init
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package io.v.nutz.zhgh.unioncomment.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentNr;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentZb;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentZbService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
/**
|
||||
* @ClassName addZbController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 15:42
|
||||
*/
|
||||
@At("/platform/unionComment/Xjkhzb")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class addZbController {
|
||||
@At("")
|
||||
@Ok("beetl:/platform/unionComment/xjkhzb.html")
|
||||
@RequiresPermissions("unionComment.Xjkhzb")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private CommentZbService commentZbService;
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.Xjkhzb")
|
||||
public Object doAdd(@Param(value = "kh_zb") CommentZb commentZb) {
|
||||
Trans.exec(() -> {
|
||||
CommentZb zb = commentZbService.insert(commentZb);
|
||||
for (CommentNr nr : commentZb.getNrs()) {
|
||||
nr.setZb_id(zb.getId());
|
||||
commentZbService.insertWith(nr, "bzs");
|
||||
}
|
||||
});
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getZbList(Integer year) {
|
||||
return commentZbService.query(Cnd.NEW().andEX("annual", "=", year));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package io.v.nutz.zhgh.unioncomment.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentExport;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentZb;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentZbService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.ddr.poi.html.HtmlRenderPolicy;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName exportZpController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/6 17:09
|
||||
*/
|
||||
@At("/platform/unionComment/exportZp")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class exportZpController {
|
||||
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
@Inject
|
||||
private CommentZbService zbService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/unionComment/exportZp.html")
|
||||
@RequiresPermissions("unionComment.exportZp")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.exportZp")
|
||||
public Object pageData(@Param(value = "annual", required = false) Integer annual,
|
||||
int pageNumber, int pageSize) {
|
||||
Sql sql = Sqls.create("SELECT YEAR(e.createTime) annual,e.* FROM `comment_export` e $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(e.createTime)", "=", annual);
|
||||
sql.setCondition(cnd);
|
||||
return zbService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.exportZp")
|
||||
public Object getZbData(@Param(value = "annual", required = false) String annual,
|
||||
@Param(value = "assessment", required = false) String assessment) {
|
||||
Sql sql = Sqls.create("SELECT * FROM `comment_zb` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(annual) && Strings.isNotBlank(annual)) {
|
||||
cnd.and("annual", "=", annual);
|
||||
}
|
||||
if (Strings.isNotBlank(assessment) && Strings.isNotBlank(assessment)) {
|
||||
cnd.where().andLike("assessment", assessment);
|
||||
} else {
|
||||
cnd.desc("annual");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return zbService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.exportZp")
|
||||
public Object doAddExport(@Param("export") CommentExport export) {
|
||||
export.setCreateTime(DateUtil.now());
|
||||
if (StrUtil.isNotBlank(export.getId())) {
|
||||
zbService.updateIgnoreNull(export);
|
||||
} else {
|
||||
zbService.insert(export);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.exportZp")
|
||||
public Object doDelete(String id) {
|
||||
zbService.dao().delete(CommentExport.class, id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.exportZp")
|
||||
public Object findOne(String id) {
|
||||
CommentExport export = zbService.dao().fetch(CommentExport.class, id);
|
||||
List<CommentZb> zbList = zbService.query(Cnd.NEW().and("id", "in", export.getZbIds()).asc("assessmentMode"));
|
||||
return Map.of("export", export, "zbList", zbList);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("unionComment.exportZp")
|
||||
public void doExport(String id, HttpServletResponse response) throws Exception {
|
||||
CommentExport export = zbService.dao().fetch(CommentExport.class, id);
|
||||
//查询测评有那几个工会测评过
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unionname unionName,
|
||||
count( peo.id ) num
|
||||
FROM
|
||||
sys_union un
|
||||
LEFT JOIN `user` u ON u.unionId = un.id
|
||||
LEFT JOIN comment_peo peo ON peo.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("peo.zbId", "in", export.getZbIds());
|
||||
cnd.groupBy("un.id");
|
||||
cnd.desc("count( peo.id )");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> unionMap = zbService.listMap(sql);
|
||||
|
||||
|
||||
List<CommentZb> zbs = zbService.query(Cnd.NEW().and("id", "in", export.getZbIds()).asc("assessmentMode"));
|
||||
|
||||
//创建临时文件夹
|
||||
Path templateDir = Files.createTempDirectory("评测结果文件夹");
|
||||
|
||||
//循环分工会
|
||||
for (NutMap un : unionMap) {
|
||||
List<User> users = zbService.dao().query(User.class, Cnd.where("unionId", "=", un.getString("id")));
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(templateDir.toString() + "/" + un.getString("unionName") + "基层工会会员评家民主测评结果报告表.docx");
|
||||
|
||||
List<NutMap> zpxxList = new ArrayList<>();
|
||||
for (CommentZb zb : zbs) {
|
||||
|
||||
Sql sqlps = Sqls.create("""
|
||||
SELECT
|
||||
SUM( CASE WHEN cp.reviewResult = '不满意' THEN 1 ELSE 0 END ) AS bmy,
|
||||
SUM( CASE WHEN cp.reviewResult = '基本满意' THEN 1 ELSE 0 END ) AS jbmy,
|
||||
SUM( CASE WHEN cp.reviewResult = '满意' THEN 1 ELSE 0 END ) AS my
|
||||
FROM
|
||||
comment_peo cp
|
||||
LEFT JOIN `user` u ON u.id = cp.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cndPs = Cnd.NEW();
|
||||
cndPs.and("u.unionId", "=", un.getString("id"));
|
||||
cndPs.and("cp.zbId", "=", zb.getId());
|
||||
|
||||
sqlps.setCondition(cndPs);
|
||||
if (zb.getAssessmentMode() == 1) {
|
||||
NutMap zpxx = new NutMap();
|
||||
NutMap psMap = zbService.fetch(sqlps);
|
||||
zpxx.setv("pcdx", "工会工作及职工之家建设情况测评");
|
||||
zpxx.setv("my", psMap.getInt("my"));
|
||||
zpxx.setv("jbmy", psMap.getInt("jbmy"));
|
||||
zpxx.setv("bmy", psMap.getInt("bmy"));
|
||||
zpxxList.add(zpxx);
|
||||
} else {
|
||||
NutMap zpxxZx = new NutMap();
|
||||
Cnd clone = cndPs.clone();
|
||||
sqlps.setCondition(clone);
|
||||
clone.and("cp.evaluatedPersonType", "=", "分工会主席");
|
||||
NutMap psMap = zbService.fetch(sqlps);
|
||||
zpxxZx.setv("pcdx", "工会主席履职情况测评");
|
||||
zpxxZx.setv("my", psMap.getInt("my"));
|
||||
zpxxZx.setv("jbmy", psMap.getInt("jbmy"));
|
||||
zpxxZx.setv("bmy", psMap.getInt("bmy"));
|
||||
zpxxList.add(zpxxZx);
|
||||
|
||||
|
||||
NutMap zpxxFzx = new NutMap();
|
||||
Cnd clone2 = cndPs.clone();
|
||||
clone2.and("cp.evaluatedPersonType", "=", "分工会副主席");
|
||||
sqlps.setCondition(clone2);
|
||||
NutMap psMap2 = zbService.fetch(sqlps);
|
||||
zpxxFzx.setv("pcdx", "工会副主席履职情况测评");
|
||||
zpxxFzx.setv("my", psMap2.getInt("my"));
|
||||
zpxxFzx.setv("jbmy", psMap2.getInt("jbmy"));
|
||||
zpxxFzx.setv("bmy", psMap2.getInt("bmy"));
|
||||
zpxxList.add(zpxxFzx);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
||||
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
|
||||
|
||||
Configure config = Configure.newBuilder().bind("zpxxList", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
map.put("zpxxList", zpxxList);
|
||||
map.put("unionName", un.getString("unionName"));
|
||||
map.put("num", users.size());
|
||||
map.put("memberNum", users.stream().filter(v -> v.getMember() == 1).collect(Collectors.toList()).size());
|
||||
XWPFTemplate.compile(officeTemplateUtil.getPath("unionComment"), config).render(map).writeAndClose(outputStream);
|
||||
|
||||
outputStream.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//压缩
|
||||
File zipFile = ZipUtil.zip(templateDir.toString());
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode(zipFile.getName(), "UTF-8"));
|
||||
try (ServletOutputStream outputStream = response.getOutputStream();
|
||||
FileInputStream zipFis = new FileInputStream(zipFile);) {
|
||||
IOUtils.copy(zipFis, outputStream);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
FileUtil.del(templateDir);
|
||||
FileUtil.del(zipFile);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package io.v.nutz.zhgh.unioncomment.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentBzService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentNrService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentPeoService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentZbService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
/**
|
||||
* @ClassName statisticsController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/5 15:58
|
||||
*/
|
||||
@At("/platform/unionComment/statisticsZp")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class statisticsZpController {
|
||||
|
||||
@Inject
|
||||
private CommentZbService commentZbService;
|
||||
|
||||
@Inject
|
||||
private CommentNrService commentNrService;
|
||||
|
||||
@Inject
|
||||
private CommentBzService commentBzService;
|
||||
|
||||
@Inject
|
||||
private CommentPeoService commentPeoService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/unionComment/statistics.html")
|
||||
@RequiresPermissions("unionComment.statistics")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.statistics")
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "zbId", required = false) String zbId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.id,
|
||||
un.unionname unionName,
|
||||
count( peo.id ) num
|
||||
FROM
|
||||
sys_union un
|
||||
LEFT JOIN `user` u ON u.unionId = un.id
|
||||
LEFT JOIN comment_peo peo ON peo.userId = u.id AND peo.zbId = @zbId
|
||||
$condition
|
||||
""").setParam("zbId", zbId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("un.id", "=", unionId);
|
||||
|
||||
cnd.groupBy("un.id");
|
||||
cnd.desc("count( peo.id )");
|
||||
sql.setCondition(cnd);
|
||||
return commentZbService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUserPeoByZbIdOrUnionId(PageForm page,
|
||||
@Param(value = "zbId", required = false) String zbId,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "reviewResult", required = false) String reviewResult) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
peo.*,
|
||||
u.username userName,
|
||||
u.loginname loginName,
|
||||
unitname unitName
|
||||
FROM
|
||||
comment_peo peo
|
||||
LEFT JOIN `user` u ON u.id = peo.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("peo.zbId", "=", zbId);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
cnd.andEX("peo.reviewResult", "=", reviewResult);
|
||||
if (StrUtil.isNotBlank(page.getSearchKeyword())) {
|
||||
SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup();
|
||||
sqlExpressionGroup.orLike("u.loginname", page.getSearchKeyword());
|
||||
sqlExpressionGroup.orLike("u.username", page.getSearchKeyword());
|
||||
cnd.and(sqlExpressionGroup);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return commentZbService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getBzById(String peoId) {
|
||||
return commentPeoService.getBzById(peoId);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getReviewResultNum(@Param(value = "zbId", required = false) String zbId,
|
||||
@Param(value = "unionId", required = false) String unionId) {
|
||||
NutMap mapList = commentPeoService.fetch(Sqls.create("""
|
||||
SELECT
|
||||
SUM( CASE WHEN cp.reviewResult = '不满意' THEN 1 ELSE 0 END ) AS bmy,
|
||||
SUM( CASE WHEN cp.reviewResult = '基本满意' THEN 1 ELSE 0 END ) AS jbmy,
|
||||
SUM( CASE WHEN cp.reviewResult = '满意' THEN 1 ELSE 0 END ) AS my
|
||||
FROM
|
||||
comment_peo cp
|
||||
LEFT JOIN `user` u ON u.id = cp.userId
|
||||
WHERE
|
||||
cp.zbId = @zbId
|
||||
AND u.unionId = @unionId
|
||||
""").setParam("zbId", zbId).setParam("unionId", unionId));
|
||||
|
||||
return mapList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package io.v.nutz.zhgh.unioncomment.controller;
|
||||
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentNr;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentZb;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentBzService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentNrService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentZbService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName viewZbController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 16:00
|
||||
*/
|
||||
@At("/platform/unionComment/viewZb")
|
||||
@Ok("json:full")
|
||||
@IocBean
|
||||
public class viewZbController {
|
||||
|
||||
|
||||
@Inject
|
||||
private CommentZbService commentZbService;
|
||||
|
||||
@Inject
|
||||
private CommentNrService commentNrService;
|
||||
|
||||
@Inject
|
||||
private CommentBzService commentBzService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/unionComment/khzb.html")
|
||||
@RequiresPermissions("unionComment.khzb")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.khzb")
|
||||
public Object pageData(@Param(value = "annual", required = false) String annual,
|
||||
@Param(value = "assessment", required = false) String assessment,
|
||||
int pageNumber, int pageSize) {
|
||||
Sql sql = Sqls.create("SELECT * FROM `comment_zb` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(annual) && Strings.isNotBlank(annual)) {
|
||||
cnd.and("annual", "=", annual);
|
||||
}
|
||||
if (Strings.isNotBlank(assessment) && Strings.isNotBlank(assessment)) {
|
||||
cnd.where().andLike("assessment", assessment);
|
||||
} else {
|
||||
cnd.desc("annual");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return commentZbService.listPageMap(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("unionComment.khzb")
|
||||
public Object delete(String id) {
|
||||
|
||||
commentZbService.delete(id);
|
||||
|
||||
List<CommentNr> query = commentNrService.query(Cnd.where("zb_id", "=", id));
|
||||
|
||||
for (CommentNr kh_nr : query) {
|
||||
commentBzService.clear(Cnd.where("nr_id", "=", kh_nr.getId()));
|
||||
}
|
||||
|
||||
commentNrService.clear(Cnd.where("zb_id", "=", id));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object edit(String id) {
|
||||
return commentZbService.khzb(id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("unionComment.khzb")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object doEdit(@Param(value = "kh_zb") CommentZb commentZb) {
|
||||
commentZbService.updateIgnoreNull(commentZb);
|
||||
|
||||
List<CommentNr> query = commentNrService.query(Cnd.where("zb_id", "=", commentZb.getId()));
|
||||
|
||||
for (CommentNr kh_nr : query) {
|
||||
commentBzService.clear(Cnd.where("nr_id", "=", kh_nr.getId()));
|
||||
}
|
||||
|
||||
commentNrService.clear(Cnd.where("zb_id", "=", commentZb.getId()));
|
||||
|
||||
for (CommentNr nr : commentZb.getNrs()) {
|
||||
nr.setZb_id(commentZb.getId());
|
||||
commentNrService.insertWith(nr, "bzs");
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package io.v.nutz.zhgh.unioncomment.model;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @ClassName CommentBz
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 16:24
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class CommentBz extends BaseModel {
|
||||
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("CommentNr表的id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String nr_id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("考核标准")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String inspection;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("是否启用佐证材料")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean isEvidence;
|
||||
|
||||
@Column
|
||||
@Comment("标准分")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String score;
|
||||
|
||||
@Column
|
||||
@Comment("单项得分")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String single_score;
|
||||
|
||||
@Column
|
||||
@Comment("自评能否超过最高分")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean beyondHighestScore;
|
||||
|
||||
@Column
|
||||
@Comment("关联模块")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
private String associatedModule;
|
||||
|
||||
@Column
|
||||
@Comment("标准标识")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
private String bz_relation_id;
|
||||
|
||||
@Column
|
||||
@Comment("CommentZb表的id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String zb_id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("题号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String contentNumber;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM comment_bz"),
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
@Column
|
||||
@Comment("能否删除该项")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean canDelete;
|
||||
|
||||
@One(field = "nr_id",key = "id")
|
||||
private CommentNr nr;
|
||||
|
||||
private String resultScore;
|
||||
|
||||
private String options;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package io.v.nutz.zhgh.unioncomment.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CommentExport
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/7 15:19
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class CommentExport {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("导出的名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String exportName;
|
||||
|
||||
@Column
|
||||
@Comment("zbids")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> zbIds;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package io.v.nutz.zhgh.unioncomment.model;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CommentNr
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 16:13
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class CommentNr extends BaseModel {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("考核内容")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String content;
|
||||
|
||||
@Column
|
||||
@Comment("题号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String contentNumber;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("CommentZb表的id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String zb_id;
|
||||
|
||||
@One(field = "zb_id",key = "id")
|
||||
private CommentZb zb;
|
||||
|
||||
@Many(field = "nr_id")
|
||||
private List<CommentBz> bzs;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db= DB.MYSQL,value = "SELECT IFNULL(MAX(location),0)+1 FROM comment_nr"),
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package io.v.nutz.zhgh.unioncomment.model;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Table
|
||||
public class CommentPeo {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("测评人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("被测评人id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String evaluatedPersonId;
|
||||
|
||||
@Column
|
||||
@Comment("被测评人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String evaluatedPersonName;
|
||||
|
||||
@Column
|
||||
@Comment("被测评人职务(主席/副主席)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String evaluatedPersonType;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("指标id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String zbId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("主席测评意见")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String presidentOpinions;
|
||||
|
||||
@Column
|
||||
@Comment("评测结果")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 10)
|
||||
private String reviewResult;
|
||||
|
||||
@Column
|
||||
@Comment("测评时间")
|
||||
@ColDefine(type = ColType.VARCHAR,width = 20)
|
||||
private String reviewTime;
|
||||
|
||||
|
||||
@Many(field = "peo_id")
|
||||
private List<CommentResult> resultList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package io.v.nutz.zhgh.unioncomment.model;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
@Data
|
||||
@Table
|
||||
public class CommentResult {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("CommentPeo表的id(测评人表id)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String peo_id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("CommentBz表的id(测评标准id)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String bz_id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("测评分数/满意度")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String assessResult;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("会员评家意见或建议")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String recommendation;
|
||||
|
||||
|
||||
@One(field = "peo_id",key = "id")
|
||||
private CommentPeo peo;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package io.v.nutz.zhgh.unioncomment.model;
|
||||
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CommentZb
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 15:39
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
public class CommentZb extends BaseModel {
|
||||
|
||||
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("年度")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String annual;
|
||||
|
||||
@Column
|
||||
@Comment("考核名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String assessment;
|
||||
|
||||
@Column
|
||||
@Comment("添加时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String addTime;
|
||||
|
||||
@Column
|
||||
@Comment("考核模式(1.工会评家2.主席评家)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer assessmentMode;
|
||||
|
||||
@Column
|
||||
@Comment("可报名范围组别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("测评对象(1.校工会2.分工会)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer commentTarget;
|
||||
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("打分模式(1.评分模式2.选择满意不满意模式)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer scoringMode;
|
||||
|
||||
|
||||
@Many(field = "zb_id")
|
||||
private List<CommentNr> nrs;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db= DB.MYSQL,value = "SELECT IFNULL(MAX(location),0)+1 FROM comment_zb"),
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service;
|
||||
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentBz;
|
||||
|
||||
public interface CommentBzService extends ViService<CommentBz> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service;
|
||||
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentNr;
|
||||
|
||||
public interface CommentNrService extends ViService<CommentNr> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service;
|
||||
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentPeo;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
public interface CommentPeoService extends ViService<CommentPeo> {
|
||||
|
||||
/**
|
||||
* 根据指标id和被测评人id查测评结果
|
||||
* @param peoId 指标id
|
||||
* @return
|
||||
*/
|
||||
NutMap getBzById(String peoId);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service;
|
||||
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentZb;
|
||||
|
||||
public interface CommentZbService extends ViService<CommentZb> {
|
||||
|
||||
|
||||
CommentZb khzb(String zbid);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service.impl;
|
||||
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentBz;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentBzService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName CommentBzServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 16:30
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class CommentBzServiceImpl extends ViServiceImpl<CommentBz> implements CommentBzService {
|
||||
public CommentBzServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service.impl;
|
||||
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentNr;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentNrService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* @ClassName CommentNrServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 16:28
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class CommentNrServiceImpl extends ViServiceImpl<CommentNr> implements CommentNrService {
|
||||
public CommentNrServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service.impl;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentNr;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentPeo;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentResult;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentZb;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentPeoService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentZbService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class CommentPeoServiceImpl extends ViServiceImpl<CommentPeo> implements CommentPeoService {
|
||||
|
||||
public CommentPeoServiceImpl(Dao dao) {super(dao);}
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private CommentZbService commentZbService;
|
||||
|
||||
/**
|
||||
* 获取测评结果信息
|
||||
* @param peoId 指标id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public NutMap getBzById(String peoId) {
|
||||
CommentPeo commentPeo = fetch(peoId);
|
||||
List<CommentResult> query = baseService.dao().query(CommentResult.class, Cnd.where("peo_id","=",peoId));
|
||||
//对测评标准分组
|
||||
Map<String, CommentResult> commentResultMap = query.stream().collect(Collectors.toMap(v -> v.getBz_id(), v -> v));
|
||||
//获取指标
|
||||
CommentZb khzb = commentZbService.khzb(commentPeo.getZbId());
|
||||
List<CommentNr> nrs = khzb.getNrs();
|
||||
nrs.forEach(v->{
|
||||
v.getBzs().forEach(o->{
|
||||
//赋值测评结果
|
||||
CommentResult result = commentResultMap.get(o.getId());
|
||||
o.setOptions(result.getRecommendation());
|
||||
o.setResultScore(result.getAssessResult());
|
||||
});
|
||||
});
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("zbxx",khzb);
|
||||
nutMap.setv("commentPeo",commentPeo);
|
||||
return nutMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package io.v.nutz.zhgh.unioncomment.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentNr;
|
||||
import io.v.nutz.zhgh.unioncomment.model.CommentZb;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentNrService;
|
||||
import io.v.nutz.zhgh.unioncomment.service.CommentZbService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CommentZbServiceImpl
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2023/9/4 15:54
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class CommentZbServiceImpl extends ViServiceImpl<CommentZb> implements CommentZbService {
|
||||
public CommentZbServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private CommentNrService commentNrService;
|
||||
|
||||
|
||||
private void setNrBz(List<CommentNr> nrs) {
|
||||
for (CommentNr nr : nrs) {
|
||||
nr = commentNrService.fetchLinks(nr, "bzs", Cnd.NEW().asc("location"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommentZb khzb(String zbid) {
|
||||
if (StrUtil.isBlank(zbid)) {
|
||||
return null;
|
||||
}
|
||||
CommentZb zb = fetchLinks(fetch(zbid), "nrs", Cnd.NEW().asc("location"));
|
||||
setNrBz(zb.getNrs());
|
||||
return zb;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user