Compare commits

...
4 Commits
5 changed files with 77 additions and 31 deletions
@@ -66,7 +66,9 @@ public class CulturalSportsBoardServiceImpl implements CulturalSportsBoardServic
private static final String FITNESS_WALK_SOURCE = "fitnessWalk";
private static final int CLOUD_PAGE_SIZE = 100;
private static final int CLOUD_AGGREGATE_PAGE_SIZE = 1000;
private static final int FITNESS_WALK_ACTIVITY_CACHE_SECONDS = 300;
//健身走活动列表缓存
private static final int FITNESS_WALK_ACTIVITY_CACHE_SECONDS = 60;
//健身走报名统计缓存
private static final int FITNESS_WALK_PARTICIPANT_CACHE_SECONDS = 60;
private static final String FITNESS_WALK_ACTIVITY_CACHE_KEY = "DataBoard:FitnessWalk:Activities";
private static final String FITNESS_WALK_PARTICIPANT_CACHE_PREFIX = "DataBoard:FitnessWalk:Participants:v2:";
@@ -13,6 +13,7 @@ import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Html2Text;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.modules.models.PageForm;
@@ -350,9 +351,16 @@ public class proposalExportNotCaseController {
for (NutMap info : infos) {
String implementUnitId = info.getString("implementUnitId");
List<String> implementUnitIds = Json.fromJsonAsList(String.class, implementUnitId);
String implementUnitName = proposalUndertakeList.stream().filter(u -> implementUnitIds.contains(u.getId())).map(u -> u.getUnitName()).collect(Collectors.joining("、"));
String implementUnitName = "";
if (StrUtil.isNotBlank(implementUnitId)) {
List<String> implementUnitIds = Json.fromJsonAsList(String.class, implementUnitId);
if (implementUnitIds != null) {
implementUnitName = proposalUndertakeList.stream().filter(u -> implementUnitIds.contains(u.getId())).map(u -> u.getUnitName()).collect(Collectors.joining("、"));
}
}
info.put("implementUnitName", implementUnitName);
info.put("brief", Html2Text.toPlainText(info.getString("brief")));
info.put("measures", Html2Text.toPlainText(info.getString("measures")));
Sql secondedSql = Sqls.create("""
SELECT
u.username s_username,
@@ -371,20 +379,21 @@ public class proposalExportNotCaseController {
info.put("schoolName", Globals.MyConfig.getString("GxName"));
HackLoopTableRenderPolicy hackLoopTableRenderPolicy = new HackLoopTableRenderPolicy();
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
Configure config = Configure.newBuilder()
.bind("secondedList", hackLoopTableRenderPolicy)
.bind("brief", htmlRenderPolicy)
.bind("measures", htmlRenderPolicy)
.build();
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/proposal/proposalSH.docx");
String docxName = info.getString("proposalCode") + "-" + info.getString("proposalName") + ".docx";
Path docFile = Files.createFile(proposalSHPath.resolve(docxName));
String docxBaseName = (info.getString("proposalCode") + "-" + info.getString("proposalName"))
.replaceAll("[/\\\\:*?\"<>|]", "_");
Path docFile = proposalSHPath.resolve(docxBaseName + ".docx");
if (Files.exists(docFile)) {
docFile = proposalSHPath.resolve(docxBaseName + "-" + info.getString("id") + ".docx");
}
Files.createFile(docFile);
XWPFTemplate.compile(inputStream, config).render(info).writeToFile(docFile.toString());
}
@@ -30,6 +30,7 @@ import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
@@ -229,6 +230,16 @@ public class ProposalInfoServiceImpl extends ViServiceImpl<ProposalInfo> impleme
NutMap nutMap = proposalInfoService.fetch(sql);
String implementUnitId = nutMap.getString("implementUnitId");
String implementUnitName = "";
if (StrUtil.isNotBlank(implementUnitId)) {
List<String> implementUnitIds = Json.fromJsonAsList(String.class, implementUnitId);
if (implementUnitIds != null && !implementUnitIds.isEmpty()) {
List<ProposalUndertake> implementUnitList = proposalInfoService.dao().query(ProposalUndertake.class, Cnd.where("id", "in", implementUnitIds));
implementUnitName = implementUnitList.stream().map(ProposalUndertake::getUnitName).collect(Collectors.joining("、"));
}
}
nutMap.setv("implementUnitName", implementUnitName);
// nutMap.setv("brief", Html2Text.toPlainText(nutMap.getString("brief")));
nutMap.setv("measures", HtmlUtil.cleanHtmlTag(nutMap.getString("measures")));
@@ -260,7 +260,9 @@ layout("/layouts/platform.html"){
window.URL.revokeObjectURL(url)
loading.close();
}).catch((err) => {
})
loading.close();
this.$message.error('导出失败,请稍后重试');
})
},
oneProposalExport(id) {
window.location.href = "/platform/proposal/statistics/summary/oneProposalExport?isAll=0&proposalId=" + id
@@ -354,4 +356,4 @@ layout("/layouts/platform.html"){
</script>
<!--#
}
#-->
#-->
@@ -120,6 +120,45 @@ layout("/layouts/platform.html"){
},
},
methods: {
initIntroduceEditor(content) {
$("#introduce").html("")
const editor = new E("#introduce")
editor.config.onchange = (html) => {
this.formData.introduce = html.replace(/<p\><\/p>/g, '')
}
editor.config.customUploadImg = (resultFiles, insertImgFn) => {
Promise.all(this.uploadIntroduceImages(resultFiles)).then(res => {
res.forEach(v => {
if (v.code === 0) {
insertImgFn(APP_DOMAIN + CREATE_PREVIEW_URL(v.data.filepath))
} else {
this.$message.warning(v.msg || '图片上传失败')
}
})
}).catch(() => {
this.$message.warning('图片上传失败')
})
}
editor.config.showLinkImg = true
editor.create()
if (content) {
editor.txt.html(content)
}
},
uploadIntroduceImages(resultFiles) {
return resultFiles.map(file => {
const formData = new FormData()
formData.append('file', file, file.name)
formData.append('folderPath', '/wangEditorImg/')
return jQuery.ajax({
url: '/file_server/uploadFile',
type: 'post',
data: formData,
processData: false,
contentType: false
})
})
},
openUserScope() {
this.userScopeDialog = true
},
@@ -491,23 +530,12 @@ layout("/layouts/platform.html"){
const type = this.trainTypeList.find(o => o.code === this.formData.trainType)
this.trainType = type ? type.name : '培训班'
this.$nextTick(() => {
$("#introduce").html("")
var editor = new E("#introduce")
editor.config.onchange = (html) => {
this.formData.introduce = html.replace(/<p\><\/p>/g, '')
}
editor.create()
editor.txt.html(resp.data.introduce)
this.initIntroduceEditor(resp.data.introduce)
})
}
} else {
this.$nextTick(() => {
$("#introduce").html("")
var editor = new E("#introduce")
editor.config.onchange = (html) => {
this.formData.introduce = html.replace(/<p\><\/p>/g, '')
}
editor.create()
this.initIntroduceEditor()
})
}
},
@@ -684,13 +712,7 @@ layout("/layouts/platform.html"){
const type = this.trainTypeList.find(o => o.code === this.formData.trainType)
this.trainType = type ? type.name : '培训班'
this.$nextTick(() => {
$("#introduce").html("")
var editor = new E("#introduce")
editor.config.onchange = (html) => {
this.formData.introduce = html.replace(/<p\><\/p>/g, '')
}
editor.create()
editor.txt.html(resp.data.introduce)
this.initIntroduceEditor(resp.data.introduce)
})
this.formData.id = ''
}