This commit is contained in:
zhaoxinyu
2024-08-26 14:28:02 +08:00
170 changed files with 17605 additions and 7509 deletions
+14
View File
@@ -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
}
+90 -68
View File
@@ -18,7 +18,7 @@
<easy-captcha.version>1.6.2</easy-captcha.version> <easy-captcha.version>1.6.2</easy-captcha.version>
<commons-lang3.version>3.8.1</commons-lang3.version> <commons-lang3.version>3.8.1</commons-lang3.version>
<emoji-java.veision>4.0.0</emoji-java.veision> <emoji-java.veision>4.0.0</emoji-java.veision>
<jsoup.veision>1.11.2</jsoup.veision> <jsoup.veision>1.12.1</jsoup.veision>
<pinyin4j.veision>2.5.1</pinyin4j.veision> <pinyin4j.veision>2.5.1</pinyin4j.veision>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<tencentcloud-sdk-java.version>4.0.11</tencentcloud-sdk-java.version> <tencentcloud-sdk-java.version>4.0.11</tencentcloud-sdk-java.version>
@@ -45,13 +45,11 @@
<artifactId>asm-util</artifactId> <artifactId>asm-util</artifactId>
<version>7.3.1</version> <version>7.3.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>asm</groupId> <groupId>asm</groupId>
<artifactId>asm-all</artifactId> <artifactId>asm-all</artifactId>
<version>2.1</version> <version>2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjdk.nashorn</groupId> <groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId> <artifactId>nashorn-core</artifactId>
@@ -73,47 +71,47 @@
<version>0.3.17</version> <version>0.3.17</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.mail</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>mail</artifactId> <artifactId>kotlin-stdlib</artifactId>
<version>1.4.7</version> <version>1.4.32</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<artifactId>xmlbeans</artifactId>
<groupId>org.apache.xmlbeans</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.artofsolving</groupId> <groupId>com.artofsolving</groupId>
<artifactId>jodconverter</artifactId> <artifactId>jodconverter</artifactId>
<version>2.2.2</version> <version>2.2.2</version>
<exclusions>
<exclusion>
<artifactId>jurt</artifactId>
<groupId>org.openoffice</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.annotation</groupId> <groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId> <artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version> <version>1.3.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.codehaus.xfire</groupId>
<artifactId>xfire-all</artifactId>
<version>1.2.6</version>
<exclusions>
<exclusion>
<artifactId>spring</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>xfire-spring</artifactId>
<groupId>org.codehaus.xfire</groupId>
</exclusion>
<exclusion>
<artifactId>xercesImpl</artifactId>
<groupId>xerces</groupId>
</exclusion>
<exclusion>
<artifactId>stax-api</artifactId>
<groupId>stax</groupId>
</exclusion>
<exclusion>
<artifactId>xfire-xmlbeans</artifactId>
<groupId>org.codehaus.xfire</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
@@ -170,13 +168,6 @@
<artifactId>thumbnailator</artifactId> <artifactId>thumbnailator</artifactId>
<version>0.4.8</version> <version>0.4.8</version>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>ooxml-schemas</artifactId>-->
<!-- <version>1.4</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>io.v</groupId> <groupId>io.v</groupId>
<artifactId>vi-nutz</artifactId> <artifactId>vi-nutz</artifactId>
@@ -202,6 +193,18 @@
<artifactId>juh</artifactId> <artifactId>juh</artifactId>
<groupId>org.openoffice</groupId> <groupId>org.openoffice</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion> <exclusion>
<artifactId>ridl</artifactId> <artifactId>ridl</artifactId>
<groupId>org.openoffice</groupId> <groupId>org.openoffice</groupId>
@@ -214,22 +217,6 @@
<artifactId>unoil</artifactId> <artifactId>unoil</artifactId>
<groupId>org.openoffice</groupId> <groupId>org.openoffice</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>xmlbeans</artifactId>
<groupId>org.apache.xmlbeans</groupId>
</exclusion>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
<exclusion>
<artifactId>spring-aop</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@@ -251,11 +238,21 @@
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>4.8.0</version> <version>4.8.0</version>
<exclusions>
<exclusion>
<artifactId>kotlin-stdlib</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
</exclusion>
<exclusion>
<artifactId>kotlin-stdlib-common</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.13</version> <version>4.3.5</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
@@ -277,10 +274,6 @@
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
@@ -293,6 +286,10 @@
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>okhttp</artifactId>
<groupId>com.squareup.okhttp</groupId>
</exclusion>
<exclusion> <exclusion>
<artifactId>okio</artifactId> <artifactId>okio</artifactId>
<groupId>com.squareup.okio</groupId> <groupId>com.squareup.okio</groupId>
@@ -322,7 +319,7 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- html -->
<dependency> <dependency>
<groupId>org.jsoup</groupId> <groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId> <artifactId>jsoup</artifactId>
@@ -362,7 +359,32 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<artifactId>xmlbeans</artifactId>
<groupId>org.apache.xmlbeans</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.nutz</groupId> <groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-test-junit4</artifactId> <artifactId>nutzboot-starter-test-junit4</artifactId>
@@ -401,11 +423,11 @@
<version>${easy-captcha.version}</version> <version>${easy-captcha.version}</version>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>commons-validator</groupId> <!-- <groupId>org.springframework</groupId>-->
<artifactId>commons-validator</artifactId> <!-- <artifactId>spring-core</artifactId>-->
<version>1.7</version> <!-- <version>4.3.21.RELEASE</version>-->
</dependency> <!-- </dependency>-->
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
@@ -4,9 +4,10 @@ package io.v.nutz.hd.controller.ca;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService; import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination; 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.FileService;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.base.utils.Vi; 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.models.Hd_ca_sbxx;
import io.v.nutz.hd.services.*; import io.v.nutz.hd.services.*;
import io.v.nutz.modules.models.PageForm; 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.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json; 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.TempFile;
import org.nutz.mvc.upload.UploadAdaptor; 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.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@IocBean @IocBean
@At("/platform/hd/childhd/sczp") @At("/platform/hd/childhd/sczp")
@@ -65,6 +58,9 @@ public class HdChildAddZpController {
@Inject @Inject
private BaseService baseService; private BaseService baseService;
@Inject
private FileService fileService;
@At("") @At("")
@Ok("beetl:/platform/hd/ca/zpMange.html") @Ok("beetl:/platform/hd/ca/zpMange.html")
@RequiresPermissions("hd.child.sczp") @RequiresPermissions("hd.child.sczp")
@@ -76,21 +72,13 @@ public class HdChildAddZpController {
* 获取当前人的工会name * 获取当前人的工会name
*/ */
@At @At
@RequiresPermissions("hd.child.sczp")
public String getGhname() { public String getGhname() {
Sql sql = Sqls.create("SELECT\n" + return Optional.ofNullable(Vi.getUnion()).map(v -> v.getUnionname()).orElse(null);
"\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<Record> list = baseService.list(sql);
return list.size() > 0 ? list.get(0).getString("ghname") : "";
} }
@At @At
@RequiresPermissions("hd.child.sczp")
public Object initformHdxxlist() { public Object initformHdxxlist() {
try { try {
Sql sql = Sqls.create("select * from hd_wm_xx where hdtype =2 and hdflag = 1 and hdkssj<=NOW() and hdjssj >=NOW()"); 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 @At
public Object pageData(PageForm page, @Param("searchKeyword") String searchKeyword, @Param("searchName") String searchName, String hdid, String hdlb, String zplb, String unionId, String unitId, @ViReturn
String pageOrderName, String pageOrderBy, String year) { 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 { try {
Cnd cnd = CndPlus.create(); Sql sql = Sqls.create("""
Sql sql = Sqls.create("SELECT\n" + SELECT
"\txx.*,\n" + xx.*,
"\tsbr.username AS sbrname,\n" + sbr.username AS sbrname,
"\tsbr.loginname,\n" + sbr.loginname,
"\thd.hdname,\n" + hd.hdname,
"\thd.hdkssj,\n" + hd.hdkssj,
"\thd.hdjssj,\n" + hd.hdjssj,
"\tzplb.zname as zplbname,\n" + zplb.zname as zplbname,
"\tlb.lname as hdlbname,\n" + lb.lname as hdlbname,
"\tdw.name as dwname,\n" + dw.name as dwname,
"\tgh.unionname as ghname\n" + gh.unionname as ghname
"FROM\n" + FROM
"\thd_ca_sbxx xx\n" + hd_ca_sbxx xx
"\tLEFT JOIN sys_user sbr ON sbr.id = xx.sbr\n" + LEFT JOIN sys_user sbr ON sbr.id = xx.sbr
"\tleft join sys_unit dw on dw.id = sbr.unitid\n" + left join sys_unit dw on dw.id = sbr.unitid
"\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + LEFT JOIN sys_union gh ON gh.id = dw.unionid
"\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" + left join hd_wm_xx hd on hd.hdid = xx.hdid
"\tleft join hd_wm_zplb zplb on zplb.zid = xx.zplb\n" + left join hd_wm_zplb zplb on zplb.zid = xx.zplb
"\tleft join hd_wm_lb lb on lb.lid = xx.hdlb $condition"); left join hd_wm_lb lb on lb.lid = xx.hdlb
cnd.and(new Static("1=1 and xx.hdid in (select hdid from hd_wm_xx where hdtype =2)")); $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")) { 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); cnd.andEX("xx.hdid", "=", hdid);
Vi.cndPlus(cnd, "xx.hdlb", "=", hdlb); cnd.andEX("xx.hdlb", "=", hdlb);
Vi.cndPlus(cnd, "xx.zplb", "=", zplb); cnd.andEX("xx.zplb", "=", zplb);
Vi.cndPlus(cnd, "dw.id", "=", unitId); cnd.andEX("dw.id", "=", unitId);
Vi.cndPlus(cnd, "gh.id", "=", unionId); cnd.andEX("gh.id", "=", unionId);
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { cnd.andEX("YEAR(xx.sbsj)", "=", year);
cnd.where().andLike(searchName, searchKeyword);
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
} }
if (Strings.isNotBlank(year)) { if (Strings.isNotBlank(page.getPageOrderName()) && Strings.isNotBlank(page.getPageOrderBy())) {
Vi.cndPlus(cnd, "YEAR(xx.sbsj)", "=", year); cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy()));
}
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy.equals("asc") ? "asc" : "desc");
} else { } else {
cnd.desc("sbr.username"); cnd.desc("sbr.username");
cnd.desc("gh.unionname"); cnd.desc("gh.unionname");
cnd.desc("dw.name"); cnd.desc("dw.name");
} }
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = baseService.listPage(page.getPageNumber(), page.getPageSize(), sql); Pagination pagination = baseService.listPage(page.getPageNumber(), page.getPageSize(), sql);
return Result.success().addData(pagination); return Result.success().addData(pagination);
@@ -156,12 +151,10 @@ public class HdChildAddZpController {
} }
} }
@Inject
private FileService fileService;
@At @At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @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 { try {
Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data); Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data);
sbxx.setSbr(ShiroUtil.getPrincipalProperty("id").toString()); sbxx.setSbr(ShiroUtil.getPrincipalProperty("id").toString());
@@ -179,7 +172,8 @@ public class HdChildAddZpController {
@At @At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @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 { try {
Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data); Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data);
hdCasbxxService.updateIgnoreNull(sbxx); hdCasbxxService.updateIgnoreNull(sbxx);
@@ -198,6 +192,8 @@ public class HdChildAddZpController {
} }
@At @At
@ViReturn
@RequiresPermissions("hd.child.sczp")
public Object findOne(String id) { public Object findOne(String id) {
try { try {
Hd_ca_sbxx sbxx = hdCasbxxService.fetch(id); Hd_ca_sbxx sbxx = hdCasbxxService.fetch(id);
@@ -236,26 +232,4 @@ public class HdChildAddZpController {
return Result.error(); 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();
}
}
} }
@@ -3,10 +3,13 @@ package io.v.nutz.hd.controller.ca;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService; import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination; 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.ExcelUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ShiroUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; 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.lang.Strings;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream; import java.io.OutputStream;
@@ -26,57 +30,53 @@ import java.util.List;
@Ok("json:full") @Ok("json:full")
public class HdChildHjxxController { public class HdChildHjxxController {
@Inject @Inject
private BaseService baseService; private BaseService baseService;
@At("") @At("")
@Ok("re") @Ok("beetl:/platform/hd/ca/hjxxyl.html")
@RequiresPermissions("hd.child.hjxx") @RequiresPermissions("hd.child.hjxx")
public String index() { public void index() {
return "beetl:/platform/hd/ca/hjxxyl.html";
} }
@At @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 { try {
StringBuffer sb = new StringBuffer(); Sql sql = Sqls.create("""
sb.append("select DISTINCT(xx.sbr),sbr.loginname,sbr.username,dw.name as dwname,gh.unionname as ghname,\n" + select DISTINCT(xx.sbr),
"(SELECT COUNT(DISTINCT(a.zplb)) FROM hd_ca_sbxx a WHERE a.sbr = xx.sbr AND a.hdid = @hdid) as hjcount\n" + sbr.loginname,
"from hd_ca_sbxx xx\n" + sbr.username,
"left join sys_user sbr on sbr.id = xx.sbr\n" + dw.name as dwname,
"left join sys_unit dw on dw.id = sbr.unitid\n" + gh.unionname as ghname,
"LEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + (SELECT COUNT(DISTINCT(a.zplb)) FROM hd_ca_sbxx a WHERE a.sbr = xx.sbr AND a.hdid = @hdid) as hjcount
"where xx.hdid in (select hdid from hd_wm_xx where hdtype =2)"); FROM hd_ca_sbxx xx
sb.append("\tand xx.hdid = @hdid"); 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")) { if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
sb.append("\tAND gh.id IN (\n" + cnd.and("gh.id", "=", Vi.getUnionId());
"\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(searchName) && Strings.isNotBlank(searchKeyword)) { if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
sb.append("\tand\t" + searchName + "\tlike @searchKeyword"); cnd.and(Cnd.likeEX(searchName, searchKeyword));
} }
if (Strings.isNotBlank(union)) { cnd.and("xx.hdid", "=", hdid);
sb.append(" AND dw.unionid = @union"); cnd.andEX("dw.unionid", "=", union);
} cnd.andEX("dw.id", "=", unit);
cnd.asc("sbr.username").asc("gh.unioncode").asc("dw.unitcode");
if (Strings.isNotBlank(unit)) { sql.setCondition(cnd);
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"));
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql); Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination); return Result.success().addData(pagination);
} catch (Exception e) { } catch (Exception e) {
@@ -86,6 +86,8 @@ public class HdChildHjxxController {
@At @At
@Ok("void") @Ok("void")
@RequiresPermissions("hd.child.hjxx")
@ViReturn
public void exportExcel(int num, String hdid, HttpServletResponse response) { public void exportExcel(int num, String hdid, HttpServletResponse response) {
HSSFWorkbook wb = null; HSSFWorkbook wb = null;
String fileName = ""; String fileName = "";
@@ -1,25 +1,30 @@
package io.v.nutz.hd.controller.ca; package io.v.nutz.hd.controller.ca;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.page.Pagination; import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.service.BaseService; import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.ExcelUtil; 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.HdCasbxxFjService;
import io.v.nutz.hd.services.HdWmsbxxService; import io.v.nutz.hd.services.HdWmsbxxService;
import io.v.nutz.sys.models.Sys_file; import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ShiroUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream; import java.io.OutputStream;
@@ -39,13 +44,13 @@ public class HdChildZpxxController {
@Inject @Inject
private BaseService baseService; private BaseService baseService;
@Inject @Inject
private Dao dao; private Dao dao;
@Inject @Inject
private HdCasbxxFjService hdCasbxxFjService; private HdCasbxxFjService hdCasbxxFjService;
@At("") @At("")
@Ok("beetl:/platform/hd/ca/zpxx.html") @Ok("beetl:/platform/hd/ca/zpxx.html")
@RequiresPermissions("hd.child.zpxx") @RequiresPermissions("hd.child.zpxx")
@@ -54,6 +59,9 @@ public class HdChildZpxxController {
} }
@At @At
@RequiresPermissions("hd.child.zpxx")
@ViReturn
@Aop(TransAop.READ_COMMITTED)
public Object dodelete(String id) { public Object dodelete(String id) {
try { try {
baseService.clear("hd_ca_sbxx", Cnd.where("id", "=", id)); baseService.clear("hd_ca_sbxx", Cnd.where("id", "=", id));
@@ -65,9 +73,15 @@ public class HdChildZpxxController {
} }
@At @At
@RequiresPermissions("hd.child.zpxx")
@ViReturn
public Object initHdxxlist() { public Object initHdxxlist() {
try { try {
List<Record> 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<Record> list = baseService.list(Sqls.create("select *,year(hdcjsj) year from hd_wm_xx where hdtype=2 %s order by hdcjsj DESC".formatted(isSysadmin)));
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
Map<Integer, List<Record>> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getInt("year"))); Map<Integer, List<Record>> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getInt("year")));
@@ -89,6 +103,8 @@ public class HdChildZpxxController {
} }
@At @At
@RequiresPermissions("hd.child.zpxx")
@ViReturn
public Object gethdlblist(String id) { public Object gethdlblist(String id) {
try { try {
List list = baseService.list(Sqls.create("select * from hd_wm_lb where lhdid = @id").setParam("id", id)); 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 @At
@RequiresPermissions("hd.child.zpxx")
@ViReturn
public Object gethdzplblist(String id) { public Object gethdzplblist(String id) {
try { try {
List list = baseService.list(Sqls.create("select * from hd_wm_zplb where zlid = @id").setParam("id", id)); 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 @At
public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String hdid, String hdlb, String zplb, @RequiresPermissions("hd.child.zpxx")
String year) { @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 { try {
StringBuffer sb = new StringBuffer(); Sql sql = Sqls.create("""
sb.append("SELECT\n" + SELECT
"\txx.*,\n" + xx.*,
"\tsbr.username AS sbrname,\n" + sbr.username AS sbrname,
"\tsbr.loginname,\n" + sbr.loginname,
"\thd.hdname,\n" + hd.hdname,
"\thd.hdkssj,\n" + hd.hdkssj,
"\thd.hdjssj,\n" + hd.hdjssj,
"\tzplb.zname as zplbname,\n" + zplb.zname as zplbname,
"\tlb.lname as hdlbname,\n" + lb.lname as hdlbname,
"\tdw.name as dwname,\n" + dw.name as dwname,
"\tgh.unionname as ghname\n" + gh.unionname as ghname
"FROM\n" + FROM
"\thd_ca_sbxx xx\n" + hd_ca_sbxx xx
"\tLEFT JOIN sys_user sbr ON sbr.id = xx.sbr\n" + LEFT JOIN sys_user sbr ON sbr.id = xx.sbr
"\tleft join sys_unit dw on dw.id = sbr.unitid\n" + left join sys_unit dw on dw.id = sbr.unitid
"\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + LEFT JOIN sys_union gh ON gh.id = dw.unionid
"\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" + left join hd_wm_xx hd on hd.hdid = xx.hdid
"\tleft join hd_wm_zplb zplb on zplb.zid = xx.zplb\n" + left join hd_wm_zplb zplb on zplb.zid = xx.zplb
"\tleft join hd_wm_lb lb on lb.lid = xx.hdlb where 1=1"); left join hd_wm_lb lb on lb.lid = xx.hdlb
sb.append("\tand xx.hdid in (select hdid from hd_wm_xx where hdtype =2)"); $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")) { if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
sb.append("\tand gh.id in (select gh.id from sys_user u \n" + cnd.and("gh.id", "=", Vi.getUnionId());
"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)");
} }
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)) { if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
sb.append("\tand\t" + searchName + "\tlike @searchKeyword"); cnd.and(Cnd.likeEX(searchName, searchKeyword));
} }
if (Strings.isNotBlank(year)) { cnd.asc("sbr.username").asc("gh.unioncode").asc("dw.unitcode");
sb.append(""" sql.setCondition(cnd);
\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 + "%");
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql); Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination); return Result.success().addData(pagination);
} catch (Exception e) { } catch (Exception e) {
@@ -184,6 +189,8 @@ public class HdChildZpxxController {
} }
@At @At
@RequiresPermissions("hd.child.zpxx")
@ViReturn
public Object findOneById(String id) { public Object findOneById(String id) {
List<Record> fjList = baseService.dao().query("sys_file", Cnd.where("reid", "=", id)); List<Record> fjList = baseService.dao().query("sys_file", Cnd.where("reid", "=", id));
return Result.success().addData(fjList); return Result.success().addData(fjList);
@@ -191,6 +198,8 @@ public class HdChildZpxxController {
@At("/exportExcel") @At("/exportExcel")
@Ok("void") @Ok("void")
@RequiresPermissions("hd.child.zpxx")
@ViReturn
public void exportExcel(HttpServletResponse response, String hdid, String hdname) { public void exportExcel(HttpServletResponse response, String hdid, String hdname) {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("SELECT\n" + sb.append("SELECT\n" +
@@ -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.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
/** /**
@@ -27,6 +24,7 @@ public class HdCnMangeController {
@At @At
@Ok("beetl:/platform/hd/ca/mobileBox.html") @Ok("beetl:/platform/hd/ca/mobileBox.html")
@RequiresPermissions("hd.ca.hdmange")
public void mobileBox() { public void mobileBox() {
} }
@@ -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;
import io.v.nutz.hd.models.Hd_ca_sbxx_fj; import io.v.nutz.hd.models.Hd_ca_sbxx_fj;
import io.v.nutz.hd.services.HdCasbxxFjService; 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.models.Sys_file;
import io.v.nutz.sys.services.SysUserService; import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.service.ViService;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.nutz.boot.starter.ftp.FtpService; import org.nutz.boot.starter.ftp.FtpService;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
@@ -15,7 +16,6 @@ import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Files;
import org.nutz.lang.random.R; import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.AdaptBy; import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
@@ -25,11 +25,8 @@ import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor; import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Author: V * @Author: V
@@ -3,6 +3,8 @@ package io.v.nutz.hd.controller.wmhd;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService; import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination; 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.base.utils.FileService;
import io.v.nutz.hd.models.Hd_wm_sbxx; import io.v.nutz.hd.models.Hd_wm_sbxx;
import io.v.nutz.hd.services.HdWmLbService; 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.HdWmsbxxService;
import io.v.nutz.hd.services.HdWmsbxxfjService; import io.v.nutz.hd.services.HdWmsbxxfjService;
import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; 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.ioc.loader.annotation.IocBean;
import org.nutz.json.Json; import org.nutz.json.Json;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.AdaptBy; import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
@@ -37,7 +37,6 @@ import java.util.Map;
@IocBean @IocBean
@At("/platform/hd/jzghd/sczp") @At("/platform/hd/jzghd/sczp")
@Ok("json:full") @Ok("json:full")
@RequiresAuthentication
public class HdJzgAddZpController { public class HdJzgAddZpController {
@Inject @Inject
@@ -67,11 +66,12 @@ public class HdJzgAddZpController {
@At @At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @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 { try {
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data); Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
sbxx.setHdsbrid(ShiroUtil.getPrincipalProperty("id").toString()); 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); Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
for (TempFile file : files) { for (TempFile file : files) {
@@ -86,14 +86,15 @@ public class HdJzgAddZpController {
@At @At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @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 { try {
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data); Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
sbxx.setAuditState(flag ? "4400" : "3999");
hdWmsbxxService.updateIgnoreNull(sbxx); hdWmsbxxService.updateIgnoreNull(sbxx);
List<String> dellist = Json.fromJsonAsList(String.class, readytodelfile); List<String> dellist = Json.fromJsonAsList(String.class, readytodelfile);
for (String f : dellist) { for (String f : dellist) {
fileService.delete(f, null); fileService.delete(f, f);
} }
for (TempFile file : files) { for (TempFile file : files) {
fileService.upload(file, sbxx.getId(), "/hd/hdwm/"); fileService.upload(file, sbxx.getId(), "/hd/hdwm/");
@@ -106,46 +107,47 @@ public class HdJzgAddZpController {
@At @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 { try {
StringBuffer sb = new StringBuffer(); Sql sql = Sqls.create("""
sb.append("SELECT\n" + SELECT
"\txx.*,\n" + xx.*,
"\tsbr.username AS sbrname,\n" + sbr.username AS sbrname,
"\tsbr.loginname,\n" + sbr.loginname,
"\thd.hdname,\n" + hd.hdname,
"\thd.hdkssj,\n" + hd.hdkssj,
"\thd.hdjssj,\n" + hd.hdjssj,
"\tdw.name as dwname,\n" + dw.name as dwname,
"\tgh.unionname as ghname,\n" + gh.unionname as ghname,
"\thdlb.lname as hdlbname,\n" + hdlb.lname as hdlbname,
"\tzplb.zname as zplbname\n" + zplb.zname as zplbname,
"FROM\n" + state.stateColor,
"\thd_wm_sbxx xx\n" + state.stateName,
"\tLEFT JOIN sys_user sbr ON sbr.id = xx.hdsbrid\n" + ( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id ) dz_znum
"\tleft join sys_unit dw on dw.id = sbr.unitid\n" + FROM
"\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" + hd_wm_sbxx xx
"\tLEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx\n" + LEFT JOIN sys_user sbr ON sbr.id = xx.hdsbrid
"\tLEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2\n" + left join sys_unit dw on dw.id = sbr.unitid
"\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" + LEFT JOIN sys_union gh ON gh.id = dw.unionid
"\twhere 1=1"); LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx
sb.append("\tand xx.hdid in (select hdid from hd_wm_xx where hdtype =1)"); LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2
sb.append("\tand xx.hdsbrid = @userid"); left join hd_wm_xx hd on hd.hdid = xx.hdid
if (Strings.isNotBlank(hdid)) { LEFT JOIN audit_state state ON state.stateId = xx.auditState
sb.append("\tand xx.hdid = @hdid"); $condition
} """);
if (Strings.isNotBlank(hdlb)) { Cnd cnd = Cnd.NEW();
sb.append("\tand xx.hdzplx = @hdlb"); cnd.and("xx.hdid", "in", Sqls.create("select hdid from hd_wm_xx where hdtype =1"));
} cnd.and("xx.hdsbrid", "=", ShiroUtil.getPrincipalProperty("id"));
if (Strings.isNotBlank(zplb)) { cnd.andEX("xx.hdid", "=", hdid);
sb.append("\tand xx.hdzplx2 = @zplb"); cnd.andEX("xx.hdlb", "=", hdlb);
} cnd.andEX("xx.zplb", "=", zplb);
sb.append("\tORDER BY sbr.username,gh.unionname,dw.name"); cnd.desc("sbr.username").desc("gh.unionname").desc("dw.name");
Sql sql = Sqls.create(sb.toString()); sql.setCondition(cnd);
sql.setParam("userid", ShiroUtil.getPrincipalProperty("id"));
sql.setParam("hdid", hdid);
sql.setParam("hdlb", hdlb);
sql.setParam("zplb", zplb);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql); Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination); return Result.success().addData(pagination);
} catch (Exception e) { } 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();
}
}
} }
@@ -1,5 +1,6 @@
package io.v.nutz.hd.controller.wmhd; package io.v.nutz.hd.controller.wmhd;
import cn.hutool.core.date.DateUtil;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import io.v.nutz.annontation.ViReturn; import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.FileService; 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_xx;
import io.v.nutz.hd.models.Hd_wm_zplb; import io.v.nutz.hd.models.Hd_wm_zplb;
import io.v.nutz.hd.services.*; import io.v.nutz.hd.services.*;
import io.v.nutz.sys.services.SysMsgService;
import io.v.nutz.util.ShiroUtil; 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.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.boot.starter.ftp.FtpService; import org.nutz.boot.starter.ftp.FtpService;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
@@ -59,6 +64,7 @@ public class HdMangeController {
@At @At
@Ok("beetl:/platform/hd/wmhd/mobileBox.html") @Ok("beetl:/platform/hd/wmhd/mobileBox.html")
@RequiresPermissions("hd.wmhd.hdmange")
public void mobileBox() { public void mobileBox() {
} }
@@ -74,12 +80,18 @@ public class HdMangeController {
@Inject @Inject
private FtpService ftpService; private FtpService ftpService;
@Inject
private SysMsgService sysMsgService;
@At @At
@Ok("json") @Ok("json")
@ViReturn @ViReturn
@RequiresAuthentication @SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集新增")
@RequiresPermissions("hd.wmhd.hdmange")
public Object doAdd(@Param("hdxx") Hd_wm_xx hdWmXx) { public Object doAdd(@Param("hdxx") Hd_wm_xx hdWmXx) {
Trans.exec(() -> { Trans.exec(() -> {
hdWmXx.setHdcjr(ShiroUtil.getPrincipalProperty("id").toString()); hdWmXx.setHdcjr(ShiroUtil.getPrincipalProperty("id").toString());
hdWmXx.setHdcjsj(sdf.format(new Date())); hdWmXx.setHdcjsj(sdf.format(new Date()));
hdWmXx.setHdflag(false); hdWmXx.setHdflag(false);
@@ -97,13 +109,15 @@ public class HdMangeController {
hdWmZplbService.insert(zplbs.get(j)); hdWmZplbService.insert(zplbs.get(j));
} }
} }
}); });
return null; return null;
} }
@At @At
@Ok("json") @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 { 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"); 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(); Cnd cnd = Cnd.NEW();
@@ -114,6 +128,9 @@ public class HdMangeController {
if (year != null) { if (year != null) {
cnd.and("YEAR(hdcjsj)", "=", year); cnd.and("YEAR(hdcjsj)", "=", year);
} }
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("hd.hdcjr", "=", ShiroUtil.getUserId());
}
cnd.desc("hdcjsj"); cnd.desc("hdcjsj");
sql.setCondition(cnd); sql.setCondition(cnd);
return Result.success().addData(hdWmxxService.listPage(pageNumber, pageSize, sql)); return Result.success().addData(hdWmxxService.listPage(pageNumber, pageSize, sql));
@@ -124,10 +141,12 @@ public class HdMangeController {
@At @At
@Ok("json") @Ok("json")
@Aop(TransAop.READ_COMMITTED)
@SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集删除")
@RequiresPermissions("hd.wmhd.hdmange")
public Object delete(String hdid) { public Object delete(String hdid) {
try { try {
String path = new File("").getCanonicalPath(); 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)); 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)); 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)); hdWmsbxxService.execute(Sqls.create("DELETE FROM `hd_wm_sbxx` WHERE `hdid`=@hdid").setParam("hdid", hdid));
hdWmxxService.delete(hdid); hdWmxxService.delete(hdid);
sysMsgService.deleteMsg(hdid);
return Result.success(); return Result.success();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -155,6 +174,8 @@ public class HdMangeController {
@At @At
@Ok("json") @Ok("json")
@RequiresPermissions("hd.wmhd.hdmange")
public Object changeStatus(String hdid, Boolean flag) { public Object changeStatus(String hdid, Boolean flag) {
try { try {
Hd_wm_xx hdWmXx = hdWmxxService.fetch(hdid); Hd_wm_xx hdWmXx = hdWmxxService.fetch(hdid);
@@ -184,10 +205,12 @@ public class HdMangeController {
@At @At
@Ok("json") @Ok("json")
@RequiresAuthentication @SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集修改")
@RequiresPermissions("hd.wmhd.hdmange")
@ViReturn @ViReturn
public Object doEdit(@Param("hdxx") Hd_wm_xx hdWmXx) { public Object doEdit(@Param("hdxx") Hd_wm_xx hdWmXx) {
Trans.exec(() -> { Trans.exec(() -> {
hdWmxxService.update(hdWmXx); hdWmxxService.update(hdWmXx);
List<String> lbids = new ArrayList<>(); List<String> lbids = new ArrayList<>();
List<String> zpLbids = new ArrayList<>(); List<String> zpLbids = new ArrayList<>();
@@ -226,8 +249,29 @@ public class HdMangeController {
hdWmZplbService.insertOrUpdate(zplbs.get(j)); hdWmZplbService.insertOrUpdate(zplbs.get(j));
} }
} }
}); });
return null; 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);
}
} }
@@ -2,7 +2,6 @@ package io.v.nutz.hd.controller.wmhd;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; 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.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import io.v.nutz.annontation.ViReturn; import io.v.nutz.annontation.ViReturn;
@@ -22,9 +21,9 @@ import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -45,7 +44,14 @@ public class HdWmHjInfoController {
@At("/pageData") @At("/pageData")
@Ok("json") @Ok("json")
@ViReturn @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 { try {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT DISTINCT SELECT DISTINCT
@@ -54,7 +60,7 @@ public class HdWmHjInfoController {
u.loginname, u.loginname,
n.NAME AS dwname, n.NAME AS dwname,
gh.unionname AS ghname, 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 FROM
hd_wm_sbxx xx hd_wm_sbxx xx
LEFT JOIN sys_user u ON u.id = xx.hdsbrid LEFT JOIN sys_user u ON u.id = xx.hdsbrid
@@ -66,7 +72,8 @@ public class HdWmHjInfoController {
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.andEX("xx.hdid", "=", hdid); cnd.andEX("xx.hdid", "=", hdid);
cnd.andEX("YEAR(xx.hdsbsj)", "=", year); 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("gh.id", "=", Vi.getUnionId());
} }
cnd.andEX("n.unionid", "=", union); cnd.andEX("n.unionid", "=", union);
@@ -84,9 +91,8 @@ public class HdWmHjInfoController {
@At("/exportExcel") @At("/exportExcel")
@Ok("void") @Ok("void")
@RequiresPermissions("hd.wmhd.hjxx1")
public void exportExcel(Integer num, String hdid, HttpServletResponse response) { public void exportExcel(Integer num, String hdid, HttpServletResponse response) {
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
if (num == 1) { if (num == 1) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
@@ -96,7 +102,7 @@ public class HdWmHjInfoController {
u.loginname, u.loginname,
n.NAME AS dwname, n.NAME AS dwname,
gh.unionname AS ghname, 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 FROM
hd_wm_sbxx xx hd_wm_sbxx xx
LEFT JOIN sys_user u ON u.id = xx.hdsbrid LEFT JOIN sys_user u ON u.id = xx.hdsbrid
@@ -107,6 +113,7 @@ public class HdWmHjInfoController {
sql.setParam("hdid", hdid); sql.setParam("hdid", hdid);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.andEX("xx.hdid", "=", hdid); cnd.andEX("xx.hdid", "=", hdid);
cnd.andEX("xx.auditState", "=", 4400);
cnd.asc("u.username").asc("n.name").asc("gh.unionname"); cnd.asc("u.username").asc("n.name").asc("gh.unionname");
sql.setCondition(cnd); sql.setCondition(cnd);
List<NutMap> winnerList = hdWmsbxxService.listMap(sql); List<NutMap> winnerList = hdWmsbxxService.listMap(sql);
@@ -119,8 +126,8 @@ public class HdWmHjInfoController {
exportEntities.add(new ExcelExportEntity("获奖次数", "hjcount", 20)); exportEntities.add(new ExcelExportEntity("获奖次数", "hjcount", 20));
try { try {
ViTool.excelResponse(response, "获奖人员名单.xlsx"); ViTool.excelResponse(response, "获奖人员名单.xls");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, winnerList); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, winnerList);
workbook.write(response.getOutputStream()); workbook.write(response.getOutputStream());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -136,9 +143,11 @@ public class HdWmHjInfoController {
LEFT JOIN `user` u ON u.unionid = gh.id LEFT JOIN `user` u ON u.unionid = gh.id
LEFT JOIN hd_wm_sbxx sbxx ON sbxx.hdsbrid = u.id LEFT JOIN hd_wm_sbxx sbxx ON sbxx.hdsbrid = u.id
AND sbxx.hdid = @hdid AND sbxx.hdid = @hdid
AND sbxx.auditState = @auditState
$condition $condition
"""); """);
sql.setParam("hdid", hdid); sql.setParam("hdid", hdid);
sql.setParam("auditState", 4400);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.groupBy("gh.id"); cnd.groupBy("gh.id");
cnd.asc("gh.unioncode"); cnd.asc("gh.unioncode");
@@ -150,128 +159,13 @@ public class HdWmHjInfoController {
exportEntities.add(new ExcelExportEntity("应发奖品数", "prizeNum", 20)); exportEntities.add(new ExcelExportEntity("应发奖品数", "prizeNum", 20));
try { try {
ViTool.excelResponse(response, "分工会获奖信息.xlsx"); ViTool.excelResponse(response, "分工会获奖信息.xls");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, unionList); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, unionList);
workbook.write(response.getOutputStream()); workbook.write(response.getOutputStream());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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<Record> 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<Record> 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();
} }
} }
} }
@@ -2,34 +2,38 @@ package io.v.nutz.hd.controller.wmhd;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; 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.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.wizzer.framework.base.Result; 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.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.Office2Pdf; 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.base.utils.Vi;
import io.v.nutz.hd.models.Hd_wm_sbxx; import io.v.nutz.hd.models.Hd_wm_sbxx;
import io.v.nutz.hd.services.HdWmLbService; import io.v.nutz.hd.services.HdWmLbService;
import io.v.nutz.hd.services.HdWmZplbService; import io.v.nutz.hd.services.HdWmZplbService;
import io.v.nutz.hd.services.HdWmsbxxService; import io.v.nutz.hd.services.HdWmsbxxService;
import io.v.nutz.hd.services.HdWmsbxxfjService; 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.sys.models.Sys_file;
import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ShiroUtil;
import io.v.nutz.util.ViTool; import io.v.nutz.util.ViTool;
import io.v.nutz.web.commons.utils.FileUtil;
import net.coobird.thumbnailator.Thumbnails; import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.boot.starter.ftp.FtpService; import org.nutz.boot.starter.ftp.FtpService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
@@ -38,18 +42,23 @@ import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST; import org.nutz.mvc.annotation.Param;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage; 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.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@IocBean @IocBean
@Ok("json:full")
@At("/platform/hd/wmhd") @At("/platform/hd/wmhd")
public class HdWmInfoController { public class HdWmInfoController {
@@ -71,6 +80,9 @@ public class HdWmInfoController {
@Inject @Inject
private HdWmsbxxfjService hdWmsbxxfjService; private HdWmsbxxfjService hdWmsbxxfjService;
@Inject
protected PropertiesProxy conf;
private static final String imgnewdir = "upload/hd/hdwm/new/"; private static final String imgnewdir = "upload/hd/hdwm/new/";
private String path = new File("").getCanonicalPath(); private String path = new File("").getCanonicalPath();
@@ -105,7 +117,7 @@ public class HdWmInfoController {
@At("/getVideo") @At("/getVideo")
@Ok("void") @Ok("void")
@RequiresAuthentication @RequiresPermissions("hd.wmhd.zpxx1")
public void getVideo(HttpServletRequest request, HttpServletResponse response, String filepath) { public void getVideo(HttpServletRequest request, HttpServletResponse response, String filepath) {
try { try {
File file = new File(path + "\\" + filepath); File file = new File(path + "\\" + filepath);
@@ -148,7 +160,7 @@ public class HdWmInfoController {
*/ */
@At("/getNewImg") @At("/getNewImg")
@Ok("void") @Ok("void")
@RequiresAuthentication @RequiresPermissions("hd.wmhd.zpxx1")
public void getNewImg(HttpServletResponse response, String filepath) throws IOException { public void getNewImg(HttpServletResponse response, String filepath) throws IOException {
//图片格式 //图片格式
String imgformat = filepath.substring(filepath.lastIndexOf(".") + 1, filepath.length()); String imgformat = filepath.substring(filepath.lastIndexOf(".") + 1, filepath.length());
@@ -174,81 +186,71 @@ public class HdWmInfoController {
@At("/pageData") @At("/pageData")
@Ok("json") @ViReturn
@RequiresAuthentication @RequiresPermissions("hd.wmhd.zpxx1")
public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String hdid, String hdlb, String zplb, public Object pageData(@Param(value = "union", required = false) String union,
String year) { @Param(value = "unit", required = false) String unit,
try { PageForm pageForm,
StringBuffer sbsql = new StringBuffer(); @Param(value = "hdid", required = false) String hdid,
sbsql.append("SELECT\n" + @Param(value = "hdlb", required = false) String hdlb,
"\txx.id,\n" + @Param(value = "zplb", required = false) String zplb,
"\txx.hdsbsj,\n" + @Param(value = "year", required = false) String year,
"\txx.hdsbzpzt,\n" + @Param(value = "isExcellent", required = false) Integer isExcellent,
"\txx.hdsbzpms,\n" + @Param(value = "stateId", required = false) Integer stateId) {
"\txx.hdzplx,\n" + Sql sql = Sqls.create("""
"\txx.hdid,\n" + SELECT
"\tu.username,\n" + xx.id,
"\tu.loginname,\n" + xx.hdsbsj,
"\tu.mobile,\n" + xx.hdsbzpzt,
"\tn.NAME AS 'dwname',\n" + xx.hdsbzpms,
"\tgh.unionname AS 'ghname',\n" + xx.hdzplx,
"\thdlb.lname as hdlbname,\n" + xx.hdid,
"\tzplb.zname as zplbname\n" + xx.isExcellent,
"FROM\n" + wmxx.hdname,
"\thd_wm_sbxx xx\n" + u.username,
"\tLEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx\n" + u.loginname,
"\tLEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2\n" + u.mobile,
"\tLEFT JOIN sys_user u ON u.id = xx.hdsbrid\n" + u.unitname AS 'dwname',
"\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + u.unionname AS 'ghname',
"\tLEFT JOIN sys_union gh ON gh.id = n.unionid where 1=1"); hdlb.lname AS hdlbname,
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) { zplb.zname AS zplbname,
sbsql.append("\tAND gh.id IN (\n" + state.stateColor,
"\tSELECT\n" + state.stateName,
"\t\tgh.id \n" + ( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id) dz_num
"\tFROM\n" + FROM
"\t\tsys_user u\n" + hd_wm_sbxx xx
"\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" + LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx
"\tLEFT JOIN sys_union gh ON gh.id = n.unionid where u.id = @cuserid)"); 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
if (Strings.isNotBlank(union)) { LEFT JOIN hd_wm_xx wmxx ON wmxx.hdid = xx.hdid
sbsql.append(" AND n.unionid = @union"); $condition
} """);
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(unit)) { if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
sbsql.append(" AND n.id = @unit"); cnd.and("u.unionid", "=", Vi.getUnionId());
}
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();
} }
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 * @return
*/ */
@At("/findOneById") @At("/findOneById")
@Ok("json:full")
@RequiresAuthentication
public Object findOneById(String id) { public Object findOneById(String id) {
try { try {
// List<Hd_wm_sbxx_fj> fjList = hdWmsbxxfjService.query(Cnd.where("hdsbid", "=", id)); // List<Hd_wm_sbxx_fj> 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<NutMap> 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") @Ok("void")
@RequiresAuthentication @RequiresPermissions("hd.wmhd.zpxx1")
public void exportExcel(HttpServletResponse response, String hdid, String hdname) { 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(""" Sql sql = Sqls.create("""
SELECT SELECT
xx.id, xx.id,
xx.hdsbzpzt,
xx.hdzplx, xx.hdzplx,
xx.hdsbzpms,
xx.hdsbsj,
u.username, u.username,
u.sex,
u.loginname, u.loginname,
n.NAME AS dwname, u.unitname AS dwname,
gh.unionname AS ghname, u.unionname AS ghname,
hd.hdname as hdname, hd.hdname as hdname,
hdlb.lname as hdlbname, hdlb.lname as hdlbname,
zplb.zname as zplbname 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_xx hd ON hd.hdid = xx.hdid
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx 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_zplb zplb ON zplb.zid = xx.hdzplx2
LEFT JOIN sys_user u ON u.id = xx.hdsbrid LEFT JOIN `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
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.andEX("xx.hdid", "=", hdid); 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("A06") && !ShiroUtil.hasRole("sysadmin")) {
if (ShiroUtil.hasRole("H04")) { 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<NutMap> 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<Sys_file> 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<Sys_file> 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); sql.setCondition(cnd);
List<NutMap> list = hdWmsbxxService.listMap(sql); List<NutMap> list = hdWmsbxxService.listMap(sql);
List<ExcelExportEntity> exportEntities = new ArrayList<>(); List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("姓名", "username", 20)); exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20)); exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
exportEntities.add(new ExcelExportEntity("单位", "dwname", 20)); exportEntities.add(new ExcelExportEntity("单位", "dwname", 20));
exportEntities.add(new ExcelExportEntity("分工会", "ghname", 20)); exportEntities.add(new ExcelExportEntity("分工会", "ghname", 20));
exportEntities.add(new ExcelExportEntity("作品主题", "hdname", 20));
exportEntities.add(new ExcelExportEntity("活动类别", "hdlbname", 20)); exportEntities.add(new ExcelExportEntity("活动类别", "hdlbname", 20));
// exportEntities.add(new ExcelExportEntity("作品类别", "zplbname", 20)); exportEntities.add(new ExcelExportEntity("作品类别", "zplbname", 20));
// exportEntities.add(new ExcelExportEntity("作品主题", "hdsbzpzt", 20)); exportEntities.add(new ExcelExportEntity("创作说明", "hdsbzpms", 200));
exportEntities.add(new ExcelExportEntity("点赞次数", "dz_num", 20));
try { try {
ExportParams exportParams = new ExportParams(); ViTool.excelResponse(response, hdname + ".xls");
exportParams.setType(ExcelType.XSSF); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, list);
ViTool.excelResponse(response, hdname + ".xlsx");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
workbook.write(response.getOutputStream()); workbook.write(response.getOutputStream());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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 @Inject
@@ -365,7 +538,7 @@ public class HdWmInfoController {
*/ */
@At("/downLoad") @At("/downLoad")
@Ok("void") @Ok("void")
@RequiresAuthentication @RequiresPermissions("hd.wmhd.zpxx1")
public void download(String filepath, String filename, String username, HttpServletResponse response) { public void download(String filepath, String filename, String username, HttpServletResponse response) {
try { try {
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
@@ -387,7 +560,7 @@ public class HdWmInfoController {
*/ */
@At("/YlDoc") @At("/YlDoc")
@Ok("void") @Ok("void")
@RequiresAuthentication @RequiresPermissions("hd.wmhd.zpxx1")
public void viewFJ(String fjurl, HttpServletRequest request, HttpServletResponse response) throws Exception { public void viewFJ(String fjurl, HttpServletRequest request, HttpServletResponse response) throws Exception {
String destFile = ""; String destFile = "";
try { try {
@@ -430,11 +603,15 @@ public class HdWmInfoController {
} }
@At @At
@Ok("json:full")
@RequiresAuthentication
public Object initHdxxlist() { public Object initHdxxlist() {
try { try {
List<Record> 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<Record> list = hdWmsbxxService.list(sql);
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
@@ -443,7 +620,14 @@ public class HdWmInfoController {
listMap.forEach((k, v) -> { listMap.forEach((k, v) -> {
List<Map<String, Object>> children = new ArrayList<>(); List<Map<String, Object>> children = new ArrayList<>();
v.forEach(x -> { 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<String, Object> parent = Map.of("value", k, "label", k, "children", children); Map<String, Object> parent = Map.of("value", k, "label", k, "children", children);
@@ -458,8 +642,6 @@ public class HdWmInfoController {
@At @At
@Ok("json:full")
@RequiresAuthentication
public Object findOne(String id) { public Object findOne(String id) {
try { try {
Hd_wm_sbxx sbxx = hdWmsbxxService.fetch(id); Hd_wm_sbxx sbxx = hdWmsbxxService.fetch(id);
@@ -497,14 +679,38 @@ public class HdWmInfoController {
@At @At
@POST
@ViReturn @ViReturn
@Ok("json:full") @RequiresPermissions("hd.wmhd.zpxx1")
@RequiresAuthentication
public Object doDelete(String id) { public Object doDelete(String id) {
dao.clear(Hd_wm_sbxx.class, Cnd.where("id", "=", id)); dao.clear(Hd_wm_sbxx.class, Cnd.where("id", "=", id));
dao.clear(Sys_file.class, Cnd.where("reid", "=", id)); dao.clear(Sys_file.class, Cnd.where("reid", "=", id));
return null; 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;
}
} }
@@ -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;
}
}
@@ -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;
}
}
@@ -79,14 +79,14 @@ public class StaffActivitiesCon {
@Ok("json") @Ok("json")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresAuthentication @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 { try {
String path = new File("").getCanonicalPath(); String path = new File("").getCanonicalPath();
sbxx.setAuditState(flag ? "4400" : "3999");
Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx); Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
for (TempFile file : files) { for (TempFile file : files) {
fileService.upload(file,insert.getId(),"/hd/hdwm/"); fileService.upload(file, insert.getId(), "/hd/hdwm/");
} }
@@ -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();
}
}
}
@@ -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> 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> 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<Hd_subject> 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);
}
}
@@ -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<Hd_subject> 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;
}
}
@@ -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<Record> 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<String> 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"));
}
}
@@ -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();
}
}
}
@@ -1,5 +1,6 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
@@ -10,6 +11,7 @@ import java.util.List;
* @Date 2022/4/22 * @Date 2022/4/22
* @Description 打卡签到活动 * @Description 打卡签到活动
*/ */
@Data
@Table("hd_checkin") @Table("hd_checkin")
public class HdCheckIn implements Serializable { public class HdCheckIn implements Serializable {
@@ -96,139 +98,4 @@ public class HdCheckIn implements Serializable {
private List<HdCheckinFile> files; private List<HdCheckinFile> files;
public List<HdCheckinFile> getFiles() {
return files;
}
public void setFiles(List<HdCheckinFile> files) {
this.files = files;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public List<Hd_wm_bgi> getBgis() {
return bgis;
}
public void setBgis(List<Hd_wm_bgi> 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;
}
} }
@@ -1,5 +1,6 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
@@ -9,6 +10,7 @@ import java.io.Serializable;
* @Date 2022/4/22 * @Date 2022/4/22
* @Description * @Description
*/ */
@Data
@Table("hd_checkin_zan") @Table("hd_checkin_zan")
public class HdCheckZan implements Serializable { public class HdCheckZan implements Serializable {
@@ -36,35 +38,4 @@ public class HdCheckZan implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
private String userid; 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;
}
} }
@@ -1,5 +1,6 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
@@ -9,6 +10,7 @@ import java.io.Serializable;
* @Date 2022/4/22 * @Date 2022/4/22
* @Description * @Description
*/ */
@Data
@Table("hd_checkin_content") @Table("hd_checkin_content")
public class HdCheckinContent implements Serializable { public class HdCheckinContent implements Serializable {
@@ -46,51 +48,4 @@ public class HdCheckinContent implements Serializable {
@ColDefine(type = ColType.BOOLEAN) @ColDefine(type = ColType.BOOLEAN)
private Boolean isOpen; 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;
}
} }
@@ -1,5 +1,6 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
@@ -9,6 +10,7 @@ import java.io.Serializable;
* @Date 2022/4/22 * @Date 2022/4/22
* @Description * @Description
*/ */
@Data
@Table("hd_checkin_file") @Table("hd_checkin_file")
public class HdCheckinFile implements Serializable { public class HdCheckinFile implements Serializable {
@@ -41,43 +43,4 @@ public class HdCheckinFile implements Serializable {
@ColDefine(type = ColType.VARCHAR,width = 100) @ColDefine(type = ColType.VARCHAR,width = 100)
private String name; 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;
}
} }
@@ -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<Hd_subject> subjects;
}
@@ -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<Hd_subject_answer> answer;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -1,5 +1,6 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
@@ -9,6 +10,7 @@ import java.util.List;
* Created by lyw on 2020/3/13 11:10 * Created by lyw on 2020/3/13 11:10
* 三八活动类别 * 三八活动类别
*/ */
@Data
@Table("Hd_wm_lb") @Table("Hd_wm_lb")
public class Hd_wm_lb implements Serializable { public class Hd_wm_lb implements Serializable {
@@ -36,43 +38,4 @@ public class Hd_wm_lb implements Serializable {
private List<Hd_wm_zplb> zplbs; private List<Hd_wm_zplb> zplbs;
public List<Hd_wm_zplb> getZplbs() {
return zplbs;
}
public void setZplbs(List<Hd_wm_zplb> 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;
}
} }
@@ -1,9 +1,11 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
@Data
@Table("Hd_wm_sbxx") @Table("Hd_wm_sbxx")
@TableIndexes({@Index(name = "INDEX_HDWMSB_HBSBRID", fields = {"hdsbrid"}, unique = false)}) @TableIndexes({@Index(name = "INDEX_HDWMSB_HBSBRID", fields = {"hdsbrid"}, unique = false)})
public class Hd_wm_sbxx implements Serializable { public class Hd_wm_sbxx implements Serializable {
@@ -22,14 +24,6 @@ public class Hd_wm_sbxx implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
private String hdid; private String hdid;
public String getHdid() {
return hdid;
}
public void setHdid(String hdid) {
this.hdid = hdid;
}
@Column @Column
@Comment("上报人id") @Comment("上报人id")
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@@ -52,9 +46,14 @@ public class Hd_wm_sbxx implements Serializable {
@Column @Column
@Comment("作品描述") @Comment("作品描述")
@ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.TEXT)
private String hdsbzpms; private String hdsbzpms;
@Column
@Comment("作品名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String zpmc;
@Column @Column
@Comment("上报时间") @Comment("上报时间")
@ColDefine(type = ColType.VARCHAR, width = 20) @ColDefine(type = ColType.VARCHAR, width = 20)
@@ -65,67 +64,29 @@ public class Hd_wm_sbxx implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 20) @ColDefine(type = ColType.VARCHAR, width = 20)
private String mobile; private String mobile;
public String getId() { @Column
return id; @Comment("状态")
} @ColDefine(type = ColType.VARCHAR, width = 20)
private String auditState;
public void setId(String id) { @Column
this.id = id; @Comment("分工会审核id")
} @ColDefine(type = ColType.VARCHAR, width = 32)
private String unionAuditId;
public String getHdsbrid() { @Column
return hdsbrid; @Comment("校工会审核id")
} @ColDefine(type = ColType.VARCHAR, width = 32)
private String schoolAuditId;
public void setHdsbrid(String hdsbrid) { @Column
this.hdsbrid = hdsbrid; @Comment("是否发送系统消息")
} @ColDefine(type = ColType.BOOLEAN)
private Boolean xlFlag;
public String getHdsbsj() { @Column
return hdsbsj; @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;
}
} }
@@ -1,9 +1,11 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
@Data
@Table("Hd_wm_sbxx_fj") @Table("Hd_wm_sbxx_fj")
@TableIndexes({@Index(name = "INDEX_HDWMSB_FJ_HBSBID", fields = {"hdsbid"}, unique = false)}) @TableIndexes({@Index(name = "INDEX_HDWMSB_FJ_HBSBID", fields = {"hdsbid"}, unique = false)})
public class Hd_wm_sbxx_fj implements Serializable { 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) @ColDefine(type = ColType.VARCHAR,width = 100)
private String fjname; 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;
}
} }
@@ -65,6 +65,21 @@ public class Hd_wm_xx implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 50) @ColDefine(type = ColType.VARCHAR, width = 50)
private String hdjssj; 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 @Column
@Comment("活动状态 (开启 关闭)") @Comment("活动状态 (开启 关闭)")
@ColDefine(type = ColType.BOOLEAN) @ColDefine(type = ColType.BOOLEAN)
@@ -84,21 +99,21 @@ public class Hd_wm_xx implements Serializable {
@Comment("配色") @Comment("配色")
@ColDefine(type = ColType.VARCHAR, width = 50) @ColDefine(type = ColType.VARCHAR, width = 50)
private String hdcolor; 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 @Column
@Comment("活动类型(1 教工 2 亲子)") @Comment("活动类型(1 教工 2 亲子)")
@ColDefine(type = ColType.INT, width = 1) @ColDefine(type = ColType.INT, width = 1)
private Integer hdtype; private Integer hdtype;
public Integer getHdtype() {
return hdtype;
}
public void setHdtype(Integer hdtype) {
this.hdtype = hdtype;
}
private List<Hd_wm_lb> lbs; private List<Hd_wm_lb> lbs;
private List<Hd_wm_bgi> bgis; private List<Hd_wm_bgi> bgis;
@@ -109,5 +124,26 @@ public class Hd_wm_xx implements Serializable {
@ColDefine(type = ColType.MYSQL_JSON) @ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files; private List<Sys_file> 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;
} }
@@ -1,13 +1,16 @@
package io.v.nutz.hd.models; package io.v.nutz.hd.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* Created by lyw on 2020/3/13 11:10 * Created by lyw on 2020/3/13 11:10
* 三八活动作品类别 * 三八活动作品类别
*/ */
@Data
@Table("Hd_wm_zplb") @Table("Hd_wm_zplb")
public class Hd_wm_zplb implements Serializable { public class Hd_wm_zplb implements Serializable {
@@ -28,40 +31,54 @@ public class Hd_wm_zplb implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
private String zname; 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<String> 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<String> otherType;
@Column
@Comment("每个音/视频、文档大小")
@ColDefine(type = ColType.INT, width = 10)
private Integer otherSize;
@Column @Column
@Comment("排序") @Comment("排序")
@ColDefine(type = ColType.INT, width = 4) @ColDefine(type = ColType.INT, width = 4)
private int zlocation; 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;
}
} }
@@ -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<Hd_papers> {
}
@@ -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<Hd_subject_answer> {
void doAdd(Hd_subject_reply[] replyList, String unique_id) throws Exception;
Object findOne(String id, String unique_id) throws Exception;
}
@@ -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<Hd_subject_reply> {
}
@@ -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<Hd_subject> {
}
@@ -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<Hd_papers> implements HdPaperService {
public HdPaperServiceImpl(Dao dao) {
super(dao);
}
}
@@ -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<Hd_subject_answer> 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<Hd_subject> 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;
}
}
@@ -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<Hd_subject_reply> implements HdSubjectReplyService {
public HdSubjectReplyServiceImpl(Dao dao) {
super(dao);
}
}
@@ -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<Hd_subject> implements HdSubjectService {
public HdSubjectServiceImpl(Dao dao) {
super(dao);
}
}
@@ -3,6 +3,7 @@ package io.v.nutz.jf.controller.activitybx;
import io.v.nutz.annontation.ViReturn; import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil; import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi; 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.model.ActivityBx;
import io.v.nutz.jf.service.ActivityBxService; import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_signature; 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.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import java.util.List;
/** /**
* @author zhf * @author zhf
* @date 2020/11/14 14:55 * @date 2020/11/14 14:55
@@ -49,29 +54,33 @@ public class AccountingCon {
@At @At
@ViReturn @ViReturn
public Object pageData(Integer year, Integer isAudit, String unitId, String unionId, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) { 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" + Sql sql = Sqls.create("""
"SELECT\n" + SELECT
"\tact.*,\n" + bx.*,
"\tu.loginname bxr_loginname,\n" + bxr.loginname bxr_loginname,
"\tu.unionname bxr_unionname,\n" + bxr.unionname bxr_unionname,
"\tu.unioncode,\n" + bxr.unioncode,
"\ts.state_name,\n" + state.state_name,
"\ts.state_color \n" + state.state_color,
"FROM\n" + abs.`name` absName
"\t`activity_bx` act\n" + FROM
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" + activity_bx bx
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition"); 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(); Cnd cnd = Cnd.NEW();
if (isAudit == 1) { if (isAudit == 1) {
cnd.and("act.state_id", ">=", 1020); cnd.and("bx.state_id", ">=", 1020);
} else { } 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)) { if (Vi.isNotBlank(searchName, searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword); cnd.where().andLike(searchName, searchKeyword);
} }
@@ -79,18 +88,20 @@ public class AccountingCon {
if (Vi.isNotBlank(pageOrderName, pageOrderBy)) { if (Vi.isNotBlank(pageOrderName, pageOrderBy)) {
cnd.orderBy(pageOrderName, pageOrderBy); cnd.orderBy(pageOrderName, pageOrderBy);
} else { } 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.unitid", "=", unitId);
Vi.cndPlus(cnd, "u.unionid", "=", unionId); Vi.cndPlus(cnd, "u.unionid", "=", unionId);
sql.setCondition(cnd); sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql); return activityBxService.listPageMap(pageNumber, pageSize, sql);
} }
@At @At
@ViReturn @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<Goods> goodsList = Json.fromJsonAsList(Goods.class, goods);
ActivityBx aid = activityBxService.fetch(id); ActivityBx aid = activityBxService.fetch(id);
aid.setGoods(goodsList);
aid.setState_id(flag ? "1030" : "1025"); aid.setState_id(flag ? "1030" : "1025");
aid.setAccounting_name(ShiroUtil.getPrincipalProperty("id").toString()); aid.setAccounting_name(ShiroUtil.getPrincipalProperty("id").toString());
aid.setAccounting_time(DateUtil.getDate()); aid.setAccounting_time(DateUtil.getDate());
@@ -102,5 +113,11 @@ public class AccountingCon {
return null; return null;
} }
@At
@ViReturn
public Object getGoods(String id) {
return activityBxService.dao().query(Goods.class, Cnd.where("reid", "=", id));
}
} }
@@ -55,16 +55,7 @@ public class ApplyController {
@ViReturn @ViReturn
public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) { public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR)); activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "A06"}) && activityBx.getActivity_type().equals(2)) { activityBx.setState_id("1020");
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.setApply_time(DateUtil.getDate()); activityBx.setApply_time(DateUtil.getDate());
activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString()); activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString());
if (Strings.isNotBlank(sign)) { if (Strings.isNotBlank(sign)) {
@@ -74,4 +65,13 @@ public class ApplyController {
return null; 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;
}
} }
@@ -1,25 +1,24 @@
package io.v.nutz.jf.controller.activitybx; package io.v.nutz.jf.controller.activitybx;
import cn.wizzer.framework.base.service.BaseService;
import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure; import com.deepoove.poi.config.Configure;
import com.deepoove.poi.data.PictureRenderData; import com.deepoove.poi.data.PictureRenderData;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy; import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.annontation.ViReturn; 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.Html2Text;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
import io.v.nutz.jf.model.ActivityBx; import io.v.nutz.jf.model.ActivityBx;
import io.v.nutz.jf.model.ActivityFile; import io.v.nutz.jf.model.ActivityFile;
import io.v.nutz.jf.service.ActivityBxService; import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.jf.service.ActivityFileService; 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.sys.services.SysSignatureService;
import io.v.nutz.util.MoneyUtil; import io.v.nutz.util.MoneyUtil;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; 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.dao.util.cri.Static;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; 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.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Base64; import java.util.Base64;
import java.util.Calendar;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
*/ */
@IocBean @IocBean
@Ok("json") @Ok("json")
@At("/platform/jf/activity_bx/recording") @At("/platform/jf/activity_bx/reimbursement")
public class ReimbursementCon { public class ReimbursementCon {
@@ -68,34 +68,11 @@ public class ReimbursementCon {
private ActivityFileService activityFileService; private ActivityFileService activityFileService;
@At("") @At("")
@Ok("beetl:/platform/jf/activitybx/recording.html") @Ok("beetl:/platform/jf/activitybx/reimbursement.html")
@RequiresPermissions("sys.jf.activity_bx.recording") @RequiresPermissions("sys.jf.activity_bx.reimbursement")
public void index() { 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.unionname bxr_unionname,
bxr.unioncode, bxr.unioncode,
state.state_name, state.state_name,
state.state_color,( state.state_color,
CASE abs.`name` absName
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
FROM FROM
activity_bx bx activity_bx bx
LEFT JOIN `user` bxr ON bx.user_id = bxr.id 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(); Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles("sysadmin")) { if (!ShiroUtil.hasAnyRoles("sysadmin")) {
@@ -223,7 +125,7 @@ public class ReimbursementCon {
Vi.cndPlus(cnd, "bxr.unitid", "=", unitId); Vi.cndPlus(cnd, "bxr.unitid", "=", unitId);
Vi.cndPlus(cnd, "bxr.unionid", "=", unionId); Vi.cndPlus(cnd, "bxr.unionid", "=", unionId);
sql.setCondition(cnd); sql.setCondition(cnd);
return activityBxService.listPage(pageNumber, pageSize, sql); return activityBxService.listPageMap(pageNumber, pageSize, sql);
} }
@At @At
@@ -232,7 +134,7 @@ public class ReimbursementCon {
return queryOne(id); return queryOne(id);
} }
private Record queryOne(String id) { private NutMap queryOne(String id) {
Sql sql = Sqls.create("SELECT\n" + Sql sql = Sqls.create("SELECT\n" +
"\tact.*,\n" + "\tact.*,\n" +
"\t`user`.loginname,\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" + "\tLEFT JOIN sys_signature us_s ON us_s.id = act.user_signature \n" +
"WHERE\n" + "WHERE\n" +
"\tact.id = @id").setParam("id", id); "\tact.id = @id").setParam("id", id);
Record record = activityBxService.list(sql).get(0); List<NutMap> listMap = baseService.listMap(sql);
record.set("Goods", baseService.dao().query("Goods", Cnd.where("reid", "=", id))); 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) { String activity_id = map.getString("activity_id");
return null; if (Strings.isNotBlank(activity_id)) {
List<ActivityFile> files = activityFileService.query(Cnd.where("activity_id", "=", activity_id).desc("time"));
LinkedHashMap<String, List<ActivityFile>> collect = files.stream().collect(Collectors.groupingBy(ActivityFile::getTime, LinkedHashMap::new, Collectors.toList()));
map.setv("activity_files", collect);
}
} }
return map;
String activity_id = record.getString("activity_id");
if (Strings.isNotBlank(activity_id)) {
List<ActivityFile> files = activityFileService.query(Cnd.where("activity_id", "=", activity_id).desc("time"));
LinkedHashMap<String, List<ActivityFile>> collect = files.stream().collect(Collectors.groupingBy(ActivityFile::getTime, LinkedHashMap::new, Collectors.toList()));
record.set("activity_files", collect);
}
return record;
} }
@At @At
@ViReturn @ViReturn
public Object doEdit(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign, String[] delNotesList) { public Object doEdit(String files, String id) {
List<Sys_file> fileList = Json.fromJsonAsList(Sys_file.class, files);
if (delNotesList != null && delNotesList.length > 0) { activityBxService.update(Chain.make("resultsFiles", fileList).add("state_id", 1060), Cnd.where("id", "=", id));
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);
return null; return null;
} }
@@ -3,13 +3,22 @@ package io.v.nutz.jf.controller.activitybx;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams; 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.annontation.ViReturn;
import io.v.nutz.base.utils.Vi; 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.jf.service.ActivityBxService;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.sys.services.SysUnionService; 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 io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; 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.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; 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.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; 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.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.*;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
@@ -45,6 +59,10 @@ public class ReimbursementViewCon {
private SysUnionService sysUnionService; private SysUnionService sysUnionService;
@Inject
private FtpService ftpService;
@At("") @At("")
@Ok("beetl:/platform/jf/activitybx/reimbursementview.html") @Ok("beetl:/platform/jf/activitybx/reimbursementview.html")
@RequiresPermissions("sys.jf.activity_bx.reimbursementview") @RequiresPermissions("sys.jf.activity_bx.reimbursementview")
@@ -55,19 +73,22 @@ public class ReimbursementViewCon {
@At @At
@ViReturn @ViReturn
public Object pageData(Integer year, String searchName, String unitId, String unionId, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) { 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" + Sql sql = Sqls.create("""
"\tact.*,\n" + SELECT
"\tu.loginname,\n" + act.*,
"\tun.unionname,\n" + bxr.loginname bxr_loginname,
"\tun.unioncode,\n" + bxr.unionname bxr_unionname,
"\ts.state_name,\n" + bxr.unioncode,
"\ts.state_color \n" + state.state_name,
"FROM\n" + state.state_color,
"\t`activity_bx` act\n" + abs.`name` absName
"\tLEFT JOIN `user` u ON act.user_id = u.id\n" + FROM
"\tLEFT JOIN sys_unit su ON su.id = u.unitid\n" + activity_bx act
"\tLEFT JOIN sys_union un ON su.unionid = un.id\n" + LEFT JOIN `user` bxr ON act.user_id = bxr.id
"\tLEFT JOIN state s ON act.state_id = s.state_id $condition"); 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(); Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02")) { if (!ShiroUtil.hasAnyRoles("sysadmin,wyh02")) {
SqlExpressionGroup group2 = new SqlExpressionGroup(); SqlExpressionGroup group2 = new SqlExpressionGroup();
@@ -93,9 +114,98 @@ public class ReimbursementViewCon {
cnd.asc("act.state_id").desc("act.apply_time"); cnd.asc("act.state_id").desc("act.apply_time");
} }
sql.setCondition(cnd); 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<NutMap> 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<String, Object> 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<ActivityBx> 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();
}
}
/** /**
* 下载名单 * 下载名单
@@ -30,11 +30,28 @@ public class ActivityBx {
@ColDefine(type = ColType.VARCHAR, width = 200) @ColDefine(type = ColType.VARCHAR, width = 200)
private String user_name; 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 @Column
@Comment("申请时间") @Comment("申请时间")
@ColDefine(type = ColType.VARCHAR, width = 30) @ColDefine(type = ColType.VARCHAR, width = 30)
private String apply_time; private String apply_time;
@Column
@Comment("申请类型(1.经费申报2.报销申请)")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String apply_type;
@Column @Column
@Comment("用户id") @Comment("用户id")
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@@ -65,6 +82,21 @@ public class ActivityBx {
@ColDefine(type = ColType.VARCHAR, width = 50) @ColDefine(type = ColType.VARCHAR, width = 50)
private String activity_name; 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 @Column
@Comment("活动id (未必有)") @Comment("活动id (未必有)")
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@@ -75,6 +107,11 @@ public class ActivityBx {
@ColDefine(type = ColType.TEXT) @ColDefine(type = ColType.TEXT)
private String activity_content; private String activity_content;
@Column
@Comment("活动安排")
@ColDefine(type = ColType.TEXT)
private String activity_arrange;
@Column @Column
@Comment("报销事由") @Comment("报销事由")
@ColDefine(type = ColType.TEXT) @ColDefine(type = ColType.TEXT)
@@ -90,6 +127,11 @@ public class ActivityBx {
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2) @ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private Double activity_money; private Double activity_money;
@Column
@Comment("申报金额")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private Double funds_money;
@Column @Column
@Comment("报销卡号") @Comment("报销卡号")
@ColDefine(type = ColType.VARCHAR, width = 50) @ColDefine(type = ColType.VARCHAR, width = 50)
@@ -255,6 +297,11 @@ public class ActivityBx {
@ColDefine(type = ColType.MYSQL_JSON) @ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files; private List<Sys_file> files;
@Column
@Comment("成果附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> resultsFiles;
@Column @Column
@Comment("附件数量") @Comment("附件数量")
@ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
@@ -1,7 +1,8 @@
package io.v.nutz.jf.service; 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 io.v.nutz.jf.model.ActivityBx;
import org.nutz.lang.util.NutMap;
/** /**
* @author zhf * @author zhf
@@ -12,4 +13,6 @@ public interface ActivityBxService extends BaseService<ActivityBx> {
void doAdd(ActivityBx activityBx); void doAdd(ActivityBx activityBx);
void doEdit(ActivityBx activityBx); void doEdit(ActivityBx activityBx);
NutMap queryOne(String id);
} }
@@ -1,13 +1,25 @@
package io.v.nutz.jf.service.impl; 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.ActivityBx;
import io.v.nutz.jf.model.ActivityFile;
import io.v.nutz.jf.service.ActivityBxService; import io.v.nutz.jf.service.ActivityBxService;
import io.v.nutz.jf.service.ActivityFileService;
import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; 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.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; 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 * @author zhf
@@ -20,6 +32,8 @@ public class ActivityBxServiceImpl extends BaseServiceImpl<ActivityBx> implement
super(dao); super(dao);
} }
@Inject
private ActivityFileService activityFileService;
@Override @Override
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
@@ -32,4 +46,66 @@ public class ActivityBxServiceImpl extends BaseServiceImpl<ActivityBx> implement
public void doEdit(ActivityBx activityBx) { public void doEdit(ActivityBx activityBx) {
updateWith(activityBx, "goods"); 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<ActivityFile> files = activityFileService.query(Cnd.where("activity_id", "=", activity_id).desc("time"));
LinkedHashMap<String, List<ActivityFile>> collect = files.stream().collect(Collectors.groupingBy(ActivityFile::getTime, LinkedHashMap::new, Collectors.toList()));
record.setv("activity_files", collect);
}
return record;
}
} }
@@ -1,6 +1,12 @@
package io.v.nutz.mobile.cahd; package io.v.nutz.mobile.cahd;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.BaseService; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
@@ -20,11 +26,29 @@ public class CahdApplyController {
@At("") @At("")
@Ok("beetl:/mobile/cahd/applyList.html") @Ok("beetl:/mobile/cahd/applyList.html")
@RequiresAuthentication
public void index() { 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);
}
} }
@@ -1,6 +1,13 @@
package io.v.nutz.mobile.wmhd; package io.v.nutz.mobile.wmhd;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.BaseService; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
@@ -22,9 +29,30 @@ public class WmhdApplyController {
@At("") @At("")
@Ok("beetl:/mobile/wmhd/applyList.html") @Ok("beetl:/mobile/wmhd/applyList.html")
@RequiresAuthentication
public void index() { 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);
}
} }
@@ -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";
}
}
@@ -49,7 +49,7 @@ public class WmhdListController {
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx 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_zplb zplb ON zplb.zid = xx.hdzplx2
WHERE xx.id=@id WHERE xx.id=@id
""").setParam("id",id); """).setParam("id", id);
return baseService.listMap(sql); return baseService.listMap(sql);
} }
@@ -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<Record> list = pagination.getList();
list.forEach(map->{
List<Record> 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<Record> list = baseService.list(sql);
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
Map<Integer, List<Record>> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getInt("year")));
listMap.forEach((k, v) -> {
List<Map<String, Object>> 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<String, Object> parent = Map.of("value", k, "label", k, "children", children);
result.add(parent);
});
return result;
}
}
@@ -48,5 +48,7 @@ public class SysEntranceModule extends BaseModel {
@Comment("排序编号") @Comment("排序编号")
@ColDefine(type = ColType.INT) @ColDefine(type = ColType.INT)
private int sortNum; private int sortNum;
private List<Sys_menu> menus;
} }
@@ -3,12 +3,15 @@ package io.v.nutz.sys.models;
import io.v.nutz.base.model.BaseModel; import io.v.nutz.base.model.BaseModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.apache.commons.lang.StringUtils;
import org.nutz.dao.DB; import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert; import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* Created by wizzer on 2016/6/21. * 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) @ColDefine(type = ColType.VARCHAR, width = 255)
private String note; private String note;
@Column
@Comment("操作指南")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> description;
@Column @Column
@Comment("排序字段") @Comment("排序字段")
@Prev({ @Prev({
@@ -100,4 +109,27 @@ public class Sys_menu extends BaseModel implements Serializable {
private List<Sys_menu> buttons; private List<Sys_menu> buttons;
private List<Sys_menu> children = new ArrayList<Sys_menu>();
private String parentName;
/**
* 前端菜单数据
*
* @param menus
* @param parentId
* @return
*/
public static List<Sys_menu> createTreeMenus(List<Sys_menu> menus, String parentId) {
List<Sys_menu> 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<Sys_menu> childMenus = createTreeMenus(menus, menu.getId());
menu.setChildren(childMenus);
// }
}
return new ArrayList<>(filterMenus);
}
} }
@@ -603,4 +603,13 @@ public class Sys_user extends BaseModel implements Serializable {
/** /**
* 2021-05-18 end * 2021-05-18 end
*/ */
/**
* 前端菜单
*/
private List<Sys_menu> treeMenus;
private List<SysEntranceModule> moduleMenus;
} }
@@ -42,6 +42,22 @@ public interface SysUserService extends BaseService<Sys_user> {
*/ */
Sys_user fillMenu(Sys_user user); 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删除用户 * 通过用户ID删除用户
* *
@@ -79,6 +95,15 @@ public interface SysUserService extends BaseService<Sys_user> {
* @param userId * @param userId
*/ */
void deleteCache(String userId); void deleteCache(String userId);
/**
* 清除一个用户的缓存并更新主体信息
* 清除当前用户缓存
*
* @param userId
*/
void deleteCacheAndUpdate(String userId);
/** /**
* 清空缓存 * 清空缓存
*/ */
@@ -1,20 +1,26 @@
package io.v.nutz.sys.services.impl; 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.constant.RedisConstant;
import io.v.nutz.base.service.impl.BaseServiceImpl; import io.v.nutz.base.service.impl.BaseServiceImpl;
import io.v.nutz.sys.models.Sys_menu; import io.v.nutz.sys.models.*;
import io.v.nutz.sys.models.Sys_role;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysMenuService; 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.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.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.plugins.wkcache.annotation.CacheDefaults; import org.nutz.plugins.wkcache.annotation.CacheDefaults;
import org.nutz.plugins.wkcache.annotation.CacheRemove; import org.nutz.plugins.wkcache.annotation.CacheRemove;
@@ -25,6 +31,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* Created by wizzer on 2016/12/22. * Created by wizzer on 2016/12/22.
@@ -39,6 +46,12 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
@Inject @Inject
private SysMenuService sysMenuService; private SysMenuService sysMenuService;
@Inject
private SysRoleService sysRoleService;
@Inject
private RedisService redisService;
/** /**
* 查询用户角色code列表 * 查询用户角色code列表
* *
@@ -86,6 +99,54 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
return user; return user;
} }
@CacheResult(cacheKey = "${args[0].id}_fillModuleMenus")
public Sys_user fillModuleMenus(Sys_user user) {
//获取用户所有的菜单
List<Sys_menu> menus = getMenus(user.getId());
user.setMenus(menus);
//一级菜单
List<Sys_menu> firstMenus = menus.stream().filter(v -> StrUtil.isBlank(v.getParentId()) && v.getPath().length() == 4).collect(Collectors.toList());
List<String> firstMenuIds = firstMenus.stream().map(v -> v.getId()).collect(Collectors.toList());
//设置菜单tree结构
List<Sys_menu> treeMenus = Sys_menu.createTreeMenus(menus, null);
user.setTreeMenus(treeMenus);
//获取所有的模块
List<SysEntranceModule> modules = dao().query(SysEntranceModule.class, Cnd.NEW().asc("sortNum"));
modules.forEach(v -> {
List<String> containsMenus = v.getContainsMenu();
for (String containsMenu : containsMenus) {
if (firstMenuIds.contains(containsMenu)) {
List<Sys_menu> 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<SysEntranceModule> 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<Sys_user> implements Sys
@CacheRemove(cacheKey = "${args[0]}_*") @CacheRemove(cacheKey = "${args[0]}_*")
//可以通过el表达式加 * 通配符来批量删除一批缓存 //可以通过el表达式加 * 通配符来批量删除一批缓存
public void deleteCache(String userId) { 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 @CacheRemoveAll
@@ -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<Sys_user_role> data = dao.query(Sys_user_role.class, Cnd.where("userId", "=", ShiroUtil.getUserId()).and("roleId", "=", Roles.UNION_MANGER));
List<String> 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<String> 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;
}
}
@@ -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();
}
}
@@ -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);
}
}
@@ -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<String, Object> 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();
}
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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);
}
}
@@ -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();
}
}
@@ -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);
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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));
}
}
@@ -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<CommentZb> zbList = zbService.query(Cnd.NEW().and("id", "in", export.getZbIds()).asc("assessmentMode"));
return Map.of("export", export, "zbList", zbList);
}
@At
@Ok("void")
@RequiresPermissions("unionComment.exportZp")
public void doExport(String id, HttpServletResponse response) throws Exception {
CommentExport export = zbService.dao().fetch(CommentExport.class, id);
//查询测评有那几个工会测评过
Sql sql = Sqls.create("""
SELECT
un.id,
un.unionname unionName,
count( peo.id ) num
FROM
sys_union un
LEFT JOIN `user` u ON u.unionId = un.id
LEFT JOIN comment_peo peo ON peo.userId = u.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("peo.zbId", "in", export.getZbIds());
cnd.groupBy("un.id");
cnd.desc("count( peo.id )");
sql.setCondition(cnd);
List<NutMap> unionMap = zbService.listMap(sql);
List<CommentZb> zbs = zbService.query(Cnd.NEW().and("id", "in", export.getZbIds()).asc("assessmentMode"));
//创建临时文件夹
Path templateDir = Files.createTempDirectory("评测结果文件夹");
//循环分工会
for (NutMap un : unionMap) {
List<User> users = zbService.dao().query(User.class, Cnd.where("unionId", "=", un.getString("id")));
FileOutputStream outputStream = new FileOutputStream(templateDir.toString() + "/" + un.getString("unionName") + "基层工会会员评家民主测评结果报告表.docx");
List<NutMap> zpxxList = new ArrayList<>();
for (CommentZb zb : zbs) {
Sql sqlps = Sqls.create("""
SELECT
SUM( CASE WHEN cp.reviewResult = '不满意' THEN 1 ELSE 0 END ) AS bmy,
SUM( CASE WHEN cp.reviewResult = '基本满意' THEN 1 ELSE 0 END ) AS jbmy,
SUM( CASE WHEN cp.reviewResult = '满意' THEN 1 ELSE 0 END ) AS my
FROM
comment_peo cp
LEFT JOIN `user` u ON u.id = cp.userId
$condition
""");
Cnd cndPs = Cnd.NEW();
cndPs.and("u.unionId", "=", un.getString("id"));
cndPs.and("cp.zbId", "=", zb.getId());
sqlps.setCondition(cndPs);
if (zb.getAssessmentMode() == 1) {
NutMap zpxx = new NutMap();
NutMap psMap = zbService.fetch(sqlps);
zpxx.setv("pcdx", "工会工作及职工之家建设情况测评");
zpxx.setv("my", psMap.getInt("my"));
zpxx.setv("jbmy", psMap.getInt("jbmy"));
zpxx.setv("bmy", psMap.getInt("bmy"));
zpxxList.add(zpxx);
} else {
NutMap zpxxZx = new NutMap();
Cnd clone = cndPs.clone();
sqlps.setCondition(clone);
clone.and("cp.evaluatedPersonType", "=", "分工会主席");
NutMap psMap = zbService.fetch(sqlps);
zpxxZx.setv("pcdx", "工会主席履职情况测评");
zpxxZx.setv("my", psMap.getInt("my"));
zpxxZx.setv("jbmy", psMap.getInt("jbmy"));
zpxxZx.setv("bmy", psMap.getInt("bmy"));
zpxxList.add(zpxxZx);
NutMap zpxxFzx = new NutMap();
Cnd clone2 = cndPs.clone();
clone2.and("cp.evaluatedPersonType", "=", "分工会副主席");
sqlps.setCondition(clone2);
NutMap psMap2 = zbService.fetch(sqlps);
zpxxFzx.setv("pcdx", "工会副主席履职情况测评");
zpxxFzx.setv("my", psMap2.getInt("my"));
zpxxFzx.setv("jbmy", psMap2.getInt("jbmy"));
zpxxFzx.setv("bmy", psMap2.getInt("bmy"));
zpxxList.add(zpxxFzx);
}
}
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
Configure config = Configure.newBuilder().bind("zpxxList", policy).build();
HashMap<String, Object> map = new HashMap<>();
map.put("zpxxList", zpxxList);
map.put("unionName", un.getString("unionName"));
map.put("num", users.size());
map.put("memberNum", users.stream().filter(v -> v.getMember() == 1).collect(Collectors.toList()).size());
// XWPFTemplate.compile(officeTemplateUtil.getPath("unionComment"), config).render(map).writeAndClose(outputStream);
outputStream.close();
}
//压缩
File zipFile = ZipUtil.zip(templateDir.toString());
response.setHeader("content-disposition", "attachment;filename="
+ URLEncoder.encode(zipFile.getName(), "UTF-8"));
try (ServletOutputStream outputStream = response.getOutputStream();
FileInputStream zipFis = new FileInputStream(zipFile);) {
IOUtils.copy(zipFis, outputStream);
} catch (Exception e) {
e.printStackTrace();
} finally {
FileUtil.del(templateDir);
FileUtil.del(zipFile);
}
}
}
@@ -0,0 +1,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<CommentPeo> 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<CommentPeo> 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<Sys_file> 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<Sys_file> 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<CommentPeo> peoList = commentPeoService.dao().query(CommentPeo.class, Cnd.where("zbId", "=", zbId));
// Map<String, List<CommentPeo>> collect = peoList.stream().collect(Collectors.groupingBy(CommentPeo::getUnionId));
}
}
@@ -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<CommentNr> query = commentNrService.query(Cnd.where("zb_id", "=", id));
for (CommentNr kh_nr : query) {
commentBzService.clear(Cnd.where("nr_id", "=", kh_nr.getId()));
}
commentNrService.clear(Cnd.where("zb_id", "=", id));
return null;
}
@At
@ViReturn
public Object edit(String id) {
return commentZbService.khzb(id);
}
@At
@ViReturn
@RequiresPermissions("wakeshome.review.khzb")
@Aop(TransAop.READ_COMMITTED)
public Object doEdit(@Param(value = "kh_zb") CommentZb commentZb) {
commentZbService.updateIgnoreNull(commentZb);
List<CommentNr> query = commentNrService.query(Cnd.where("zb_id", "=", commentZb.getId()));
for (CommentNr kh_nr : query) {
commentBzService.clear(Cnd.where("nr_id", "=", kh_nr.getId()));
}
commentNrService.clear(Cnd.where("zb_id", "=", commentZb.getId()));
List<CommentNr> 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<CommentBz> 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;
}
}
@@ -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<NutMap> list = pagination.getList();
List<Sys_union> 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<String> 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();
}
}
@@ -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<NutMap> list = pagination.getList();
List<Sys_union> 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<String> 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<CommentResult> 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<NutMap> 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);
}
}
@@ -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> awardInfo;
@Column
@Comment("图片文件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> picFiles;
@Column
@Comment("附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> 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;
}
}
@@ -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;
}
@@ -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<Sys_file> files;
}
@@ -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;
}
@@ -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;
}
@@ -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<String> zbIds;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String createTime;
}
@@ -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<CommentBz> 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;
}
@@ -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<CommentResult> resultList;
@Column
@Comment("自我测评的附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
}
@@ -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;
}
@@ -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<CommentNr> 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<String> 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;
}
@@ -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<WakesHomeApply> {
NutMap findById(String id);
void setParams(WakesHomeApply wakesHomeApply);
}
@@ -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<WakesHome> {
}
@@ -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<WakesHomeApply> 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());
}
}
@@ -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<WakesHome> implements WakesHomeInfoService {
public WakesHomeInfoServiceImpl(Dao dao) {
super(dao);
}
}
@@ -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<CommentBz> implements CommentBzService {
public CommentBzServiceImpl(Dao dao) {
super(dao);
}
}
@@ -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<CommentNr> implements CommentNrService {
public CommentNrServiceImpl(Dao dao) {
super(dao);
}
}
@@ -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<CommentPeo> implements CommentPeoService {
public CommentPeoServiceImpl(Dao dao) {super(dao);}
@Inject
private BaseService baseService;
@Inject
private CommentZbService commentZbService;
/**
* 获取测评结果信息
* @param peoId 指标id
* @return
*/
@Override
public NutMap getBzById(String peoId) {
CommentPeo commentPeo = fetch(peoId);
List<CommentResult> query = baseService.dao().query(CommentResult.class, Cnd.where("peo_id","=",peoId));
//对测评标准分组
Map<String, CommentResult> commentResultMap = query.stream().collect(Collectors.toMap(v -> v.getBz_id(), v -> v));
//获取指标
CommentZb khzb = commentZbService.khzb(commentPeo.getZbId());
List<CommentNr> nrs = khzb.getNrs();
nrs.forEach(v->{
v.getBzs().forEach(o->{
//赋值测评结果
CommentResult result = commentResultMap.get(o.getId());
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;
}
}
@@ -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<CommentPeo> 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<NutMap> list = new ArrayList<>();
resultMap.put("schoolName", Globals.schoolName);
CommentZb khzb = map.getAs("zbxx", CommentZb.class);
List<CommentNr> nrs = khzb.getNrs();
nrs.forEach(v -> {
NutMap nutMap = NutMap.NEW();
List<CommentBz> bzs = v.getBzs();
String nr = bzs.stream().sorted(Comparator.comparing(CommentBz::getContentNumber)).map(item -> {
return item.getContentNumber() + "." + item.getInspection() + "(" + item.getScore() + "分)";
}).collect(Collectors.joining("\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();
}
}
}
@@ -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<CommentZb> implements CommentZbService {
public CommentZbServiceImpl(Dao dao) {
super(dao);
}
@Inject
private CommentNrService commentNrService;
private void setNrBz(List<CommentNr> nrs) {
for (CommentNr nr : nrs) {
nr = commentNrService.fetchLinks(nr, "bzs", Cnd.NEW().asc("location"));
}
}
@Override
public CommentZb khzb(String zbid) {
if (StrUtil.isBlank(zbid)) {
return null;
}
CommentZb zb = fetchLinks(fetch(zbid), "nrs", Cnd.NEW().asc("location"));
setNrBz(zb.getNrs());
return zb;
}
}
@@ -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<CommentBz> {
}
@@ -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<CommentNr> {
}
@@ -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<CommentPeo> {
/**
* 根据指标id和被测评人id查测评结果
* @param peoId 指标id
* @return
*/
NutMap getBzById(String peoId);
}
@@ -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<CommentPeo> {
void exportWord(CommentPeo peo, OutputStream outputStream);
}
@@ -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> {
CommentZb khzb(String zbid);
}
@@ -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<CommentBz> bzList;
private String reviewResult;
private String evaluatedPersonId;
private String evaluatedPersonName;
private String evaluatedPersonType;
private String presidentOpinions;
private List<Sys_file> files;
}

Some files were not shown because too many files have changed in this diff Show More