提交
This commit is contained in:
@@ -4,9 +4,10 @@ package io.v.nutz.hd.controller.ca;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.FileService;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.hd.models.Hd_ca_sbxx;
|
||||
import io.v.nutz.hd.services.*;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
@@ -18,7 +19,6 @@ import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
@@ -31,15 +31,8 @@ import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/hd/childhd/sczp")
|
||||
@@ -65,6 +58,9 @@ public class HdChildAddZpController {
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private FileService fileService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/hd/ca/zpMange.html")
|
||||
@RequiresPermissions("hd.child.sczp")
|
||||
@@ -76,21 +72,13 @@ public class HdChildAddZpController {
|
||||
* 获取当前人的工会name
|
||||
*/
|
||||
@At
|
||||
@RequiresPermissions("hd.child.sczp")
|
||||
public String getGhname() {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tgh.unionname AS ghname \n" +
|
||||
"FROM\n" +
|
||||
"\tsys_user u\n" +
|
||||
"\tLEFT JOIN sys_unit dw ON dw.id = u.unitid\n" +
|
||||
"\tLEFT JOIN sys_union gh ON gh.id = dw.unionid \n" +
|
||||
"WHERE\n" +
|
||||
"\tu.id = @userid");
|
||||
sql.setParam("userid", ShiroUtil.getPrincipalProperty("id"));
|
||||
List<Record> list = baseService.list(sql);
|
||||
return list.size() > 0 ? list.get(0).getString("ghname") : "";
|
||||
return Optional.ofNullable(Vi.getUnion()).map(v -> v.getUnionname()).orElse(null);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("hd.child.sczp")
|
||||
public Object initformHdxxlist() {
|
||||
try {
|
||||
Sql sql = Sqls.create("select * from hd_wm_xx where hdtype =2 and hdflag = 1 and hdkssj<=NOW() and hdjssj >=NOW()");
|
||||
@@ -101,52 +89,59 @@ public class HdChildAddZpController {
|
||||
}
|
||||
|
||||
@At
|
||||
public Object pageData(PageForm page, @Param("searchKeyword") String searchKeyword, @Param("searchName") String searchName, String hdid, String hdlb, String zplb, String unionId, String unitId,
|
||||
String pageOrderName, String pageOrderBy, String year) {
|
||||
@ViReturn
|
||||
public Object pageData(PageForm page,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "hdlb", required = false) String hdlb,
|
||||
@Param(value = "zplb", required = false) String zplb,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "year", required = false) String year) {
|
||||
try {
|
||||
Cnd cnd = CndPlus.create();
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\txx.*,\n" +
|
||||
"\tsbr.username AS sbrname,\n" +
|
||||
"\tsbr.loginname,\n" +
|
||||
"\thd.hdname,\n" +
|
||||
"\thd.hdkssj,\n" +
|
||||
"\thd.hdjssj,\n" +
|
||||
"\tzplb.zname as zplbname,\n" +
|
||||
"\tlb.lname as hdlbname,\n" +
|
||||
"\tdw.name as dwname,\n" +
|
||||
"\tgh.unionname as ghname\n" +
|
||||
"FROM\n" +
|
||||
"\thd_ca_sbxx xx\n" +
|
||||
"\tLEFT JOIN sys_user sbr ON sbr.id = xx.sbr\n" +
|
||||
"\tleft join sys_unit dw on dw.id = sbr.unitid\n" +
|
||||
"\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" +
|
||||
"\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" +
|
||||
"\tleft join hd_wm_zplb zplb on zplb.zid = xx.zplb\n" +
|
||||
"\tleft join hd_wm_lb lb on lb.lid = xx.hdlb $condition");
|
||||
cnd.and(new Static("1=1 and xx.hdid in (select hdid from hd_wm_xx where hdtype =2)"));
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
sbr.username AS sbrname,
|
||||
sbr.loginname,
|
||||
hd.hdname,
|
||||
hd.hdkssj,
|
||||
hd.hdjssj,
|
||||
zplb.zname as zplbname,
|
||||
lb.lname as hdlbname,
|
||||
dw.name as dwname,
|
||||
gh.unionname as ghname
|
||||
FROM
|
||||
hd_ca_sbxx xx
|
||||
LEFT JOIN sys_user sbr ON sbr.id = xx.sbr
|
||||
left join sys_unit dw on dw.id = sbr.unitid
|
||||
LEFT JOIN sys_union gh ON gh.id = dw.unionid
|
||||
left join hd_wm_xx hd on hd.hdid = xx.hdid
|
||||
left join hd_wm_zplb zplb on zplb.zid = xx.zplb
|
||||
left join hd_wm_lb lb on lb.lid = xx.hdlb
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("xx.hdid", "in", Sqls.create("select hdid from hd_wm_xx where hdtype =2"));
|
||||
if (!ShiroUtil.hasAnyRoles("H04,sysadmin")) {
|
||||
Vi.cndPlus(cnd, "xx.sbr", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and("xx.sbr", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
}
|
||||
Vi.cndPlus(cnd, "xx.hdid", "=", hdid);
|
||||
Vi.cndPlus(cnd, "xx.hdlb", "=", hdlb);
|
||||
Vi.cndPlus(cnd, "xx.zplb", "=", zplb);
|
||||
Vi.cndPlus(cnd, "dw.id", "=", unitId);
|
||||
Vi.cndPlus(cnd, "gh.id", "=", unionId);
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
cnd.andEX("xx.hdlb", "=", hdlb);
|
||||
cnd.andEX("xx.zplb", "=", zplb);
|
||||
cnd.andEX("dw.id", "=", unitId);
|
||||
cnd.andEX("gh.id", "=", unionId);
|
||||
cnd.andEX("YEAR(xx.sbsj)", "=", year);
|
||||
|
||||
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
|
||||
cnd.where().andLike(page.getSearchName(), page.getSearchKeyword());
|
||||
}
|
||||
if (Strings.isNotBlank(year)) {
|
||||
Vi.cndPlus(cnd, "YEAR(xx.sbsj)", "=", year);
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, pageOrderBy.equals("asc") ? "asc" : "desc");
|
||||
if (Strings.isNotBlank(page.getPageOrderName()) && Strings.isNotBlank(page.getPageOrderBy())) {
|
||||
cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("sbr.username");
|
||||
cnd.desc("gh.unionname");
|
||||
cnd.desc("dw.name");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPage(page.getPageNumber(), page.getPageSize(), sql);
|
||||
return Result.success().addData(pagination);
|
||||
@@ -156,12 +151,10 @@ public class HdChildAddZpController {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
private FileService fileService;
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object doSubmit(@Param("data") String data, @Param("file") TempFile[] files) {
|
||||
@RequiresPermissions("hd.child.sczp")
|
||||
public Object doSubmit(@Param("data") String data, @Param(value = "file", required = false) TempFile[] files, boolean flag) {
|
||||
try {
|
||||
Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data);
|
||||
sbxx.setSbr(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
@@ -179,7 +172,8 @@ public class HdChildAddZpController {
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object doEdit(@Param("data") String data, String readytodelfile, @Param("file") TempFile[] files) {
|
||||
@RequiresPermissions("hd.child.sczp")
|
||||
public Object doEdit(@Param("data") String data, String readytodelfile, @Param(value = "file", required = false) TempFile[] files) {
|
||||
try {
|
||||
Hd_ca_sbxx sbxx = Json.fromJson(Hd_ca_sbxx.class, data);
|
||||
hdCasbxxService.updateIgnoreNull(sbxx);
|
||||
@@ -198,6 +192,8 @@ public class HdChildAddZpController {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("hd.child.sczp")
|
||||
public Object findOne(String id) {
|
||||
try {
|
||||
Hd_ca_sbxx sbxx = hdCasbxxService.fetch(id);
|
||||
@@ -236,26 +232,4 @@ public class HdChildAddZpController {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void previewPhoto(String url, HttpServletResponse response) {
|
||||
try {
|
||||
String canonicalPath = new File("").getCanonicalPath();
|
||||
File file = new File(canonicalPath + "/" + url);
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
OutputStream out = response.getOutputStream();
|
||||
byte[] bs = new byte[1024];
|
||||
while ((fis.read(bs) != -1)) {
|
||||
out.write(bs);
|
||||
}
|
||||
out.flush();
|
||||
out.close();
|
||||
out = null;
|
||||
fis.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@ package io.v.nutz.hd.controller.ca;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.ExcelUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
@@ -15,6 +18,7 @@ import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
@@ -26,57 +30,53 @@ import java.util.List;
|
||||
@Ok("json:full")
|
||||
public class HdChildHjxxController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("re")
|
||||
@Ok("beetl:/platform/hd/ca/hjxxyl.html")
|
||||
@RequiresPermissions("hd.child.hjxx")
|
||||
public String index() {
|
||||
return "beetl:/platform/hd/ca/hjxxyl.html";
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String hdid, String searchName, String searchKeyword) {
|
||||
@RequiresPermissions("hd.child.hjxx")
|
||||
@ViReturn
|
||||
public Object pageData(@Param(value = "union", required = false) String union,
|
||||
@Param(value = "unit", required = false) String unit,
|
||||
Integer pageNumber,
|
||||
Integer pageSize,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("select DISTINCT(xx.sbr),sbr.loginname,sbr.username,dw.name as dwname,gh.unionname as ghname,\n" +
|
||||
"(SELECT COUNT(DISTINCT(a.zplb)) FROM hd_ca_sbxx a WHERE a.sbr = xx.sbr AND a.hdid = @hdid) as hjcount\n" +
|
||||
"from hd_ca_sbxx xx\n" +
|
||||
"left join sys_user sbr on sbr.id = xx.sbr\n" +
|
||||
"left join sys_unit dw on dw.id = sbr.unitid\n" +
|
||||
"LEFT JOIN sys_union gh ON gh.id = dw.unionid\n" +
|
||||
"where xx.hdid in (select hdid from hd_wm_xx where hdtype =2)");
|
||||
sb.append("\tand xx.hdid = @hdid");
|
||||
Sql sql = Sqls.create("""
|
||||
select DISTINCT(xx.sbr),
|
||||
sbr.loginname,
|
||||
sbr.username,
|
||||
dw.name as dwname,
|
||||
gh.unionname as ghname,
|
||||
(SELECT COUNT(DISTINCT(a.zplb)) FROM hd_ca_sbxx a WHERE a.sbr = xx.sbr AND a.hdid = @hdid) as hjcount
|
||||
FROM hd_ca_sbxx xx
|
||||
LEFT JOIN sys_user sbr on sbr.id = xx.sbr
|
||||
LEFT JOIN sys_unit dw on dw.id = sbr.unitid
|
||||
LEFT JOIN sys_union gh ON gh.id = dw.unionid
|
||||
$condition
|
||||
""").setParam("hdid", hdid);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||
sb.append("\tAND gh.id IN (\n" +
|
||||
"\tSELECT\n" +
|
||||
"\t\tgh.id \n" +
|
||||
"\tFROM\n" +
|
||||
"\t\tsys_user u\n" +
|
||||
"\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" +
|
||||
"\tLEFT JOIN sys_union gh ON gh.id = n.unionid where u.id = @cuserid)");
|
||||
cnd.and("gh.id", "=", Vi.getUnionId());
|
||||
}
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
sb.append("\tand\t" + searchName + "\tlike @searchKeyword");
|
||||
cnd.and(Cnd.likeEX(searchName, searchKeyword));
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(union)) {
|
||||
sb.append(" AND dw.unionid = @union");
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(unit)) {
|
||||
sb.append(" AND dw.id = @unit");
|
||||
}
|
||||
|
||||
sb.append(" ORDER BY sbr.username,dw.name,gh.unionname");
|
||||
Sql sql = Sqls.create(sb.toString());
|
||||
sql.setParam("hdid", hdid);
|
||||
sql.setParam("union", union);
|
||||
sql.setParam("unit", unit);
|
||||
sql.setParam("searchKeyword", "%" + searchKeyword + "%");
|
||||
sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and("xx.hdid", "=", hdid);
|
||||
cnd.andEX("dw.unionid", "=", union);
|
||||
cnd.andEX("dw.id", "=", unit);
|
||||
cnd.asc("sbr.username").asc("gh.unioncode").asc("dw.unitcode");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
|
||||
return Result.success().addData(pagination);
|
||||
} catch (Exception e) {
|
||||
@@ -86,6 +86,8 @@ public class HdChildHjxxController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("hd.child.hjxx")
|
||||
@ViReturn
|
||||
public void exportExcel(int num, String hdid, HttpServletResponse response) {
|
||||
HSSFWorkbook wb = null;
|
||||
String fileName = "";
|
||||
|
||||
@@ -1,25 +1,30 @@
|
||||
package io.v.nutz.hd.controller.ca;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.ExcelUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.hd.services.HdCasbxxFjService;
|
||||
import io.v.nutz.hd.services.HdWmsbxxService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
@@ -39,13 +44,13 @@ public class HdChildZpxxController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private HdCasbxxFjService hdCasbxxFjService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/hd/ca/zpxx.html")
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@@ -54,6 +59,9 @@ public class HdChildZpxxController {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@ViReturn
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object dodelete(String id) {
|
||||
try {
|
||||
baseService.clear("hd_ca_sbxx", Cnd.where("id", "=", id));
|
||||
@@ -65,9 +73,15 @@ public class HdChildZpxxController {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@ViReturn
|
||||
public Object initHdxxlist() {
|
||||
try {
|
||||
List<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>>();
|
||||
|
||||
Map<Integer, List<Record>> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getInt("year")));
|
||||
@@ -89,6 +103,8 @@ public class HdChildZpxxController {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@ViReturn
|
||||
public Object gethdlblist(String id) {
|
||||
try {
|
||||
List list = baseService.list(Sqls.create("select * from hd_wm_lb where lhdid = @id").setParam("id", id));
|
||||
@@ -99,6 +115,8 @@ public class HdChildZpxxController {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@ViReturn
|
||||
public Object gethdzplblist(String id) {
|
||||
try {
|
||||
List list = baseService.list(Sqls.create("select * from hd_wm_zplb where zlid = @id").setParam("id", id));
|
||||
@@ -109,72 +127,59 @@ public class HdChildZpxxController {
|
||||
}
|
||||
|
||||
@At
|
||||
public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String hdid, String hdlb, String zplb,
|
||||
String year) {
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@ViReturn
|
||||
public Object pageData(@Param(value = "union", required = false) String union,
|
||||
@Param(value = "unit", required = false) String unit,
|
||||
Integer pageNumber,
|
||||
Integer pageSize,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "hdlb", required = false) String hdlb,
|
||||
@Param(value = "zplb", required = false) String zplb,
|
||||
@Param(value = "year", required = false) String year) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("SELECT\n" +
|
||||
"\txx.*,\n" +
|
||||
"\tsbr.username AS sbrname,\n" +
|
||||
"\tsbr.loginname,\n" +
|
||||
"\thd.hdname,\n" +
|
||||
"\thd.hdkssj,\n" +
|
||||
"\thd.hdjssj,\n" +
|
||||
"\tzplb.zname as zplbname,\n" +
|
||||
"\tlb.lname as hdlbname,\n" +
|
||||
"\tdw.name as dwname,\n" +
|
||||
"\tgh.unionname as ghname\n" +
|
||||
"FROM\n" +
|
||||
"\thd_ca_sbxx xx\n" +
|
||||
"\tLEFT JOIN sys_user sbr ON sbr.id = xx.sbr\n" +
|
||||
"\tleft join sys_unit dw on dw.id = sbr.unitid\n" +
|
||||
"\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" +
|
||||
"\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" +
|
||||
"\tleft join hd_wm_zplb zplb on zplb.zid = xx.zplb\n" +
|
||||
"\tleft join hd_wm_lb lb on lb.lid = xx.hdlb where 1=1");
|
||||
sb.append("\tand xx.hdid in (select hdid from hd_wm_xx where hdtype =2)");
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
sbr.username AS sbrname,
|
||||
sbr.loginname,
|
||||
hd.hdname,
|
||||
hd.hdkssj,
|
||||
hd.hdjssj,
|
||||
zplb.zname as zplbname,
|
||||
lb.lname as hdlbname,
|
||||
dw.name as dwname,
|
||||
gh.unionname as ghname
|
||||
FROM
|
||||
hd_ca_sbxx xx
|
||||
LEFT JOIN sys_user sbr ON sbr.id = xx.sbr
|
||||
left join sys_unit dw on dw.id = sbr.unitid
|
||||
LEFT JOIN sys_union gh ON gh.id = dw.unionid
|
||||
left join hd_wm_xx hd on hd.hdid = xx.hdid
|
||||
left join hd_wm_zplb zplb on zplb.zid = xx.zplb
|
||||
left join hd_wm_lb lb on lb.lid = xx.hdlb
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("xx.hdid", "in", Sqls.create("select hdid from hd_wm_xx where hdtype =2"));
|
||||
cnd.andEX("dw.unionid", "=", union);
|
||||
cnd.andEX("dw.id", "=", unit);
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
cnd.andEX("xx.hdlb", "=", hdlb);
|
||||
cnd.andEX("xx.zplb", "=", zplb);
|
||||
cnd.andEX("YEAR(xx.sbsj)", "=", year);
|
||||
|
||||
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||
sb.append("\tand gh.id in (select gh.id from sys_user u \n" +
|
||||
"left join sys_unit n on n.id = u.unitid\n" +
|
||||
"left join sys_union gh ON gh.id = n.unionid\n" +
|
||||
"where u.id = @cuserid)");
|
||||
cnd.and("gh.id", "=", Vi.getUnionId());
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(union)) {
|
||||
sb.append(" AND dw.unionid = @union");
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(unit)) {
|
||||
sb.append(" AND dw.id = @unit");
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(hdid)) {
|
||||
sb.append("\tand xx.hdid = @hdid");
|
||||
}
|
||||
if (Strings.isNotBlank(hdlb)) {
|
||||
sb.append("\tand xx.hdlb = @hdlb");
|
||||
}
|
||||
if (Strings.isNotBlank(zplb)) {
|
||||
sb.append("\tand xx.zplb = @zplb");
|
||||
}
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
sb.append("\tand\t" + searchName + "\tlike @searchKeyword");
|
||||
cnd.and(Cnd.likeEX(searchName, searchKeyword));
|
||||
}
|
||||
if (Strings.isNotBlank(year)) {
|
||||
sb.append("""
|
||||
\tand YEAR(xx.sbsj) = @year
|
||||
""");
|
||||
}
|
||||
sb.append("\tORDER BY sbr.username,gh.unionname,dw.name");
|
||||
Sql sql = Sqls.create(sb.toString());
|
||||
sql.setParam("union", union);
|
||||
sql.setParam("unit", unit);
|
||||
sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id"));
|
||||
sql.setParam("hdid", hdid);
|
||||
sql.setParam("hdlb", hdlb);
|
||||
sql.setParam("zplb", zplb);
|
||||
sql.setParam("year", year);
|
||||
sql.setParam("searchKeyword", "%" + searchKeyword + "%");
|
||||
cnd.asc("sbr.username").asc("gh.unioncode").asc("dw.unitcode");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
|
||||
return Result.success().addData(pagination);
|
||||
} catch (Exception e) {
|
||||
@@ -184,6 +189,8 @@ public class HdChildZpxxController {
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@ViReturn
|
||||
public Object findOneById(String id) {
|
||||
List<Record> fjList = baseService.dao().query("sys_file", Cnd.where("reid", "=", id));
|
||||
return Result.success().addData(fjList);
|
||||
@@ -191,6 +198,8 @@ public class HdChildZpxxController {
|
||||
|
||||
@At("/exportExcel")
|
||||
@Ok("void")
|
||||
@RequiresPermissions("hd.child.zpxx")
|
||||
@ViReturn
|
||||
public void exportExcel(HttpServletResponse response, String hdid, String hdname) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("SELECT\n" +
|
||||
|
||||
@@ -2,13 +2,10 @@ package io.v.nutz.hd.controller.ca;
|
||||
|
||||
|
||||
|
||||
import io.v.nutz.hd.services.*;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
@@ -27,6 +24,7 @@ public class HdCnMangeController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/hd/ca/mobileBox.html")
|
||||
@RequiresPermissions("hd.ca.hdmange")
|
||||
public void mobileBox() {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.hd.models.Hd_ca_sbxx;
|
||||
import io.v.nutz.hd.models.Hd_ca_sbxx_fj;
|
||||
import io.v.nutz.hd.services.HdCasbxxFjService;
|
||||
import io.v.nutz.service.ViService;
|
||||
import io.v.nutz.hd.services.HdCasbxxService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.service.ViService;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -15,7 +16,6 @@ import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Files;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
@@ -25,11 +25,8 @@ import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: V
|
||||
|
||||
@@ -3,6 +3,8 @@ package io.v.nutz.hd.controller.wmhd;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.FileService;
|
||||
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
||||
import io.v.nutz.hd.services.HdWmLbService;
|
||||
@@ -10,7 +12,6 @@ import io.v.nutz.hd.services.HdWmZplbService;
|
||||
import io.v.nutz.hd.services.HdWmsbxxService;
|
||||
import io.v.nutz.hd.services.HdWmsbxxfjService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -20,7 +21,6 @@ import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
@@ -37,7 +37,6 @@ import java.util.Map;
|
||||
@IocBean
|
||||
@At("/platform/hd/jzghd/sczp")
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public class HdJzgAddZpController {
|
||||
|
||||
@Inject
|
||||
@@ -67,11 +66,12 @@ public class HdJzgAddZpController {
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object doSubmit(@Param("data") String data, @Param("file") TempFile[] files) {
|
||||
public Object doSubmit(@Param("data") String data, @Param(value = "file", required = false) TempFile[] files, boolean flag) {
|
||||
try {
|
||||
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
|
||||
sbxx.setHdsbrid(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
sbxx.setHdsbsj(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
|
||||
sbxx.setHdsbsj(DateUtil.getDateTime());
|
||||
sbxx.setAuditState(flag ? "4400" : "3999");
|
||||
Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
|
||||
|
||||
for (TempFile file : files) {
|
||||
@@ -86,14 +86,15 @@ public class HdJzgAddZpController {
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Object doEdit(@Param("data") String data, String readytodelfile, @Param("file") TempFile[] files) {
|
||||
public Object doEdit(@Param("data") String data, String readytodelfile, @Param(value = "file", required = false) TempFile[] files, boolean flag) {
|
||||
try {
|
||||
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
|
||||
sbxx.setAuditState(flag ? "4400" : "3999");
|
||||
hdWmsbxxService.updateIgnoreNull(sbxx);
|
||||
|
||||
List<String> dellist = Json.fromJsonAsList(String.class, readytodelfile);
|
||||
for (String f : dellist) {
|
||||
fileService.delete(f, null);
|
||||
fileService.delete(f, f);
|
||||
}
|
||||
for (TempFile file : files) {
|
||||
fileService.upload(file, sbxx.getId(), "/hd/hdwm/");
|
||||
@@ -106,46 +107,47 @@ public class HdJzgAddZpController {
|
||||
|
||||
|
||||
@At
|
||||
public Object pageData(Integer pageNumber, Integer pageSize, String hdid, String hdlb, String zplb) {
|
||||
@ViReturn
|
||||
public Object pageData(Integer pageNumber,
|
||||
Integer pageSize,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "hdlb", required = false) String hdlb,
|
||||
@Param(value = "zplb", required = false) String zplb) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("SELECT\n" +
|
||||
"\txx.*,\n" +
|
||||
"\tsbr.username AS sbrname,\n" +
|
||||
"\tsbr.loginname,\n" +
|
||||
"\thd.hdname,\n" +
|
||||
"\thd.hdkssj,\n" +
|
||||
"\thd.hdjssj,\n" +
|
||||
"\tdw.name as dwname,\n" +
|
||||
"\tgh.unionname as ghname,\n" +
|
||||
"\thdlb.lname as hdlbname,\n" +
|
||||
"\tzplb.zname as zplbname\n" +
|
||||
"FROM\n" +
|
||||
"\thd_wm_sbxx xx\n" +
|
||||
"\tLEFT JOIN sys_user sbr ON sbr.id = xx.hdsbrid\n" +
|
||||
"\tleft join sys_unit dw on dw.id = sbr.unitid\n" +
|
||||
"\tLEFT JOIN sys_union gh ON gh.id = dw.unionid\n" +
|
||||
"\tLEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx\n" +
|
||||
"\tLEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2\n" +
|
||||
"\tleft join hd_wm_xx hd on hd.hdid = xx.hdid\n" +
|
||||
"\twhere 1=1");
|
||||
sb.append("\tand xx.hdid in (select hdid from hd_wm_xx where hdtype =1)");
|
||||
sb.append("\tand xx.hdsbrid = @userid");
|
||||
if (Strings.isNotBlank(hdid)) {
|
||||
sb.append("\tand xx.hdid = @hdid");
|
||||
}
|
||||
if (Strings.isNotBlank(hdlb)) {
|
||||
sb.append("\tand xx.hdzplx = @hdlb");
|
||||
}
|
||||
if (Strings.isNotBlank(zplb)) {
|
||||
sb.append("\tand xx.hdzplx2 = @zplb");
|
||||
}
|
||||
sb.append("\tORDER BY sbr.username,gh.unionname,dw.name");
|
||||
Sql sql = Sqls.create(sb.toString());
|
||||
sql.setParam("userid", ShiroUtil.getPrincipalProperty("id"));
|
||||
sql.setParam("hdid", hdid);
|
||||
sql.setParam("hdlb", hdlb);
|
||||
sql.setParam("zplb", zplb);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
sbr.username AS sbrname,
|
||||
sbr.loginname,
|
||||
hd.hdname,
|
||||
hd.hdkssj,
|
||||
hd.hdjssj,
|
||||
dw.name as dwname,
|
||||
gh.unionname as ghname,
|
||||
hdlb.lname as hdlbname,
|
||||
zplb.zname as zplbname,
|
||||
state.stateColor,
|
||||
state.stateName,
|
||||
( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id ) dz_znum
|
||||
FROM
|
||||
hd_wm_sbxx xx
|
||||
LEFT JOIN sys_user sbr ON sbr.id = xx.hdsbrid
|
||||
left join sys_unit dw on dw.id = sbr.unitid
|
||||
LEFT JOIN sys_union gh ON gh.id = dw.unionid
|
||||
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx
|
||||
LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2
|
||||
left join hd_wm_xx hd on hd.hdid = xx.hdid
|
||||
LEFT JOIN audit_state state ON state.stateId = xx.auditState
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("xx.hdid", "in", Sqls.create("select hdid from hd_wm_xx where hdtype =1"));
|
||||
cnd.and("xx.hdsbrid", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
cnd.andEX("xx.hdlb", "=", hdlb);
|
||||
cnd.andEX("xx.zplb", "=", zplb);
|
||||
cnd.desc("sbr.username").desc("gh.unionname").desc("dw.name");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
|
||||
return Result.success().addData(pagination);
|
||||
} catch (Exception e) {
|
||||
@@ -189,5 +191,14 @@ public class HdJzgAddZpController {
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
public Object gethdzplblist(String id) {
|
||||
try {
|
||||
return Result.success().addData(hdWmZplbService.query(Cnd.where("zlid", "=", id)));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.v.nutz.hd.controller.wmhd;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.FileService;
|
||||
@@ -7,14 +8,18 @@ import io.v.nutz.hd.models.Hd_wm_lb;
|
||||
import io.v.nutz.hd.models.Hd_wm_xx;
|
||||
import io.v.nutz.hd.models.Hd_wm_zplb;
|
||||
import io.v.nutz.hd.services.*;
|
||||
import io.v.nutz.sys.services.SysMsgService;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
@@ -59,6 +64,7 @@ public class HdMangeController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/hd/wmhd/mobileBox.html")
|
||||
@RequiresPermissions("hd.wmhd.hdmange")
|
||||
public void mobileBox() {
|
||||
|
||||
}
|
||||
@@ -74,12 +80,18 @@ public class HdMangeController {
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
@SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集新增")
|
||||
@RequiresPermissions("hd.wmhd.hdmange")
|
||||
public Object doAdd(@Param("hdxx") Hd_wm_xx hdWmXx) {
|
||||
Trans.exec(() -> {
|
||||
|
||||
|
||||
hdWmXx.setHdcjr(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
hdWmXx.setHdcjsj(sdf.format(new Date()));
|
||||
hdWmXx.setHdflag(false);
|
||||
@@ -97,13 +109,15 @@ public class HdMangeController {
|
||||
hdWmZplbService.insert(zplbs.get(j));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Object data(String hdname, Integer hdtype, int pageNumber, int pageSize, Integer year) {
|
||||
public Object data(@Param(value = "hdname", required = false) String hdname, @Param(value = "hdtype", required = false) Integer hdtype, @Param(value = "year", required = false) Integer year, int pageNumber, int pageSize) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT hd.*,u.`username` cjr FROM hd_wm_xx hd LEFT JOIN sys_user u ON hd.hdcjr = u.`id` $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
@@ -114,6 +128,9 @@ public class HdMangeController {
|
||||
if (year != null) {
|
||||
cnd.and("YEAR(hdcjsj)", "=", year);
|
||||
}
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("hd.hdcjr", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
cnd.desc("hdcjsj");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(hdWmxxService.listPage(pageNumber, pageSize, sql));
|
||||
@@ -124,10 +141,12 @@ public class HdMangeController {
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集删除")
|
||||
@RequiresPermissions("hd.wmhd.hdmange")
|
||||
public Object delete(String hdid) {
|
||||
try {
|
||||
String path = new File("").getCanonicalPath();
|
||||
|
||||
hdWmZplbService.execute(Sqls.create("DELETE FROM `hd_wm_zplb` WHERE zlid IN (SELECT lb.`lid` FROM hd_wm_lb lb WHERE lb.`lhdid`=@hdid)").setParam("hdid", hdid));
|
||||
hdWmLbService.clear(Cnd.where("lhdid", "=", hdid));
|
||||
|
||||
@@ -145,7 +164,7 @@ public class HdMangeController {
|
||||
hdWmsbxxService.execute(Sqls.create("DELETE FROM `hd_wm_sbxx` WHERE `hdid`=@hdid").setParam("hdid", hdid));
|
||||
|
||||
hdWmxxService.delete(hdid);
|
||||
|
||||
sysMsgService.deleteMsg(hdid);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -155,6 +174,8 @@ public class HdMangeController {
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
|
||||
@RequiresPermissions("hd.wmhd.hdmange")
|
||||
public Object changeStatus(String hdid, Boolean flag) {
|
||||
try {
|
||||
Hd_wm_xx hdWmXx = hdWmxxService.fetch(hdid);
|
||||
@@ -184,10 +205,12 @@ public class HdMangeController {
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@RequiresAuthentication
|
||||
@SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集修改")
|
||||
@RequiresPermissions("hd.wmhd.hdmange")
|
||||
@ViReturn
|
||||
public Object doEdit(@Param("hdxx") Hd_wm_xx hdWmXx) {
|
||||
Trans.exec(() -> {
|
||||
|
||||
hdWmxxService.update(hdWmXx);
|
||||
List<String> lbids = new ArrayList<>();
|
||||
List<String> zpLbids = new ArrayList<>();
|
||||
@@ -226,8 +249,29 @@ public class HdMangeController {
|
||||
hdWmZplbService.insertOrUpdate(zplbs.get(j));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getUserActivityGroup() {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT * FROM hd_wm_xx WHERE activityGroupId in (SELECT groupId FROM `activity_user_scope` $condition)
|
||||
""");
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
cnd.and("hdkssj","<=", DateUtil.now());
|
||||
cnd.and("hdjssj",">=", DateUtil.now());
|
||||
sql.setCondition(cnd);
|
||||
return hdWmsbxxService.listMap(sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.v.nutz.hd.controller.wmhd;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
@@ -22,9 +21,9 @@ import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,7 +44,14 @@ public class HdWmHjInfoController {
|
||||
@At("/pageData")
|
||||
@Ok("json")
|
||||
@ViReturn
|
||||
public Object pageData(String year, String union, String unit, PageForm pageForm, String hdid, String searchName, String searchKeyword) {
|
||||
@RequiresPermissions("hd.wmhd.hjxx1")
|
||||
public Object pageData(@Param(value = "year", required = false) String year,
|
||||
@Param(value = "union", required = false) String union,
|
||||
@Param(value = "unit", required = false) String unit,
|
||||
PageForm pageForm,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT DISTINCT
|
||||
@@ -54,7 +60,7 @@ public class HdWmHjInfoController {
|
||||
u.loginname,
|
||||
n.NAME AS dwname,
|
||||
gh.unionname AS ghname,
|
||||
( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid ) AS hjcount
|
||||
( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid AND auditState=4400) AS hjcount
|
||||
FROM
|
||||
hd_wm_sbxx xx
|
||||
LEFT JOIN sys_user u ON u.id = xx.hdsbrid
|
||||
@@ -66,7 +72,8 @@ public class HdWmHjInfoController {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
cnd.andEX("YEAR(xx.hdsbsj)", "=", year);
|
||||
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.andEX("xx.auditState", "=", 4400);
|
||||
if (!ShiroUtil.hasRole("H10") && !ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.andEX("gh.id", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("n.unionid", "=", union);
|
||||
@@ -84,9 +91,8 @@ public class HdWmHjInfoController {
|
||||
|
||||
@At("/exportExcel")
|
||||
@Ok("void")
|
||||
@RequiresPermissions("hd.wmhd.hjxx1")
|
||||
public void exportExcel(Integer num, String hdid, HttpServletResponse response) {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
|
||||
if (num == 1) {
|
||||
Sql sql = Sqls.create("""
|
||||
@@ -96,7 +102,7 @@ public class HdWmHjInfoController {
|
||||
u.loginname,
|
||||
n.NAME AS dwname,
|
||||
gh.unionname AS ghname,
|
||||
( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid ) AS hjcount
|
||||
( SELECT COUNT( DISTINCT ( a.hdzplx )) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid` and a.hdid = @hdid AND a.auditState=4400) AS hjcount
|
||||
FROM
|
||||
hd_wm_sbxx xx
|
||||
LEFT JOIN sys_user u ON u.id = xx.hdsbrid
|
||||
@@ -107,6 +113,7 @@ public class HdWmHjInfoController {
|
||||
sql.setParam("hdid", hdid);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
cnd.andEX("xx.auditState", "=", 4400);
|
||||
cnd.asc("u.username").asc("n.name").asc("gh.unionname");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> winnerList = hdWmsbxxService.listMap(sql);
|
||||
@@ -119,8 +126,8 @@ public class HdWmHjInfoController {
|
||||
exportEntities.add(new ExcelExportEntity("获奖次数", "hjcount", 20));
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, "获奖人员名单.xlsx");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, winnerList);
|
||||
ViTool.excelResponse(response, "获奖人员名单.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, winnerList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -136,9 +143,11 @@ public class HdWmHjInfoController {
|
||||
LEFT JOIN `user` u ON u.unionid = gh.id
|
||||
LEFT JOIN hd_wm_sbxx sbxx ON sbxx.hdsbrid = u.id
|
||||
AND sbxx.hdid = @hdid
|
||||
AND sbxx.auditState = @auditState
|
||||
$condition
|
||||
""");
|
||||
sql.setParam("hdid", hdid);
|
||||
sql.setParam("auditState", 4400);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("gh.id");
|
||||
cnd.asc("gh.unioncode");
|
||||
@@ -150,128 +159,13 @@ public class HdWmHjInfoController {
|
||||
exportEntities.add(new ExcelExportEntity("应发奖品数", "prizeNum", 20));
|
||||
|
||||
try {
|
||||
ViTool.excelResponse(response, "分工会获奖信息.xlsx");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, unionList);
|
||||
ViTool.excelResponse(response, "分工会获奖信息.xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, unionList);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// HSSFWorkbook wb = null;
|
||||
// String fileName = "";
|
||||
// if (num == 1) {
|
||||
// StringBuffer sbsql = new StringBuffer();
|
||||
// sbsql.append("SELECT DISTINCT ( xx.hdsbrid ),u.username,u.loginname,n.NAME AS dwname,gh.unionname AS ghname,\n" +
|
||||
// "(SELECT COUNT(DISTINCT(a.hdzplx)) FROM hd_wm_sbxx a WHERE a.hdsbrid = xx.`hdsbrid`) as hjcount\n" +
|
||||
// "FROM hd_wm_sbxx xx LEFT JOIN sys_user u ON u.id = xx.hdsbrid\n" +
|
||||
// " LEFT JOIN sys_unit n ON n.id = u.unitid\n" +
|
||||
// " LEFT JOIN sys_union gh ON gh.id = n.unionid\n" +
|
||||
// " WHERE 1=1 ");
|
||||
// sbsql.append("\tand xx.hdid = @hdid");
|
||||
// if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||
// sbsql.append("\tAND gh.id IN (\n" +
|
||||
// "\tSELECT\n" +
|
||||
// "\t\tgh.id \n" +
|
||||
// "\tFROM\n" +
|
||||
// "\t\tsys_user u\n" +
|
||||
// "\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" +
|
||||
// "\tLEFT JOIN sys_union gh ON gh.id = n.unionid where u.id = @cuserid)");
|
||||
// }
|
||||
// sbsql.append(" ORDER BY u.username,n.name,gh.unionname");
|
||||
// Sql sql = Sqls.create(sbsql.toString());
|
||||
// sql.setParam("hdid", hdid);
|
||||
// sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id"));
|
||||
// List<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.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Office2Pdf;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
||||
import io.v.nutz.hd.services.HdWmLbService;
|
||||
import io.v.nutz.hd.services.HdWmZplbService;
|
||||
import io.v.nutz.hd.services.HdWmsbxxService;
|
||||
import io.v.nutz.hd.services.HdWmsbxxfjService;
|
||||
import io.v.nutz.modules.models.Audit;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import io.v.nutz.web.commons.utils.FileUtil;
|
||||
import net.coobird.thumbnailator.Thumbnails;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.impl.PropertiesProxy;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
@@ -38,18 +42,23 @@ import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/hd/wmhd")
|
||||
public class HdWmInfoController {
|
||||
|
||||
@@ -71,6 +80,9 @@ public class HdWmInfoController {
|
||||
@Inject
|
||||
private HdWmsbxxfjService hdWmsbxxfjService;
|
||||
|
||||
@Inject
|
||||
protected PropertiesProxy conf;
|
||||
|
||||
private static final String imgnewdir = "upload/hd/hdwm/new/";
|
||||
|
||||
private String path = new File("").getCanonicalPath();
|
||||
@@ -105,7 +117,7 @@ public class HdWmInfoController {
|
||||
|
||||
@At("/getVideo")
|
||||
@Ok("void")
|
||||
@RequiresAuthentication
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public void getVideo(HttpServletRequest request, HttpServletResponse response, String filepath) {
|
||||
try {
|
||||
File file = new File(path + "\\" + filepath);
|
||||
@@ -148,7 +160,7 @@ public class HdWmInfoController {
|
||||
*/
|
||||
@At("/getNewImg")
|
||||
@Ok("void")
|
||||
@RequiresAuthentication
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public void getNewImg(HttpServletResponse response, String filepath) throws IOException {
|
||||
//图片格式
|
||||
String imgformat = filepath.substring(filepath.lastIndexOf(".") + 1, filepath.length());
|
||||
@@ -174,81 +186,71 @@ public class HdWmInfoController {
|
||||
|
||||
|
||||
@At("/pageData")
|
||||
@Ok("json")
|
||||
@RequiresAuthentication
|
||||
public Object pageData(String union, String unit, Integer pageNumber, Integer pageSize, String searchName, String searchKeyword, String hdid, String hdlb, String zplb,
|
||||
String year) {
|
||||
try {
|
||||
StringBuffer sbsql = new StringBuffer();
|
||||
sbsql.append("SELECT\n" +
|
||||
"\txx.id,\n" +
|
||||
"\txx.hdsbsj,\n" +
|
||||
"\txx.hdsbzpzt,\n" +
|
||||
"\txx.hdsbzpms,\n" +
|
||||
"\txx.hdzplx,\n" +
|
||||
"\txx.hdid,\n" +
|
||||
"\tu.username,\n" +
|
||||
"\tu.loginname,\n" +
|
||||
"\tu.mobile,\n" +
|
||||
"\tn.NAME AS 'dwname',\n" +
|
||||
"\tgh.unionname AS 'ghname',\n" +
|
||||
"\thdlb.lname as hdlbname,\n" +
|
||||
"\tzplb.zname as zplbname\n" +
|
||||
"FROM\n" +
|
||||
"\thd_wm_sbxx xx\n" +
|
||||
"\tLEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx\n" +
|
||||
"\tLEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2\n" +
|
||||
"\tLEFT JOIN sys_user u ON u.id = xx.hdsbrid\n" +
|
||||
"\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" +
|
||||
"\tLEFT JOIN sys_union gh ON gh.id = n.unionid where 1=1");
|
||||
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||
sbsql.append("\tAND gh.id IN (\n" +
|
||||
"\tSELECT\n" +
|
||||
"\t\tgh.id \n" +
|
||||
"\tFROM\n" +
|
||||
"\t\tsys_user u\n" +
|
||||
"\t\tLEFT JOIN sys_unit n ON n.id = u.unitid\n" +
|
||||
"\tLEFT JOIN sys_union gh ON gh.id = n.unionid where u.id = @cuserid)");
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(union)) {
|
||||
sbsql.append(" AND n.unionid = @union");
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(unit)) {
|
||||
sbsql.append(" AND n.id = @unit");
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
sbsql.append("\tand " + searchName + " like '%" + searchKeyword + "%'");
|
||||
}
|
||||
if (Strings.isNotBlank(hdid)) {
|
||||
sbsql.append("\tand xx.hdid = @hdid");
|
||||
}
|
||||
if (Strings.isNotBlank(hdlb)) {
|
||||
sbsql.append("\tand xx.hdzplx = @hdzplx");
|
||||
}
|
||||
if (Strings.isNotBlank(zplb)) {
|
||||
sbsql.append("\tand xx.hdzplx2 = @hdzplx2");
|
||||
}
|
||||
if (Strings.isNotBlank(year)) {
|
||||
sbsql.append("\tand YEAR(xx.hdsbsj) = @year");
|
||||
}
|
||||
|
||||
sbsql.append("\tORDER BY xx.hdsbsj desc,gh.unionname,n.name,u.username,xx.hdzplx");
|
||||
Sql sql = Sqls.create(sbsql.toString());
|
||||
sql.setParam("union", union);
|
||||
sql.setParam("unit", unit);
|
||||
sql.setParam("hdid", hdid);
|
||||
sql.setParam("hdzplx", hdlb);
|
||||
sql.setParam("hdzplx2", zplb);
|
||||
sql.setParam("cuserid", ShiroUtil.getPrincipalProperty("id"));
|
||||
sql.setParam("year", year);
|
||||
Pagination pagination = hdWmsbxxfjService.listPage(pageNumber, pageSize, sql);
|
||||
return Result.success().addData(pagination);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
@ViReturn
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public Object pageData(@Param(value = "union", required = false) String union,
|
||||
@Param(value = "unit", required = false) String unit,
|
||||
PageForm pageForm,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "hdlb", required = false) String hdlb,
|
||||
@Param(value = "zplb", required = false) String zplb,
|
||||
@Param(value = "year", required = false) String year,
|
||||
@Param(value = "isExcellent", required = false) Integer isExcellent,
|
||||
@Param(value = "stateId", required = false) Integer stateId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.id,
|
||||
xx.hdsbsj,
|
||||
xx.hdsbzpzt,
|
||||
xx.hdsbzpms,
|
||||
xx.hdzplx,
|
||||
xx.hdid,
|
||||
xx.isExcellent,
|
||||
wmxx.hdname,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.mobile,
|
||||
u.unitname AS 'dwname',
|
||||
u.unionname AS 'ghname',
|
||||
hdlb.lname AS hdlbname,
|
||||
zplb.zname AS zplbname,
|
||||
state.stateColor,
|
||||
state.stateName,
|
||||
( SELECT COUNT( dz.id )FROM hd_wm_dz_xx dz WHERE dz.zpid = xx.id) dz_num
|
||||
FROM
|
||||
hd_wm_sbxx xx
|
||||
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx
|
||||
LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2
|
||||
LEFT JOIN `user` u ON u.id = xx.hdsbrid
|
||||
LEFT JOIN audit_state state ON state.stateId = xx.auditState
|
||||
LEFT JOIN hd_wm_xx wmxx ON wmxx.hdid = xx.hdid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", union);
|
||||
cnd.andEX("u.unitid", "=", unit);
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
cnd.andEX("xx.hdzplx", "=", hdlb);
|
||||
cnd.andEX("xx.hdzplx2", "=", zplb);
|
||||
cnd.andEX("YEAR(xx.hdsbsj)", "=", year);
|
||||
cnd.andEX("xx.auditState", "=", stateId);
|
||||
cnd.andEX("xx.isExcellent", "=", isExcellent);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("dz_num").desc("xx.hdsbsj").asc("xx.auditState").asc("unioncode");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return hdWmsbxxfjService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -259,8 +261,6 @@ public class HdWmInfoController {
|
||||
* @return
|
||||
*/
|
||||
@At("/findOneById")
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public Object findOneById(String id) {
|
||||
try {
|
||||
// List<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")
|
||||
@RequiresAuthentication
|
||||
public void exportExcel(HttpServletResponse response, String hdid, String hdname) {
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public void exportWork(HttpServletResponse response,
|
||||
String hdid,
|
||||
String hdlb,
|
||||
String hdname,
|
||||
String zplb,
|
||||
String union,
|
||||
String unit,
|
||||
Integer isExcellent,
|
||||
String stateId) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.id,
|
||||
xx.hdsbzpzt,
|
||||
xx.hdzplx,
|
||||
xx.hdsbzpms,
|
||||
xx.hdsbsj,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.loginname,
|
||||
n.NAME AS dwname,
|
||||
gh.unionname AS ghname,
|
||||
u.unitname AS dwname,
|
||||
u.unionname AS ghname,
|
||||
hd.hdname as hdname,
|
||||
hdlb.lname as hdlbname,
|
||||
zplb.zname as zplbname
|
||||
@@ -294,62 +339,190 @@ public class HdWmInfoController {
|
||||
LEFT JOIN hd_wm_xx hd ON hd.hdid = xx.hdid
|
||||
LEFT JOIN hd_wm_lb hdlb ON hdlb.lid = xx.hdzplx
|
||||
LEFT JOIN hd_wm_zplb zplb ON zplb.zid = xx.hdzplx2
|
||||
LEFT JOIN sys_user u ON u.id = xx.hdsbrid
|
||||
LEFT JOIN sys_unit n ON n.id = u.unitid
|
||||
LEFT JOIN sys_union gh ON gh.id = n.unionid
|
||||
LEFT JOIN `user` u ON u.id = xx.hdsbrid
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("xx.hdid", "=", hdid);
|
||||
cnd.andEX("xx.hdzplx", "=", hdlb);
|
||||
cnd.andEX("xx.hdzplx2", "=", zplb);
|
||||
cnd.andEX("u.unionid", "=", union);
|
||||
cnd.andEX("u.unitid", "=", unit);
|
||||
cnd.andEX("xx.auditState", "=", 4400);
|
||||
cnd.andEX("xx.isExcellent", "=", isExcellent);
|
||||
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||
if (ShiroUtil.hasRole("H04")) {
|
||||
cnd.andEX("gh.id", "=", Vi.getUnionId());
|
||||
cnd.andEX("u.unionid", "=", Vi.getUnionId());
|
||||
}
|
||||
}
|
||||
cnd.asc("gh.unionname").asc("n.name").asc("u.username").asc("xx.hdzplx");
|
||||
cnd.asc("u.unionname").asc("u.unitname").asc("u.username").asc("xx.hdzplx");
|
||||
sql.setCondition(cnd);
|
||||
List<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);
|
||||
List<NutMap> list = hdWmsbxxService.listMap(sql);
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("单位", "dwname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("分工会", "ghname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("作品主题", "hdname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("活动类别", "hdlbname", 20));
|
||||
// exportEntities.add(new ExcelExportEntity("作品类别", "zplbname", 20));
|
||||
// exportEntities.add(new ExcelExportEntity("作品主题", "hdsbzpzt", 20));
|
||||
exportEntities.add(new ExcelExportEntity("作品类别", "zplbname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("创作说明", "hdsbzpms", 200));
|
||||
exportEntities.add(new ExcelExportEntity("点赞次数", "dz_num", 20));
|
||||
|
||||
try {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
ViTool.excelResponse(response, hdname + ".xlsx");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
ViTool.excelResponse(response, hdname + ".xls");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//发送响应流方法
|
||||
public void setResponseHeader(HttpServletResponse response, String fileName) {
|
||||
try {
|
||||
try {
|
||||
fileName = new String(fileName.getBytes(), "ISO8859-1");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.setContentType("application/octet-stream;charset=ISO8859-1");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.addHeader("Pargam", "no-cache");
|
||||
response.addHeader("Cache-Control", "no-cache");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
@@ -365,7 +538,7 @@ public class HdWmInfoController {
|
||||
*/
|
||||
@At("/downLoad")
|
||||
@Ok("void")
|
||||
@RequiresAuthentication
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public void download(String filepath, String filename, String username, HttpServletResponse response) {
|
||||
try {
|
||||
response.setContentType("application/octet-stream");
|
||||
@@ -387,7 +560,7 @@ public class HdWmInfoController {
|
||||
*/
|
||||
@At("/YlDoc")
|
||||
@Ok("void")
|
||||
@RequiresAuthentication
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public void viewFJ(String fjurl, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String destFile = "";
|
||||
try {
|
||||
@@ -430,11 +603,15 @@ public class HdWmInfoController {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public Object initHdxxlist() {
|
||||
try {
|
||||
List<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>>();
|
||||
|
||||
@@ -443,7 +620,14 @@ public class HdWmInfoController {
|
||||
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")));
|
||||
/* 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);
|
||||
@@ -458,8 +642,6 @@ public class HdWmInfoController {
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public Object findOne(String id) {
|
||||
try {
|
||||
Hd_wm_sbxx sbxx = hdWmsbxxService.fetch(id);
|
||||
@@ -497,14 +679,38 @@ public class HdWmInfoController {
|
||||
|
||||
|
||||
@At
|
||||
@POST
|
||||
@ViReturn
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public Object doDelete(String id) {
|
||||
dao.clear(Hd_wm_sbxx.class, Cnd.where("id", "=", id));
|
||||
dao.clear(Sys_file.class, Cnd.where("reid", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public Object getAuditStateByModule() {
|
||||
return baseService.dao().query(AuditState.class, Cnd.where("module", "=", "hdwm"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public Object doExcellent(String id) {
|
||||
baseService.dao().update(Hd_wm_sbxx.class, Chain.make("isExcellent", true), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||
public Object cancelExcellent(String id) {
|
||||
baseService.dao().update(Hd_wm_sbxx.class, Chain.make("isExcellent", false), Cnd.where("id", "=", id));
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@RequiresAuthentication
|
||||
public Object doSubmit(@Param("..") Hd_wm_sbxx sbxx, @Param("files") TempFile[] files) {
|
||||
public Object doSubmit(@Param("..") Hd_wm_sbxx sbxx, @Param("files") TempFile[] files, boolean flag) {
|
||||
try {
|
||||
String path = new File("").getCanonicalPath();
|
||||
|
||||
sbxx.setAuditState(flag ? "4400" : "3999");
|
||||
Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
|
||||
|
||||
for (TempFile file : files) {
|
||||
fileService.upload(file,insert.getId(),"/hd/hdwm/");
|
||||
fileService.upload(file, insert.getId(), "/hd/hdwm/");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -10,6 +11,7 @@ import java.util.List;
|
||||
* @Date 2022/4/22
|
||||
* @Description 打卡签到活动
|
||||
*/
|
||||
@Data
|
||||
@Table("hd_checkin")
|
||||
public class HdCheckIn implements Serializable {
|
||||
|
||||
@@ -96,139 +98,4 @@ public class HdCheckIn implements Serializable {
|
||||
|
||||
private List<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;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -9,6 +10,7 @@ import java.io.Serializable;
|
||||
* @Date 2022/4/22
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
@Table("hd_checkin_zan")
|
||||
public class HdCheckZan implements Serializable {
|
||||
|
||||
@@ -36,35 +38,4 @@ public class HdCheckZan implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userid;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getHdid() {
|
||||
return hdid;
|
||||
}
|
||||
|
||||
public void setHdid(String hdid) {
|
||||
this.hdid = hdid;
|
||||
}
|
||||
|
||||
public String getContentId() {
|
||||
return contentId;
|
||||
}
|
||||
|
||||
public void setContentId(String contentId) {
|
||||
this.contentId = contentId;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.v.nutz.hd.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -9,6 +10,7 @@ import java.io.Serializable;
|
||||
* @Date 2022/4/22
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
@Table("hd_checkin_content")
|
||||
public class HdCheckinContent implements Serializable {
|
||||
|
||||
@@ -46,51 +48,4 @@ public class HdCheckinContent implements Serializable {
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isOpen;
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getHdid() {
|
||||
return hdid;
|
||||
}
|
||||
|
||||
public void setHdid(String hdid) {
|
||||
this.hdid = hdid;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Boolean getOpen() {
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
public void setOpen(Boolean open) {
|
||||
isOpen = open;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.v.nutz.hd.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -9,6 +10,7 @@ import java.io.Serializable;
|
||||
* @Date 2022/4/22
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
@Table("hd_checkin_file")
|
||||
public class HdCheckinFile implements Serializable {
|
||||
|
||||
@@ -41,43 +43,4 @@ public class HdCheckinFile implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
private String name;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getHdid() {
|
||||
return hdid;
|
||||
}
|
||||
|
||||
public void setHdid(String hdid) {
|
||||
this.hdid = hdid;
|
||||
}
|
||||
|
||||
public String getContentId() {
|
||||
return contentId;
|
||||
}
|
||||
|
||||
public void setContentId(String contentId) {
|
||||
this.contentId = contentId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -9,6 +10,7 @@ import java.util.List;
|
||||
* Created by lyw on 2020/3/13 11:10
|
||||
* 三八活动类别
|
||||
*/
|
||||
@Data
|
||||
@Table("Hd_wm_lb")
|
||||
public class Hd_wm_lb implements Serializable {
|
||||
|
||||
@@ -36,43 +38,4 @@ public class Hd_wm_lb implements Serializable {
|
||||
|
||||
private List<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;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Table("Hd_wm_sbxx")
|
||||
@TableIndexes({@Index(name = "INDEX_HDWMSB_HBSBRID", fields = {"hdsbrid"}, unique = false)})
|
||||
public class Hd_wm_sbxx implements Serializable {
|
||||
@@ -22,14 +24,6 @@ public class Hd_wm_sbxx implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String hdid;
|
||||
|
||||
public String getHdid() {
|
||||
return hdid;
|
||||
}
|
||||
|
||||
public void setHdid(String hdid) {
|
||||
this.hdid = hdid;
|
||||
}
|
||||
|
||||
@Column
|
||||
@Comment("上报人id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@@ -52,9 +46,14 @@ public class Hd_wm_sbxx implements Serializable {
|
||||
|
||||
@Column
|
||||
@Comment("作品描述")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String hdsbzpms;
|
||||
|
||||
@Column
|
||||
@Comment("作品名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String zpmc;
|
||||
|
||||
@Column
|
||||
@Comment("上报时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@@ -65,67 +64,29 @@ public class Hd_wm_sbxx implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String mobile;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
@Column
|
||||
@Comment("状态")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String auditState;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
@Column
|
||||
@Comment("分工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionAuditId;
|
||||
|
||||
public String getHdsbrid() {
|
||||
return hdsbrid;
|
||||
}
|
||||
@Column
|
||||
@Comment("校工会审核id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String schoolAuditId;
|
||||
|
||||
public void setHdsbrid(String hdsbrid) {
|
||||
this.hdsbrid = hdsbrid;
|
||||
}
|
||||
@Column
|
||||
@Comment("是否发送系统消息")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean xlFlag;
|
||||
|
||||
public String getHdsbsj() {
|
||||
return hdsbsj;
|
||||
}
|
||||
@Column
|
||||
@Comment("是否优秀作品")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isExcellent;
|
||||
|
||||
public void setHdsbsj(String hdsbsj) {
|
||||
this.hdsbsj = hdsbsj;
|
||||
}
|
||||
|
||||
public String getHdsbzpzt() {
|
||||
return hdsbzpzt;
|
||||
}
|
||||
|
||||
public void setHdsbzpzt(String hdsbzpzt) {
|
||||
this.hdsbzpzt = hdsbzpzt;
|
||||
}
|
||||
|
||||
public String getHdsbzpms() {
|
||||
return hdsbzpms;
|
||||
}
|
||||
|
||||
public void setHdsbzpms(String hdsbzpms) {
|
||||
this.hdsbzpms = hdsbzpms;
|
||||
}
|
||||
|
||||
public String getHdzplx() {
|
||||
return hdzplx;
|
||||
}
|
||||
|
||||
public void setHdzplx(String hdzplx) {
|
||||
this.hdzplx = hdzplx;
|
||||
}
|
||||
|
||||
public String getHdzplx2() {
|
||||
return hdzplx2;
|
||||
}
|
||||
|
||||
public void setHdzplx2(String hdzplx2) {
|
||||
this.hdzplx2 = hdzplx2;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package io.v.nutz.hd.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Table("Hd_wm_sbxx_fj")
|
||||
@TableIndexes({@Index(name = "INDEX_HDWMSB_FJ_HBSBID", fields = {"hdsbid"}, unique = false)})
|
||||
public class Hd_wm_sbxx_fj implements Serializable {
|
||||
@@ -31,35 +33,4 @@ public class Hd_wm_sbxx_fj implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
private String fjname;
|
||||
|
||||
public String getFjid() {
|
||||
return fjid;
|
||||
}
|
||||
|
||||
public void setFjid(String fjid) {
|
||||
this.fjid = fjid;
|
||||
}
|
||||
|
||||
public String getHdsbid() {
|
||||
return hdsbid;
|
||||
}
|
||||
|
||||
public void setHdsbid(String hdsbid) {
|
||||
this.hdsbid = hdsbid;
|
||||
}
|
||||
|
||||
public String getFjurl() {
|
||||
return fjurl;
|
||||
}
|
||||
|
||||
public void setFjurl(String fjurl) {
|
||||
this.fjurl = fjurl;
|
||||
}
|
||||
|
||||
public String getFjname() {
|
||||
return fjname;
|
||||
}
|
||||
|
||||
public void setFjname(String fjname) {
|
||||
this.fjname = fjname;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,21 @@ public class Hd_wm_xx implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String hdjssj;
|
||||
|
||||
@Column
|
||||
@Comment("点赞开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String dzkssj;
|
||||
|
||||
@Column
|
||||
@Comment("点赞结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String dzjssj;
|
||||
|
||||
@Column
|
||||
@Comment("每人每日点赞次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer dzNum;
|
||||
|
||||
@Column
|
||||
@Comment("活动状态 (开启 关闭)")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@@ -84,21 +99,21 @@ public class Hd_wm_xx implements Serializable {
|
||||
@Comment("配色")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String hdcolor;
|
||||
@Column
|
||||
@Comment("活动范围Id")
|
||||
@ColDefine(type = ColType.INT, width = 32)
|
||||
private Integer activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("活动范围名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 40)
|
||||
private String activityGroupName;
|
||||
|
||||
@Column
|
||||
@Comment("活动类型(1 教工 2 亲子)")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer hdtype;
|
||||
|
||||
|
||||
public Integer getHdtype() {
|
||||
return hdtype;
|
||||
}
|
||||
|
||||
public void setHdtype(Integer hdtype) {
|
||||
this.hdtype = hdtype;
|
||||
}
|
||||
|
||||
private List<Hd_wm_lb> lbs;
|
||||
|
||||
private List<Hd_wm_bgi> bgis;
|
||||
@@ -109,5 +124,26 @@ public class Hd_wm_xx implements Serializable {
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
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;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by lyw on 2020/3/13 11:10
|
||||
* 三八活动作品类别
|
||||
*/
|
||||
@Data
|
||||
@Table("Hd_wm_zplb")
|
||||
public class Hd_wm_zplb implements Serializable {
|
||||
|
||||
@@ -28,40 +31,54 @@ public class Hd_wm_zplb implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String zname;
|
||||
|
||||
@Column
|
||||
@Comment("作品介绍最多字数")
|
||||
@ColDefine(type = ColType.INT, width = 20)
|
||||
private Integer maxWordCount;
|
||||
|
||||
@Column
|
||||
@Comment("是否上传图片")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isUploadPhoto;
|
||||
|
||||
@Column
|
||||
@Comment("上传图片数量")
|
||||
@ColDefine(type = ColType.INT, width = 10)
|
||||
private Integer photoNum;
|
||||
|
||||
@Column
|
||||
@Comment("上传图片格式")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<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
|
||||
@Comment("排序")
|
||||
@ColDefine(type = ColType.INT, width = 4)
|
||||
private int zlocation;
|
||||
|
||||
public String getZid() {
|
||||
return zid;
|
||||
}
|
||||
|
||||
public void setZid(String zid) {
|
||||
this.zid = zid;
|
||||
}
|
||||
|
||||
public String getZlid() {
|
||||
return zlid;
|
||||
}
|
||||
|
||||
public void setZlid(String zlid) {
|
||||
this.zlid = zlid;
|
||||
}
|
||||
|
||||
public String getZname() {
|
||||
return zname;
|
||||
}
|
||||
|
||||
public void setZname(String zname) {
|
||||
this.zname = zname;
|
||||
}
|
||||
|
||||
public int getZlocation() {
|
||||
return zlocation;
|
||||
}
|
||||
|
||||
public void setZlocation(int zlocation) {
|
||||
this.zlocation = zlocation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -55,16 +55,7 @@ public class ApplyController {
|
||||
@ViReturn
|
||||
public Object doAdd(@Param("activityBx") ActivityBx activityBx, @Param("sign") String sign) {
|
||||
activityBx.setYear(Calendar.getInstance().get(Calendar.YEAR));
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"xghhdwy", "A06"}) && activityBx.getActivity_type().equals(2)) {
|
||||
activityBx.setState_id("1020");
|
||||
activityBx.setActivity_type(2);
|
||||
} else if (ShiroUtil.hasAnyRoles(new String[]{"H02"}) && activityBx.getActivity_type().equals(3)) {
|
||||
activityBx.setState_id("1020");
|
||||
activityBx.setActivity_type(3);
|
||||
} else {
|
||||
activityBx.setState_id("1010");
|
||||
activityBx.setActivity_type(1);
|
||||
}
|
||||
activityBx.setState_id("1020");
|
||||
activityBx.setApply_time(DateUtil.getDate());
|
||||
activityBx.setUser_id(ShiroUtil.getPrincipalProperty("id").toString());
|
||||
if (Strings.isNotBlank(sign)) {
|
||||
|
||||
@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/jf/activity_bx/recording")
|
||||
@At("/platform/jf/activity_bx/reimbursement")
|
||||
public class ReimbursementCon {
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ public class ReimbursementCon {
|
||||
private ActivityFileService activityFileService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/jf/activitybx/recording.html")
|
||||
@RequiresPermissions("sys.jf.activity_bx.recording")
|
||||
@Ok("beetl:/platform/jf/activitybx/reimbursement.html")
|
||||
@RequiresPermissions("sys.jf.activity_bx.reimbursement")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@@ -120,91 +120,16 @@ public class ReimbursementCon {
|
||||
bxr.unionname bxr_unionname,
|
||||
bxr.unioncode,
|
||||
state.state_name,
|
||||
state.state_color,(
|
||||
CASE
|
||||
state.state_id
|
||||
WHEN @state1 THEN
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( u.username )
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
||||
WHERE
|
||||
sur.roleId = @role1
|
||||
)
|
||||
WHEN @state2 THEN
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( u.username )
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
||||
WHERE
|
||||
sur.unionid = bxr.unionid
|
||||
AND sur.roleId = @role2
|
||||
)
|
||||
WHEN @state3 THEN
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( u.username )
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
||||
WHERE
|
||||
sur.roleId = @role3
|
||||
)
|
||||
WHEN @state4 THEN
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( u.username )
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
||||
WHERE
|
||||
sur.roleId = @role4
|
||||
)
|
||||
WHEN @state5 THEN
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( u.username )
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
||||
WHERE
|
||||
sur.roleId = @role5
|
||||
)
|
||||
WHEN @state6 THEN
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( u.username )
|
||||
FROM
|
||||
sys_user_role sur
|
||||
LEFT JOIN sys_user u ON sur.userId = u.id
|
||||
WHERE
|
||||
sur.roleId = @role6
|
||||
) ELSE NULL
|
||||
END
|
||||
) shrname
|
||||
state.state_color,
|
||||
abs.`name` absName
|
||||
FROM
|
||||
activity_bx bx
|
||||
LEFT JOIN `user` bxr ON bx.user_id = bxr.id
|
||||
LEFT JOIN state state ON state.state_id = bx.state_id $condition
|
||||
LEFT JOIN state state ON state.state_id = bx.state_id
|
||||
LEFT JOIN activity_basic_settings abs ON abs.`code` = bx.projectTypeCode
|
||||
$condition
|
||||
""");
|
||||
|
||||
sql.setParam("role1", Roles.CLUB_FZR);
|
||||
sql.setParam("role2", Roles.UNION_MANGER);
|
||||
sql.setParam("role3", Roles.XGHKJ);
|
||||
sql.setParam("role4", Roles.GH_WYH_FZX);
|
||||
sql.setParam("role5", Roles.GH_WYH_CWFZX);
|
||||
sql.setParam("role6", Roles.XGHCN);
|
||||
sql.setParam("state1", 1000);
|
||||
sql.setParam("state2", 1010);
|
||||
sql.setParam("state3", 1020);
|
||||
sql.setParam("state4", 1030);
|
||||
sql.setParam("state5", 1040);
|
||||
sql.setParam("state6", 1050);
|
||||
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
|
||||
@@ -30,11 +30,22 @@ public class ActivityBx {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String user_name;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("联系方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String apply_time;
|
||||
|
||||
@Column
|
||||
@Comment("申请类型(1.经费申报2.报销申请)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String apply_type;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@@ -75,6 +86,11 @@ public class ActivityBx {
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activity_content;
|
||||
|
||||
@Column
|
||||
@Comment("活动安排")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String activity_arrange;
|
||||
|
||||
@Column
|
||||
@Comment("报销事由")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package io.v.nutz.mobile.cahd;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
@@ -20,11 +26,29 @@ public class CahdApplyController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/cahd/applyList.html")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At()
|
||||
@ViReturn
|
||||
public Object pageData(Integer year, PageForm page) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
u.username
|
||||
FROM
|
||||
hd_wm_xx xx
|
||||
LEFT JOIN sys_user u ON u.id = xx.hdcjr
|
||||
WHERE
|
||||
activityGroupId IN ( SELECT groupId FROM `activity_user_scope` $condition)
|
||||
AND YEAR ( hdkssj )= @year and xx.hdflag=true and xx.hdtype=2
|
||||
""").setParam("year", year);
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
package io.v.nutz.mobile.wmhd;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
@@ -22,9 +29,30 @@ public class WmhdApplyController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/mobile/wmhd/applyList.html")
|
||||
@RequiresAuthentication
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At()
|
||||
@ViReturn
|
||||
public Object pageData(Integer year, PageForm page) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
xx.*,
|
||||
u.username
|
||||
FROM
|
||||
hd_wm_xx xx
|
||||
LEFT JOIN sys_user u ON u.id = xx.hdcjr
|
||||
WHERE
|
||||
activityGroupId IN ( SELECT groupId FROM `activity_user_scope` $condition)
|
||||
AND YEAR ( hdkssj )= @year and xx.hdflag=true and xx.hdtype=1
|
||||
""").setParam("year", year);
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
cnd.and("userId", "=", ShiroUtil.getUserId());
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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_zplb zplb ON zplb.zid = xx.hdzplx2
|
||||
WHERE xx.id=@id
|
||||
""").setParam("id",id);
|
||||
""").setParam("id", id);
|
||||
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("排序编号")
|
||||
@ColDefine(type = ColType.INT)
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
@@ -86,6 +89,12 @@ public class Sys_menu extends BaseModel implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String note;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("操作指南")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> description;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@@ -100,4 +109,27 @@ public class Sys_menu extends BaseModel implements Serializable {
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 前端菜单
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 绑定模块及模块下的菜单到用户
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
Sys_user fillModuleMenus(Sys_user user);
|
||||
|
||||
/**
|
||||
* 绑定用户单位 分工会信息
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
Sys_user fillUnitUnion(Sys_user user);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
@@ -79,6 +95,15 @@ public interface SysUserService extends BaseService<Sys_user> {
|
||||
* @param userId
|
||||
*/
|
||||
void deleteCache(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 清除一个用户的缓存并更新主体信息
|
||||
* 清除当前用户缓存
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void deleteCacheAndUpdate(String userId);
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
package io.v.nutz.sys.services.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.constant.RedisConstant;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.sys.models.Sys_menu;
|
||||
import io.v.nutz.sys.models.Sys_role;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.*;
|
||||
import io.v.nutz.sys.services.SysMenuService;
|
||||
import io.v.nutz.sys.services.SysRoleService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheRemove;
|
||||
@@ -25,6 +31,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
@@ -39,6 +46,12 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
|
||||
@Inject
|
||||
private SysMenuService sysMenuService;
|
||||
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 查询用户角色code列表
|
||||
*
|
||||
@@ -86,6 +99,54 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
|
||||
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]}_*")
|
||||
//可以通过el表达式加 * 通配符来批量删除一批缓存
|
||||
public void deleteCache(String userId) {
|
||||
//查询用户最新的菜单、角色信息
|
||||
sysRoleService.clearCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCacheAndUpdate(String userId) {
|
||||
//删除sys_user_*,sys_role_*所有缓存
|
||||
this.deleteCache(userId);
|
||||
sysRoleService.clearCache();
|
||||
|
||||
//查询用户最新的菜单、角色信息
|
||||
Sys_user user = fetch(Cnd.where("id", "=", ShiroUtil.getUserId()));
|
||||
fetchLinks(user, null);
|
||||
user = fillModuleMenus(user);
|
||||
user = fillUnitUnion(user);
|
||||
|
||||
//更新principal信息
|
||||
PrincipalCollection principals = SecurityUtils.getSubject().getPrincipals();
|
||||
String realm = principals.getRealmNames().iterator().next();
|
||||
SimplePrincipalCollection simplePrincipalCollection = new SimplePrincipalCollection(user, realm);
|
||||
SecurityUtils.getSubject().runAs(simplePrincipalCollection);
|
||||
}
|
||||
|
||||
@CacheRemoveAll
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package io.v.nutz.web.commons.utils;
|
||||
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.sys.models.Sys_menu;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.Sys_user_role;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.sys.services.impl.SysUserServiceImpl;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
import org.slf4j.Logger;
|
||||
@@ -13,11 +22,13 @@ import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2017/1/16.
|
||||
*/
|
||||
public class ShiroUtil {
|
||||
public class ShiroUtil extends io.v.nutz.util.ShiroUtil {
|
||||
private static final String ROLE_NAMES_DELIMETER = ",";
|
||||
private static final String PERMISSION_NAMES_DELIMETER = ",";
|
||||
|
||||
@@ -378,4 +389,31 @@ public class ShiroUtil {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
return (String) subject.getSession().getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前用户信息 json
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getUser() {
|
||||
Sys_user user = (Sys_user) getPrincipal();
|
||||
return Json.toJson(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户模块菜单
|
||||
*
|
||||
* @return {@link String}
|
||||
*/
|
||||
public static String userModuleMenus() {
|
||||
List<Sys_menu> menus = (List<Sys_menu>) getPrincipalProperty("moduleMenus");
|
||||
if (Lang.isEmpty(menus)) {
|
||||
SysUserService sysUserService = Mvcs.getIoc().get(SysUserServiceImpl.class);
|
||||
sysUserService.deleteCacheAndUpdate(getUserId());
|
||||
menus = (List<Sys_menu>) getPrincipalProperty("moduleMenus");
|
||||
}
|
||||
return Json.toJson(menus);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.v.nutz.web.controllers.platform.sys;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.sys.models.Sys_menu;
|
||||
import io.v.nutz.sys.services.SysMenuService;
|
||||
@@ -12,6 +14,7 @@ import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
@@ -53,7 +56,7 @@ public class SysMenuController {
|
||||
@At("/child")
|
||||
@Ok("json")
|
||||
@RequiresAuthentication
|
||||
public Object child(@Param("pid") String pid, HttpServletRequest req) {
|
||||
public Object child(@Param("pid") String pid, @Param(value = "menuName", required = false) String menuName, HttpServletRequest req) {
|
||||
List<Sys_menu> list = new ArrayList<>();
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
@@ -62,6 +65,9 @@ public class SysMenuController {
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
if (StrUtil.isNotBlank(menuName)) {
|
||||
cnd.where().andLike("name", menuName);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysMenuService.query(cnd);
|
||||
for (Sys_menu menu : list) {
|
||||
@@ -69,8 +75,8 @@ public class SysMenuController {
|
||||
menu.setHasChildren(true);
|
||||
}
|
||||
NutMap map = Lang.obj2nutmap(menu);
|
||||
map.addv("expanded", false);
|
||||
map.addv("children", new ArrayList<>());
|
||||
map.setv("expanded", false);
|
||||
map.setv("children", new ArrayList<>());
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
@@ -306,6 +312,10 @@ public class SysMenuController {
|
||||
if (list1 == null) {
|
||||
list1 = new ArrayList<>();
|
||||
}
|
||||
if (StrUtil.isNotBlank(unit.getParentId())) {
|
||||
Sys_menu parentMenu = list.stream().filter(o -> o.getId().equals(unit.getParentId())).findFirst().orElse(null);
|
||||
unit.setParentName(parentMenu.getName());
|
||||
}
|
||||
list1.add(unit);
|
||||
menuMap.put(unit.getParentId(), list1);
|
||||
}
|
||||
@@ -351,4 +361,46 @@ public class SysMenuController {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json")
|
||||
public Object getDescription(String url) {
|
||||
if (StrUtil.isBlank(url)) {
|
||||
return null;
|
||||
}
|
||||
Sys_menu sysMenu = sysMenuService.fetch(Cnd.where("href", "=", url));
|
||||
return Lang.isEmpty(sysMenu) ? null : sysMenu.getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊查询菜单选项
|
||||
*
|
||||
* @param keyword 关键字
|
||||
* @return {@link Object}
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("json")
|
||||
@RequiresAuthentication
|
||||
public Object menuOption(String keyword) {
|
||||
Sql menuSql = Sqls.create("""
|
||||
select menuId from sys_role_menu where roleId in (
|
||||
select roleId from sys_user_role where userId = @userId
|
||||
)
|
||||
""").setParam("userId", ShiroUtil.getPrincipalProperty("id"));
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("name", "like", "%" + keyword + "%");
|
||||
cnd.andEX("hasChildren", "=", 0);
|
||||
cnd.and("showit", "=", 1);
|
||||
cnd.and("disabled", "=", 0);
|
||||
cnd.and("type", "=", "menu");
|
||||
cnd.and("id", "in", menuSql);
|
||||
cnd.asc("location");
|
||||
List<Sys_menu> list = sysMenuService.query(cnd);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user