diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..3dc0817 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,14 @@ +{ + "printWidth": 150, + "singleQuote": false, + "tabWidth": 4, + "semi": false, + "trailingComma": "none", + "bracketSpacing": true, + "arrowParens": "always", + "rangeStart": 0, + "htmlWhitespaceSensitivity": "ignore", + "vueIndentScriptAndStyle": false, + "endOfLine": "auto", + "useTabs": false +} diff --git a/pom.xml b/pom.xml index 60ccc40..2359588 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 1.6.2 3.8.1 4.0.0 - 1.11.2 + 1.12.1 2.5.1 4.1.2 4.0.11 @@ -45,13 +45,11 @@ asm-util 7.3.1 - asm asm-all 2.1 - org.openjdk.nashorn nashorn-core @@ -73,47 +71,47 @@ 0.3.17 - javax.mail - mail - 1.4.7 - - - org.apache.poi - poi - ${poi.version} - - - org.apache.poi - poi-ooxml - ${poi.version} - - - org.apache.poi - ooxml-schemas - 1.3 - - - xmlbeans - org.apache.xmlbeans - - + org.jetbrains.kotlin + kotlin-stdlib + 1.4.32 com.artofsolving jodconverter 2.2.2 - - - jurt - org.openoffice - - javax.annotation javax.annotation-api 1.3.2 + + org.codehaus.xfire + xfire-all + 1.2.6 + + + spring + org.springframework + + + xfire-spring + org.codehaus.xfire + + + xercesImpl + xerces + + + stax-api + stax + + + xfire-xmlbeans + org.codehaus.xfire + + + cn.hutool hutool-all @@ -170,13 +168,6 @@ thumbnailator 0.4.8 - - - - - - - io.v vi-nutz @@ -202,6 +193,18 @@ juh org.openoffice + + poi + org.apache.poi + + + poi-ooxml + org.apache.poi + + + poi-ooxml-schemas + org.apache.poi + ridl org.openoffice @@ -214,22 +217,6 @@ unoil org.openoffice - - xmlbeans - org.apache.xmlbeans - - - commons-io - commons-io - - - spring-aop - org.springframework - - - org.apache.poi - ooxml-schemas - @@ -251,11 +238,21 @@ com.squareup.okhttp3 okhttp 4.8.0 + + + kotlin-stdlib + org.jetbrains.kotlin + + + kotlin-stdlib-common + org.jetbrains.kotlin + + org.apache.httpcomponents httpclient - 4.5.13 + 4.3.5 commons-codec @@ -277,10 +274,6 @@ commons-logging commons-logging - - commons-beanutils - commons-beanutils - @@ -293,6 +286,10 @@ commons-logging commons-logging + + okhttp + com.squareup.okhttp + okio com.squareup.okio @@ -322,7 +319,7 @@ - + org.jsoup jsoup @@ -362,7 +359,32 @@ - + + org.apache.poi + poi + ${poi.version} + + + org.apache.poi + poi-ooxml + ${poi.version} + + + org.apache.poi + poi-ooxml-schemas + ${poi.version} + + + org.apache.poi + ooxml-schemas + 1.3 + + + xmlbeans + org.apache.xmlbeans + + + org.nutz nutzboot-starter-test-junit4 @@ -401,11 +423,11 @@ ${easy-captcha.version} - - commons-validator - commons-validator - 1.7 - + + + + + diff --git a/src/main/java/io/v/nutz/hd/controller/ca/HdChildAddZpController.java b/src/main/java/io/v/nutz/hd/controller/ca/HdChildAddZpController.java index 2603212..5d867e0 100644 --- a/src/main/java/io/v/nutz/hd/controller/ca/HdChildAddZpController.java +++ b/src/main/java/io/v/nutz/hd/controller/ca/HdChildAddZpController.java @@ -4,9 +4,10 @@ package io.v.nutz.hd.controller.ca; import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.service.BaseService; import cn.wizzer.framework.page.Pagination; +import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.utils.FileService; +import io.v.nutz.base.utils.PageUtil; import io.v.nutz.base.utils.Vi; -import io.v.nutz.dao.CndPlus; import io.v.nutz.hd.models.Hd_ca_sbxx; import io.v.nutz.hd.services.*; import io.v.nutz.modules.models.PageForm; @@ -18,7 +19,6 @@ import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; import org.nutz.dao.sql.Sql; -import org.nutz.dao.util.cri.Static; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; @@ -31,15 +31,8 @@ import org.nutz.mvc.annotation.Param; import org.nutz.mvc.upload.TempFile; import org.nutz.mvc.upload.UploadAdaptor; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileInputStream; -import java.io.OutputStream; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; @IocBean @At("/platform/hd/childhd/sczp") @@ -65,6 +58,9 @@ public class HdChildAddZpController { @Inject private BaseService baseService; + @Inject + private FileService fileService; + @At("") @Ok("beetl:/platform/hd/ca/zpMange.html") @RequiresPermissions("hd.child.sczp") @@ -76,21 +72,13 @@ public class HdChildAddZpController { * 获取当前人的工会name */ @At + @RequiresPermissions("hd.child.sczp") public String getGhname() { - Sql sql = Sqls.create("SELECT\n" + - "\tgh.unionname AS ghname \n" + - "FROM\n" + - "\tsys_user u\n" + - "\tLEFT JOIN sys_unit dw ON dw.id = u.unitid\n" + - "\tLEFT JOIN sys_union gh ON gh.id = dw.unionid \n" + - "WHERE\n" + - "\tu.id = @userid"); - sql.setParam("userid", ShiroUtil.getPrincipalProperty("id")); - List list = baseService.list(sql); - return list.size() > 0 ? list.get(0).getString("ghname") : ""; + return Optional.ofNullable(Vi.getUnion()).map(v -> v.getUnionname()).orElse(null); } @At + @RequiresPermissions("hd.child.sczp") public Object initformHdxxlist() { try { Sql sql = Sqls.create("select * from hd_wm_xx where hdtype =2 and hdflag = 1 and hdkssj<=NOW() and hdjssj >=NOW()"); @@ -101,52 +89,59 @@ public class HdChildAddZpController { } @At - public Object pageData(PageForm page, @Param("searchKeyword") String searchKeyword, @Param("searchName") String searchName, String hdid, String hdlb, String zplb, String unionId, String unitId, - String pageOrderName, String pageOrderBy, String year) { + @ViReturn + public Object pageData(PageForm page, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "hdlb", required = false) String hdlb, + @Param(value = "zplb", required = false) String zplb, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId, + @Param(value = "year", required = false) String year) { try { - Cnd cnd = CndPlus.create(); - Sql sql = Sqls.create("SELECT\n" + - "\txx.*,\n" + - "\tsbr.username AS sbrname,\n" + - "\tsbr.loginname,\n" + - "\thd.hdname,\n" + - "\thd.hdkssj,\n" + - "\thd.hdjssj,\n" + - "\tzplb.zname as zplbname,\n" + - "\tlb.lname as hdlbname,\n" + - "\tdw.name as dwname,\n" + - "\tgh.unionname as ghname\n" + - "FROM\n" + - "\thd_ca_sbxx xx\n" + - "\tLEFT JOIN sys_user sbr ON sbr.id = xx.sbr\n" + - "\tleft join sys_unit dw on dw.id = sbr.unitid\n" + - "\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + - "\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" + - "\tleft join hd_wm_zplb zplb on zplb.zid = xx.zplb\n" + - "\tleft join hd_wm_lb lb on lb.lid = xx.hdlb $condition"); - cnd.and(new Static("1=1 and xx.hdid in (select hdid from hd_wm_xx where hdtype =2)")); + Sql sql = Sqls.create(""" + SELECT + xx.*, + sbr.username AS sbrname, + sbr.loginname, + hd.hdname, + hd.hdkssj, + hd.hdjssj, + zplb.zname as zplbname, + lb.lname as hdlbname, + dw.name as dwname, + gh.unionname as ghname + FROM + hd_ca_sbxx xx + LEFT JOIN sys_user sbr ON sbr.id = xx.sbr + left join sys_unit dw on dw.id = sbr.unitid + LEFT JOIN sys_union gh ON gh.id = dw.unionid + left join hd_wm_xx hd on hd.hdid = xx.hdid + left join hd_wm_zplb zplb on zplb.zid = xx.zplb + left join hd_wm_lb lb on lb.lid = xx.hdlb + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("xx.hdid", "in", Sqls.create("select hdid from hd_wm_xx where hdtype =2")); if (!ShiroUtil.hasAnyRoles("H04,sysadmin")) { - Vi.cndPlus(cnd, "xx.sbr", "=", ShiroUtil.getPrincipalProperty("id")); + cnd.and("xx.sbr", "=", ShiroUtil.getPrincipalProperty("id")); } - Vi.cndPlus(cnd, "xx.hdid", "=", hdid); - Vi.cndPlus(cnd, "xx.hdlb", "=", hdlb); - Vi.cndPlus(cnd, "xx.zplb", "=", zplb); - Vi.cndPlus(cnd, "dw.id", "=", unitId); - Vi.cndPlus(cnd, "gh.id", "=", unionId); - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - cnd.where().andLike(searchName, searchKeyword); + cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdlb", "=", hdlb); + cnd.andEX("xx.zplb", "=", zplb); + cnd.andEX("dw.id", "=", unitId); + cnd.andEX("gh.id", "=", unionId); + cnd.andEX("YEAR(xx.sbsj)", "=", year); + + if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) { + cnd.where().andLike(page.getSearchName(), page.getSearchKeyword()); } - if (Strings.isNotBlank(year)) { - Vi.cndPlus(cnd, "YEAR(xx.sbsj)", "=", year); - } - if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) { - cnd.orderBy(pageOrderName, pageOrderBy.equals("asc") ? "asc" : "desc"); + if (Strings.isNotBlank(page.getPageOrderName()) && Strings.isNotBlank(page.getPageOrderBy())) { + cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy())); } else { cnd.desc("sbr.username"); cnd.desc("gh.unionname"); cnd.desc("dw.name"); } - sql.setCondition(cnd); Pagination pagination = baseService.listPage(page.getPageNumber(), page.getPageSize(), sql); return Result.success().addData(pagination); @@ -156,12 +151,10 @@ public class HdChildAddZpController { } } - @Inject - private FileService fileService; - @At @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) - public Object doSubmit(@Param("data") String data, @Param("file") TempFile[] files) { + @RequiresPermissions("hd.child.sczp") + public Object doSubmit(@Param("data") String data, @Param(value = "file", required = false) TempFile[] files, boolean flag) { try { Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data); sbxx.setSbr(ShiroUtil.getPrincipalProperty("id").toString()); @@ -179,7 +172,8 @@ public class HdChildAddZpController { @At @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) - public Object doEdit(@Param("data") String data, String readytodelfile, @Param("file") TempFile[] files) { + @RequiresPermissions("hd.child.sczp") + public Object doEdit(@Param("data") String data, String readytodelfile, @Param(value = "file", required = false) TempFile[] files) { try { Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data); hdCasbxxService.updateIgnoreNull(sbxx); @@ -198,6 +192,8 @@ public class HdChildAddZpController { } @At + @ViReturn + @RequiresPermissions("hd.child.sczp") public Object findOne(String id) { try { Hd_ca_sbxx sbxx = hdCasbxxService.fetch(id); @@ -236,26 +232,4 @@ public class HdChildAddZpController { return Result.error(); } } - - @At - @Ok("void") - public void previewPhoto(String url, HttpServletResponse response) { - try { - String canonicalPath = new File("").getCanonicalPath(); - File file = new File(canonicalPath + "/" + url); - FileInputStream fis = new FileInputStream(file); - OutputStream out = response.getOutputStream(); - byte[] bs = new byte[1024]; - while ((fis.read(bs) != -1)) { - out.write(bs); - } - out.flush(); - out.close(); - out = null; - fis.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } diff --git a/src/main/java/io/v/nutz/hd/controller/ca/HdChildHjxxController.java b/src/main/java/io/v/nutz/hd/controller/ca/HdChildHjxxController.java index a3cf4a8..239b9ed 100644 --- a/src/main/java/io/v/nutz/hd/controller/ca/HdChildHjxxController.java +++ b/src/main/java/io/v/nutz/hd/controller/ca/HdChildHjxxController.java @@ -3,10 +3,13 @@ package io.v.nutz.hd.controller.ca; import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.service.BaseService; import cn.wizzer.framework.page.Pagination; +import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.utils.ExcelUtil; +import io.v.nutz.base.utils.Vi; import io.v.nutz.util.ShiroUtil; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; import org.nutz.dao.sql.Sql; @@ -15,6 +18,7 @@ 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 javax.servlet.http.HttpServletResponse; import java.io.OutputStream; @@ -26,57 +30,53 @@ import java.util.List; @Ok("json:full") public class HdChildHjxxController { - @Inject private BaseService baseService; @At("") - @Ok("re") + @Ok("beetl:/platform/hd/ca/hjxxyl.html") @RequiresPermissions("hd.child.hjxx") - public String index() { - return "beetl:/platform/hd/ca/hjxxyl.html"; + public void index() { + } @At - public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String hdid, String searchName, String searchKeyword) { + @RequiresPermissions("hd.child.hjxx") + @ViReturn + public Object pageData(@Param(value = "union", required = false) String union, + @Param(value = "unit", required = false) String unit, + Integer pageNumber, + Integer pageSize, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "searchName", required = false) String searchName, + @Param(value = "searchKeyword", required = false) String searchKeyword) { try { - StringBuffer sb = new StringBuffer(); - sb.append("select DISTINCT(xx.sbr),sbr.loginname,sbr.username,dw.name as dwname,gh.unionname as ghname,\n" + - "(SELECT COUNT(DISTINCT(a.zplb)) FROM hd_ca_sbxx a WHERE a.sbr = xx.sbr AND a.hdid = @hdid) as hjcount\n" + - "from hd_ca_sbxx xx\n" + - "left join sys_user sbr on sbr.id = xx.sbr\n" + - "left join sys_unit dw on dw.id = sbr.unitid\n" + - "LEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + - "where xx.hdid in (select hdid from hd_wm_xx where hdtype =2)"); - sb.append("\tand xx.hdid = @hdid"); + Sql sql = Sqls.create(""" + select DISTINCT(xx.sbr), + sbr.loginname, + sbr.username, + dw.name as dwname, + gh.unionname as ghname, + (SELECT COUNT(DISTINCT(a.zplb)) FROM hd_ca_sbxx a WHERE a.sbr = xx.sbr AND a.hdid = @hdid) as hjcount + FROM hd_ca_sbxx xx + LEFT JOIN sys_user sbr on sbr.id = xx.sbr + LEFT JOIN sys_unit dw on dw.id = sbr.unitid + LEFT JOIN sys_union gh ON gh.id = dw.unionid + $condition + """).setParam("hdid", hdid); + Cnd cnd = Cnd.NEW(); if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { - sb.append("\tAND gh.id IN (\n" + - "\tSELECT\n" + - "\t\tgh.id \n" + - "\tFROM\n" + - "\t\tsys_user u\n" + - "\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + - "\tLEFT JOIN sys_union gh ON gh.id = n.unionid where u.id = @cuserid)"); + cnd.and("gh.id", "=", Vi.getUnionId()); } if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - sb.append("\tand\t" + searchName + "\tlike @searchKeyword"); + cnd.and(Cnd.likeEX(searchName, searchKeyword)); } - if (Strings.isNotBlank(union)) { - sb.append(" AND dw.unionid = @union"); - } - - if (Strings.isNotBlank(unit)) { - sb.append(" AND dw.id = @unit"); - } - - sb.append(" ORDER BY sbr.username,dw.name,gh.unionname"); - Sql sql = Sqls.create(sb.toString()); - sql.setParam("hdid", hdid); - sql.setParam("union", union); - sql.setParam("unit", unit); - sql.setParam("searchKeyword", "%" + searchKeyword + "%"); - sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id")); + cnd.and("xx.hdid", "=", hdid); + cnd.andEX("dw.unionid", "=", union); + cnd.andEX("dw.id", "=", unit); + cnd.asc("sbr.username").asc("gh.unioncode").asc("dw.unitcode"); + sql.setCondition(cnd); Pagination pagination = baseService.listPage(pageNumber, pageSize, sql); return Result.success().addData(pagination); } catch (Exception e) { @@ -86,6 +86,8 @@ public class HdChildHjxxController { @At @Ok("void") + @RequiresPermissions("hd.child.hjxx") + @ViReturn public void exportExcel(int num, String hdid, HttpServletResponse response) { HSSFWorkbook wb = null; String fileName = ""; diff --git a/src/main/java/io/v/nutz/hd/controller/ca/HdChildZpxxController.java b/src/main/java/io/v/nutz/hd/controller/ca/HdChildZpxxController.java index 6881176..33c5c5c 100644 --- a/src/main/java/io/v/nutz/hd/controller/ca/HdChildZpxxController.java +++ b/src/main/java/io/v/nutz/hd/controller/ca/HdChildZpxxController.java @@ -1,25 +1,30 @@ package io.v.nutz.hd.controller.ca; import cn.wizzer.framework.base.Result; +import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.page.Pagination; import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.ExcelUtil; +import io.v.nutz.base.utils.Vi; import io.v.nutz.hd.services.HdCasbxxFjService; import io.v.nutz.hd.services.HdWmsbxxService; import io.v.nutz.sys.models.Sys_file; import io.v.nutz.util.ShiroUtil; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; 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 javax.servlet.http.HttpServletResponse; import java.io.OutputStream; @@ -39,13 +44,13 @@ public class HdChildZpxxController { @Inject private BaseService baseService; + @Inject private Dao dao; @Inject private HdCasbxxFjService hdCasbxxFjService; - @At("") @Ok("beetl:/platform/hd/ca/zpxx.html") @RequiresPermissions("hd.child.zpxx") @@ -54,6 +59,9 @@ public class HdChildZpxxController { } @At + @RequiresPermissions("hd.child.zpxx") + @ViReturn + @Aop(TransAop.READ_COMMITTED) public Object dodelete(String id) { try { baseService.clear("hd_ca_sbxx", Cnd.where("id", "=", id)); @@ -65,9 +73,15 @@ public class HdChildZpxxController { } @At + @RequiresPermissions("hd.child.zpxx") + @ViReturn public Object initHdxxlist() { try { - List list = baseService.list(Sqls.create("select *,year(hdcjsj) year from hd_wm_xx where hdtype=2 order by hdcjsj")); + String isSysadmin = " and hdcjr is not null"; + if (!ShiroUtil.hasRole("sysadmin")) { + isSysadmin = "and hdcjr = '" + ShiroUtil.getUserId() + "'"; + } + List list = baseService.list(Sqls.create("select *,year(hdcjsj) year from hd_wm_xx where hdtype=2 %s order by hdcjsj DESC".formatted(isSysadmin))); List> result = new ArrayList>(); Map> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getInt("year"))); @@ -89,6 +103,8 @@ public class HdChildZpxxController { } @At + @RequiresPermissions("hd.child.zpxx") + @ViReturn public Object gethdlblist(String id) { try { List list = baseService.list(Sqls.create("select * from hd_wm_lb where lhdid = @id").setParam("id", id)); @@ -99,6 +115,8 @@ public class HdChildZpxxController { } @At + @RequiresPermissions("hd.child.zpxx") + @ViReturn public Object gethdzplblist(String id) { try { List list = baseService.list(Sqls.create("select * from hd_wm_zplb where zlid = @id").setParam("id", id)); @@ -109,72 +127,59 @@ public class HdChildZpxxController { } @At - public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String hdid, String hdlb, String zplb, - String year) { + @RequiresPermissions("hd.child.zpxx") + @ViReturn + public Object pageData(@Param(value = "union", required = false) String union, + @Param(value = "unit", required = false) String unit, + Integer pageNumber, + Integer pageSize, + @Param(value = "searchName", required = false) String searchName, + @Param(value = "searchKeyword", required = false) String searchKeyword, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "hdlb", required = false) String hdlb, + @Param(value = "zplb", required = false) String zplb, + @Param(value = "year", required = false) String year) { try { - StringBuffer sb = new StringBuffer(); - sb.append("SELECT\n" + - "\txx.*,\n" + - "\tsbr.username AS sbrname,\n" + - "\tsbr.loginname,\n" + - "\thd.hdname,\n" + - "\thd.hdkssj,\n" + - "\thd.hdjssj,\n" + - "\tzplb.zname as zplbname,\n" + - "\tlb.lname as hdlbname,\n" + - "\tdw.name as dwname,\n" + - "\tgh.unionname as ghname\n" + - "FROM\n" + - "\thd_ca_sbxx xx\n" + - "\tLEFT JOIN sys_user sbr ON sbr.id = xx.sbr\n" + - "\tleft join sys_unit dw on dw.id = sbr.unitid\n" + - "\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + - "\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" + - "\tleft join hd_wm_zplb zplb on zplb.zid = xx.zplb\n" + - "\tleft join hd_wm_lb lb on lb.lid = xx.hdlb where 1=1"); - sb.append("\tand xx.hdid in (select hdid from hd_wm_xx where hdtype =2)"); + Sql sql = Sqls.create(""" + SELECT + xx.*, + sbr.username AS sbrname, + sbr.loginname, + hd.hdname, + hd.hdkssj, + hd.hdjssj, + zplb.zname as zplbname, + lb.lname as hdlbname, + dw.name as dwname, + gh.unionname as ghname + FROM + hd_ca_sbxx xx + LEFT JOIN sys_user sbr ON sbr.id = xx.sbr + left join sys_unit dw on dw.id = sbr.unitid + LEFT JOIN sys_union gh ON gh.id = dw.unionid + left join hd_wm_xx hd on hd.hdid = xx.hdid + left join hd_wm_zplb zplb on zplb.zid = xx.zplb + left join hd_wm_lb lb on lb.lid = xx.hdlb + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("xx.hdid", "in", Sqls.create("select hdid from hd_wm_xx where hdtype =2")); + cnd.andEX("dw.unionid", "=", union); + cnd.andEX("dw.id", "=", unit); + cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdlb", "=", hdlb); + cnd.andEX("xx.zplb", "=", zplb); + cnd.andEX("YEAR(xx.sbsj)", "=", year); + if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { - sb.append("\tand gh.id in (select gh.id from sys_user u \n" + - "left join sys_unit n on n.id = u.unitid\n" + - "left join sys_union gh ON gh.id = n.unionid\n" + - "where u.id = @cuserid)"); + cnd.and("gh.id", "=", Vi.getUnionId()); } - if (Strings.isNotBlank(union)) { - sb.append(" AND dw.unionid = @union"); - } - - if (Strings.isNotBlank(unit)) { - sb.append(" AND dw.id = @unit"); - } - - if (Strings.isNotBlank(hdid)) { - sb.append("\tand xx.hdid = @hdid"); - } - if (Strings.isNotBlank(hdlb)) { - sb.append("\tand xx.hdlb = @hdlb"); - } - if (Strings.isNotBlank(zplb)) { - sb.append("\tand xx.zplb = @zplb"); - } if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - sb.append("\tand\t" + searchName + "\tlike @searchKeyword"); + cnd.and(Cnd.likeEX(searchName, searchKeyword)); } - if (Strings.isNotBlank(year)) { - sb.append(""" - \tand YEAR(xx.sbsj) = @year - """); - } - sb.append("\tORDER BY sbr.username,gh.unionname,dw.name"); - Sql sql = Sqls.create(sb.toString()); - sql.setParam("union", union); - sql.setParam("unit", unit); - sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id")); - sql.setParam("hdid", hdid); - sql.setParam("hdlb", hdlb); - sql.setParam("zplb", zplb); - sql.setParam("year", year); - sql.setParam("searchKeyword", "%" + searchKeyword + "%"); + cnd.asc("sbr.username").asc("gh.unioncode").asc("dw.unitcode"); + sql.setCondition(cnd); Pagination pagination = baseService.listPage(pageNumber, pageSize, sql); return Result.success().addData(pagination); } catch (Exception e) { @@ -184,6 +189,8 @@ public class HdChildZpxxController { } @At + @RequiresPermissions("hd.child.zpxx") + @ViReturn public Object findOneById(String id) { List fjList = baseService.dao().query("sys_file", Cnd.where("reid", "=", id)); return Result.success().addData(fjList); @@ -191,6 +198,8 @@ public class HdChildZpxxController { @At("/exportExcel") @Ok("void") + @RequiresPermissions("hd.child.zpxx") + @ViReturn public void exportExcel(HttpServletResponse response, String hdid, String hdname) { StringBuffer sb = new StringBuffer(); sb.append("SELECT\n" + diff --git a/src/main/java/io/v/nutz/hd/controller/ca/HdCnMangeController.java b/src/main/java/io/v/nutz/hd/controller/ca/HdCnMangeController.java index bb51091..8040ac3 100644 --- a/src/main/java/io/v/nutz/hd/controller/ca/HdCnMangeController.java +++ b/src/main/java/io/v/nutz/hd/controller/ca/HdCnMangeController.java @@ -2,13 +2,10 @@ package io.v.nutz.hd.controller.ca; -import io.v.nutz.hd.services.*; import org.apache.shiro.authz.annotation.RequiresPermissions; -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 java.text.SimpleDateFormat; /** @@ -27,6 +24,7 @@ public class HdCnMangeController { @At @Ok("beetl:/platform/hd/ca/mobileBox.html") + @RequiresPermissions("hd.ca.hdmange") public void mobileBox() { } diff --git a/src/main/java/io/v/nutz/hd/controller/ca/mobile/ChildrenActivitiesCon.java b/src/main/java/io/v/nutz/hd/controller/ca/mobile/ChildrenActivitiesCon.java index 6158e37..c568a54 100644 --- a/src/main/java/io/v/nutz/hd/controller/ca/mobile/ChildrenActivitiesCon.java +++ b/src/main/java/io/v/nutz/hd/controller/ca/mobile/ChildrenActivitiesCon.java @@ -5,9 +5,10 @@ import cn.wizzer.framework.base.Result; import io.v.nutz.hd.models.Hd_ca_sbxx; import io.v.nutz.hd.models.Hd_ca_sbxx_fj; import io.v.nutz.hd.services.HdCasbxxFjService; -import io.v.nutz.service.ViService; +import io.v.nutz.hd.services.HdCasbxxService; import io.v.nutz.sys.models.Sys_file; import io.v.nutz.sys.services.SysUserService; +import io.v.nutz.service.ViService; import org.apache.commons.io.FilenameUtils; import org.nutz.boot.starter.ftp.FtpService; import org.nutz.dao.Sqls; @@ -15,7 +16,6 @@ import org.nutz.dao.entity.Record; import org.nutz.dao.sql.Sql; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; -import org.nutz.lang.Files; import org.nutz.lang.random.R; import org.nutz.mvc.annotation.AdaptBy; import org.nutz.mvc.annotation.At; @@ -25,11 +25,8 @@ import org.nutz.mvc.upload.TempFile; import org.nutz.mvc.upload.UploadAdaptor; import javax.servlet.http.HttpSession; -import java.io.File; import java.io.IOException; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * @Author: V diff --git a/src/main/java/io/v/nutz/hd/controller/wmhd/HdJzgAddZpController.java b/src/main/java/io/v/nutz/hd/controller/wmhd/HdJzgAddZpController.java index 0b1c69d..a964064 100644 --- a/src/main/java/io/v/nutz/hd/controller/wmhd/HdJzgAddZpController.java +++ b/src/main/java/io/v/nutz/hd/controller/wmhd/HdJzgAddZpController.java @@ -3,6 +3,8 @@ package io.v.nutz.hd.controller.wmhd; import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.service.BaseService; import cn.wizzer.framework.page.Pagination; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.DateUtil; import io.v.nutz.base.utils.FileService; import io.v.nutz.hd.models.Hd_wm_sbxx; import io.v.nutz.hd.services.HdWmLbService; @@ -10,7 +12,6 @@ import io.v.nutz.hd.services.HdWmZplbService; import io.v.nutz.hd.services.HdWmsbxxService; import io.v.nutz.hd.services.HdWmsbxxfjService; import io.v.nutz.util.ShiroUtil; -import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; @@ -20,7 +21,6 @@ import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; import org.nutz.lang.Lang; -import org.nutz.lang.Strings; import org.nutz.mvc.annotation.AdaptBy; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @@ -37,7 +37,6 @@ import java.util.Map; @IocBean @At("/platform/hd/jzghd/sczp") @Ok("json:full") -@RequiresAuthentication public class HdJzgAddZpController { @Inject @@ -67,11 +66,12 @@ public class HdJzgAddZpController { @At @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) - public Object doSubmit(@Param("data") String data, @Param("file") TempFile[] files) { + public Object doSubmit(@Param("data") String data, @Param(value = "file", required = false) TempFile[] files, boolean flag) { try { Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data); sbxx.setHdsbrid(ShiroUtil.getPrincipalProperty("id").toString()); - sbxx.setHdsbsj(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); + sbxx.setHdsbsj(DateUtil.getDateTime()); + sbxx.setAuditState(flag ? "4400" : "3999"); Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx); for (TempFile file : files) { @@ -86,14 +86,15 @@ public class HdJzgAddZpController { @At @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) - public Object doEdit(@Param("data") String data, String readytodelfile, @Param("file") TempFile[] files) { + public Object doEdit(@Param("data") String data, String readytodelfile, @Param(value = "file", required = false) TempFile[] files, boolean flag) { try { Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data); + sbxx.setAuditState(flag ? "4400" : "3999"); hdWmsbxxService.updateIgnoreNull(sbxx); List dellist = Json.fromJsonAsList(String.class, readytodelfile); for (String f : dellist) { - fileService.delete(f, null); + fileService.delete(f, f); } for (TempFile file : files) { fileService.upload(file, sbxx.getId(), "/hd/hdwm/"); @@ -106,46 +107,47 @@ public class HdJzgAddZpController { @At - public Object pageData(Integer pageNumber, Integer pageSize, String hdid, String hdlb, String zplb) { + @ViReturn + public Object pageData(Integer pageNumber, + Integer pageSize, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "hdlb", required = false) String hdlb, + @Param(value = "zplb", required = false) String zplb) { try { - StringBuffer sb = new StringBuffer(); - sb.append("SELECT\n" + - "\txx.*,\n" + - "\tsbr.username AS sbrname,\n" + - "\tsbr.loginname,\n" + - "\thd.hdname,\n" + - "\thd.hdkssj,\n" + - "\thd.hdjssj,\n" + - "\tdw.name as dwname,\n" + - "\tgh.unionname as ghname,\n" + - "\thdlb.lname as hdlbname,\n" + - "\tzplb.zname as zplbname\n" + - "FROM\n" + - "\thd_wm_sbxx xx\n" + - "\tLEFT JOIN sys_user sbr ON sbr.id = xx.hdsbrid\n" + - "\tleft join sys_unit dw on dw.id = sbr.unitid\n" + - "\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + - "\tLEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx\n" + - "\tLEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2\n" + - "\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" + - "\twhere 1=1"); - sb.append("\tand xx.hdid in (select hdid from hd_wm_xx where hdtype =1)"); - sb.append("\tand xx.hdsbrid = @userid"); - if (Strings.isNotBlank(hdid)) { - sb.append("\tand xx.hdid = @hdid"); - } - if (Strings.isNotBlank(hdlb)) { - sb.append("\tand xx.hdzplx = @hdlb"); - } - if (Strings.isNotBlank(zplb)) { - sb.append("\tand xx.hdzplx2 = @zplb"); - } - sb.append("\tORDER BY sbr.username,gh.unionname,dw.name"); - Sql sql = Sqls.create(sb.toString()); - sql.setParam("userid", ShiroUtil.getPrincipalProperty("id")); - sql.setParam("hdid", hdid); - sql.setParam("hdlb", hdlb); - sql.setParam("zplb", zplb); + Sql sql = Sqls.create(""" + SELECT + xx.*, + sbr.username AS sbrname, + sbr.loginname, + hd.hdname, + hd.hdkssj, + hd.hdjssj, + dw.name as dwname, + gh.unionname as ghname, + hdlb.lname as hdlbname, + zplb.zname as zplbname, + state.stateColor, + state.stateName, + ( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id ) dz_znum + FROM + hd_wm_sbxx xx + LEFT JOIN sys_user sbr ON sbr.id = xx.hdsbrid + left join sys_unit dw on dw.id = sbr.unitid + LEFT JOIN sys_union gh ON gh.id = dw.unionid + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + left join hd_wm_xx hd on hd.hdid = xx.hdid + LEFT JOIN audit_state state ON state.stateId = xx.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("xx.hdid", "in", Sqls.create("select hdid from hd_wm_xx where hdtype =1")); + cnd.and("xx.hdsbrid", "=", ShiroUtil.getPrincipalProperty("id")); + cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdlb", "=", hdlb); + cnd.andEX("xx.zplb", "=", zplb); + cnd.desc("sbr.username").desc("gh.unionname").desc("dw.name"); + sql.setCondition(cnd); Pagination pagination = baseService.listPage(pageNumber, pageSize, sql); return Result.success().addData(pagination); } catch (Exception e) { @@ -189,5 +191,14 @@ public class HdJzgAddZpController { } } + @At + public Object gethdzplblist(String id) { + try { + return Result.success().addData(hdWmZplbService.query(Cnd.where("zlid", "=", id))); + } catch (Exception e) { + return Result.error(); + } + } + } diff --git a/src/main/java/io/v/nutz/hd/controller/wmhd/HdMangeController.java b/src/main/java/io/v/nutz/hd/controller/wmhd/HdMangeController.java index 10abe3f..47c2ee9 100644 --- a/src/main/java/io/v/nutz/hd/controller/wmhd/HdMangeController.java +++ b/src/main/java/io/v/nutz/hd/controller/wmhd/HdMangeController.java @@ -1,5 +1,6 @@ package io.v.nutz.hd.controller.wmhd; +import cn.hutool.core.date.DateUtil; import cn.wizzer.framework.base.Result; import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.utils.FileService; @@ -7,14 +8,18 @@ import io.v.nutz.hd.models.Hd_wm_lb; import io.v.nutz.hd.models.Hd_wm_xx; import io.v.nutz.hd.models.Hd_wm_zplb; import io.v.nutz.hd.services.*; +import io.v.nutz.sys.services.SysMsgService; import io.v.nutz.util.ShiroUtil; +import io.v.nutz.web.commons.slog.annotation.SLog; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.boot.starter.ftp.FtpService; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; 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; @@ -59,6 +64,7 @@ public class HdMangeController { @At @Ok("beetl:/platform/hd/wmhd/mobileBox.html") + @RequiresPermissions("hd.wmhd.hdmange") public void mobileBox() { } @@ -74,12 +80,18 @@ public class HdMangeController { @Inject private FtpService ftpService; + @Inject + private SysMsgService sysMsgService; + @At @Ok("json") @ViReturn - @RequiresAuthentication + @SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集新增") + @RequiresPermissions("hd.wmhd.hdmange") public Object doAdd(@Param("hdxx") Hd_wm_xx hdWmXx) { Trans.exec(() -> { + + hdWmXx.setHdcjr(ShiroUtil.getPrincipalProperty("id").toString()); hdWmXx.setHdcjsj(sdf.format(new Date())); hdWmXx.setHdflag(false); @@ -97,13 +109,15 @@ public class HdMangeController { hdWmZplbService.insert(zplbs.get(j)); } } + + }); return null; } @At @Ok("json") - public Object data(String hdname, Integer hdtype, int pageNumber, int pageSize, Integer year) { + public Object data(@Param(value = "hdname", required = false) String hdname, @Param(value = "hdtype", required = false) Integer hdtype, @Param(value = "year", required = false) Integer year, int pageNumber, int pageSize) { try { Sql sql = Sqls.create("SELECT hd.*,u.`username` cjr FROM hd_wm_xx hd LEFT JOIN sys_user u ON hd.hdcjr = u.`id` $condition"); Cnd cnd = Cnd.NEW(); @@ -114,6 +128,9 @@ public class HdMangeController { if (year != null) { cnd.and("YEAR(hdcjsj)", "=", year); } + if (!ShiroUtil.hasRole("sysadmin")) { + cnd.and("hd.hdcjr", "=", ShiroUtil.getUserId()); + } cnd.desc("hdcjsj"); sql.setCondition(cnd); return Result.success().addData(hdWmxxService.listPage(pageNumber, pageSize, sql)); @@ -124,10 +141,12 @@ public class HdMangeController { @At @Ok("json") + @Aop(TransAop.READ_COMMITTED) + @SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集删除") + @RequiresPermissions("hd.wmhd.hdmange") public Object delete(String hdid) { try { String path = new File("").getCanonicalPath(); - hdWmZplbService.execute(Sqls.create("DELETE FROM `hd_wm_zplb` WHERE zlid IN (SELECT lb.`lid` FROM hd_wm_lb lb WHERE lb.`lhdid`=@hdid)").setParam("hdid", hdid)); hdWmLbService.clear(Cnd.where("lhdid", "=", hdid)); @@ -145,7 +164,7 @@ public class HdMangeController { hdWmsbxxService.execute(Sqls.create("DELETE FROM `hd_wm_sbxx` WHERE `hdid`=@hdid").setParam("hdid", hdid)); hdWmxxService.delete(hdid); - + sysMsgService.deleteMsg(hdid); return Result.success(); } catch (Exception e) { e.printStackTrace(); @@ -155,6 +174,8 @@ public class HdMangeController { @At @Ok("json") + + @RequiresPermissions("hd.wmhd.hdmange") public Object changeStatus(String hdid, Boolean flag) { try { Hd_wm_xx hdWmXx = hdWmxxService.fetch(hdid); @@ -184,10 +205,12 @@ public class HdMangeController { @At @Ok("json") - @RequiresAuthentication + @SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集修改") + @RequiresPermissions("hd.wmhd.hdmange") @ViReturn public Object doEdit(@Param("hdxx") Hd_wm_xx hdWmXx) { Trans.exec(() -> { + hdWmxxService.update(hdWmXx); List lbids = new ArrayList<>(); List zpLbids = new ArrayList<>(); @@ -226,8 +249,29 @@ public class HdMangeController { hdWmZplbService.insertOrUpdate(zplbs.get(j)); } } + + }); return null; } + + @At + @Ok("json") + @ViReturn + @RequiresAuthentication + public Object getUserActivityGroup() { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT * FROM hd_wm_xx WHERE activityGroupId in (SELECT groupId FROM `activity_user_scope` $condition) + """); + if (!ShiroUtil.hasRole("sysadmin")) { + cnd.and("userId", "=", ShiroUtil.getUserId()); + } + cnd.and("hdkssj","<=", DateUtil.now()); + cnd.and("hdjssj",">=", DateUtil.now()); + sql.setCondition(cnd); + return hdWmsbxxService.listMap(sql); + } + } diff --git a/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmHjInfoController.java b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmHjInfoController.java index ef3caf4..3265206 100644 --- a/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmHjInfoController.java +++ b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmHjInfoController.java @@ -2,7 +2,6 @@ package io.v.nutz.hd.controller.wmhd; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; -import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.wizzer.framework.base.Result; import io.v.nutz.annontation.ViReturn; @@ -22,9 +21,9 @@ 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.http.HttpServletResponse; -import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; @@ -45,7 +44,14 @@ public class HdWmHjInfoController { @At("/pageData") @Ok("json") @ViReturn - public Object pageData(String year, String union, String unit, PageForm pageForm, String hdid, String searchName, String searchKeyword) { + @RequiresPermissions("hd.wmhd.hjxx1") + public Object pageData(@Param(value = "year", required = false) String year, + @Param(value = "union", required = false) String union, + @Param(value = "unit", required = false) String unit, + PageForm pageForm, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "searchName", required = false) String searchName, + @Param(value = "searchKeyword", required = false) String searchKeyword) { try { Sql sql = Sqls.create(""" SELECT DISTINCT @@ -54,7 +60,7 @@ public class HdWmHjInfoController { u.loginname, n.NAME AS dwname, gh.unionname AS ghname, - ( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid ) AS hjcount + ( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid AND auditState=4400) AS hjcount FROM hd_wm_sbxx xx LEFT JOIN sys_user u ON u.id = xx.hdsbrid @@ -66,7 +72,8 @@ public class HdWmHjInfoController { Cnd cnd = Cnd.NEW(); cnd.andEX("xx.hdid", "=", hdid); cnd.andEX("YEAR(xx.hdsbsj)", "=", year); - if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { + cnd.andEX("xx.auditState", "=", 4400); + if (!ShiroUtil.hasRole("H10") && !ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { cnd.andEX("gh.id", "=", Vi.getUnionId()); } cnd.andEX("n.unionid", "=", union); @@ -84,9 +91,8 @@ public class HdWmHjInfoController { @At("/exportExcel") @Ok("void") + @RequiresPermissions("hd.wmhd.hjxx1") public void exportExcel(Integer num, String hdid, HttpServletResponse response) { - ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); if (num == 1) { Sql sql = Sqls.create(""" @@ -96,7 +102,7 @@ public class HdWmHjInfoController { u.loginname, n.NAME AS dwname, gh.unionname AS ghname, - ( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid ) AS hjcount + ( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid AND a.auditState=4400) AS hjcount FROM hd_wm_sbxx xx LEFT JOIN sys_user u ON u.id = xx.hdsbrid @@ -107,6 +113,7 @@ public class HdWmHjInfoController { sql.setParam("hdid", hdid); Cnd cnd = Cnd.NEW(); cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.auditState", "=", 4400); cnd.asc("u.username").asc("n.name").asc("gh.unionname"); sql.setCondition(cnd); List winnerList = hdWmsbxxService.listMap(sql); @@ -119,8 +126,8 @@ public class HdWmHjInfoController { exportEntities.add(new ExcelExportEntity("获奖次数", "hjcount", 20)); try { - ViTool.excelResponse(response, "获奖人员名单.xlsx"); - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, winnerList); + ViTool.excelResponse(response, "获奖人员名单.xls"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, winnerList); workbook.write(response.getOutputStream()); } catch (Exception e) { e.printStackTrace(); @@ -136,9 +143,11 @@ public class HdWmHjInfoController { LEFT JOIN `user` u ON u.unionid = gh.id LEFT JOIN hd_wm_sbxx sbxx ON sbxx.hdsbrid = u.id AND sbxx.hdid = @hdid + AND sbxx.auditState = @auditState $condition """); sql.setParam("hdid", hdid); + sql.setParam("auditState", 4400); Cnd cnd = Cnd.NEW(); cnd.groupBy("gh.id"); cnd.asc("gh.unioncode"); @@ -150,128 +159,13 @@ public class HdWmHjInfoController { exportEntities.add(new ExcelExportEntity("应发奖品数", "prizeNum", 20)); try { - ViTool.excelResponse(response, "分工会获奖信息.xlsx"); - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, unionList); + ViTool.excelResponse(response, "分工会获奖信息.xls"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, unionList); workbook.write(response.getOutputStream()); } catch (Exception e) { e.printStackTrace(); } - - } - - -// HSSFWorkbook wb = null; -// String fileName = ""; -// if (num == 1) { -// StringBuffer sbsql = new StringBuffer(); -// sbsql.append("SELECT DISTINCT ( xx.hdsbrid ),u.username,u.loginname,n.NAME AS dwname,gh.unionname AS ghname,\n" + -// "(SELECT COUNT(DISTINCT(a.hdzplx)) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid`) as hjcount\n" + -// "FROM hd_wm_sbxx xx LEFT JOIN sys_user u ON u.id = xx.hdsbrid\n" + -// " LEFT JOIN sys_unit n ON n.id = u.unitid\n" + -// " LEFT JOIN sys_union gh ON gh.id = n.unionid\n" + -// " WHERE 1=1 "); -// sbsql.append("\tand xx.hdid = @hdid"); -// if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { -// sbsql.append("\tAND gh.id IN (\n" + -// "\tSELECT\n" + -// "\t\tgh.id \n" + -// "\tFROM\n" + -// "\t\tsys_user u\n" + -// "\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + -// "\tLEFT JOIN sys_union gh ON gh.id = n.unionid where u.id = @cuserid)"); -// } -// sbsql.append(" ORDER BY u.username,n.name,gh.unionname"); -// Sql sql = Sqls.create(sbsql.toString()); -// sql.setParam("hdid", hdid); -// sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id")); -// List list = hdWmsbxxService.list(sql); -// fileName = "获奖人员名单"; -// String[] title = {"姓名", "工资号", "单位", "分工会", "获奖次数"}; -// String[][] content = new String[list.size()][title.length]; -// for (int i = 0; i < list.size(); i++) { -// Record r = list.get(i); -// content[i][0] = r.getString("username"); -// content[i][1] = r.getString("loginname"); -// content[i][2] = r.getString("dwname"); -// content[i][3] = r.getString("ghname"); -// content[i][4] = String.valueOf(r.getInt("hjcount")); -// } -// wb = ExcelUtil.getHSSFWorkbook(fileName, title, content, null); -// } else { -// String ghtjstr = "SELECT\n" + -// "\tfgh.unionname,\n" + -// "\t(\n" + -// "\tSELECT\n" + -// "\t\tcount( DISTINCT ( xx.hdsbrid ) ) \n" + -// "\tFROM\n" + -// "\t\thd_wm_sbxx xx\n" + -// "\t\tLEFT JOIN sys_user u ON u.id = xx.hdsbrid\n" + -// "\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + -// "\t\tLEFT JOIN sys_union ghx ON ghx.id = n.unionid \n" + -// "\tWHERE\n" + -// "\t\tghx.id = fgh.id \n" + -// "\t) AS cjrsCount,\n" + -// "\t(\n" + -// "\tSELECT\n" + -// "\t\tSUM( c ) \n" + -// "\tFROM\n" + -// "\t\t(\n" + -// "\t\tSELECT\n" + -// "\t\t\tgh.`id`,\n" + -// "\t\t\t( SELECT COUNT( DISTINCT ( a.hdzplx ) ) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` ) c \n" + -// "\t\tFROM\n" + -// "\t\t\thd_wm_sbxx xx\n" + -// "\t\t\tLEFT JOIN sys_user u ON u.id = xx.hdsbrid\n" + -// "\t\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + -// "\t\t\tLEFT JOIN sys_union gh ON gh.id = n.unionid \n" + -// "\t\tGROUP BY\n" + -// "\t\t\txx.hdsbrid \n" + -// "\t\t) tab \n" + -// "\tWHERE\n" + -// "\t\ttab.id = fgh.`id` \n" + -// "\t) jpCount \n" + -// "FROM\n" + -// "\tsys_union fgh"; -// Sql ghtjsql = Sqls.create(ghtjstr.toString()); -// List ghtjList = hdWmsbxxService.list(ghtjsql); -// fileName = "分工会奖品统计"; -// String[] title = {"分工会", "参加人数", "应发奖品数"}; -// String[][] content = new String[ghtjList.size()][title.length]; -// for (int i = 0; i < ghtjList.size(); i++) { -// Record r = ghtjList.get(i); -// content[i][0] = r.getString("unionname"); -// content[i][1] = r.getString("cjrsCount"); -// content[i][2] = r.getString("jpCount") == null ? "0" : r.getString("jpCount"); -// } -// wb = ExcelUtil.getHSSFWorkbook(fileName, title, content, null); -// } -// try { -// this.setResponseHeader(response, fileName + ".xls"); -// OutputStream os = response.getOutputStream(); -// wb.write(os); -// os.flush(); -// os.close(); -// } catch (Exception e) { -// e.printStackTrace(); -// } - - - } - - public void setResponseHeader(HttpServletResponse response, String fileName) { - try { - try { - fileName = new String(fileName.getBytes(), "ISO8859-1"); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - response.setContentType("application/octet-stream;charset=ISO8859-1"); - response.setHeader("Content-Disposition", "attachment;filename=" + fileName); - response.addHeader("Pargam", "no-cache"); - response.addHeader("Cache-Control", "no-cache"); - } catch (Exception ex) { - ex.printStackTrace(); } } + } diff --git a/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmInfoController.java b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmInfoController.java index d0d2ec4..f962a0e 100644 --- a/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmInfoController.java +++ b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmInfoController.java @@ -2,34 +2,38 @@ package io.v.nutz.hd.controller.wmhd; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; -import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.wizzer.framework.base.Result; -import cn.wizzer.framework.base.service.BaseService; -import cn.wizzer.framework.page.Pagination; import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.Office2Pdf; +import io.v.nutz.base.utils.PageUtil; import io.v.nutz.base.utils.Vi; import io.v.nutz.hd.models.Hd_wm_sbxx; import io.v.nutz.hd.services.HdWmLbService; import io.v.nutz.hd.services.HdWmZplbService; import io.v.nutz.hd.services.HdWmsbxxService; import io.v.nutz.hd.services.HdWmsbxxfjService; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.AuditState; +import io.v.nutz.modules.models.PageForm; import io.v.nutz.sys.models.Sys_file; import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ViTool; +import io.v.nutz.web.commons.utils.FileUtil; import net.coobird.thumbnailator.Thumbnails; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.util.IOUtils; -import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.boot.starter.ftp.FtpService; +import org.nutz.dao.Chain; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; import org.nutz.dao.sql.Sql; +import org.nutz.ioc.impl.PropertiesProxy; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; @@ -38,18 +42,23 @@ import org.nutz.lang.random.R; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; -import org.nutz.mvc.annotation.POST; +import org.nutz.mvc.annotation.Param; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URLEncoder; import java.util.*; import java.util.stream.Collectors; @IocBean +@Ok("json:full") @At("/platform/hd/wmhd") public class HdWmInfoController { @@ -71,6 +80,9 @@ public class HdWmInfoController { @Inject private HdWmsbxxfjService hdWmsbxxfjService; + @Inject + protected PropertiesProxy conf; + private static final String imgnewdir = "upload/hd/hdwm/new/"; private String path = new File("").getCanonicalPath(); @@ -105,7 +117,7 @@ public class HdWmInfoController { @At("/getVideo") @Ok("void") - @RequiresAuthentication + @RequiresPermissions("hd.wmhd.zpxx1") public void getVideo(HttpServletRequest request, HttpServletResponse response, String filepath) { try { File file = new File(path + "\\" + filepath); @@ -148,7 +160,7 @@ public class HdWmInfoController { */ @At("/getNewImg") @Ok("void") - @RequiresAuthentication + @RequiresPermissions("hd.wmhd.zpxx1") public void getNewImg(HttpServletResponse response, String filepath) throws IOException { //图片格式 String imgformat = filepath.substring(filepath.lastIndexOf(".") + 1, filepath.length()); @@ -174,81 +186,71 @@ public class HdWmInfoController { @At("/pageData") - @Ok("json") - @RequiresAuthentication - public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String hdid, String hdlb, String zplb, - String year) { - try { - StringBuffer sbsql = new StringBuffer(); - sbsql.append("SELECT\n" + - "\txx.id,\n" + - "\txx.hdsbsj,\n" + - "\txx.hdsbzpzt,\n" + - "\txx.hdsbzpms,\n" + - "\txx.hdzplx,\n" + - "\txx.hdid,\n" + - "\tu.username,\n" + - "\tu.loginname,\n" + - "\tu.mobile,\n" + - "\tn.NAME AS 'dwname',\n" + - "\tgh.unionname AS 'ghname',\n" + - "\thdlb.lname as hdlbname,\n" + - "\tzplb.zname as zplbname\n" + - "FROM\n" + - "\thd_wm_sbxx xx\n" + - "\tLEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx\n" + - "\tLEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2\n" + - "\tLEFT JOIN sys_user u ON u.id = xx.hdsbrid\n" + - "\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + - "\tLEFT JOIN sys_union gh ON gh.id = n.unionid where 1=1"); - if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { - sbsql.append("\tAND gh.id IN (\n" + - "\tSELECT\n" + - "\t\tgh.id \n" + - "\tFROM\n" + - "\t\tsys_user u\n" + - "\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + - "\tLEFT JOIN sys_union gh ON gh.id = n.unionid where u.id = @cuserid)"); - } - - if (Strings.isNotBlank(union)) { - sbsql.append(" AND n.unionid = @union"); - } - - if (Strings.isNotBlank(unit)) { - sbsql.append(" AND n.id = @unit"); - } - - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - sbsql.append("\tand " + searchName + " like '%" + searchKeyword + "%'"); - } - if (Strings.isNotBlank(hdid)) { - sbsql.append("\tand xx.hdid = @hdid"); - } - if (Strings.isNotBlank(hdlb)) { - sbsql.append("\tand xx.hdzplx = @hdzplx"); - } - if (Strings.isNotBlank(zplb)) { - sbsql.append("\tand xx.hdzplx2 = @hdzplx2"); - } - if (Strings.isNotBlank(year)) { - sbsql.append("\tand YEAR(xx.hdsbsj) = @year"); - } - - sbsql.append("\tORDER BY xx.hdsbsj desc,gh.unionname,n.name,u.username,xx.hdzplx"); - Sql sql = Sqls.create(sbsql.toString()); - sql.setParam("union", union); - sql.setParam("unit", unit); - sql.setParam("hdid", hdid); - sql.setParam("hdzplx", hdlb); - sql.setParam("hdzplx2", zplb); - sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id")); - sql.setParam("year", year); - Pagination pagination = hdWmsbxxfjService.listPage(pageNumber, pageSize, sql); - return Result.success().addData(pagination); - } catch (Exception e) { - return Result.error(); + @ViReturn + @RequiresPermissions("hd.wmhd.zpxx1") + public Object pageData(@Param(value = "union", required = false) String union, + @Param(value = "unit", required = false) String unit, + PageForm pageForm, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "hdlb", required = false) String hdlb, + @Param(value = "zplb", required = false) String zplb, + @Param(value = "year", required = false) String year, + @Param(value = "isExcellent", required = false) Integer isExcellent, + @Param(value = "stateId", required = false) Integer stateId) { + Sql sql = Sqls.create(""" + SELECT + xx.id, + xx.hdsbsj, + xx.hdsbzpzt, + xx.hdsbzpms, + xx.hdzplx, + xx.hdid, + xx.isExcellent, + wmxx.hdname, + u.username, + u.loginname, + u.mobile, + u.unitname AS 'dwname', + u.unionname AS 'ghname', + hdlb.lname AS hdlbname, + zplb.zname AS zplbname, + state.stateColor, + state.stateName, + ( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id) dz_num + FROM + hd_wm_sbxx xx + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + LEFT JOIN `user` u ON u.id = xx.hdsbrid + LEFT JOIN audit_state state ON state.stateId = xx.auditState + LEFT JOIN hd_wm_xx wmxx ON wmxx.hdid = xx.hdid + $condition + """); + Cnd cnd = Cnd.NEW(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and("u.unionid", "=", Vi.getUnionId()); } + cnd.andEX("u.unionid", "=", union); + cnd.andEX("u.unitid", "=", unit); + cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdzplx", "=", hdlb); + cnd.andEX("xx.hdzplx2", "=", zplb); + cnd.andEX("YEAR(xx.hdsbsj)", "=", year); + cnd.andEX("xx.auditState", "=", stateId); + cnd.andEX("xx.isExcellent", "=", isExcellent); + if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) { + cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); + } + if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) { + cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); + } else { + cnd.desc("dz_num").desc("xx.hdsbsj").asc("xx.auditState").asc("unioncode"); + } + + sql.setCondition(cnd); + + return hdWmsbxxfjService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } @@ -259,8 +261,6 @@ public class HdWmInfoController { * @return */ @At("/findOneById") - @Ok("json:full") - @RequiresAuthentication public Object findOneById(String id) { try { // List fjList = hdWmsbxxfjService.query(Cnd.where("hdsbid", "=", id)); @@ -272,20 +272,65 @@ public class HdWmInfoController { } } + @At("/findxxById") + @ViReturn + public Object findxxById(String id) { + Sql sql = Sqls.create(""" + SELECT + xx.*, + u.username, + u.loginname, + u.unitname AS 'dwname', + u.unionname AS 'ghname', + hdlb.lname AS hdlbname, + zplb.zname AS zplbname, + zplb.*, + zt.hdname, + state.stateColor, + state.stateName + FROM + hd_wm_sbxx xx + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + LEFT JOIN hd_wm_xx zt ON zt.hdid = xx.hdid + LEFT JOIN `user` u ON u.id = xx.hdsbrid + LEFT JOIN audit_state state ON state.stateId = xx.auditState + WHERE xx.id=@id + """).setParam("id", id); + List list = baseService.listMap(sql); + if (list.size() > 0) { + NutMap map = list.get(0); + map.setv("union", Strings.isNotBlank(map.getString("unionAuditId")) ? baseService.dao().fetch(Audit.class, map.getString("unionAuditId")) : null); + map.setv("school", Strings.isNotBlank(map.getString("schoolAuditId")) ? baseService.dao().fetch(Audit.class, map.getString("schoolAuditId")) : null); + return map; + } + return null; + } - @At("/exportExcel") + @At("/exportWork") @Ok("void") - @RequiresAuthentication - public void exportExcel(HttpServletResponse response, String hdid, String hdname) { + @RequiresPermissions("hd.wmhd.zpxx1") + public void exportWork(HttpServletResponse response, + String hdid, + String hdlb, + String hdname, + String zplb, + String union, + String unit, + Integer isExcellent, + String stateId) { + Sql sql = Sqls.create(""" SELECT xx.id, - xx.hdsbzpzt, xx.hdzplx, + xx.hdsbzpms, + xx.hdsbsj, u.username, + u.sex, u.loginname, - n.NAME AS dwname, - gh.unionname AS ghname, + u.unitname AS dwname, + u.unionname AS ghname, hd.hdname as hdname, hdlb.lname as hdlbname, zplb.zname as zplbname @@ -294,62 +339,190 @@ public class HdWmInfoController { LEFT JOIN hd_wm_xx hd ON hd.hdid = xx.hdid LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 - LEFT JOIN sys_user u ON u.id = xx.hdsbrid - LEFT JOIN sys_unit n ON n.id = u.unitid - LEFT JOIN sys_union gh ON gh.id = n.unionid + LEFT JOIN `user` u ON u.id = xx.hdsbrid $condition """); Cnd cnd = Cnd.NEW(); cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdzplx", "=", hdlb); + cnd.andEX("xx.hdzplx2", "=", zplb); + cnd.andEX("u.unionid", "=", union); + cnd.andEX("u.unitid", "=", unit); + cnd.andEX("xx.auditState", "=", 4400); + cnd.andEX("xx.isExcellent", "=", isExcellent); if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { if (ShiroUtil.hasRole("H04")) { - cnd.andEX("gh.id", "=", Vi.getUnionId()); + cnd.andEX("u.unionid", "=", Vi.getUnionId()); } } - cnd.asc("gh.unionname").asc("n.name").asc("u.username").asc("xx.hdzplx"); + cnd.asc("u.unionname").asc("u.unitname").asc("u.username").asc("xx.hdzplx"); + sql.setCondition(cnd); + List list = hdWmsbxxService.listMap(sql); + try { + + response.reset(); + response.setContentType("application/x-msdownload;charset=utf-8"); + + /** + * 创建临时文件夹 + */ + String tmpPath = "tmp/" + R.UU32(); + File tmpDir = new File(tmpPath + "/" + hdname); + tmpDir.mkdirs(); + for (NutMap item : list) { + + List fileList = dao.query(Sys_file.class, Cnd.where("reid", "=", item.getString("id"))); + /** + * 创建临时文件夹 + */ + /* File tDir = new File(tmpDir + "/" + fileName.replaceAll(" ", "-")); + tDir.mkdirs();*/ + + if (Lang.isNotEmpty(fileList)) { + for (Sys_file file : fileList) { + String fileName = item.getString("username") + "【" + item.getString("zplbname") + "】——" + file.getFilename(); + + if (Lang.isNotEmpty(file)) { + FileOutputStream outputStream = new FileOutputStream(tmpDir.getPath() + "/" + fileName); + ftpService.download(file.getFilepath(), outputStream); + outputStream.close(); + } + } + } + } + + String aimsDir = "zipTmp/" + R.UU32(); + String aimsName = hdname + ".zip"; + String aimsPath = aimsDir + "/" + aimsName; + FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName); + + response.setHeader("content-disposition", "attachment;filename=" + + URLEncoder.encode(aimsName, "UTF-8")); + + File aimsFile = new File(aimsPath); + FileInputStream inputStream = new FileInputStream(aimsFile); + org.apache.commons.io.IOUtils.copy(inputStream, response.getOutputStream()); + inputStream.close(); + aimsFile.delete(); + + FileUtil.deleteDir(new File(tmpPath)); + FileUtil.deleteDir(new File(aimsDir)); + } catch (Exception e) { + e.printStackTrace(); + } + /* //连接ftp + FTPClient ftpClient = new FTPClient(); + ftpClient.connect(conf.get(PROP_SERVER_HOST, ""), conf.getInt(PROP_SERVER_PORT, 21)); + ftpClient.login(conf.get(PROP_SERVER_USERNAME, ""), conf.get(PROP_SERVER_PASSWORD, "")); + ftpClient.enterLocalPassiveMode(); + + ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream())); + + list.forEach(item -> { + List fileList = dao.query(Sys_file.class, Cnd.where("reid", "=", item.getString("id"))); + if (Lang.isNotEmpty(fileList)) { + for (int i = 0; i < fileList.size(); i++) { + Sys_file file = fileList.get(i); + try { + String extension = file.getFilename().substring(file.getFilename().lastIndexOf(".")); + String newFileName = ""; + if (fileList.size() > 1) { + newFileName = item.getString("hdsbzpms").replaceAll("\n", "") + (i + 1) + extension; + } else { + newFileName = item.getString("hdsbzpms").replaceAll("\n", "") + extension; + } + String entryName = item.getString("ghname") + "/" + "【" + item.getString("username") + "】" + newFileName; + zipOutputStream.putNextEntry(new ZipEntry(entryName)); + //读取ftp文件 + InputStream inputStream = ftpClient.retrieveFileStream(file.getFilepath()); + org.apache.commons.io.IOUtils.copy(inputStream, zipOutputStream); + inputStream.close(); + zipOutputStream.closeEntry(); + ftpClient.completePendingCommand(); + response.flushBuffer(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }); + zipOutputStream.flush(); + zipOutputStream.close(); + ftpClient.logout();*/ + } + + @At("/exportExcel") + @Ok("void") + @RequiresPermissions("hd.wmhd.zpxx1") + public void exportExcel(HttpServletResponse response, + String hdid, + String hdname, + String hdlb, + String zplb, + String union, + String unit, + Integer isExcellent, + String stateId) { + Sql sql = Sqls.create(""" + SELECT + xx.id, + xx.hdzplx, + xx.hdsbzpms, + u.username, + u.sex, + u.loginname, + u.unitname AS dwname, + u.unionname AS ghname, + hd.hdname as hdname, + hdlb.lname as hdlbname, + zplb.zname as zplbname, + ( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id) dz_num + FROM + hd_wm_sbxx xx + LEFT JOIN hd_wm_xx hd ON hd.hdid = xx.hdid + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + LEFT JOIN `user` u ON u.id = xx.hdsbrid + $condition + """); + + Cnd cnd = Cnd.NEW(); + cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdzplx", "=", hdlb); + cnd.andEX("xx.hdzplx2", "=", zplb); + cnd.andEX("u.unionid", "=", union); + cnd.andEX("u.unitid", "=", unit); + cnd.andEX("xx.isExcellent", "=", isExcellent); + cnd.andEX("xx.auditState", "=", 4400); + if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { + if (ShiroUtil.hasRole("H04")) { + cnd.andEX("u.unionid", "=", Vi.getUnionId()); + } + } + cnd.asc("u.unionname").asc("u.unitname").asc("u.username").asc("xx.hdzplx"); sql.setCondition(cnd); List list = hdWmsbxxService.listMap(sql); List exportEntities = new ArrayList<>(); exportEntities.add(new ExcelExportEntity("姓名", "username", 20)); exportEntities.add(new ExcelExportEntity("工号", "loginname", 20)); + exportEntities.add(new ExcelExportEntity("性别", "sex", 20)); exportEntities.add(new ExcelExportEntity("单位", "dwname", 20)); exportEntities.add(new ExcelExportEntity("分工会", "ghname", 20)); + exportEntities.add(new ExcelExportEntity("作品主题", "hdname", 20)); exportEntities.add(new ExcelExportEntity("活动类别", "hdlbname", 20)); -// exportEntities.add(new ExcelExportEntity("作品类别", "zplbname", 20)); -// exportEntities.add(new ExcelExportEntity("作品主题", "hdsbzpzt", 20)); + exportEntities.add(new ExcelExportEntity("作品类别", "zplbname", 20)); + exportEntities.add(new ExcelExportEntity("创作说明", "hdsbzpms", 200)); + exportEntities.add(new ExcelExportEntity("点赞次数", "dz_num", 20)); try { - ExportParams exportParams = new ExportParams(); - exportParams.setType(ExcelType.XSSF); - ViTool.excelResponse(response, hdname + ".xlsx"); - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list); + ViTool.excelResponse(response, hdname + ".xls"); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, list); workbook.write(response.getOutputStream()); } catch (Exception e) { e.printStackTrace(); } - - - } - - - //发送响应流方法 - public void setResponseHeader(HttpServletResponse response, String fileName) { - try { - try { - fileName = new String(fileName.getBytes(), "ISO8859-1"); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - response.setContentType("application/octet-stream;charset=ISO8859-1"); - response.setHeader("Content-Disposition", "attachment;filename=" + fileName); - response.addHeader("Pargam", "no-cache"); - response.addHeader("Cache-Control", "no-cache"); - } catch (Exception ex) { - ex.printStackTrace(); - } } @Inject @@ -365,7 +538,7 @@ public class HdWmInfoController { */ @At("/downLoad") @Ok("void") - @RequiresAuthentication + @RequiresPermissions("hd.wmhd.zpxx1") public void download(String filepath, String filename, String username, HttpServletResponse response) { try { response.setContentType("application/octet-stream"); @@ -387,7 +560,7 @@ public class HdWmInfoController { */ @At("/YlDoc") @Ok("void") - @RequiresAuthentication + @RequiresPermissions("hd.wmhd.zpxx1") public void viewFJ(String fjurl, HttpServletRequest request, HttpServletResponse response) throws Exception { String destFile = ""; try { @@ -430,11 +603,15 @@ public class HdWmInfoController { } @At - @Ok("json:full") - @RequiresAuthentication public Object initHdxxlist() { try { - List list = hdWmsbxxService.list(Sqls.create("select *,year(hdcjsj) year from hd_wm_xx where hdtype=1 order by hdcjsj desc")); + String isSysadmin = " and hdcjr is not null"; + if (ShiroUtil.hasRole("H10")) { + isSysadmin = "and hdcjr = '" + ShiroUtil.getUserId() + "'"; + } + Sql sql = Sqls.create("select *,year(hdcjsj) year from hd_wm_xx where hdtype=1 and hdflag = true %s order by hdcjsj desc".formatted(isSysadmin)); + + List list = hdWmsbxxService.list(sql); List> result = new ArrayList>(); @@ -443,7 +620,14 @@ public class HdWmInfoController { listMap.forEach((k, v) -> { List> children = new ArrayList<>(); v.forEach(x -> { - children.add(Map.of("value", x.getString("hdid"), "label", x.getString("hdname"))); + /* children.add(Map.of("value", x.getString("hdid"), + "label", x.getString("hdname"), + "dzkssj", x.getString("dzkssj"), + "dzjssj", x.getString("dzjssj"), + "dzNum", x.getInt("dzNum") + ));*/ + children.add(Map.of("value", x.getString("hdid"), + "label", x.getString("hdname"))); }); Map parent = Map.of("value", k, "label", k, "children", children); @@ -458,8 +642,6 @@ public class HdWmInfoController { @At - @Ok("json:full") - @RequiresAuthentication public Object findOne(String id) { try { Hd_wm_sbxx sbxx = hdWmsbxxService.fetch(id); @@ -497,14 +679,38 @@ public class HdWmInfoController { @At - @POST @ViReturn - @Ok("json:full") - @RequiresAuthentication + @RequiresPermissions("hd.wmhd.zpxx1") public Object doDelete(String id) { dao.clear(Hd_wm_sbxx.class, Cnd.where("id", "=", id)); dao.clear(Sys_file.class, Cnd.where("reid", "=", id)); return null; } + @At + @ViReturn + @RequiresPermissions("hd.wmhd.zpxx1") + public Object getAuditStateByModule() { + return baseService.dao().query(AuditState.class, Cnd.where("module", "=", "hdwm")); + + } + + + @At + @ViReturn + @RequiresPermissions("hd.wmhd.zpxx1") + public Object doExcellent(String id) { + baseService.dao().update(Hd_wm_sbxx.class, Chain.make("isExcellent", true), Cnd.where("id", "=", id)); + return null; + } + + + @At + @ViReturn + @RequiresPermissions("hd.wmhd.zpxx1") + public Object cancelExcellent(String id) { + baseService.dao().update(Hd_wm_sbxx.class, Chain.make("isExcellent", false), Cnd.where("id", "=", id)); + return null; + } + } diff --git a/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmSchoolAuditController.java b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmSchoolAuditController.java new file mode 100644 index 0000000..c82e003 --- /dev/null +++ b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmSchoolAuditController.java @@ -0,0 +1,125 @@ +package io.v.nutz.hd.controller.wmhd; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.utils.PageUtil; +import io.v.nutz.hd.models.Hd_wm_sbxx; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +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.Lang; +import org.nutz.lang.Strings; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * TODO + * + * @Author zhf + * @Date 2022/11/24 15:07 + */ +@IocBean +@At("/platform/hd/wmhd/school/audit") +@Ok("json:full") +public class HdWmSchoolAuditController { + + + @At("") + @Ok("beetl:/platform/hd/wmhd/schoolAudit.html") + @RequiresPermissions("hd.wmhd.schoolAudit") + public void index() { + + } + + @Inject + private BaseService baseService; + + + @At + @ViReturn + @RequiresPermissions("hd.wmhd.schoolAudit") + public Object pageData(@Param(value = "stateId", required = false) String stateId, + String isAudit, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId, + PageForm page, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "hdlb", required = false) String hdlb, + @Param(value = "zplb", required = false) String zplb, + @Param(value = "year", required = false) String year) { + Sql sql = Sqls.create(""" + SELECT + xx.*, + u.username, + u.loginname, + u.unitname AS 'dwname', + u.unionname AS 'ghname', + hdlb.lname AS hdlbname, + zplb.zname AS zplbname, + zt.hdname, + state.stateColor, + state.stateName + FROM + hd_wm_sbxx xx + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + LEFT JOIN hd_wm_xx zt ON zt.hdid = xx.hdid + LEFT JOIN `user` u ON u.id = xx.hdsbrid + LEFT JOIN audit_state state ON state.stateId = xx.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(xx.hdsbsj)", "=", year); + cnd.andEX("u.unionid", "=", unionId); + cnd.andEX("u.unitid", "=", unitId); + cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdzplx", "=", hdlb); + cnd.andEX("xx.hdzplx2", "=", zplb); + cnd.andEX("xx.auditState", "=", stateId); + if (Strings.isNotBlank(page.getSearchKeyword()) && Strings.isNotBlank(page.getSearchName())) { + cnd.and(Cnd.likeEX(page.getSearchName(), page.getSearchKeyword())); + } + if (Strings.isNotBlank(isAudit)) { + cnd.and("xx.auditState", isAudit.equals("true") ? ">" : "=", "4200"); + } else { + cnd.and("xx.auditState", ">=", "4200"); + } + if (Strings.isNotBlank(page.getPageOrderName()) && Strings.isNotBlank(page.getPageOrderBy())) { + cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy())); + } else { + cnd.desc("xx.hdsbsj").asc("xx.auditState").asc("unioncode"); + } + sql.setCondition(cnd); + + return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql); + } + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + public Object doReview(@Param(value = "id", required = false) String id, + @Param(value = "ids", required = false) String[] ids, + Integer pass, + Audit audit) { + String auditState = (pass == 1 ? "4300" : pass == 2 ? "4250" : "4400"); + baseService.insert(audit); + if (Lang.isNotEmpty(ids)) { + baseService.dao().update(Hd_wm_sbxx.class, Chain.make("auditState", auditState).add("schoolAuditId", audit.getId()), Cnd.where("id", "in", ids)); + } else { + baseService.dao().update(Hd_wm_sbxx.class, Chain.make("auditState", auditState).add("schoolAuditId", audit.getId()), Cnd.where("id", "=", id)); + } + return null; + } + + +} diff --git a/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmUnionAuditController.java b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmUnionAuditController.java new file mode 100644 index 0000000..3523719 --- /dev/null +++ b/src/main/java/io/v/nutz/hd/controller/wmhd/HdWmUnionAuditController.java @@ -0,0 +1,139 @@ +package io.v.nutz.hd.controller.wmhd; + +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.utils.PageUtil; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.hd.models.Hd_wm_sbxx; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +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.Lang; +import org.nutz.lang.Strings; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * TODO + * + * @Author zhf + * @Date 2022/11/24 10:53 + */ +@IocBean +@At("/platform/hd/wmhd/union/audit") +@Ok("json:full") +public class HdWmUnionAuditController { + + + @At("") + @Ok("beetl:/platform/hd/wmhd/unionAudit.html") + @RequiresPermissions("hd.wmhd.unionAudit") + public void index() { + + } + + @Inject + private BaseService baseService; + + + @At + @ViReturn + @RequiresPermissions("hd.wmhd.unionAudit") + public Object pageData(@Param(value = "stateId", required = false) String stateId, + String isAudit, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId, + PageForm page, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "hdlb", required = false) String hdlb, + @Param(value = "zplb", required = false) String zplb, + @Param(value = "year", required = false) String year) { + + + Sql sql = Sqls.create(""" + SELECT + xx.*, + u.username, + u.loginname, + u.unitname AS 'dwname', + u.unionname AS 'ghname', + hdlb.lname AS hdlbname, + zplb.zname AS zplbname, + zt.hdname, + state.stateColor, + state.stateName + FROM + hd_wm_sbxx xx + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + LEFT JOIN hd_wm_xx zt ON zt.hdid = xx.hdid + LEFT JOIN `user` u ON u.id = xx.hdsbrid + LEFT JOIN audit_state state ON state.stateId = xx.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(xx.hdsbsj)", "=", year); + cnd.andEX("u.unionid", "=", unionId); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.andEX("u.unionid", "=", Vi.getUnionId()); + } + cnd.andEX("u.unitid", "=", unitId); + cnd.andEX("xx.hdid", "=", hdid); + cnd.andEX("xx.hdzplx", "=", hdlb); + cnd.andEX("xx.hdzplx2", "=", zplb); + cnd.andEX("xx.auditState", "=", stateId); + if (Strings.isNotBlank(page.getSearchKeyword()) && Strings.isNotBlank(page.getSearchName())) { + cnd.and(Cnd.likeEX(page.getSearchName(), page.getSearchKeyword())); + } + if (Strings.isNotBlank(isAudit)) { + cnd.and("xx.auditState", isAudit.equals("true") ? ">" : "=", "4000"); + } else { + cnd.and("xx.auditState", ">=", "4000"); + } + if (Strings.isNotBlank(page.getPageOrderName()) && Strings.isNotBlank(page.getPageOrderBy())) { + cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy())); + } else { + cnd.desc("xx.hdsbsj").asc("xx.auditState").asc("unioncode"); + } + sql.setCondition(cnd); + + return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql); + } + + + @At + @ViReturn + @RequiresPermissions("hd.wmhd.unionAudit") + @Aop(TransAop.READ_COMMITTED) + public Object doReview(@Param(value = "id", required = false) String id, + @Param(value = "ids", required = false)String[] ids, + Integer pass, + Audit audit) { + if (StrUtil.isBlank(id) && Lang.isEmptyArray(ids)) { + return Result.error("参数错误"); + } + + String auditState = (pass == 1 ? "4150" : pass == 2 ? "4100" : "4200"); + baseService.insert(audit); + if (Lang.isNotEmpty(ids)) { + baseService.dao().update(Hd_wm_sbxx.class, Chain.make("auditState", auditState).add("unionAuditId", audit.getId()), Cnd.where("id", "in", ids)); + } else { + baseService.dao().update(Hd_wm_sbxx.class, Chain.make("auditState", auditState).add("unionAuditId", audit.getId()), Cnd.where("id", "=", id)); + } + return null; + } + + +} diff --git a/src/main/java/io/v/nutz/hd/controller/wmhd/mobile/StaffActivitiesCon.java b/src/main/java/io/v/nutz/hd/controller/wmhd/mobile/StaffActivitiesCon.java index 9db9dec..5a64395 100644 --- a/src/main/java/io/v/nutz/hd/controller/wmhd/mobile/StaffActivitiesCon.java +++ b/src/main/java/io/v/nutz/hd/controller/wmhd/mobile/StaffActivitiesCon.java @@ -79,14 +79,14 @@ public class StaffActivitiesCon { @Ok("json") @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @RequiresAuthentication - public Object doSubmit(@Param("..") Hd_wm_sbxx sbxx, @Param("files") TempFile[] files) { + public Object doSubmit(@Param("..") Hd_wm_sbxx sbxx, @Param("files") TempFile[] files, boolean flag) { try { String path = new File("").getCanonicalPath(); - + sbxx.setAuditState(flag ? "4400" : "3999"); Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx); for (TempFile file : files) { - fileService.upload(file,insert.getId(),"/hd/hdwm/"); + fileService.upload(file, insert.getId(), "/hd/hdwm/"); } diff --git a/src/main/java/io/v/nutz/hd/controller/zxdt/AnswerController.java b/src/main/java/io/v/nutz/hd/controller/zxdt/AnswerController.java deleted file mode 100644 index f1fbadf..0000000 --- a/src/main/java/io/v/nutz/hd/controller/zxdt/AnswerController.java +++ /dev/null @@ -1,96 +0,0 @@ -package io.v.nutz.hd.controller.zxdt; - - -import cn.wizzer.framework.base.Result; -import io.v.nutz.annontation.ViReturn; -import io.v.nutz.base.utils.PageUtil; -import io.v.nutz.hd.models.Hd_papers; -import io.v.nutz.hd.models.Hd_subject_reply; -import io.v.nutz.hd.services.HdPaperService; -import io.v.nutz.hd.services.HdSubjectAnswerService; -import io.v.nutz.hd.services.HdSubjectReplyService; -import io.v.nutz.hd.services.HdSubjectService; -import io.v.nutz.util.ShiroUtil; -import org.apache.shiro.authz.annotation.RequiresAuthentication; -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.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; - -/** - * @author: Aaron - * @create: 2020-10-23 09:24 - * @description: 开始答题 - **/ -@At("/platform/hd/zxdt/answer") -@Ok("json:full") -@IocBean -@RequiresAuthentication -public class AnswerController { - - @Inject - private HdSubjectAnswerService hdSubjectAnswerService; - - @Inject - private HdPaperService hdPaperService; - - @Inject - private HdSubjectService hdSubjectService; - - @Inject - private HdSubjectReplyService hdSubjectReplyService; - - @At("") - @Ok("beetl:/platform/hd/zxdt/answer.html") - @RequiresPermissions("hd.zxdt.ksdt") - public void index() { - } - - @At - @ViReturn - public Object pageData(Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String pageOrderName, String pageOrderBy) { - Cnd cnd = Cnd.NEW(); - Sql sql = Sqls.create("SELECT id, `name`, explain_txt, answer_num, fraction, answer_start_time, answer_end_time, create_time FROM hd_papers $condition"); - - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - cnd.where().andLike(searchName, searchKeyword); - } - - if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) { - cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy)); - } else { - cnd.desc("create_time").desc("answer_start_time"); - } - - sql.setCondition(cnd); - return hdPaperService.listPage(pageNumber, pageSize, sql); - } - - @At - public Object doAdd(@Param("replyList") Hd_subject_reply[] replyList) { - try { - hdSubjectAnswerService.doAdd(replyList, (String) ShiroUtil.getPrincipalProperty("loginname")); - return Result.success(); - } catch (Exception e) { - e.printStackTrace(); - return Result.error(); - } - } - - @At - public Object findOne(String id) { - try { - Hd_papers hd_papers = (Hd_papers) hdSubjectAnswerService.findOne(id, (String) ShiroUtil.getPrincipalProperty("loginname")); - return Result.success().addData(hd_papers); - } catch (Exception e) { - e.printStackTrace(); - return Result.error(); - } - } -} diff --git a/src/main/java/io/v/nutz/hd/controller/zxdt/PapersController.java b/src/main/java/io/v/nutz/hd/controller/zxdt/PapersController.java deleted file mode 100644 index 003341b..0000000 --- a/src/main/java/io/v/nutz/hd/controller/zxdt/PapersController.java +++ /dev/null @@ -1,162 +0,0 @@ -package io.v.nutz.hd.controller.zxdt; - - -import cn.wizzer.framework.base.service.BaseService; -import io.v.nutz.annontation.ViReturn; -import io.v.nutz.base.utils.DateUtil; -import io.v.nutz.base.utils.PageUtil; -import io.v.nutz.hd.models.Hd_papers; -import io.v.nutz.hd.models.Hd_subject; -import io.v.nutz.hd.services.HdPaperService; -import io.v.nutz.hd.services.HdSubjectService; -import org.apache.shiro.authz.annotation.RequiresAuthentication; -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.ArrayList; -import java.util.List; - -/** - * @author: Aaron - * @create: 2020-10-21 09:45 - * @description: 试卷管理 - **/ -@At("/platform/hd/zxdt/papers") -@Ok("json:full") -@IocBean -@RequiresAuthentication -public class PapersController { - - @Inject - private BaseService baseService; - - @Inject - private HdPaperService hdPaperService; - - @Inject - private HdSubjectService hdSubjectService; - - @At("") - @Ok("beetl:/platform/hd/zxdt/papers.html") - @RequiresPermissions("hd.zxdt.sj") - public void index() { - } - - @At - @ViReturn - public Object pageData(Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String pageOrderName, String pageOrderBy) { - Cnd cnd = Cnd.NEW(); - Sql sql = Sqls.create("SELECT id, `name`, explain_txt, answer_num, fraction, answer_start_time, answer_end_time, create_time FROM hd_papers $condition"); - - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - cnd.where().andLike(searchName, searchKeyword); - } - - if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) { - cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy)); - } else { - cnd.desc("create_time"); - } - - sql.setCondition(cnd); - return hdPaperService.listPage(pageNumber, pageSize, sql); - } - - @At - @ViReturn - @Aop(TransAop.READ_COMMITTED) - public Object doAdd(@Param("papers") Hd_papers papers, @Param("subject") Hd_subject[] subject) { - papers.setCreate_time(DateUtil.getDate()); - ArrayList hd_subject = new ArrayList<>(); - for (Hd_subject hdSubject : subject) { - hd_subject.add(hdSubject); - } - papers.setSubjects(hd_subject); - hdPaperService.insertRelation(hdPaperService.insert(papers), "subjects"); - return null; - } - - @At - @ViReturn - @Aop(TransAop.READ_COMMITTED) - public Object doEdit(@Param("papers") Hd_papers papers, @Param("subject") Hd_subject[] subject) { - baseService.clear("hd_papers_subject", Cnd.where("pid", "=", papers.getId())); - papers.setCreate_time(DateUtil.getDate()); - hdPaperService.updateIgnoreNull(papers); - ArrayList hd_subject = new ArrayList<>(); - for (Hd_subject hdSubject : subject) { - hd_subject.add(hdSubject); - } - papers.setSubjects(hd_subject); - hdPaperService.insertRelation(papers, "subjects"); - return null; - } - - @At - @ViReturn - @Aop(TransAop.READ_COMMITTED) - public Object delete(String id) { - hdPaperService.delete(id); - baseService.clear("hd_papers_subject", Cnd.where("pid", "=", id)); - return null; - } - - @At - @ViReturn - public Object findOne(String id) { - Hd_papers hd_papers = hdPaperService.fetchLinks(hdPaperService.fetch(id), "subjects", Cnd.NEW().asc("location")); - List subjects = new ArrayList<>(); - hd_papers.getSubjects().forEach(v -> { - subjects.add(hdSubjectService.fetchLinks(hdSubjectService.fetch(v.getId()), "answer", Cnd.NEW().asc("location"))); - }); - hd_papers.setSubjects(subjects); - return hd_papers; - } - - @At - @ViReturn - public Object findSubject(Integer pageNumber, Integer pageSize, String type, String searchName, String searchKeyword, String pageOrderName, String pageOrderBy) { - Cnd cnd = Cnd.NEW(); - Sql sql = Sqls.create("SELECT\n" + - "\tsub.id,\n" + - "\tsub.`name`,\n" + - "\tsub.type,\n" + - "\tGROUP_CONCAT(ans.option_txt separator '、') option_txt\n" + - "FROM\n" + - "\thd_subject sub\n" + - "\tLEFT JOIN hd_subject_answer ans ON ans.subject_id = sub.id \n" + - "\tAND ans.is_yes = TRUE $condition"); - - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - cnd.where().andLike(searchName, searchKeyword); - } - - if (Strings.isNotBlank(type)) { - cnd.where().and("sub.type", "=", type); - } - - if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) { - cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy)); - } else { - cnd.desc("sub.location"); - } - - cnd.groupBy("sub.id"); - - sql.setCondition(cnd); - - return hdSubjectService.listPage(pageNumber, pageSize, sql); - } - - -} diff --git a/src/main/java/io/v/nutz/hd/controller/zxdt/ResultController.java b/src/main/java/io/v/nutz/hd/controller/zxdt/ResultController.java deleted file mode 100644 index 72bdebf..0000000 --- a/src/main/java/io/v/nutz/hd/controller/zxdt/ResultController.java +++ /dev/null @@ -1,111 +0,0 @@ -package io.v.nutz.hd.controller.zxdt; - -import io.v.nutz.annontation.ViReturn; -import io.v.nutz.base.utils.PageUtil; -import io.v.nutz.hd.models.Hd_papers; -import io.v.nutz.hd.models.Hd_subject; -import io.v.nutz.hd.services.HdPaperService; -import io.v.nutz.hd.services.HdSubjectReplyService; -import io.v.nutz.hd.services.HdSubjectService; -import org.apache.shiro.authz.annotation.RequiresAuthentication; -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.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 java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author: Aaron - * @create: 2020-10-24 08:48 - * @description: 统计分析 - **/ -@At("/platform/hd/zxdt/result") -@Ok("json:full") -@IocBean -@RequiresAuthentication -public class ResultController { - - @Inject - private HdPaperService hdPaperService; - - @Inject - private HdSubjectService hdSubjectService; - - @Inject - private HdSubjectReplyService hdSubjectReplyService; - - @At("") - @Ok("beetl:/platform/hd/zxdt/result.html") - @RequiresPermissions("hd.zxdt.tj") - public void index() { - } - - @At - @ViReturn - public Object pageData(Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String pageOrderName, String pageOrderBy) { - Cnd cnd = Cnd.NEW(); - Sql sql = Sqls.create("SELECT id, `name`, explain_txt, answer_num, fraction, answer_start_time, answer_end_time, create_time FROM hd_papers $condition"); - - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - cnd.where().andLike(searchName, searchKeyword); - } - - if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) { - cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy)); - } else { - cnd.desc("create_time"); - } - - sql.setCondition(cnd); - return hdPaperService.listPage(pageNumber, pageSize, sql); - } - - @At - @ViReturn - public Object findOne(String id) { - Map result = new HashMap(); - Hd_papers hd_papers = hdPaperService.fetchLinks(hdPaperService.fetch(id), "subjects", Cnd.NEW().asc("location")); - List subjects = new ArrayList<>(); - hd_papers.getSubjects().forEach(v -> { - subjects.add(hdSubjectService.fetchLinks(hdSubjectService.fetch(v.getId()), "answer", Cnd.NEW().asc("location"))); - }); - - hd_papers.setSubjects(subjects); - result.put("hd_papers", hd_papers); - - hd_papers.getSubjects().forEach(subject -> { - Map map = new HashMap(); - - Sql yxs = Sqls.create("SELECT COUNT(DISTINCT reply.unique_id) \n" + - "FROM hd_subject_reply reply\n" + - "WHERE reply.answer_id IN (SELECT ans.id FROM hd_subject_answer ans WHERE ans.subject_id = @subject_id)\n" + - "AND reply.papers_id = @papers_id").setParam("subject_id", subject.getId()).setParam("papers_id", id); - - Sql sql = Sqls.create("SELECT answer_id,count(DISTINCT unique_id) num \n" + - "FROM hd_subject_reply \n" + - "WHERE subject_id = @subject_id \n" + - "AND papers_id = @papers_id \n" + - "GROUP BY answer_id").setParam("subject_id", subject.getId()).setParam("papers_id", id); - - hdSubjectReplyService.list(sql).forEach(v -> { - map.put(v.getString("answer_id"), v.getInt("num")); - }); - - map.put("yxs", hdSubjectReplyService.count(yxs)); - - result.put(subject.getId(), map); - }); - - return result; - } - -} diff --git a/src/main/java/io/v/nutz/hd/controller/zxdt/SubjectController.java b/src/main/java/io/v/nutz/hd/controller/zxdt/SubjectController.java deleted file mode 100644 index a37957e..0000000 --- a/src/main/java/io/v/nutz/hd/controller/zxdt/SubjectController.java +++ /dev/null @@ -1,149 +0,0 @@ -package io.v.nutz.hd.controller.zxdt; - -import cn.wizzer.framework.base.Result; -import cn.wizzer.framework.base.service.BaseService; -import io.v.nutz.annontation.ViReturn; -import io.v.nutz.base.utils.DateUtil; -import io.v.nutz.base.utils.PageUtil; -import io.v.nutz.hd.models.Hd_subject; -import io.v.nutz.hd.models.Hd_subject_answer; -import io.v.nutz.hd.services.HdPaperService; -import io.v.nutz.hd.services.HdSubjectAnswerService; -import io.v.nutz.hd.services.HdSubjectService; -import org.apache.shiro.authz.annotation.RequiresAuthentication; -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.entity.Record; -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.ArrayList; -import java.util.List; - -/** - * @author: Aaron - * @create: 2020-10-21 09:45 - * @description: 题库管理 - **/ -@At("/platform/hd/zxdt/subject") -@Ok("json:full") -@IocBean -@RequiresAuthentication -public class SubjectController { - - @Inject - private BaseService baseService; - - @Inject - private HdPaperService hdPaperService; - - @Inject - private HdSubjectService hdSubjectService; - - @Inject - private HdSubjectAnswerService hdSubjectAnswerService; - - @At("") - @Ok("beetl:/platform/hd/zxdt/subject.html") - @RequiresPermissions("hd.zxdt.tk") - public void index() { - } - - @At - @ViReturn - public Object pageData(Integer pageNumber, Integer pageSize, String type, String searchName, String searchKeyword, String pageOrderName, String pageOrderBy) { - Cnd cnd = Cnd.NEW(); - Sql sql = Sqls.create("SELECT id, `name`, type, create_time FROM hd_subject $condition"); - - if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { - cnd.where().andLike(searchName, searchKeyword); - } - - if (Strings.isNotBlank(type)) { - cnd.where().and("type", "=", type); - } - - if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) { - cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy)); - } else { - cnd.desc("location"); - } - - sql.setCondition(cnd); - return hdSubjectService.listPage(pageNumber, pageSize, sql); - } - - @At - @ViReturn - @Aop(TransAop.READ_COMMITTED) - public Object doAdd(@Param("subject") Hd_subject subject) { - String time = DateUtil.getDate(); - - subject.setCreate_time(time); - - for (Hd_subject_answer answer : subject.getAnswer()) { - answer.setCreate_time(time); - } - hdSubjectService.insertWith(subject, "answer"); - return null; - } - - @At - @ViReturn - @Aop(TransAop.READ_COMMITTED) - public Object doEdit(@Param("subject") Hd_subject subject, String[] delOption) { - if (delOption.length > 0) { - for (String s : delOption) { - hdSubjectAnswerService.delete(s); - } - } - - String time = DateUtil.getDate(); - for (Hd_subject_answer answer : subject.getAnswer()) { - if (Strings.isBlank(answer.getSubject_id()) && Strings.isBlank(answer.getId())) { - answer.setCreate_time(time); - answer.setSubject_id(subject.getId()); - hdSubjectAnswerService.insert(answer); - } - } - - hdSubjectService.updateWith(subject, "answer"); - return null; - } - - @At - @Aop(TransAop.READ_COMMITTED) - public Object delete(String id) { - try { - List records = hdPaperService.list(Sqls.create("SELECT `name` FROM hd_papers WHERE id IN (SELECT pid FROM `hd_papers_subject` WHERE sid = @sid )").setParam("sid", id)); - List name = new ArrayList<>(); - if (records.size() > 0) { - records.forEach(v -> { - name.add(v.getString("name")); - }); - return Result.error().addMsg("试卷 " + name + " 正在使用该题"); - } - hdSubjectService.delete(id); - hdSubjectAnswerService.clear(Cnd.where("subject_id", "=", id)); - return Result.success(); - } catch (Exception e) { - return Result.error(); - } - } - - @At - @ViReturn - public Object findOne(String id) { - return hdSubjectService.fetchLinks(hdSubjectService.fetch(id), "answer", Cnd.NEW().asc("location")); - } - - -} diff --git a/src/main/java/io/v/nutz/hd/controller/zxdt/mobile/MobileAnswerController.java b/src/main/java/io/v/nutz/hd/controller/zxdt/mobile/MobileAnswerController.java deleted file mode 100644 index 723faba..0000000 --- a/src/main/java/io/v/nutz/hd/controller/zxdt/mobile/MobileAnswerController.java +++ /dev/null @@ -1,72 +0,0 @@ -package io.v.nutz.hd.controller.zxdt.mobile; - -import cn.wizzer.framework.base.Result; -import io.v.nutz.annontation.ViReturn; -import io.v.nutz.base.utils.Vi; -import io.v.nutz.hd.models.Hd_papers; -import io.v.nutz.hd.models.Hd_subject_reply; -import io.v.nutz.hd.services.HdSubjectAnswerService; -import io.v.nutz.hd.services.HdSubjectReplyService; -import io.v.nutz.hd.services.HdSubjectService; -import io.v.nutz.util.ShiroUtil; -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.Attr; -import org.nutz.mvc.annotation.Ok; -import org.nutz.mvc.annotation.Param; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -/** - * @author: Aaron - * @create: 2020-10-23 09:24 - * @description: 手机端答题 - **/ -@At("/platform/hd/zxdt/mobile/answer") -@Ok("json:full") -@IocBean -public class MobileAnswerController { - - @Inject - private HdSubjectAnswerService hdSubjectAnswerService; - - @Inject - private HdSubjectService hdSubjectService; - - @Inject - private HdSubjectReplyService hdSubjectReplyService; - - @Inject - private Vi vi; - - @At("") - @Ok("beetl:/platform/hd/zxdt/mobile/mobile_answer.html") - public void index(String papers_id, HttpSession session) { - session.setAttribute("papers_id", papers_id); - } - - @At - @ViReturn - public Object doAdd(@Param("replyList") Hd_subject_reply[] replyList, HttpServletRequest request) { - try { - hdSubjectAnswerService.doAdd(replyList, String.valueOf(Vi.getCookie(request, "sid"))); - return Result.success(); - } catch (Exception e) { - e.printStackTrace(); - return Result.error(); - } - } - - @At - public Object findOne(@Attr("papers_id") String papers_id) { - try { - Hd_papers hd_papers = (Hd_papers) hdSubjectAnswerService.findOne(papers_id, (String) ShiroUtil.getPrincipalProperty("loginname")); - return Result.success().addData(hd_papers); - } catch (Exception e) { - e.printStackTrace(); - return Result.error(); - } - } -} diff --git a/src/main/java/io/v/nutz/hd/models/HdCheckIn.java b/src/main/java/io/v/nutz/hd/models/HdCheckIn.java index ef18e8a..2fe05d2 100644 --- a/src/main/java/io/v/nutz/hd/models/HdCheckIn.java +++ b/src/main/java/io/v/nutz/hd/models/HdCheckIn.java @@ -1,5 +1,6 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; @@ -10,6 +11,7 @@ import java.util.List; * @Date 2022/4/22 * @Description 打卡签到活动 */ +@Data @Table("hd_checkin") public class HdCheckIn implements Serializable { @@ -96,139 +98,4 @@ public class HdCheckIn implements Serializable { private List files; - public List getFiles() { - return files; - } - - public void setFiles(List files) { - this.files = files; - } - - public String getRate() { - return rate; - } - - public void setRate(String rate) { - this.rate = rate; - } - - public List getBgis() { - return bgis; - } - - public void setBgis(List bgis) { - this.bgis = bgis; - } - - public String getHdid() { - return hdid; - } - - public void setHdid(String hdid) { - this.hdid = hdid; - } - - public String getHdname() { - return hdname; - } - - public void setHdname(String hdname) { - this.hdname = hdname; - } - - public String getHdjs() { - return hdjs; - } - - public void setHdjs(String hdjs) { - this.hdjs = hdjs; - } - - public String getHdcjry() { - return hdcjry; - } - - public void setHdcjry(String hdcjry) { - this.hdcjry = hdcjry; - } - - public String getHdjlfs() { - return hdjlfs; - } - - public void setHdjlfs(String hdjlfs) { - this.hdjlfs = hdjlfs; - } - - public String getHdnr() { - return hdnr; - } - - public void setHdnr(String hdnr) { - this.hdnr = hdnr; - } - - public String getHdlxr() { - return hdlxr; - } - - public void setHdlxr(String hdlxr) { - this.hdlxr = hdlxr; - } - - public String getHdother() { - return hdother; - } - - public void setHdother(String hdother) { - this.hdother = hdother; - } - - public String getHdkssj() { - return hdkssj; - } - - public void setHdkssj(String hdkssj) { - this.hdkssj = hdkssj; - } - - public String getHdjssj() { - return hdjssj; - } - - public void setHdjssj(String hdjssj) { - this.hdjssj = hdjssj; - } - - public Boolean getHdflag() { - return hdflag; - } - - public void setHdflag(Boolean hdflag) { - this.hdflag = hdflag; - } - - public String getHdcjr() { - return hdcjr; - } - - public void setHdcjr(String hdcjr) { - this.hdcjr = hdcjr; - } - - public String getHdcjsj() { - return hdcjsj; - } - - public void setHdcjsj(String hdcjsj) { - this.hdcjsj = hdcjsj; - } - - public String getHdcolor() { - return hdcolor; - } - - public void setHdcolor(String hdcolor) { - this.hdcolor = hdcolor; - } } diff --git a/src/main/java/io/v/nutz/hd/models/HdCheckZan.java b/src/main/java/io/v/nutz/hd/models/HdCheckZan.java index c895da3..b3d26d7 100644 --- a/src/main/java/io/v/nutz/hd/models/HdCheckZan.java +++ b/src/main/java/io/v/nutz/hd/models/HdCheckZan.java @@ -1,5 +1,6 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; @@ -9,6 +10,7 @@ import java.io.Serializable; * @Date 2022/4/22 * @Description */ +@Data @Table("hd_checkin_zan") public class HdCheckZan implements Serializable { @@ -36,35 +38,4 @@ public class HdCheckZan implements Serializable { @ColDefine(type = ColType.VARCHAR, width = 32) private String userid; - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getHdid() { - return hdid; - } - - public void setHdid(String hdid) { - this.hdid = hdid; - } - - public String getContentId() { - return contentId; - } - - public void setContentId(String contentId) { - this.contentId = contentId; - } - - public String getUserid() { - return userid; - } - - public void setUserid(String userid) { - this.userid = userid; - } } diff --git a/src/main/java/io/v/nutz/hd/models/HdCheckinContent.java b/src/main/java/io/v/nutz/hd/models/HdCheckinContent.java index 409a7c9..2458aad 100644 --- a/src/main/java/io/v/nutz/hd/models/HdCheckinContent.java +++ b/src/main/java/io/v/nutz/hd/models/HdCheckinContent.java @@ -1,5 +1,6 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; @@ -9,6 +10,7 @@ import java.io.Serializable; * @Date 2022/4/22 * @Description */ +@Data @Table("hd_checkin_content") public class HdCheckinContent implements Serializable { @@ -46,51 +48,4 @@ public class HdCheckinContent implements Serializable { @ColDefine(type = ColType.BOOLEAN) private Boolean isOpen; - public String getUserid() { - return userid; - } - - public void setUserid(String userid) { - this.userid = userid; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getHdid() { - return hdid; - } - - public void setHdid(String hdid) { - this.hdid = hdid; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Boolean getOpen() { - return isOpen; - } - - public void setOpen(Boolean open) { - isOpen = open; - } } diff --git a/src/main/java/io/v/nutz/hd/models/HdCheckinFile.java b/src/main/java/io/v/nutz/hd/models/HdCheckinFile.java index cf59ee4..e0e84b6 100644 --- a/src/main/java/io/v/nutz/hd/models/HdCheckinFile.java +++ b/src/main/java/io/v/nutz/hd/models/HdCheckinFile.java @@ -1,5 +1,6 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; @@ -9,6 +10,7 @@ import java.io.Serializable; * @Date 2022/4/22 * @Description */ +@Data @Table("hd_checkin_file") public class HdCheckinFile implements Serializable { @@ -41,43 +43,4 @@ public class HdCheckinFile implements Serializable { @ColDefine(type = ColType.VARCHAR,width = 100) private String name; - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getHdid() { - return hdid; - } - - public void setHdid(String hdid) { - this.hdid = hdid; - } - - public String getContentId() { - return contentId; - } - - public void setContentId(String contentId) { - this.contentId = contentId; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } } diff --git a/src/main/java/io/v/nutz/hd/models/Hd_papers.java b/src/main/java/io/v/nutz/hd/models/Hd_papers.java deleted file mode 100644 index 83b12b1..0000000 --- a/src/main/java/io/v/nutz/hd/models/Hd_papers.java +++ /dev/null @@ -1,65 +0,0 @@ -package io.v.nutz.hd.models; - -import cn.wizzer.framework.base.model.BaseModel; -import lombok.Data; -import org.nutz.dao.entity.annotation.*; -import org.nutz.integration.json4excel.annotation.J4EIgnore; - -import java.util.List; - -/** - * @author: Aaron - * @create: 2020-10-21 16:43 - * @description: 试卷 - **/ - -@Data -@Table("hd_papers") -public class Hd_papers extends BaseModel { - - @Column - @Name - @Comment("ID") - @ColDefine(type = ColType.VARCHAR, width = 32) - @Prev(els = {@EL("uuid()")}) - private String id; - - @Column - @Comment("试卷名称") - @J4EIgnore - @ColDefine(type = ColType.TEXT) - private String name; - - @Column - @Comment("说明") - @ColDefine(type = ColType.TEXT) - private String explain_txt; - - @Column - @Comment("分数") - @ColDefine(type = ColType.INT, width = 3) - private Integer fraction; - - @Column - @Comment("每日可答次数") - @ColDefine(type = ColType.INT, width = 2) - private Integer answer_num; - - @Column - @Comment("每日开始答题时间") - @ColDefine(type = ColType.VARCHAR, width = 50) - private String answer_start_time; - - @Column - @Comment("每日结束答题时间") - @ColDefine(type = ColType.VARCHAR, width = 50) - private String answer_end_time; - - @Column - @Comment("创建时间") - @ColDefine(type = ColType.VARCHAR, width = 30) - private String create_time; - - @ManyMany(relation = "hd_papers_subject", from = "pid", to = "sid") - private List subjects; -} diff --git a/src/main/java/io/v/nutz/hd/models/Hd_subject.java b/src/main/java/io/v/nutz/hd/models/Hd_subject.java deleted file mode 100644 index c39176c..0000000 --- a/src/main/java/io/v/nutz/hd/models/Hd_subject.java +++ /dev/null @@ -1,55 +0,0 @@ -package io.v.nutz.hd.models; - -import cn.wizzer.framework.base.model.BaseModel; -import lombok.Data; -import org.nutz.dao.DB; -import org.nutz.dao.entity.annotation.*; -import org.nutz.integration.json4excel.annotation.J4EIgnore; - -import java.util.List; - -/** - * @author: Aaron - * @create: 2020-10-21 09:56 - * @description: 题目 - **/ - -@Data -@Table("hd_subject") -public class Hd_subject extends BaseModel { - - @Column - @Name - @Comment("ID") - @ColDefine(type = ColType.VARCHAR, width = 32) - @Prev(els = {@EL("uuid()")}) - private String id; - - @Column - @Comment("题名") - @J4EIgnore - @ColDefine(type = ColType.TEXT) - private String name; - - @Column - @Comment("题型 (1.单选 2.多选 3.填空)") - @J4EIgnore - @ColDefine(type = ColType.INT, width = 2) - private Integer type; - - @Column - @Comment("创建时间") - @ColDefine(type = ColType.VARCHAR, width = 30) - private String create_time; - - @Column - @Comment("排序字段") - @Prev({ - @SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM hd_subject"), - @SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM hd_subject") - }) - private Integer location; - - @Many(field = "subject_id") - private List answer; -} diff --git a/src/main/java/io/v/nutz/hd/models/Hd_subject_answer.java b/src/main/java/io/v/nutz/hd/models/Hd_subject_answer.java deleted file mode 100644 index a258ef9..0000000 --- a/src/main/java/io/v/nutz/hd/models/Hd_subject_answer.java +++ /dev/null @@ -1,59 +0,0 @@ -package io.v.nutz.hd.models; - -import cn.wizzer.framework.base.model.BaseModel; -import lombok.Data; -import org.nutz.dao.DB; -import org.nutz.dao.entity.annotation.*; -import org.nutz.integration.json4excel.annotation.J4EIgnore; - -/** - * @author: Aaron - * @create: 2020-10-21 10:04 - * @description: 答案 - **/ - -@Data -@Table("hd_subject_answer") -public class Hd_subject_answer extends BaseModel { - - @Column - @Name - @Comment("ID") - @ColDefine(type = ColType.VARCHAR, width = 32) - @Prev(els = {@EL("uuid()")}) - private String id; - - @Column - @Comment("所属题目") - @J4EIgnore - @ColDefine(type = ColType.VARCHAR, width = 32) - private String subject_id; - - @Column - @Comment("选项文字") - @J4EIgnore - @ColDefine(type = ColType.VARCHAR, width = 200) - private String option_txt; - - @Column - @Comment("是否正确答案") - @J4EIgnore - @ColDefine(type = ColType.BOOLEAN) - private Boolean is_yes; - - @Column - @Comment("创建时间") - @ColDefine(type = ColType.VARCHAR, width = 30) - private String create_time; - - @Column - @Comment("排序字段") - @Prev({ - @SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM hd_subject_answer"), - @SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM hd_subject_answer") - }) - private Integer location; - - @One(field = "subject_id", key = "id") - private Hd_subject subject; -} diff --git a/src/main/java/io/v/nutz/hd/models/Hd_subject_reply.java b/src/main/java/io/v/nutz/hd/models/Hd_subject_reply.java deleted file mode 100644 index 91fdd53..0000000 --- a/src/main/java/io/v/nutz/hd/models/Hd_subject_reply.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.v.nutz.hd.models; - -import cn.wizzer.framework.base.model.BaseModel; -import lombok.Data; -import org.nutz.dao.DB; -import org.nutz.dao.entity.annotation.*; - -/** - * @author: Aaron - * @create: 2020-10-23 09:30 - * @description: 提交的试卷 - **/ - -@Data -@Table("hd_subject_reply") -public class Hd_subject_reply 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 papers_id; - - @Column - @Comment("所属题目") - @ColDefine(type = ColType.VARCHAR, width = 32) - private String subject_id; - - @Column - @Comment("所选答案") - @ColDefine(type = ColType.VARCHAR, width = 32) - private String answer_id; - - @Column - @Comment("唯一id") - @ColDefine(type = ColType.VARCHAR, width = 100) - private String unique_id; - - @Column - @Comment("提交时间") - @ColDefine(type = ColType.VARCHAR, width = 30) - private String submit_time; - - @Column - @Comment("排序字段") - @Prev({ - @SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM Hd_subject_reply"), - @SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM Hd_subject_reply") - }) - private Integer location; -} diff --git a/src/main/java/io/v/nutz/hd/models/Hd_wm_dz_xx.java b/src/main/java/io/v/nutz/hd/models/Hd_wm_dz_xx.java new file mode 100644 index 0000000..2248b46 --- /dev/null +++ b/src/main/java/io/v/nutz/hd/models/Hd_wm_dz_xx.java @@ -0,0 +1,43 @@ +package io.v.nutz.zhgh.hd.models; + +import lombok.Data; +import org.nutz.dao.entity.annotation.*; + +import java.io.Serializable; + +/** + * @ClassName Hd_wm_dz_xx + * @Description 作品征集点赞信息 + * @Author zhf + * @Date 2024/6/3 10:41 + */ +@Data +@Table +public class Hd_wm_dz_xx implements Serializable { + + @Column + @Name + @Comment("ID") + @Prev(els = {@EL("uuid()")}) + @ColDefine(type = ColType.VARCHAR, width = 32) + private String id; + + @Column + @Comment("作品id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String zpid; + + @Column + @Comment("hdid") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String hdid; + + @Column + @Comment("点赞人id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userid; + @Column + @Comment("点赞日期") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String applyDate; +} diff --git a/src/main/java/io/v/nutz/hd/models/Hd_wm_lb.java b/src/main/java/io/v/nutz/hd/models/Hd_wm_lb.java index b5fd0a7..d09c75a 100644 --- a/src/main/java/io/v/nutz/hd/models/Hd_wm_lb.java +++ b/src/main/java/io/v/nutz/hd/models/Hd_wm_lb.java @@ -1,5 +1,6 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; @@ -9,6 +10,7 @@ import java.util.List; * Created by lyw on 2020/3/13 11:10 * 三八活动类别 */ +@Data @Table("Hd_wm_lb") public class Hd_wm_lb implements Serializable { @@ -36,43 +38,4 @@ public class Hd_wm_lb implements Serializable { private List zplbs; - public List getZplbs() { - return zplbs; - } - - public void setZplbs(List zplbs) { - this.zplbs = zplbs; - } - - public String getLid() { - return lid; - } - - public void setLid(String lid) { - this.lid = lid; - } - - public String getLhdid() { - return lhdid; - } - - public void setLhdid(String lhdid) { - this.lhdid = lhdid; - } - - public String getLname() { - return lname; - } - - public void setLname(String lname) { - this.lname = lname; - } - - public int getLlocation() { - return llocation; - } - - public void setLlocation(int llocation) { - this.llocation = llocation; - } } diff --git a/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx.java b/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx.java index 57c3b56..22dacf3 100644 --- a/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx.java +++ b/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx.java @@ -1,9 +1,11 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; +@Data @Table("Hd_wm_sbxx") @TableIndexes({@Index(name = "INDEX_HDWMSB_HBSBRID", fields = {"hdsbrid"}, unique = false)}) public class Hd_wm_sbxx implements Serializable { @@ -22,14 +24,6 @@ public class Hd_wm_sbxx implements Serializable { @ColDefine(type = ColType.VARCHAR, width = 32) private String hdid; - public String getHdid() { - return hdid; - } - - public void setHdid(String hdid) { - this.hdid = hdid; - } - @Column @Comment("上报人id") @ColDefine(type = ColType.VARCHAR, width = 32) @@ -52,9 +46,14 @@ public class Hd_wm_sbxx implements Serializable { @Column @Comment("作品描述") - @ColDefine(type = ColType.VARCHAR, width = 100) + @ColDefine(type = ColType.TEXT) private String hdsbzpms; + @Column + @Comment("作品名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String zpmc; + @Column @Comment("上报时间") @ColDefine(type = ColType.VARCHAR, width = 20) @@ -65,67 +64,29 @@ public class Hd_wm_sbxx implements Serializable { @ColDefine(type = ColType.VARCHAR, width = 20) private String mobile; - public String getId() { - return id; - } + @Column + @Comment("状态") + @ColDefine(type = ColType.VARCHAR, width = 20) + private String auditState; - public void setId(String id) { - this.id = id; - } + @Column + @Comment("分工会审核id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionAuditId; - public String getHdsbrid() { - return hdsbrid; - } + @Column + @Comment("校工会审核id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String schoolAuditId; - public void setHdsbrid(String hdsbrid) { - this.hdsbrid = hdsbrid; - } + @Column + @Comment("是否发送系统消息") + @ColDefine(type = ColType.BOOLEAN) + private Boolean xlFlag; - public String getHdsbsj() { - return hdsbsj; - } + @Column + @Comment("是否优秀作品") + @ColDefine(type = ColType.BOOLEAN) + private Boolean isExcellent; - public void setHdsbsj(String hdsbsj) { - this.hdsbsj = hdsbsj; - } - - public String getHdsbzpzt() { - return hdsbzpzt; - } - - public void setHdsbzpzt(String hdsbzpzt) { - this.hdsbzpzt = hdsbzpzt; - } - - public String getHdsbzpms() { - return hdsbzpms; - } - - public void setHdsbzpms(String hdsbzpms) { - this.hdsbzpms = hdsbzpms; - } - - public String getHdzplx() { - return hdzplx; - } - - public void setHdzplx(String hdzplx) { - this.hdzplx = hdzplx; - } - - public String getHdzplx2() { - return hdzplx2; - } - - public void setHdzplx2(String hdzplx2) { - this.hdzplx2 = hdzplx2; - } - - public String getMobile() { - return mobile; - } - - public void setMobile(String mobile) { - this.mobile = mobile; - } } diff --git a/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx_fj.java b/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx_fj.java index dbf14ce..a553e7b 100644 --- a/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx_fj.java +++ b/src/main/java/io/v/nutz/hd/models/Hd_wm_sbxx_fj.java @@ -1,9 +1,11 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; +@Data @Table("Hd_wm_sbxx_fj") @TableIndexes({@Index(name = "INDEX_HDWMSB_FJ_HBSBID", fields = {"hdsbid"}, unique = false)}) public class Hd_wm_sbxx_fj implements Serializable { @@ -31,35 +33,4 @@ public class Hd_wm_sbxx_fj implements Serializable { @ColDefine(type = ColType.VARCHAR,width = 100) private String fjname; - public String getFjid() { - return fjid; - } - - public void setFjid(String fjid) { - this.fjid = fjid; - } - - public String getHdsbid() { - return hdsbid; - } - - public void setHdsbid(String hdsbid) { - this.hdsbid = hdsbid; - } - - public String getFjurl() { - return fjurl; - } - - public void setFjurl(String fjurl) { - this.fjurl = fjurl; - } - - public String getFjname() { - return fjname; - } - - public void setFjname(String fjname) { - this.fjname = fjname; - } } diff --git a/src/main/java/io/v/nutz/hd/models/Hd_wm_xx.java b/src/main/java/io/v/nutz/hd/models/Hd_wm_xx.java index 5461b5f..37b21d5 100644 --- a/src/main/java/io/v/nutz/hd/models/Hd_wm_xx.java +++ b/src/main/java/io/v/nutz/hd/models/Hd_wm_xx.java @@ -65,6 +65,21 @@ public class Hd_wm_xx implements Serializable { @ColDefine(type = ColType.VARCHAR, width = 50) private String hdjssj; + @Column + @Comment("点赞开始时间") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String dzkssj; + + @Column + @Comment("点赞结束时间") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String dzjssj; + + @Column + @Comment("每人每日点赞次数") + @ColDefine(type = ColType.INT) + private Integer dzNum; + @Column @Comment("活动状态 (开启 关闭)") @ColDefine(type = ColType.BOOLEAN) @@ -84,21 +99,21 @@ public class Hd_wm_xx implements Serializable { @Comment("配色") @ColDefine(type = ColType.VARCHAR, width = 50) private String hdcolor; + @Column + @Comment("活动范围Id") + @ColDefine(type = ColType.INT, width = 32) + private Integer activityGroupId; + + @Column + @Comment("活动范围名称") + @ColDefine(type = ColType.VARCHAR, width = 40) + private String activityGroupName; @Column @Comment("活动类型(1 教工 2 亲子)") @ColDefine(type = ColType.INT, width = 1) private Integer hdtype; - - public Integer getHdtype() { - return hdtype; - } - - public void setHdtype(Integer hdtype) { - this.hdtype = hdtype; - } - private List lbs; private List bgis; @@ -109,5 +124,26 @@ public class Hd_wm_xx implements Serializable { @ColDefine(type = ColType.MYSQL_JSON) private List files; + @Column + @Comment("是否发送系统消息") + @ColDefine(type = ColType.BOOLEAN) + private Boolean xlFlag; + + + @Column + @Comment("是否推送移动端首页") + @ColDefine(type = ColType.INT) + private Integer isPushHome; + + @Column + @Comment("是否启用积分系统") + @ColDefine(type = ColType.BOOLEAN) + private Boolean isIntegral; + + @Column + @Comment("任务id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String taskId; + } diff --git a/src/main/java/io/v/nutz/hd/models/Hd_wm_zplb.java b/src/main/java/io/v/nutz/hd/models/Hd_wm_zplb.java index acd4c91..e052324 100644 --- a/src/main/java/io/v/nutz/hd/models/Hd_wm_zplb.java +++ b/src/main/java/io/v/nutz/hd/models/Hd_wm_zplb.java @@ -1,13 +1,16 @@ package io.v.nutz.hd.models; +import lombok.Data; import org.nutz.dao.entity.annotation.*; import java.io.Serializable; +import java.util.List; /** * Created by lyw on 2020/3/13 11:10 * 三八活动作品类别 */ +@Data @Table("Hd_wm_zplb") public class Hd_wm_zplb implements Serializable { @@ -28,40 +31,54 @@ public class Hd_wm_zplb implements Serializable { @ColDefine(type = ColType.VARCHAR, width = 100) private String zname; + @Column + @Comment("作品介绍最多字数") + @ColDefine(type = ColType.INT, width = 20) + private Integer maxWordCount; + + @Column + @Comment("是否上传图片") + @ColDefine(type = ColType.BOOLEAN) + private Boolean isUploadPhoto; + + @Column + @Comment("上传图片数量") + @ColDefine(type = ColType.INT, width = 10) + private Integer photoNum; + + @Column + @Comment("上传图片格式") + @ColDefine(type = ColType.MYSQL_JSON) + private List photoType; + + @Column + @Comment("每张图片大小") + @ColDefine(type = ColType.INT, width = 10) + private Integer photoSize; + + @Column + @Comment("是否上传音/视频、文档") + @ColDefine(type = ColType.BOOLEAN) + private Boolean isUploadOther; + + @Column + @Comment("上传音/视频、文档数量") + @ColDefine(type = ColType.INT, width = 10) + private Integer otherFileNum; + + @Column + @Comment("上传音/视频、文档格式") + @ColDefine(type = ColType.MYSQL_JSON) + private List otherType; + + @Column + @Comment("每个音/视频、文档大小") + @ColDefine(type = ColType.INT, width = 10) + private Integer otherSize; + @Column @Comment("排序") @ColDefine(type = ColType.INT, width = 4) private int zlocation; - public String getZid() { - return zid; - } - - public void setZid(String zid) { - this.zid = zid; - } - - public String getZlid() { - return zlid; - } - - public void setZlid(String zlid) { - this.zlid = zlid; - } - - public String getZname() { - return zname; - } - - public void setZname(String zname) { - this.zname = zname; - } - - public int getZlocation() { - return zlocation; - } - - public void setZlocation(int zlocation) { - this.zlocation = zlocation; - } } diff --git a/src/main/java/io/v/nutz/hd/services/HdPaperService.java b/src/main/java/io/v/nutz/hd/services/HdPaperService.java deleted file mode 100644 index 821072b..0000000 --- a/src/main/java/io/v/nutz/hd/services/HdPaperService.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.v.nutz.hd.services; - - -import io.v.nutz.base.service.BaseService; -import io.v.nutz.hd.models.Hd_papers; - -public interface HdPaperService extends BaseService { -} diff --git a/src/main/java/io/v/nutz/hd/services/HdSubjectAnswerService.java b/src/main/java/io/v/nutz/hd/services/HdSubjectAnswerService.java deleted file mode 100644 index 1741341..0000000 --- a/src/main/java/io/v/nutz/hd/services/HdSubjectAnswerService.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.v.nutz.hd.services; - -import io.v.nutz.base.service.BaseService; -import io.v.nutz.hd.models.Hd_subject_answer; -import io.v.nutz.hd.models.Hd_subject_reply; - -public interface HdSubjectAnswerService extends BaseService { - - void doAdd(Hd_subject_reply[] replyList, String unique_id) throws Exception; - - Object findOne(String id, String unique_id) throws Exception; -} diff --git a/src/main/java/io/v/nutz/hd/services/HdSubjectReplyService.java b/src/main/java/io/v/nutz/hd/services/HdSubjectReplyService.java deleted file mode 100644 index e45fcdc..0000000 --- a/src/main/java/io/v/nutz/hd/services/HdSubjectReplyService.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.v.nutz.hd.services; - - -import io.v.nutz.base.service.BaseService; -import io.v.nutz.hd.models.Hd_subject_reply; - -public interface HdSubjectReplyService extends BaseService { -} diff --git a/src/main/java/io/v/nutz/hd/services/HdSubjectService.java b/src/main/java/io/v/nutz/hd/services/HdSubjectService.java deleted file mode 100644 index cbca29b..0000000 --- a/src/main/java/io/v/nutz/hd/services/HdSubjectService.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.v.nutz.hd.services; - - -import io.v.nutz.base.service.BaseService; -import io.v.nutz.hd.models.Hd_subject; - -public interface HdSubjectService extends BaseService { -} diff --git a/src/main/java/io/v/nutz/hd/services/impl/HdPaperServiceImpl.java b/src/main/java/io/v/nutz/hd/services/impl/HdPaperServiceImpl.java deleted file mode 100644 index df030ae..0000000 --- a/src/main/java/io/v/nutz/hd/services/impl/HdPaperServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.v.nutz.hd.services.impl; - -import io.v.nutz.base.service.impl.BaseServiceImpl; -import io.v.nutz.hd.models.Hd_papers; -import io.v.nutz.hd.services.HdPaperService; -import org.nutz.dao.Dao; -import org.nutz.ioc.loader.annotation.IocBean; - -/** - * @author: Aaron - * @create: 2020-10-21 10:39 - * @description: - **/ -@IocBean(args = {"refer:dao"}) -public class HdPaperServiceImpl extends BaseServiceImpl implements HdPaperService { - - public HdPaperServiceImpl(Dao dao) { - super(dao); - } -} diff --git a/src/main/java/io/v/nutz/hd/services/impl/HdSubjectAnswerServiceImpl.java b/src/main/java/io/v/nutz/hd/services/impl/HdSubjectAnswerServiceImpl.java deleted file mode 100644 index 3524aef..0000000 --- a/src/main/java/io/v/nutz/hd/services/impl/HdSubjectAnswerServiceImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -package io.v.nutz.hd.services.impl; - -import io.v.nutz.base.service.impl.BaseServiceImpl; -import io.v.nutz.base.utils.DateUtil; -import io.v.nutz.hd.models.Hd_papers; -import io.v.nutz.hd.models.Hd_subject; -import io.v.nutz.hd.models.Hd_subject_answer; -import io.v.nutz.hd.models.Hd_subject_reply; -import io.v.nutz.hd.services.HdPaperService; -import io.v.nutz.hd.services.HdSubjectAnswerService; -import io.v.nutz.hd.services.HdSubjectReplyService; -import io.v.nutz.hd.services.HdSubjectService; -import org.nutz.aop.interceptor.ioc.TransAop; -import org.nutz.dao.Cnd; -import org.nutz.dao.Dao; -import org.nutz.dao.Sqls; -import org.nutz.dao.entity.Record; -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 java.util.ArrayList; -import java.util.List; - -/** - * @author: Aaron - * @create: 2020-10-21 10:39 - * @description: - **/ -@IocBean(args = {"refer:dao"}) -public class HdSubjectAnswerServiceImpl extends BaseServiceImpl implements HdSubjectAnswerService { - - public HdSubjectAnswerServiceImpl(Dao dao) { - super(dao); - } - - @Inject - private HdPaperService hdPaperService; - - @Inject - private HdSubjectService hdSubjectService; - - @Inject - private HdSubjectReplyService hdSubjectReplyService; - - @Override - @Aop(TransAop.READ_COMMITTED) - public void doAdd(Hd_subject_reply[] replyList, String unique_id) throws Exception { - String time = DateUtil.getDateTime(); - for (Hd_subject_reply reply : replyList) { - reply.setSubmit_time(time); - reply.setUnique_id(unique_id); - hdSubjectReplyService.insert(reply); - } - } - - @Override - public Object findOne(String id, String unique_id) { - Sql sql = Sqls.create("SELECT\n" + - "\t(\n" + - "\tSELECT\n" + - "\t\tcount( DISTINCT sr.papers_id ) \n" + - "\tFROM\n" + - "\t\t`hd_subject_reply` sr \n" + - "\tWHERE\n" + - "\t\tsr.papers_id = @papers_id \n" + - "\t\tAND sr.unique_id = @unique_id \n" + - "\t\tAND sr.submit_time = @submit_time \n" + - "\t) >= p.answer_num flag\n" + - "FROM\n" + - "\t`hd_papers` p\n" + - "\tLEFT JOIN hd_subject_reply sr ON p.id = sr.papers_id \n" + - "GROUP BY\n" + - "\tsr.papers_id").setParam("papers_id", id) - .setParam("unique_id", unique_id) - .setParam("submit_time", DateUtil.getDate()); - Record record = hdPaperService.list(sql).get(0); - if (record.getInt("flag") > 0) { - return null; - } - - Hd_papers hd_papers = hdPaperService.fetchLinks(hdPaperService.fetch(id), "subjects", Cnd.NEW().asc("location")); - List subjects = new ArrayList<>(); - hd_papers.getSubjects().forEach(v -> { - subjects.add(hdSubjectService.fetchLinks(hdSubjectService.fetch(v.getId()), "answer", Cnd.NEW().asc("location"))); - }); - hd_papers.setSubjects(subjects); - return hd_papers; - } -} diff --git a/src/main/java/io/v/nutz/hd/services/impl/HdSubjectReplyServiceImpl.java b/src/main/java/io/v/nutz/hd/services/impl/HdSubjectReplyServiceImpl.java deleted file mode 100644 index 79a5bc1..0000000 --- a/src/main/java/io/v/nutz/hd/services/impl/HdSubjectReplyServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.v.nutz.hd.services.impl; - -import io.v.nutz.base.service.impl.BaseServiceImpl; -import io.v.nutz.hd.models.Hd_subject_reply; -import io.v.nutz.hd.services.HdSubjectReplyService; -import org.nutz.dao.Dao; -import org.nutz.ioc.loader.annotation.IocBean; - -/** - * @author: Aaron - * @create: 2020-10-21 10:39 - * @description: - **/ -@IocBean(args = {"refer:dao"}) -public class HdSubjectReplyServiceImpl extends BaseServiceImpl implements HdSubjectReplyService { - - public HdSubjectReplyServiceImpl(Dao dao) { - super(dao); - } -} diff --git a/src/main/java/io/v/nutz/hd/services/impl/HdSubjectServiceImpl.java b/src/main/java/io/v/nutz/hd/services/impl/HdSubjectServiceImpl.java deleted file mode 100644 index 7f5d8ed..0000000 --- a/src/main/java/io/v/nutz/hd/services/impl/HdSubjectServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.v.nutz.hd.services.impl; - -import io.v.nutz.base.service.impl.BaseServiceImpl; -import io.v.nutz.hd.models.Hd_subject; -import io.v.nutz.hd.services.HdSubjectService; -import org.nutz.dao.Dao; -import org.nutz.ioc.loader.annotation.IocBean; - -/** - * @author: Aaron - * @create: 2020-10-21 10:39 - * @description: - **/ -@IocBean(args = {"refer:dao"}) -public class HdSubjectServiceImpl extends BaseServiceImpl implements HdSubjectService { - - public HdSubjectServiceImpl(Dao dao) { - super(dao); - } -} diff --git a/src/main/java/io/v/nutz/jf/controller/activitybx/AccountingCon.java b/src/main/java/io/v/nutz/jf/controller/activitybx/AccountingCon.java index 433fb66..c7b8158 100644 --- a/src/main/java/io/v/nutz/jf/controller/activitybx/AccountingCon.java +++ b/src/main/java/io/v/nutz/jf/controller/activitybx/AccountingCon.java @@ -3,6 +3,7 @@ package io.v.nutz.jf.controller.activitybx; import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.utils.DateUtil; import io.v.nutz.base.utils.Vi; +import io.v.nutz.common.models.Goods; import io.v.nutz.jf.model.ActivityBx; import io.v.nutz.jf.service.ActivityBxService; import io.v.nutz.sys.models.Sys_signature; @@ -14,10 +15,14 @@ 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.json.Json; import org.nutz.lang.Strings; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; +import java.util.List; + /** * @author zhf * @date 2020/11/14 14:55 @@ -49,29 +54,33 @@ public class AccountingCon { @At @ViReturn public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) { - Sql sql = Sqls.create("\t\n" + - "SELECT\n" + - "\tact.*,\n" + - "\tu.loginname bxr_loginname,\n" + - "\tu.unionname bxr_unionname,\n" + - "\tu.unioncode,\n" + - "\ts.state_name,\n" + - "\ts.state_color \n" + - "FROM\n" + - "\t`activity_bx` act\n" + - "\tLEFT JOIN `user` u ON act.user_id = u.id\n" + - "\tLEFT JOIN state s ON act.state_id = s.state_id $condition"); + Sql sql = Sqls.create(""" + SELECT + bx.*, + bxr.loginname bxr_loginname, + bxr.unionname bxr_unionname, + bxr.unioncode, + state.state_name, + state.state_color, + abs.`name` absName + FROM + activity_bx bx + LEFT JOIN `user` bxr ON bx.user_id = bxr.id + LEFT JOIN state state ON state.state_id = bx.state_id + LEFT JOIN activity_basic_settings abs ON abs.`code` = bx.projectTypeCode + $condition + """); Cnd cnd = Cnd.NEW(); if (isAudit == 1) { - cnd.and("act.state_id", ">=", 1020); + cnd.and("bx.state_id", ">=", 1020); } else { - cnd.and("act.state_id", isAudit == 2 ? ">" : "=", 1020); + cnd.and("bx.state_id", isAudit == 2 ? ">" : "=", 1020); } - Vi.cndPlus(cnd, "act.year", "=", year); + Vi.cndPlus(cnd, "bx.year", "=", year); if (Vi.isNotBlank(searchName, searchKeyword)) { cnd.where().andLike(searchName, searchKeyword); } @@ -79,18 +88,20 @@ public class AccountingCon { if (Vi.isNotBlank(pageOrderName, pageOrderBy)) { cnd.orderBy(pageOrderName, pageOrderBy); } else { - cnd.asc("act.state_id").desc("act.apply_time"); + cnd.asc("bx.state_id").desc("bx.apply_time"); } Vi.cndPlus(cnd, "u.unitid", "=", unitId); Vi.cndPlus(cnd, "u.unionid", "=", unionId); sql.setCondition(cnd); - return activityBxService.listPage(pageNumber, pageSize, sql); + return activityBxService.listPageMap(pageNumber, pageSize, sql); } @At @ViReturn - public Object doReview(String id, String idea, String sign, Boolean flag) { + public Object doReview(String id, String idea, String sign, Boolean flag, String goods) { + List goodsList = Json.fromJsonAsList(Goods.class, goods); ActivityBx aid = activityBxService.fetch(id); + aid.setGoods(goodsList); aid.setState_id(flag ? "1030" : "1025"); aid.setAccounting_name(ShiroUtil.getPrincipalProperty("id").toString()); aid.setAccounting_time(DateUtil.getDate()); @@ -102,5 +113,11 @@ public class AccountingCon { return null; } + @At + @ViReturn + public Object getGoods(String id) { + return activityBxService.dao().query(Goods.class, Cnd.where("reid", "=", id)); + } + } diff --git a/src/main/java/io/v/nutz/jf/controller/activitybx/ApplyController.java b/src/main/java/io/v/nutz/jf/controller/activitybx/ApplyController.java index 8688351..5e12fb9 100644 --- a/src/main/java/io/v/nutz/jf/controller/activitybx/ApplyController.java +++ b/src/main/java/io/v/nutz/jf/controller/activitybx/ApplyController.java @@ -55,16 +55,7 @@ public class ApplyController { @ViReturn public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) { activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR)); - if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "A06"}) && activityBx.getActivity_type().equals(2)) { - activityBx.setState_id("1020"); - activityBx.setActivity_type(2); - } else if (ShiroUtil.hasAnyRoles(new String[]{"H02"}) && activityBx.getActivity_type().equals(3)) { - activityBx.setState_id("1020"); - activityBx.setActivity_type(3); - } else { - activityBx.setState_id("1010"); - activityBx.setActivity_type(1); - } + activityBx.setState_id("1020"); activityBx.setApply_time(DateUtil.getDate()); activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString()); if (Strings.isNotBlank(sign)) { @@ -74,4 +65,13 @@ public class ApplyController { return null; } + @At + @ViReturn + public Object doEdit(@Param("activityBx") ActivityBx activityBx) { + activityBx.setApply_time(DateUtil.getDate()); + activityBx.setState_id("1020"); + activityBxService.doEdit(activityBx); + return null; + } + } diff --git a/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementCon.java b/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementCon.java index 57a9b3c..1f6c6e7 100644 --- a/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementCon.java +++ b/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementCon.java @@ -1,25 +1,24 @@ package io.v.nutz.jf.controller.activitybx; -import cn.wizzer.framework.base.service.BaseService; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; import com.deepoove.poi.data.PictureRenderData; import com.deepoove.poi.policy.HackLoopTableRenderPolicy; import io.v.nutz.annontation.ViReturn; -import io.v.nutz.base.utils.DateUtil; +import io.v.nutz.base.service.BaseService; import io.v.nutz.base.utils.Html2Text; -import io.v.nutz.base.utils.Roles; import io.v.nutz.base.utils.Vi; import io.v.nutz.jf.model.ActivityBx; import io.v.nutz.jf.model.ActivityFile; import io.v.nutz.jf.service.ActivityBxService; import io.v.nutz.jf.service.ActivityFileService; -import io.v.nutz.sys.models.Sys_signature; +import io.v.nutz.sys.models.Sys_file; import io.v.nutz.sys.services.SysSignatureService; import io.v.nutz.util.MoneyUtil; import io.v.nutz.web.commons.utils.ShiroUtil; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.dao.Chain; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; @@ -28,16 +27,17 @@ import org.nutz.dao.util.cri.SqlExpressionGroup; import org.nutz.dao.util.cri.Static; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; +import org.nutz.lang.Lang; 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.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.util.Base64; -import java.util.Calendar; import java.util.LinkedHashMap; import java.util.List; import java.util.stream.Collectors; @@ -49,7 +49,7 @@ import java.util.stream.Collectors; */ @IocBean @Ok("json") -@At("/platform/jf/activity_bx/recording") +@At("/platform/jf/activity_bx/reimbursement") public class ReimbursementCon { @@ -68,34 +68,11 @@ public class ReimbursementCon { private ActivityFileService activityFileService; @At("") - @Ok("beetl:/platform/jf/activitybx/recording.html") - @RequiresPermissions("sys.jf.activity_bx.recording") + @Ok("beetl:/platform/jf/activitybx/reimbursement.html") + @RequiresPermissions("sys.jf.activity_bx.reimbursement") public void index() { } - @At - @ViReturn - public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) { - activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR)); - if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "A06"}) && activityBx.getActivity_type().equals(2)) { - activityBx.setState_id("1020"); - activityBx.setActivity_type(2); - } else if (ShiroUtil.hasAnyRoles(new String[]{"H02"}) && activityBx.getActivity_type().equals(3)) { - activityBx.setState_id("1000"); - activityBx.setActivity_type(3); - } else { - activityBx.setState_id("1010"); - activityBx.setActivity_type(1); - } - activityBx.setApply_time(DateUtil.getDate()); - activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString()); - if (Strings.isNotBlank(sign)) { - activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId()); - } - activityBxService.doAdd(activityBx); - return null; - } - /** * 多功能查询 * @@ -120,91 +97,16 @@ public class ReimbursementCon { bxr.unionname bxr_unionname, bxr.unioncode, state.state_name, - state.state_color,( - CASE - state.state_id - WHEN @state1 THEN - ( - SELECT - GROUP_CONCAT( u.username ) - FROM - sys_user_role sur - LEFT JOIN sys_user u ON sur.userId = u.id - WHERE - sur.roleId = @role1 - ) - WHEN @state2 THEN - ( - SELECT - GROUP_CONCAT( u.username ) - FROM - sys_user_role sur - LEFT JOIN sys_user u ON sur.userId = u.id - WHERE - sur.unionid = bxr.unionid - AND sur.roleId = @role2 - ) - WHEN @state3 THEN - ( - SELECT - GROUP_CONCAT( u.username ) - FROM - sys_user_role sur - LEFT JOIN sys_user u ON sur.userId = u.id - WHERE - sur.roleId = @role3 - ) - WHEN @state4 THEN - ( - SELECT - GROUP_CONCAT( u.username ) - FROM - sys_user_role sur - LEFT JOIN sys_user u ON sur.userId = u.id - WHERE - sur.roleId = @role4 - ) - WHEN @state5 THEN - ( - SELECT - GROUP_CONCAT( u.username ) - FROM - sys_user_role sur - LEFT JOIN sys_user u ON sur.userId = u.id - WHERE - sur.roleId = @role5 - ) - WHEN @state6 THEN - ( - SELECT - GROUP_CONCAT( u.username ) - FROM - sys_user_role sur - LEFT JOIN sys_user u ON sur.userId = u.id - WHERE - sur.roleId = @role6 - ) ELSE NULL - END - ) shrname + state.state_color, + abs.`name` absName FROM activity_bx bx LEFT JOIN `user` bxr ON bx.user_id = bxr.id - LEFT JOIN state state ON state.state_id = bx.state_id $condition + LEFT JOIN state state ON state.state_id = bx.state_id + LEFT JOIN activity_basic_settings abs ON abs.`code` = bx.projectTypeCode + $condition """); - sql.setParam("role1", Roles.CLUB_FZR); - sql.setParam("role2", Roles.UNION_MANGER); - sql.setParam("role3", Roles.XGHKJ); - sql.setParam("role4", Roles.GH_WYH_FZX); - sql.setParam("role5", Roles.GH_WYH_CWFZX); - sql.setParam("role6", Roles.XGHCN); - sql.setParam("state1", 1000); - sql.setParam("state2", 1010); - sql.setParam("state3", 1020); - sql.setParam("state4", 1030); - sql.setParam("state5", 1040); - sql.setParam("state6", 1050); - Cnd cnd = Cnd.NEW(); if (!ShiroUtil.hasAnyRoles("sysadmin")) { @@ -223,7 +125,7 @@ public class ReimbursementCon { Vi.cndPlus(cnd, "bxr.unitid", "=", unitId); Vi.cndPlus(cnd, "bxr.unionid", "=", unionId); sql.setCondition(cnd); - return activityBxService.listPage(pageNumber, pageSize, sql); + return activityBxService.listPageMap(pageNumber, pageSize, sql); } @At @@ -232,7 +134,7 @@ public class ReimbursementCon { return queryOne(id); } - private Record queryOne(String id) { + private NutMap queryOne(String id) { Sql sql = Sqls.create("SELECT\n" + "\tact.*,\n" + "\t`user`.loginname,\n" + @@ -271,49 +173,28 @@ public class ReimbursementCon { "\tLEFT JOIN sys_signature us_s ON us_s.id = act.user_signature \n" + "WHERE\n" + "\tact.id = @id").setParam("id", id); - Record record = activityBxService.list(sql).get(0); - record.set("Goods", baseService.dao().query("Goods", Cnd.where("reid", "=", id))); + List listMap = baseService.listMap(sql); + NutMap map = null; + if (Lang.isNotEmpty(listMap)) { + map = listMap.get(0); + map.setv("goods", baseService.dao().query("Goods", Cnd.where("reid", "=", id))); - if (record.size() == 0) { - return null; + String activity_id = map.getString("activity_id"); + if (Strings.isNotBlank(activity_id)) { + List files = activityFileService.query(Cnd.where("activity_id", "=", activity_id).desc("time")); + LinkedHashMap> collect = files.stream().collect(Collectors.groupingBy(ActivityFile::getTime, LinkedHashMap::new, Collectors.toList())); + + map.setv("activity_files", collect); + } } - - - String activity_id = record.getString("activity_id"); - if (Strings.isNotBlank(activity_id)) { - List files = activityFileService.query(Cnd.where("activity_id", "=", activity_id).desc("time")); - LinkedHashMap> collect = files.stream().collect(Collectors.groupingBy(ActivityFile::getTime, LinkedHashMap::new, Collectors.toList())); - - record.set("activity_files", collect); - } - - return record; + return map; } @At @ViReturn - public Object doEdit(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign, String[] delNotesList) { - - if (delNotesList != null && delNotesList.length > 0) { - for (String s : delNotesList) { - if (Strings.isNotBlank(s)) { - baseService.clear("goods", Cnd.where("id", "=", s)); - } - } - } - if (!activityBx.getGoods().isEmpty()) { - activityBx.getGoods().forEach(goods -> { - if (Strings.isBlank(goods.getId())) { - goods.setReid(activityBx.getId()); - baseService.insert(goods); - } - }); - } - if (Strings.isNotBlank(sign)) { - activityBx.setUser_signature(sysSignatureService.insert(new Sys_signature(sign)).getId()); - } - - activityBxService.doEdit(activityBx); + public Object doEdit(String files, String id) { + List fileList = Json.fromJsonAsList(Sys_file.class, files); + activityBxService.update(Chain.make("resultsFiles", fileList).add("state_id", 1060), Cnd.where("id", "=", id)); return null; } diff --git a/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementViewCon.java b/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementViewCon.java index 7ccae38..76ee86f 100644 --- a/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementViewCon.java +++ b/src/main/java/io/v/nutz/jf/controller/activitybx/ReimbursementViewCon.java @@ -3,13 +3,22 @@ package io.v.nutz.jf.controller.activitybx; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.entity.ExportParams; +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.Vi; +import io.v.nutz.jf.model.ActivityBx; import io.v.nutz.jf.service.ActivityBxService; +import io.v.nutz.sys.models.Sys_file; import io.v.nutz.sys.services.SysUnionService; +import io.v.nutz.web.commons.base.Globals; +import io.v.nutz.web.commons.utils.FileUtil; import io.v.nutz.web.commons.utils.ShiroUtil; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.ddr.poi.html.HtmlRenderPolicy; +import org.nutz.boot.starter.ftp.FtpService; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.entity.Record; @@ -17,12 +26,17 @@ 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.Lang; +import org.nutz.lang.random.R; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; +import java.io.*; +import java.net.URLEncoder; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; /** @@ -45,6 +59,10 @@ public class ReimbursementViewCon { private SysUnionService sysUnionService; + @Inject + private FtpService ftpService; + + @At("") @Ok("beetl:/platform/jf/activitybx/reimbursementview.html") @RequiresPermissions("sys.jf.activity_bx.reimbursementview") @@ -55,19 +73,22 @@ public class ReimbursementViewCon { @At @ViReturn public Object pageData(Integer year, String searchName, String unitId, String unionId, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) { - Sql sql = Sqls.create("SELECT\n" + - "\tact.*,\n" + - "\tu.loginname,\n" + - "\tun.unionname,\n" + - "\tun.unioncode,\n" + - "\ts.state_name,\n" + - "\ts.state_color \n" + - "FROM\n" + - "\t`activity_bx` act\n" + - "\tLEFT JOIN `user` u ON act.user_id = u.id\n" + - "\tLEFT JOIN sys_unit su ON su.id = u.unitid\n" + - "\tLEFT JOIN sys_union un ON su.unionid = un.id\n" + - "\tLEFT JOIN state s ON act.state_id = s.state_id $condition"); + Sql sql = Sqls.create(""" + SELECT + act.*, + bxr.loginname bxr_loginname, + bxr.unionname bxr_unionname, + bxr.unioncode, + state.state_name, + state.state_color, + abs.`name` absName + FROM + activity_bx act + LEFT JOIN `user` bxr ON act.user_id = bxr.id + LEFT JOIN state state ON state.state_id = act.state_id + LEFT JOIN activity_basic_settings abs ON abs.`code` = act.projectTypeCode + $condition + """); Cnd cnd = Cnd.NEW(); if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02")) { SqlExpressionGroup group2 = new SqlExpressionGroup(); @@ -93,9 +114,98 @@ public class ReimbursementViewCon { cnd.asc("act.state_id").desc("act.apply_time"); } sql.setCondition(cnd); - return activityBxService.listPage(pageNumber, pageSize, sql); + return activityBxService.listPageMap(pageNumber, pageSize, sql); } + @At + @Ok("void") + public void doExport(String id, HttpServletResponse response) throws Exception { + NutMap nutMap = activityBxService.queryOne(id); + + nutMap.setv("apply_time", nutMap.getString("apply_time").substring(0, 10)); + List goods = nutMap.getAsList("goods", NutMap.class); + + for (int i = 0; i < goods.size(); i++) { + goods.get(i).put("ranking", i + 1); + } + if (nutMap.get("a_s") != null) { + nutMap.setv("a_sign", Vi.getImg(nutMap.getString("a_s"))); + nutMap.setv("accounting_time", nutMap.getString("apply_time")); + } + + HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy(); + HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy(); + htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true); + + Configure config = Configure.newBuilder().bind("goods", policy) + .bind("n.activity_content", htmlRenderPolicy) + .bind("n.activity_arrange", htmlRenderPolicy).build(); + HashMap map = new HashMap<>(); + map.put("goods", goods); + map.put("n", nutMap); + map.put("schoolName", Globals.schoolName); + String fileName = Globals.schoolName + "活动申报登记表"; + + 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/funds2.docx"); + XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream()); + inputStream.close(); + } + + + @At + @Ok("void") + public void downloadResults(Integer year, HttpServletResponse response) throws IOException { + + List activityBxList = activityBxService.query(Cnd.where("year", "=", year)); + try { + + response.reset(); + response.setContentType("application/x-msdownload;charset=utf-8"); + + /** + * 创建临时文件夹 + */ + String tmpPath = "tmp/" + R.UU32(); + File tmpDir = new File(tmpPath + "/" + year + "活动申报"); + tmpDir.mkdirs(); + for (ActivityBx map : activityBxList) { + if (Lang.isNotEmpty(map)) { + for (Sys_file file : map.getResultsFiles()) { + String fileName = map.getFundsUnitName() + "活动名称:【" + map.getActivity_name() + "】——" + file.getFilename(); + + if (Lang.isNotEmpty(file)) { + FileOutputStream outputStream = new FileOutputStream(tmpDir.getPath() + "/" + fileName); + ftpService.download(file.getFilepath(), outputStream); + outputStream.close(); + } + + } + } + + } + String aimsDir = "zipTmp/" + R.UU32(); + String aimsName = year + "活动申报.zip"; + String aimsPath = aimsDir + "/" + aimsName; + FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName); + + response.setHeader("content-disposition", "attachment;filename=" + + URLEncoder.encode(aimsName, "UTF-8")); + + File aimsFile = new File(aimsPath); + FileInputStream inputStream = new FileInputStream(aimsFile); + org.apache.commons.io.IOUtils.copy(inputStream, response.getOutputStream()); + inputStream.close(); + aimsFile.delete(); + + FileUtil.deleteDir(new File(tmpPath)); + FileUtil.deleteDir(new File(aimsDir)); + } catch (Exception e) { + e.printStackTrace(); + } + + } /** * 下载名单 diff --git a/src/main/java/io/v/nutz/jf/model/ActivityBx.java b/src/main/java/io/v/nutz/jf/model/ActivityBx.java index 940a4b7..2525659 100644 --- a/src/main/java/io/v/nutz/jf/model/ActivityBx.java +++ b/src/main/java/io/v/nutz/jf/model/ActivityBx.java @@ -30,11 +30,28 @@ public class ActivityBx { @ColDefine(type = ColType.VARCHAR, width = 200) private String user_name; + + @Column + @Comment("联系方式") + @ColDefine(type = ColType.VARCHAR, width = 200) + private String mobile; + + + @Column + @Comment("申报(承办)单位") + @ColDefine(type = ColType.VARCHAR, width = 200) + private String fundsUnitName; + @Column @Comment("申请时间") @ColDefine(type = ColType.VARCHAR, width = 30) private String apply_time; + @Column + @Comment("申请类型(1.经费申报2.报销申请)") + @ColDefine(type = ColType.VARCHAR, width = 30) + private String apply_type; + @Column @Comment("用户id") @ColDefine(type = ColType.VARCHAR, width = 32) @@ -65,6 +82,21 @@ public class ActivityBx { @ColDefine(type = ColType.VARCHAR, width = 50) private String activity_name; + @Column + @Comment("活动计划结束时间") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String startPlannedDate; + + @Column + @Comment("活动计划结束时间") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String endPlannedDate; + + @Column + @Comment("活动项目类型") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String projectTypeCode; + @Column @Comment("活动id (未必有)") @ColDefine(type = ColType.VARCHAR, width = 32) @@ -75,6 +107,11 @@ public class ActivityBx { @ColDefine(type = ColType.TEXT) private String activity_content; + @Column + @Comment("活动安排") + @ColDefine(type = ColType.TEXT) + private String activity_arrange; + @Column @Comment("报销事由") @ColDefine(type = ColType.TEXT) @@ -90,6 +127,11 @@ public class ActivityBx { @ColDefine(type = ColType.FLOAT, width = 10, precision = 2) private Double activity_money; + @Column + @Comment("申报金额") + @ColDefine(type = ColType.FLOAT, width = 10, precision = 2) + private Double funds_money; + @Column @Comment("报销卡号") @ColDefine(type = ColType.VARCHAR, width = 50) @@ -255,6 +297,11 @@ public class ActivityBx { @ColDefine(type = ColType.MYSQL_JSON) private List files; + @Column + @Comment("成果附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List resultsFiles; + @Column @Comment("附件数量") @ColDefine(type = ColType.VARCHAR, width = 100) diff --git a/src/main/java/io/v/nutz/jf/service/ActivityBxService.java b/src/main/java/io/v/nutz/jf/service/ActivityBxService.java index 4d8af8e..2b0adff 100644 --- a/src/main/java/io/v/nutz/jf/service/ActivityBxService.java +++ b/src/main/java/io/v/nutz/jf/service/ActivityBxService.java @@ -1,7 +1,8 @@ package io.v.nutz.jf.service; -import cn.wizzer.framework.base.service.BaseService; +import io.v.nutz.base.service.BaseService; import io.v.nutz.jf.model.ActivityBx; +import org.nutz.lang.util.NutMap; /** * @author zhf @@ -12,4 +13,6 @@ public interface ActivityBxService extends BaseService { void doAdd(ActivityBx activityBx); void doEdit(ActivityBx activityBx); + + NutMap queryOne(String id); } diff --git a/src/main/java/io/v/nutz/jf/service/impl/ActivityBxServiceImpl.java b/src/main/java/io/v/nutz/jf/service/impl/ActivityBxServiceImpl.java index bf1668e..371f825 100644 --- a/src/main/java/io/v/nutz/jf/service/impl/ActivityBxServiceImpl.java +++ b/src/main/java/io/v/nutz/jf/service/impl/ActivityBxServiceImpl.java @@ -1,13 +1,25 @@ package io.v.nutz.jf.service.impl; -import cn.wizzer.framework.base.service.BaseServiceImpl; +import io.v.nutz.base.service.impl.BaseServiceImpl; import io.v.nutz.jf.model.ActivityBx; +import io.v.nutz.jf.model.ActivityFile; import io.v.nutz.jf.service.ActivityBxService; +import io.v.nutz.jf.service.ActivityFileService; import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; import org.nutz.dao.Dao; +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.lang.util.NutMap; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.stream.Collectors; /** * @author zhf @@ -20,6 +32,8 @@ public class ActivityBxServiceImpl extends BaseServiceImpl implement super(dao); } + @Inject + private ActivityFileService activityFileService; @Override @Aop(TransAop.READ_COMMITTED) @@ -32,4 +46,66 @@ public class ActivityBxServiceImpl extends BaseServiceImpl implement public void doEdit(ActivityBx activityBx) { updateWith(activityBx, "goods"); } + + @Override + public NutMap queryOne(String id) { + + Sql sql = Sqls.create(""" + SELECT + act.*, + `user`.loginname, + s.state_name, + s.state_color, + d_c.username dc_username, + d_c.loginname dc_loginname, + a.username a_username, + a.loginname a_loginname, + c_t.username ct_username, + c_t.loginname ct_loginname, + u_c.username uc_username, + u_c.loginname uc_loginname, + ucc_c.username ucc_username, + ucc_c.loginname ucc_loginname, + dc_s.`data` dc_s, + a_s.`data` a_s, + ct_s.`data` ct_s, + uc_s.`data` uc_s, + ucc_s.`data` ucc_s, + us_s.`data` us_s + FROM + activity_bx act + LEFT JOIN sys_user `user` ON act.user_id = `user`.id + LEFT JOIN state s ON act.state_id = s.state_id + LEFT JOIN sys_user d_c ON d_c.id = act.division_chairman_name + LEFT JOIN sys_user a ON a.id = act.accounting_name + LEFT JOIN sys_user c_t ON c_t.id = act.confirm_trade_name + LEFT JOIN sys_user u_c ON u_c.id = act.union_cashier_name + LEFT JOIN sys_user ucc_c ON ucc_c.id = act.union_chairman_name + LEFT JOIN sys_signature dc_s ON dc_s.id = act.division_chairman + LEFT JOIN sys_signature a_s ON a_s.id = act.accounting + LEFT JOIN sys_signature ct_s ON ct_s.id = act.confirm_trade + LEFT JOIN sys_signature uc_s ON uc_s.id = act.union_cashier + LEFT JOIN sys_signature ucc_s ON ucc_s.id = act.union_chairman + LEFT JOIN sys_signature us_s ON us_s.id = act.user_signature + WHERE + act.id = @id + """).setParam("id", id); + NutMap record = listMap(sql).get(0); + record.setv("goods", dao().query("goods", Cnd.where("reid", "=", id))); + + if (record.size() == 0) { + return null; + } + + + String activity_id = record.getString("activity_id"); + if (Strings.isNotBlank(activity_id)) { + List files = activityFileService.query(Cnd.where("activity_id", "=", activity_id).desc("time")); + LinkedHashMap> collect = files.stream().collect(Collectors.groupingBy(ActivityFile::getTime, LinkedHashMap::new, Collectors.toList())); + + record.setv("activity_files", collect); + } + + return record; + } } diff --git a/src/main/java/io/v/nutz/mobile/cahd/CahdApplyController.java b/src/main/java/io/v/nutz/mobile/cahd/CahdApplyController.java index bd32be2..3411775 100644 --- a/src/main/java/io/v/nutz/mobile/cahd/CahdApplyController.java +++ b/src/main/java/io/v/nutz/mobile/cahd/CahdApplyController.java @@ -1,6 +1,12 @@ package io.v.nutz.mobile.cahd; +import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.service.BaseService; +import io.v.nutz.modules.models.PageForm; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +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.mvc.annotation.At; @@ -20,11 +26,29 @@ public class CahdApplyController { @At("") @Ok("beetl:/mobile/cahd/applyList.html") + @RequiresAuthentication public void index() { } - + @At() + @ViReturn + public Object pageData(Integer year, PageForm page) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + xx.*, + u.username + FROM + hd_wm_xx xx + LEFT JOIN sys_user u ON u.id = xx.hdcjr + WHERE + activityGroupId IN ( SELECT groupId FROM `activity_user_scope` $condition) + AND YEAR ( hdkssj )= @year and xx.hdflag=true and xx.hdtype=2 + """).setParam("year", year); + sql.setCondition(cnd); + return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql); + } } diff --git a/src/main/java/io/v/nutz/mobile/wmhd/WmhdApplyController.java b/src/main/java/io/v/nutz/mobile/wmhd/WmhdApplyController.java index 4b11747..e6cee8e 100644 --- a/src/main/java/io/v/nutz/mobile/wmhd/WmhdApplyController.java +++ b/src/main/java/io/v/nutz/mobile/wmhd/WmhdApplyController.java @@ -1,6 +1,13 @@ package io.v.nutz.mobile.wmhd; +import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.service.BaseService; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +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.mvc.annotation.At; @@ -22,9 +29,30 @@ public class WmhdApplyController { @At("") @Ok("beetl:/mobile/wmhd/applyList.html") + @RequiresAuthentication public void index() { } - + @At() + @ViReturn + public Object pageData(Integer year, PageForm page) { + Cnd cnd = Cnd.NEW(); + Sql sql = Sqls.create(""" + SELECT + xx.*, + u.username + FROM + hd_wm_xx xx + LEFT JOIN sys_user u ON u.id = xx.hdcjr + WHERE + activityGroupId IN ( SELECT groupId FROM `activity_user_scope` $condition) + AND YEAR ( hdkssj )= @year and xx.hdflag=true and xx.hdtype=1 + """).setParam("year", year); + if (!ShiroUtil.hasRole("sysadmin")) { + cnd.and("userId", "=", ShiroUtil.getUserId()); + } + sql.setCondition(cnd); + return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql); + } } diff --git a/src/main/java/io/v/nutz/mobile/wmhd/WmhdAuditController.java b/src/main/java/io/v/nutz/mobile/wmhd/WmhdAuditController.java new file mode 100644 index 0000000..67888c6 --- /dev/null +++ b/src/main/java/io/v/nutz/mobile/wmhd/WmhdAuditController.java @@ -0,0 +1,113 @@ +package io.v.nutz.mobile.wmhd; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.web.commons.utils.ShiroUtil; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * TODO + * + * @Author zhf + * @Date 2022/11/24 17:16 + */ +@IocBean +@At("/mobile/wmhd/audit") +@Ok("json:full") +public class WmhdAuditController { + + + @Inject + private BaseService baseService; + + + @At("") + @Ok("beetl:/mobile/wmhd/auditList.html") + public void index() { + } + + @At("/unionAudit") + @Ok("beetl:/mobile/wmhd/unionAudit.html") + public void unionAudit() { + } + + + @At + @ViReturn + public Object pageData(@Param(value = "hdid", required = false) String hdid, + @Param(value = "isAudit", required = false) boolean isAudit, + @Param(value = "year", required = false) Integer year, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "unitId", required = false) String unitId, + @Param(value = "lx", required = false) Integer lx, + Integer pageNumber, + Integer pageSize) { + + + Sql sql = Sqls.create(""" + SELECT + xx.*, + u.username, + u.loginname, + u.unitname AS 'dwname', + u.unionname AS 'ghname', + hdlb.lname AS hdlbname, + zplb.zname AS zplbname, + zt.hdname, + state.stateColor, + state.stateName + FROM + hd_wm_sbxx xx + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + LEFT JOIN hd_wm_xx zt ON zt.hdid = xx.hdid + LEFT JOIN `user` u ON u.id = xx.hdsbrid + LEFT JOIN audit_state state ON state.stateId = xx.auditState + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(xx.hdsbsj)", "=", year); + cnd.andEX("u.unionid", "=", unionId); + cnd.andEX("u.unitid", "=", unitId); + cnd.andEX("xx.hdid", "=", hdid); + if (!ShiroUtil.hasRole("sysadmin")) { + if (ShiroUtil.hasAnyRoles("H10")) { + cnd.and("xx.auditState", "in", isAudit ? "4250,4300,4400" : "4200"); + } else { + cnd.and("u.unionid", "=", Vi.getUnionId()); + cnd.and("xx.auditState", "in", isAudit ? "4100,4150,4200" : "4000"); + } + + } else { + cnd.and("xx.auditState", "in", isAudit ? "4100,4150,4250,4300,4400" : "4000,4200"); + } + cnd.desc("xx.hdsbsj"); + cnd.desc("u.unionname"); + sql.setCondition(cnd); + + + return baseService.listPageMap(pageNumber, pageSize, sql); + } + + + @At("/auditHtml") + @Ok("re") + public String auditHtml(Integer auditState) { + if (auditState == 4000 || auditState == 4250) { + return "beetl:/mobile/wmhd/unionAudit.html"; + } else if (auditState == 4200) { + return "beetl:/mobile/wmhd/schoolAudit.html"; + } + return "beetl:/mobile/wmhd/viewInfo.html"; + } + + +} diff --git a/src/main/java/io/v/nutz/mobile/wmhd/WmhdListController.java b/src/main/java/io/v/nutz/mobile/wmhd/WmhdListController.java index 3f037a9..4981378 100644 --- a/src/main/java/io/v/nutz/mobile/wmhd/WmhdListController.java +++ b/src/main/java/io/v/nutz/mobile/wmhd/WmhdListController.java @@ -49,7 +49,7 @@ public class WmhdListController { LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 WHERE xx.id=@id - """).setParam("id",id); + """).setParam("id", id); return baseService.listMap(sql); } diff --git a/src/main/java/io/v/nutz/mobile/wmhd/WmhdStatisticsController.java b/src/main/java/io/v/nutz/mobile/wmhd/WmhdStatisticsController.java new file mode 100644 index 0000000..c0882f9 --- /dev/null +++ b/src/main/java/io/v/nutz/mobile/wmhd/WmhdStatisticsController.java @@ -0,0 +1,167 @@ +package io.v.nutz.mobile.wmhd; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.page.Pagination; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.web.commons.utils.ShiroUtil; +import io.v.nutz.zhgh.hd.models.Hd_wm_dz_xx; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.entity.Record; +import org.nutz.dao.sql.Sql; +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 java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @ClassName WmhdStatisticsController + * @Description TODO + * @Author zhf + * @Date 2024/6/3 9:58 + */ +@IocBean +@At("/mobile/wmhd/statistics") +@Ok("json:full") +@RequiresAuthentication +public class WmhdStatisticsController { + + + @Inject + private BaseService baseService; + + @At("") + @Ok("beetl:/mobile/wmhd/statistics.html") + @RequiresAuthentication + public void index() { + } + + + @At + @ViReturn + public Object pageData(Integer pageNumber, + Integer pageSize, + @Param(value = "hdid", required = false) String hdid, + @Param(value = "hdlb", required = false) String hdlb) { + if (StrUtil.isBlank(hdid)) { + return null; + } + Sql sql = Sqls.create(""" + SELECT + xx.*, + sbr.username AS sbrname, + sbr.loginname, + hd.hdname, + hd.dzkssj, + hd.dzjssj, + hd.hdkssj, + hd.hdjssj, + dw.name as dwname, + gh.unionname as ghname, + hdlb.lname as hdlbname, + zplb.zname as zplbname, + state.stateColor, + state.stateName, + ( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id AND dz.userid=@userid AND applyDate=@applyDate) dz_num, + ( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id ) dz_znum + FROM + hd_wm_sbxx xx + LEFT JOIN sys_user sbr ON sbr.id = xx.hdsbrid + left join sys_unit dw on dw.id = sbr.unitid + LEFT JOIN sys_union gh ON gh.id = dw.unionid + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx + LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2 + left join hd_wm_xx hd on hd.hdid = xx.hdid + LEFT JOIN audit_state state ON state.stateId = xx.auditState + $condition + """).setParam("userid", ShiroUtil.getUserId()) + .setParam("applyDate", DateUtil.today()); + Cnd cnd = Cnd.NEW(); + cnd.and("xx.hdid", "=", hdid); + cnd.andEX("xx.hdzplx", "=", hdlb); + cnd.andEX("xx.auditState", "=", "4400"); + cnd.desc("xx.hdsbsj").asc("xx.auditState").asc("unioncode"); + sql.setCondition(cnd); + Pagination pagination = baseService.listPage(pageNumber, pageSize, sql); + List list = pagination.getList(); + list.forEach(map->{ + List fjList = baseService.dao().query("sys_file", Cnd.where("reid", "=", map.getString("id"))); + map.set("files", fjList); + }); + pagination.setList(list); + return pagination; + + } + + + @At + @ViReturn + public Object doDz(String id, String hdid) { + Hd_wm_dz_xx xx = new Hd_wm_dz_xx(); + xx.setZpid(id); + xx.setHdid(hdid); + xx.setApplyDate(DateUtil.today()); + xx.setUserid(ShiroUtil.getUserId()); + return baseService.insert(xx); + } + + @At + @ViReturn + public Object findDzNum(String hdid) { + Cnd cnd = Cnd.NEW(); + cnd.and("hdid", "=", hdid); + cnd.and("userid", "=", ShiroUtil.getUserId()); + cnd.and("applyDate", "=", DateUtil.today()); + return baseService.dao().count(Hd_wm_dz_xx.class, cnd); + } + + @At + @ViReturn + public Object findDzByZpId(String id) { + Cnd cnd = Cnd.NEW(); + cnd.and("zpid", "=", id); + cnd.and("userid", "=", ShiroUtil.getUserId()); + cnd.and("applyDate", "=", DateUtil.today()); + return baseService.dao().count(Hd_wm_dz_xx.class, cnd); + } + + @At + @ViReturn + public Object initHdxxlist() { + String isSysadmin = " and hdcjr is not null"; + Sql sql = Sqls.create("select *,year(hdcjsj) year from hd_wm_xx where hdtype=1 and hdflag = true %s order by hdcjsj desc".formatted(isSysadmin)); + + List list = baseService.list(sql); + + List> result = new ArrayList>(); + + Map> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getInt("year"))); + + listMap.forEach((k, v) -> { + List> children = new ArrayList<>(); + v.forEach(x -> { + children.add(Map.of("value", x.getString("hdid"), + "label", x.getString("hdname"), + "dzkssj", x.getString("dzkssj"), + "dzjssj", x.getString("dzjssj"), + "dzNum", x.getInt("dzNum") + )); + }); + + Map parent = Map.of("value", k, "label", k, "children", children); + result.add(parent); + }); + + return result; + + } +} diff --git a/src/main/java/io/v/nutz/sys/models/SysEntranceModule.java b/src/main/java/io/v/nutz/sys/models/SysEntranceModule.java index 051a5cf..5415d19 100644 --- a/src/main/java/io/v/nutz/sys/models/SysEntranceModule.java +++ b/src/main/java/io/v/nutz/sys/models/SysEntranceModule.java @@ -48,5 +48,7 @@ public class SysEntranceModule extends BaseModel { @Comment("排序编号") @ColDefine(type = ColType.INT) private int sortNum; + private List menus; + } diff --git a/src/main/java/io/v/nutz/sys/models/Sys_menu.java b/src/main/java/io/v/nutz/sys/models/Sys_menu.java index 5b589b2..6c23f1c 100644 --- a/src/main/java/io/v/nutz/sys/models/Sys_menu.java +++ b/src/main/java/io/v/nutz/sys/models/Sys_menu.java @@ -3,12 +3,15 @@ package io.v.nutz.sys.models; import io.v.nutz.base.model.BaseModel; import lombok.Data; import lombok.EqualsAndHashCode; +import org.apache.commons.lang.StringUtils; import org.nutz.dao.DB; import org.nutz.dao.entity.annotation.*; import org.nutz.dao.interceptor.annotation.PrevInsert; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * Created by wizzer on 2016/6/21. @@ -86,6 +89,12 @@ public class Sys_menu extends BaseModel implements Serializable { @ColDefine(type = ColType.VARCHAR, width = 255) private String note; + + @Column + @Comment("操作指南") + @ColDefine(type = ColType.MYSQL_JSON) + private List description; + @Column @Comment("排序字段") @Prev({ @@ -100,4 +109,27 @@ public class Sys_menu extends BaseModel implements Serializable { private List buttons; + private List children = new ArrayList(); + + private String parentName; + + /** + * 前端菜单数据 + * + * @param menus + * @param parentId + * @return + */ + public static List createTreeMenus(List menus, String parentId) { + List filterMenus = menus.stream().filter(v -> StringUtils.defaultString(v.getParentId(), "").equals(StringUtils.defaultString(parentId, ""))).collect(Collectors.toList()); + for (Sys_menu menu : filterMenus) { +// if (menu.isHasChildren()) { + List childMenus = createTreeMenus(menus, menu.getId()); + menu.setChildren(childMenus); +// } + } + return new ArrayList<>(filterMenus); + } + + } diff --git a/src/main/java/io/v/nutz/sys/models/Sys_user.java b/src/main/java/io/v/nutz/sys/models/Sys_user.java index f0a09bf..3e5ed7d 100644 --- a/src/main/java/io/v/nutz/sys/models/Sys_user.java +++ b/src/main/java/io/v/nutz/sys/models/Sys_user.java @@ -603,4 +603,13 @@ public class Sys_user extends BaseModel implements Serializable { /** * 2021-05-18 end */ + + + + /** + * 前端菜单 + */ + private List treeMenus; + + private List moduleMenus; } diff --git a/src/main/java/io/v/nutz/sys/services/SysUserService.java b/src/main/java/io/v/nutz/sys/services/SysUserService.java index cf8a39d..c202f27 100644 --- a/src/main/java/io/v/nutz/sys/services/SysUserService.java +++ b/src/main/java/io/v/nutz/sys/services/SysUserService.java @@ -42,6 +42,22 @@ public interface SysUserService extends BaseService { */ Sys_user fillMenu(Sys_user user); + /** + * 绑定模块及模块下的菜单到用户 + * + * @param user + * @return + */ + Sys_user fillModuleMenus(Sys_user user); + + /** + * 绑定用户单位 分工会信息 + * + * @param user + * @return + */ + Sys_user fillUnitUnion(Sys_user user); + /** * 通过用户ID删除用户 * @@ -79,6 +95,15 @@ public interface SysUserService extends BaseService { * @param userId */ void deleteCache(String userId); + + + /** + * 清除一个用户的缓存并更新主体信息 + * 清除当前用户缓存 + * + * @param userId + */ + void deleteCacheAndUpdate(String userId); /** * 清空缓存 */ diff --git a/src/main/java/io/v/nutz/sys/services/impl/SysUserServiceImpl.java b/src/main/java/io/v/nutz/sys/services/impl/SysUserServiceImpl.java index ddcd352..85d9754 100644 --- a/src/main/java/io/v/nutz/sys/services/impl/SysUserServiceImpl.java +++ b/src/main/java/io/v/nutz/sys/services/impl/SysUserServiceImpl.java @@ -1,20 +1,26 @@ package io.v.nutz.sys.services.impl; +import cn.hutool.core.util.StrUtil; import io.v.nutz.base.constant.RedisConstant; import io.v.nutz.base.service.impl.BaseServiceImpl; -import io.v.nutz.sys.models.Sys_menu; -import io.v.nutz.sys.models.Sys_role; -import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.sys.models.*; import io.v.nutz.sys.services.SysMenuService; +import io.v.nutz.sys.services.SysRoleService; import io.v.nutz.sys.services.SysUserService; +import io.v.nutz.web.commons.utils.ShiroUtil; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.subject.PrincipalCollection; +import org.apache.shiro.subject.SimplePrincipalCollection; import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; +import org.nutz.integration.jedis.RedisService; import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; import org.nutz.lang.Strings; import org.nutz.plugins.wkcache.annotation.CacheDefaults; import org.nutz.plugins.wkcache.annotation.CacheRemove; @@ -25,6 +31,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * Created by wizzer on 2016/12/22. @@ -39,6 +46,12 @@ public class SysUserServiceImpl extends BaseServiceImpl implements Sys @Inject private SysMenuService sysMenuService; + @Inject + private SysRoleService sysRoleService; + + @Inject + private RedisService redisService; + /** * 查询用户角色code列表 * @@ -86,6 +99,54 @@ public class SysUserServiceImpl extends BaseServiceImpl implements Sys return user; } + @CacheResult(cacheKey = "${args[0].id}_fillModuleMenus") + public Sys_user fillModuleMenus(Sys_user user) { + //获取用户所有的菜单 + List menus = getMenus(user.getId()); + user.setMenus(menus); + + //一级菜单 + List firstMenus = menus.stream().filter(v -> StrUtil.isBlank(v.getParentId()) && v.getPath().length() == 4).collect(Collectors.toList()); + List firstMenuIds = firstMenus.stream().map(v -> v.getId()).collect(Collectors.toList()); + + //设置菜单tree结构 + List treeMenus = Sys_menu.createTreeMenus(menus, null); + user.setTreeMenus(treeMenus); + + //获取所有的模块 + List modules = dao().query(SysEntranceModule.class, Cnd.NEW().asc("sortNum")); + + modules.forEach(v -> { + List containsMenus = v.getContainsMenu(); + for (String containsMenu : containsMenus) { + if (firstMenuIds.contains(containsMenu)) { + List collect = treeMenus.stream().filter(x -> x.getId().equals(containsMenu)).collect(Collectors.toList()); + if (Lang.isEmpty(v.getMenus())) { + v.setMenus(collect); + } else { + v.getMenus().addAll(collect); + } + } + } + }); + + List filterModules = modules.stream().filter(v -> Lang.isNotEmpty(v.getMenus())).collect(Collectors.toList()); + + user.setModuleMenus(filterModules); + return user; + } + + @Override + public Sys_user fillUnitUnion(Sys_user user) { + if (user.getUnit() != null) { + if (Strings.isNotBlank(user.getUnit().getUnionid())) { + Sys_union union = dao().fetch(Sys_union.class, user.getUnit().getUnionid()); + user.setUnion(union); + } + } + return user; + } + /** * 查询用户菜单权限 * @@ -198,7 +259,27 @@ public class SysUserServiceImpl extends BaseServiceImpl implements Sys @CacheRemove(cacheKey = "${args[0]}_*") //可以通过el表达式加 * 通配符来批量删除一批缓存 public void deleteCache(String userId) { + //查询用户最新的菜单、角色信息 + sysRoleService.clearCache(); + } + @Override + public void deleteCacheAndUpdate(String userId) { + //删除sys_user_*,sys_role_*所有缓存 + this.deleteCache(userId); + sysRoleService.clearCache(); + + //查询用户最新的菜单、角色信息 + Sys_user user = fetch(Cnd.where("id", "=", ShiroUtil.getUserId())); + fetchLinks(user, null); + user = fillModuleMenus(user); + user = fillUnitUnion(user); + + //更新principal信息 + PrincipalCollection principals = SecurityUtils.getSubject().getPrincipals(); + String realm = principals.getRealmNames().iterator().next(); + SimplePrincipalCollection simplePrincipalCollection = new SimplePrincipalCollection(user, realm); + SecurityUtils.getSubject().runAs(simplePrincipalCollection); } @CacheRemoveAll diff --git a/src/main/java/io/v/nutz/wakershome/controller/data/WakesHomeDataRevelController.java b/src/main/java/io/v/nutz/wakershome/controller/data/WakesHomeDataRevelController.java new file mode 100644 index 0000000..42f9674 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/data/WakesHomeDataRevelController.java @@ -0,0 +1,185 @@ +package io.v.nutz.wakershome.controller.data; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.page.Pagination; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.result.Result; +import io.v.nutz.base.utils.Roles; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.sys.models.Sys_file; +import io.v.nutz.sys.models.Sys_user_role; +import io.v.nutz.sys.models.User; +import io.v.nutz.wakershome.model.WakesHomeDataRevel; +import io.v.nutz.wakershome.service.WakesHomeInfoService; +import io.v.nutz.web.commons.utils.ShiroUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Criteria; +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.random.R; +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 java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDataRevelController + * @Date 2024/7/30 15:48 + * @注释 职工建家资料管理 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/data/revel") +public class WakesHomeDataRevelController { + + @Inject + private Dao dao; + + @Inject + private WakesHomeInfoService wakesHomeInfoService; + + @At("") + @Ok("beetl:/platform/wakeshome/data/revel.html") + @RequiresPermissions("wakeshome.data.revel") + public void index() { + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.data.revel") + public Object getTreeData(@Param(value = "year", required = false) String year, + @Param(value = "revelName", required = false) String revelName, + @Param(value = "typeId", required = false) String typeId) { + NutMap nutMap = NutMap.NEW(); + nutMap.setv("unionname", "工会委员会"); + Sql sql = Sqls.create(""" + select + un.*, + (select count(*) from wakes_home_data_revel whdr where whdr.unionId = un.id $revelCount) as revelCount + from + sys_union un + $condition + """); + Criteria criteria = Cnd.cri(); + criteria.where().setTop(false); + if (StringUtils.isNotBlank(year)) { + criteria.where().and("year(whdr.time)", "=", year); + } + if (StringUtils.isNotBlank(revelName)) { + criteria.where().and(Cnd.likeEX("whdr.revelName", revelName)); + } + if (StringUtils.isNotBlank(typeId)) { + criteria.where().and("whdr.typeId", "=", typeId); + } + if (!criteria.where().isEmpty()) { + sql.vars().set("revelCount", "and " + criteria.toSql(null)); + } + + Cnd cnd = Cnd.NEW(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + List data = dao.query(Sys_user_role.class, Cnd.where("userId", "=", ShiroUtil.getUserId()).and("roleId", "=", Roles.UNION_MANGER)); + List unionIds = data.stream().map(Sys_user_role::getUnionid).distinct().collect(Collectors.toList()); + cnd.and("un.id", "in", unionIds); + } + cnd.and("un.isEnable","=",true); + cnd.asc("un.unioncode"); + sql.setCondition(cnd); + nutMap.setv("child", wakesHomeInfoService.listMap(sql)); + return List.of(nutMap); + } + + + @At + @RequiresPermissions("wakeshome.data.revel") + public Object pageData(PageForm pageForm, + @Param(value = "year", required = false) String year, + @Param(value = "revelName", required = false) String revelName, + @Param(value = "typeId", required = false) String typeId, + @Param(value = "unionId", required = false) String unionId) { + try { + Sql sql = Sqls.create(""" + SELECT + whdr.*, + whdt.typeName + FROM + wakes_home_data_revel whdr + LEFT JOIN wakes_home_data_type whdt ON whdr.typeId = whdt.id + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("year(whdr.time)", "=", year); + if (StrUtil.isNotBlank(revelName)) { + cnd.and(Cnd.likeEX("whdr.revelName", revelName)); + } + cnd.andEX("whdr.typeId", "=", typeId); + cnd.andEX("whdr.unionId", "=", unionId); + cnd.desc("whdr.time"); + sql.setCondition(cnd); + Pagination pagination = wakesHomeInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } + } + + + @At + @ViReturn +// @RequiresPermissions("wakeshome.data.revel") + public Object doAdd(WakesHomeDataRevel wakesHomeDataRevel) { + User user = dao.fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUserId())); + wakesHomeDataRevel.setId(R.UU32()); + wakesHomeDataRevel.setUserId(user.getId()); + wakesHomeDataRevel.setUsername(user.getUsername()); + wakesHomeDataRevel.setLoginName(user.getLoginname()); + wakesHomeDataRevel.setUnitId(user.getUnitid()); + wakesHomeDataRevel.setUnitName(user.getUnitname()); + wakesHomeDataRevel.setUnionId(user.getUnionid()); + wakesHomeDataRevel.setUnionName(user.getUnionname()); + wakesHomeDataRevel.setTime(DateUtil.now()); + dao.fastInsert(wakesHomeDataRevel); + return null; + } + + + @At + @ViReturn +// @RequiresPermissions("wakeshome.data.revel") + public Object doEdit(WakesHomeDataRevel wakesHomeDataRevel) { + dao.update(wakesHomeDataRevel); + return null; + } + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) +// @RequiresPermissions("wakeshome.data.revel") + public Object doDelete(String id) { + WakesHomeDataRevel revel = dao.fetch(WakesHomeDataRevel.class, id); + if (revel != null) { + if (revel.getFiles() != null && !revel.getFiles().isEmpty()) { + Set fileIds = revel.getFiles().stream().map(Sys_file::getId).collect(Collectors.toSet()); + dao.clear(Sys_file.class, Cnd.where("id", "in", fileIds)); + } + dao.clear(WakesHomeDataRevel.class, Cnd.where("id", "=", id)); + } + return null; + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/data/WakesHomeDataTypeController.java b/src/main/java/io/v/nutz/wakershome/controller/data/WakesHomeDataTypeController.java new file mode 100644 index 0000000..5554776 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/data/WakesHomeDataTypeController.java @@ -0,0 +1,137 @@ +package io.v.nutz.wakershome.controller.data; + +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.wakershome.model.WakesHomeDataType; +import io.v.nutz.wakershome.service.WakesHomeInfoService; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +import org.nutz.dao.Cnd; +import org.nutz.dao.Sqls; +import org.nutz.dao.entity.Record; +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.random.R; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDataTypeController + * @Date 2024/7/30 15:48 + * @注释 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/data/type") +public class WakesHomeDataTypeController { + + @Inject + private WakesHomeInfoService wakesHomeInfoService; + + @At("") + @Ok("beetl:/platform/wakeshome/data/type.html") + @RequiresPermissions("wakeshome.data.type") + public void index() { + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.data.type") + public Object pageData(PageForm pageForm, + @Param(value = "typeName", required = false) String typeName) { + Sql sql = Sqls.create("select * from wakes_home_data_type $condition"); + Cnd cnd = Cnd.NEW(); + if (StrUtil.isNotBlank(typeName)) { + cnd.and(Cnd.likeEX("typeName", typeName)); + } + cnd.asc("serialNum"); + sql.setCondition(cnd); + return wakesHomeInfoService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + @At + @RequiresPermissions("wakeshome.data.type") + public Object doAdd(WakesHomeDataType wakesHomeDataType) { + try { + int count = wakesHomeInfoService.dao().count("wakes_home_data_type", Cnd.where("code", "=", wakesHomeDataType.getCode())); + if (count > 0) { + return Result.error("编码重复"); + } + wakesHomeDataType.setId(R.UU32()); + int totalCount = wakesHomeInfoService.count("wakes_home_data_type"); + wakesHomeDataType.setSerialNum(totalCount + 1); + wakesHomeInfoService.insert("wakes_home_data_type", Chain.from(wakesHomeDataType)); + return Result.success(); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } + } + + + @At + @RequiresPermissions("wakeshome.data.type") + public Object doEdit(WakesHomeDataType wakesHomeDataType) { + try { + int count = wakesHomeInfoService.count("wakes_home_data_type", Cnd.where("code", "=", wakesHomeDataType.getCode()).and("id", "!=", wakesHomeDataType.getId())); + if (count > 0) { + return Result.error("编码重复"); + } + wakesHomeInfoService.update("wakes_home_data_type", Chain.from(wakesHomeDataType), Cnd.where("id", "=", wakesHomeDataType.getId())); + return Result.success(); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } + } + + @At + @RequiresPermissions("wakeshome.data.type") + public Object doDelete(String id) { + try { + wakesHomeInfoService.clear("wakes_home_data_type", Cnd.where("id", "=", id)); + return Result.success(); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } + } + + + @At + @ViReturn + @RequiresAuthentication + public Object getAllWakesHomeDataType() { + return wakesHomeInfoService.dao().query(WakesHomeDataType.class, Cnd.NEW().asc("serialNum")); + } + + + @At + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("sys.jdh2.gzzl.lx") + public Object serialNumChange(String id, Integer serialNum, boolean toDown) { + if (toDown) { + WakesHomeDataType next = wakesHomeInfoService.dao().fetch(WakesHomeDataType.class, Cnd.where("serialNum", "=", serialNum + 1)); + next.setSerialNum(serialNum - 1); + wakesHomeInfoService.dao().update(next); + wakesHomeInfoService.dao().update(WakesHomeDataType.class, Chain.make("serialNum", serialNum + 1), Cnd.where("id", "=", id)); + } else { + WakesHomeDataType pre = wakesHomeInfoService.dao().fetch(WakesHomeDataType.class, Cnd.where("serialNum", "=", serialNum - 1)); + pre.setSerialNum(serialNum + 1); + wakesHomeInfoService.dao().update(pre); + wakesHomeInfoService.dao().update(WakesHomeDataType.class, Chain.make("serialNum", serialNum - 1), Cnd.where("id", "=", id)); + } + return Result.success(); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationApplyController.java b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationApplyController.java new file mode 100644 index 0000000..7f6bf54 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationApplyController.java @@ -0,0 +1,77 @@ +package io.v.nutz.wakershome.controller.declaration; + +import cn.hutool.core.util.StrUtil; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.wakershome.model.WakesHomeApply; +import io.v.nutz.wakershome.service.IWakesHomeApplyService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.random.R; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDeclarationApply + * @Date 2024/7/30 14:06 + * @注释 职工建家申报 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/declaration/apply") +public class WakesHomeDeclarationApplyController { + + @Inject + private IWakesHomeApplyService wakesHomeApplyService; + + @At("") + @Ok("beetl:/platform/wakeshome/declaration/apply.html") + @RequiresPermissions("wakeshome.declaration.apply") + public void index() {} + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.apply") + public Object doSave(WakesHomeApply wakesHomeApply) { + wakesHomeApply.setState("10000"); + if (wakesHomeApply != null) { + if (StrUtil.isNotBlank(wakesHomeApply.getId())) { + wakesHomeApplyService.update(wakesHomeApply); + } else { + wakesHomeApplyService.setParams(wakesHomeApply); + wakesHomeApplyService.fastInsert(wakesHomeApply); + } + } + return null; + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.apply") + public Object doSubmit(WakesHomeApply wakesHomeApply) { + wakesHomeApply.setState("10010"); + if (wakesHomeApply != null) { + if (StrUtil.isNotBlank(wakesHomeApply.getId())) { + wakesHomeApplyService.update(wakesHomeApply); + } else { + wakesHomeApply.setId(R.UU32()); + wakesHomeApplyService.setParams(wakesHomeApply); + wakesHomeApplyService.fastInsert(wakesHomeApply); + } + } + return null; + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.apply") + public Object getInfoById(String id){ + return wakesHomeApplyService.findById(id); + } + +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationMineController.java b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationMineController.java new file mode 100644 index 0000000..7b76ddb --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationMineController.java @@ -0,0 +1,147 @@ +package io.v.nutz.wakershome.controller.declaration; + +import cn.hutool.core.date.DateUtil; +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.base.utils.Vi; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.model.WakesHomeApply; +import io.v.nutz.wakershome.service.IWakesHomeApplyService; +import io.v.nutz.web.commons.base.Globals; +import org.apache.shiro.authz.annotation.Logical; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.ddr.poi.html.HtmlRenderPolicy; +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.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.util.HashMap; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDeclarationMine + * @Date 2024/7/30 14:06 + * @注释 我的建家申报 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/declaration/mine") +public class WakesHomeDeclarationMineController { + + @Inject + private IWakesHomeApplyService wakesHomeApplyService; + + @At("") + @Ok("beetl:/platform/wakeshome/declaration/mine.html") + @RequiresPermissions("wakeshome.declaration.mine") + public void index() { + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.mine") + public Object pageData(PageForm pageForm, + @Param(value = "year", required = false) Integer year, + @Param(value = "unionId", required = false) String unionId) { + Sql sql = Sqls.create(""" + SELECT + wh.*, + audit.stateName + FROM + `wakes_home_apply` wh + LEFT JOIN audit_state audit ON wh.state = audit.stateId + AND audit.module = 'WakesHome' + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("YEAR(wh.applyDate)", "=", year); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and("unionId", "=", Vi.getUnionId()); + } else { + cnd.andEX("unionId", "=", unionId); + } + sql.setCondition(cnd); + return wakesHomeApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions(value = {"wakeshome.declaration.apply", "wakeshome.declaration.mine"}, logical = Logical.OR) + public Object doDelete(String id) { + WakesHomeApply apply = wakesHomeApplyService.fetch(id); + if (StrUtil.isNotBlank(apply.getOrganizationAuditId())) { + wakesHomeApplyService.dao().delete(Audit.class, apply.getOrganizationAuditId()); + } + if (StrUtil.isNotBlank(apply.getSchoolAuditId())) { + wakesHomeApplyService.dao().delete(Audit.class, apply.getSchoolAuditId()); + } + wakesHomeApplyService.delete(id); + return null; + } + + @At + @Ok("void") + public void openExport(String id, HttpServletResponse response) { + + try { + NutMap nutMap = wakesHomeApplyService.findById(id); + + + HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy(); + HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy(); + htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true); + + Configure config = Configure.newBuilder() + .bind("basicInformation", htmlRenderPolicy) + .bind("constructionPlan", htmlRenderPolicy).build(); + HashMap map = new HashMap<>(); + String fileName = Globals.schoolName + "教工小家”建设计划书"; + map.put("fileName", fileName); + map.put("schoolName", Globals.schoolName); + map.put("unionName", nutMap.getString("unionName")); + map.put("applyDate", nutMap.getString("applyDate")); + map.put("username", nutMap.getString("username")); + map.put("mobile", nutMap.getString("mobile")); + map.put("basicInformation", nutMap.getString("basicInformation")); + map.put("constructionPlan", nutMap.getString("constructionPlan")); + NutMap schoolAudit = nutMap.getAs("schoolAudit", NutMap.class); + NutMap organizationAudit = nutMap.getAs("organizationAudit", NutMap.class); + schoolAudit.setv("auditTime", DateUtil.formatDate(schoolAudit.getTime("auditTime"))); + schoolAudit.setv("auditSign", Vi.getImg(schoolAudit.getString("auditSign"))); + organizationAudit.setv("auditTime", DateUtil.formatDate(organizationAudit.getTime("auditTime"))); + organizationAudit.setv("auditSign", Vi.getImg(organizationAudit.getString("auditSign"))); + map.put("organizationAudit", organizationAudit); + map.put("schoolAudit", schoolAudit); + + + 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/wakeshome.docx"); + XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream()); + inputStream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationOrganizationController.java b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationOrganizationController.java new file mode 100644 index 0000000..af8eb29 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationOrganizationController.java @@ -0,0 +1,99 @@ +package io.v.nutz.wakershome.controller.declaration; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.model.WakesHomeApply; +import io.v.nutz.wakershome.service.IWakesHomeApplyService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDeclarationOrganization + * @Date 2024/7/30 14:07 + * @注释 建家申报党组织审核 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/declaration/organization") +public class WakesHomeDeclarationOrganizationController { + + @Inject + private IWakesHomeApplyService wakesHomeApplyService; + + @At("") + @Ok("beetl:/platform/wakeshome/declaration/organizationAudit.html") + @RequiresPermissions("wakeshome.declaration.organization") + public void index() { + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.organization") + public Object pageData(PageForm pageForm, + @Param(value = "year", required = false) Integer year, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "isAudit", required = false) String isAudit) { + Sql sql = Sqls.create(""" + SELECT + wh.*, + audit.stateName + FROM + `wakes_home_apply` wh + LEFT JOIN audit_state audit ON wh.state = audit.stateId + AND audit.module = 'WakesHome' + $condition + """); + CndPlus cnd = CndPlus.create(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and("wh.unionId", "=", Vi.getUnionId()); + } else { + cnd.andEX("wh.unionId", "=", unionId); + } + cnd.andEX("YEAR(wh.applyDate)", "=", year); + cnd.and("wh.state", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", 10010); + sql.setCondition(cnd); + return wakesHomeApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("wakeshome.declaration.organization") + public Object doAudit(@Param("audit") Audit audit, String id) { + Boolean auditPass = audit.getAuditPass(); + wakesHomeApplyService.dao().insert(audit); + wakesHomeApplyService.update(Chain.make("state", auditPass ? 10020 : 10015) + .add("organizationAuditId", audit.getId()), Cnd.where("id", "=", id)); + return null; + } + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("wakeshome.declaration.organization") + public Object doRollBack(String id){ + WakesHomeApply wakesHome = wakesHomeApplyService.fetch(id); + wakesHomeApplyService.dao().clear(Audit.class,Cnd.where("id","=",wakesHome.getOrganizationAuditId())); + wakesHomeApplyService.update(Chain.make("state",10010).add("organizationAuditId",null),Cnd.where("id","=",id)); + return null; + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationSchoolController.java b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationSchoolController.java new file mode 100644 index 0000000..d864e95 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationSchoolController.java @@ -0,0 +1,98 @@ +package io.v.nutz.wakershome.controller.declaration; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.model.WakesHomeApply; +import io.v.nutz.wakershome.service.IWakesHomeApplyService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDeclarationSchool + * @Date 2024/7/30 14:07 + * @注释 建家申报校工会审核 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/declaration/school") +public class WakesHomeDeclarationSchoolController { + + @Inject + private IWakesHomeApplyService wakesHomeApplyService; + + @At("") + @Ok("beetl:/platform/wakeshome/declaration/schoolAudit.html") + @RequiresPermissions("wakeshome.declaration.school") + public void index() {} + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.school") + public Object pageData(PageForm pageForm, + @Param(value = "year", required = false) Integer year, + @Param(value = "unionId", required = false) String unionId, + @Param(value = "isAudit", required = false) String isAudit){ + Sql sql = Sqls.create(""" + SELECT + wh.*, + audit.stateName + FROM + `wakes_home_apply` wh + LEFT JOIN audit_state audit ON wh.state = audit.stateId + AND audit.module = 'WakesHome' + $condition + """); + CndPlus cnd = CndPlus.create(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and("wh.unionId", "=", Vi.getUnionId()); + } else { + cnd.andEX("wh.unionId", "=", unionId); + } + cnd.andEX("YEAR(wh.applyDate)", "=", year); + cnd.and("wh.state", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", 10020); + sql.setCondition(cnd); + return wakesHomeApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("wakeshome.declaration.school") + public Object doAudit(@Param("audit") Audit audit, String id) { + Boolean auditPass = audit.getAuditPass(); + wakesHomeApplyService.dao().insert(audit); + wakesHomeApplyService.update(Chain.make("state", auditPass ? 10030 : 10025) + .add("schoolAuditId", audit.getId()), Cnd.where("id", "=", id)); + return null; + } + + + @At + @ViReturn + @Aop(TransAop.READ_COMMITTED) + @RequiresPermissions("wakeshome.declaration.school") + public Object doRollBack(String id){ + WakesHomeApply wakesHome = wakesHomeApplyService.fetch(id); + wakesHomeApplyService.dao().clear(Audit.class,Cnd.where("id","=",wakesHome.getSchoolAuditId())); + wakesHomeApplyService.update(Chain.make("state",10010).add("schoolAuditId",null),Cnd.where("id","=",id)); + return null; + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationStatisticsController.java b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationStatisticsController.java new file mode 100644 index 0000000..d311127 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/declaration/WakesHomeDeclarationStatisticsController.java @@ -0,0 +1,66 @@ +package io.v.nutz.wakershome.controller.declaration; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.service.IWakesHomeApplyService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDeclarationStatisticsController + * @Date 2024/8/2 15:00 + * @注释 申报,查询统计 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/declaration/statistics") +public class WakesHomeDeclarationStatisticsController { + + @Inject + private IWakesHomeApplyService wakesHomeApplyService; + + @At("") + @Ok("beetl:/platform/wakeshome/declaration/statistics.html") + @RequiresPermissions("wakeshome.declaration.statistics") + public void index() {} + + + @At + @ViReturn + @RequiresPermissions("wakeshome.declaration.statistics") + public Object pageData(PageForm pageForm, + @Param(value = "year", required = false) Integer year, + @Param(value = "unionId", required = false) String unionId){ + Sql sql = Sqls.create(""" + SELECT + wh.*, + audit.stateName + FROM + `wakes_home_apply` wh + LEFT JOIN audit_state audit ON wh.state = audit.stateId + AND audit.module = 'WakesHome' + $condition + """); + CndPlus cnd = CndPlus.create(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.and("wh.unionId", "=", Vi.getUnionId()); + } else { + cnd.andEX("wh.unionId", "=", unionId); + } + cnd.andEX("YEAR(wh.applyDate)", "=", year); + cnd.and("wh.state", "=" , 10030); + sql.setCondition(cnd); + return wakesHomeApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeApplyController.java b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeApplyController.java new file mode 100644 index 0000000..1a76629 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeApplyController.java @@ -0,0 +1,70 @@ +package io.v.nutz.wakershome.controller.info; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.result.Result; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.wakershome.model.WakesHome; +import io.v.nutz.wakershome.model.WakesHomeApply; +import io.v.nutz.wakershome.service.WakesHomeInfoService; +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; + +@At("/platform/wakeshome/info/apply") +@Ok("json:full") +@IocBean +public class WakesHomeApplyController { + + + @Inject + private WakesHomeInfoService wakesHomeInfoService; + + + @At("") + @Ok("beetl:/platform/wakeshome/info/apply.html") + @RequiresPermissions("wakeshome.info.apply") + public void index() {} + + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.apply") + public Object doAdd(WakesHome wakesHome, Boolean isSubmit){ + if (isSubmit){ +// wakesHome.setApplyTime(new Date()); + wakesHome.setState(8120); + } else { + wakesHome.setState(8100); + } + + if (!"校工会".equals(wakesHome.getCategory())){ + wakesHome.setUnionId(Vi.getUnionId()); + } + + wakesHomeInfoService.insert(wakesHome); + return null; + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.apply") + public Object doEdit(WakesHome wakesHome,Boolean isSubmit){ + if (isSubmit){ + wakesHome.setState(8120); + } + wakesHomeInfoService.updateIgnoreNull(wakesHome); + return null; + } + + + @At + @RequiresPermissions("wakeshome.info.apply") + public Object validateApply(){ + int count = wakesHomeInfoService.dao().count(WakesHomeApply.class, Cnd.where("state", "=", "10030").and("unionId", "=", Vi.getUnionId())); + return (count > 0) ? Result.success() : Result.error(); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeInfoController.java b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeInfoController.java new file mode 100644 index 0000000..ca76636 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeInfoController.java @@ -0,0 +1,58 @@ +package io.v.nutz.wakershome.controller.info; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.wakershome.service.WakesHomeInfoService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + + +@At("/platform/wakeshome/info/info") +@Ok("json:full") +@IocBean +public class WakesHomeInfoController { + + + @Inject + private WakesHomeInfoService wakesHomeInfoService; + + + @At("") + @Ok("beetl:/platform/wakeshome/info/info.html") + @RequiresPermissions("wakeshome.info.info") + public void index() {} + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.info") + public Object pageData(PageForm pageForm, + @Param(value = "year",required = false) Integer year, + @Param(value = "unionId",required = false) String unionId){ + Sql sql = Sqls.create(""" + SELECT + wh.* + FROM + `wakes_home` wh + LEFT JOIN sys_union su ON su.id = wh.unionId + $condition + """); + CndPlus cnd = CndPlus.create(); + cnd.andEX("YEAR(applyTime)","=",year); + if ("校工会".equals(unionId)){ + cnd.and("wh.category","=","校工会"); + } else { + cnd.andEX("wh.unionId","=",unionId); + } + cnd.and("wh.state","=",8130); + cnd.asc("su.unioncode"); + sql.setCondition(cnd); + return wakesHomeInfoService.listMap(sql); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeMineController.java b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeMineController.java new file mode 100644 index 0000000..196cc2d --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeMineController.java @@ -0,0 +1,93 @@ +package io.v.nutz.wakershome.controller.info; + + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.model.WakesHome; +import io.v.nutz.wakershome.service.WakesHomeInfoService; +import org.apache.shiro.authz.annotation.Logical; +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.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +@At("/platform/wakeshome/info/mine") +@Ok("json:full") +@IocBean +public class WakesHomeMineController { + + @Inject + private WakesHomeInfoService wakesHomeInfoService; + + @At("") + @Ok("beetl:/platform/wakeshome/info/mine.html") + @RequiresPermissions("wakeshome.info.mine") + public void index() {} + + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.mine") + public Object pageData(PageForm pageForm, + @Param(value = "year",required = false) Integer year, + @Param(value = "unionId",required = false)String unionId){ + Sql sql = Sqls.create(""" + SELECT + wh.*, + audit.stateName + FROM + `wakes_home` wh + LEFT JOIN audit_state audit ON wh.state = audit.stateId + AND audit.module = 'WakesHome' + $condition + """); + + CndPlus cnd = CndPlus.create(); + cnd.andEX("YEAR(applyTime)","=",year); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")){ + cnd.and("unionId","=", Vi.getUnionId()); + } else { + if ("校工会".equals(unionId)){ + cnd.and("wh.category","=","校工会"); + } else { + cnd.andEX("unionId", "=", unionId); + } + } + sql.setCondition(cnd); + return wakesHomeInfoService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql); + } + + + + @At + @ViReturn + @RequiresPermissions(value = {"wakeshome.info.mine","wakeshome.info.apply"},logical = Logical.OR) + public Object getInfoById(String id){ + WakesHome wakesHome = wakesHomeInfoService.fetch(id); + NutMap nutMap = Lang.obj2nutmap(wakesHome); + Audit audit = wakesHomeInfoService.dao().fetch(Audit.class, Cnd.where("id", "=", wakesHome.getSchoolAuditId())); + if (Lang.isNotEmpty(audit)){ + nutMap.setv("schoolAudit",audit); + } + return nutMap; + } + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.mine") + public Object doRemove(String id){ + wakesHomeInfoService.delete(id); + return null; + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeSchoolAuditController.java b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeSchoolAuditController.java new file mode 100644 index 0000000..d4c5a84 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/info/WakesHomeSchoolAuditController.java @@ -0,0 +1,97 @@ +package io.v.nutz.wakershome.controller.info; + + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.model.WakesHome; +import io.v.nutz.wakershome.service.WakesHomeInfoService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +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.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +@At("/platform/wakeshome/info/schoolaudit") +@Ok("json:full") +@IocBean +public class WakesHomeSchoolAuditController { + + @Inject + private WakesHomeInfoService wakesHomeInfoService; + + @At("") + @Ok("beetl:/platform/wakeshome/info/schoolAudit.html") + @RequiresPermissions("wakeshome.info.schoolaudit") + public void index() {} + + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.schoolaudit") + public Object pageData(PageForm pageForm, + @Param(value = "year",required = false) Integer year, + @Param(value = "unionId",required = false)String unionId, + @Param(value = "isAudit", required = false) String isAudit){ + Sql sql = Sqls.create(""" + SELECT + wh.*, + audit.stateName + FROM + `wakes_home` wh + LEFT JOIN audit_state audit ON wh.state = audit.stateId + AND audit.module = 'WakesHome' + $condition + """); + + CndPlus cnd = CndPlus.create(); + if (!ShiroUtil.hasAnyRoles("sysadmin,A06")){ + cnd.and("unionId","=", Vi.getUnionId()); + } else { + if ("校工会".equals(unionId)){ + cnd.and("wh.category","=","校工会"); + } else { + cnd.andEX("unionId", "=", unionId); + } + } + cnd.andEX("YEAR(applyTime)","=",year); + cnd.and("wh.state", "true".equals(isAudit) ? ">" : "false".equals(isAudit) ? "=" : ">=", 8120); + sql.setCondition(cnd); + return wakesHomeInfoService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(),sql); + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.schoolaudit") + @Aop(TransAop.READ_COMMITTED) + public Object doAudit(@Param("audit") Audit audit, String id, String isPass){ + wakesHomeInfoService.dao().insert(audit); + wakesHomeInfoService.update(Chain.make("state","1".equals(isPass) ? 8130 : 8125) + .add("schoolAuditId",audit.getId()), Cnd.where("id","=",id)); + return null; + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.info.schoolaudit") + @Aop(TransAop.READ_COMMITTED) + public Object doRollBack(String id){ + WakesHome wakesHome = wakesHomeInfoService.fetch(id); + wakesHomeInfoService.dao().clear(Audit.class,Cnd.where("id","=",wakesHome.getSchoolAuditId())); + wakesHomeInfoService.update(Chain.make("state",8120).add("schoolAuditId",null),Cnd.where("id","=",id)); + return null; + } + +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/AddZbController.java b/src/main/java/io/v/nutz/wakershome/controller/review/AddZbController.java new file mode 100644 index 0000000..7d5b13a --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/review/AddZbController.java @@ -0,0 +1,58 @@ +package io.v.nutz.wakershome.controller.review; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.wakershome.model.review.CommentNr; +import io.v.nutz.wakershome.model.review.CommentZb; +import io.v.nutz.wakershome.service.review.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/wakeshome/review/Xjkhzb") +@Ok("json:full") +@IocBean +public class AddZbController { + @At("") + @Ok("beetl:/platform/wakeshome/review/xjkhzb.html") + @RequiresPermissions("wakeshome.review.xjkhzb") + public void index() { + } + + + @Inject + private CommentZbService commentZbService; + + @At + @ViReturn + @RequiresPermissions("wakeshome.review.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)); + } + + +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/ExportZpController.java b/src/main/java/io/v/nutz/wakershome/controller/review/ExportZpController.java new file mode 100644 index 0000000..0a5f4b6 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/review/ExportZpController.java @@ -0,0 +1,259 @@ +package io.v.nutz.wakershome.controller.review; + +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.annontation.ViReturn; +import io.v.nutz.sys.models.User; +import io.v.nutz.wakershome.model.review.CommentExport; +import io.v.nutz.wakershome.model.review.CommentZb; +import io.v.nutz.wakershome.service.review.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 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 unionMap = zbService.listMap(sql); + + + List zbs = zbService.query(Cnd.NEW().and("id", "in", export.getZbIds()).asc("assessmentMode")); + + //创建临时文件夹 + Path templateDir = Files.createTempDirectory("评测结果文件夹"); + + //循环分工会 + for (NutMap un : unionMap) { + List users = zbService.dao().query(User.class, Cnd.where("unionId", "=", un.getString("id"))); + + FileOutputStream outputStream = new FileOutputStream(templateDir.toString() + "/" + un.getString("unionName") + "基层工会会员评家民主测评结果报告表.docx"); + + List 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 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); + } + + + } + + +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java b/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java new file mode 100644 index 0000000..9672d0d --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/review/StatisticsZpController.java @@ -0,0 +1,381 @@ +package io.v.nutz.wakershome.controller.review; + +import cn.hutool.core.convert.Convert; +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.base.utils.Vi; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.sys.models.Sys_file; +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.service.review.CommentPeoService; +import io.v.nutz.wakershome.service.review.CommentStatisticsService; +import io.v.nutz.wakershome.service.review.CommentZbService; +import io.v.nutz.web.commons.base.Globals; +import io.v.nutz.web.commons.utils.FileUtil; +import org.apache.commons.io.IOUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.ddr.poi.html.HtmlRenderPolicy; +import org.nutz.boot.starter.ftp.FtpService; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +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.Lang; +import org.nutz.lang.random.R; +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.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * @ClassName statisticsController + * @Description TODO + * @Author zhf + * @Date 2023/9/5 15:58 + */ +@At("/platform/wakeshome/review/statistics") +@Ok("json:full") +@IocBean +public class StatisticsZpController { + + @Inject + private FtpService ftpService; + + @Inject + private CommentZbService commentZbService; + + @Inject + private CommentPeoService commentPeoService; + + @Inject + private CommentStatisticsService commentStatisticsService; + + + @At("") + @Ok("beetl:/platform/wakeshome/review/statistics.html") + @RequiresPermissions("wakeshome.review.statistics") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("wakeshome.review.statistics") + public Object pageData(PageForm page, + @Param(value = "zbId", required = false) String zbId, + @Param(value = "unionId", required = false) String unionId) { + + CommentZb zb = commentPeoService.dao().fetch(CommentZb.class, Cnd.where("id", "=", zbId)); + 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(); + + if (Lang.isNotEmpty(zb.getUnionIds())) { + cnd.and("un.id", "in", zb.getUnionIds()); + } else { + if (ShiroUtil.hasAnyRoles("sysadmin,A06")) { + cnd.andEX("un.id", "=", unionId); + } else { + cnd.and("un.id", "=", Vi.getUnionId()); + } + } + + 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.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; + + } + + + /** + * 分工会自评导出(单个) + * + * @param zbId + * @param unionId + * @param response + */ + @At + @Ok("void") + @RequiresPermissions("wakeshome.review.statistics") + public void doDownLoadSingleByUnionId(String zbId, String unionId, HttpServletResponse response) { + CommentPeo peo = commentZbService.dao().fetch(CommentPeo.class, Cnd.where("unionId", "=", unionId).and("zbId", "=", zbId)); + + String fileName = peo.getUnionName() + "(" + peo.getUserName() + ")“模范教工小家”评议结果"; + try { + response.addHeader("Content-Type", "application/octet-stream"); + response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx"); + commentStatisticsService.exportWord(peo, response.getOutputStream()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * 分工会下所有测评结果导出(多个)压缩包 + * @param zbId + * @param unionId + * @param response + */ + @At + @Ok("void") + @RequiresPermissions("wakeshome.review.statistics") + public void doDownLoadZipByUnionId(String zbId, String unionId, HttpServletResponse response) { + try { + List peoList = commentPeoService.dao().query(CommentPeo.class, Cnd.where("unionId", "=", unionId).and("zbId", "=", zbId)); + CommentPeo commentPeo = peoList.stream().findFirst().orElse(new CommentPeo()); + String zipName = commentPeo.getUnionName() + "评议结果.zip"; + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(zipName, "UTF-8")); + + ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream())); + for (CommentPeo peo : peoList) { + String fileName = peo.getUnionName() + "(" + peo.getUserName() + ")“模范教工小家”评议结果.docx"; + zipOutputStream.putNextEntry(new ZipEntry(fileName)); + commentStatisticsService.exportWord(peo, zipOutputStream); + zipOutputStream.closeEntry(); + response.flushBuffer(); + } + zipOutputStream.flush(); + zipOutputStream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * 分工会导出附件 + * @param zbId + * @param unionId + * @param response + */ + @At + @Ok("void") + @RequiresPermissions("wakeshome.review.statistics") + public void exportFilesByUnionId(String zbId, String unionId, HttpServletResponse response) { + List peoList = commentPeoService.dao().query(CommentPeo.class, Cnd.where("unionId", "=", unionId).and("zbId", "=", zbId)); + CommentPeo commentPeo = peoList.stream().findFirst().orElse(new CommentPeo()); + response.reset(); + response.setContentType("application/x-msdownload;charset=utf-8"); + + String tmpPath = "tmp/" + R.UU32(); + File tmpDir = new File(tmpPath + "/附件信息"); + tmpDir.mkdirs(); + + try { + for (CommentPeo peo : peoList) { + String fileName = peo.getUnionName() + "(" + peo.getUserName() + ")"; + List files = peo.getFiles(); + + File tDir = new File(tmpDir + "/" + fileName); + tDir.mkdirs(); + + if (Lang.isNotEmpty(files)) { + for (Sys_file file : files) { + if(Lang.isNotEmpty(file)) { + FileOutputStream outputStream = new FileOutputStream(tDir.getPath() + "/" + file.getFilename()); + ftpService.download(file.getFilepath(), outputStream); + outputStream.close(); + } + } + } + } + + String aimsDir = "zipTmp/" + R.UU32(); + String aimsName = commentPeo.getUnionName() + "评议信息.zip"; + String aimsPath = aimsDir + "/" + aimsName; + FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName); + + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(aimsName, "UTF-8")); + + File aimsFile = new File(aimsPath); + FileInputStream inputStream = new FileInputStream(aimsFile); + IOUtils.copy(inputStream, response.getOutputStream()); + inputStream.close(); + aimsFile.delete(); + + FileUtil.deleteDir(new File(tmpPath)); + FileUtil.deleteDir(new File(aimsDir)); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + /** + * 个人上传附件导出 + * + * @param peoId + * @param response + */ + @At + @Ok("void") + @RequiresPermissions("wakeshome.review.statistics") + public void exportFilesByPeoId(String peoId, HttpServletResponse response) { + CommentPeo peo = commentPeoService.dao().fetch(CommentPeo.class, peoId); + List files = peo.getFiles(); + + response.reset(); + response.setContentType("application/x-msdownload;charset=utf-8"); + + String tmpPath = "tmp/" + R.UU32(); + File tmpDir = new File(tmpPath + "/个人附件信息"); + tmpDir.mkdirs(); + + try { + for (Sys_file file : files) { + if (Lang.isNotEmpty(files)) { + FileOutputStream out = new FileOutputStream(tmpDir.getPath() + "/" + file.getFilename()); + ftpService.download(file.getFilepath(), out); + out.close(); + } + } + String aimsDir = "zipTmp/" + R.UU32(); + String aimsName = peo.getUnionName() + "(" + peo.getUserName() + ")个人附件信息.zip"; + String aimsPath = aimsDir + "/" + aimsName; + FileUtil.compressToZip(tmpDir.getPath(), aimsDir, aimsName); + + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(aimsName, "UTF-8")); + + File aimsFile = new File(aimsPath); + FileInputStream inputStream = new FileInputStream(aimsFile); + IOUtils.copy(inputStream, response.getOutputStream()); + inputStream.close(); + aimsFile.delete(); + + FileUtil.deleteDir(new File(tmpPath)); + FileUtil.deleteDir(new File(aimsDir)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * 个人评议结果导出(得分) + * + * @param peoId + * @param response + */ + @At + @Ok("void") + @RequiresPermissions("wakeshome.review.statistics") + public void exportByPeoId(String peoId, HttpServletResponse response) { + CommentPeo peo = commentPeoService.dao().fetch(CommentPeo.class, peoId); + + String fileName = peo.getUnionName() + "(" + peo.getUserName() + ")“模范教工小家”评议结果"; + try { + response.addHeader("Content-Type", "application/octet-stream"); + response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx"); + commentStatisticsService.exportWord(peo, response.getOutputStream()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * 导出所有分工会评议结果和附件信息 + * + * @param zbId + * @param response + */ + @At + @Ok("void") + @RequiresPermissions("wakeshome.review.statistics") + public void exportAllUnions(String zbId, HttpServletResponse response) { +// List peoList = commentPeoService.dao().query(CommentPeo.class, Cnd.where("zbId", "=", zbId)); + +// Map> collect = peoList.stream().collect(Collectors.groupingBy(CommentPeo::getUnionId)); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java b/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java new file mode 100644 index 0000000..f75b3f1 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java @@ -0,0 +1,163 @@ +package io.v.nutz.wakershome.controller.review; + +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.wakershome.model.review.CommentBz; +import io.v.nutz.wakershome.model.review.CommentNr; +import io.v.nutz.wakershome.model.review.CommentZb; +import io.v.nutz.wakershome.service.review.CommentBzService; +import io.v.nutz.wakershome.service.review.CommentNrService; +import io.v.nutz.wakershome.service.review.CommentZbService; +import io.v.nutz.welfare.model.WelfareProjectSubject; +import io.v.nutz.welfare.model.WelfareProjectSubjectOption; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; +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.Lang; +import org.nutz.lang.Strings; +import org.nutz.lang.random.R; +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/wakeshome/review/khzb") +@Ok("json:full") +@IocBean +public class ViewZbController { + + + @Inject + private CommentZbService commentZbService; + + @Inject + private CommentNrService commentNrService; + + @Inject + private CommentBzService commentBzService; + + + @At("") + @Ok("beetl:/platform/wakeshome/review/khzb.html") + @RequiresPermissions("wakeshome.review.khzb") + public void index() { + + } + + @At + @ViReturn + @RequiresPermissions("wakeshome.review.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("wakeshome.review.khzb") + public Object delete(String id) { + + commentZbService.delete(id); + + List 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("wakeshome.review.khzb") + @Aop(TransAop.READ_COMMITTED) + public Object doEdit(@Param(value = "kh_zb") CommentZb commentZb) { + commentZbService.updateIgnoreNull(commentZb); + + List 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())); + List nrs = commentZb.getNrs(); + if (Lang.isNotEmpty(nrs)){ + nrs.forEach(v->{ + if (v.getId() == null) { + v.setId(R.UU32()); + } + Chain chain = Chain.make("id", v.getId()); + chain.add("zb_id",commentZb.getId()); + chain.add("content",v.getContent()); + chain.add("contentNumber",v.getContentNumber()); + chain.add("remark",v.getRemark()); + commentNrService.dao().insert(CommentNr.class, chain); + + List bzs = v.getBzs(); + bzs.forEach(b->{ + if (b.getId() == null) { + b.setId(R.UU32()); + } + Chain bzChain = Chain.make("id", b.getId()); + bzChain.add("nr_id",v.getId()); + bzChain.add("inspection",b.getInspection()); + bzChain.add("score",b.getScore()); + bzChain.add("single_score",b.getSingle_score()); + bzChain.add("zb_id",commentZb.getId()); + bzChain.add("contentNumber",b.getContentNumber()); + commentNrService.dao().insert(CommentBz.class, bzChain); + + }); + + + }); + + } + /* for (CommentNr nr : commentZb.getNrs()) { + nr.setZb_id(commentZb.getId()); + commentNrService.insertWith(nr, "bzs"); + }*/ + return null; + + } + + +} diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/WakesHomeReviewController.java b/src/main/java/io/v/nutz/wakershome/controller/review/WakesHomeReviewController.java new file mode 100644 index 0000000..7b3e29c --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/controller/review/WakesHomeReviewController.java @@ -0,0 +1,112 @@ +package io.v.nutz.wakershome.controller.review; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import cn.wizzer.framework.page.Pagination; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.modules.models.PageForm; +import io.v.nutz.sys.models.Sys_union; +import io.v.nutz.wakershome.model.review.CommentPeo; +import io.v.nutz.wakershome.service.review.CommentZbService; +import io.v.nutz.web.commons.utils.ShiroUtil; +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.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 java.util.List; +import java.util.stream.Collectors; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeReviewController + * @Date 2024/8/1 16:47 + * @注释 pc端职工评议 + */ +@IocBean +@Ok("json:full") +@At("/platform/wakeshome/review/doReview") +public class WakesHomeReviewController { + + @Inject + private CommentZbService commentZbService; + + @At("") + @Ok("beetl:/platform/wakeshome/review/doReview.html") + @RequiresPermissions("wakeshome.review.doReview") + public void index() { + } + + @At + @ViReturn + @RequiresPermissions("wakeshome.review.doReview") + public Object pageData(PageForm pageForm, + @Param(value = "annual", required = false) String annual, + @Param(value = "assessment", required = false) String assessment){ + Sql sql = Sqls.create(""" + SELECT + zb.* , + if((select count(1) from comment_peo peo where peo.zbId = zb.id and peo.userId = @userId) > 0,true,false) as isReview + FROM + `comment_zb` zb + $condition + """).setParam("userId",ShiroUtil.getUserId()); + Cnd cnd = Cnd.NEW(); + if (Strings.isNotBlank(annual) && Strings.isNotBlank(annual)) { + cnd.and("zb.annual", "=", annual); + } + if (Strings.isNotBlank(assessment) && Strings.isNotBlank(assessment)) { + cnd.where().andLike("zb.assessment", assessment); + } else { + cnd.desc("zb.annual"); + } + sql.setCondition(cnd); + Pagination pagination = commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + List unionList = commentZbService.dao().query(Sys_union.class, Cnd.NEW()); + list.forEach(v -> { + //自评模式 + boolean reviewMode = v.getInt("reviewMode") == 1; + if (reviewMode && v.getInt("commentTarget") == 1) { + //校工会自评,判断有没有校工会管理员的权限 + v.put("canJoin", ShiroUtil.hasRole("A06")); + } else if (reviewMode && v.getInt("commentTarget") == 2){ + //分工会自评,判断有没有分工会管理员 + v.put("canJoin", ShiroUtil.hasRole("H04")); + } + + //自选分工会的模式 + if (StrUtil.isNotBlank(v.getString("unionIds"))) { + List unionIdList = JSONUtil.parseArray(v.getString("unionIds")).toList(String.class); + String string = unionList.stream().filter(item -> unionIdList.contains(item.getId())) + .map(Sys_union::getUnionname).collect(Collectors.joining(",")); + v.put("unionNames", string); + //如果是自评,只有分工会主席才能自评 + if (reviewMode) { + v.put("canJoin", (unionIdList.contains(Vi.getUnionId()) && ShiroUtil.hasRole("H04"))); + } else { + v.put("canJoin", unionIdList.contains(Vi.getUnionId())); + } + } + }); + return pagination; + } + + + @At + @ViReturn + @RequiresPermissions("wakeshome.review.doReview") + public Object getPeoId(String id){ + CommentPeo peo = commentZbService.dao().fetch(CommentPeo.class, Cnd.where("zbId", "=", id).and("userId", "=", ShiroUtil.getUserId())); + return peo.getId(); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/mobile/MWakesHomeReviewController.java b/src/main/java/io/v/nutz/wakershome/mobile/MWakesHomeReviewController.java new file mode 100644 index 0000000..5a1874a --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/mobile/MWakesHomeReviewController.java @@ -0,0 +1,308 @@ +package io.v.nutz.wakershome.mobile; + + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import cn.wizzer.framework.page.Pagination; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.result.Result; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.base.utils.Vi; +import io.v.nutz.dao.CndPlus; +import io.v.nutz.modules.models.PageForm; +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.CommentPeo; +import io.v.nutz.wakershome.model.review.CommentResult; +import io.v.nutz.wakershome.service.review.CommentPeoService; +import io.v.nutz.wakershome.service.review.CommentZbService; +import io.v.nutz.wakershome.vo.WakesHomeVo; +import io.v.nutz.web.commons.utils.ShiroUtil; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +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.dao.util.cri.Static; +import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +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 java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@IocBean +@At("/mobile/wakeshome/review/appraisal") +@Ok("json:full") +public class MWakesHomeReviewController { + + @Inject + private CommentZbService commentZbService; + + @Inject + private BaseService baseService; + + @Inject + private CommentPeoService commentPeoService; + + @At + @Ok("beetl:/mobile/wakeshome/review/appraisal.html") + @RequiresAuthentication + public void index() { + } + + @At + @Ok("beetl:/mobile/wakeshome/review/commentator.html") + @RequiresAuthentication + public void commentator() { + } + + + @At + @Ok("beetl:/mobile/wakeshome/review/mine.html") + @RequiresAuthentication + public void mine() { + } + + + /** + * 民主测评首页展示 + * + * @param pageForm + * @param annual + * @return + */ + @At + @ViReturn + public Object pageData(PageForm pageForm, + @Param(value = "annual", required = false) String annual, + @Param(value = "type", required = false) Integer type) { + Sql sql = Sqls.create("SELECT * FROM `comment_zb` $condition"); + Cnd cnd = Cnd.NEW(); + if (Strings.isNotBlank(annual) && Strings.isNotBlank(annual)) { + cnd.and("annual", "=", annual); + } + switch (type) { + //进行中 + case 2 -> cnd.and(new Static("now() >= startTime and now() <= endTime")); + //已结束 + case 3 -> cnd.and(new Static("now() > endTime")); + //未开始 + case 4 -> cnd.and(new Static("now() < startTime")); + } + sql.setCondition(cnd); + Pagination pagination = commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + List list = pagination.getList(); + List unionList = commentZbService.dao().query(Sys_union.class, Cnd.NEW()); + list.forEach(v -> { + //自评模式 + boolean reviewMode = v.getInt("reviewMode") == 1; + if (reviewMode && v.getInt("commentTarget") == 1) { + //校工会自评,判断有没有校工会管理员的权限 + v.put("canJoin", ShiroUtil.hasRole("A06")); + } else if (reviewMode && v.getInt("commentTarget") == 2){ + //分工会自评,判断有没有分工会管理员 + v.put("canJoin", ShiroUtil.hasRole("H04")); + } + + //自选分工会的模式 + if (StrUtil.isNotBlank(v.getString("unionIds"))) { + List unionIdList = JSONUtil.parseArray(v.getString("unionIds")).toList(String.class); + String string = unionList.stream().filter(item -> unionIdList.contains(item.getId())) + .map(Sys_union::getUnionname).collect(Collectors.joining(",")); + v.put("unionNames", string); + //如果是自评,只有分工会主席才能自评 + if (reviewMode) { + v.put("canJoin", (unionIdList.contains(Vi.getUnionId()) && ShiroUtil.hasRole("H04"))); + } else { + v.put("canJoin", unionIdList.contains(Vi.getUnionId())); + } + } + }); + return pagination; + } + + + /** + * 根据id获取测评内容 + * + * @param id + * @return + */ + @At + @ViReturn + public Object getById(String id) { + return commentZbService.khzb(id); + } + + + @At + @Aop(TransAop.READ_COMMITTED) + public Object doSubmit(WakesHomeVo wakesHomeVo) { + try { + User user = baseService.dao().fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUser())); + CommentPeo peo = new CommentPeo(); + if (Strings.isNotBlank(wakesHomeVo.getEvaluatedPersonId())) { + peo.setEvaluatedPersonId(wakesHomeVo.getEvaluatedPersonId()); + peo.setEvaluatedPersonName(wakesHomeVo.getEvaluatedPersonName()); + peo.setEvaluatedPersonType(wakesHomeVo.getEvaluatedPersonType()); + } + peo.setReviewResult(wakesHomeVo.getReviewResult()); + peo.setZbId(wakesHomeVo.getId()); + peo.setReviewTime(DateUtil.now()); + peo.setFiles(wakesHomeVo.getFiles()); + peo.setUserId(user.getId()); + peo.setUserName(user.getUsername()); + peo.setUnionId(user.getUnionid()); + peo.setUnionName(user.getUnionname()); + if (Strings.isNotBlank(wakesHomeVo.getPresidentOpinions())) { + peo.setPresidentOpinions(wakesHomeVo.getPresidentOpinions()); + } + baseService.dao().insert(peo); + List commentResults = new ArrayList<>(); + for (CommentBz v : wakesHomeVo.getBzList()) { + CommentResult result = new CommentResult(); + result.setBz_id(v.getId()); + result.setAssessResult(v.getResultScore()); + result.setRecommendation(v.getOptions() != null ? v.getOptions() : null); + result.setPeo_id(peo.getId()); + commentResults.add(result); + } + baseService.dao().insert(commentResults); + return Result.success(); + } catch (Exception e) { + e.printStackTrace(); + return Result.error(); + } + } + + + /** + * 判断是否测评过 + * + * @param id 指标id + * @param evaluatedPersonId 被测评人id + * @return + */ + @At + public Object isAssess(@Param("id") String id, + @Param(value = "evaluatedPersonId", required = false) String evaluatedPersonId) { + //主席测评 + if (Strings.isNotBlank(evaluatedPersonId)) { + CndPlus cnd = CndPlus.create(); + cnd.and("evaluatedPersonId", "=", evaluatedPersonId); + cnd.and("userId", "=", ShiroUtil.getPrincipalProperty("id")); + cnd.and("zbId", "=", id); + return Result.success().addData(baseService.dao().count(CommentPeo.class, cnd)); + } else {//会员评家测评 + Sql sql = Sqls.create(""" + SELECT + cp.*, + cz.annual, + cz.assessment, + cz.assessmentMode, + cz.scoringMode, + cz.commentTarget + FROM + `comment_peo` cp + LEFT JOIN `comment_zb` cz ON cz.id = cp.zbId + where cp.zbId=@zbId and cp.userId=@userId + """).setParam("zbId", id).setParam("userId", ShiroUtil.getPrincipalProperty("id")); + List list = baseService.listMap(sql); + NutMap nutMap = list.stream().findFirst().orElse(null); + if (Strings.isNotBlank(nutMap.getString("commentTarget")) && "1".equals(nutMap.getString("assessmentMode"))) { + return Result.success().addData(1); + } else { + return Result.success().addData(0); + } + } + } + + + /** + * 我的测评页面展示 + * + * @param pageForm + * @param annual + * @return + */ + @At + @ViReturn + public Object onLoad(PageForm pageForm, + @Param(value = "annual", required = false) String annual) { + Sql sql = Sqls.create(""" + SELECT + cp.*, + cz.annual, + cz.assessment, + cz.assessmentMode, + cz.scoringMode, + cz.commentTarget + FROM + `comment_peo` cp + LEFT JOIN `comment_zb` cz ON cz.id = cp.zbId + $condition + """); + CndPlus cnd = CndPlus.create(); + cnd.andEX("cz.annual", "=", annual); + cnd.and("cp.userId", "=", ShiroUtil.getPrincipalProperty("id")); + cnd.desc("cp.reviewTime"); + sql.setCondition(cnd); + return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + } + + + /** + * 获取测评结果信息 + * + * @param peoId + * @return + */ + @At + @ViReturn + public Object getBzById(@Param("peoId") String peoId) { + return commentPeoService.getBzById(peoId); + } + + private static final String GH01 = "9c1f19e385914fef82bc35da7c9ded36"; + private static final String GH02 = "672b47cfc79c4a77878c0f2cfd5734be"; + + /** + * 获取分工会主席和副主席 + * + * @return + */ + @At + @ViReturn + public Object getPresidents() { + Sql sql = Sqls.create(""" + SELECT + u.id, + u.loginname, + u.username, + sr.`name` evaluatedPersonType, + GROUP_CONCAT( DISTINCT u.username, '(', sr.`name`, ')' ) presidents + FROM + `user` u + LEFT JOIN `sys_user_role` sur ON u.id = sur.userId + LEFT JOIN `sys_role` sr ON sur.roleId = sr.id + $condition + """); + CndPlus cnd = CndPlus.create(); + cnd.and("sr.`id`", "in", Lang.array(GH01, GH02)); + cnd.and("u.unionid", "=", Vi.getUnionId()); + cnd.groupBy("u.id"); + cnd.asc("u.loginname"); + sql.setCondition(cnd); + return baseService.listMap(sql); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/model/WakesHome.java b/src/main/java/io/v/nutz/wakershome/model/WakesHome.java new file mode 100644 index 0000000..1625b6b --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/WakesHome.java @@ -0,0 +1,123 @@ +package io.v.nutz.wakershome.model; + +import io.v.nutz.sys.models.Sys_file; +import lombok.Data; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.io.Serializable; +import java.util.List; + +@Data +@Table +public class WakesHome { + + @Name + @Column + @Comment("ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("填报人") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String username; + + @Column + @Comment("联系方式") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String mobile; + + @Column + @Comment("所属工会id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionId; + + @Column + @Comment("工会名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unionName; + + @Column + @Comment("填报时间") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String applyTime; + + @Column + @Comment("填报类别(校工会/分工会)") + @ColDefine(type = ColType.VARCHAR, width = 10) + private String category; + + @Column + @Comment("创办时间") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String foundTime; + + @Column + @Comment("单位位置") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String position; + + @Column + @Comment("单位面积") + @ColDefine(type = ColType.VARCHAR, width = 10) + private String area; + + @Column + @Comment("单位信息") + @ColDefine(type = ColType.TEXT) + private String details; + + @Column + @Comment("获奖情况") + @ColDefine(type = ColType.MYSQL_JSON) + private List awardInfo; + + @Column + @Comment("图片文件") + @ColDefine(type = ColType.MYSQL_JSON) + private List picFiles; + + @Column + @Comment("附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List files; + + @Column + @Comment("分工会审核id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionAuditId; + + @Column + @Comment("校工会审核id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String schoolAuditId; + + @Column + @Comment("状态") + @ColDefine(type = ColType.INT) + private Integer state; + + + @Data + public static class awardInfo implements Serializable { + /** + * 获奖日期 + */ + private String awardTime; + /** + * 获奖单位 + */ + private String awardUnit; + /** + * 奖项名称 + */ + private String awardName; + /** + * 奖项照片 + */ + private String awardPic; + } + +} diff --git a/src/main/java/io/v/nutz/wakershome/model/WakesHomeApply.java b/src/main/java/io/v/nutz/wakershome/model/WakesHomeApply.java new file mode 100644 index 0000000..543e720 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/WakesHomeApply.java @@ -0,0 +1,103 @@ +package io.v.nutz.wakershome.model; + +import io.v.nutz.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.io.Serializable; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeApply + * @Date 2024/7/31 10:47 + * @注释 职工之家申报 + */ +@Data +@Table +@Comment("职工之家申报") +@EqualsAndHashCode(callSuper = true) +public class WakesHomeApply extends BaseModel implements Serializable { + + private static final long serialVersionUID = 1L; + + @Column + @Name + @Comment("id") + @ColDefine(type = ColType.VARCHAR, width = 32) + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("申报人id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userId; + + @Column + @Comment("申报人工号") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String loginName; + + @Column + @Comment("申报人姓名") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String username; + + @Column + @Comment("申报人单位id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unitId; + + @Column + @Comment("申报人单位名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unitName; + + @Column + @Comment("申报人工会Id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionId; + + @Column + @Comment("申报人工会名称") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String unionName; + + @Column + @Comment("联系电话") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String mobile; + + @Column + @Comment("基本情况简介(500字内)") + @ColDefine(type = ColType.TEXT) + private String basicInformation; + + @Column + @Comment("建设方案") + @ColDefine(type = ColType.TEXT) + private String constructionPlan; + + @Column + @Comment("基层党组织审核Id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String organizationAuditId; + + @Column + @Comment("校工会审核Id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String schoolAuditId; + + //10000待提交;10010待基层党组织审核;10020待校工会审核;10030审核通过 + @Column + @Comment("当前状态") + @ColDefine(type = ColType.VARCHAR, width = 10) + private String state; + + @Column + @Comment("申报时间") + @ColDefine(type = ColType.DATE) + private String applyDate; +} diff --git a/src/main/java/io/v/nutz/wakershome/model/WakesHomeDataRevel.java b/src/main/java/io/v/nutz/wakershome/model/WakesHomeDataRevel.java new file mode 100644 index 0000000..6b2e6ed --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/WakesHomeDataRevel.java @@ -0,0 +1,85 @@ +package io.v.nutz.wakershome.model; + +import io.v.nutz.base.model.BaseModel; +import io.v.nutz.sys.models.Sys_file; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +import java.util.List; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDataRevel + * @Date 2024/7/30 15:29 + * @注释 职工建家资料管理 + */ +@Data +@Table +@Comment("职工建家资料管理") +@EqualsAndHashCode(callSuper = true) +public class WakesHomeDataRevel extends BaseModel { + + @Name + @Comment("id") + @ColDefine(type = ColType.VARCHAR, width = 32) + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("资料名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String revelName; + + @Column + @Comment("上传人id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String userId; + + @Column + @Comment("上传人工号") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String loginName; + + @Column + @Comment("上传人姓名") + @ColDefine(type = ColType.VARCHAR, width = 50) + private String username; + + @Column + @Comment("上传人单位id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unitId; + + @Column + @Comment("上传人单位名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String unitName; + + @Column + @Comment("上传人工会id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unionId; + + @Column + @Comment("上传人工会名称") + @ColDefine(type = ColType.VARCHAR, width = 100) + private String unionName; + + @Column + @Comment("上传时间") + @ColDefine(type = ColType.VARCHAR, width = 20) + private String time; + + @Column + @Comment("类型Id") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String typeId; + + @Column + @Comment("附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List files; +} diff --git a/src/main/java/io/v/nutz/wakershome/model/WakesHomeDataType.java b/src/main/java/io/v/nutz/wakershome/model/WakesHomeDataType.java new file mode 100644 index 0000000..f5da393 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/WakesHomeDataType.java @@ -0,0 +1,43 @@ +package io.v.nutz.wakershome.model; + +import io.v.nutz.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeDataType + * @Date 2024/7/30 15:29 + * @注释 职工建家资料类型管理 + */ +@Data +@Table +@Comment("职工建家资料类型管理") +@EqualsAndHashCode(callSuper = true) +public class WakesHomeDataType extends BaseModel { + + @Name + @Comment("id") + @ColDefine(type = ColType.VARCHAR, width = 32) + @PrevInsert(uu32 = true) + private String id; + + @Column + @Comment("类型编码") + @ColDefine(type = ColType.VARCHAR, width = 10) + private String code; + + @Column + @Comment("工作资料类型名称") + @ColDefine(type = ColType.VARCHAR, width = 80) + private String typeName; + + @Column + @Comment("序号") + @ColDefine(type = ColType.INT) + private Integer serialNum; + +} diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentBz.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentBz.java new file mode 100644 index 0000000..f8add2a --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentBz.java @@ -0,0 +1,97 @@ +package io.v.nutz.wakershome.model.review; + +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; +} diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentExport.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentExport.java new file mode 100644 index 0000000..c181b91 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentExport.java @@ -0,0 +1,44 @@ +package io.v.nutz.wakershome.model.review; + +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 zbIds; + + + @Column + @Comment("创建时间") + @ColDefine(type = ColType.VARCHAR, width = 20) + private String createTime; + + +} diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentNr.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentNr.java new file mode 100644 index 0000000..395f1a9 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentNr.java @@ -0,0 +1,61 @@ +package io.v.nutz.wakershome.model.review; + +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 bzs; + + @Column + @Comment("排序字段") + @Prev({ + @SQL(db= DB.MYSQL,value = "SELECT IFNULL(MAX(location),0)+1 FROM comment_nr"), + }) + private Integer location; + + @Column + @Comment("备注") + @ColDefine(type = ColType.TEXT) + private String remark; +} diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentPeo.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentPeo.java new file mode 100644 index 0000000..41bd52c --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentPeo.java @@ -0,0 +1,86 @@ +package io.v.nutz.wakershome.model.review; + + +import io.v.nutz.sys.models.Sys_file; +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("测评人姓名") + @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 + @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 resultList; + + + @Column + @Comment("自我测评的附件") + @ColDefine(type = ColType.MYSQL_JSON) + private List files; +} diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentResult.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentResult.java new file mode 100644 index 0000000..1f9aad4 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentResult.java @@ -0,0 +1,45 @@ +package io.v.nutz.wakershome.model.review; + + +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; +} diff --git a/src/main/java/io/v/nutz/wakershome/model/review/CommentZb.java b/src/main/java/io/v/nutz/wakershome/model/review/CommentZb.java new file mode 100644 index 0000000..74e08e5 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/model/review/CommentZb.java @@ -0,0 +1,96 @@ +package io.v.nutz.wakershome.model.review; + +import cn.wizzer.framework.base.model.BaseModel; +import lombok.Data; +import org.nutz.dao.DB; +import org.nutz.dao.entity.annotation.*; + +import java.util.Date; +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.全部分工会 3.自选分工会)") + @ColDefine(type = ColType.INT) + private Integer commentTarget; + + @Column + @Comment("打分模式(1.评分模式2.选择满意不满意模式)") + @ColDefine(type = ColType.INT) + private Integer scoringMode; + + + @Many(field = "zb_id") + private List nrs; + + @Column + @Comment("排序字段") + @Prev({ + @SQL(db= DB.MYSQL,value = "SELECT IFNULL(MAX(location),0)+1 FROM comment_zb"), + }) + private Integer location; + + + @Column + @Comment("自选分工会Id") + @ColDefine(type = ColType.MYSQL_JSON) + private List unionIds; + + @Column + @Comment("评议开始时间") + @ColDefine(type = ColType.DATETIME) + private Date startTime; + + + @Column + @Comment("评议结束时间") + @ColDefine(type = ColType.DATETIME) + private Date endTime; + + + @Column + @Comment("评议模式(1.自评模式 2.教职工评议)") + @ColDefine(type = ColType.INT) + private Integer reviewMode; +} diff --git a/src/main/java/io/v/nutz/wakershome/service/IWakesHomeApplyService.java b/src/main/java/io/v/nutz/wakershome/service/IWakesHomeApplyService.java new file mode 100644 index 0000000..4ad343f --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/IWakesHomeApplyService.java @@ -0,0 +1,19 @@ +package io.v.nutz.wakershome.service; + +import io.v.nutz.base.service.BaseService; +import io.v.nutz.wakershome.model.WakesHomeApply; +import org.nutz.lang.util.NutMap; + +/** + * @version 1.0 + * @Author zzr + * @name:IWakesHomeApplyService + * @Date 2024/7/31 11:09 + * @注释 + */ +public interface IWakesHomeApplyService extends BaseService { + + NutMap findById(String id); + + void setParams(WakesHomeApply wakesHomeApply); +} diff --git a/src/main/java/io/v/nutz/wakershome/service/WakesHomeInfoService.java b/src/main/java/io/v/nutz/wakershome/service/WakesHomeInfoService.java new file mode 100644 index 0000000..faef584 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/WakesHomeInfoService.java @@ -0,0 +1,7 @@ +package io.v.nutz.wakershome.service; + +import io.v.nutz.service.ViService; +import io.v.nutz.wakershome.model.WakesHome; + +public interface WakesHomeInfoService extends ViService { +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/WakesHomeApplyServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/WakesHomeApplyServiceImpl.java new file mode 100644 index 0000000..9c9d4d0 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/impl/WakesHomeApplyServiceImpl.java @@ -0,0 +1,58 @@ +package io.v.nutz.wakershome.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.base.service.impl.BaseServiceImpl; +import io.v.nutz.modules.models.Audit; +import io.v.nutz.sys.models.User; +import io.v.nutz.util.ShiroUtil; +import io.v.nutz.wakershome.model.WakesHomeApply; +import io.v.nutz.wakershome.service.IWakesHomeApplyService; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; +import org.nutz.lang.random.R; +import org.nutz.lang.util.NutMap; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeApplyServiceImpl + * @Date 2024/7/31 11:10 + * @注释 + */ +@IocBean(args = {"refer:dao"}) +public class WakesHomeApplyServiceImpl extends BaseServiceImpl implements IWakesHomeApplyService { + public WakesHomeApplyServiceImpl(Dao dao) { + super(dao); + } + + + @Override + public NutMap findById(String id) { + WakesHomeApply apply = fetch(id); + NutMap nutMap = Lang.obj2nutmap(apply); + if (StrUtil.isNotBlank(apply.getOrganizationAuditId())) { + Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", apply.getOrganizationAuditId())); + nutMap.put("organizationAudit", Lang.obj2nutmap(audit)); + } + if (StrUtil.isNotBlank(apply.getSchoolAuditId())) { + Audit audit = dao().fetch(Audit.class, Cnd.where("id", "=", apply.getSchoolAuditId())); + nutMap.put("schoolAudit", Lang.obj2nutmap(audit)); + } + return nutMap; + } + + + @Override + public void setParams(WakesHomeApply wakesHomeApply) { + User user = dao().fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUserId())); + wakesHomeApply.setId(R.UU32()); + wakesHomeApply.setApplyDate(DateUtil.today()); + wakesHomeApply.setUnitId(user.getUnitid()); + wakesHomeApply.setUnitName(user.getUnitname()); + wakesHomeApply.setUnionId(user.getUnionid()); + wakesHomeApply.setUnionName(user.getUnionname()); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/WakesHomeInfoServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/WakesHomeInfoServiceImpl.java new file mode 100644 index 0000000..d82f9c3 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/impl/WakesHomeInfoServiceImpl.java @@ -0,0 +1,14 @@ +package io.v.nutz.wakershome.service.impl; + +import io.v.nutz.service.impl.ViServiceImpl; +import io.v.nutz.wakershome.model.WakesHome; +import io.v.nutz.wakershome.service.WakesHomeInfoService; +import org.nutz.dao.Dao; +import org.nutz.ioc.loader.annotation.IocBean; + +@IocBean(args = {"refer:dao"}) +public class WakesHomeInfoServiceImpl extends ViServiceImpl implements WakesHomeInfoService { + public WakesHomeInfoServiceImpl(Dao dao) { + super(dao); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentBzServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentBzServiceImpl.java new file mode 100644 index 0000000..e9c899a --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentBzServiceImpl.java @@ -0,0 +1,20 @@ +package io.v.nutz.wakershome.service.impl.review; + +import io.v.nutz.service.impl.ViServiceImpl; +import io.v.nutz.wakershome.model.review.CommentBz; +import io.v.nutz.wakershome.service.review.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 implements CommentBzService { + public CommentBzServiceImpl(Dao dao) { + super(dao); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentNrServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentNrServiceImpl.java new file mode 100644 index 0000000..b2c0556 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentNrServiceImpl.java @@ -0,0 +1,20 @@ +package io.v.nutz.wakershome.service.impl.review; + +import io.v.nutz.service.impl.ViServiceImpl; +import io.v.nutz.wakershome.model.review.CommentNr; +import io.v.nutz.wakershome.service.review.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 implements CommentNrService { + public CommentNrServiceImpl(Dao dao) { + super(dao); + } +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentPeoServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentPeoServiceImpl.java new file mode 100644 index 0000000..226852b --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentPeoServiceImpl.java @@ -0,0 +1,64 @@ +package io.v.nutz.wakershome.service.impl.review; + + +import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.service.BaseService; +import io.v.nutz.service.impl.ViServiceImpl; +import io.v.nutz.wakershome.model.review.CommentNr; +import io.v.nutz.wakershome.model.review.CommentPeo; +import io.v.nutz.wakershome.model.review.CommentResult; +import io.v.nutz.wakershome.model.review.CommentZb; +import io.v.nutz.wakershome.service.review.CommentPeoService; +import io.v.nutz.wakershome.service.review.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.Lang; +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 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 query = baseService.dao().query(CommentResult.class, Cnd.where("peo_id","=",peoId)); + //对测评标准分组 + Map commentResultMap = query.stream().collect(Collectors.toMap(v -> v.getBz_id(), v -> v)); + //获取指标 + CommentZb khzb = commentZbService.khzb(commentPeo.getZbId()); + List nrs = khzb.getNrs(); + nrs.forEach(v->{ + v.getBzs().forEach(o->{ + //赋值测评结果 + CommentResult result = commentResultMap.get(o.getId()); + if (Lang.isNotEmpty(result)){ + o.setOptions(StrUtil.isNotBlank(result.getRecommendation()) ? result.getRecommendation() : "未填写备注"); + o.setResultScore(result.getAssessResult()); + } + }); + }); + NutMap nutMap = new NutMap(); + nutMap.setv("zbxx",khzb); + nutMap.setv("commentPeo",commentPeo); + return nutMap; + } +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentStatisticsServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentStatisticsServiceImpl.java new file mode 100644 index 0000000..6daa6a5 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentStatisticsServiceImpl.java @@ -0,0 +1,94 @@ +package io.v.nutz.wakershome.service.impl.review; + +import cn.hutool.core.convert.Convert; +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.policy.HackLoopTableRenderPolicy; +import io.v.nutz.base.service.impl.BaseServiceImpl; +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.service.review.CommentPeoService; +import io.v.nutz.wakershome.service.review.CommentStatisticsService; +import io.v.nutz.web.commons.base.Globals; +import org.ddr.poi.html.HtmlRenderPolicy; +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 javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @version 1.0 + * @Author zzr + * @name:CommentStatisticsServiceImpl + * @Date 2024/8/26 9:48 + * @注释 + */ +@IocBean(args = {"refer:dao"}) +public class CommentStatisticsServiceImpl extends BaseServiceImpl implements CommentStatisticsService { + public CommentStatisticsServiceImpl(Dao dao) { + super(dao); + } + + @Inject + private CommentPeoService commentPeoService; + + + @Override + public void exportWord(CommentPeo peo, OutputStream outputStream) { + NutMap map = commentPeoService.getBzById(peo.getId()); + //最后的导出表 + NutMap resultMap = NutMap.NEW(); + + List list = new ArrayList<>(); + resultMap.put("schoolName", Globals.schoolName); + + CommentZb khzb = map.getAs("zbxx", CommentZb.class); + List nrs = khzb.getNrs(); + + nrs.forEach(v -> { + NutMap nutMap = NutMap.NEW(); + List bzs = v.getBzs(); + String nr = bzs.stream().sorted(Comparator.comparing(CommentBz::getContentNumber)).map(item -> { + return item.getContentNumber() + "." + item.getInspection() + "(" + item.getScore() + "分)"; + }).collect(Collectors.joining("\n")); + + 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); + + try { + InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/WakesHome.docx"); + XWPFTemplate.compile(inputStream, config).render(resultMap, outputStream); + inputStream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentZbServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentZbServiceImpl.java new file mode 100644 index 0000000..240b592 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentZbServiceImpl.java @@ -0,0 +1,48 @@ +package io.v.nutz.wakershome.service.impl.review; + +import cn.hutool.core.util.StrUtil; +import io.v.nutz.service.impl.ViServiceImpl; +import io.v.nutz.wakershome.model.review.CommentNr; +import io.v.nutz.wakershome.model.review.CommentZb; +import io.v.nutz.wakershome.service.review.CommentNrService; +import io.v.nutz.wakershome.service.review.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 implements CommentZbService { + public CommentZbServiceImpl(Dao dao) { + super(dao); + } + + @Inject + private CommentNrService commentNrService; + + + private void setNrBz(List 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; + } + +} diff --git a/src/main/java/io/v/nutz/wakershome/service/review/CommentBzService.java b/src/main/java/io/v/nutz/wakershome/service/review/CommentBzService.java new file mode 100644 index 0000000..dc9e7c7 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/review/CommentBzService.java @@ -0,0 +1,7 @@ +package io.v.nutz.wakershome.service.review; + +import io.v.nutz.service.ViService; +import io.v.nutz.wakershome.model.review.CommentBz; + +public interface CommentBzService extends ViService { +} diff --git a/src/main/java/io/v/nutz/wakershome/service/review/CommentNrService.java b/src/main/java/io/v/nutz/wakershome/service/review/CommentNrService.java new file mode 100644 index 0000000..ec38a6e --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/review/CommentNrService.java @@ -0,0 +1,7 @@ +package io.v.nutz.wakershome.service.review; + +import io.v.nutz.service.ViService; +import io.v.nutz.wakershome.model.review.CommentNr; + +public interface CommentNrService extends ViService { +} diff --git a/src/main/java/io/v/nutz/wakershome/service/review/CommentPeoService.java b/src/main/java/io/v/nutz/wakershome/service/review/CommentPeoService.java new file mode 100644 index 0000000..1c968f4 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/review/CommentPeoService.java @@ -0,0 +1,18 @@ +package io.v.nutz.wakershome.service.review; + +import io.v.nutz.service.ViService; +import io.v.nutz.wakershome.model.review.CommentPeo; +import org.nutz.lang.util.NutMap; + +import java.io.InputStream; + +public interface CommentPeoService extends ViService { + + /** + * 根据指标id和被测评人id查测评结果 + * @param peoId 指标id + * @return + */ + NutMap getBzById(String peoId); + +} diff --git a/src/main/java/io/v/nutz/wakershome/service/review/CommentStatisticsService.java b/src/main/java/io/v/nutz/wakershome/service/review/CommentStatisticsService.java new file mode 100644 index 0000000..c78fec9 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/review/CommentStatisticsService.java @@ -0,0 +1,23 @@ +package io.v.nutz.wakershome.service.review; + +import io.v.nutz.base.service.BaseService; +import io.v.nutz.wakershome.model.review.CommentPeo; +import org.nutz.lang.util.NutMap; + +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; + +/** + * @version 1.0 + * @Author zzr + * @name:CommentStatisticsService + * @Date 2024/8/26 9:47 + * @注释 + */ +public interface CommentStatisticsService extends BaseService { + + void exportWord(CommentPeo peo, OutputStream outputStream); + + + +} diff --git a/src/main/java/io/v/nutz/wakershome/service/review/CommentZbService.java b/src/main/java/io/v/nutz/wakershome/service/review/CommentZbService.java new file mode 100644 index 0000000..19f50c9 --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/service/review/CommentZbService.java @@ -0,0 +1,11 @@ +package io.v.nutz.wakershome.service.review; + +import io.v.nutz.service.ViService; +import io.v.nutz.wakershome.model.review.CommentZb; + +public interface CommentZbService extends ViService { + + + CommentZb khzb(String zbid); + +} diff --git a/src/main/java/io/v/nutz/wakershome/vo/WakesHomeVo.java b/src/main/java/io/v/nutz/wakershome/vo/WakesHomeVo.java new file mode 100644 index 0000000..a7ac2cc --- /dev/null +++ b/src/main/java/io/v/nutz/wakershome/vo/WakesHomeVo.java @@ -0,0 +1,34 @@ +package io.v.nutz.wakershome.vo; + +import io.v.nutz.sys.models.Sys_file; +import io.v.nutz.wakershome.model.review.CommentBz; +import lombok.Data; + +import java.util.List; + +/** + * @version 1.0 + * @Author zzr + * @name:WakesHomeVo + * @Date 2024/8/1 16:06 + * @注释 职工建家vo + */ +@Data +public class WakesHomeVo { + + private String id; + + private List bzList; + + private String reviewResult; + + private String evaluatedPersonId; + + private String evaluatedPersonName; + + private String evaluatedPersonType; + + private String presidentOpinions; + + private List files; +} diff --git a/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java b/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java index 9bde240..e63c7cb 100644 --- a/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java +++ b/src/main/java/io/v/nutz/web/commons/controller/ViCommonCon.java @@ -18,6 +18,7 @@ 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.ArrayList; @@ -284,9 +285,14 @@ public class ViCommonCon { */ @At @ViReturn - public Object unions(String delegationId) { + public Object unions(@Param(value = "delegationId", required = false) String delegationId, boolean isPermission) { if (Strings.isBlank(delegationId)) { - return sysUnionService.query(Cnd.where("isEnable", "=", true).orderBy().asc("unioncode")); + Cnd cndX = Cnd.NEW(); + if (isPermission) { + cndX.and("id", "=", Vi.getUnionId()); + } + cndX.asc("unioncode"); + return sysUnionService.query(cndX); } Cnd cnd = Cnd.NEW(); Sql sql = Sqls.create(""" @@ -300,7 +306,7 @@ public class ViCommonCon { LEFT JOIN jdh_dbt dbt ON zc.dbtid = dbt.id $condition """); - cnd.and("zc.dbtid", "=", delegationId).and("uni.isEnable", "=", true) + cnd.and("zc.dbtid", "=", delegationId) .groupBy("uni.id") .asc("uni.unioncode"); diff --git a/src/main/java/io/v/nutz/web/commons/utils/ShiroUtil.java b/src/main/java/io/v/nutz/web/commons/utils/ShiroUtil.java index eacce66..691407a 100644 --- a/src/main/java/io/v/nutz/web/commons/utils/ShiroUtil.java +++ b/src/main/java/io/v/nutz/web/commons/utils/ShiroUtil.java @@ -1,8 +1,17 @@ package io.v.nutz.web.commons.utils; +import io.v.nutz.base.utils.Roles; +import io.v.nutz.sys.models.Sys_menu; import io.v.nutz.sys.models.Sys_user; +import io.v.nutz.sys.models.Sys_user_role; +import io.v.nutz.sys.services.SysUserService; +import io.v.nutz.sys.services.impl.SysUserServiceImpl; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.json.Json; +import org.nutz.lang.Lang; import org.nutz.lang.Strings; import org.nutz.mvc.Mvcs; import org.slf4j.Logger; @@ -13,11 +22,13 @@ import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; /** * Created by wizzer on 2017/1/16. */ -public class ShiroUtil { +public class ShiroUtil extends io.v.nutz.util.ShiroUtil { private static final String ROLE_NAMES_DELIMETER = ","; private static final String PERMISSION_NAMES_DELIMETER = ","; @@ -378,4 +389,31 @@ public class ShiroUtil { Subject subject = SecurityUtils.getSubject(); return (String) subject.getSession().getId(); } -} \ No newline at end of file + + + /** + * 获取当前用户信息 json + * + * @return + */ + public static String getUser() { + Sys_user user = (Sys_user) getPrincipal(); + return Json.toJson(user); + } + + /** + * 用户模块菜单 + * + * @return {@link String} + */ + public static String userModuleMenus() { + List menus = (List) getPrincipalProperty("moduleMenus"); + if (Lang.isEmpty(menus)) { + SysUserService sysUserService = Mvcs.getIoc().get(SysUserServiceImpl.class); + sysUserService.deleteCacheAndUpdate(getUserId()); + menus = (List) getPrincipalProperty("moduleMenus"); + } + return Json.toJson(menus); + } + +} diff --git a/src/main/java/io/v/nutz/web/controllers/platform/sys/SysMenuController.java b/src/main/java/io/v/nutz/web/controllers/platform/sys/SysMenuController.java index 80ee41d..50ba6d9 100644 --- a/src/main/java/io/v/nutz/web/controllers/platform/sys/SysMenuController.java +++ b/src/main/java/io/v/nutz/web/controllers/platform/sys/SysMenuController.java @@ -1,5 +1,7 @@ package io.v.nutz.web.controllers.platform.sys; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.result.Result; import io.v.nutz.sys.models.Sys_menu; import io.v.nutz.sys.services.SysMenuService; @@ -12,6 +14,7 @@ import org.apache.shiro.authz.annotation.RequiresAuthentication; 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.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.json.Json; @@ -53,7 +56,7 @@ public class SysMenuController { @At("/child") @Ok("json") @RequiresAuthentication - public Object child(@Param("pid") String pid, HttpServletRequest req) { + public Object child(@Param("pid") String pid, @Param(value = "menuName", required = false) String menuName, HttpServletRequest req) { List list = new ArrayList<>(); List treeList = new ArrayList<>(); Cnd cnd = Cnd.NEW(); @@ -62,6 +65,9 @@ public class SysMenuController { } else { cnd.and("parentId", "=", pid); } + if (StrUtil.isNotBlank(menuName)) { + cnd.where().andLike("name", menuName); + } cnd.asc("location").asc("path"); list = sysMenuService.query(cnd); for (Sys_menu menu : list) { @@ -69,8 +75,8 @@ public class SysMenuController { menu.setHasChildren(true); } NutMap map = Lang.obj2nutmap(menu); - map.addv("expanded", false); - map.addv("children", new ArrayList<>()); + map.setv("expanded", false); + map.setv("children", new ArrayList<>()); treeList.add(map); } return Result.success().addData(treeList); @@ -306,6 +312,10 @@ public class SysMenuController { if (list1 == null) { list1 = new ArrayList<>(); } + if (StrUtil.isNotBlank(unit.getParentId())) { + Sys_menu parentMenu = list.stream().filter(o -> o.getId().equals(unit.getParentId())).findFirst().orElse(null); + unit.setParentName(parentMenu.getName()); + } list1.add(unit); menuMap.put(unit.getParentId(), list1); } @@ -351,4 +361,46 @@ public class SysMenuController { return Result.error(); } } + + + @At + @ViReturn + @Ok("json") + public Object getDescription(String url) { + if (StrUtil.isBlank(url)) { + return null; + } + Sys_menu sysMenu = sysMenuService.fetch(Cnd.where("href", "=", url)); + return Lang.isEmpty(sysMenu) ? null : sysMenu.getDescription(); + } + + /** + * 模糊查询菜单选项 + * + * @param keyword 关键字 + * @return {@link Object} + */ + @At + @ViReturn + @Ok("json") + @RequiresAuthentication + public Object menuOption(String keyword) { + Sql menuSql = Sqls.create(""" + select menuId from sys_role_menu where roleId in ( + select roleId from sys_user_role where userId = @userId + ) + """).setParam("userId", ShiroUtil.getPrincipalProperty("id")); + + Cnd cnd = Cnd.NEW(); + cnd.andEX("name", "like", "%" + keyword + "%"); + cnd.andEX("hasChildren", "=", 0); + cnd.and("showit", "=", 1); + cnd.and("disabled", "=", 0); + cnd.and("type", "=", "menu"); + cnd.and("id", "in", menuSql); + cnd.asc("location"); + List list = sysMenuService.query(cnd); + return list; + } + } diff --git a/src/main/resources/docTemplate/WakesHome.docx b/src/main/resources/docTemplate/WakesHome.docx new file mode 100644 index 0000000..42c097f Binary files /dev/null and b/src/main/resources/docTemplate/WakesHome.docx differ diff --git a/src/main/resources/docTemplate/funds2.docx b/src/main/resources/docTemplate/funds2.docx new file mode 100644 index 0000000..a774d14 Binary files /dev/null and b/src/main/resources/docTemplate/funds2.docx differ diff --git a/src/main/resources/docTemplate/wakeshome/wakeshome.docx b/src/main/resources/docTemplate/wakeshome/wakeshome.docx new file mode 100644 index 0000000..92def59 Binary files /dev/null and b/src/main/resources/docTemplate/wakeshome/wakeshome.docx differ diff --git a/src/main/resources/static/assets/mobile/svg/psychology/wdpy.svg b/src/main/resources/static/assets/mobile/svg/psychology/wdpy.svg new file mode 100644 index 0000000..15c3a7f --- /dev/null +++ b/src/main/resources/static/assets/mobile/svg/psychology/wdpy.svg @@ -0,0 +1,5 @@ + + + + diff --git a/src/main/resources/static/assets/mobile/svg/psychology/zgpy.svg b/src/main/resources/static/assets/mobile/svg/psychology/zgpy.svg new file mode 100644 index 0000000..af1a394 --- /dev/null +++ b/src/main/resources/static/assets/mobile/svg/psychology/zgpy.svg @@ -0,0 +1,5 @@ + + + + diff --git a/src/main/resources/static/assets/platform/js/v.js b/src/main/resources/static/assets/platform/js/v.js index ca75c79..c7bbb43 100644 --- a/src/main/resources/static/assets/platform/js/v.js +++ b/src/main/resources/static/assets/platform/js/v.js @@ -48,8 +48,8 @@ const getDbt = async (jdhId) => { * 获取院级工会 * @returns {Promise<*>} */ -const getUnions = async (delegationId) => { - const {data} = await $.get("/platform/vi/common/unions", {delegationId}) +const getUnions = async (delegationId = null, isPermission = false) => { + const {data} = await $.get("/platform/vi/common/unions", {delegationId, isPermission}) return data } diff --git a/src/main/resources/static/assets/platform/module/basics/basics.js b/src/main/resources/static/assets/platform/module/basics/basics.js index 631e86d..be22517 100644 --- a/src/main/resources/static/assets/platform/module/basics/basics.js +++ b/src/main/resources/static/assets/platform/module/basics/basics.js @@ -55,6 +55,10 @@ const FILE_PREVIEW_ADDRESS = '/file_server/preview' const FILE_DOWNLOAD_ADDRESS = '/file_server/download' const FILE_STREAM_PREVIEW_ADDRESS = '/file_server/fileStreamPreview' +const CREATE_PREVIEW_URL = (val) => { + return FILE_STREAM_PREVIEW_ADDRESS + "?id=" + val +} + const preview = async (filename, id) => { const suffix = filename.substring(filename.lastIndexOf('.') + 1) @@ -1955,4 +1959,4 @@ const loc = () => { const clone = (obj) => { return JSON.parse(JSON.stringify(obj)) -} \ No newline at end of file +} diff --git a/src/main/resources/static/components/activityBx/ActivityBxInfo.vue b/src/main/resources/static/components/activityBx/ActivityBxInfo.vue index 63160fc..144e7b1 100644 --- a/src/main/resources/static/components/activityBx/ActivityBxInfo.vue +++ b/src/main/resources/static/components/activityBx/ActivityBxInfo.vue @@ -19,8 +19,48 @@ - - {{ viewData.activity_time }} + + {{ viewData.mobile }} + + + + + + {{ + viewData.activity_type === 40002 ? "分工会活动" : viewData.activity_type === 40003 ? + "协会(社团)活动" : + "校工会活动" + }} + + + + + + {{ viewData.activity_name }} + + + + + + {{ viewData.absName }}({{ viewData.projectTypeCode }}) + + + + + + {{ viewData.fundsUnitName }} + + + + + + {{ viewData.startPlannedDate }}-{{ viewData.endPlannedDate }} + + + + + + {{ viewData.venue }} @@ -31,28 +71,22 @@ - - {{ viewData.activity_money }} - - - - - - {{ viewData.activity_card_number }} + + {{ viewData.funds_money }} - - {{ viewData.venue }} - - - - - +
+ + + +
+
+
@@ -66,84 +100,74 @@ - - - - + + - - - - + + 暂无 - - - - - 暂无 - - - + - + + --> @@ -196,7 +220,10 @@ -
{{ viewData.accounting_idea ? viewData.accounting_idea : '暂无' }}
+
{{ + viewData.accounting_idea ? viewData.accounting_idea : '暂无' + }} +
-
{{ viewData.confirm_trade_idea ? viewData.confirm_trade_idea : '暂无' }}
+
+ {{ viewData.confirm_trade_idea ? viewData.confirm_trade_idea : '暂无' }} +
-
{{ viewData.union_chairman_idea ? viewData.union_chairman_idea : '暂无' }}
+
+ {{ viewData.union_chairman_idea ? viewData.union_chairman_idea : '暂无' }} +
-
{{ viewData.union_chairman_idea ? viewData.union_chairman_idea : '暂无' }}
+
+ {{ viewData.union_chairman_idea ? viewData.union_chairman_idea : '暂无' }} +
\ No newline at end of file + diff --git a/src/main/resources/static/components/hd/hdwmInfo.vue b/src/main/resources/static/components/hd/hdwmInfo.vue new file mode 100644 index 0000000..a58d63e --- /dev/null +++ b/src/main/resources/static/components/hd/hdwmInfo.vue @@ -0,0 +1,481 @@ + + + + + + + diff --git a/src/main/resources/static/components/plugins/BorderTable.vue b/src/main/resources/static/components/plugins/BorderTable.vue new file mode 100644 index 0000000..142213c --- /dev/null +++ b/src/main/resources/static/components/plugins/BorderTable.vue @@ -0,0 +1,81 @@ +/** +*Desc: +*Create by: jug +*Create time:2023/11/10/11:07 +*/ + + + + + diff --git a/src/main/resources/static/components/plugins/ImageUpload.vue b/src/main/resources/static/components/plugins/ImageUpload.vue new file mode 100644 index 0000000..9da8b47 --- /dev/null +++ b/src/main/resources/static/components/plugins/ImageUpload.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/main/resources/static/components/plugins/textEditor.vue b/src/main/resources/static/components/plugins/textEditor.vue new file mode 100644 index 0000000..81f8e6c --- /dev/null +++ b/src/main/resources/static/components/plugins/textEditor.vue @@ -0,0 +1,229 @@ +/** +*Desc: +*Create by: jug +*Create time:2024/1/24/16:40 +*/ + + + + + + + + diff --git a/src/main/resources/static/components/wakeshome/declaration/WakesHomeInfoApply.vue b/src/main/resources/static/components/wakeshome/declaration/WakesHomeInfoApply.vue new file mode 100644 index 0000000..2b23de1 --- /dev/null +++ b/src/main/resources/static/components/wakeshome/declaration/WakesHomeInfoApply.vue @@ -0,0 +1,134 @@ + + + + diff --git a/src/main/resources/static/components/wakeshome/info/WakesHomeInfo.vue b/src/main/resources/static/components/wakeshome/info/WakesHomeInfo.vue new file mode 100644 index 0000000..42799b1 --- /dev/null +++ b/src/main/resources/static/components/wakeshome/info/WakesHomeInfo.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/main/resources/static/components/wakeshome/review/ReviewResult.vue b/src/main/resources/static/components/wakeshome/review/ReviewResult.vue new file mode 100644 index 0000000..57b57e9 --- /dev/null +++ b/src/main/resources/static/components/wakeshome/review/ReviewResult.vue @@ -0,0 +1,120 @@ + + + diff --git a/src/main/resources/static/components/wakeshome/review/UnionCommentZb.vue b/src/main/resources/static/components/wakeshome/review/UnionCommentZb.vue new file mode 100644 index 0000000..adc638b --- /dev/null +++ b/src/main/resources/static/components/wakeshome/review/UnionCommentZb.vue @@ -0,0 +1,508 @@ + + + + + + diff --git a/src/main/resources/views/layouts/platform.html b/src/main/resources/views/layouts/platform.html index 8b0e0ae..4db11aa 100644 --- a/src/main/resources/views/layouts/platform.html +++ b/src/main/resources/views/layouts/platform.html @@ -130,6 +130,10 @@ Vue.component('guava', httpVueLoader('/components/plugins/Guava.vue')) Vue.component('sign', httpVueLoader('/components/sign/sign.vue?v=2.0.0')) Vue.component('file-upload', httpVueLoader('/components/plugins/FileUpload.vue')) + Vue.component('text-editor', httpVueLoader('/components/plugins/textEditor.vue')) + Vue.component('border-table', httpVueLoader('/components/plugins/BorderTable.vue')) + Vue.component('image-upload', httpVueLoader('/components/plugins/ImageUpload.vue')) + + diff --git a/src/main/resources/views/mobile/wakeshome/review/commentator.html b/src/main/resources/views/mobile/wakeshome/review/commentator.html new file mode 100644 index 0000000..6e4c7a5 --- /dev/null +++ b/src/main/resources/views/mobile/wakeshome/review/commentator.html @@ -0,0 +1,372 @@ + + +
+ + +
+ + + +
+
+ + +
+
+
+ {{item.contentNumber}}、{{item.inspection}} +
+ +
标准分:{{item.score}}
+
+ +
+
+
+ +
+
+
+
+ + + + +
+
+ +
+ +
+ + + +
+ +
+
+
+
{{item.contentNumber}}、{{item.inspection}} +
+ + + +
+
+
+
+ +
+
+
+ +
+ +
+ +
+ + 查看测评结果 + 提交 + +
+ +
+ + diff --git a/src/main/resources/views/mobile/wakeshome/review/mine.html b/src/main/resources/views/mobile/wakeshome/review/mine.html new file mode 100644 index 0000000..8546824 --- /dev/null +++ b/src/main/resources/views/mobile/wakeshome/review/mine.html @@ -0,0 +1,271 @@ + + +
+ +
+ +
+ + + +
+ +
+ +
+
+ + + + + +
+ + + +
+
+ + +
+
+
+ {{item.contentNumber}}、{{item.inspection}} +
+ +
标准分:{{item.score}}
+
+ + + +
+
+
+
+
+ +
+
+ +
+
+
+
+
+ {{item.contentNumber}}、{{item.inspection}} +
+ + + +
+
+
+
+ + +
+
+
+ +
+
+
+ +
+ + 民主测评 + 我的测评 + +
+ +
+ + diff --git a/src/main/resources/views/mobile/wmhd/applyList.html b/src/main/resources/views/mobile/wmhd/applyList.html index dd7d306..c07bbda 100644 --- a/src/main/resources/views/mobile/wmhd/applyList.html +++ b/src/main/resources/views/mobile/wmhd/applyList.html @@ -10,16 +10,17 @@ layout("/mobile/platform.html"){ left-arrow placeholder fixed - @click-left="history.back()" + @click-left="history.go(-1)" >
- +
-
+
{{o.hdname}} - {{o.cjr}} + {{o.username}} + {{o.hdflag?'已开启':'未开启'}} {{o.hdcjsj}} {{o.hdkssj}} {{o.hdjssj}} @@ -43,6 +45,14 @@ layout("/mobile/platform.html"){ >
+
+ + 教工作品征集 + 我的教工作品 + + +
+
+ + + \ No newline at end of file diff --git a/src/main/resources/views/mobile/wmhd/schoolAudit.html b/src/main/resources/views/mobile/wmhd/schoolAudit.html new file mode 100644 index 0000000..cd20ab5 --- /dev/null +++ b/src/main/resources/views/mobile/wmhd/schoolAudit.html @@ -0,0 +1,124 @@ + + + +
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/src/main/resources/views/mobile/wmhd/statistics.html b/src/main/resources/views/mobile/wmhd/statistics.html new file mode 100644 index 0000000..d0814a4 --- /dev/null +++ b/src/main/resources/views/mobile/wmhd/statistics.html @@ -0,0 +1,321 @@ + + + + +
+ + + + +
+ + + + + +
+ +
+ + +
+ + {{o.sbrname}} + {{o.loginname}} + {{o.dwname}} + {{o.ghname}} + {{o.hdlbname}} + {{o.zplbname}} + + {{o.hdsbsj}} + {{o.dz_znum}}次 + + + + + + +
+ + 已点赞 + +
+ + 点赞 + +
+ + 查看 + + +
+
+
+
+ +
+ + + + +
+ + + + + + + + + + +
+ + 教工作品征集 + 我的教工作品 + + 点赞教工作品 + + +
+ + +
+ + + + + diff --git a/src/main/resources/views/mobile/wmhd/unionAudit.html b/src/main/resources/views/mobile/wmhd/unionAudit.html new file mode 100644 index 0000000..950ead3 --- /dev/null +++ b/src/main/resources/views/mobile/wmhd/unionAudit.html @@ -0,0 +1,125 @@ + + + +
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/src/main/resources/views/mobile/wmhd/userList.html b/src/main/resources/views/mobile/wmhd/userList.html index c66a038..e38e66a 100644 --- a/src/main/resources/views/mobile/wmhd/userList.html +++ b/src/main/resources/views/mobile/wmhd/userList.html @@ -15,44 +15,53 @@ layout("/mobile/platform.html"){
- +
-
+
左滑可删除作品。 + @load="onLoad" + v-model="mLoading"> -
- +
+ - - {{o.username}} + + {{o.sbrname}} {{o.loginname}} {{o.dwname}} {{o.ghname}} {{o.hdlbname}} - {{o.zplbname}} + {{o.zplbname}} + {{o.hdsbsj}} +
@@ -60,11 +69,30 @@ layout("/mobile/platform.html"){ + + +
+ + + + + + +
+ + 教工作品征集 + 我的教工作品 + +
@@ -75,6 +103,8 @@ layout("/mobile/platform.html"){ mixins: [mobileMixins], data() { return { + viewShow: false, + tarBarActive: 1, yearOption: [], pageForm: { year: '', @@ -82,7 +112,9 @@ layout("/mobile/platform.html"){ } } }, - + components: { + 'mobile-wmhd-info': httpVueLoader('/components/mobile/wmhd/info.vue?v=' + new Date().getTime()), + }, methods: { openEdit(id, hdid) { window.location.href = '/platform/staffActivities?client=mobile&id=' + hdid + '&zpid=' + id @@ -108,7 +140,7 @@ layout("/mobile/platform.html"){ }, async onLoad() { this.mLoading = true - $.post('/platform/hd/wmhd/pageData', this.pageForm).then(res => { + $.post('/platform/hd/jzghd/sczp/pageData', this.pageForm).then(res => { if (res.code === 0) { this.tableData = this.tableData.concat(res.data.list) if (this.tableData.length === res.data.totalCount) { @@ -121,7 +153,10 @@ layout("/mobile/platform.html"){ }) }, openView(o) { - window.location.href = '/mobile/wmhd/list/view?id=' + o.id + this.viewShow = true + setTimeout(() => { + this.$refs.minfo.getInfo(o.id) + }, 100) } }, async created() { @@ -136,4 +171,4 @@ layout("/mobile/platform.html"){ \ No newline at end of file +#--> diff --git a/src/main/resources/views/platform/hd/ca/hdMange.html b/src/main/resources/views/platform/hd/ca/hdMange.html index fc816e4..f7d154f 100644 --- a/src/main/resources/views/platform/hd/ca/hdMange.html +++ b/src/main/resources/views/platform/hd/ca/hdMange.html @@ -5,10 +5,6 @@ layout("/layouts/platform.html"){ 三八妇女活动管理 --> -
@@ -187,10 +182,10 @@ layout("/layouts/platform.html"){
+ v-model="pageForm.year" + value-format="yyyy">
@@ -199,98 +194,99 @@ layout("/layouts/platform.html"){
- +
- 创建活动 + + 创建活动 +
- + + style="width: 100%"> + header-align="center" + label="序号" + type="index"> + prop="hdname" + show-overflow-tooltip="true"> + prop="cjr"> + prop="hdcjsj"> + label="活动时间" + prop="time" + width="300px"> + label="状态" + prop="hdflag"> + label="操作" + width="400"> - - - - + @@ -299,481 +295,224 @@ layout("/layouts/platform.html"){
{{formData.hdname}}
-
- 刷新 + 刷新
- - - - - - - - - - - - - - - - - - - - - + + - + + start-placeholder="开始时间" + style="width: 100%" + type="datetimerange" + v-model="formData.time" + value-format="yyyy-MM-dd HH:mm:ss"> - - - - - - - - - - - + + - + - + - + - 作品类别  + 作品类别  - + - + - + - + +
+
+ + + +
+
+ 设置 + +
+
+
+ + + + 不推送 + 推送列表 + 推送大图 + + + + + 不启用 + 启用 + + + + +
- +
- +
- +
- +
- +
- -
    -
  • - - +
      +
    • + +
    - - 保 存 - 确 定 + + 保 存 + 确 定 - - - - -
    -
    {{formData.hdname}}
    - -
    - 刷新 - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 作品类别  - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - - - -
      -
    • - - -
    • -
    -
    -
    -
    -
    - - - 取 消 - 保 存 - 确 定 - -
    - + + - -
    -
    -
    + + + - - 关 闭 - 分 享 - 下 载 - -
- \ No newline at end of file +#--> diff --git a/src/main/resources/views/platform/hd/ca/hjxxyl.html b/src/main/resources/views/platform/hd/ca/hjxxyl.html index 75bd57f..ad65542 100644 --- a/src/main/resources/views/platform/hd/ca/hjxxyl.html +++ b/src/main/resources/views/platform/hd/ca/hjxxyl.html @@ -4,33 +4,34 @@ layout("/layouts/platform.html"){
+
- -
-
- + - - - - - - +
- - + + @@ -40,63 +41,70 @@ layout("/layouts/platform.html"){
- - + v-if="hasSuperAdminOrXghRole" v-model="pageForm.union"> + - - + +
- +
-
- +
+ 导出获奖人员名单 - + 导出分工会获奖信息
- + - + - - - + - - + :page-sizes="[10, 20, 30, 50]" + :total="pageForm.totalCount" + @current-change="pageNumberChange" + @size-change="pageSizeChange" + layout="total, sizes, prev, pager, next, jumper"> @@ -107,83 +115,31 @@ layout("/layouts/platform.html"){ \ No newline at end of file +#--> diff --git a/src/main/resources/views/platform/hd/ca/mobile/childrenActivities.html b/src/main/resources/views/platform/hd/ca/mobile/childrenActivities.html index e35814d..98c54e9 100644 --- a/src/main/resources/views/platform/hd/ca/mobile/childrenActivities.html +++ b/src/main/resources/views/platform/hd/ca/mobile/childrenActivities.html @@ -88,19 +88,28 @@ .van-swipe-cell__wrapper { border: none; } + + .van-nav-bar__content { + background-color: #081776; + } + + .van-nav-bar__title, .van-icon-arrow-left::before { + color: white; + }
- - + + @@ -311,7 +320,7 @@ (如同时参加以下多个活动,或有多个主题,请分别提交)

- +
- + - - - +
- {{video.file.name}} + {{video.filename ? video.filename : video.file.name }}
- - - + { + this.showMsg = true + this.showPlan = true + this.percent = 0 + this.msg = '' + + let formData1 = {} + let formData2 = new FormData(); + if (!this.isNull(this.formData.id)) { + this.$set(formData1, "id", getQueryVariable("zpid")) + this.$set(formData1, "hdid", getQueryVariable("id")) + + this.$set(formData1, "sbr", this.formData.userid) + this.$set(formData1, "mobile", this.formData.mobile) + this.$set(formData1, "hdlb", this.boxData.lbs[i].lid) + this.$set(formData1, "znxm", this.formData.znxm) + this.$set(formData1, "znnl", this.formData.znnl) + this.$set(formData1, "znxb", this.formData.znxb) + this.$set(formData1, "zngx", this.formData.zngx) + + this.$set(formData1, "zplb", this.fd[i].zplb) + this.$set(formData1, "zpzt", this.fd[i].zpzt) + this.$set(formData1, "zpms", this.fd[i].zpms) + this.$set(formData1, "sbsj", moment().format('YYYY-MM-DD HH:mm:ss')) - var formdata = new FormData(); - formdata.append("hdid", getQueryVariable("id")) + } else { + formData2.append("hdid", getQueryVariable("id")) - formdata.append("sbr", vue.isNull(vue.formData.userid) ? '' : vue.formData.userid); - formdata.append("mobile", vue.isNull(vue.formData.mobile) ? '' : vue.formData.mobile); - formdata.append("hdlb", vue.isNull(vue.boxData.lbs[i].lid) ? '' : vue.boxData.lbs[i].lid) + formData2.append("sbr", this.isNull(this.formData.userid) ? '' : this.formData.userid); + formData2.append("mobile", vue.isNull(vue.formData.mobile) ? '' : this.formData.mobile); + formData2.append("hdlb", vue.isNull(vue.boxData.lbs[i].lid) ? '' : this.boxData.lbs[i].lid) - formdata.append("znxm", vue.isNull(vue.formData.znxm) ? '' : vue.formData.znxm); - formdata.append("znnl", vue.isNull(vue.formData.znnl) ? '' : vue.formData.znnl); - formdata.append("znxb", vue.isNull(vue.formData.znxb) ? '' : vue.formData.znxb); - formdata.append("zngx", vue.isNull(vue.formData.zngx) ? '' : vue.formData.zngx); + formData2.append("znxm", this.isNull(this.formData.znxm) ? '' : this.formData.znxm); + formData2.append("znnl", this.isNull(this.formData.znnl) ? '' : this.formData.znnl); + formData2.append("znxb", this.isNull(this.formData.znxb) ? '' : this.formData.znxb); + formData2.append("zngx", this.isNull(this.formData.zngx) ? '' : this.formData.zngx); - formdata.append("zplb", vue.isNull(vue.fd[i].zplb) ? '' : vue.fd[i].zplb); - formdata.append("zpzt", vue.isNull(vue.fd[i].zpzt) ? '' : vue.fd[i].zpzt); - formdata.append("zpms", vue.isNull(vue.fd[i].zpms) ? '' : vue.fd[i].zpms); - formdata.append("sbsj", moment().format('YYYY-MM-DD HH:mm:ss')); + formData2.append("zplb", this.isNull(this.fd[i].zplb) ? '' : this.fd[i].zplb); + formData2.append("zpzt", this.isNull(this.fd[i].zpzt) ? '' : this.fd[i].zpzt); + formData2.append("zpms", this.isNull(this.fd[i].zpms) ? '' : this.fd[i].zpms); + formData2.append("sbsj", moment().format('YYYY-MM-DD HH:mm:ss')); - vue.fd[i].imgList.forEach(function (val) { - formdata.append("files", val.file, vue.isNull(val.ms) ? val.file.name : val.ms + getSuffix(val.file.name)); - }); - vue.fd[i].videoList.forEach(function (val) { - formdata.append("files", val.file, vue.isNull(val.ms) ? val.file.name : val.ms + getSuffix(val.file.name)); - }); - - $.ajax({ - url: "/childrenActivities/doSubmit", - type: "post", - data: formdata, - processData: false, - contentType: false, - xhr: xhrOnProgress(function (e) { - if (e.total == 0) { - vue.percent = 0 - } else { - vue.percent = ((e.loaded / e.total) * 100).toFixed(0);//文件上传百分比 - } - - }), - success: function (data) { - if (data.code === 0) { - - vue.formData.znxm = '' - vue.formData.znnl = '' - vue.formData.znxb = '' - vue.formData.zngx = '' - - vue.fd[i].zplb = '' - vue.fd[i].zplb_name = '' - vue.fd[i].zpzt = '' - vue.fd[i].zpms = '' - vue.fd[i].sbsj = '' - vue.fd[i].imgList = [] - vue.fd[i].videoList = [] - vue.fd[i].audioList = [] - Cookies.remove('ca_formData'); - - - vue.msg = '

我们已收到您的作品!
非常感谢您的支持!

' - vue.flag = true - } else { - - vue.msg = '

非常抱歉对您造成的不便!
请联系系统管理员进行修复!

' - vue.flag = false - } - vue.showPlan = false - }, - error: function (data) { - vue.msg = '

非常抱歉对您造成的不便!
请联系系统管理员进行修复!

' - vue.flag = false - vue.showPlan = false + vue.fd[i].imgList.forEach(function (val) { + formData2.append("files", val.file, vue.isNull(val.ms) ? val.file.name : val.ms + getSuffix(val.file.name)); + }); + vue.fd[i].videoList.forEach(function (val) { + formData2.append("files", val.file, vue.isNull(val.ms) ? val.file.name : val.ms + getSuffix(val.file.name)); + }); } - }); - }, 500) - }).catch(function (reason) { + if (!this.isNull(this.formData.id)) { + formData2.append("data", JSON.stringify(formData1)); + formData2.append("readytodelfile", JSON.stringify(this.readytodelfile)); + this.fd[i].imgList.forEach(val => { + formData2.append("file", val.file); + }); + this.fd[i].videoList.forEach(val => { + formData2.append("file", val.file); + }); + $.ajax({ + url: "/platform/hd/childhd/sczp/doEdit", + type: "post", + data: formData2, + processData: false, + contentType: false, + xhr: xhrOnProgress(function (e) { + if (e.total == 0) { + vue.percent = 0 + } else { + vue.percent = ((e.loaded / e.total) * 100).toFixed(0);//文件上传百分比 + } + + }), + success: function (data) { + if (data.code === 0) { + + vue.formData.znxm = '' + vue.formData.znnl = '' + vue.formData.znxb = '' + vue.formData.zngx = '' + + vue.fd[i].zplb = '' + vue.fd[i].zplb_name = '' + vue.fd[i].zpzt = '' + vue.fd[i].zpms = '' + vue.fd[i].sbsj = '' + vue.fd[i].imgList = [] + vue.fd[i].videoList = [] + vue.fd[i].audioList = [] + Cookies.remove('ca_formData'); + + + vue.msg = '

我们已收到您的作品!
非常感谢您的支持!

' + vue.flag = true + } else { + + vue.msg = '

非常抱歉对您造成的不便!
请联系系统管理员进行修复!

' + vue.flag = false + } + vue.showPlan = false + window.history.back() + }, + error: function (data) { + vue.msg = '

非常抱歉对您造成的不便!
请联系系统管理员进行修复!

' + vue.flag = false + vue.showPlan = false + } + }); + + } else { + $.ajax({ + url: "/childrenActivities/doSubmit", + type: "post", + data: formData2, + processData: false, + contentType: false, + xhr: xhrOnProgress(function (e) { + if (e.total == 0) { + vue.percent = 0 + } else { + vue.percent = ((e.loaded / e.total) * 100).toFixed(0);//文件上传百分比 + } + + }), + success: function (data) { + if (data.code === 0) { + + vue.formData.znxm = '' + vue.formData.znnl = '' + vue.formData.znxb = '' + vue.formData.zngx = '' + + vue.fd[i].zplb = '' + vue.fd[i].zplb_name = '' + vue.fd[i].zpzt = '' + vue.fd[i].zpms = '' + vue.fd[i].sbsj = '' + vue.fd[i].imgList = [] + vue.fd[i].videoList = [] + vue.fd[i].audioList = [] + Cookies.remove('ca_formData'); + + + vue.msg = '

我们已收到您的作品!
非常感谢您的支持!

' + vue.flag = true + } else { + + vue.msg = '

非常抱歉对您造成的不便!
请联系系统管理员进行修复!

' + vue.flag = false + } + vue.showPlan = false + }, + error: function (data) { + vue.msg = '

非常抱歉对您造成的不便!
请联系系统管理员进行修复!

' + vue.flag = false + vue.showPlan = false + } + }); + } + + + } + , + 500 + ) + } + - }); }, // 返回布尔值 beforeReadImg: function (file) { @@ -684,11 +783,14 @@ return true; }, }, - created() { - GetQueryString("client") == "mobile" ? this.leftArrow = true : this.leftArrow = false + async created() { const loginname = "${@shiro.getPrincipalProperty('loginname')}" this.$set(this.formData, "loginname", loginname) this.doInput(loginname) + const zpid = GetQueryString("zpid") + GetQueryString("client") == "mobile" ? this.leftArrow = true : this.leftArrow = false + this.$set(this.formData, "loginname", loginname) + this.doInput(loginname) var self = this if (window.innerWidth > 800) { self.$notify({type: 'warning', message: '当前窗口宽度过大!部分区域显示会出现大小偏差'}); @@ -725,15 +827,36 @@ }) } - if (Cookies.get("ca_formData") != undefined) { - self.formData = JSON.parse(Cookies.get("ca_formData")) - Cookies.remove('ca_formData'); + if (!this.isNull(zpid)) { + const {data, code, msg} = await $.get("/platform/hd/wmhd/findOneById", {id: zpid}) + const refs = await $.get("/mobile/cahd/list/findOne", {id: zpid}) + this.$set(this.formData, "id", refs[0].id) + this.$set(this.formData, "hdid", refs[0].id) + this.$set(this.formData, "userid", refs[0].sbr) + this.$set(this.formData, "mobile", refs[0].mobile) + this.$set(this.boxData.lbs[this.formData.hdlb_i], "lid", refs[0].hdlb) + this.$set(this.formData, "znxm", refs[0].znxm) + this.$set(this.formData, "znnl", refs[0].znnl) + this.$set(this.formData, "znxb", refs[0].znxb) + this.$set(this.formData, "zngx", refs[0].zngx) + this.$set(this.fd[this.formData.hdlb_i], "zplb", refs[0].zplb) + this.$set(this.fd[this.formData.hdlb_i], "zpzt", refs[0].zpzt) + this.$set(this.fd[this.formData.hdlb_i], "zpms", refs[0].zpms) + this.$set(this.fd[this.formData.hdlb_i], "zplb_name", refs[0].zname) + data.forEach((v, i) => { + v.filename = v.filename + v.fjurl = v.filepath + v.url = FILE_DOMAIN + v.filepath + v.content = FILE_DOMAIN + v.filepath + const filetype = v.filename.substring(v.filename.lastIndexOf(".") + 1) + const aa = this.audiotype.concat(this.videotype) + if (this.imgtype.indexOf(filetype) > -1) { + this.fd[this.formData.hdlb_i].imgList.push(v) + } else if (aa.indexOf(filetype) > -1) { + this.fd[this.formData.hdlb_i].videoList.push(v); + } + }) } - - setInterval(function () { - Cookies.set("ca_formData", JSON.stringify(self.formData)) - }, 1000) - } }) diff --git a/src/main/resources/views/platform/hd/ca/mobileBox.html b/src/main/resources/views/platform/hd/ca/mobileBox.html index 67a4f51..f62ca7a 100644 --- a/src/main/resources/views/platform/hd/ca/mobileBox.html +++ b/src/main/resources/views/platform/hd/ca/mobileBox.html @@ -13,8 +13,8 @@ - - + + @@ -93,13 +93,13 @@
- - + + diff --git a/src/main/resources/views/platform/hd/ca/zpMange.html b/src/main/resources/views/platform/hd/ca/zpMange.html index aea3491..916884a 100644 --- a/src/main/resources/views/platform/hd/ca/zpMange.html +++ b/src/main/resources/views/platform/hd/ca/zpMange.html @@ -204,9 +204,6 @@ layout("/layouts/platform.html"){ - - - - + - - + + - + @@ -239,7 +239,8 @@ layout("/layouts/platform.html"){ - @@ -250,7 +251,8 @@ layout("/layouts/platform.html"){ - - - + - + - - 上传作品 - + + + + - + + + @@ -293,9 +304,11 @@ layout("/layouts/platform.html"){ show-overflow-tooltip sortable> - - @@ -303,7 +316,8 @@ layout("/layouts/platform.html"){ show-overflow-tooltip sortable> - @@ -311,8 +325,9 @@ layout("/layouts/platform.html"){ show-overflow-tooltip sortable> + + + - - - 基本信息 -
- - - - - - -
-
- - - - - - -
- 子女信息 -
- - - - - - -
-
- - 男 - 女 - - - - - - - - -
- 活动信息 -
- - - - - - - - - - -
- - - - - - - - - - - - 作品信息 - - - - - - - - 点击上传 - - -
- - 取 消 - 确 定 - -
- - - 基本信息 -
- - - - - - -
-
- - - - - - -
- 子女信息 -
- - - - - - -
-
- - 男 - 女 - - - - - - - - -
- 活动信息 -
- - - - - - - - - - -
- - - - - - - - - - - - 作品信息 - - - - - - - - 点击上传 - - -
- - 取 消 - 确 定 - -
@@ -677,401 +710,437 @@ layout("/layouts/platform.html"){
\ No newline at end of file +#--> diff --git a/src/main/resources/views/platform/hd/ca/zpxx.html b/src/main/resources/views/platform/hd/ca/zpxx.html index fc246e2..df4b460 100644 --- a/src/main/resources/views/platform/hd/ca/zpxx.html +++ b/src/main/resources/views/platform/hd/ca/zpxx.html @@ -310,148 +310,148 @@ layout("/layouts/platform.html"){ - + + + +
+ +
+
+
+ 没有文档。 +
+ + + + + -->