提交
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
+31
-7
@@ -1,15 +1,17 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.lxy.model.Lxy_bm;
|
||||
import io.v.nutz.lxy.model.Lxy_grxx;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import io.v.nutz.lxy.service.LxyGrxxService;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_grxx;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.zgfw.service.LxyGrxxService;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
@@ -19,9 +21,12 @@ 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.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -59,7 +64,14 @@ public class LxyFghShController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(Integer year, String hdid, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
@RequiresPermissions("zgfw.lxy.fghsh")
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tunit.name unitname,\n" +
|
||||
"\tl.id,\n" +
|
||||
@@ -121,6 +133,7 @@ public class LxyFghShController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.fghsh")
|
||||
public Object sh(String hdid, String uid, Integer bmzt) {
|
||||
lxyBmService.update(Chain.make("bmzt", bmzt), Cnd.where("hdid", "=", hdid).and("userid", "=", uid));
|
||||
return null;
|
||||
@@ -128,11 +141,22 @@ public class LxyFghShController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions(value = {"zgfw.lxy.xghsh", "zgfw.lxy.fghsh"}, logical = Logical.OR)
|
||||
public Object getBmInfo(String id) {
|
||||
Lxy_grxx grxx = lxyGrxxService.fetch(id);
|
||||
List<Sys_file> files = baseService.dao().query(Sys_file.class, Cnd.where("reid", "=", id));
|
||||
grxx.setFiles(files);
|
||||
return grxx;
|
||||
|
||||
Lxy_bm lxyBm = lxyBmService.dao().fetch(Lxy_bm.class, Cnd.where("hdid", "=", grxx.getHdid())
|
||||
.and("userid", "=", grxx.getUserid()));
|
||||
|
||||
NutMap nutMap = Lang.obj2nutmap(grxx);
|
||||
nutMap.put("bmFiles", lxyBm.getFiles());
|
||||
nutMap.put("mobile", lxyBm.getMobile());
|
||||
nutMap.put("idcard", lxyBm.getIdcard());
|
||||
nutMap.put("zyhj", lxyBm.getZyhj());
|
||||
nutMap.put("bz", lxyBm.getBz());
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.lxy.model.Lxy_bm;
|
||||
import io.v.nutz.lxy.model.Lxy_grxx;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import io.v.nutz.lxy.service.LxyGrxxService;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.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.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.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: 1V
|
||||
* @DateTime: 2020/8/28 9:21
|
||||
* @Description: 院级工会统一报名
|
||||
*/
|
||||
@At("/platform/zgfw/lxy/ghbm")
|
||||
@Ok("json")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class LxyGhbmController {
|
||||
|
||||
@Inject
|
||||
private LxyHdService lxyHdService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private LxyBmService lxyBmService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private LxyGrxxService lxyGrxxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zgfw/lxy/HdGhbm.html")
|
||||
@RequiresPermissions("zgfw.lxy.ghbm")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.ghbm")
|
||||
public Object pageData(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "searchKeyword", required = false) String searchKeyword,
|
||||
@Param(value = "pageNumber", required = false) int pageNumber,
|
||||
@Param(value = "pageSize", required = false) int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mefp.*,
|
||||
(
|
||||
mefp.number - ( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt not in (2,4))\s
|
||||
) remain,
|
||||
(
|
||||
( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt =5 )\s
|
||||
) passnum,
|
||||
(
|
||||
( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt = 3 )\s
|
||||
) reviewnum,
|
||||
un.unionname,
|
||||
un.unioncode,
|
||||
hd.*
|
||||
FROM
|
||||
lxy_mefp mefp
|
||||
LEFT JOIN sys_union un ON mefp.ghid = un.id
|
||||
LEFT JOIN lxy_hd hd ON mefp.hdid = hd.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and(new Static("now() < hd.bmjzsj"));
|
||||
|
||||
cnd.and("mefp.hdid", "=", hdid);
|
||||
cnd.andEX("un.id", "=", unionId);
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "SchoolUnionAdmin"})) {
|
||||
cnd.and(new Static("mefp.ghid in " + vi.getMangeUnionStr()));
|
||||
//工会管理员查看分配名额大于0的
|
||||
cnd.and("mefp.number", ">", 0);
|
||||
}
|
||||
|
||||
if (year != null) {
|
||||
cnd.and("YEAR(hdcjsj)", "=", year);
|
||||
}
|
||||
|
||||
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("hdcjsj");
|
||||
}
|
||||
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return lxyHdService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.ghbm")
|
||||
public Object getNotApply(String unionid, String hdid,
|
||||
@Param(value = "query", required = false) String query,
|
||||
@Param(value = "checks", required = false) String[] checks) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.unitid,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
u.birthday,
|
||||
CURDATE()) age,
|
||||
u.username,
|
||||
u.loginname,
|
||||
unit.`name` unitname,
|
||||
un.unionname,
|
||||
u.idcard
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN lxy_bm bm ON bm.userid = u.id
|
||||
AND bm.hdid = @hdid
|
||||
LEFT JOIN sys_unit unit ON u.unitid = unit.id
|
||||
LEFT JOIN ry_rygl_gr ry ON ry.userid = u.id
|
||||
LEFT JOIN sys_union un ON unit.unionid = un.id $condition
|
||||
""").setParam("hdid", hdid).setParam("unionid", unionid);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("member", "=", 1);
|
||||
cnd.and("unit.unionid", "=", unionid);
|
||||
cnd.and(new Static("u.id NOT IN ( SELECT bm.userid FROM lxy_bm bm WHERE bm.hdid = '" + hdid + "' ) "));
|
||||
if (checks != null && checks.length > 0) {
|
||||
for (String check : checks) {
|
||||
if (check.equals("honer")) {
|
||||
cnd.and(new Static("ry.zyxjsj is not null"));
|
||||
}
|
||||
|
||||
if (check.equals("five")) {
|
||||
cnd.and(new Static(" u.id not in (SELECT bm.userid from lxy_bm bm WHERE YEAR (NOW())- 5 < YEAR ( bm.bmsj ) )"));
|
||||
}
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return lxyBmService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.ghbm")
|
||||
public Object getHasApply(String unionid, String hdid,
|
||||
@Param(value = "query", required = false) String query,
|
||||
@Param(value = "checks", required = false) String[] checks) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
bm.bmzt,
|
||||
bm.age,
|
||||
bm.files,
|
||||
bm.zyhj,
|
||||
bm.bz,
|
||||
bm.mobile,
|
||||
bm.idcard,
|
||||
bm.unitid,
|
||||
bm.unitname,
|
||||
bm.unionname
|
||||
FROM
|
||||
lxy_bm bm
|
||||
LEFT JOIN `user` u ON u.id = bm.userid
|
||||
where bm.hdid = @hdid and u.unionid = @unionid ORDER BY bm.bmzt ASC
|
||||
""").setParam("hdid", hdid).setParam("unionid", unionid);
|
||||
return Result.success().addData(lxyBmService.list(sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.ghbm")
|
||||
public Object bm(@Param("::data") List<NutMap> bmMapList, @Param("flag") boolean flag) {
|
||||
|
||||
Trans.exec(() -> {
|
||||
List<Lxy_bm> bmList = Lang.collection2list(bmMapList, Lxy_bm.class);
|
||||
if (Lang.isNotEmpty(bmList)) {
|
||||
lxyBmService.clear(Cnd
|
||||
.NEW().and(Cnd.exps("bmzt", "is", null).or("bmzt", "=", 4))
|
||||
.and("ghid", "=", bmList.get(0).getGhid())
|
||||
.and("hdid", "=", bmList.get(0).getHdid()));
|
||||
|
||||
List<Lxy_grxx> grxxList = new ArrayList<>();
|
||||
for (Lxy_bm bm : bmList) {
|
||||
lxyBmService.clear(Cnd
|
||||
.where("userid","=",bm.getUserid())
|
||||
.and("ghid", "=", bmList.get(0).getGhid())
|
||||
.and("hdid", "=", bmList.get(0).getHdid()));
|
||||
|
||||
Lxy_bm fetch = lxyBmService.fetch(Cnd.where("hdid", "=", bm.getGhid()).and("userid", "=", bm.getUserid()).and("bmzt", "=", 3));
|
||||
if (Lang.isNotEmpty(fetch)) {
|
||||
continue;
|
||||
}
|
||||
bm.setBmzt(flag ? 3 : null);
|
||||
bm.setBmlx(1);
|
||||
bm.setBmsj(DateUtil.getDate());
|
||||
|
||||
if (flag) {
|
||||
Sql sql = Sqls.create("SELECT u.loginname,u.username,u.mobile,TIMESTAMPDIFF(YEAR,u.birthday,CURDATE()) age,u.sex,u.position,u.personType,u.nation,u.idcard FROM sys_user u WHERE u.id = '" + bm.getUserid() + "'");
|
||||
List<Record> records = sysUserService.list(sql);
|
||||
records.forEach(item -> {
|
||||
Lxy_grxx lxy_grxx = new Lxy_grxx();
|
||||
lxy_grxx.setLoginname(item.getString("loginname"));
|
||||
lxy_grxx.setUsername(item.getString("username"));
|
||||
lxy_grxx.setMobile(bm.getMobile());
|
||||
lxy_grxx.setAge(bm.getAge());
|
||||
lxy_grxx.setSex(item.getString("sex"));
|
||||
lxy_grxx.setZw(item.getString("position"));
|
||||
lxy_grxx.setRsbz(item.getString("personType"));
|
||||
lxy_grxx.setMz(item.getString("nation"));
|
||||
lxy_grxx.setIdcard(bm.getIdcard());
|
||||
lxy_grxx.setChry(new ArrayList());
|
||||
lxy_grxx.setUserid(bm.getUserid());
|
||||
lxy_grxx.setHdid(bm.getHdid());
|
||||
lxy_grxx.setGhid(bm.getGhid());
|
||||
grxxList.add(lxy_grxx);
|
||||
});
|
||||
}
|
||||
}
|
||||
lxyBmService.insert(bmList);
|
||||
lxyGrxxService.insert(grxxList);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.ghbm")
|
||||
public Object findBm(String ghId, String hdId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
l.id,
|
||||
hd.id hdid,
|
||||
u.id uid,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
bm.age,
|
||||
bm.mobile,
|
||||
bm.idcard,
|
||||
bm.unitname,
|
||||
bm.bmzt,
|
||||
bm.zyhj,
|
||||
bm.bz,
|
||||
bm.ghid
|
||||
FROM
|
||||
lxy_bm bm
|
||||
LEFT JOIN lxy_hd hd ON hd.id = bm.hdid
|
||||
LEFT JOIN sys_user u ON u.id = bm.userid
|
||||
LEFT JOIN sys_unit unit ON u.unitid = unit.id
|
||||
LEFT JOIN Lxy_grxx l ON l.loginname = u.loginname
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("bm.bmzt","NOT IN",List.of(2,4,6));
|
||||
cnd.and("bm.hdid","=",hdId);
|
||||
cnd.and("bm.ghid","=",ghId);
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("bm.bmzt");
|
||||
sql.setCondition(cnd);
|
||||
return lxyBmService.list(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+44
-33
@@ -1,16 +1,16 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.lxy.model.Lxy_grxx;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import io.v.nutz.lxy.service.LxyGrxxService;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_grxx;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.zgfw.service.LxyGrxxService;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
@@ -66,34 +66,42 @@ public class LxyGrBmController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(Integer year, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"hd.id hdid,\n" +
|
||||
"hd.`name`,\n" +
|
||||
"hd.hdcd,\n" +
|
||||
"hd.hdkssj,\n" +
|
||||
"hd.hdjssj,\n" +
|
||||
"hd.bmjzsj,\n" +
|
||||
"u.id uid,\n" +
|
||||
"u.loginname,\n" +
|
||||
"u.username,\n" +
|
||||
"u.chry,\n" +
|
||||
"u.rsbz,\n" +
|
||||
"u.zw,\n" +
|
||||
"u.sex,\n" +
|
||||
"u.mobile,\n" +
|
||||
"u.mz,\n" +
|
||||
"u.idcard,\n" +
|
||||
"unit.unionid,\n" +
|
||||
"bm.bmzt ,\n" +
|
||||
"g.id gid,\n" +
|
||||
"TIMESTAMPDIFF(YEAR,u.birthday,CURDATE()) age\n" +
|
||||
"FROM lxy_bm bm\n" +
|
||||
"LEFT JOIN lxy_hd hd ON hd.id = bm.hdid\n" +
|
||||
"LEFT JOIN sys_user u ON u.id = bm.userid \n" +
|
||||
"LEFT JOIN sys_unit unit ON unit.id = u.unitid\n" +
|
||||
"LEFT JOIN sys_union un ON un.id = unit.unionid\n" +
|
||||
"LEFT JOIN lxy_grxx g ON g.userid = bm.userid $condition");
|
||||
@RequiresPermissions("zgfw.lxy.grbm")
|
||||
public Object pageData(@Param(value = "year",required = false) Integer year,
|
||||
@Param(value = "searchName",required = false) String searchName,
|
||||
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber,@Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName",required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy",required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
hd.id hdid,
|
||||
hd.`name`,
|
||||
hd.hdcd,
|
||||
hd.hdkssj,
|
||||
hd.hdjssj,
|
||||
hd.bmjzsj,
|
||||
u.id uid,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.chry,
|
||||
u.rsbz,
|
||||
u.zw,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.mz,
|
||||
u.idcard,
|
||||
unit.unionid,
|
||||
bm.bmzt ,
|
||||
g.id gid,
|
||||
TIMESTAMPDIFF(YEAR,u.birthday,CURDATE()) age
|
||||
FROM lxy_bm bm
|
||||
LEFT JOIN lxy_hd hd ON hd.id = bm.hdid
|
||||
LEFT JOIN sys_user u ON u.id = bm.userid
|
||||
LEFT JOIN sys_unit unit ON unit.id = u.unitid
|
||||
LEFT JOIN sys_union un ON un.id = unit.unionid
|
||||
LEFT JOIN lxy_grxx g ON g.userid = bm.userid $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and(new Static("now() < hd.bmjzsj"));
|
||||
@@ -126,6 +134,7 @@ public class LxyGrBmController {
|
||||
@POST
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.grbm")
|
||||
public Object doAdd(Lxy_grxx lxy_grxx, @Param("fileList") TempFile[] fileList) throws IOException {
|
||||
|
||||
lxy_grxx = lxyGrxxService.insert(lxy_grxx);
|
||||
@@ -154,6 +163,7 @@ public class LxyGrBmController {
|
||||
@POST
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.grbm")
|
||||
public Object doEdit(Lxy_grxx lxy_grxx, @Param("fileList") TempFile[] fileList, String[] delFiles) throws IOException {
|
||||
|
||||
lxyGrxxService.updateIgnoreNull(lxy_grxx);
|
||||
@@ -184,6 +194,7 @@ public class LxyGrBmController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.grbm")
|
||||
public Object findOne(String id) {
|
||||
Lxy_grxx grxx = lxyGrxxService.fetch(id);
|
||||
List<Sys_file> files = baseService.dao().query(Sys_file.class, Cnd.where("reid", "=", id));
|
||||
+26
-12
@@ -1,14 +1,14 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.dao.CndPlus;
|
||||
import io.v.nutz.lxy.model.Lxy_hd;
|
||||
import io.v.nutz.lxy.model.Lxy_mefp;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import io.v.nutz.lxy.service.LxyMefpService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_hd;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_mefp;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import io.v.nutz.zgfw.service.LxyMefpService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
@@ -62,12 +62,20 @@ public class LxyHdCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String hdcd,String pastQuota,Integer year, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
CndPlus cnd = CndPlus.create();
|
||||
@RequiresPermissions("zgfw.lxy.hdmange")
|
||||
public Object pageData(@Param(value = "hdcd",required = false) String hdcd,
|
||||
@Param(value = "pastQuota",required = false) String pastQuota,
|
||||
@Param(value = "year",required = false) Integer year,
|
||||
@Param(value = "searchName",required = false) String searchName,
|
||||
@Param(value = "searchKeyword",required = false) String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName",required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy",required = false) String pageOrderBy) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.andExcludeEmpty("YEAR(hdcjsj)", "=", year);
|
||||
cnd.andExcludeEmpty("id", "=", hdcd);
|
||||
cnd.andExcludeEmpty("id", "=", pastQuota);
|
||||
cnd.andEX("YEAR(hdcjsj)", "=", year);
|
||||
cnd.andEX("id", "=", hdcd);
|
||||
cnd.andEX("id", "=", pastQuota);
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
@@ -85,7 +93,8 @@ public class LxyHdCon {
|
||||
@POST
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@ViReturn
|
||||
public Object doAdd(Lxy_hd hd, @Param("files") TempFile[] files, Lxy_mefp[] mefp) throws IOException {
|
||||
@RequiresPermissions("zgfw.lxy.hdmange")
|
||||
public Object doAdd(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, Lxy_mefp[] mefp) throws IOException {
|
||||
|
||||
hd.setHdcjsj(new Date());
|
||||
hd = lxyHdService.insert(hd);
|
||||
@@ -114,6 +123,7 @@ public class LxyHdCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.hdmange")
|
||||
public Object doEditMefp(Lxy_mefp[] mefp) {
|
||||
for (Lxy_mefp lxyMefp : mefp) {
|
||||
baseService.dao().update("lxy_mefp", Chain.make("number", lxyMefp.getNumber()), Cnd.where("ghid", "=", lxyMefp.getGhid()).and("hdid", "=", lxyMefp.getHdid()));
|
||||
@@ -125,7 +135,8 @@ public class LxyHdCon {
|
||||
@POST
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@ViReturn
|
||||
public Object doEdit(Lxy_hd hd, @Param("files") TempFile[] files, String[] delFiles) throws IOException {
|
||||
@RequiresPermissions("zgfw.lxy.hdmange")
|
||||
public Object doEdit(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, String[] delFiles) throws IOException {
|
||||
lxyHdService.updateIgnoreNull(hd);
|
||||
|
||||
for (TempFile file : files) {
|
||||
@@ -152,6 +163,7 @@ public class LxyHdCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.hdmange")
|
||||
public Object delete(String id) {
|
||||
List<Record> files = baseService.dao().query("sys_file", Cnd.where("reid", "=", id));
|
||||
files.forEach(file -> {
|
||||
@@ -167,12 +179,14 @@ public class LxyHdCon {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.hdmange")
|
||||
public Object getPastQuota(String pastQuota) {
|
||||
return lxyMefpService.list(Sqls.create("SELECT fp.ghid,fp.number,un.unionname FROM lxy_mefp fp LEFT JOIN sys_union un ON fp.ghid = un.id WHERE hdid = '" + pastQuota + "'"));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.hdmange")
|
||||
public Object getUnions(){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
@@ -0,0 +1,180 @@
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.MsgApi;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.lxy.model.Lxy_bm;
|
||||
import io.v.nutz.lxy.service.LxyGrxxService;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import io.v.nutz.util.ViTool;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.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;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-09-25 14:55
|
||||
* @description: 疗休养活动统计
|
||||
**/
|
||||
@At("/platform/zgfw/lxy/hdtj")
|
||||
@Ok("json")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class LxyHdTjController {
|
||||
|
||||
@Inject
|
||||
private LxyHdService lxyHdService;
|
||||
|
||||
@Inject
|
||||
private LxyGrxxService lxyGrxxService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
|
||||
@Inject
|
||||
private MsgApi msgApi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zgfw/lxy/HdTj.html")
|
||||
@RequiresPermissions("zgfw.lxy.hdtj")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.hdtj")
|
||||
public Object pageData(@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "ghid", required = false) String ghid,
|
||||
@Param(value = "searchKey", required = false) String searchKey,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("SELECT gr.* ,u.unionname,u.unioncode,u.unitname unitname,u.unitcode FROM `lxy_grxx` gr \n" +
|
||||
"LEFT JOIN lxy_bm bm ON bm.userid = gr.userid \n" +
|
||||
"LEFT JOIN `user` u ON u.id=bm.userid $condition");
|
||||
|
||||
cnd.and(new Static("bm.bmzt = 5"));
|
||||
cnd.and("gr.hdid", "=", hdid);
|
||||
|
||||
if (Strings.isNotBlank(ghid)) {
|
||||
cnd.and("gr.ghid", "=", ghid);
|
||||
}
|
||||
if (Strings.isNotBlank(searchKey)) {
|
||||
cnd.where().andLike("u.loginname", searchKey).orLike("u.username", searchKey);
|
||||
}
|
||||
cnd.groupBy("bm.userid");
|
||||
cnd.asc("u.unioncode");
|
||||
sql.setCondition(cnd);
|
||||
return lxyGrxxService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.hdtj")
|
||||
public Object getLxyHd(String year) {
|
||||
return lxyHdService.list(Sqls.create("SELECT id,`name` FROM `lxy_hd` WHERE YEAR(hdcjsj) = @year ORDER BY hdcjsj DESC ").setParam("year", year));
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("zgfw.lxy.hdtj")
|
||||
public void doExport(@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "hdname", required = false) String hdname,
|
||||
@Param(value = "ghid", required = false) String ghid, HttpServletResponse response) throws IOException {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gr.*,
|
||||
bm.unionname,
|
||||
bm.unitname,
|
||||
bm.zyhj,
|
||||
bm.bz
|
||||
FROM
|
||||
`lxy_grxx` gr
|
||||
LEFT JOIN lxy_bm bm ON bm.userid = gr.userid
|
||||
LEFT JOIN `user` u ON u.id = bm.userid
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.and(new Static("bm.bmzt = 5"));
|
||||
cnd.and("gr.hdid", "=", hdid);
|
||||
|
||||
if (Strings.isNotBlank(ghid)) {
|
||||
cnd.and("gr.ghid", "=", ghid);
|
||||
}
|
||||
cnd.groupBy("bm.userid");
|
||||
cnd.asc("bm.unionname").asc("bm.unitname").asc("gr.age");
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = lxyGrxxService.list(sql);
|
||||
int i = 1;
|
||||
for (Record r : list) {
|
||||
r.set("index", i);
|
||||
List<NutMap> chry = Json.fromJsonAsList(NutMap.class, r.getString("chry"));
|
||||
for (NutMap map : chry) {
|
||||
r.set("rych", (r.getString("rych") == null ? "" : r.getString("rych")) + " " + map.getString("shry"));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||
entities.add(new ExcelExportEntity("序号", "index", 10));
|
||||
entities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
entities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
entities.add(new ExcelExportEntity("年龄", "age", 20));
|
||||
entities.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("身份证号", "idcard", 20));
|
||||
entities.add(new ExcelExportEntity("工会", "unionname", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
entities.add(new ExcelExportEntity("获奖名称", "zyhj", 20));
|
||||
entities.add(new ExcelExportEntity("备注", "bz", 20));
|
||||
|
||||
ViTool.excelResponse(response, "疗休养人员名单汇总表.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(hdname);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("zgfw.lxy.hdtj")
|
||||
public Object openSendMessage(String hdid,
|
||||
@Param("sendTypes") String[] sendTypes,
|
||||
@Param("content") String content) {
|
||||
List<Lxy_bm> grxxes = lxyGrxxService.dao().query(Lxy_bm.class, Cnd.where("hdid", "=", hdid).and("bmzt", "=", 5));
|
||||
List<String> loginnames = grxxes.stream().map(Lxy_bm::getLoginname).collect(Collectors.toList());
|
||||
loginnames.forEach(loginname -> {
|
||||
/* msgApi.sendMsg(content, "", "", "", "4", new ArrayList<>() {{
|
||||
add(NutMap.NEW().addv("userId", loginname));
|
||||
}});*/
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,15 +1,15 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.lxy.model.Lxy_bm;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_bm;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -78,7 +78,7 @@ public class LxyMetjController {
|
||||
|
||||
cnd.and("mefp.hdid", "=", hdid);
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "SchoolUnionAdmin"})) {
|
||||
cnd.and(new Static("mefp.ghid in " + vi.getMangeUnionStr()));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,336 @@
|
||||
package io.v.nutz.lxy.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
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.PageUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.lxy.model.Lxy_grxx;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import io.v.nutz.web.commons.utils.FileUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
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.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.impl.PropertiesProxy;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: 1V
|
||||
* @DateTime: 2020/8/28 9:21
|
||||
* @Description: 校工会审核
|
||||
*/
|
||||
@At("/platform/zgfw/lxy/xghsh")
|
||||
@Ok("json")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class LxyXghshController {
|
||||
|
||||
@Inject
|
||||
private LxyHdService lxyHdService;
|
||||
|
||||
@Inject
|
||||
private LxyBmService lxyBmService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@Inject
|
||||
protected PropertiesProxy conf;
|
||||
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zgfw/lxy/HdXghsh.html")
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public Object pageData(@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit,
|
||||
@Param(value = "searchName", required = false) String searchName,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param(value = "pageOrderName", required = false) String pageOrderName,
|
||||
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mefp.*,
|
||||
un.unionname,
|
||||
un.unioncode,
|
||||
hd.*,
|
||||
(mefp.number - ( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt NOT IN (2,4)) ) remain,
|
||||
(SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt = 3) dsh,
|
||||
(SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt = 5) ysh,
|
||||
(SELECT GROUP_CONCAT(u.username) FROM lxy_bm bm LEFT JOIN `user` u on u.id=bm.userid WHERE bm.hdid=@hdid AND bm.ghid=mefp.ghid AND bm.bmzt != 4) username ,
|
||||
(SELECT GROUP_CONCAT(DISTINCT concat(u.username,'(',u.mobile,')') ) FROM `user` u LEFT JOIN sys_user_role ur ON u.id = ur.userId WHERE u.unionid = mefp.ghid AND ur.roleId = @roleId ) fglyname
|
||||
FROM
|
||||
lxy_mefp mefp
|
||||
LEFT JOIN sys_union un ON mefp.ghid = un.id
|
||||
LEFT JOIN lxy_bm bm ON bm.ghid = mefp.ghid
|
||||
LEFT JOIN sys_user u ON u.id = bm.userid AND bm.bmzt IN (3,5)
|
||||
LEFT JOIN lxy_hd hd ON mefp.hdid = hd.id
|
||||
$condition
|
||||
""").setParam("hdid", hdid).setParam("roleId", Roles.UNION_MANGER);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.andEX("mefp.ghid", "=", unionId);
|
||||
cnd.and(new Static("now()<hd.bmjzsj"));
|
||||
cnd.and("mefp.number", ">", 0);
|
||||
cnd.and("mefp.hdid", "=", hdid);
|
||||
cnd.and(new Static("(select count(1) from lxy_bm lb where lb.hdid = '" + hdid + "' and lb.ghid = mefp.ghid AND lb.bmzt is NOT null) > 0 "));
|
||||
|
||||
if (isAudit == 2) {
|
||||
cnd.and(new Static("(SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt = 3 )=0"));
|
||||
} else if (isAudit == 3) {
|
||||
cnd.and(new Static("(SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt = 3 )>0"));
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "SchoolUnionAdmin"})) {
|
||||
cnd.and(new Static("mefp.ghid in " + vi.getMangeUnionStr()));
|
||||
}
|
||||
if (year != null) {
|
||||
cnd.and("YEAR(hdkssj)", "=", year);
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
} else {
|
||||
cnd.desc("hdcjsj");
|
||||
cnd.desc("username");
|
||||
}
|
||||
cnd.groupBy(" mefp.ghid ");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return lxyHdService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询通过审核及待校工会审核的人员
|
||||
*
|
||||
* @param ghId
|
||||
* @param hdId
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public Object findBm(String ghId, String hdId, Integer pageNumber, Integer pageSize) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
l.id,
|
||||
hd.id hdid,
|
||||
u.id uid,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
bm.age,
|
||||
bm.mobile,
|
||||
bm.idcard,
|
||||
bm.unitname,
|
||||
bm.bmzt,
|
||||
bm.zyhj,
|
||||
bm.bz,
|
||||
bm.ghid
|
||||
FROM
|
||||
lxy_bm bm
|
||||
LEFT JOIN lxy_hd hd ON hd.id = bm.hdid
|
||||
LEFT JOIN sys_user u ON u.id = bm.userid
|
||||
LEFT JOIN sys_unit unit ON u.unitid = unit.id
|
||||
LEFT JOIN Lxy_grxx l ON l.loginname = u.loginname
|
||||
$condition
|
||||
""");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("bm.bmzt", "NOT IN", List.of(2, 4, 6));
|
||||
cnd.and("bm.hdid", "=", hdId);
|
||||
cnd.and("bm.ghid", "=", ghId);
|
||||
cnd.groupBy("u.loginname");
|
||||
cnd.desc("bm.bmzt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = lxyBmService.listPage(pageNumber, pageSize, sql);
|
||||
return Result.success().addData(pagination);
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public Object sh(String hdid, String ghid, Integer bmzt, String[] users) {
|
||||
for (String user : users) {
|
||||
lxyBmService.update(Chain.make("bmzt", bmzt), Cnd.where("ghid", "=", ghid).and("hdid", "=", hdid).and("userid", "=", user));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public Object grsh(String hdid, String ghid, Integer bmzt, String userid) {
|
||||
lxyBmService.update(Chain.make("bmzt", bmzt), Cnd.where("ghid", "=", ghid).and("hdid", "=", hdid).and("userid", "=", userid));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public Object yjSh(NutMap[] maps) {
|
||||
for (NutMap map : maps) {
|
||||
lxyBmService.update(Chain.make("bmzt", 5), Cnd.where("ghid", "=", map.get("ghid")).and("hdid", "=", map.get("hdid")).and("bmzt", "=", 3));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public Object doDelete(String id, String unionid, String userid, String hdid) {
|
||||
Trans.exec(() -> {
|
||||
lxyBmService.clear(Cnd.where("userid", "=", userid).and("hdid", "=", hdid).and("ghid", "=", unionid));
|
||||
baseService.dao().delete(Lxy_grxx.class, id);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public void downLoadAll(@Param(value = "year", required = false) Integer year,
|
||||
@Param(value = "hdid", required = false) String hdid,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "isAudit", required = false) Integer isAudit, HttpServletResponse response) throws IOException {
|
||||
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
b.*,
|
||||
u.username,
|
||||
u.unionId,
|
||||
u.unionname
|
||||
FROM
|
||||
lxy_bm b
|
||||
LEFT JOIN `user` u ON b.userid = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("hdid", "=", hdid);
|
||||
cnd.andEX("year(bmsj)", "=", year);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
if (isAudit != null) {
|
||||
if (isAudit == 2) {
|
||||
cnd.and("bmzt", ">", 3);
|
||||
} else if (isAudit == 3) {
|
||||
cnd.and("bmzt", "=", 3);
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
|
||||
try {
|
||||
|
||||
response.reset();
|
||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||
|
||||
/**
|
||||
* 创建临时文件夹
|
||||
*/
|
||||
String tmpPath = "tmp/" + R.UU32();
|
||||
File tmpDir = new File(tmpPath + "/报名人员材料");
|
||||
tmpDir.mkdirs();
|
||||
|
||||
Map<String, List<NutMap>> unionNameMap = list.stream()
|
||||
.collect(Collectors.groupingBy(l -> l.getString("unionname")));
|
||||
|
||||
|
||||
unionNameMap.forEach((k, v) -> {
|
||||
File unionTmpDir = new File(tmpDir + "/" + k);
|
||||
unionTmpDir.mkdirs();
|
||||
List<NutMap> unionNameList = list.stream().filter(li -> li.getString("unionname").equals(k)).collect(Collectors.toList());
|
||||
|
||||
unionNameList.forEach(item -> {
|
||||
|
||||
File tDir = new File(unionTmpDir + "/" + item.getString("username"));
|
||||
tDir.mkdirs();
|
||||
|
||||
if (StrUtil.isNotBlank(item.getString("files"))) {
|
||||
List<Sys_file> fileList = Json.fromJsonAsList(Sys_file.class, item.getString("files"));
|
||||
fileList.forEach(file -> {
|
||||
try {
|
||||
FileOutputStream outputStream = new FileOutputStream(tDir.getPath() + "/" + file.getFilename());
|
||||
ftpService.download(file.getFilepath(), outputStream);
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
String aimsDir = "zipTmp/" + R.UU32();
|
||||
String aimsName = "报名人员材料.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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package io.v.nutz.lxy.model;
|
||||
|
||||
import io.v.nutz.sys.models.Sys_file;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: 1V
|
||||
* @DateTime: 2020/8/27 9:11
|
||||
* @Description: 疗休养报名
|
||||
*/
|
||||
@Data
|
||||
@Table("Lxy_bm")
|
||||
public class Lxy_bm {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动id")
|
||||
@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 loginname;
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String ghid;
|
||||
|
||||
@Column
|
||||
@Comment("报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String bmsj;
|
||||
|
||||
@Column
|
||||
@Comment("报名状态(1.待分工会审核 2.分工会审核不通过 3.待校工会审核 4 校工会审核不通过 5 报名成功 6 待填写个人资料)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer bmzt;
|
||||
|
||||
@Column
|
||||
@Comment("报名类型(1.分工会统一报名 2.个人报名)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer bmlx;
|
||||
|
||||
@Column
|
||||
@Comment("单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unitname;
|
||||
@Column
|
||||
@Comment("单位id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitid;
|
||||
|
||||
@Column
|
||||
@Comment("年龄")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private String age;
|
||||
|
||||
@Column
|
||||
@Comment("工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionname;
|
||||
|
||||
@Column
|
||||
@Comment("手机号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 11)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("身份证号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String idcard;
|
||||
|
||||
@Column
|
||||
@Comment("主要获奖")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
private String zyhj;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
private String bz;
|
||||
|
||||
@Column
|
||||
@Comment("附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<Sys_file> files;
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.v.nutz.zgfw.model.lxy;
|
||||
package io.v.nutz.lxy.model;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.wizzer.framework.base.model.BaseModel;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package io.v.nutz.zgfw.model.lxy;
|
||||
package io.v.nutz.lxy.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
@@ -63,4 +63,4 @@ public class Lxy_hd {
|
||||
@Comment("活动内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String hdnr;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.v.nutz.zgfw.model.lxy;
|
||||
package io.v.nutz.lxy.model;
|
||||
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package io.v.nutz.zgfw.service;
|
||||
package io.v.nutz.lxy.service;
|
||||
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_bm;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.lxy.model.Lxy_bm;
|
||||
|
||||
public interface LxyBmService extends BaseService<Lxy_bm> {
|
||||
}
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package io.v.nutz.zgfw.service;
|
||||
|
||||
package io.v.nutz.lxy.service;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_grxx;
|
||||
import io.v.nutz.lxy.model.Lxy_grxx;
|
||||
|
||||
public interface LxyGrxxService extends BaseService<Lxy_grxx> {
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package io.v.nutz.zgfw.service;
|
||||
package io.v.nutz.lxy.service;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_hd;
|
||||
import io.v.nutz.lxy.model.Lxy_hd;
|
||||
|
||||
public interface LxyHdService extends BaseService<Lxy_hd> {
|
||||
}
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
package io.v.nutz.zgfw.service;
|
||||
package io.v.nutz.lxy.service;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_mefp;
|
||||
import io.v.nutz.lxy.model.Lxy_mefp;
|
||||
|
||||
|
||||
public interface LxyMefpService extends BaseService<Lxy_mefp> {
|
||||
}
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package io.v.nutz.zgfw.service.impl;
|
||||
package io.v.nutz.lxy.service.impl;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_bm;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.lxy.model.Lxy_bm;
|
||||
import io.v.nutz.lxy.service.LxyBmService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package io.v.nutz.zgfw.service.impl;
|
||||
package io.v.nutz.lxy.service.impl;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_grxx;
|
||||
import io.v.nutz.zgfw.service.LxyGrxxService;
|
||||
import io.v.nutz.lxy.model.Lxy_grxx;
|
||||
import io.v.nutz.lxy.service.LxyGrxxService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package io.v.nutz.zgfw.service.impl;
|
||||
package io.v.nutz.lxy.service.impl;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_hd;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import io.v.nutz.lxy.model.Lxy_hd;
|
||||
import io.v.nutz.lxy.service.LxyHdService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package io.v.nutz.zgfw.service.impl;
|
||||
package io.v.nutz.lxy.service.impl;
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_mefp;
|
||||
import io.v.nutz.zgfw.service.LxyMefpService;
|
||||
import io.v.nutz.lxy.model.Lxy_mefp;
|
||||
import io.v.nutz.lxy.service.LxyMefpService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
@@ -1,390 +0,0 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
|
||||
import cn.wizzer.framework.base.Result;
|
||||
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.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.sys.services.SysUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_bm;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_grxx;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.zgfw.service.LxyGrxxService;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
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.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.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;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: 1V
|
||||
* @DateTime: 2020/8/28 9:21
|
||||
* @Description: 院级工会统一报名
|
||||
*/
|
||||
@At("/platform/zgfw/lxy/ghbm")
|
||||
@Ok("json")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class LxyGhbmController {
|
||||
|
||||
@Inject
|
||||
private LxyHdService lxyHdService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
@Inject
|
||||
private LxyBmService lxyBmService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private LxyGrxxService lxyGrxxService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zgfw/lxy/HdGhbm.html")
|
||||
@RequiresPermissions("zgfw.lxy.ghbm")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(Integer year, String hdid, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tmefp.*,\n" +
|
||||
"\t(\n" +
|
||||
"\tmefp.number - ( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt not in (2,4)) \n" +
|
||||
"\t) remain,\n" +
|
||||
"\t(\n" +
|
||||
"\t( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt =5 ) \n" +
|
||||
"\t) passnum,\n" +
|
||||
"\t(\n" +
|
||||
"\t( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt = 3 ) \n" +
|
||||
"\t) reviewnum,\n" +
|
||||
"\tun.unionname,\n" +
|
||||
"\tun.unioncode,\n" +
|
||||
"\thd.* \n" +
|
||||
"FROM\n" +
|
||||
"\tlxy_mefp mefp\n" +
|
||||
"\tLEFT JOIN sys_union un ON mefp.ghid = un.id\n" +
|
||||
"\tLEFT JOIN lxy_hd hd ON mefp.hdid = hd.id $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and(new Static("now() < hd.bmjzsj"));
|
||||
|
||||
cnd.and("mefp.hdid", "=", hdid);
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
cnd.and(new Static("mefp.ghid in " + vi.getMangeUnionStr()));
|
||||
//工会管理员查看分配名额大于0的
|
||||
cnd.and("mefp.number", ">", 0);
|
||||
}
|
||||
|
||||
if (year != null) {
|
||||
cnd.and("YEAR(hdcjsj)", "=", year);
|
||||
}
|
||||
|
||||
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("hdcjsj");
|
||||
}
|
||||
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return lxyHdService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getNotApply(String unionid, String hdid, String query, String[] checks) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
u.birthday,
|
||||
CURDATE()) age,
|
||||
u.username,
|
||||
u.loginname,
|
||||
unit.`name` unitname,
|
||||
un.unionname\s
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN lxy_bm bm ON bm.userid = u.id\s
|
||||
AND bm.hdid = @hdid
|
||||
LEFT JOIN sys_unit unit ON u.unitid = unit.id
|
||||
LEFT JOIN ry_rygl_gr ry ON ry.userid = u.id
|
||||
LEFT JOIN sys_union un ON unit.unionid = un.id $condition
|
||||
""").setParam("hdid", hdid).setParam("unionid", unionid);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("member", "=", 1);
|
||||
cnd.and("unit.unionid", "=", unionid);
|
||||
cnd.and(new Static("u.id NOT IN ( SELECT bm.userid FROM lxy_bm bm WHERE bm.hdid = '" + hdid + "' ) "));
|
||||
if (checks != null && checks.length > 0) {
|
||||
for (String check : checks) {
|
||||
if (check.equals("honer")) {
|
||||
cnd.and(new Static("ry.zyxjsj is not null"));
|
||||
}
|
||||
|
||||
if (check.equals("five")) {
|
||||
cnd.and(new Static(" u.id not in (SELECT bm.userid from lxy_bm bm WHERE YEAR (NOW())- 5 < YEAR ( bm.bmsj ) )"));
|
||||
}
|
||||
}
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return lxyBmService.list(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getHasApply(String unionid, String hdid, String query, String[] checks) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitname,
|
||||
bm.bmzt,
|
||||
TIMESTAMPDIFF(
|
||||
YEAR,
|
||||
u.birthday,
|
||||
CURDATE()) age
|
||||
FROM
|
||||
lxy_bm bm
|
||||
LEFT JOIN `user` u ON u.id = bm.userid
|
||||
where bm.hdid = @hdid and u.unionid = @unionid ORDER BY bm.bmzt ASC
|
||||
""").setParam("hdid", hdid).setParam("unionid", unionid);
|
||||
return Result.success().addData(lxyBmService.list(sql));
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getUser(Integer sign, String unionid, String hdid, String query, String[] checks, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tu.id,\n" +
|
||||
"\tu.sex,u.mobile, TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) age,\n" +
|
||||
"\tu.username,\n" +
|
||||
"\tu.loginname,\n" +
|
||||
"\tunit.`name` unitname,\n" +
|
||||
"\tun.unionname \n" +
|
||||
"FROM\n" +
|
||||
"\tsys_user u\n" +
|
||||
"\tLEFT JOIN lxy_bm bm ON bm.userid = u.id AND bm.hdid = '" + hdid + "'\n" +
|
||||
"\tLEFT JOIN sys_unit unit ON u.unitid = unit.id\n" +
|
||||
"\tLEFT JOIN ry_rygl_gr ry ON ry.userid = u.id\n" +
|
||||
"\tLEFT JOIN sys_union un ON unit.unionid = un.id $condition");
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and("unit.unionid", "=", unionid);
|
||||
|
||||
if (sign == 0) {
|
||||
cnd.and(new Static("u.id not in (SELECT bm.userid from lxy_bm bm WHERE bm.hdid = '" + hdid + "')"));
|
||||
}
|
||||
|
||||
if (checks.length > 0) {
|
||||
for (String check : checks) {
|
||||
if (check.equals("honer")) {
|
||||
cnd.and(new Static("ry.zyxjsj is not null"));
|
||||
}
|
||||
|
||||
if (check.equals("five")) {
|
||||
cnd.and(new Static(" u.id not in (SELECT bm.userid from lxy_bm bm WHERE YEAR (NOW())- 5 < YEAR ( bm.bmsj ) )"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(query)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("u.username", query).orLike("u.loginname", query);
|
||||
cnd.and(group);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
}
|
||||
|
||||
cnd.desc("bm.bmzt");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = lxyHdService.listPage(pageNumber, pageSize, sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getNumberData(String unionid, String hdid) {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"\tun.unionname,\n" +
|
||||
"\tmefp.number sum,\n" +
|
||||
"\t( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt = 5) ybm,\n" +
|
||||
"\t( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt in (1,3)) dsh ,\n" +
|
||||
"\t( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt in (2,4)) btg ,\n" +
|
||||
"\t(mefp.number - (SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid and bm.bmzt not in (2,4))) kxz\n" +
|
||||
"FROM\n" +
|
||||
"\tlxy_mefp mefp\n" +
|
||||
"\tLEFT JOIN sys_union un ON mefp.ghid = un.id WHERE mefp.hdid=@hdid and mefp.ghid=@unionid").setParam("hdid", hdid).setParam("unionid", unionid);
|
||||
Record record = lxyHdService.list(sql).get(0);
|
||||
record.set("multiple", lxyBmService.list(Sqls.create("SELECT bm.userid id from lxy_bm bm WHERE bm.hdid = '" + hdid + "' AND bm.ghid = '" + unionid + "'")));
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object bm(String hdid, String unionid, @Param("users[]") String[] users, boolean flag) {
|
||||
List<Lxy_bm> lxyBms = lxyBmService.query(Cnd.where("ghid", "=", unionid).and("hdid", "=", hdid));
|
||||
|
||||
Trans.exec(() -> {
|
||||
|
||||
lxyBmService.clear(Cnd
|
||||
.where("bmzt", "is", null)
|
||||
.and("ghid", "=", unionid)
|
||||
.and("hdid", "=", hdid));
|
||||
for (String user : users) {
|
||||
Lxy_bm bm = new Lxy_bm();
|
||||
bm.setBmzt(flag ? 3 : null);
|
||||
bm.setBmlx(1);
|
||||
bm.setBmsj(DateUtil.getDate());
|
||||
bm.setUserid(user);
|
||||
bm.setHdid(hdid);
|
||||
bm.setGhid(unionid);
|
||||
lxyBmService.insert(bm);
|
||||
}
|
||||
|
||||
|
||||
if (Lang.isNotEmpty(users)) {
|
||||
for (String user : users) {
|
||||
if (flag) {
|
||||
Sql sql = Sqls.create("SELECT u.loginname,u.username,u.mobile,TIMESTAMPDIFF(YEAR,u.birthday,CURDATE()) age,u.sex,u.position,u.personType,u.nation,u.idcard FROM sys_user u WHERE u.id = '" + user + "'");
|
||||
List<Record> records = sysUserService.list(sql);
|
||||
records.forEach(item -> {
|
||||
Lxy_grxx lxy_grxx = new Lxy_grxx();
|
||||
lxy_grxx.setLoginname(item.getString("loginname"));
|
||||
lxy_grxx.setUsername(item.getString("username"));
|
||||
lxy_grxx.setMobile(item.getString("mobile"));
|
||||
lxy_grxx.setAge(item.getString("age"));
|
||||
lxy_grxx.setSex(item.getString("sex"));
|
||||
lxy_grxx.setZw(item.getString("position"));
|
||||
lxy_grxx.setRsbz(item.getString("personType"));
|
||||
lxy_grxx.setMz(item.getString("nation"));
|
||||
lxy_grxx.setIdcard(item.getString("idcard"));
|
||||
lxy_grxx.setChry(new ArrayList());
|
||||
lxy_grxx.setUserid(user);
|
||||
lxy_grxx.setHdid(hdid);
|
||||
lxy_grxx.setGhid(unionid);
|
||||
|
||||
lxyGrxxService.insert(lxy_grxx);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doEdit(String hdid, String unionid, String[] users) {
|
||||
for (String userid : users) {
|
||||
if (userid == null) {
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
lxyBmService.clear(Cnd.where("hdid", "=", hdid).and("ghid", "=", unionid).and("bmlx", "=", 1));
|
||||
lxyGrxxService.clear(Cnd.where("hdid", "=", hdid).and("ghid", "=", unionid));
|
||||
for (String userid : users) {
|
||||
Lxy_bm bm = new Lxy_bm();
|
||||
bm.setBmzt(3);
|
||||
bm.setBmlx(1);
|
||||
bm.setBmsj(DateUtil.getDate());
|
||||
bm.setUserid(userid);
|
||||
bm.setHdid(hdid);
|
||||
bm.setGhid(unionid);
|
||||
lxyBmService.insert(bm);
|
||||
|
||||
Sql sql = Sqls.create("SELECT u.loginname,u.username,u.mobile,TIMESTAMPDIFF(YEAR,u.birthday,CURDATE()) age,u.sex,u.position,u.preparedBy,u.nation,u.idcard FROM sys_user u WHERE u.id = '" + userid + "'");
|
||||
List<Record> records = sysUserService.list(sql);
|
||||
records.forEach(item -> {
|
||||
Lxy_grxx lxy_grxx = new Lxy_grxx();
|
||||
lxy_grxx.setLoginname(item.getString("loginname"));
|
||||
lxy_grxx.setUsername(item.getString("username"));
|
||||
lxy_grxx.setMobile(item.getString("mobile"));
|
||||
lxy_grxx.setAge(item.getString("age"));
|
||||
lxy_grxx.setSex(item.getString("sex"));
|
||||
lxy_grxx.setZw(item.getString("position"));
|
||||
lxy_grxx.setRsbz(item.getString("preparedBy"));
|
||||
lxy_grxx.setMz(item.getString("nation"));
|
||||
lxy_grxx.setIdcard(item.getString("idcard"));
|
||||
lxy_grxx.setChry(new ArrayList());
|
||||
lxy_grxx.setUserid(userid);
|
||||
lxy_grxx.setHdid(hdid);
|
||||
lxy_grxx.setGhid(unionid);
|
||||
|
||||
lxyGrxxService.insert(lxy_grxx);
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
public Object findBm(String ghId, String hdId) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"unit.`name` unitname,\n" +
|
||||
"l.id,\n" +
|
||||
"hd.id hdid,\n" +
|
||||
"u.id uid,\n" +
|
||||
"u.loginname,\n" +
|
||||
"u.username,\n" +
|
||||
"u.sex,\n" +
|
||||
"u.mobile,\n" +
|
||||
"TIMESTAMPDIFF(YEAR,u.birthday,CURDATE()) age,\n" +
|
||||
"bm.bmzt,\n" +
|
||||
"bm.ghid\n" +
|
||||
"FROM lxy_bm bm\n" +
|
||||
"LEFT JOIN lxy_hd hd ON hd.id = bm.hdid\n" +
|
||||
"LEFT JOIN sys_user u ON u.id = bm.userid\n" +
|
||||
"LEFT JOIN sys_unit unit ON u.unitid = unit.id\n" +
|
||||
"LEFT JOIN Lxy_grxx l ON l.loginname = u.loginname \n" +
|
||||
"WHERE bm.bmzt NOT IN (2,4,6) AND bm.hdid = @hdid \n" +
|
||||
"AND bm.ghid = @ghid \n" +
|
||||
"GROUP BY u.loginname\n" +
|
||||
"ORDER BY bm.bmzt DESC");
|
||||
sql.setParam("hdid", hdId);
|
||||
sql.setParam("ghid", ghId);
|
||||
List<Record> list = lxyBmService.list(sql);
|
||||
return Result.success().addData(list);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zgfw.service.LxyGrxxService;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.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;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Aaron
|
||||
* @create: 2020-09-25 14:55
|
||||
* @description: 疗休养活动统计
|
||||
**/
|
||||
@At("/platform/zgfw/lxy/hdtj")
|
||||
@Ok("json")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class LxyHdTjController {
|
||||
|
||||
@Inject
|
||||
private LxyHdService lxyHdService;
|
||||
|
||||
@Inject
|
||||
private LxyGrxxService lxyGrxxService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zgfw/lxy/HdTj.html")
|
||||
@RequiresPermissions("zgfw.lxy.hdtj")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String hdid, String ghid, String searchKey, int pageNumber, int pageSize) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("SELECT gr.* ,u.unionname,u.unioncode,u.unitname unitname,u.unitcode FROM `lxy_grxx` gr \n" +
|
||||
"LEFT JOIN lxy_bm bm ON bm.userid = gr.userid \n" +
|
||||
"LEFT JOIN `user` u ON u.id=bm.userid $condition");
|
||||
|
||||
cnd.and(new Static("bm.bmzt = 5"));
|
||||
cnd.and("gr.hdid", "=", hdid);
|
||||
|
||||
if (Strings.isNotBlank(ghid)) {
|
||||
cnd.and("gr.ghid", "=", ghid);
|
||||
}
|
||||
if (Strings.isNotBlank(searchKey)) {
|
||||
cnd.where().andLike("loginname", searchKey).orLike("username", searchKey);
|
||||
}
|
||||
cnd.groupBy("bm.userid");
|
||||
cnd.asc("u.unioncode");
|
||||
sql.setCondition(cnd);
|
||||
return lxyGrxxService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getLxyHd(String year) {
|
||||
return lxyHdService.list(Sqls.create("SELECT id,`name` FROM `lxy_hd` WHERE YEAR(hdcjsj) = @year ORDER BY hdcjsj DESC ").setParam("year", year));
|
||||
}
|
||||
|
||||
@At
|
||||
public void doExport(String hdid, String hdname, String ghid, HttpServletResponse response) throws IOException {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("SELECT gr.* ,u.unionname,u.unioncode,u.unitname unitname,u.unitcode FROM `lxy_grxx` gr \n" +
|
||||
"LEFT JOIN lxy_bm bm ON bm.userid = gr.userid \n" +
|
||||
"LEFT JOIN `user` u ON u.id=bm.userid $condition");
|
||||
|
||||
cnd.and(new Static("bm.bmzt = 5"));
|
||||
cnd.and("gr.hdid", "=", hdid);
|
||||
|
||||
if (Strings.isNotBlank(ghid)) {
|
||||
cnd.and("gr.ghid", "=", ghid);
|
||||
}
|
||||
cnd.groupBy("bm.userid");
|
||||
cnd.asc("u.unionname").asc("u.unitcode").asc("gr.age");
|
||||
sql.setCondition(cnd);
|
||||
List<Record> list = lxyGrxxService.list(sql);
|
||||
int i = 1;
|
||||
for (Record r : list) {
|
||||
r.set("index", i);
|
||||
List<NutMap> chry = Json.fromJsonAsList(NutMap.class, r.getString("chry"));
|
||||
for (NutMap map : chry) {
|
||||
r.set("rych", (r.getString("rych") == null ? "" : r.getString("rych")) + " " + map.getString("shry"));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
// Configure config = Configure.newBuilder().bind("list", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("hdmc", hdname);
|
||||
map.put("mapList", list);
|
||||
String fileName = "疗休养人员名单汇总表.xls";
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("utf-8"), "ISO8859-1"));
|
||||
TemplateExportParams params = new TemplateExportParams(
|
||||
"templates/lxy/lxyrymd.xls");
|
||||
// Workbook workbook = ExcelExportUtil.exportExcel(params, map);
|
||||
// workbook.write(response.getOutputStream());
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
// String fileName = "疗休养人员名单汇总表";
|
||||
// response.addHeader("Content-Type", "application/octet-stream");
|
||||
// response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx;filename*=UTF-8''" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1"));
|
||||
// InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/lxyrymd.docx");
|
||||
// XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
|
||||
// inputStream.close();
|
||||
}
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
package io.v.nutz.zgfw.controller.lxy;
|
||||
|
||||
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.PageUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zgfw.model.lxy.Lxy_grxx;
|
||||
import io.v.nutz.zgfw.service.LxyBmService;
|
||||
import io.v.nutz.zgfw.service.LxyHdService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.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.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
/**
|
||||
* @Author: 1V
|
||||
* @DateTime: 2020/8/28 9:21
|
||||
* @Description: 校工会审核
|
||||
*/
|
||||
@At("/platform/zgfw/lxy/xghsh")
|
||||
@Ok("json")
|
||||
@IocBean
|
||||
@RequiresAuthentication
|
||||
public class LxyXghshController {
|
||||
|
||||
@Inject
|
||||
private LxyHdService lxyHdService;
|
||||
|
||||
@Inject
|
||||
private LxyBmService lxyBmService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private Vi vi;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zgfw/lxy/HdXghsh.html")
|
||||
@RequiresPermissions("zgfw.lxy.xghsh")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String hdid, Integer year, Integer isAudit, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mefp.*,
|
||||
un.unionname,
|
||||
un.unioncode,
|
||||
hd.*,
|
||||
(mefp.number - ( SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt NOT IN (2,4)) ) remain,
|
||||
(SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt = 3) dsh,
|
||||
(SELECT GROUP_CONCAT(u.username) FROM lxy_bm bm LEFT JOIN `user` u on u.id=bm.userid WHERE bm.hdid=@hdid AND bm.ghid=mefp.ghid AND bm.bmzt = 5) username ,
|
||||
(SELECT GROUP_CONCAT(DISTINCT concat(u.username,'(',u.mobile,')') ) FROM `user` u LEFT JOIN sys_user_role ur ON u.id = ur.userId WHERE u.unionid = mefp.ghid AND ur.roleId = @roleId ) fglyname
|
||||
FROM
|
||||
lxy_mefp mefp
|
||||
LEFT JOIN sys_union un ON mefp.ghid = un.id
|
||||
LEFT JOIN lxy_bm bm ON bm.ghid = mefp.ghid
|
||||
LEFT JOIN sys_user u ON u.id = bm.userid AND bm.bmzt IN (3,5)
|
||||
LEFT JOIN lxy_hd hd ON mefp.hdid = hd.id
|
||||
$condition
|
||||
""").setParam("hdid", hdid).setParam("roleId", Roles.UNION_MANGER);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and(new Static("now()<hd.bmjzsj"));
|
||||
cnd.and("mefp.number", ">", 0);
|
||||
cnd.and("mefp.hdid", "=", hdid);
|
||||
cnd.and(new Static("(select count(1) from lxy_bm lb where lb.hdid = '" + hdid + "' and lb.ghid = mefp.ghid AND lb.bmzt is NOT null) > 0 "));
|
||||
|
||||
if (isAudit == 2) {
|
||||
cnd.and(new Static("(SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt = 3 )=0"));
|
||||
} else if (isAudit == 3) {
|
||||
cnd.and(new Static("(SELECT count( 1 ) FROM lxy_bm bm WHERE bm.hdid = mefp.hdid AND bm.ghid = mefp.ghid AND bm.bmzt = 3 )>0"));
|
||||
}
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "A06"})) {
|
||||
cnd.and(new Static("mefp.ghid in " + vi.getMangeUnionStr()));
|
||||
}
|
||||
if (year != null) {
|
||||
cnd.and("YEAR(hdkssj)", "=", year);
|
||||
}
|
||||
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("hdcjsj");
|
||||
cnd.desc("username");
|
||||
}
|
||||
cnd.groupBy(" mefp.ghid ");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return lxyHdService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询通过审核及待校工会审核的人员
|
||||
*
|
||||
* @param ghId
|
||||
* @param hdId
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
public Object findBm(String ghId, String hdId, Integer pageNumber, Integer pageSize) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT\n" +
|
||||
"l.id,\n" +
|
||||
"hd.id hdid,\n" +
|
||||
"u.id uid,\n" +
|
||||
"u.loginname,\n" +
|
||||
"u.username,\n" +
|
||||
"u.unitname,\n" +
|
||||
"u.unionname,\n" +
|
||||
"u.sex,\n" +
|
||||
"u.mobile,\n" +
|
||||
"TIMESTAMPDIFF(YEAR,u.birthday,CURDATE()) age,\n" +
|
||||
"bm.bmzt,\n" +
|
||||
"bm.ghid\n" +
|
||||
"FROM lxy_bm bm\n" +
|
||||
"LEFT JOIN lxy_hd hd ON hd.id = bm.hdid\n" +
|
||||
"LEFT JOIN Lxy_grxx l ON l.userid = bm.userid\n" +
|
||||
"LEFT JOIN `user` u ON u.id = bm.userid \n" +
|
||||
"WHERE bm.bmzt IN (3,4,5) AND bm.hdid = @hdid \n" +
|
||||
"AND bm.ghid = @ghid \n" +
|
||||
"GROUP BY u.username \n" +
|
||||
"ORDER BY bm.bmzt ASC");
|
||||
sql.setParam("hdid", hdId);
|
||||
sql.setParam("ghid", ghId);
|
||||
// List<Record> list = lxyBmService.list(sql);
|
||||
Pagination pagination = lxyBmService.listPage(pageNumber, pageSize, sql);
|
||||
return Result.success().addData(pagination);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object sh(String hdid, String ghid, Integer bmzt, String[] users) {
|
||||
for (String user : users) {
|
||||
lxyBmService.update(Chain.make("bmzt", bmzt), Cnd.where("ghid", "=", ghid).and("hdid", "=", hdid).and("userid", "=", user));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object grsh(String hdid, String ghid, Integer bmzt, String userid) {
|
||||
lxyBmService.update(Chain.make("bmzt", bmzt), Cnd.where("ghid", "=", ghid).and("hdid", "=", hdid).and("userid", "=", userid));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object yjSh(NutMap[] maps) {
|
||||
for (NutMap map : maps) {
|
||||
lxyBmService.update(Chain.make("bmzt", 5), Cnd.where("ghid", "=", map.get("ghid")).and("hdid", "=", map.get("hdid")).and("bmzt", "=", 3));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object doDelete(String id, String unionid, String userid, String hdid) {
|
||||
Trans.exec(() -> {
|
||||
lxyBmService.clear(Cnd.where("userid", "=", userid).and("hdid", "=", hdid).and("ghid", "=", unionid));
|
||||
baseService.dao().delete(Lxy_grxx.class, id);
|
||||
});
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package io.v.nutz.zgfw.model.lxy;
|
||||
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author: 1V
|
||||
* @DateTime: 2020/8/27 9:11
|
||||
* @Description: 疗休养报名
|
||||
*/
|
||||
@Table("Lxy_bm")
|
||||
public class Lxy_bm {
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("活动id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String hdid;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userid;
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String ghid;
|
||||
|
||||
@Column
|
||||
@Comment("报名时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String bmsj;
|
||||
|
||||
@Column
|
||||
@Comment("报名状态(1.待分工会审核 2.分工会审核不通过 3.待校工会审核 4 校工会审核不通过 5 报名成功 6 待填写个人资料)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer bmzt;
|
||||
|
||||
@Column
|
||||
@Comment("报名类型(1.分工会统一报名 2.个人报名)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer bmlx;
|
||||
|
||||
public Integer getBmlx() {
|
||||
return bmlx;
|
||||
}
|
||||
|
||||
public void setBmlx(Integer bmlx) {
|
||||
this.bmlx = bmlx;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = 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 getGhid() {
|
||||
return ghid;
|
||||
}
|
||||
|
||||
public void setGhid(String ghid) {
|
||||
this.ghid = ghid;
|
||||
}
|
||||
|
||||
public String getBmsj() {
|
||||
return bmsj;
|
||||
}
|
||||
|
||||
public void setBmsj(String bmsj) {
|
||||
this.bmsj = bmsj;
|
||||
}
|
||||
|
||||
public Integer getBmzt() {
|
||||
return bmzt;
|
||||
}
|
||||
|
||||
public void setBmzt(Integer bmzt) {
|
||||
this.bmzt = bmzt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user