commit
This commit is contained in:
@@ -1,15 +1,25 @@
|
|||||||
package io.v.nutz.wakershome.controller.review;
|
package io.v.nutz.wakershome.controller.review;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
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.annontation.ViReturn;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.modules.models.PageForm;
|
import io.v.nutz.modules.models.PageForm;
|
||||||
import io.v.nutz.util.ShiroUtil;
|
import io.v.nutz.util.ShiroUtil;
|
||||||
|
import io.v.nutz.wakershome.model.review.CommentBz;
|
||||||
|
import io.v.nutz.wakershome.model.review.CommentNr;
|
||||||
|
import io.v.nutz.wakershome.model.review.CommentPeo;
|
||||||
import io.v.nutz.wakershome.model.review.CommentZb;
|
import io.v.nutz.wakershome.model.review.CommentZb;
|
||||||
import io.v.nutz.wakershome.service.review.CommentPeoService;
|
import io.v.nutz.wakershome.service.review.CommentPeoService;
|
||||||
import io.v.nutz.wakershome.service.review.CommentZbService;
|
import io.v.nutz.wakershome.service.review.CommentZbService;
|
||||||
|
import io.v.nutz.web.commons.base.Globals;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.ddr.poi.html.HtmlRenderPolicy;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||||
@@ -21,6 +31,13 @@ import org.nutz.mvc.annotation.At;
|
|||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
import org.nutz.mvc.annotation.Param;
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName statisticsController
|
* @ClassName statisticsController
|
||||||
* @Description TODO
|
* @Description TODO
|
||||||
@@ -92,7 +109,6 @@ public class StatisticsZpController {
|
|||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
peo.*,
|
peo.*,
|
||||||
u.username userName,
|
|
||||||
u.loginname loginName,
|
u.loginname loginName,
|
||||||
unitname unitName
|
unitname unitName
|
||||||
FROM
|
FROM
|
||||||
@@ -142,4 +158,58 @@ public class StatisticsZpController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
public void doDownLoad(String zbId, String unionId, HttpServletResponse response) {
|
||||||
|
CommentPeo peo = commentZbService.dao().fetch(CommentPeo.class, Cnd.where("unionId", "=", unionId).and("zbId", "=", zbId));
|
||||||
|
NutMap map = commentPeoService.getBzById(peo.getId());
|
||||||
|
//最后的导出表
|
||||||
|
NutMap resultMap = NutMap.NEW();
|
||||||
|
|
||||||
|
List<NutMap> list = new ArrayList<>();
|
||||||
|
resultMap.put("schoolName", Globals.schoolName);
|
||||||
|
|
||||||
|
CommentZb khzb = map.getAs("zbxx", CommentZb.class);
|
||||||
|
List<CommentNr> nrs = khzb.getNrs();
|
||||||
|
|
||||||
|
nrs.forEach(v -> {
|
||||||
|
NutMap nutMap = NutMap.NEW();
|
||||||
|
List<CommentBz> bzs = v.getBzs();
|
||||||
|
String nr = bzs.stream().sorted(Comparator.comparing(CommentBz::getContentNumber)).map(item -> {
|
||||||
|
return item.getContentNumber() + "." + item.getInspection() + "(" + item.getScore() + "分)";
|
||||||
|
}).collect(Collectors.joining("<br/>"));
|
||||||
|
|
||||||
|
int jf = bzs.stream().mapToInt(item -> Integer.parseInt(item.getScore())).sum();
|
||||||
|
int zpf = bzs.stream().mapToInt(item -> Integer.parseInt(item.getResultScore())).sum();
|
||||||
|
CommentBz commentBz = bzs.stream().findFirst().orElse(new CommentBz());
|
||||||
|
|
||||||
|
nutMap.put("xh", Convert.numberToChinese(Double.parseDouble(v.getContentNumber()), false));
|
||||||
|
nutMap.put("zb", v.getContent());
|
||||||
|
nutMap.put("nr", nr);
|
||||||
|
nutMap.put("jf", jf);
|
||||||
|
nutMap.put("zpf", zpf);
|
||||||
|
nutMap.put("bz", commentBz.getOptions());
|
||||||
|
list.add(nutMap);
|
||||||
|
});
|
||||||
|
|
||||||
|
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||||
|
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
||||||
|
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
|
||||||
|
|
||||||
|
Configure config = Configure.newBuilder().bind("list", policy)
|
||||||
|
.bind("list.nr", htmlRenderPolicy).build();
|
||||||
|
resultMap.put("list", list);
|
||||||
|
String fileName = Globals.schoolName + "“模范教工小家”评分标准";
|
||||||
|
try {
|
||||||
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||||
|
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/WakesHome.docx");
|
||||||
|
XWPFTemplate.compile(inputStream, config).render(resultMap, response.getOutputStream());
|
||||||
|
inputStream.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import io.v.nutz.base.utils.Vi;
|
|||||||
import io.v.nutz.dao.CndPlus;
|
import io.v.nutz.dao.CndPlus;
|
||||||
import io.v.nutz.modules.models.PageForm;
|
import io.v.nutz.modules.models.PageForm;
|
||||||
import io.v.nutz.sys.models.Sys_union;
|
import io.v.nutz.sys.models.Sys_union;
|
||||||
|
import io.v.nutz.sys.models.User;
|
||||||
import io.v.nutz.wakershome.model.review.CommentBz;
|
import io.v.nutz.wakershome.model.review.CommentBz;
|
||||||
import io.v.nutz.wakershome.model.review.CommentPeo;
|
import io.v.nutz.wakershome.model.review.CommentPeo;
|
||||||
import io.v.nutz.wakershome.model.review.CommentResult;
|
import io.v.nutz.wakershome.model.review.CommentResult;
|
||||||
@@ -148,7 +149,7 @@ public class MWakesHomeReviewController {
|
|||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Object doSubmit(WakesHomeVo wakesHomeVo) {
|
public Object doSubmit(WakesHomeVo wakesHomeVo) {
|
||||||
try {
|
try {
|
||||||
System.out.println(wakesHomeVo);
|
User user = baseService.dao().fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUser()));
|
||||||
CommentPeo peo = new CommentPeo();
|
CommentPeo peo = new CommentPeo();
|
||||||
if (Strings.isNotBlank(wakesHomeVo.getEvaluatedPersonId())) {
|
if (Strings.isNotBlank(wakesHomeVo.getEvaluatedPersonId())) {
|
||||||
peo.setEvaluatedPersonId(wakesHomeVo.getEvaluatedPersonId());
|
peo.setEvaluatedPersonId(wakesHomeVo.getEvaluatedPersonId());
|
||||||
@@ -159,7 +160,10 @@ public class MWakesHomeReviewController {
|
|||||||
peo.setZbId(wakesHomeVo.getId());
|
peo.setZbId(wakesHomeVo.getId());
|
||||||
peo.setReviewTime(DateUtil.now());
|
peo.setReviewTime(DateUtil.now());
|
||||||
peo.setFiles(wakesHomeVo.getFiles());
|
peo.setFiles(wakesHomeVo.getFiles());
|
||||||
peo.setUserId((String) ShiroUtil.getPrincipalProperty("id"));
|
peo.setUserId(user.getId());
|
||||||
|
peo.setUserName(user.getUsername());
|
||||||
|
peo.setUnionId(user.getUnionid());
|
||||||
|
peo.setUnionName(user.getUnionname());
|
||||||
if (Strings.isNotBlank(wakesHomeVo.getPresidentOpinions())) {
|
if (Strings.isNotBlank(wakesHomeVo.getPresidentOpinions())) {
|
||||||
peo.setPresidentOpinions(wakesHomeVo.getPresidentOpinions());
|
peo.setPresidentOpinions(wakesHomeVo.getPresidentOpinions());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,25 @@ public class CommentPeo {
|
|||||||
@Prev(els = {@EL("uuid()")})
|
@Prev(els = {@EL("uuid()")})
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("测评人")
|
@Comment("测评人")
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("测评人姓名")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("测评人工会id")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String unionId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("测评人工会名称")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||||
|
private String unionName;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("被测评人id")
|
@Comment("被测评人id")
|
||||||
|
|||||||
Binary file not shown.
@@ -83,7 +83,7 @@ layout("/layouts/platform.html"){
|
|||||||
fixed="right">
|
fixed="right">
|
||||||
<template scope="{row}">
|
<template scope="{row}">
|
||||||
<el-button size="mini" @click="openView(row)">查看</el-button>
|
<el-button size="mini" @click="openView(row)">查看</el-button>
|
||||||
<el-button v-if="canDownload()" size="mini" type="primary" @click="openView(row)">查看</el-button>
|
<el-button v-if="canDownload" size="mini" type="primary" @click="doDownLoad(row)">导出</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -246,6 +246,9 @@ layout("/layouts/platform.html"){
|
|||||||
'wakes-home-review': httpVueLoader('/components/wakeshome/review/ReviewResult.vue?v=' + moment(new Date()).unix()),
|
'wakes-home-review': httpVueLoader('/components/wakeshome/review/ReviewResult.vue?v=' + moment(new Date()).unix()),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
doDownLoad(row){
|
||||||
|
window.open(loc() + '/doDownLoad?zbId=' + this.pageForm.zbId + '&unionId=' + row.id)
|
||||||
|
},
|
||||||
async getReviewResultNum(row) {
|
async getReviewResultNum(row) {
|
||||||
const res = await $.post(loc() + "/getReviewResultNum", {
|
const res = await $.post(loc() + "/getReviewResultNum", {
|
||||||
zbId: this.userPageForm.zbId,
|
zbId: this.userPageForm.zbId,
|
||||||
@@ -254,8 +257,6 @@ layout("/layouts/platform.html"){
|
|||||||
this.reviewResultData = res.data
|
this.reviewResultData = res.data
|
||||||
},
|
},
|
||||||
async openUserView(row) {
|
async openUserView(row) {
|
||||||
// const res = await $.post(loc() + "/getBzById", {peoId: row.id})
|
|
||||||
// this.zpxx = res.data
|
|
||||||
this.userDrawer = true
|
this.userDrawer = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.wakesHomeReview.findOne(row.id)
|
this.$refs.wakesHomeReview.findOne(row.id)
|
||||||
@@ -309,6 +310,12 @@ layout("/layouts/platform.html"){
|
|||||||
this.doSearch()
|
this.doSearch()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
canDownload() {
|
||||||
|
const data = this.zbList.find(v=> v.id === this.pageForm.zbId)
|
||||||
|
return data.commentTarget===3 && data.unionIds
|
||||||
|
}
|
||||||
|
},
|
||||||
async created() {
|
async created() {
|
||||||
await this.getZbList()
|
await this.getZbList()
|
||||||
this.unions = await getUnions(null)
|
this.unions = await getUnions(null)
|
||||||
|
|||||||
Reference in New Issue
Block a user