This commit is contained in:
Paidax
2024-11-29 09:03:59 +08:00
commit 2ffadd89a7
3480 changed files with 879405 additions and 0 deletions
@@ -0,0 +1,43 @@
package io.v.nutz.zhgh.jdh.constants;
import io.v.nutz.base.annontation.SelectEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Optional;
@Getter
@SelectEnum
@AllArgsConstructor
public enum MechanismRolesEnum {
ZMWYH("84519c3978404af89147c42f19e9c5d8", "", "", "", "专门委员会"),
LDZYTJ("8768384741d74b4289c1ff943457a6a7", "88e7db2082444838bbf37d5135f3c6b5", "abc52072424e441d8a57f25bf21bbed8", "be88034510fb46679910a5a2b32cde9c", "劳动争议调解工作委员会"),
RSFLFP("1e0d88ec672e4b299c74fdd2c394be67", "5e3afc110c194efc8b1feb8d38b98169", "f63faad48deb48a8b4b17428b65b3667", "a6bfc01acc2946f6bd18336b7ce523b1", "人事福利分配工作委员会"),
JXKY("51935be4276244298f9e014852f50780", "3i70u31hhkjf5pfb2sed6l3n5a", "1q9squ5p5gjcsp093t482joc6v", "4mk69i8n16htmqeraitin6obnv", "教学科研工作委员会"),
MZPYGB("7f748bc17bd24d58a48935a05439027b", "1f8gjcs7jmi17q5anbfalg7sgh", "ub8et581doi73qnhds49bsjarq", "5leuv19hliif0qn1uuv4n7ajsq", "民主评议干部工作委员会"),
FWZG("1605503fddd542399ff8752360879073", "4hfd9u87q0j57r7vetil3mtn7t", "5tok74e0i4ggdqa98cna3vgont", "vcb01ef8tsi4ip5sjdrgjuvv6s", "房屋整改委员会"),
CJ("faee550db5f74ab8837012931c2706f6", "v8k9ed07gkipapsamtc55qihco", "qp5vdce27siqrppkioaprl6jvk", "1nm0uaiei2ij3raieqvf9j98mc", "财经工作委员会"),
TA("oljk9ojm5qh6jqm1spo3os5ge5", "827d20a5f2cb400ab1dff4335539ee9f", "c3e67e4f4060499a8ce6dbe0a9bb591e", "2b7194f5b17c4cc8b049ad945e6c6d04", "提案工作委员会"),
ZX("d9e2ea079038467893ea040a9772fc9b", "9198553383294ba7ba3f27be184d15fc", "b9e9bf91c7c24101902e786d0a33e47d", "33b76a43a6ca4c48be7f3ab0656b3a98", "执行委员会"),
ZXT("61d0177e63c14f41953532ad757bea29", "vb560igpuaj6jonlusll5tdgr7", "stlhub1r9ki9ardhvc0n23bcu9", "05mmc2tknuhinro63v429og7bb", "主席团管理"),
ZG("579ea46651c2496b98d3f46a7da36b47", "3mcgecjt5ihdbotik1qsu4lmod", "s0hmcv9hj2j6tpaubqt7t0n4q8", "utkugukl7miiqoedat5b3g2eqa", "资格领导小组"),
CB("7c3be7fd3d7e4eb2b7fb7b0cb565c02c", "63er6qdqhcjsuoq5qbih1oipaf", "pknqbkl4b4hhfqf2ve5seo94bs", "tbn79t49pohuuootcta5h5j3ar", "筹备领导小组");
private String id;
private String directorRoleId;
private String viceDirectorRoleId;
private String committeeRoleId;
private String description;
// private List<MechanismRolesEnum> childList;
public static MechanismRolesEnum getById(String id) {
MechanismRolesEnum[] values = MechanismRolesEnum.values();
Optional<MechanismRolesEnum> mechanismRolesEnum = Arrays.stream(values).filter(v -> v.getId().equals(id)).findFirst();
return mechanismRolesEnum.orElse(null);
}
}
@@ -0,0 +1,163 @@
package io.v.nutz.zhgh.jdh.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.models.Sys_unit;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt_zcdw;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.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.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@IocBean
@At("/platform/jdh/Common")
@Ok("json:full")
public class JdhCommonConrtroller {
private static final String SYS_DICT_DBT_ID = "9373a8db35ca428f9b24d7ceac96a550";
@Inject
private BaseService baseService;
@Inject
private Dao dao;
/**
* 获取开启教代会信息
*
* @return
*/
@At
@ViReturn
public Object getOpenJdhxx() {
Cnd cnd = Cnd.NEW();
cnd.and("jdhkqzt", "=", 1).desc("jdhkqsj");
List<Record> jdhxxList = baseService.dao().query("jdh_jdhxx", cnd);
return Result.success(jdhxxList);
}
/**
* 获取所有教代会信息
*
* @return
*/
@At
@ViReturn
public Object getAllJdhxx() {
return Result.success(baseService.dao().query("jdh_jdhxx", Cnd.NEW().desc("jdhkqsj")));
}
/**
* 资料类型
*
* @return
*/
@At
@ViReturn
public Object getGzzllx() {
return Result.success(baseService.dao().query("jdh_gzzllx", Cnd.NEW().asc("xh")));
}
@At
@ViReturn
public Object getDbt() {
return baseService.dao().query("sys_dict", Cnd.where("parentid", "=", SYS_DICT_DBT_ID));
}
/**
* 根据教代会获取代表团 此处没有角色权限控制
*
* @param jdhid
* @return
*/
@At
@ViReturn
public Object getDbtListByJdhId(String jdhid) {
return Result.success().addData(baseService.dao().query("jdh_dbt", Cnd.where("jdhid", "=", jdhid).asc("pxbh")));
}
@At
@ViReturn
public Object findDbxx(String id) {
Sql sql = Sqls.create("""
SELECT
u.username,
u.sex,
u.birthday,
u.nation mz,
u.education xl,
u.political zzmm,
u.mobile,
u.jobTitle zc,
u.position zw,
u.vita grjl,
dw.`NAME` AS dwname ,
db.files,
db.rewards
FROM
jdh_db db
LEFT JOIN sys_user u ON db.dbid = u.id
LEFT JOIN sys_unit dw ON dw.id = u.unitid
WHERE
u.id =@id
""");
sql.setParam("id", id);
List list = baseService.list(sql);
return Result.success().addData(list.get(0));
}
@At
@ViReturn
public Object getJdh2Gzzllx() {
return Result.success(baseService.dao().query("jdh2_gzzllx", Cnd.NEW().asc("xh")));
}
/**
* 查询代表团下的分工会
*
* @param delegationId
* @return
*/
@At
@RequiresPermissions("sys.jdh")
public Result listUnionByDelegationId(@Param("delegationId") String delegationId) {
List<Jdh_dbt_zcdw> zcdws = dao.query(Jdh_dbt_zcdw.class, Cnd.where("dbtid", "=", delegationId));
List<String> unitIds = zcdws.stream().map(Jdh_dbt_zcdw::getDwid).collect(Collectors.toList());
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("id", "in", unitIds));
Set<String> unionIds = units.stream().map(v -> v.getUnionid()).collect(Collectors.toSet());
List<Sys_union> unions = dao.query(Sys_union.class, Cnd.where("id", "in", unionIds));
return Result.success(unions);
}
@At
@RequiresPermissions("sys.jdh")
public Result listUnitByDelegationIdAndUnionId(@Param("delegationId") String delegationId, @Param("unionId") String unionId) {
List<Jdh_dbt_zcdw> zcdws = dao.query(Jdh_dbt_zcdw.class, Cnd.where("dbtid", "=", delegationId));
List<String> unitIds = zcdws.stream().map(Jdh_dbt_zcdw::getDwid).collect(Collectors.toList());
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("id", "in", unitIds).andEX("unionid", "=", unionId));
return Result.success(units);
}
}
@@ -0,0 +1,84 @@
package io.v.nutz.zhgh.jdh.controller;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.base.service.ViService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
@IocBean
@At("/platform/jdh/sjkb")
@Ok("json:full")
public class JdhSjkbController {
@Inject
private BaseService baseService;
@Inject
private ViService viService;
@At("")
@Ok("beetl:/platform/jdh/sjkb.html")
@RequiresPermissions("jdh.sjkb")
public void index() {
}
private static final String LXDB_ROLE_ID = "f411b5965d364876830aa6d597491038";
private static final String TYDB_ROLE_ID = "f3ca7ab46f764753b13e4a755ef13265";
private static final String ZSDB_ROLE_ID = "1427083503b74aa0885d104419b33170";
@At
public Object getData(String jdhid) {
try {
Sql sqldb = Sqls.create("""
select
(SELECT count(1) FROM jdh_db where roleid = '1427083503b74aa0885d104419b33170' and jdhid = @jdhid) as 正式代表,
(SELECT count(1) FROM jdh_db db left join sys_user u on u.id = db.dbid where db.roleid is not null and TIMESTAMPDIFF(YEAR, u.birthday,CURDATE()) < 40 and db.jdhid = @jdhid) as '青年代表(<40岁)',
(select count(1) from `jdh_db` db\s
left join teacher_meet_delegate tmd on tmd.teacherMeetId = db.jdhid
and tmd.userid = db.dbid
where db.jdhid = @jdhid AND tmd.technicalTitle in ('教授','副教授','正高级实验师','高级实验师','研究馆员','副研究馆员','正高级会计师(正高级审计师)','高级会计师(高级审计师)','研究馆员','副研究馆员','主任医(药、护、技)师','副主任医(药、护、技)师','幼儿园高级教师','研究员','副研究员')) as '高级职称',
(SELECT count(1) FROM jdh_db db left join sys_user u on u.id = db.dbid where db.roleid is not null and u.sex = '女' and db.jdhid = @jdhid) as '女教师代表',
(SELECT count(1) FROM jdh_db db left join sys_user u on u.id = db.dbid where db.roleid is not null and u.nation != '汉族' and db.jdhid = @jdhid) as '少数民族代表'
""");
sqldb.setParam("jdhid", jdhid);
Object o = baseService.list(sqldb).get(0);
Sql sqldbt = Sqls.create("""
SELECT
dbt.*,
dbt.dbtname delegationName,
dict.`code` delegationCode,
( SELECT count( 1 ) FROM jdh_db WHERE dbtid = dbt.id AND dbzt = 2 ) AS num
FROM
jdh_dbt dbt
LEFT JOIN sys_dict dict ON dict.`name` = dbt.dbtname
WHERE
dbt.jdhid = @jdhid
ORDER BY
dbt.`code`
""").setParam("jdhid", jdhid);
List<NutMap> dbtlist = viService.listMap(sqldbt);
Sql sqlhyhd = Sqls.create("select * from jdh_hyhd where jdhid = @jdhid").setParam("jdhid", jdhid);
List hyhdlist = baseService.list(sqlhyhd);
return Result.success().addData(NutMap.NEW().addv("db", o).addv("dbt", dbtlist).addv("hyhd", hyhdlist));
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,200 @@
package io.v.nutz.zhgh.jdh.controller.card;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.workersCongress.model.workersCongressSession;
import org.nutz.boot.starter.ftp.FtpService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
@IocBean
@At("/platform/card")
@Ok("json:full")
public class CardController {
@Inject
private Dao dao;
@Inject
private FtpService ftpService;
@At("")
@Ok("beetl:/mobile/card/card.html")
public void index() throws IOException {
}
@At
@ViReturn
public Object isDb(String type) {
if (StrUtil.isBlank(type)) {
return Result.error("参数错误");
}
//查询当前有没有开启
if ("jdh".equals(type)) {
List<Jdh_jdhxx> jdhxxList = dao.query(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
if (Lang.isEmpty(jdhxxList)) {
return Result.error("当前没有开启的教代会");
}
Jdh_jdhxx jdhxx = jdhxxList.get(0);
int count = dao.count(Sys_user_role.class, Cnd.where("userId", "=", ShiroUtil.getPlatformUid())
.and("roleId", "in", Lang.array(Roles.ZSDB, Roles.LXDB, Roles.TYDB))
.and("jdhid", "=", jdhxx.getId()));
if (count == 0) {
return Result.error("抱歉," + jdhxx.getJdhallname() + "教代会您不是代表");
} else {
return Result.success();
}
}
if ("gdh".equals(type)) {
List<workersCongressSession> list = dao.query(workersCongressSession.class, Cnd.where("startState", "=", true).desc("year"));
if (Lang.isEmpty(list)) {
return Result.error("当前没有开启的工代会");
}
workersCongressSession workSession = list.get(0);
int count = dao.count(Sys_user_role.class, Cnd.where("userId", "=", ShiroUtil.getPlatformUid())
.and("roleId", "in", Lang.array(Roles.GDHDB, Roles.GDHLX, Roles.GDHTY))
.and("gdhid", "=", workSession.getId()));
if (count == 0) {
return Result.error("抱歉," + workSession.getGdhAllName() + "工代会您不是代表");
} else {
return Result.success();
}
}
return Result.error("参数错误");
}
@At
@Ok("void")
public void showCard(String type, HttpServletResponse response) throws IOException, WriterException {
//获取数据
NutMap cardInfo = this.getCardInfo(type);
String cardBackImg = Globals.MyConfig.getString("cardBackImg");
// 读取底背景图片
Sys_file sysFile = dao.fetch(Sys_file.class, cardBackImg);
InputStream inputStream = ftpService.connect().retrieveFileStream(sysFile.getFilepath());
//InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/assets/mobile/img/card/back.jpg");
BufferedImage backgroundImage = ImageIO.read(inputStream);
// 创建一个新的BufferedImage对象,大小与底背景图片相同
BufferedImage resultImage = new BufferedImage(backgroundImage.getWidth(), backgroundImage.getHeight(), BufferedImage.TYPE_INT_RGB);
// 将底背景图片绘制到新的BufferedImage上
Graphics2D graphics = resultImage.createGraphics();
// 启用抗锯齿
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.drawImage(backgroundImage, 0, 0, null);
// 设置二维码的格式参数
EncodeHintType hintType = EncodeHintType.ERROR_CORRECTION;
ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.H;
// 创建编码选项的Map对象并设置错误纠正级别
Map<EncodeHintType, ErrorCorrectionLevel> hintMap = new EnumMap<>(EncodeHintType.class);
hintMap.put(hintType, errorCorrectionLevel);
// 生成二维码
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
NutMap nutMap = new NutMap();
nutMap.setv("userId", ShiroUtil.getPrincipalProperty("id"));
BitMatrix bitMatrix = multiFormatWriter.encode(Json.toJson(nutMap), BarcodeFormat.QR_CODE, 200, 200,
hintMap);
// 将二维码绘制到新的BufferedImage上
int qrCodeX = (resultImage.getWidth() - 200) / 2;
int qrCodeY = (resultImage.getHeight() - 200) / 2;
for (int x = 0; x < 200; x++) {
for (int y = 0; y < 200; y++) {
if (bitMatrix.get(x, y)) {
resultImage.setRGB(qrCodeX + x, qrCodeY + y, Color.BLACK.getRGB());
}
}
}
// 在新的BufferedImage上绘制文字,正文
String title = StrUtil.isNotBlank(cardInfo.getString("title")) ? cardInfo.getString("title") : "";
int titleY = (resultImage.getHeight() / 2) - 130;
Font titleFont = new Font("微软雅黑", Font.PLAIN, 26).deriveFont(Font.BOLD);
this.commonFont(resultImage, graphics, title, titleY, titleFont, Color.decode("#d1b930"));
// 姓名
String nameText = ShiroUtil.getPlatformUsername();
int nameTextY = (resultImage.getHeight() / 2) + 150;
Font nameFont = new Font("楷体", Font.BOLD, 40);
this.commonFont(resultImage, graphics, nameText, nameTextY, nameFont, Color.WHITE);
// 代表团
String dbtText = StrUtil.isNotBlank(cardInfo.getString("dbtText")) ? cardInfo.getString("dbtText") : "";
int dbtTextY = (resultImage.getHeight() / 2) + 200;
Font dbtFont = new Font("cursive", Font.BOLD, 24);
this.commonFont(resultImage, graphics, dbtText, dbtTextY, dbtFont, Color.WHITE);
// 返回生成的图片
ImageIO.write(resultImage, "png", response.getOutputStream());
}
//获取代表证上的信息
private NutMap getCardInfo(String type) {
NutMap nutMap = NutMap.NEW();
if (StrUtil.isNotBlank(type) && "jdh".equals(type)) {
//获取当前开启的教代会
List<Jdh_jdhxx> jdhxxList = dao.query(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
Jdh_jdhxx jdhxx = jdhxxList.get(0);
Sys_user_role userRole = dao.fetch(Sys_user_role.class, Cnd.where("jdhid", "=", jdhxx.getId())
.and("userId", "=", ShiroUtil.getPlatformUid())
.and("roleId", "in", Lang.array(Roles.ZSDB, Roles.LXDB, Roles.TYDB)));
Jdh_dbt dbt = dao.fetch(Jdh_dbt.class, userRole.getDbtid());
nutMap.put("title", jdhxx.getJdhallname() + "教代会");
nutMap.put("dbtText", dbt.getDbtname());
} else if (StrUtil.isNotBlank(type) && "gdh".equals(type)) {
//获取当前开启的工代会
List<workersCongressSession> list = dao.query(workersCongressSession.class, Cnd.where("startState", "=", true).desc("year"));
workersCongressSession congressSession = list.get(0);
Sys_user_role userRole = dao.fetch(Sys_user_role.class, Cnd.where("gdhid", "=", congressSession.getId())
.and("userId", "=", ShiroUtil.getPlatformUid())
.and("roleId", "in", Lang.array(Roles.GDHDB, Roles.GDHLX, Roles.GDHTY)));
Jdh_dbt dbt = dao.fetch(Jdh_dbt.class, userRole.getDbtid());
nutMap.put("title", congressSession.getGdhAllName() + "工代会");
nutMap.put("dbtText", dbt.getDbtname());
}
return nutMap;
}
private void commonFont(BufferedImage resultImage, Graphics2D graphics, String dbtText, int dbtTextY, Font dbtFont, Color color) {
graphics.setFont(dbtFont);
graphics.setColor(color);
FontMetrics dbtFontMetrics = graphics.getFontMetrics();
int dbtTextWidth = dbtFontMetrics.stringWidth(dbtText);
int dbtTextX = (resultImage.getWidth() - dbtTextWidth) / 2;
graphics.drawString(dbtText, dbtTextX, dbtTextY);
}
}
@@ -0,0 +1,145 @@
package io.v.nutz.zhgh.jdh.controller.cb;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
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.zhgh.jdh.model.cb.Jdh_cbwj;
import io.v.nutz.web.commons.utils.ShiroUtil;
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.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.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@At("/platform/jdh/cb/cbwj")
@Ok("json:full")
public class JdhCbwjController {
@Inject
private BaseService baseService;
@Inject
private FtpService ftpService;
@Inject
private FileService fileService;
@At("")
@Ok("beetl:/platform/jdh/cb/cbwj.html")
@RequiresPermissions("sys.jdh.cb.cbwj")
public void index() {
}
@At
@RequiresPermissions("sys.jdh.cb.cbwj")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy,
@Param(value = "zlname",required = false) String zlname,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "zllx",required = false) String zllx,
@Param(value = "union_id",required = false) String union_id) {
try {
Sql sql = Sqls.create("""
SELECT
cbwj.*,
f.id AS fileid,
f.filename,
f.filepath,
jdh.jdhallname,
lx.lxname,
u.unionname
FROM
jdh_cbwj cbwj
LEFT JOIN sys_file f ON f.reid = cbwj.id
LEFT JOIN jdh_jdhxx jdh ON jdh.id = cbwj.jdhid
LEFT JOIN jdh_gzzllx lx ON lx.id = cbwj.zllx
LEFT JOIN `user` u ON u.id = cbwj.userid
$condition
""");
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
}
if (Strings.isNotBlank(zlname)) {
cnd.and("cbwj.zlname", "like", "%" + zlname + "%");
}
if (Strings.isNotBlank(jdhid)) {
cnd.and("cbwj.jdhid", "=", jdhid);
}
if (Strings.isNotBlank(zllx)) {
cnd.and("cbwj.zllx", "=", zllx);
}
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) {
cnd.and("u.unionid", "=", Vi.getUnionId());
}
if (Strings.isNotBlank(union_id)) {
cnd.and("u.unionid", "=", union_id);
}
cnd.desc("jdh.jdhallname");
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
return Result.error();
}
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.cb.cbwj")
public Object doAdd(Jdh_cbwj jdh_cbwj) {
String id = R.UU32();
jdh_cbwj.setId(id);
jdh_cbwj.setUserid(ShiroUtil.getPrincipalProperty("id").toString());
jdh_cbwj.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
jdh_cbwj.setTime(DateUtil.getDate());
baseService.insert("jdh_cbwj", Chain.from(jdh_cbwj));
return null;
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.cb.cbwj")
public Object doDelete(String id,String filepath) {
try {
baseService.clear("jdh_cbwj", Cnd.where("id", "=", id));
baseService.clear("sys_file", Cnd.where("reid", "=", id));
ftpService.delete(filepath);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.cb.cbwj")
public Object doEdit(Jdh_cbwj jdh_cbwj) {
baseService.update("jdh_cbwj", Chain.from(jdh_cbwj), Cnd.where("id", "=", jdh_cbwj.getId()));
return null;
}
}
@@ -0,0 +1,273 @@
package io.v.nutz.zhgh.jdh.controller.cb;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_mefp;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.db.Jdh_lxty_db;
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.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/17 17:40
*/
@IocBean
@At("/platform/jdh/cb/mefp")
@Ok("json:full")
public class JdhMefpController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jdh/cb/mefp.html")
@RequiresPermissions("sys.jdh.cb.mefp")
public void index() {
}
@At
@RequiresPermissions("sys.jdh.cb.mefp")
public Object data(@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "union_id",required = false) String union_id) {
try {
Sql sql = Sqls.create("""
SELECT
dbt.id,
dbt.dbtname,
(
SELECT
count( 1 )
FROM
`user`
WHERE
member = 1 AND
unionId IN ( SELECT fghid FROM jdh_dbt_zcfgh jbz WHERE jbz.dbtid = dbt.id )) AS ghzrs,
( SELECT count( 1 ) FROM `jdh_db` WHERE dbtid = dbt.id AND roleId = '1427083503b74aa0885d104419b33170') AS dbzrs,
(select count(1) from `jdh_db` db left join sys_user u on u.id = db.dbid WHERE db.dbtid = dbt.id AND u.sex = '男') manCount,
(select count(1) from `jdh_db` db left join sys_user u on u.id = db.dbid WHERE db.dbtid = dbt.id AND u.sex = '女') womanCount,
( SELECT COUNT( 1 ) FROM jdh_db WHERE dbtid = dbt.id AND roleid = 'f411b5965d364876830aa6d597491038') AS lxCount,
( SELECT COUNT( 1 ) FROM jdh_db WHERE dbtid = dbt.id AND roleid = 'f3ca7ab46f764753b13e4a755ef13265') AS tyCount,
( SELECT COUNT( 1 ) FROM jdh_db WHERE dbtid = dbt.id AND roleid in ('f411b5965d364876830aa6d597491038','f3ca7ab46f764753b13e4a755ef13265')) AS lxty
FROM
`jdh_dbt` dbt
$condition
""");
CndPlus cndPlus = CndPlus.create();
cndPlus.andEx("dbt.jdhid", "=", jdhid);
// cndPlus.andEx("uni.id", "=", union_id);
// cndPlus.asc("unioncode");
sql.setCondition(cndPlus);
return Result.success().addData(baseService.list(sql));
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.cb.mefp")
public Object doMefp(Jdh_mefp mefp) {
try {
int count = baseService.count("jdh_mefp", Cnd.where("jdhid", "=", mefp.getJdhid())
.and("fghid", "=", mefp.getFghid()));
if (count == 0) {
//没有分配过
mefp.setId(R.UU32());
baseService.insert("jdh_mefp", Chain.from(mefp));
} else {
//进行修改
Chain upChain = Chain.make("fps", mefp.getFps());
baseService.update("jdh_mefp", upChain, Cnd.where("jdhid", "=", mefp.getJdhid())
.and("fghid", "=", mefp.getFghid()));
}
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
/**
* 查询该代表团下的列席特邀代表
*
* @param fghid
* @return
*/
@At
@RequiresPermissions("sys.jdh.cb.mefp")
public Object lxtydbPgaeData(@Param(value = "fghid",required = false) String fghid,
@Param(value = "jdhid",required = false) String jdhid) {
try {
Sql sql = Sqls.create("""
SELECT
db.*,
u.loginname,
u.username,
u.mobile,
u.sex,
r.name as rolename
FROM
jdh_db db
LEFT JOIN sys_user u ON u.id = db.dbid
LEFT JOIN sys_role r ON r.id = db.roleid
WHERE
db.dbfghid = @fghid
AND db.jdhid = @jdhid
AND db.roleid IN (
'f3ca7ab46f764753b13e4a755ef13265',
'f411b5965d364876830aa6d597491038')
""").setParam("fghid", fghid).setParam("jdhid", jdhid);
List list = baseService.list(sql);
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 查询本届没有被设置为列席特邀或者是正式代表的用户
*
* @param fghid
* @param keyword
* @return
*/
@At
@RequiresPermissions("sys.jdh.cb.mefp")
public Object queryNolxtyDb(@Param(value = "fghid",required = false) String fghid,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "keyword",required = false) String keyword) {
try {
// Sql sql = Sqls.create("SELECT\n" +
// "\tu.id,\n" +
// "\tu.username,\n" +
// "\tu.loginname,\n" +
// "\tdw.id AS dbunitid,\n" +
// "\tdw.NAME AS dbunitname,\n" +
// "\tdw.NAME AS dwname,\n" +
// "\tfgh.id AS fghid,\n" +
// "\tfgh.id AS dbfghid,\n" +
// "\tfgh.unionname AS dbfghname \n" +
// "FROM\n" +
// "\tsys_user u\n" +
// "\tLEFT JOIN sys_unit dw ON dw.id = u.unitid\n" +
// "\tLEFT JOIN sys_union fgh ON fgh.id = dw.unionid \n" +
// "WHERE\n" +
// "\t( u.username LIKE @keyword OR u.loginname LIKE @keyword ) \n" +
// "\tAND u.id NOT IN(select dbid from jdh_db where dbzt=2 and jdhid = @jdhid) \n" +
// "\tAND u.id NOT IN (\n" +
// "\tSELECT\n" +
// "\t\tdbid \n" +
// "\tFROM\n" +
// "\t\tjdh_lxty_db \n" +
// "\tWHERE\n" +
// "\tjdhid = @jdhid)");
// sql.setParam("jdhid", jdhid).setParam("keyword", "%" + keyword + "%");
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
dw.id AS dbunitid,
dw.NAME AS dbunitname,
dw.NAME AS dwname,
fgh.id AS fghid,
fgh.id AS dbfghid,
fgh.unionname AS dbfghname\s
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union fgh ON fgh.id = dw.unionid\s
WHERE
( u.username LIKE @keyword OR u.loginname LIKE @keyword )
AND
u.id NOT IN ( SELECT dbid FROM jdh_db WHERE jdhid = @jdhid )
""");
sql.setParam("jdhid", jdhid).setParam("keyword", "%" + keyword + "%");
Pagination pagination = baseService.listPage(1, 10, sql);
return Result.success().addData(pagination.getList());
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
private static final String LXDB_ROLE_ID = "f411b5965d364876830aa6d597491038";
private static final String TYDB_ROLE_ID = "f3ca7ab46f764753b13e4a755ef13265";
/**
* 列席特邀代表添加
*
* @param db
* @return
*/
@At
@RequiresPermissions("sys.jdh.cb.mefp")
public Object doAddLxTyDb(Jdh_lxty_db db, Integer lx) {
try {
Jdh_db zsdb = new Jdh_db();
zsdb.setId(R.UU32());
zsdb.setDbid(db.getDbid());
zsdb.setDbunitid(db.getDbunitid());
zsdb.setDbunitname(db.getDbunitname());
zsdb.setDbfghid(db.getDbfghid());
zsdb.setDbfghname(db.getDbfghname());
zsdb.setDbtid(db.getDbtid());
zsdb.setJdhid(db.getJdhid());
zsdb.setDbzt(2);
zsdb.setRoleid(lx == 1 ? TYDB_ROLE_ID : LXDB_ROLE_ID);
baseService.insert("jdh_db", Chain.from(zsdb));
Chain surChain = Chain.make("userid", db.getDbid()).add("jdhid", db.getJdhid())
.add("roleid", lx == 1 ? TYDB_ROLE_ID : LXDB_ROLE_ID).add("dbtid", db.getDbtid());
baseService.insert("sys_user_role", surChain);
// db.setRoleid(lx == 1 ? TYDB_ROLE_ID : LXDB_ROLE_ID);
// db.setId(R.UU32());
// baseService.insert("jdh_lxty_db", Chain.from(db));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.cb.mefp")
public Object delLxtyDb(String dbid,String jdhid) {
try {
baseService.clear("jdh_db", Cnd.where("dbid", "=", dbid).and("jdhid", "=", jdhid));
baseService.clear("sys_user_role", Cnd.where("dbid", "=", dbid).and("jdhid", "=", jdhid));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,316 @@
package io.v.nutz.zhgh.jdh.controller.cb;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.db.Jdh_lxty_db;
import io.v.nutz.zhgh.jdh.model.zzjg.*;
import io.v.nutz.sys.models.Sys_user_role;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.ArrayList;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/17 15:19
*/
@IocBean
@At("/platform/jdh/cb/jcgl")
@Ok("json:full")
public class JdhjcglController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jdh/cb/jcgl.html")
@RequiresPermissions("sys.jdh.cb.jcgl")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.cb.jcgl")
public Object doDelete(String id) {
Trans.exec(() -> {
Cnd jdhcnd = Cnd.where("jdhid", "=", id);
baseService.clear("jdh_jdhxx", Cnd.where("id", "=", id));
baseService.clear("jdh_dbt", jdhcnd);
baseService.clear("jdh_dbt_zcfgh", jdhcnd);
baseService.clear("jdh_mefp", jdhcnd);
//删除筹备文件
baseService.clear("jdh_cbwj", Cnd.where("jdhid", "=", id));
//删除正式代表
baseService.clear("jdh_db", jdhcnd);
//删除列席特邀代表
baseService.clear("jdh_lxty_db", jdhcnd);
List<Record> hyhdList = baseService.list(Sqls.create("select * from jdh_hyhd where jdhid = @jdhid").setParam("jdhid", id));
for (Record hyhd : hyhdList) {
//删除会议活动附件信息
baseService.clear("sys_file", Cnd.where("reid", "=", hyhd.getString("id")));
//删除会议活动成员
baseService.clear("jdh_hyhd_cy", Cnd.where("hyhdid", "=", hyhd.getString("id")));
}
//删除会议活动信息
baseService.clear("jdh_hyhd", jdhcnd);
baseService.clear("jdh_hyhd", jdhcnd);
//删除用户权限
baseService.clear("sys_user_role", jdhcnd);
//删除代表小组
baseService.dao().clear(JdhGroup.class, jdhcnd);
baseService.dao().clear(JdhGroupAndDbt.class, jdhcnd);
});
return null;
}
@At
@RequiresPermissions("sys.jdh.cb.jcgl")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumnber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "searchYear",required = false) Integer searchYear,
@Param(value = "jdhjs",required = false) String jdhjs,
@Param(value = "jdhcs",required = false) String jdhcs,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy) {
try {
Cnd cnd = Cnd.NEW();
if (searchYear != null) {
cnd.and("jdhnf", "=", searchYear);
}
if (Strings.isNotBlank(jdhjs)) {
cnd.and("jdhjs", "=", jdhjs);
}
if (Strings.isNotBlank(jdhcs)) {
cnd.and("jdhcs", "=", jdhcs);
}
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.desc("jdhkqsj").desc("jdhjs").desc("jdhcs");
}
Pagination pagination = baseService.listPage(pageNumnber, pageSize, "jdh_jdhxx", cnd);
return Result.success().addData(pagination);
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.cb.jcgl")
public Object jdhztChange(String id,boolean status) {
try {
baseService.update("jdh_jdhxx", Chain.make("jdhkqzt", !status), Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.cb.jcgl")
public Object editDo(Jdh_jdhxx jdhxx) {
try {
jdhxx.setJdhallname("" + jdhxx.getJdhjs() + "届第" + jdhxx.getJdhcs() + "");
baseService.update(jdhxx);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.cb.jcgl")
public Object doAdd(@Param("..") Jdh_jdhxx jdhxx,boolean isExtend) throws Exception {
try {
//判断新建的教代会届次是否存在
int count = baseService.count("jdh_jdhxx", Cnd.where("jdhjs", "=", jdhxx.getJdhjs()).and("jdhcs", "=", jdhxx.getJdhcs()));
if (count > 0) {
return Result.error().addMsg("当前届次的教代会已存在,无法重复创建!");
}
jdhxx.setId(R.UU32());
jdhxx.setJdhkqzt(true);
jdhxx.setJdhkqsj(DateUtil.getDateTime());
jdhxx.setJdhallname("" + jdhxx.getJdhjs() + "届第" + jdhxx.getJdhcs() + "");
baseService.insert("jdh_jdhxx", Chain.from(jdhxx));
//是否继承上一次教代会的数据
if (isExtend) {
//根据此次教代会信息找到上一次教代会的信息
Cnd preJdh = Cnd.NEW();
preJdh.and("jdhjs", "=", jdhxx.getJdhjs()).and("jdhcs", "=", getCs(jdhxx.getJdhcs()));
//preJdh.and("jdhjs", "=", jdhxx.getJdhjs()).and("jdhkqsj", "<", jdhxx.getJdhkqsj()).desc("jdhkqsj");
List<Record> preJdhxxList = baseService.dao().query("jdh_jdhxx", preJdh);
//存在上一次教代会信息才能延用
if (preJdhxxList.size() > 0) {
String oldjdhid = preJdhxxList.get(0).getString("id");
this.extendPreJdh(oldjdhid, jdhxx.getId());
}
}
return Result.success().addMsg("教代会创建成功!");
} catch (Exception e) {
return Result.error();
}
}
public static String getCs(String cs) {
if (cs.equals("")) {
return "";
} else if (cs.equals("")) {
return "";
} else if (cs.equals("")) {
return "";
} else if (cs.equals("")) {
return "";
} else if (cs.equals("")) {
return "";
}
return "";
}
private static final String CBLDXZ_ROLE_ID = "df80289878bd4a84bacb44567d145bfc";
private static final String ZGSCXZ_ROLE_ID = "262e11bfe387404e8d46831f7a22d13d";
private static final String ZXT_MSZ_ROLE_ID = "9b54205ef5f34d1a843709a5cf23ee44";
private static final String ZXT_FMSZ_ROLE_ID = "f2317602ec0d49b9ba3b090a9065eaaf";
private static final String ZXT_CY_ROLE_ID = "517161a4ccba4898a1d627a7ea93ff59";
private static final String ZXWYH_ZR_ROLE_ID = "9198553383294ba7ba3f27be184d15fc";
private static final String ZXWYH_FZR_ROLE_ID = "b9e9bf91c7c24101902e786d0a33e47d";
private static final String ZXWYH_WY_ROLE_ID = "33b76a43a6ca4c48be7f3ab0656b3a98";
private static final String SYS_DICT_TAWYH_ID = "425efc05403b49dcbdbbe93122a77513";
private static final String JDH_TA_WXY_WY_ROLE_ID = "2b7194f5b17c4cc8b049ad945e6c6d04";
private static final String JDH_TA_WXY_FZR_ROLE_ID = "c3e67e4f4060499a8ce6dbe0a9bb591e";
private static final String JDH_TA_WXY_ZR_ROLE_ID = "827d20a5f2cb400ab1dff4335539ee9f";
private static final String JDH_DBT_CZY_ROLE_ID = "0af36fa65ee742deb46a1fb1ded268ff";
private static final String JDH_DBT_TZ_ROLE_ID = "c1765c03459840c2b621d140f575c869";
private static final String JDH_DBT_FTZ_ROLE_ID = "6445f21685c5489aa212a986cfbeecce";
public void extendPreJdh(String oldid, String newid) {
List<Jdh_jgcy> jgcyList = baseService.dao().query(Jdh_jgcy.class, Cnd.where("jdhid", "=", oldid));
List<Jdh_jgcy> newJgcyList = new ArrayList<>();
jgcyList.forEach(item -> {
item.setId(R.UU32());
item.setJdhid(newid);
newJgcyList.add(item);
});
List<Jdh_dbt> newDbtList = new ArrayList<>();
List<Jdh_dbt_zcfgh> newDbtZcfghList = new ArrayList<>();
List<Sys_user_role> tzFtzList = new ArrayList<>();
List<Sys_user_role> newCzyList = new ArrayList<>();
List<Jdh_db> newDbList = new ArrayList<>();
List<Sys_user_role> newDbRoleList = new ArrayList<>();
List<Jdh_lxty_db> newLxtyList = new ArrayList<>();
//代表团
List<Jdh_dbt> dbtList = baseService.dao().query(Jdh_dbt.class, Cnd.where("jdhid", "=", oldid));
for (Jdh_dbt r : dbtList) {
//新增本届代表团
String olddbtid = r.getId();
String code = r.getCode();
String newdbtid = R.UU32();
r.setId(newdbtid);
r.setJdhid(newid);
r.setCode(code);
r.setCjsj(DateUtil.getDate());
newDbtList.add(r);
//组成基层工会
List<Jdh_dbt_zcfgh> zcfghList = baseService.dao().query(Jdh_dbt_zcfgh.class, Cnd.where("dbtid", "=", olddbtid));
for (Jdh_dbt_zcfgh fgh : zcfghList) {
fgh.setId(R.UU32());
fgh.setJdhid(newid);
fgh.setDbtid(newdbtid);
newDbtZcfghList.add(fgh);
}
//团长 副团长
List<Sys_user_role> tzftzList = baseService.dao().query(Sys_user_role.class, Cnd.where("dbtid", "=", olddbtid).and("roleid", "in", Lang.array(JDH_DBT_TZ_ROLE_ID, JDH_DBT_FTZ_ROLE_ID)));
for (Sys_user_role tzftz : tzftzList) {
tzftz.setJdhid(newid);
tzftz.setDbtid(newdbtid);
tzFtzList.add(tzftz);
}
//操作员
List<Sys_user_role> czyList = baseService.dao().query(Sys_user_role.class, Cnd.where("dbtid", "=", olddbtid).and("roleid", "=", JDH_DBT_CZY_ROLE_ID));
for (Sys_user_role czy : czyList) {
czy.setJdhid(newid);
czy.setDbtid(newdbtid);
newCzyList.add(czy);
}
//正式代表
List<Jdh_db> dbList = baseService.dao().query(Jdh_db.class, Cnd.where("jdhid", "=", oldid).and("dbtid", "=", olddbtid).and("dbzt", "=", 2));
for (Jdh_db db : dbList) {
db.setId(R.UU32());
db.setJdhid(newid);
db.setDbtid(newdbtid);
newDbList.add(db);
Sys_user_role userRole = new Sys_user_role();
userRole.setRoleId(db.getRoleid());
userRole.setJdhid(db.getJdhid());
userRole.setUserId(db.getDbid());
userRole.setDbtid(newdbtid);
newDbRoleList.add(userRole);
}
//列席特邀代表
List<Jdh_lxty_db> lxtydbList = baseService.dao().query(Jdh_lxty_db.class, Cnd.where("jdhid", "=", oldid).and("dbtid", "=", olddbtid));
for (Jdh_lxty_db lxtydb : lxtydbList) {
lxtydb.setId(R.UU32());
lxtydb.setJdhid(newid);
lxtydb.setDbtid(newdbtid);
newLxtyList.add(lxtydb);
}
}
baseService.dao().insert(newJgcyList);
baseService.dao().fastInsert(newDbtList);
baseService.dao().insert(newDbtZcfghList);
baseService.dao().insert(tzFtzList);
baseService.dao().insert(newCzyList);
baseService.dao().fastInsert(newDbList);
baseService.dao().insert(newDbRoleList);
baseService.dao().insert(newLxtyList);
}
}
@@ -0,0 +1,73 @@
package io.v.nutz.zhgh.jdh.controller.cxtj;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
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.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/24 16:42
*/
@IocBean
@At("/platform/jdh/cxtj/sjzl")
@Ok("json:full")
public class JdhCxtjSjzlController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jdh/cxtj/sjzl.html")
@RequiresPermissions("jdh.cxtj.sjzl")
public void index() {
}
@At
@RequiresPermissions("jdh.cxtj.sjzl")
public Object data(String jdhid) {
try {
NutMap res = NutMap.NEW();
Cnd cnd = Cnd.where("jdhid", "=", jdhid);
Cnd cbldxz = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "7c3be7fd3d7e4eb2b7fb7b0cb565c02c");
Cnd zgscxz = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "579ea46651c2496b98d3f46a7da36b47");
Cnd zxt = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "61d0177e63c14f41953532ad757bea29");
Cnd zxwyh = Cnd.where("jdhid", "=", jdhid).and("jgid", "=", "d9e2ea079038467893ea040a9772fc9b");
Cnd zmwyh = Cnd.where(new Static("jdhid='"+jdhid+"' and jgid in (select id from jdh_jgsz where parentId='84519c3978404af89147c42f19e9c5d8')"));
res.setv("jdhxx", baseService.dao().fetch("jdh_jdhxx", Cnd.where("id", "=", jdhid)));
res.setv("cbldxz", baseService.count("jdh_jgcy", cbldxz));
res.setv("zgscxz", baseService.count("jdh_jgcy", zgscxz));
res.setv("zxt", baseService.count("jdh_jgcy", zxt));
res.setv("zxwyh", baseService.count("jdh_jgcy", zxwyh));
res.setv("db", baseService.count("jdh_db", Cnd.where("jdhid", "=", jdhid).and("dbzt", "=", 2)));
res.setv("dbt", baseService.count("jdh_dbt", cnd));
res.setv("zmwyh", baseService.count("jdh_jgcy", zmwyh));
return Result.success().addData(res);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,61 @@
package io.v.nutz.zhgh.jdh.controller.cxtj;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
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.List;
@IocBean
@At("/platform/jdh/cxtj/dbtj")
@Ok("json:full")
public class JdhDbtjController {
@Inject
private Dao dao;
@At("")
@Ok("beetl:/platform/jdh/cxtj/dbtj.html")
//@RequiresPermissions("jdh.cxtj.sjzl")
public void index() {
}
@At
@ViReturn
public Object data(@Param(value = "jdhid",required = false) String jdhid) {
Sql sql = Sqls.create("""
SELECT
dbt.id,
dbt.dbtname,
( SELECT count( 1 ) FROM `jdh_db` WHERE dbtid = dbt.id AND roleId = '1427083503b74aa0885d104419b33170') AS dbzrs,
(select count(1) from `jdh_db` db left join sys_user u on u.id = db.dbid WHERE db.dbtid = dbt.id AND u.sex = '男') manCount,
(select count(1) from `jdh_db` db left join sys_user u on u.id = db.dbid WHERE db.dbtid = dbt.id AND u.sex = '女') womanCount,
(select count(1) from `jdh_db` db left join sys_user u on u.id = db.dbid WHERE db.dbtid = dbt.id AND TIMESTAMPDIFF(YEAR, u.birthday,CURDATE()) < 40 ) youthCount,
(select count(1) from `jdh_db` db\s
left join teacher_meet_delegate tmd on tmd.teacherMeetId = db.jdhid
and tmd.userid = db.dbid
where db.dbtid = dbt.id and tmd.technicalTitle in ('教授','副教授','正高级实验师','高级实验师','研究馆员','副研究馆员','正高级会计师(正高级审计师)','高级会计师(高级审计师)','研究馆员','副研究馆员','主任医(药、护、技)师','副主任医(药、护、技)师','幼儿园高级教师','研究员','副研究员')) as seniorProTitleCount
FROM
`jdh_dbt` dbt
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("dbt.jdhid", "=", jdhid);
sql.setCondition(cnd);
return Daos.query(dao, sql.toString(), Sqls.callback.maps());
}
}
@@ -0,0 +1,646 @@
package io.v.nutz.zhgh.jdh.controller.db;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.db.TeacherMeetDelegate;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUserRoleService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt_zcdw;
import io.v.nutz.zhgh.jdh.vo.TeacherDelegateExcelImportVo;
import io.v.nutz.zhgh.thirtyteach.template.ThirtyTeachTemp;
import io.v.nutz.zhgh.workersCongress.model.workersCongressSession;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
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.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.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.trans.Trans;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/20 8:40
*/
@IocBean
@At("/platform/jdh/db/dbgl")
@Ok("json:full")
@Slf4j
public class JdhDbGlController {
private static final String JDH_ZSDB_ROLE_ID = "1427083503b74aa0885d104419b33170";
private static final String JDH_LXDB_ROLE_ID = "f411b5965d364876830aa6d597491038";
private static final String JDH_TYDB_ROLE_ID = "f3ca7ab46f764753b13e4a755ef13265";
private static final String JDH_TZ_ROLE_ID = "c1765c03459840c2b621d140f575c869";
private static final String JDH_FTZ_ROLE_ID = "6445f21685c5489aa212a986cfbeecce";
@Inject
private BaseService baseService;
@Inject
private SysRoleService sysRoleService;
@Inject
private SysUserService sysUserService;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
@Inject
private Dao dao;
@At("")
@Ok("beetl:/platform/jdh/db/dbgl.html")
@RequiresPermissions("sys.jdh.db.dbgl")
public void index() {
}
@At
@RequiresPermissions("sys.jdh.db.dbgl")
public Object pageData(@Param(value = "pageNumber", required = false) Integer pageNumber, @Param(value = "pageSize", required = false) Integer pageSize, @Param(value = "pageOrderName", required = false) String pageOrderName, @Param(value = "pageOrderBy", required = false) String pageOrderBy, @Param(value = "searchName", required = false) String searchName, @Param(value = "searchKeyword", required = false) String searchKeyword, @Param(value = "jdhid", required = false) String jdhid, @Param(value = "unitid", required = false) String unitid, @Param(value = "dbtid", required = false) String dbtid, @Param(value = "unionid", required = false) String unionid, @Param(value = "dbsf", required = false) String dbsf) {
try {
Sql sql = Sqls.create("""
SELECT
u.username,
u.loginname,
u.sex,
u.mobile,
TIMESTAMPDIFF(YEAR, u.birthday,CURDATE()) as age,
db.political,
db.education,
db.jobTitle,
db.position,
jdh.jdhallname AS sessionName,
db.id,
db.dbid,
db.jdhid,
db.dbunitid,
db.dbunitname,
db.dbfghid,
db.dbfghname,
db.dbzt,
jdh.jdhallname,
dbt.dbtname,
r.NAME AS roleName,
(sum(case when sur.roleId = 'c1765c03459840c2b621d140f575c869' then 1 else 0 end)>0) isTz,
(sum(case when sur.roleId = '6445f21685c5489aa212a986cfbeecce' then 1 else 0 end)>0) isFtz
FROM
jdh_db db
LEFT JOIN `user` u ON u.id = db.dbid
LEFT JOIN sys_role r ON r.id = db.roleid
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
LEFT JOIN jdh_jdhxx jdh ON jdh.id = db.jdhid
LEFT JOIN sys_user_role sur on sur.userId = db.dbid and sur.jdhid = jdh.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.groupBy("db.id");
cnd.and("db.dbzt", "=", 2);
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
if (Strings.isNotBlank(jdhid)) {
cnd.and("db.jdhid", "=", jdhid);
}
if (Strings.isNotBlank(dbtid)) {
cnd.and("db.dbtid", "=", dbtid);
}
if (Strings.isNotBlank(unitid)) {
cnd.and("u.unitid", "=", unitid);
}
if (Strings.isNotBlank(unionid)) {
cnd.and("u.unionid", "=", unionid);
}
if (Strings.isNotBlank(dbsf)) {
cnd.and("r.NAME", "=", dbsf);
}
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.desc("jdh.jdhkqsj").asc("dbt.dbtname").asc("u.unionname");
}
cnd.asc("db.id");
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.dbgl")
public Object doDelete(@Param("::data") List<NutMap> dataMapList) {
try {
String delRoles[] = new String[]{JDH_ZSDB_ROLE_ID, JDH_LXDB_ROLE_ID, JDH_TYDB_ROLE_ID, JDH_TZ_ROLE_ID, JDH_FTZ_ROLE_ID};
List<String> ids = dataMapList.stream().map(v -> v.getString("id")).collect(Collectors.toList());
dao.clear(Jdh_db.class, Cnd.where("id", "in", ids));
for (NutMap map : dataMapList) {
//删除代表信息 团长 副团长 代表权限
baseService.clear("sys_user_role", Cnd.where("userid", "=", map.getString("dbid")).and("jdhid", "=", map.getString("jdhid")).and("roleid", "in", delRoles));
}
sysRoleService.clearCache();
sysUserService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.dbgl")
public Object doAdd(String jdhid, String dbtid, String role, @Param("::user") List<NutMap> userList) {
try {
for (NutMap userMap : userList) {
//如果这个人是代表团操作员上报的 还处在校工会审核中 修改代表表状态 添加sys_user_role权限
Record fetch = baseService.dao().fetch("jdh_db", Cnd.where("dbid", "=", userMap.getString("id")).and("jdhid", "=", jdhid));
if (fetch != null) {
fetch.set("roleid", role);
fetch.set("dbzt", 2);
baseService.update("jdh_db", Chain.from(fetch), Cnd.where("id", "=", fetch.getString("id")));
Chain surChain = Chain.make("userid", fetch.getString("dbid")).add("jdhid", fetch.getString("jdhid")).add("roleid", role).add("dbtid", fetch.getString("dbtid"));
baseService.insert("sys_user_role", surChain);
} else {
Jdh_db db = new Jdh_db();
db.setId(R.UU32());
db.setDbid(userMap.getString("id"));
db.setPolitical(userMap.getString("political"));
db.setEducation(userMap.getString("education"));
db.setJobTitle(userMap.getString("jobTitle"));
db.setPosition(userMap.getString("position"));
db.setDbunitid(userMap.getString("dwid"));
db.setDbunitname(userMap.getString("dwname"));
db.setDbfghid(userMap.getString("ghid"));
db.setDbfghname(userMap.getString("unionname"));
db.setDbtid(dbtid);
db.setJdhid(jdhid);
db.setDbzt(2);
db.setRoleid(role);
baseService.insert("jdh_db", Chain.from(db));
Chain surChain = Chain.make("userid", userMap.getString("id")).add("jdhid", jdhid).add("roleid", role).add("dbtid", dbtid);
baseService.insert("sys_user_role", surChain);
}
}
sysRoleService.clearCache();
sysUserService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.db.dbgl")
public Object representativeRoleOptions() {
return List.of(Map.of("label", "正式代表", "value", Roles.ZSDB), Map.of("label", "列席代表", "value", Roles.LXDB), Map.of("label", "特邀代表", "value", Roles.TYDB));
}
@Inject
private SysUserRoleService sysUserRoleService;
@At
@ViReturn
@RequiresPermissions("sys.jdh.db.dbgl")
public Object modifyRepresentativeInfo(Jdh_db db) {
Record fetch = baseService.dao().fetch("jdh_db", Cnd.where("dbid", "=", db.getDbid()).and("jdhid", "=", db.getJdhid()));
sysUserRoleService.update(Chain.make("roleId", db.getRoleid()), Cnd.where("jdhid", "=", db.getJdhid()).and("userId", "=", db.getDbid()).and("roleid", "=", fetch.getString("roleid")));
viService.updateIgnoreNull(db);
sysRoleService.clearCache();
sysUserService.clearCache();
return null;
}
@At("/representativeInfo/?")
@ViReturn
@RequiresPermissions("sys.jdh.db.dbgl")
public Object representativeInfo(String id) {
Sql sql = Sqls.create("""
SELECT
db.*,
u.username,
u.loginname
FROM
jdh_db db
left join sys_user u on db.dbid = u.id
WHERE
db.id = @id
""").setParam("id", id);
return viService.fetch(sql);
}
@Inject
private ViService viService;
@At
public Object queryXldUser(String jdhid, String query) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.sex,
u.loginname,
u.jobTitle,
u.political,
u.education,
u.position,
u.mobile,
dw.id AS dwid,
dw.NAME AS dwname,
gh.id AS ghid,
gh.unionname
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.id = dw.unionid
WHERE
u.id NOT IN ( SELECT dbid FROM jdh_db WHERE jdhid = @jdhid )
AND (
u.username LIKE @query
OR u.loginname LIKE @query)
""");
sql.setParam("query", "%" + query + "%");
sql.setParam("jdhid", jdhid);
Pagination pagination = baseService.listPage(1, 10, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.dbgl")
public Object fpXldToDbt(@Param("::user") List<NutMap> userMapList, String jdhid) {
try {
for (NutMap userMap : userMapList) {
Jdh_db db = new Jdh_db();
db.setId(R.UU32());
db.setDbid(userMap.getString("id"));
db.setPolitical(userMap.getString("political"));
db.setEducation(userMap.getString("education"));
db.setJobTitle(userMap.getString("jobTitle"));
db.setPosition(userMap.getString("position"));
db.setDbunitid(userMap.getString("dwid"));
db.setDbunitname(userMap.getString("dwname"));
db.setDbfghid(userMap.getString("ghid"));
db.setDbfghname(userMap.getString("unionname"));
db.setDbtid(userMap.getString("dbtid"));
db.setJdhid(jdhid);
db.setDbzt(2);
db.setRoleid(JDH_ZSDB_ROLE_ID);
baseService.insert("jdh_db", Chain.from(db));
Chain surChain = Chain.make("userid", userMap.getString("id")).add("jdhid", jdhid).add("roleid", JDH_ZSDB_ROLE_ID).add("dbtid", userMap.getString("dbtid"));
baseService.insert("sys_user_role", surChain);
}
sysRoleService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.dbgl")
public void jdhUpdate() throws Exception {
String jdhid = "6n7brjd3okj91op2e6dr79835i";
//代表
List<Record> list = baseService.list(Sqls.create("select * from jdh_db where jdhid = '6n7brjd3okj91op2e6dr79835i' and dbzt = 2\n" + "and dbid not in (select userid from sys_user_role where jdhid = '6n7brjd3okj91op2e6dr79835i')"));
for (Record record : list) {
Chain surChain = Chain.make("userid", record.getString("dbid")).add("jdhid", record.getString("jdhid")).add("roleid", record.getString("roleid")).add("dbtid", record.getString("dbtid"));
baseService.insert("sys_user_role", surChain);
}
sysUserService.clearCache();
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.db.dbgl")
public Object dofpdbt(String jdhid) {
List<TeacherMeetDelegate> jdhList = baseService.dao().query(TeacherMeetDelegate.class, Cnd.where("stateCode", "=", 300).and("isJdh", "=", 1).and("teacherMeetId", "=", jdhid));
List<TeacherMeetDelegate> gdhList = baseService.dao().query(TeacherMeetDelegate.class, Cnd.where("stateCode", "=", 300).and("isGdh", "=", 1).and("teacherMeetId", "=", jdhid));
Trans.exec(() -> {
jdhList.forEach(v -> {
Sql sql = Sqls.create("select * from `user` where id = @id").setParam("id", v.getUserId());
sql.setCallback(Sqls.callback.map());
baseService.dao().execute(sql);
NutMap user = (NutMap) sql.getResult();
Record fetch = baseService.dao().fetch("jdh_dbt_zcfgh", Cnd.where("fghid", "=", user.getString("unionid")).and("jdhid", "=", v.getTeacherMeetId()));
baseService.update("jdh_db", Chain.make("dbtid", fetch.getString("dbtid")).add("dbfghid", user.getString("unionid")).add("dbfghname", user.getString("unionname")).add("dbunitid", user.getString("unitid")).add("dbunitname", user.getString("unitname")), Cnd.where("jdhid", "=", v.getTeacherMeetId()).and("dbid", "=", v.getUserId()));
});
workersCongressSession workersCongressSession = baseService.dao().fetch(workersCongressSession.class, Cnd.where("startState", "=", 1).desc("startTime"));
gdhList.forEach(z -> {
Sql sql = Sqls.create("select * from `user` where id = @id").setParam("id", z.getUserId());
sql.setCallback(Sqls.callback.map());
baseService.dao().execute(sql);
NutMap user = (NutMap) sql.getResult();
Record fetch = baseService.dao().fetch("workers_congress_delegation_make_up_union", Cnd.where("union_id", "=", user.getString("unionid")).and("gdh_id", "=", workersCongressSession.getId()));
baseService.update("workers_congress_representative", Chain.make("dbt_id", fetch.getString("dbt_id")), Cnd.where("userid", "=", user.getString("id")).and("gdh_id", "=", workersCongressSession.getId()));
});
});
return null;
}
@At
@Ok("void")
@RequiresPermissions("sys.jdh.db.dbgl")
public void downloadTemplate(HttpServletResponse response) {
try {
ViTool.excelResponse(response, "代表导入模板.xlsx");
InputStream is = officeTemplateUtil.getInputStream("delegateImport");
ServletOutputStream outputStream = response.getOutputStream();
IoUtil.copy(is, outputStream);
outputStream.close();
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 导入代表信息
*
* @param tempFile
* @return
*/
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.dbgl")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Result doImport(@Param("file") TempFile tempFile, @Param("sessionId") String sessionId) {
//清空原有的代表数据
dao.clear(Jdh_db.class, Cnd.where("jdhid", "=", sessionId));
//清空代表权限
dao.clear(Sys_user_role.class, Cnd.where("jdhid", "=", sessionId).and("roleid", "=", JDH_ZSDB_ROLE_ID));
//清空团长/副团长权限
dao.clear(Sys_user_role.class, Cnd.where("jdhid", "=", sessionId).and("roleid", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ)));
//清空代表团
dao.clear(Jdh_dbt.class, Cnd.where("jdhid", "=", sessionId));
//清空代表团组成单位
dao.clear(Jdh_dbt_zcdw.class, Cnd.where("jdhid", "=", sessionId));
//execl数据
List<TeacherDelegateExcelImportVo> list = ExcelImportUtil.importExcel(tempFile.getFile(), TeacherDelegateExcelImportVo.class, new ImportParams());
//取出代表团名称
List<String> delegationNames = list.stream().map(TeacherDelegateExcelImportVo::getDelegationName).distinct().collect(Collectors.toList());
//插入代表团
for (int i = 0; i < delegationNames.size(); i++) {
Jdh_dbt jdh_dbt = new Jdh_dbt();
jdh_dbt.setDbtname(delegationNames.get(i));
jdh_dbt.setJdhid(sessionId);
jdh_dbt.setCjsj(DateUtil.today());
jdh_dbt.setCode(String.format("%03d", i + 1));
dao.insert(jdh_dbt);
}
List<Jdh_dbt> delegations = dao.query(Jdh_dbt.class, Cnd.where("jdhid", "=", sessionId));
Map<String, String> delegationMap = delegations.stream().collect(Collectors.toMap(v -> v.getDbtname(), v -> v.getId()));
//用户数据
Sql userSql = Sqls.create("select * from user where loginname in (@loginnames) group by loginname").setParam("loginnames", list.stream().map(TeacherDelegateExcelImportVo::getLoginName).collect(Collectors.toList()));
List<NutMap> sysUsers = sysUserService.listMap(userSql);
Map<String, NutMap> sysUserMap = sysUsers.stream().collect(Collectors.toMap(v -> v.getString("loginname"), v -> v));
//每个代表团下的组成单位Map
Map<String, Set<String>> delegationUnitIdsMap = list.stream().collect(Collectors.groupingBy(TeacherDelegateExcelImportVo::getDelegationName, Collectors.collectingAndThen(Collectors.toList(), voList -> {
List<String> loginNames = voList.stream().map(TeacherDelegateExcelImportVo::getLoginName).collect(Collectors.toList());
return sysUsers.stream().filter(user -> loginNames.contains(user.get("loginname"))).map(user -> (String) user.get("unitid")).collect(Collectors.toSet());
})));
//插入组成单位
delegationUnitIdsMap.forEach((delegationName, unitIds) -> {
List<Jdh_dbt_zcdw> zcdws = unitIds.stream().map(unitId -> {
Jdh_dbt_zcdw jdh_dbt_zcdw = new Jdh_dbt_zcdw();
jdh_dbt_zcdw.setJdhid(sessionId);
jdh_dbt_zcdw.setDbtid(delegationMap.get(delegationName));
jdh_dbt_zcdw.setDwid(unitId);
return jdh_dbt_zcdw;
}).collect(Collectors.toList());
dao.insert(zcdws);
});
//循环导入的代表数据
for (TeacherDelegateExcelImportVo vo : list) {
StringBuilder errors = new StringBuilder();
String loginName = vo.getLoginName();
if (!sysUserMap.containsKey(loginName)) {
errors.append("系统中查询不到" + loginName + "的信息");
vo.setErrors(errors.toString());
continue;
}
NutMap userMap = sysUserMap.get(loginName);
String dbtId = delegationMap.get(vo.getDelegationName());
Jdh_db db = new Jdh_db();
db.setId(R.UU32());
db.setDbid(userMap.getString("id"));
db.setPolitical(userMap.getString("political"));
db.setEducation(userMap.getString("education"));
db.setJobTitle(userMap.getString("jobTitle"));
db.setPosition(userMap.getString("position"));
db.setDbunitid(userMap.getString("unitid"));
db.setDbunitname(userMap.getString("unitname"));
db.setDbfghid(userMap.getString("unionid"));
db.setDbfghname(userMap.getString("unionname"));
db.setDbtid(dbtId);
db.setJdhid(sessionId);
db.setDbzt(2);
db.setRoleid(JDH_ZSDB_ROLE_ID);
baseService.insert("jdh_db", Chain.from(db));
Chain surChain = Chain.make("userid", userMap.getString("id")).add("jdhid", sessionId).add("roleid", Roles.ZSDB).add("dbtid", dbtId);
baseService.insert("sys_user_role", surChain);
//判断是否是团长/副团长
String roleName = vo.getRoleName();
if (StrUtil.isNotBlank(roleName)) {
Sys_user_role sysUserRole = new Sys_user_role();
sysUserRole.setUserId(userMap.getString("id"));
sysUserRole.setJdhid(sessionId);
sysUserRole.setDbtid(dbtId);
if (roleName.equals("团长")) {
sysUserRole.setRoleId(Roles.DBT_TZ);
dao.insert(sysUserRole);
} else if (roleName.equals("副团长")) {
sysUserRole.setRoleId(Roles.DBT_FTZ);
dao.insert(sysUserRole);
}
}
}
long successCount = list.stream().filter(v -> StrUtil.isBlank(v.getErrors())).count();
List<TeacherDelegateExcelImportVo> errorList = list.stream().filter(v -> StrUtil.isNotBlank(v.getErrors())).collect(Collectors.toList());
NutMap nutMap = NutMap.NEW();
nutMap.setv("totalCount", list.size());
nutMap.setv("successCount", successCount);
nutMap.setv("errorCount", (long) errorList.size());
nutMap.setv("errorList", errorList);
return Result.success(nutMap);
}
@At
@RequiresPermissions("sys.jdh.db.dbgl")
@Ok("void")
public void exportDelegate(String jdhid, String dbtid, String unionid, String unitid, String dbsf, String fields, HttpServletResponse response) {
try (ServletOutputStream os = response.getOutputStream()) {
ViTool.excelResponse(response, "代表信息.xlsx");
Sql sql = Sqls.create("""
SELECT
u.username,
u.loginname,
u.sex,
u.mobile,
TIMESTAMPDIFF(YEAR, u.birthday,CURDATE()) as age,
db.political,
db.education,
db.jobTitle,
db.position,
jdh.jdhallname AS sessionName,
db.id,
db.dbid,
db.jdhid,
db.dbunitid,
db.dbunitname,
db.dbfghid,
db.dbfghname,
db.dbzt,
jdh.jdhallname,
dbt.dbtname,
r.NAME AS roleName,
(sum(case when sur.roleId = 'c1765c03459840c2b621d140f575c869' then 1 else 0 end)>0) isTz,
(sum(case when sur.roleId = '6445f21685c5489aa212a986cfbeecce' then 1 else 0 end)>0) isFtz
FROM
jdh_db db
LEFT JOIN `user` u ON u.id = db.dbid
LEFT JOIN sys_role r ON r.id = db.roleid
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
LEFT JOIN jdh_jdhxx jdh ON jdh.id = db.jdhid
LEFT JOIN sys_user_role sur on sur.userId = db.dbid and sur.jdhid = jdh.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.groupBy("db.id");
cnd.and("db.dbzt", "=", 2);
cnd.andEX("db.jdhid", "=", jdhid);
cnd.andEX("db.dbtid", "=", dbtid);
cnd.andEX("u.unitid", "=", unitid);
cnd.andEX("u.unionid", "=", unionid);
cnd.andEX("r.NAME", "=", dbsf);
cnd.desc("jdh.jdhkqsj").asc("dbt.dbtname").asc("u.unionname");
cnd.asc("db.id");
sql.setCondition(cnd);
List<NutMap> dataList = sysUserService.listMap(sql);
for (int i = 0; i < dataList.size(); i++) {
NutMap row = dataList.get(i);
row.put("no", i + 1);
boolean isTz = row.getBoolean("isTz");
boolean isFtz = row.getBoolean("isFtz");
if (isTz) {
row.put("headName", "团长");
} else if (isFtz) {
row.put("headName", "副团长");
}
}
List<NutMap> list = Json.fromJsonAsList(NutMap.class, fields);
ArrayList<ExcelExportEntity> entities = new ArrayList<>();
entities.add(new ExcelExportEntity("序号", "no", 20));
for (NutMap field : list) {
entities.add(new ExcelExportEntity(field.getString("label"), field.getString("prop"), 20));
}
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, dataList);
workbook.write(os);
workbook.close();
} catch (IOException e) {
log.error("代表导出失败{}", e.getMessage());
}
}
}
@@ -0,0 +1,141 @@
package io.v.nutz.zhgh.jdh.controller.db;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.sys.services.SysRoleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/19 17:25
*/
@IocBean
@At("/platform/jdh/db/qrmd")
@Ok("json:full")
public class JdhDbQrmdController {
private static final String JDH_ZSDB_ROLE_ID = "1427083503b74aa0885d104419b33170";
@Inject
private BaseService baseService;
@Inject
private SysRoleService sysRoleService;
@At("")
@Ok("re")
@RequiresPermissions("sys.jdh.db.qrmd")
public String index() {
return "beetl:/platform/jdh/db/qrmd.html";
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.db.qrmd")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "unitId",required = false) String unitId,
@Param(value = "dbtid",required = false) String dbtid,
@Param(value = "unionId",required = false) String unionId) {
Sql sql = Sqls.create("""
SELECT
u.username,
u.loginname,
u.sex,
u.mobile,
db.id,
db.dbid,
db.jdhid,
db.dbunitid,
dw.name dbunitname,
dw.name unitname,
db.dbfghid,
db.dbfghname,
db.dbzt,
dbt.dbtname,
dbt.dbtname delegationName,
dbtdict.`code` delegationCode,
gh.unioncode code,
r.name as rolename
FROM
jdh_db db
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
LEFT JOIN sys_dict dbtdict ON dbtdict.`name` = dbt.`dbtname`
LEFT JOIN sys_user u ON u.id = db.dbid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.`id` = dw.unionid
LEFT JOIN sys_dict dict ON dict.`name` = db.dbfghname
LEFT JOIN sys_role r ON r.id = db.roleid $condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("db.dbzt", "=", 1);
cnd.and("db.jdhid", "=", jdhid);
cnd.asc("dict.`code`");
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
if (Strings.isNotBlank(unitId)) {
cnd.and("db.dbunitid", "=", unitId);
}
if (Strings.isNotBlank(unionId)) {
cnd.and("db.dbfghid", "=", unionId);
}
if (Strings.isNotBlank(dbtid)) {
cnd.and("db.dbtid", "=", dbtid);
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.qrmd")
public Object doConfirm(@Param("ids[]") String ids[]) {
try {
for (String id : ids) {
baseService.update("jdh_db", Chain.make("dbzt", 2)
.add("sfyx",1)
.add("roleid", JDH_ZSDB_ROLE_ID), Cnd.where("id", "=", id));
Record fetch = baseService.dao().fetch("jdh_db", Cnd.where("id", "=", id));
Chain add = Chain.make("userid", fetch.getString("dbid")).add("jdhid", fetch.getString("jdhid"))
.add("roleid", JDH_ZSDB_ROLE_ID).add("dbtid", fetch.getString("dbtid"));
baseService.insert("sys_user_role", add);
}
sysRoleService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,414 @@
package io.v.nutz.zhgh.jdh.controller.db;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.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.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db_Excel;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/19 11:35
*/
@IocBean
@At("/platform/jdh/db/scmd")
@Ok("json:full")
public class JdhDbScmdController {
private static final String JDH_DBT_CZY_ROLE_ID = "0af36fa65ee742deb46a1fb1ded268ff";
private static final String FGH_ADMIN_ROLE_ID = "5d342e614e9a48288d50154bcdcc75d3";
// private static final String JDH_DBT_CZY_ROLE_ID = "0af36fa65ee742deb46a1fb1ded268ff";
private static final String JDH_ZSDB_ROLE_ID = "1427083503b74aa0885d104419b33170";
@Inject
private BaseService baseService;
@Inject
private ViService viService;
@At("")
@Ok("re")
@RequiresPermissions("sys.jdh.db.scmd")
public String index() {
return "beetl:/platform/jdh/db/scmd.html";
}
/**
* 查询当前代表团操作员可操作的教代会
*
* @return
*/
@At
@RequiresPermissions("sys.jdh.db.scmd")
public Object getJdhList() {
try {
StringBuffer str = new StringBuffer();
str.append("select * from jdh_jdhxx where 1=1");
if (!ShiroUtil.hasRole("sysadmin")) {
str.append("\tand id in (select jdhid from sys_user_role where userid = @userid and roleid = @roleid)");
}
str.append("\torder by jdhkqsj desc");
Sql sql = Sqls.create(str.toString());
sql.setParam("userid", ShiroUtil.getPrincipalProperty("id"));
sql.setParam("roleid", JDH_DBT_CZY_ROLE_ID);
List list = baseService.list(sql);
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 查询代表团
*
* @param jdhid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.db.scmd")
public Object getDbtList(String jdhid) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
dbt.*
FROM
jdh_dbt dbt
left join jdh_dbt_zcfgh zcgh on dbt.id = zcgh.dbtid
$condition
""");
cnd.and("dbt.jdhid", "=", jdhid);
if (!ShiroUtil.hasRole("sysadmin")) {
// cnd.and(new Static("dbt.id in (select dbtid from sys_user_role where userid = '" + ShiroUtil.getPrincipalProperty("id") + "' and jdhid = '" + jdhid + "')"));
cnd.and("zcgh.fghid", "=", Vi.getUnionId());
}
cnd.groupBy("dbt.id");
cnd.asc("code");
sql.setCondition(cnd);
return Result.success().addData(baseService.list(sql));
}
/**
* 查询本届教代会代表团里不是代表的用户
*
* @param jdhid
* @param dbtid
* @return
*/
@At
public Object queryNotDbUser(String jdhid, String dbtid, String keyword) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,u.loginname,u.username,dw.id as dwid,dw.name as dwname,
gh.id as ghid,gh.unionname,
u.political,
u.education,
u.jobTitle,
u.position
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.id = dw.unionid
$condition
AND u.id NOT IN ( SELECT dbid FROM jdh_db WHERE jdhid = @jdhid AND dbzt in (1,2) )
AND (u.username like @keyword or u.loginname like @keyword)
""");
Cnd cnd = Cnd.NEW();
if ("unit".equals(Globals.MyConfig.getString("dbtzc"))) {
cnd.and(new Static(" dw.id in (select dwid from jdh_dbt_zcdw where jdhid='%s' and dbtid='%s' )".formatted(jdhid, dbtid)));
} else {
cnd.and(new Static("gh.id IN ( SELECT fghid FROM jdh_dbt_zcfgh WHERE jdhid = '%s' AND dbtid = '%s' )".formatted(jdhid, dbtid)));
}
sql.setCondition(cnd);
sql.setParam("jdhid", jdhid);
sql.setParam("dbtid", dbtid);
sql.setParam("keyword", "%" + keyword + "%");
Pagination pagination = baseService.listPageMap(1, 10, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.scmd")
public Object doAdd(String jdhid, String dbtid, @Param("::user") List<NutMap> userList, String role) {
try {
Jdh_db db = null;
for (NutMap userMap : userList) {
db = new Jdh_db();
db.setId(R.UU32());
db.setRoleid(role);
db.setDbid(userMap.getString("id"));
db.setDbunitid(userMap.getString("dwid"));
db.setDbunitname(userMap.getString("dwname"));
db.setDbfghid(userMap.getString("ghid"));
db.setDbfghname(userMap.getString("unionname"));
db.setDbtid(dbtid);
db.setJdhid(jdhid);
db.setDbzt(1);
//db.setRoleid(JDH_ZSDB_ROLE_ID);
baseService.insert("jdh_db", Chain.from(db));
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.db.scmd")
public Object pageData(@Param(value = "pageNumber", required = false) Integer pageNumber,
@Param(value = "pageSize", required = false) Integer pageSize,
@Param(value = "jdhid", required = false) String jdhid,
@Param(value = "pageOrderName", required = false) String pageOrderName,
@Param(value = "pageOrderBy", required = false) String pageOrderBy,
@Param(value = "unitid", required = false) String unitid,
@Param(value = "searchName", required = false) String searchName,
@Param(value = "searchKeyword", required = false) String searchKeyword) {
try {
Sql sql = Sqls.create("""
SELECT
u.username,
u.loginname,
u.sex,
u.mobile,
db.id,
db.dbid,
db.jdhid,
db.dbunitid,
dw.name dbunitname,
dw.name unitname,
dw.unitcode,
db.dbfghid,
db.dbfghname,
db.dbzt,
dbt.dbtname,
dbtdict.`code` delegationCode,
r.name as rolename
FROM
jdh_db db
LEFT JOIN sys_user u ON u.id = db.dbid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union fgh ON fgh.id = dw.unionid
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
LEFT JOIN sys_dict dbtdict ON dbtdict.`name` = dbt.`dbtname`
LEFT JOIN sys_role r ON r.id = db.roleid $condition
""");
Cnd cnd = Cnd.NEW();
//cnd.and("db.sfyx","=",1);
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("fgh.id", "=", ((Sys_union) ShiroUtil.getPrincipalProperty("union")).getId());
}
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.orderBy("db.dbzt", "asc");
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
if (Strings.isNotBlank(jdhid)) {
cnd.and("db.jdhid", "=", jdhid);
}
if (Strings.isNotBlank(unitid)) {
cnd.and("db.unitid", "=", unitid);
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.db.scmd")
public Object doDelete(@Param("id") String id) {
try {
baseService.clear("jdh_db", Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.scmd")
public Object readScmdExecl(@Param("file") TempFile tempFile, @Param("jdhid") String jdhid) throws Exception {
ImportParams params = new ImportParams();
List<Jdh_db_Excel> result = ExcelImportUtil.importExcel(tempFile.getInputStream(),
Jdh_db_Excel.class, params);
for (Jdh_db_Excel db : result) {
validUser(db, jdhid);
}
return Result.success().addData(result);
}
/**
* 验证
*
* @param db
* @return
*/
public String validUser(Jdh_db_Excel db, String jdhid) throws Exception {
Sql existinUserSql = Sqls.create("select count(1) from sys_user where username = @username and loginname =@loginname");
existinUserSql.setParam("username", db.getUsername());
existinUserSql.setParam("loginname", db.getLoginname());
int countuser = baseService.count(existinUserSql);
if (countuser == 0) {
db.setInfo("工号和姓名不对应,请核实!");
db.setIsok(false);
return "error";
}
//判断该用户是否已经在该教代会中是否已经是代表 防止重复添加 wrnm
Sql existinDbSql = Sqls.create("""
SELECT
db.dbzt
FROM
jdh_db db
LEFT JOIN jdh_jdhxx jdhxx ON jdhxx.id = db.jdhid
WHERE
jdhxx.id = @jdhid and
dbid = ( SELECT id FROM sys_user WHERE loginname = @loginname )
""");
existinDbSql.setParam("jdhid", jdhid);
existinDbSql.setParam("loginname", db.getLoginname());
List<Record> list = (List<Record>) baseService.list(existinDbSql);
if (list.size() > 0) {
db.setDbtname(null);
db.setDwname(null);
if (list.get(0).getInt("dbzt") == 1) {
db.setInfo("该用户已经处于待校工会审核了,请勿重复上传!");
} else if (list.get(0).getInt("dbzt") == 2) {
db.setInfo("该用户已经是当前教代会的正式代表,请勿重复上传!");
}
return "error";
}
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
dw.id AS dwid,
dw.NAME AS dwname,
gh.unionname,
gh.id as ghid,
dbt.id as dbtid,
dbt.dbtname
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.id = dw.unionid
LEFT JOIN jdh_dbt_zcfgh dz ON dz.fghid = gh.id
LEFT JOIN jdh_dbt dbt ON dbt.id = dz.dbtid
WHERE
u.loginname = @loginname AND
dz.jdhid = @jdhid
""");
sql.setParam("loginname", db.getLoginname()).setParam("jdhid", jdhid);
Record o = (Record) baseService.list(sql).get(0);
db.setDwid(o.getString("dwid"));
db.setDwname(o.getString("dwname"));
db.setGhid(o.getString("ghid"));
db.setUnionname(o.getString("unionname"));
db.setDbtid(o.getString("dbtid"));
db.setDbtname(o.getString("dbtname"));
db.setUserid(o.getString("id"));
db.setIsok(true);
return "success";
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.db.scmd")
public Object doAddExcel(String data, String jdhid) {
try {
List<NutMap> userMapList = Json.fromJsonAsList(NutMap.class, data);
Jdh_db db = null;
for (NutMap userMap : userMapList) {
db = new Jdh_db();
db.setId(R.UU32());
db.setDbid(userMap.getString("userid"));
db.setDbunitid(userMap.getString("dwid"));
db.setDbunitname(userMap.getString("dwname"));
db.setDbfghid(userMap.getString("ghid"));
db.setDbfghname(userMap.getString("unionname"));
db.setDbtid(userMap.getString("dbtid"));
db.setJdhid(jdhid);
db.setDbzt(1);
//db.setRoleid(JDH_ZSDB_ROLE_ID);
if ("列席代表".equals(userMap.getString("role"))) {
db.setRoleid(Roles.LXDB);
} else if ("特邀代表".equals(userMap.getString("role"))) {
db.setRoleid(Roles.TYDB);
} else {
db.setRoleid(Roles.ZSDB);
}
baseService.insert("jdh_db", Chain.from(db));
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,469 @@
package io.v.nutz.zhgh.jdh.controller.db;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.base.utils.OfficeTemplateUtil;
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.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.zhgh.workersCongress.model.workersCongressSession;
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.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 javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/20 14:57
*/
@IocBean
@At("/platform/jdh/db/dbyl")
@Ok("json:full")
public class JdhDbYlController {
private static final String JDH_ZSDB_ROLE_ID = "1427083503b74aa0885d104419b33170";
@Inject
private BaseService baseService;
@Inject
private SysUserService sysUserService;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
@At("")
@Ok("re")
@RequiresPermissions("jdh.db.dbyl")
public String index() {
return "beetl:/platform/jdh/db/dbyl.html";
}
@At
@RequiresPermissions("jdh.db.dbyl")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy,
@Param(value = "searchName",required = false) String searchName,
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "unitid",required = false) String unitid,
@Param(value = "unitId",required = false) String unitId,
@Param(value = "dbtid",required = false) String dbtid,
@Param(value = "dbsf",required = false) String dbsf,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unionid",required = false) String unionid) {
try {
Sql sql = Sqls.create("""
SELECT
u.username,
u.loginname,
u.sex,
u.mobile,
TIMESTAMPDIFF(YEAR, u.birthday,CURDATE()) as age,
u.unionname,
u.unioncode,
db.id,
db.dbid,
db.jdhid,
db.dbunitid,
db.dbunitname,
db.dbfghid,
db.dbfghname,
db.dbzt,
jdh.jdhallname,
dbt.dbtname,
r.`name` as rolename
FROM
jdh_db db
LEFT JOIN `user` u ON u.id = db.dbid
LEFT JOIN sys_role r ON r.id = db.roleid
LEFT JOIN jdh_dbt dbt ON dbt.id = db.dbtid
LEFT JOIN jdh_jdhxx jdh on jdh.id = db.jdhid
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("db.dbzt", "=", 2);
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.desc("jdh.jdhkqsj").asc("dbt.dbtname").asc("db.dbunitname");
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
}
if (Strings.isNotBlank(jdhid)) {
cnd.and("db.jdhid", "=", jdhid);
}
if (Strings.isNotBlank(dbtid)) {
cnd.and("db.dbtid", "=", dbtid);
}
if (Strings.isNotBlank(unionId)) {
cnd.and("db.dbfghid", "=", unionId);
}
if (Strings.isNotBlank(unionid)) {
cnd.and("db.dbfghid", "=", unionid);
}
if (Strings.isNotBlank(unitid) || Strings.isNotBlank(unitId)) {
cnd.and("db.dbunitid", "=", Strings.isNotBlank(unitid) ? unitid : unitId);
}
if (Strings.isNotBlank(dbsf)) {
cnd.and("r.NAME", "=", dbsf);
}
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin,tamange")) {
cnd.and("u.unionid", "=", Vi.getUnionId());
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 根据教代会导出代表名单
*
* @param jdh_id
*/
@At
@RequiresPermissions("jdh.db.dbyl")
public void downloadDbList(@Param(value = "jdh_id",required = false) String jdh_id, HttpServletResponse response) throws Exception {
Sql dbtSql = Sqls.create("SELECT dbt.*,(SELECT count(1) from jdh_db db WHERE db.dbtid = dbt.id) " +
"dbnum from jdh_dbt dbt where dbt.jdhid = @jdhid ORDER BY dbt.code").setParam("jdhid", jdh_id);
Sql dbSql = Sqls.create("SELECT u.id,(case u.sex when '女' then CONCAT(u.username,'(女)') else u.username end) " +
"username,u.nation mz,db.dbtid,db.roleid from jdh_db db left join sys_user u on db.dbid = u.id " +
"WHERE db.dbzt = 2 and db.jdhid = @jdhid ORDER BY u.username").setParam("jdhid", jdh_id);
Sql tzSql = Sqls.create("SELECT u.id,(case u.sex when '女' then CONCAT(u.username,'(女)') else u.username end) " +
"username,u.nation mz,sur.dbtid,sur.roleId roleid from sys_user_role sur left join sys_user u on sur.userId = u.id " +
"WHERE sur.roleId in (@tz_role_id,@ftz_role_id) and sur.jdhid = @jdhid ORDER BY u.username")
.setParam("tz_role_id", Roles.DBT_TZ).setParam("ftz_role_id", Roles.DBT_FTZ).setParam("jdhid", jdh_id);
List<Record> dbtList = baseService.list(dbtSql);
List<Record> dbs = baseService.list(dbSql);
List<Record> tzs = baseService.list(tzSql);
dbs.forEach(db -> {
if (db.getString("mz") != null && !db.getString("mz").contains("")) {
db.set("username", db.getString("username") + '(' + db.getString("mz") + ')');
}
});
tzs.forEach(db -> {
if (db.getString("mz") != null && !db.getString("mz").contains("")) {
db.set("username", db.getString("username") + '(' + db.getString("mz") + ')');
}
});
dbtList.forEach(dbt -> {
dbt.set("tz", tzs.stream().filter(v -> {
return dbt.getString("id").equals(v.getString("dbtid")) && Roles.DBT_TZ.equals(v.getString("roleid"));
}).collect(Collectors.toList()));
dbt.set("ftz", tzs.stream().filter(v -> {
return dbt.getString("id").equals(v.getString("dbtid")) && Roles.DBT_FTZ.equals(v.getString("roleid"));
}).collect(Collectors.toList()));
dbt.set("cy", dbs.stream().filter(v -> {
/*return dbt.getString("id").equals(v.getString("dbtid")) && Roles.ZSDB.equals(v.getString("roleid")) && tzs.stream().noneMatch(x -> {
return StrUtil.isNotBlank(x.getString("id")) && x.getString("id").equals(v.getString("id"));
});*/
return dbt.getString("id").equals(v.getString("dbtid")) && tzs.stream().noneMatch(x -> {
return StrUtil.isNotBlank(x.getString("id")) && x.getString("id").equals(v.getString("id"));
});
}).collect(Collectors.toList()));
});
String jdh_name = baseService.dao().fetch(Jdh_jdhxx.class, jdh_id).getJdhallname();
String fileName = jdh_name + "代表名单";
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
Configure config = Configure.newBuilder().bind("dbts", policy).build();
HashMap<String, Object> map = new HashMap<>();
map.put("gx_name", Globals.MyConfig.getString("GxName"));
map.put("jdh_name", jdh_name);
map.put("dbts", dbtList);
XWPFTemplate.compile(officeTemplateUtil.getPath("jdh_dbList"), config).render(map).writeAndClose(response.getOutputStream());
}
@At
@Ok("void")
@RequiresPermissions("jdh.db.dbyl")
public void exportList(@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "dbtid",required = false) String dbtid,
HttpServletResponse response) throws IOException {
Jdh_jdhxx jdhxx = baseService.dao().fetch(Jdh_jdhxx.class, jdhid);
//只查询开启教代会的代表
Sql sql = Sqls.create("""
SELECT
u.loginname,
u.username,
u.sex,
u.mobile,
u.unitname,
u.unionname,
dbt.dbtname,
CONCAT( jdh.jdhjs, '届', jdh.jdhcs, '次' ) jdh,
role.`name` rolename
FROM
jdh_db db
LEFT JOIN `user` u ON db.dbid = u.id
LEFT JOIN jdh_dbt dbt ON db.dbtid = dbt.id
LEFT JOIN jdh_jdhxx jdh ON db.jdhid = jdh.id
LEFT JOIN sys_role role ON db.roleid = role.id
WHERE
db.jdhid = @jdhid
ORDER BY
dbt.code,
u.unioncode,
u.unitcode
""").setParam("jdhid", jdhid);
Sql sql2 = Sqls.create("""
SELECT
u.loginname,
u.username,
u.sex,
u.mobile,
u.unitname,
u.unionname,
dbt.dbtname,
CONCAT( jdh.jdhjs, '届', jdh.jdhcs, '次' ) jdh,
role.`name` rolename
FROM
jdh_db db
LEFT JOIN `user` u ON db.dbid = u.id
LEFT JOIN jdh_dbt dbt ON db.dbtid = dbt.id
LEFT JOIN jdh_jdhxx jdh ON db.jdhid = jdh.id
LEFT JOIN sys_role role ON db.roleid = role.id $condition""");
Cnd cnd = Cnd.NEW();
cnd.and("db.jdhid", "=", jdhid);
if (Strings.isNotBlank(dbtid)) {
cnd.and("db.dbtid", "=", dbtid);
}
cnd.desc("dbt.code").desc("u.unioncode").desc("u.unitcode");
sql2.setCondition(cnd);
List<DB> dbs = new ArrayList<>();
List<Record> records = baseService.list(sql2);
for (Record record : records) {
DB db = new DB();
db.setLoginname(record.getString("loginname"));
db.setUsername(record.getString("username"));
db.setSex(record.getString("sex"));
db.setMobile(record.getString("mobile"));
db.setRolename(record.getString("rolename"));
db.setDbtname(record.getString("dbtname"));
db.setUnionname(record.getString("unionname"));
db.setUnitname(record.getString("unitname"));
db.setJdh(record.getString("jdh"));
dbs.add(db);
}
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((jdhxx.getJdhjs() + "" + jdhxx.getJdhcs() + "" + "教代会代表名单.xls").getBytes("utf-8"), "ISO8859-1"));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), DB.class, dbs);
workbook.write(response.getOutputStream());
}
public static class DB implements Serializable {
@Excel(name = "工号", width = 20)
private String loginname;
@Excel(name = "姓名", width = 20)
private String username;
@Excel(name = "性别", width = 10)
private String sex;
@Excel(name = "联系方式", width = 20)
private String mobile;
@Excel(name = "代表身份", width = 20)
private String rolename;
@Excel(name = "所属代表团", width = 30)
private String dbtname;
@Excel(name = "所属工会", width = 30)
private String unionname;
@Excel(name = "所属单位", width = 30)
private String unitname;
@Excel(name = "教代会", width = 20)
private String jdh;
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getRolename() {
return rolename;
}
public void setRolename(String rolename) {
this.rolename = rolename;
}
public String getDbtname() {
return dbtname;
}
public void setDbtname(String dbtname) {
this.dbtname = dbtname;
}
public String getUnionname() {
return unionname;
}
public void setUnionname(String unionname) {
this.unionname = unionname;
}
public String getUnitname() {
return unitname;
}
public void setUnitname(String unitname) {
this.unitname = unitname;
}
public String getJdh() {
return jdh;
}
public void setJdh(String jdh) {
this.jdh = jdh;
}
}
@At
@Ok("void")
@RequiresAuthentication
@RequiresPermissions("jdh.db.dbyl")
public void doExport(@Param(value = "jdhid",required = false) String jdhid, HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<String, Object>();
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT
tea.*,u.unionname
FROM
teacher_meet_delegate tea
LEFT JOIN `user` u ON u.id = tea.userid
$condition
""").setParam("jdhid", jdhid);
cnd.and("tea.teacherMeetId", "=", jdhid);
cnd.and("tea.stateCode", "in", Lang.array(100, 300));
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("u.unionid", "=", Vi.getUnionId());
}
cnd.desc("u.unionname");
sql.setCondition(cnd);
List<NutMap> maps = sysUserService.listMap(sql);
workersCongressSession workersCongressSession = sysUserService.dao().fetch(workersCongressSession.class, Cnd.where("startState", "=", 1).desc("year"));
Jdh_jdhxx jdhxx = sysUserService.dao().fetch(Jdh_jdhxx.class, Cnd.where("jdhkqzt", "=", 1).desc("jdhkqsj"));
for (int i = 0; i < maps.size(); i++) {
maps.get(i).put("number", i + 1);
maps.get(i).setv("age", maps.get(i).getInt("age") < 40 ? "" : "");
maps.get(i).setv("twoWork", maps.get(i).getBoolean("twoWork") ? "" : "");
maps.get(i).setv("isJdh", maps.get(i).getBoolean("isJdh") ? "" : "");
maps.get(i).setv("isGdh", maps.get(i).getBoolean("isGdh") ? "" : "");
}
map.put("unionname", Vi.getUnion().getUnionname().replaceAll("分工会*", ""));
map.put("jdhJs", jdhxx.getJdhjs());
String fileName = null;
if (workersCongressSession != null) {
map.put("sessionJs", workersCongressSession.getGdhJs());
fileName = "" + jdhxx.getJdhjs() + "届教代会和第" + workersCongressSession.getGdhJs() + "届工代会代表名册.xlsx";
} else {
fileName = "" + jdhxx.getJdhjs() + "届教代会代表名册.xlsx";
}
map.put("maplist", maps);
response.setContentType("application/octet-stream");
ViTool.excelResponse(response, fileName);
TemplateExportParams params = new TemplateExportParams(
officeTemplateUtil.getPath("jdh_gdh_db"));
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
workbook.write(response.getOutputStream());
}
}
@@ -0,0 +1,76 @@
package io.v.nutz.zhgh.jdh.controller.db;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2021/1/19 14:44
* @description 预选代表填报
*/
@IocBean
@At("/platform/jdh/db/preselection")
@Ok("json:full")
public class PreselectionCon {
@Inject
private ViService<Jdh_db> jdh_dbViService;
@At("")
@Ok("beetl:/platform/jdh/db/preselection.html")
@RequiresPermissions("sys.jdh.db.preselection")
public void index() {
}
@Inject
private SysUserService userService;
@At
@ViReturn
@RequiresPermissions("sys.jdh.db.preselection")
public Object doAdd(Jdh_db jdh_db,Sys_user user) {
userService.updateIgnoreNull(user);
userService.deleteCache(user.getId());
String id = ShiroUtil.getPrincipalProperty("id").toString();
String unitid = ShiroUtil.getPrincipalProperty("unitid").toString();
String unionId = Vi.getUnionId();
String unionname = Vi.getUnion().getUnionname();
jdh_db.setDbid(id);
jdh_db.setDbunitid(unitid);
jdh_db.setDbunitname(Vi.getUnit().getName());
jdh_db.setDbfghid(unionId);
jdh_db.setDbfghname(unionname);
jdh_db.setDbzt(1);
jdh_dbViService.insert(jdh_db);
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.db.preselection")
public Object getdb(String jdhid) {
String id = ShiroUtil.getPrincipalProperty("id").toString();
Sql sql = Sqls.create("""
SELECT COUNT(*) num FROM `jdh_db` WHERE dbid=@dbid and jdhid=@jdhid
""");
sql.setParam("dbid", id);
sql.setParam("jdhid", jdhid);
return jdh_dbViService.count(sql);
}
}
@@ -0,0 +1,168 @@
package io.v.nutz.zhgh.jdh.controller.db;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.db.TeacherMeetDelegate;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.zhgh.workersCongress.model.workersCongressRepresentative;
import io.v.nutz.zhgh.workersCongress.model.workersCongressSession;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
/**
* 代表资格审查
*/
@IocBean
@At("/platform/teacherMeet/delegate/audit")
@Ok("json:full")
public class TeacherMeetAuditController {
@Inject
private BaseService baseService;
@Inject
private Dao dao;
@At("")
@Ok("beetl:/platform/jdh/db/audit.html")
public void index() {
}
/**
* 查询待校工会审核的代表
*
* @return
*/
@At
@ViReturn
public Object pageData(PageForm pageForm,
@Param(value = "isAudit",required = false) String isAudit,
@Param(value = "teacherMeetId",required = false) String teacherMeetId,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId) {
Sql sql = Sqls.create("""
SELECT tmd.*,
u.unionname,
CASE tmd.stateCode
when 0 then '未上报'
when 100 then '待审查'
when 200 then '未通过'
when 300 then '审查通过'
ELSE '未知' END stateName
FROM teacher_meet_delegate tmd
LEFT JOIN `USER` u ON u.id = tmd.userId
$condition
""");
Cnd cnd = Cnd.NEW();
if (isAudit.equals("true")) {
cnd.and("tmd.stateCode", "in", Lang.array(200, 300));
} else if (isAudit.equals("false")) {
cnd.and("tmd.stateCode", "in", Lang.array(100));
} else if (isAudit.equals("all")) {
}
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
}
if (StrUtil.isNotBlank(teacherMeetId)) {
cnd.and("tmd.teacherMeetId", "=", teacherMeetId);
}
if (StrUtil.isNotBlank(unionId)) {
cnd.and("u.unionId", "=", unionId);
}
if (StrUtil.isNotBlank(unitId)) {
cnd.and("u.unitId", "=", unitId);
}
cnd.asc("tmd.stateCode").asc("u.unionname");
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
public Object doAudit(@Param("ids[]") String[] ids,Boolean result) {
Trans.exec(() -> {
for (String id : ids) {
TeacherMeetDelegate delegate = dao.fetch(TeacherMeetDelegate.class, id);
Sql sql = Sqls.create("""
select * from `user` where id = @id
""").setParam("id", delegate.getUserId());
sql.setCallback(Sqls.callback.map());
dao.execute(sql);
NutMap user = (NutMap) sql.getResult();
if (result) {
if (delegate.getIsJdh()) {
Jdh_db db = new Jdh_db();
db.setDbid(delegate.getUserId());
db.setJdhid(delegate.getTeacherMeetId());
db.setDbunitid(user.getString("unitid"));
db.setDbunitname(user.getString("unitname"));
db.setDbfghid(user.getString("unionid"));
db.setDbfghname(user.getString("unionname"));
db.setRoleid(Roles.ZSDB);
db.setDbzt(2);
db.setDbtid(delegate.getDelegationId());
dao.insert(db);
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(delegate.getUserId());
userRole.setRoleId(Roles.ZSDB);
userRole.setJdhid(delegate.getTeacherMeetId());
dao.insert(userRole);
}
if (delegate.getIsGdh()) {
workersCongressSession workersCongressSession = dao.fetch(workersCongressSession.class, Cnd.where("1", "=", 1).desc("startTime"));
workersCongressRepresentative workersCongressRepresentative = new workersCongressRepresentative();
workersCongressRepresentative.setGdh_id(workersCongressSession.getId());
workersCongressRepresentative.setUserId(delegate.getUserId());
workersCongressRepresentative.setRoleId(Roles.GDHDB);
dao.insert(workersCongressRepresentative);
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(delegate.getUserId());
userRole.setRoleId(Roles.GDHDB);
userRole.setGdhid(workersCongressSession.getId());
dao.insert(userRole);
}
delegate.setStateCode(300);
} else {
delegate.setStateCode(200);
}
dao.updateIgnoreNull(delegate);
}
});
return null;
}
@At
@Ok("json:full")
@RequiresAuthentication
@ViReturn
public Object doEditTeacher(TeacherMeetDelegate teacherMeetDelegate) {
dao.updateIgnoreNull(teacherMeetDelegate);
return null;
}
}
@@ -0,0 +1,219 @@
package io.v.nutz.zhgh.jdh.controller.db;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.db.TeacherMeetDelegate;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt_zcfgh;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.sys.services.SysUserService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.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 org.nutz.trans.Trans;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 院级工会推选代表
*/
@IocBean
@At("/platform/teacherMeet/push")
@Ok("json:full")
public class TeacherMeetPushController {
@At("")
@Ok("beetl:/platform/jdh/db/push.html")
public void index() {
}
@Inject
private BaseService baseService;
@Inject
private SysUserService sysUserService;
@At
@ViReturn
public Object pageData(PageForm pageForm, @Param(value = "teacherMeetId",required = false) String teacherMeetId) {
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT
db.*,
case db.stateCode
when 0 then '未上报'
when 100 then '待审查'
when 200 then '未通过'
when 300 then '审查通过'
ELSE '未知' END stateName
FROM
`teacher_meet_delegate` db
LEFT JOIN `user` u on u.id = db.userId
$condition
""");
cnd.and("u.unionid", "=", Vi.getUnionId());
cnd.andEx("db.teacherMeetId", "=", teacherMeetId);
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.asc("db.stateCode");
sql.setCondition(cnd);
return baseService.listMap(sql);
}
@At
@ViReturn
public Object getUnionUser(String teacherMeetId) {
CndPlus cnd1 = CndPlus.create();
Sql sql1 = Sqls.create("""
SELECT
db.*,u.username
FROM
`teacher_meet_delegate` db
LEFT JOIN `user` u ON db.userId = u.id
$condition
""");
cnd1.andEx("db.teacherMeetId", "=", teacherMeetId);
cnd1.and("u.unionid", "=", Vi.getUnionId());
sql1.setCondition(cnd1);
List<NutMap> userValue = baseService.listMap(sql1);
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT * FROM `user` u $condition
""");
cnd.and("unionid", "=", Vi.getUnionId());
/* if (ShiroUtil.hasRole("H04")) {
cnd.and("u.unionid", "=", Vi.getUnionId());
}*/
List<Jdh_db> zsdbList = sysUserService.dao().query(Jdh_db.class, Cnd.where("jdhid", "=", teacherMeetId).and("dbzt", "=", 2));
if (userValue.size() > 0) {
cnd.and("u.id", "NOT IN", userValue.stream().map(v -> v.getString("userId")).collect(Collectors.toList()));
}
cnd.and("u.id", "NOT IN", zsdbList.stream().map(v -> v.getDbid()).collect(Collectors.toList()));
cnd.and(Cnd.exps("u.personType", "IS NOT", null).or("u.personType", "!=", ""));
sql.setCondition(cnd);
List userData = baseService.listMap(sql);
return Result.success().addData(Map.of("userData", userData, "userValue", userValue));
}
@At
@ViReturn
public Object addPreselectionDb(String[] userValue,String teacherMeetId) {
Dao dao = baseService.dao();
Trans.exec(() -> {
for (String id : userValue) {
Sql sql = Sqls.create("select * from `user` where id = @id").setParam("id", id);
sql.setCallback(Sqls.callback.map());
dao.execute(sql);
NutMap user = (NutMap) sql.getResult();
String unionid = user.getString("unionid");
Jdh_dbt_zcfgh zcfgh = dao.fetch(Jdh_dbt_zcfgh.class, Cnd.where("jdhid", "=", teacherMeetId)
.and("fghid", "=", unionid));
TeacherMeetDelegate tmd = new TeacherMeetDelegate();
tmd.setUserId(user.getString("id"));
tmd.setTeacherMeetId(teacherMeetId);
tmd.setDelegationId(zcfgh != null ? zcfgh.getDbtid() : null);
tmd.setUserName(user.getString("username"));
tmd.setLoginName(user.getString("loginname"));
tmd.setSex(user.getString("sex"));
tmd.setNation(user.getString("nation"));
tmd.setPoliticalOutlook(user.getString("political"));
tmd.setEducation(user.getString("education"));
tmd.setTechnicalTitle(user.getString("jobTitle"));
tmd.setAdministrativeTitle(user.getString("position", ""));
tmd.setIsJdh(false);
tmd.setIsGdh(false);
if (Strings.isNotBlank(user.getString("birthday"))) {
Integer age = DateUtil.getYear() - Integer.parseInt(user.getString("birthday").substring(0, 4));
tmd.setAge(age);
}
tmd.setStateCode(0);
baseService.dao().insert(tmd);
}
});
return null;
}
@At
@ViReturn
public Object doCofirmMany(String data) {
List<TeacherMeetDelegate> delegateList = Json.fromJsonAsList(TeacherMeetDelegate.class, data);
Trans.exec(() -> {
delegateList.forEach(v -> {
v.setStateCode(100);
baseService.dao().updateIgnoreNull(v);
});
});
return null;
}
@At
@ViReturn
public Object doUpdate(TeacherMeetDelegate delegate) {
delegate.setStateCode(100);
baseService.dao().updateIgnoreNull(delegate);
return null;
}
@At
@ViReturn
public Object doRevoke(TeacherMeetDelegate delegate) {
delegate.setStateCode(0);
baseService.dao().updateIgnoreNull(delegate);
return null;
}
@At
@ViReturn
public Object doDelete(String id) {
baseService.dao().clear(TeacherMeetDelegate.class, Cnd.where("id", "=", id));
return null;
}
@Inject
private SysDictService sysDictService;
@At
@ViReturn
public Object getTechnicalTitleOptions() {
List<Sys_dict> firstOptions = sysDictService.getSubListByCode("JobTitle");
List<NutMap> hasChildrenFirstOptions = firstOptions.stream().filter(Sys_dict::isHasChildren)
.map(v -> NutMap.NEW().addv("label", v.getName()).addv("code", v.getCode())).collect(Collectors.toList());
for (NutMap option : hasChildrenFirstOptions) {
List<Sys_dict> childrens = sysDictService.getSubListByCode((String) option.get("code"));
List<Map<String, String>> filterChildrens = childrens.stream().map(v -> Map.of("label", v.getName(), "value", v.getCode())).collect(Collectors.toList());
option.put("options", filterChildrens);
}
return hasChildrenFirstOptions;
}
}
@@ -0,0 +1,58 @@
package io.v.nutz.zhgh.jdh.controller.db;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.base.service.ViService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhf
* @date 2021/5/28 16:17
* @description
*/
@IocBean
@Ok("json:full")
@At("/platform/dbyx/agent")
public class dbYxAgentController {
@Inject
private Vi vi;
@Inject("Jdh_db")
private ViService<Jdh_db> jdh_dbViService;
private static final String UNION = "/platform/jdh/db/qrmd";
@At
@ViReturn
public Object getAgenda() {
final String title = "【代表预选】";
List<NutMap> result = new ArrayList<>();
if (ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) {
result.add(new NutMap().setv("title", title).setv("url", UNION).setv("iconClass", vi.getIconByPath(UNION)).setv("label", "待校工会审核").setv("number", getUnionCount()));
}
return result;
}
public Object getUnionCount() {
return jdh_dbViService.count(Cnd.where("dbzt", "=", 1));
}
}
@@ -0,0 +1,31 @@
package io.v.nutz.zhgh.jdh.controller.gzzl;
import cn.wizzer.framework.base.service.BaseService;
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;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 11:48
*/
@IocBean
@At("/platform/jdh/gzzlgl")
@Ok("json:full")
public class JdhGzzlglController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jdh/gzzl/zlgl.html")
@RequiresPermissions("sys.jdh.gzzl.gl")
public void index(){
}
}
@@ -0,0 +1,127 @@
package io.v.nutz.zhgh.jdh.controller.gzzl;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.zhgh.jdh.model.gzzl.Jdh_gzzllx;
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.entity.Record;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 9:03
*/
@IocBean
@At("/platform/jdh/gzzllx")
@Ok("json:full")
public class JdhGzzllxController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jdh/gzzl/zllx.html")
@RequiresPermissions("sys.jdh.gzzl.lx")
public void index() {
}
@At
@RequiresPermissions("sys.jdh.gzzl.lx")
public Object doAdd(Jdh_gzzllx gzzllx) {
try {
int count = baseService.count("jdh_gzzllx", Cnd.where("code", "=", gzzllx.getCode()));
if (count > 0) {
return Result.error("编码重复");
}
gzzllx.setId(R.UU32());
int totalCount = baseService.count("jdh_gzzllx");
gzzllx.setXh(totalCount + 1);
baseService.insert("jdh_gzzllx", Chain.from(gzzllx));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.gzzl.lx")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "lxname",required = false) String lxname) {
try {
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(lxname)) {
cnd.and("lxname", "like", "%" + lxname + "%");
}
cnd.asc("xh");
Pagination pagination = baseService.listPage(pageNumber, pageSize, "jdh_gzzllx", cnd);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.gzzl.lx")
public Object doEdit(Jdh_gzzllx gzzllx) {
try {
int count = baseService.count("jdh_gzzllx", Cnd.where("code", "=", gzzllx.getCode()).and("id", "!=", gzzllx.getId()));
if (count > 0) {
return Result.error("编码重复");
}
baseService.update("jdh_gzzllx", Chain.from(gzzllx), Cnd.where("id", "=", gzzllx.getId()));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.gzzl.lx")
public Object doDelete(String id) {
try {
baseService.clear("jdh_gzzllx", Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.gzzl.lx")
public Object xhChange(String id,Integer xh,boolean toDown) {
if (toDown) {
Record next = baseService.dao().fetch("jdh_gzzllx", Cnd.where("xh", "=", xh + 1));
next.set("xh", next.getInt("xh") - 1);
baseService.update("jdh_gzzllx", Chain.from(next), Cnd.where("id", "=", next.getString("id")));
baseService.update("jdh_gzzllx", Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
} else {
Record pre = baseService.dao().fetch("jdh_gzzllx", Cnd.where("xh", "=", xh - 1));
pre.set("xh", pre.getInt("xh") + 1);
baseService.update("jdh_gzzllx", Chain.from(pre), Cnd.where("id", "=", pre.getString("id")));
baseService.update("jdh_gzzllx", Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
}
return Result.success();
}
}
@@ -0,0 +1,267 @@
package io.v.nutz.zhgh.jdh.controller.hyhd;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.FileService;
import io.v.nutz.zhgh.jdh.model.hyjhd.Jdh_hyhd;
import io.v.nutz.web.commons.utils.ShiroUtil;
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.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/21 15:09
*/
@IocBean
@At("/platform/jdh/hyjhd")
@Ok("json:full")
public class JdhHyHdController {
@Inject
private BaseService baseService;
@Inject
private FileService fileService;
@Inject
private FtpService ftpService;
@At("")
@Ok("beetl:/platform/jdh/hyhd/index.html")
@RequiresPermissions("jdh.hyjhd")
public void index() {
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("jdh.hyjhd")
public Object doAdd(String data,TempFile file) {
try {
Jdh_hyhd hyhd = Json.fromJson(Jdh_hyhd.class, data);
String id = R.UU32();
hyhd.setId(id);
hyhd.setUserid(ShiroUtil.getPrincipalProperty("id").toString());
baseService.insert("jdh_hyhd", Chain.from(hyhd));
fileService.upload(file, id, "/jdh/hyhd/");
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("jdh.hyjhd")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "name",required = false) String name,
@Param(value = "lx",required = false) Integer lx,
@Param(value = "jdhid",required = false) String jdhid) {
try {
Sql sql = Sqls.create("""
SELECT
hyhd.*,
jdh.jdhallname
FROM
jdh_hyhd hyhd
LEFT JOIN jdh_jdhxx jdh ON jdh.id = hyhd.jdhid
$condition
""");
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(name)) {
cnd.and("name", "like", "%" + name + "%");
}
cnd.andEX("lx", "=", lx);
cnd.andEX("jdh.id", "=", jdhid);
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("jdh.hyjhd")
public Object findOne(String id) {
try {
NutMap res = NutMap.NEW();
Sql sql = Sqls.create("""
SELECT
hyhd.*,
jdh.jdhallname,
u.username
FROM
jdh_hyhd hyhd
LEFT JOIN sys_user u ON u.id = hyhd.userid
LEFT JOIN jdh_jdhxx jdh ON jdh.id = hyhd.jdhid
WHERE
hyhd.id = @hyhdid
""");
sql.setParam("hyhdid", id);
Object o = baseService.list(sql).get(0);
List<Record> fileList = baseService.dao().query("sys_file", Cnd.where("reid", "=", id));
res.setv("data", o);
res.setv("fileList", fileList);
return Result.success(res);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("jdh.hyjhd")
public Object doEdit(String data,TempFile file,String delFile) {
try {
Jdh_hyhd hyhd = Json.fromJson(Jdh_hyhd.class, data);
baseService.update("jdh_hyhd", Chain.from(hyhd), Cnd.where("id", "=", hyhd.getId()));
if (file != null) {
fileService.upload(file, hyhd.getId(), "/jdh/hyhd/");
}
List<NutMap> delMapList = Json.fromJsonAsList(NutMap.class, delFile);
for (NutMap del : delMapList) {
fileService.delete(del.getString("fileid"), del.getString("filepath"));
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("jdh.hyjhd")
public Object userData(String id) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.sex,
u.mobile,
dw.NAME AS dwname
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.id = dw.unionid
WHERE
u.id IN ( SELECT userid FROM jdh_hyhd_cy WHERE hyhdid = @hyhdid )
""");
sql.setParam("hyhdid", id);
List list = baseService.list(sql);
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("jdh.hyjhd")
public Object queryUser(String query,String id) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
dw.NAME AS dwname
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.id = dw.unionid
WHERE
u.id NOT IN ( SELECT userid FROM jdh_hyhd_cy WHERE hyhdid = @hyhdid )
AND ( u.username LIKE @keyword OR u.loginname LIKE @keyword )
""");
sql.setParam("hyhdid", id);
sql.setParam("keyword", "%" + query + "%");
List<Object> list = baseService.listPage(1, 10, sql).getList();
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("jdh.hyjhd")
public Object doAddUser(String id,String userid) {
try {
Chain chain = Chain.make("id", R.UU32()).add("userid", userid).add("hyhdid", id);
baseService.insert("jdh_hyhd_cy", chain);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("jdh.hyjhd")
public Object doDeleteUser(String id, String userid) {
try {
baseService.clear("jdh_hyhd_cy", Cnd.where("hyhdid", "=", id).and("userid", "=", userid));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("jdh.hyjhd")
public Object doDelete(String id) {
try {
baseService.clear("jdh_hyhd", Cnd.where("id", "=", id));
baseService.clear("jdh_hyhd_cy", Cnd.where("hyhdid", "=", id));
Record file = baseService.dao().fetch("sys_file", Cnd.where("reid", "=", id));
if (null != file) {
ftpService.delete(file.getString("filepath"));
}
baseService.clear("sys_file", Cnd.where("reid", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,160 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.zhgh.jdh.model.two.Jdh_db2;
import io.v.nutz.zhgh.jdh.model.two.Jdh_jdhxx2;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysUserService;
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.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
@IocBean
@At("/platfotm/jdh/jdh2/dbgl")
@Ok("json:full")
public class Jdh2DbController {
@At("")
@Ok("beetl:/platform/jdh/two/dbgl.html")
@RequiresPermissions("jdh.jdh2.dbgl")
public void index() {
}
@Inject
private BaseService baseService;
@Inject
private SysUserService sysUserService;
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.dbgl")
public Object pageData(@Param("unionid") String unionid,
@Param("jdhid") String jdhid, PageForm page) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
db.*,
u.loginname,
u.username,
u.sex,
u.mobile,
u.unionname,
u.unitname,
xx.jdhallname
FROM
`jdh_db2` db
LEFT JOIN `user` u ON db.userid = u.id
LEFT JOIN jdh_jdhxx2 xx ON xx.id = db.jdhid
$condition
""");
if (Strings.isNotBlank(unionid)) {
cnd.and("db.unionid", "=", unionid);
}
if (Strings.isNotBlank(jdhid)) {
cnd.and("db.jdhid", "=", jdhid);
}
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%");
}
cnd.desc("u.unitid");
sql.setCondition(cnd);
return baseService.listPage(page.getPageNumber(), page.getPageSize(), sql);
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.dbgl")
public Object getJdhList(String unionid) {
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(unionid)) {
cnd.and("unionid", "=", unionid);
}
cnd.and("jdhkqzt", "=", 1);
cnd.desc("jdhcjsj");
return baseService.dao().query(Jdh_jdhxx2.class, cnd);
}
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.dbgl")
public Object queryNotUser(String jdhid,String unionid,String keyword) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.unitname,
u.unitid,
u.unionname,
u.unionid
FROM
`user` u
WHERE
u.id NOT IN ( SELECT userid FROM jdh_db2 WHERE unionid = @unionid AND jdhid = @jdhid )
AND u.unionid = @unionid
AND (u.username like @keyword or u.loginname LIKE @keyword)
""").setParam("unionid", unionid).setParam("jdhid", jdhid).setParam("keyword", "%" + keyword + "%");
return baseService.listPage(1, 20, sql);
}
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.dbgl")
public Object doAdd(String jdhid, String unionid,String[] userList) {
Trans.exec(() -> {
for (String u : userList) {
Jdh_db2 jdh_db2 = new Jdh_db2();
jdh_db2.setId(R.UU32());
jdh_db2.setJdhid(jdhid);
jdh_db2.setUnionid(unionid);
jdh_db2.setUserid(u);
jdh_db2.setRoleid(Roles.JDH_DB2);
baseService.insert(jdh_db2);
Sys_user_role user_role = new Sys_user_role();
user_role.setUserId(u);
user_role.setRoleId(Roles.JDH_DB2);
user_role.setUnionid(unionid);
user_role.setJdhid(jdhid);
baseService.insert(user_role);
}
sysUserService.clearCache();
});
return null;
}
@At
@ViReturn
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.dbgl")
public Object doDelete(String id,String userid, String jdhid) {
Trans.exec(() -> {
baseService.clear("jdh_db2", Cnd.where("id", "=", id));
baseService.clear("sys_user_role", Cnd.where("userid", "=", userid).and("roleid", "=", Roles.JDH_DB2).and("jdhid", "=", jdhid));
});
return null;
}
}
@@ -0,0 +1,252 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.*;
import io.v.nutz.zhgh.jdh.model.two.Jdh2_gzzl;
import io.v.nutz.zhgh.jdh.model.two.JdhLevel2;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.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.sql.Criteria;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.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 java.util.List;
import java.util.stream.Collectors;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 11:48
*/
@IocBean
@At("/platform/jdh2/gzzlgl")
@Ok("json:full")
public class Jdh2GzzlglController {
@Inject
private BaseService baseService;
@Inject
private FtpService ftpService;
@Inject
private FileService fileService;
@Inject
private Dao dao;
@Inject
private ViService viService;
@At("")
@Ok("beetl:/platform/jdh/two/zlgl.html")
@RequiresPermissions("sys.jdh2.gzzl.gl")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object getTreeData(@Param(value = "year",required = false) String year,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "zllx",required = false) String zllx) {
NutMap nutMap = NutMap.NEW();
nutMap.setv("unionname", "工会委员会");
Sql sql = Sqls.create("""
select
un.*,
(select count(*) from jdh2_gzzl g left join `user` u on g.userid=u.id where u.unionId = un.id and g.state=0 $zlCount) as zlCount
from
sys_union un
$condition
order by unioncode asc
""");
Criteria criteria = Cnd.cri();
criteria.where().setTop(false);
if (StringUtils.isNotBlank(year)) {
criteria.where().and("year(time)", "=", year);
}
if (StringUtils.isNotBlank(jdhid)) {
criteria.where().and("g.jdhid", "=", jdhid);
}
if (StringUtils.isNotBlank(zllx)) {
criteria.where().and("g.zllx", "=", zllx);
}
if (!criteria.where().isEmpty()) {
sql.vars().set("zlCount", "and " + criteria.toSql(null));
}
if (!ShiroUtil.hasAnyRoles("sysadmin, SchoolUnionAdmin")) {
List<Sys_user_role> data = dao.query(Sys_user_role.class, Cnd.where("userId", "=", ShiroUtil.getPrincipalProperty("id")).and("roleId", "=", Roles.UNION_MANGER));
List<String> unionIds = data.stream().map(Sys_user_role::getUnionid).distinct().collect(Collectors.toList());
Cnd cnd = Cnd.NEW();
cnd.and("id", "in", unionIds);
sql.setCondition(cnd);
}
nutMap.setv("child", viService.listMap(sql));
return List.of(nutMap);
}
@At
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy,
@Param(value = "year",required = false) String year,
@Param(value = "zlname",required = false) String zlname,
@Param(value = "jdhid",required = false) String jdhid,
@Param(value = "zllx",required = false) String zllx,
@Param(value = "unionId",required = false) String unionId) {
try {
Sql sql = Sqls.create("""
SELECT
cbwj.*,
lx.lxname,
u.unionname
FROM
jdh2_gzzl cbwj
LEFT JOIN jdh2_gzzllx lx ON lx.id = cbwj.zllx
LEFT JOIN `user` u ON u.id = cbwj.userid
$condition
""");
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
}
if (Strings.isNotBlank(year)) {
cnd.and("year(cbwj.time)", "=", year);
}
if (Strings.isNotBlank(zlname)) {
cnd.and("cbwj.zlname", "like", "%" + zlname + "%");
}
if (Strings.isNotBlank(jdhid)) {
cnd.and("cbwj.jdhid", "=", jdhid);
}
if (Strings.isNotBlank(zllx)) {
cnd.and("cbwj.zllx", "=", zllx);
}
if (!ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) {
cnd.and("u.unionId", "=", Vi.getUnionId());
}
if (Strings.isNotBlank(unionId)) {
cnd.and("u.unionId", "=", unionId);
}
cnd.desc("cbwj.jdhid");
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
return Result.error();
}
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object doAdd(Jdh2_gzzl jdh_cbwj) {
String id = R.UU32();
jdh_cbwj.setId(id);
jdh_cbwj.setUserid(ShiroUtil.getPrincipalProperty("id").toString());
jdh_cbwj.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
jdh_cbwj.setTime(DateUtil.getDate());
jdh_cbwj.setState(0);
baseService.insert("jdh2_gzzl", Chain.from(jdh_cbwj));
return null;
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object doDelete(String id) {
try {
Jdh2_gzzl jdh2_gzzl = dao.fetch(Jdh2_gzzl.class, id);
baseService.clear("jdh2_gzzl", Cnd.where("id", "=", id));
for (Sys_file file : jdh2_gzzl.getFiles()) {
fileService.delete(file.getId(), file.getFilepath());
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object doEdit(Jdh2_gzzl jdh_cbwj) {
baseService.update("jdh2_gzzl", Chain.from(jdh_cbwj), Cnd.where("id", "=", jdh_cbwj.getId()));
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object getJdh2(String unionId) {
//如果系统管理员或者校工会管理员,返回二级教代会中所有的届次
Sql sql = Sqls.create("""
SELECT
*
FROM
jdh_level2
$condition
""");
Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "SchoolUnionAdmin"})) {
cnd.and("union_id", "=", ((Sys_union) ShiroUtil.getPrincipalProperty("union")).getId());
} else {
if (StrUtil.isNotBlank(unionId)) {
cnd.and("union_id", "=", unionId);
}
}
cnd.groupBy("jdhallname");
cnd.desc("create_time");
sql.setCondition(cnd);
return baseService.list(sql);
}
@At
@ViReturn
@RequiresPermissions("sys.jdh2.gzzl.gl")
public Object oneAudit(String[] ids, String jdhid) {
if (ids != null && ids.length > 0) {
dao.update(Jdh2_gzzl.class, Chain.make("state", 2), Cnd.where("id", "in", ids));
}
JdhLevel2 jdhLevel2 = dao.fetch(JdhLevel2.class, Cnd.where("jdhallname", "=", jdhid));
jdhLevel2.setAudit_state(MeetingState.T500);
dao.updateIgnoreNull(jdhLevel2);
return null;
}
}
@@ -0,0 +1,127 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.zhgh.jdh.model.two.Jdh2_gzzllx;
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.entity.Record;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 9:03
*/
@IocBean
@At("/platform/jdh2/gzzllx")
@Ok("json:full")
public class Jdh2GzzllxController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jdh/two/zllx.html")
@RequiresPermissions("sys.jdh2.gzzl.lx")
public void index() {
}
@At
@RequiresPermissions("sys.jdh2.gzzl.lx")
public Object doAdd(Jdh2_gzzllx gzzllx) {
try {
int count = baseService.count("jdh2_gzzllx", Cnd.where("code", "=", gzzllx.getCode()));
if (count > 0) {
return Result.error("编码重复");
}
gzzllx.setId(R.UU32());
int totalCount = baseService.count("jdh2_gzzllx");
gzzllx.setXh(totalCount + 1);
baseService.insert("jdh2_gzzllx", Chain.from(gzzllx));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh2.gzzl.lx")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "lxname",required = false) String lxname) {
try {
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(lxname)) {
cnd.and("lxname", "like", "%" + lxname + "%");
}
cnd.asc("xh");
Pagination pagination = baseService.listPage(pageNumber, pageSize, "jdh2_gzzllx", cnd);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh2.gzzl.lx")
public Object doEdit(Jdh2_gzzllx gzzllx) {
try {
int count = baseService.count("jdh2_gzzllx", Cnd.where("code", "=", gzzllx.getCode()).and("id", "!=", gzzllx.getId()));
if (count > 0) {
return Result.error("编码重复");
}
baseService.update("jdh2_gzzllx", Chain.from(gzzllx), Cnd.where("id", "=", gzzllx.getId()));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh2.gzzl.lx")
public Object doDelete(String id) {
try {
baseService.clear("jdh2_gzzllx", Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh2.gzzl.lx")
public Object xhChange(String id, Integer xh, boolean toDown) {
if (toDown) {
Record next = baseService.dao().fetch("jdh2_gzzllx", Cnd.where("xh", "=", xh + 1));
next.set("xh", next.getInt("xh") - 1);
baseService.update("jdh2_gzzllx", Chain.from(next), Cnd.where("id", "=", next.getString("id")));
baseService.update("jdh2_gzzllx", Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
} else {
Record pre = baseService.dao().fetch("jdh2_gzzllx", Cnd.where("xh", "=", xh - 1));
pre.set("xh", pre.getInt("xh") + 1);
baseService.update("jdh2_gzzllx", Chain.from(pre), Cnd.where("id", "=", pre.getString("id")));
baseService.update("jdh2_gzzllx", Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
}
return Result.success();
}
}
@@ -0,0 +1,196 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.FileService;
import io.v.nutz.zhgh.jdh.model.two.Jdh_jdh2_hyjl;
import io.v.nutz.zhgh.syr.UnionUnitUtil;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/24 14:47
*/
@IocBean
@At("/platfotm/jdh/jdh2/hyjl")
@Ok("json:full")
public class Jdh2HyjlController {
@Inject
private ShiroUtil shiroUtil;
@Inject
private BaseService baseService;
@Inject
private UnionUnitUtil unionUnitUtil;
@Inject
private FileService fileService;
@At("")
@Ok("beetl:/platform/jdh/jdh2/hyjl.html")
@RequiresPermissions("jdh.jdh2.hyjl")
public void index() {
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hyjl")
public Object getHyList() {
try {
Cnd cnd = Cnd.NEW();
if (!shiroUtil.hasAnyRoles("sysadmin", "SchoolUnionAdmin")) {
if (shiroUtil.hasRole("H04")) {
cnd.and("id", "in", unionUnitUtil.getUnionList());
}
}
Sql sql = Sqls.create("""
SELECT
gh.unionname AS label,
gh.id
FROM
sys_union gh $condition
""");
sql.setCondition(cnd);
List<Record> ghList = (List<Record>) baseService.list(sql);
for (Record r : ghList) {
Sql hysql = Sqls.create("""
SELECT
hysj,
hydd,
hyname AS label,
id
FROM
jdh_jdh2
WHERE
fghid = @fghid and shzt=3
""").setParam("fghid", r.getString("id"));
List list = baseService.list(hysql);
r.set("children", list);
}
return Result.success().addData(ghList);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresAuthentication
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresPermissions("jdh.jdh2.hyjl")
public Object doAdd(String data, TempFile[] files) {
Jdh_jdh2_hyjl hyjl = Json.fromJson(Jdh_jdh2_hyjl.class, data);
String id = R.UU32();
hyjl.setId(id);
hyjl.setJlrname((String) shiroUtil.getPrincipalProperty("username"));
baseService.insert("jdh_jdh2_hyjl", Chain.from(hyjl));
for (TempFile file : files) {
fileService.upload(file, id, "/jdh/hyjlzl/");
}
return Result.success().addData(null);
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hyjl")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "fghid",required = false) String fghid) {
try {
Sql sql = Sqls.create("""
SELECT
jl.id,
jl.hysj,
jl.hydd,
jl.zcrname,
jl.jlrname,
jl.cjry,
jl.hynr,
jdh2.hyname
FROM
`jdh_jdh2_hyjl` jl
LEFT JOIN jdh_jdh2 jdh2 ON jdh2.id = jl.hyid $condition
""");
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(fghid)) {
cnd.and("jdh2.fghid", "=", fghid);
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hyjl")
public Object doDelete(String id) {
try {
baseService.clear("jdh_jdh2_hyjl", Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hyjl")
public Object doEdit(String data, TempFile[] files, String delfile) {
Jdh_jdh2_hyjl hyjl = Json.fromJson(Jdh_jdh2_hyjl.class, data);
baseService.updateIgnoreNull(hyjl);
List<String> delPathList = Json.fromJsonAsList(String.class, delfile);
for (String delpath : delPathList) {
fileService.delete(null, delpath);
}
for (TempFile file : files) {
fileService.upload(file, hyjl.getId(), "/jdh/hyjlzl/");
}
return Result.success();
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hyjl")
public Object selectFile(String id) {
Sql sql = Sqls.create("SELECT *,CONCAT('" + Globals.AppFileDomain + "',filepath) as url,filename as name FROM sys_file where reid = @id").setParam("id", id);
return Result.success().addData(baseService.list(sql));
}
}
@@ -0,0 +1,97 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.zhgh.jdh.model.two.Jdh_jdj2;
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.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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/22 11:09
*/
@IocBean
@Ok("json:full")
@At("/platfotm/jdh/jdh2/hysh")
public class Jdh2HyshController {
@Inject
private ShiroUtil shiroUtil;
@Inject
private BaseService baseService;
@At("")
@Ok("re")
@RequiresPermissions("jdh.jdh2.hysh")
public String index(){
return "beetl:/platform/jdh/jdh2/hysh.html";
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysh")
public Object pageData(Integer pageNumber,Integer pageSize,String hyname,Integer shzt,String fghid){
try {
Sql sql = Sqls.create("""
SELECT
xx.*,
gh.unionname
FROM
`jdh_jdh2` xx
LEFT JOIN sys_union gh ON gh.id = xx.fghid $condition
""");
Cnd cnd = Cnd.NEW();
if(Strings.isNotBlank(hyname)){
cnd.and("xx.hyname","like","%"+hyname+"%");
}
if(Strings.isNotBlank(fghid)){
cnd.and("xx.fghid","=",fghid);
}
if(shzt!=null){
cnd.and("xx.shzt","=",shzt);
}
if(!shiroUtil.hasRole("sysadmin")){
cnd.and(new Static("xx.fghid in (select unionid from sys_user_role sur where sur.userid = '"+shiroUtil.getPrincipalProperty("id")+"' and roleid = '5d342e614e9a48288d50154bcdcc75d3')"));
}
cnd.and("xx.shzt","=",1);
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysh")
public Object doSh(Jdh_jdj2 jdh2){
try {
baseService.update("jdh_jdh2",Chain.make("shzt",jdh2.getShzt()),Cnd.where("id","=",jdh2.getId()));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,153 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.zhgh.jdh.model.two.Jdh_jdj2;
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.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.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/22 11:09
*/
@IocBean
@Ok("json:full")
@At("/platfotm/jdh/jdh2/hysq")
public class Jdh2HysqController {
@Inject
private ShiroUtil shiroUtil;
@Inject
private BaseService baseService;
@Inject
private Vi vi;
@At("")
@Ok("beetl:/platform/jdh/jdh2/hysq.html")
@RequiresPermissions("jdh.jdh2.hysq")
public void index(){
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysq")
public Object getUnionList(){
try {
Cnd cnd = Cnd.NEW();
if(!shiroUtil.hasRole("sysadmin")){
cnd.and(new Static("id in (select unionid from sys_user_role sur where sur.userid = '"+shiroUtil.getPrincipalProperty("id")+"' and roleid = '5d342e614e9a48288d50154bcdcc75d3')"));
}
return Result.success().addData(baseService.dao().query("sys_union", cnd));
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysq")
public Object doAdd(Jdh_jdj2 jdh2){
try {
jdh2.setId(R.UU32());
jdh2.setTbrname(shiroUtil.getPrincipalProperty("username").toString());
jdh2.setShzt(1);
baseService.insert("jdh_jdh2", Chain.from(jdh2));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysq")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "hyname",required = false) String hyname,
@Param(value = "shzt",required = false) Integer shzt,
@Param(value = "fghid",required = false) String fghid){
try {
Sql sql = Sqls.create("""
SELECT
xx.*,
gh.unionname
FROM
`jdh_jdh2` xx
LEFT JOIN sys_union gh ON gh.id = xx.fghid $condition
""");
Cnd cnd = Cnd.NEW();
if (!shiroUtil.hasAnyRoles(new String[]{"sysadmin"})) {
cnd.and("gh.id", "in", vi.getMangeUnionStr());
}
if(Strings.isNotBlank(hyname)){
cnd.and("xx.hyname","like","%"+hyname+"%");
}
if(Strings.isNotBlank(fghid)){
cnd.and("xx.fghid","=",fghid);
}
if(shzt!=null){
cnd.and("xx.shzt","=",shzt);
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysq")
public Object doDelete(String id){
try {
baseService.clear("jdh_jdh2",Cnd.where("id","=",id));
baseService.clear("jdh_jdh2_hyjl",Cnd.where("hyid","=",id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysq")
public Object doEdit(Jdh_jdj2 jdh2){
try {
baseService.update("jdh_jdh2",Chain.from(jdh2),Cnd.where("id","=",jdh2.getId()));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,87 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
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.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.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/22 11:09
*/
@IocBean
@Ok("json:full")
@At("/platfotm/jdh/jdh2/hyyl")
public class Jdh2HyylController {
@Inject
private ShiroUtil shiroUtil;
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/jdh/jdh2/hyyl.html")
@RequiresPermissions("jdh.jdh2.hysh")
public void index() {
}
@At
@RequiresAuthentication
@RequiresPermissions("jdh.jdh2.hysh")
public Object pageData(@Param(value = "pageNumber",required = false) Integer pageNumber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "hyname",required = false) String hyname,
@Param(value = "shzt",required = false) Integer shzt,
@Param(value = "fghid",required = false) String fghid) {
try {
Sql sql = Sqls.create("""
SELECT
xx.*,
gh.unionname
FROM
`jdh_jdh2` xx
LEFT JOIN sys_union gh ON gh.id = xx.fghid $condition
""");
Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(hyname)) {
cnd.and("xx.hyname", "like", "%" + hyname + "%");
}
if (Strings.isNotBlank(fghid)) {
cnd.and("xx.fghid", "=", fghid);
}
if (shzt != null) {
cnd.and("xx.shzt", "=", shzt);
}
if (!shiroUtil.hasRole("sysadmin")) {
cnd.and(new Static("xx.fghid in (select unionid from sys_user_role sur where sur.userid = '" + shiroUtil.getPrincipalProperty("id") + "' and roleid = '5d342e614e9a48288d50154bcdcc75d3')"));
}
cnd.and("xx.shzt", "in", Lang.array("2", "3"));
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
@@ -0,0 +1,24 @@
package io.v.nutz.zhgh.jdh.controller.two;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @Author JyuHsin
* @Date 2022/7/12
* @Description
*/
@IocBean
@At("/platform/jdh2/unionManage")
@Ok("json:full")
public class Jdh2UnionManage {
@At("")
@Ok("beetl:/platform/jdh/two/unionManage.html")
@RequiresPermissions("sys.organization.unionMange.level2")
public void index(){
}
}
@@ -0,0 +1,204 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
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.zhgh.jdh.model.two.Jdh_db2;
import io.v.nutz.zhgh.jdh.model.two.Jdh_jdhxx2;
import io.v.nutz.sys.models.Sys_user_role;
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.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/17 15:19
*/
@IocBean
@At("/platform/jdh2/cb/jcgl")
@Ok("json:full")
public class Jdh2jcglController {
@Inject
private BaseService baseService;
@Inject
private Vi vi;
@At("")
@Ok("beetl:/platform/jdh/two/jcgl.html")
@RequiresPermissions("sys.jdh2.cb.jcgl")
public void index() {
}
@At
@RequiresAuthentication
@RequiresPermissions("sys.jdh2.cb.jcgl")
public Object pageData(@Param(value = "pageNumnber",required = false) Integer pageNumnber,
@Param(value = "pageSize",required = false) Integer pageSize,
@Param(value = "searchYear",required = false) Integer searchYear,
@Param(value = "jdhjs",required = false) String jdhjs,
@Param(value = "jdhcs",required = false) String jdhcs,
@Param(value = "pageOrderName",required = false) String pageOrderName,
@Param(value = "pageOrderBy",required = false) String pageOrderBy,
@Param(value = "unionid",required = false) String unionid) {
try {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
xx.*,
un.unionname
FROM
jdh_jdhxx2 xx
LEFT JOIN sys_union un ON xx.unionid = un.id
$condition
""");
if (searchYear != null) {
cnd.and("xx.jdhnf", "=", searchYear);
}
if (Strings.isNotBlank(unionid)) {
cnd.and("xx.unionid", "=", unionid);
}
if (Strings.isNotBlank(jdhjs)) {
cnd.and("xx.jdhjs", "=", jdhjs);
}
if (Strings.isNotBlank(jdhcs)) {
cnd.and("xx.jdhcs", "=", jdhcs);
}
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
} else {
cnd.desc("xx.jdhnf").asc("un.unionname");
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumnber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresAuthentication
@RequiresPermissions("sys.jdh2.cb.jcgl")
public Object doAdd(Jdh_jdhxx2 jdhxx2, boolean isExtend) {
int count = baseService.count("jdh_jdhxx2", Cnd.where("jdhjs", "=", jdhxx2.getJdhjs()).and("jdhcs", "=", jdhxx2.getJdhcs()).and("unionid", "=", jdhxx2.getUnionid()));
int count1 = baseService.count("jdh_jdhxx2", Cnd.where("jdhnf", "=", jdhxx2.getJdhnf()).and("unionid", "=", jdhxx2.getUnionid()));
if (count > 0) {
return Result.error().addMsg("当前届次的教代会已存在,无法重复创建!");
}
if (count1 > 0) {
return Result.error().addMsg("一年只能创建一次教代会!");
}
Trans.exec(() -> {
jdhxx2.setId(R.UU32());
jdhxx2.setJdhkqzt(true);
jdhxx2.setJdhcjsj(DateUtil.getDate());
jdhxx2.setJdhallname(jdhxx2.getJdhjs() + "" + jdhxx2.getJdhcs() + "次教代会");
baseService.insert("jdh_jdhxx2", Chain.from(jdhxx2));
if (isExtend) {
List<Jdh_jdhxx2> jdh_db2s = baseService.dao().query(Jdh_jdhxx2.class, Cnd.where("jdhjs", "=", jdhxx2.getJdhjs()).and("jdhcs", "=", getCs(jdhxx2.getJdhcs())).and("unionid", "=", jdhxx2.getUnionid()));
if (jdh_db2s.size() > 0) {
String jdhidold = jdh_db2s.get(0).getId();
List<Jdh_db2> db2s = baseService.dao().query(Jdh_db2.class, Cnd.where("jdhid", "=", jdhidold));
for (Jdh_db2 db2 : db2s) {
db2.setId(R.UU32());
db2.setJdhid(jdhxx2.getId());
db2.setUnionid(db2.getUnionid());
db2.setRoleid(db2.getRoleid());
db2.setUserid(db2.getUserid());
baseService.insert(db2);
Sys_user_role user_role = new Sys_user_role();
user_role.setUserId(db2.getUserid());
user_role.setRoleId(db2.getRoleid());
user_role.setUnionid(db2.getUnionid());
user_role.setJdhid(jdhxx2.getId());
baseService.insert(user_role);
}
}
}
});
return Result.success().addMsg("教代会创建成功!");
}
@At
@RequiresAuthentication
@RequiresPermissions("sys.jdh2.cb.jcgl")
public Object doDelete(String id) {
Trans.exec(() -> {
baseService.clear("jdh_jdhxx2", Cnd.where("id", "=", id));
baseService.clear("jdh_db2", Cnd.where("jdhid", "=", id));
baseService.clear("sys_user_role", Cnd.where("jdhid", "=", id));
});
return Result.success();
}
@At
@RequiresAuthentication
@RequiresPermissions("sys.jdh2.cb.jcgl")
public Object jdhztChange(String id, boolean status) {
try {
baseService.update("jdh_jdhxx2", Chain.make("jdhkqzt", !status), Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
return Result.error();
}
}
@At
@RequiresAuthentication
@RequiresPermissions("sys.jdh2.cb.jcgl")
public Object editDo(Jdh_jdhxx2 jdhxx2) {
try {
jdhxx2.setJdhcjsj(DateUtil.getDate());
jdhxx2.setJdhallname(jdhxx2.getJdhjs() + "" + jdhxx2.getJdhcs() + "次教代会");
baseService.update(jdhxx2);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
public static String getCs(String cs) {
if (cs.equals("")) {
return "";
} else if (cs.equals("")) {
return "";
} else if (cs.equals("")) {
return "";
} else if (cs.equals("")) {
return "";
}
return "";
}
}
@@ -0,0 +1,204 @@
package io.v.nutz.zhgh.jdh.controller.two;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.FileService;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.model.two.Jdh2_gzzl;
import io.v.nutz.zhgh.jdh.model.two.Jdh2_gzzllx;
import io.v.nutz.zhgh.jdh.model.two.JdhLevel2;
import io.v.nutz.zhgh.jdh.services.MeetingLevelTwoService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.web.commons.slog.annotation.SLog;
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;
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.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @author: Aaron
* @create: 2021-01-19 17:24
* @description: 二级教代会会议申请
**/
@IocBean
@Ok("json:full")
@At("/platform/jdh/level2/info")
@RequiresAuthentication
public class MeetingApplicationController {
@Inject
private Vi vi;
@Inject
private MeetingLevelTwoService meetingLevelTwoService;
@Inject
private Dao dao;
@Inject
private FileService fileService;
@At("")
@Ok("beetl:/platform/jdh/two/apply.html")
@RequiresPermissions("jdh.level2.info")
public void index() {
}
@At
@ViReturn
@RequiresPermissions(value = {"jdh.level2.info","jdh.level2.reading"},logical = Logical.OR)
public Object pageData(@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId, PageForm page) {
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasAnyRoles("sysadmin,H06")) {
if (ShiroUtil.hasAnyRoles("H04")) {
cnd.and("uni.id", "IN", vi.getMangeUnionStr());
}
}
return meetingLevelTwoService.pageData(cnd, page, unionId, unitId);
}
@At
@RequiresAuthentication
@SLog(tag = "双代会系统管理", msg = "会议新增", param = true, result = true)
@ViReturn
@RequiresPermissions(value = {"jdh.level2.info","jdh.level2.reading"},logical = Logical.OR)
public Object doAdd(@Param("jdhLevel2") JdhLevel2 jdhLevel2) {
jdhLevel2.setFounder(ShiroUtil.getPrincipalProperty("id").toString());
jdhLevel2.setCreate_time(DateUtil.getDate());
jdhLevel2.setUnit_id(ShiroUtil.getPrincipalProperty("unitid").toString());
jdhLevel2.setUnion_id(((Sys_union) ShiroUtil.getPrincipalProperty("union")).getId());
jdhLevel2.setAudit_state(MeetingState.T300);
JdhLevel2 insert = meetingLevelTwoService.insert(jdhLevel2);
//新增双代会会议时,将附件同时添加到会议资料表中
if (jdhLevel2.getFiles().size() > 0) {
Jdh2_gzzl jdh2_gzzl = new Jdh2_gzzl();
String id = R.UU32();
jdh2_gzzl.setId(id);
jdh2_gzzl.setUserid(ShiroUtil.getPrincipalProperty("id").toString());
jdh2_gzzl.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
jdh2_gzzl.setTime(DateUtil.getDate());
jdh2_gzzl.setJdhid(jdhLevel2.getJdhallname());
String str = jdhLevel2.getMeeting_name().contains("请示") ? "资料" : "请示资料";
jdh2_gzzl.setZlname(jdhLevel2.getMeeting_name() + str);
jdh2_gzzl.setZllx(dao.fetch(Jdh2_gzzllx.class, Cnd.NEW().and("lxname", "=", "会议请示")).getId());
jdh2_gzzl.setIspass(true);
jdh2_gzzl.setFiles(jdhLevel2.getFiles());
jdh2_gzzl.setFromid(insert.getId());
jdh2_gzzl.setState(2);
dao.insert("jdh2_gzzl", Chain.from(jdh2_gzzl));
}
return insert;
}
@At
@RequiresAuthentication
@SLog(tag = "双代会系统管理", msg = "会议编辑", param = true, result = true)
@ViReturn
@RequiresPermissions(value = {"jdh.level2.info","jdh.level2.reading"},logical = Logical.OR)
public Object doEdit(@Param("jdhLevel2") JdhLevel2 jdhLevel2) {
if (jdhLevel2.getAudit_state().equals(MeetingState.T200) || jdhLevel2.getAudit_state().equals(MeetingState.T400)) {
jdhLevel2.setAudit_state(MeetingState.T300);
jdhLevel2.setParty_committee_id("");
jdhLevel2.setSchool_union_id("");
}
//修改双代会会议时,将附件同时添加到会议资料表中
if (jdhLevel2.getFiles().size() > 0) {
Jdh2_gzzl gzzl = dao.fetch(Jdh2_gzzl.class, Cnd.NEW().and("fromid", "=", jdhLevel2.getId()));
gzzl.setFiles(jdhLevel2.getFiles());
dao.updateIgnoreNull(gzzl);
}
return meetingLevelTwoService.updateIgnoreNull(jdhLevel2);
}
@At
@RequiresAuthentication
@SLog(tag = "双代会系统管理", msg = "会议删除", param = true, result = true)
@ViReturn
@RequiresPermissions(value = {"jdh.level2.info","jdh.level2.reading"},logical = Logical.OR)
public Object doDelete(String id) {
JdhLevel2 jdhLevel2 = meetingLevelTwoService.fetch(id);
meetingLevelTwoService.delete(id);
dao.clear("jdh2_gzzl", Cnd.NEW().and("fromid", "=", id));
//删除文件
List<Sys_file> files = jdhLevel2.getFiles();
for (Sys_file file : files) {
fileService.delete(file.getId(), file.getFilepath());
}
return null;
}
@At
@ViReturn
@RequiresPermissions(value = {"jdh.level2.info","jdh.level2.reading"},logical = Logical.OR)
public Object getMeetingInfo(String id) {
Sql sql = Sqls.create("""
SELECT
jdh2.*,
s.color,
s.`name` state_name,
fo.username,
party.username party_name,
school.username school_name,
un.`name` unit_name,
uni.unionname union_name
FROM
jdh_level2 jdh2
LEFT JOIN jdh_level2_state s ON s.id = jdh2.audit_state
LEFT JOIN sys_user fo ON fo.id = jdh2.founder
LEFT JOIN sys_user party ON party.id = jdh2.party_committee_id
LEFT JOIN sys_user school ON school.id = jdh2.school_union_id
LEFT JOIN sys_unit un ON un.id = jdh2.unit_id
LEFT JOIN sys_union uni ON uni.id = un.unionid
WHERE
jdh2.id = @id
ORDER BY
jdh2.audit_state ASC,
jdh2.create_time DESC
""").setParam("id", id);
List<Record> list = meetingLevelTwoService.list(sql);
return list.isEmpty() ? null : list.get(0);
}
@At
@ViReturn
@RequiresPermissions(value = {"jdh.level2.info","jdh.level2.reading"},logical = Logical.OR)
public Object findOne(String id) {
Sql sql = Sqls.create("""
SELECT
jdh2.*,
un.`name` unit_name
FROM
jdh_level2 jdh2
LEFT JOIN sys_unit un ON un.id = jdh2.unit_id
WHERE
jdh2.id = @id
""").setParam("id", id);
List<Record> list = meetingLevelTwoService.list(sql);
return list.isEmpty() ? null : list.get(0);
}
}
@@ -0,0 +1,143 @@
package io.v.nutz.zhgh.jdh.controller.two;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.model.two.Jdh2_gzzl;
import io.v.nutz.zhgh.jdh.model.two.Jdh2_gzzllx;
import io.v.nutz.zhgh.jdh.model.two.JdhLevel2;
import io.v.nutz.zhgh.jdh.services.MeetingLevelTwoService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.web.commons.utils.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.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.List;
/**
* @author: Aaron
* @create: 2021-01-20 15:57
* @description:
**/
@IocBean
@Ok("json:full")
@At("/platform/jdh/level2/audit")
@RequiresAuthentication
public class MeetingAuditController {
@Inject
private MeetingLevelTwoService meetingLevelTwoService;
@Inject
private Dao dao;
@At("")
@Ok("beetl:/platform/jdh/two/audit.html")
@RequiresPermissions("jdh.level2.audit")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("jdh.level2.audit")
public Object pageData(@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId,
@Param(value = "isAudit",required = false) Boolean isAudit, PageForm page) {
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasRole("sysadmin")) {
if (ShiroUtil.hasRole("Y01")) {
cnd.and("jdh2.party_committee_id", isAudit ? "IS NOT" : "IS", null);
cnd.and("jdh2.audit_state", ">=", MeetingState.T100);
} else if (ShiroUtil.hasRole("SchoolUnionAdmin")) {
if(isAudit != null) {
if(isAudit) {
cnd.and("jdh2.school_union_id", "IS NOT", null).and("jdh2.school_union_id", "!=", "");
} else {
cnd.and(Cnd.exps("jdh2.school_union_id", "IS", null).or("jdh2.school_union_id", "=", ""));
}
}
cnd.and("jdh2.audit_state", ">=", MeetingState.T300);
}
} else {
if(isAudit != null) {
if (isAudit) {
cnd.where().andIn("jdh2.audit_state", MeetingState.T200, MeetingState.T400, MeetingState.T450, MeetingState.T500);
} else {
cnd.where().andIn("jdh2.audit_state", MeetingState.T100, MeetingState.T300);
}
}
}
return meetingLevelTwoService.pageData(cnd, page, unionId, unitId);
}
@At
@RequiresAuthentication
@SLog(tag = "双代会系统管理", msg = "会议审核", param = true, result = true)
@ViReturn
@RequiresPermissions("jdh.level2.audit")
public Object doAudit(String id, String opinion, Boolean flag, String files) {
JdhLevel2 fetch = meetingLevelTwoService.fetch(id);
List<Sys_file> fileList = new ArrayList<>();
if(StrUtil.isNotBlank(files)) {
fileList = Json.fromJsonAsList(Sys_file.class, files);
}
String userId = ShiroUtil.getPrincipalProperty("id").toString();
Chain chain = null;
if (fetch.getAudit_state().equals(MeetingState.T100) && ShiroUtil.hasAnyRoles("sysadmin,gh03")) {
chain = Chain.make("party_committee_id", userId).add("party_committee_time", DateUtil.getDate())
.add("party_committee_opinion", opinion).add("audit_state", flag ? MeetingState.T300 : MeetingState.T200);
} else if (fetch.getAudit_state().equals(MeetingState.T300) && ShiroUtil.hasAnyRoles("sysadmin,SchoolUnionAdmin")) {
chain = Chain.make("school_union_id", userId).add("school_union_time", DateUtil.getDate())
.add("school_union_opinion", opinion).add("audit_state", flag ? MeetingState.T450 : MeetingState.T400);
chain.add("school_files", fileList);
}
//批复双代会会议时,将附件同时添加到会议资料表中
if(fileList.size() > 0) {
Jdh2_gzzl jdh2_gzzl = new Jdh2_gzzl();
String rid = R.UU32();
jdh2_gzzl.setId(rid);
jdh2_gzzl.setUserid(ShiroUtil.getPrincipalProperty("id").toString());
jdh2_gzzl.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
jdh2_gzzl.setTime(DateUtil.getDate());
jdh2_gzzl.setJdhid(fetch.getJdhallname());
String str = fetch.getMeeting_name().contains("批复") ? "资料" : "批复资料";
jdh2_gzzl.setZlname(fetch.getMeeting_name().replace("请示", "") + str);
jdh2_gzzl.setZllx(dao.fetch(Jdh2_gzzllx.class, Cnd.NEW().and("lxname", "=", "会议批复")).getId());
jdh2_gzzl.setIspass(true);
jdh2_gzzl.setFiles(fileList);
jdh2_gzzl.setFromid(id);
jdh2_gzzl.setState(2);
dao.insert("jdh2_gzzl", Chain.from(jdh2_gzzl));
}
return meetingLevelTwoService.update(chain, Cnd.where("id", "=", id));
}
@At
@RequiresAuthentication
@SLog(tag = "双代会系统管理", msg = "会议撤回", param = true, result = true)
@RequiresPermissions("jdh.level2.audit")
public Object callback(String id) {
return meetingLevelTwoService.callback(id);
}
}
@@ -0,0 +1,29 @@
package io.v.nutz.zhgh.jdh.controller.two;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @author zhf
* @date 2021/1/21 8:55
* @description 会议阅览
*/
@IocBean
@Ok("json:full")
@At("/platform/jdh/level2/reading")
@RequiresAuthentication
public class MeetingReadingController {
@At("")
@Ok("beetl:/platform/jdh/two/reading.html")
@RequiresPermissions("jdh.level2.reading")
public void index() {
}
}
@@ -0,0 +1,39 @@
package io.v.nutz.zhgh.jdh.controller.two;
/**
* @author: Aaron
* @create: 2021-01-20 16:49
* @description:
**/
public interface MeetingState {
/**
* 待院级党委审核
*/
Integer T100 = 100;
/**
* 党委退回
*/
Integer T200 = 200;
/**
* 待校工会审核
*/
Integer T300 = 300;
/**
* 校工会退回
*/
Integer T400 = 400;
/**
* 待提交资料
*/
Integer T450 = 450;
/**
* 已完结
*/
Integer T500 = 500;
}
@@ -0,0 +1,602 @@
package io.v.nutz.zhgh.jdh.controller.zzjg;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt_zcdw;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt_zcfgh;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUserRoleService;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.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.List;
/**
* @author zhf
* @date 2021/1/25 9:54
* @description 代表团设置
*/
@IocBean
@At("/platform/jdh/zzjg/delegation")
@Ok("json:full")
public class DelegationController {
@Inject("Jdh_dbt")
private ViService<Jdh_dbt> jdhDbtViService;
@Inject("Jdh_dbt_zcfgh")
private ViService<Jdh_dbt_zcfgh> jdhDbtZcfghViService;
@Inject("Jdh_dbt_zcdw")
private ViService<Jdh_dbt_zcdw> jdhDbtZcdwViService;
@Inject
private SysUserRoleService sysUserRoleService;
@Inject("Jdh_db")
private ViService<Jdh_db> jdhDbViService;
@Inject
private SysDictService sysDictService;
@Inject
private SysRoleService sysRoleService;
@Inject
private Dao dao;
private static final String SYS_DICT_DBT_ID = "9373a8db35ca428f9b24d7ceac96a550";
private static final String SYS_FGH_ZX_ROLE_ID = "9c1f19e385914fef82bc35da7c9ded36";
private static final String JDH_DBT_CZY_ROLE_ID = "0af36fa65ee742deb46a1fb1ded268ff";
private static final String JDH_DBT_TZ_ROLE_ID = "c1765c03459840c2b621d140f575c869";
private static final String JDH_DBT_FTZ_ROLE_ID = "6445f21685c5489aa212a986cfbeecce";
private static final String ZSDB = "1427083503b74aa0885d104419b33170";
@At("")
@Ok("beetl:/platform/jdh/zzjg/delegation.html")
@RequiresPermissions("sys.jdh.zzjg.delegation")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object undertakeUnionTree(String jdhid) {
Record record = new Record();
record.set("dbtname", "教代会代表团");
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
dbt.*,
jdh.jdhallname,
jdh.jdhkqsj,
dict.`code`
FROM
jdh_dbt dbt
LEFT JOIN jdh_dbt_zcfgh jdz ON jdz.dbtid = dbt.id
AND jdz.jdhid = dbt.jdhid
LEFT JOIN jdh_jdhxx jdh ON dbt.`jdhid` = dbt.jdhid
LEFT JOIN sys_dict dict ON dict.`name` = dbt.dbtname $condition
""");
cnd.and("jdh.jdhkqzt", "=", 1);
cnd.and("dbt.jdhid", "=", jdhid);
cnd.groupBy("dbt.id");
cnd.asc("dbt.`code`");
sql.setCondition(cnd);
record.set("childrens", jdhDbtViService.list(sql));
return record;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object pageData(@Param(value = "union_id", required = false) String union_id,
@Param(value = "pageSize", required = false) Integer pageSize,
@Param(value = "pageNumber", required = false) Integer pageNumber,
@Param(value = "jdhid", required = false) String jdhid,
@Param(value = "dbtid", required = false) String dbtid) {
Sql sql = Sqls.create("""
SELECT
dbt.*,
jdh.jdhallname,
jdh.jdhkqsj,
dict.`code` dictcode
FROM
jdh_dbt dbt
LEFT JOIN jdh_dbt_zcfgh jdz ON jdz.dbtid = dbt.id\s
AND jdz.jdhid = dbt.jdhid
LEFT JOIN jdh_jdhxx jdh ON dbt.`jdhid` = dbt.jdhid
LEFT JOIN sys_dict dict ON dict.`name` = dbt.dbtname $condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("jdh.jdhkqzt", "=", 1).and("dbt.jdhid", "=", jdhid);
if (Strings.isNotBlank(union_id)) {
cnd.and("jdz.fghid", "=", union_id);
}
if (Strings.isNotBlank(dbtid)) {
cnd.and("dbt.id", "=", dbtid);
}
cnd.groupBy("dbt.id");
cnd.asc("dbt.code");
sql.setCondition(cnd);
Pagination pagination = jdhDbtViService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
}
/**
* 查询该代表团下的组成基层工会
*
* @param dbtid 代表团id
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object adminPageData(@Param(value = "dbtid", required = false) String dbtid) {
return findAdmin(dbtid);
}
/**
* 查询该代表团下的组成单位
*
* @param dbtid 代表团id
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object unitPageData(@Param(value = "dbtid", required = false) String dbtid) {
return findAdmin2(dbtid);
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object queryKyDbtMc(String jdhid) {
Sql sql = Sqls.create("""
SELECT
dict.id,
dict.`name`,
dict.code
FROM
sys_dict dict
WHERE
dict.`parentId` = @dbtid
AND dict.`name` NOT IN ( SELECT dbt.dbtname FROM jdh_dbt dbt WHERE dbt.`jdhid` = @jdhid )
ORDER BY
`code`
""");
sql.setParam("dbtid", SYS_DICT_DBT_ID);
sql.setParam("jdhid", jdhid);
return jdhDbtViService.list(sql);
}
/**
* 添加该教代会下的代表团
*
* @param jdhid
* @param dbtname
* @param code
* @return {@link Object}
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object doAdd(String jdhid, String dbtname, String code) {
Cnd cnd = Cnd.NEW();
int count = dao.count(Jdh_dbt.class, Cnd.where("jdhid", "=", jdhid).and("dbtname", "=", dbtname));
if (count > 0) {
return Result.error("代表团名称已存在");
}
Jdh_dbt jdh_dbt = new Jdh_dbt();
jdh_dbt.setJdhid(jdhid);
jdh_dbt.setDbtname(dbtname);
jdh_dbt.setCode(code);
jdh_dbt.setCjsj(DateUtil.getDate());
jdhDbtViService.insert(jdh_dbt);
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object updateDelegation(@Param("delegation") Jdh_dbt dbt) {
dao.updateIgnoreNull(dbt);
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object doDelete(String id) {
Trans.exec(() -> {
if (Globals.MyConfig.getString("dbtzc").equals("unit")) {
//删除组成基层工会
jdhDbtZcfghViService.dao().clear(Jdh_dbt_zcdw.class, Cnd.where("dbtid", "=", id));
} else {
//删除组成基层工会
jdhDbtZcfghViService.clear(Cnd.where("dbtid", "=", id));
}
jdhDbtViService.clear(Cnd.where("id", "=", id));
//删除团长 副团长 操作员的权限
sysUserRoleService.clear(Cnd.where("dbtid", "=", id).and("roleid", "in", List.of(Roles.DBT_TZ, Roles.DBT_FTZ)));
//删除正式代表权限
sysUserRoleService.clear(Cnd.where("dbtid", "=", id).and("roleid", "=", Roles.ZSDB));
//删除jdh_db 表用户
jdhDbViService.clear(Cnd.where("dbtid", "=", id));
});
return Result.success();
}
/**
* 查询该代表团下的团长副团长
*
* @param dbtid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object getTzList(@Param(value = "dbtid", required = false) String dbtid) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.mobile,
u.sex,
r.id AS roleid,
r.NAME AS rolename,
dw.NAME AS dwname
FROM
sys_user_role ur
LEFT JOIN sys_role r ON r.id = ur.roleid
LEFT JOIN sys_user u ON u.id = ur.userid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
WHERE
ur.dbtid = @dbtid
AND ur.roleid IN (@TZROLEID, @FTZROLEID)
ORDER BY roleId DESC
""").setParam("dbtid", dbtid).setParam("TZROLEID", JDH_DBT_TZ_ROLE_ID).setParam("FTZROLEID", JDH_DBT_FTZ_ROLE_ID);
return sysUserRoleService.list(sql);
}
/**
* 查询该教代会还未组成的分工会
*
* @param jdhid
* @param dbtid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object findfgh(String jdhid, @Param(value = "dbtid", required = false) String dbtid) {
Sql sql = Sqls.create("""
SELECT
un.id,
un.unionname
FROM
sys_union un
WHERE
un.id NOT IN (
SELECT
fghid
FROM
jdh_dbt_zcfgh dz
WHERE
dz.jdhid = @jdhid
AND dz.dbtid != @dbtid
)
""").setParam("jdhid", jdhid).setParam("dbtid", dbtid);
return Record.create().set("data", jdhDbtZcfghViService.list(sql)).set("value", findAdmin(dbtid));
}
/**
* 查询该教代会还未组成的分工会
*
* @param jdhid
* @param dbtid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object finddw(String jdhid, @Param(value = "dbtid", required = false) String dbtid) {
Sql sql = Sqls.create("""
SELECT
it.id,
it.name as unitname
FROM
sys_unit it
WHERE
it.id NOT IN (
SELECT
dwid
FROM
jdh_dbt_zcdw dw
WHERE
dw.jdhid = @jdhid
AND dw.dbtid != @dbtid
) and it.unitlevel=2
""").setParam("jdhid", jdhid).setParam("dbtid", dbtid);
return Record.create().set("data", jdhDbtZcdwViService.list(sql)).set("value", findAdmin2(dbtid));
}
private List<Record> findAdmin(String dbtid) {
Sql sql = Sqls.create("""
SELECT
zc.*,
un.unionname
FROM
jdh_dbt_zcfgh zc
LEFT JOIN sys_union un ON un.id = zc.fghid
WHERE
zc.dbtid =@dbtid
""").setParam("dbtid", dbtid);
return jdhDbtZcfghViService.list(sql);
}
private List<Record> findAdmin2(String dbtid) {
Sql sql = Sqls.create("""
SELECT
zc.*,
it.name as unitname
FROM
jdh_dbt_zcdw zc
LEFT JOIN sys_unit it ON it.id = zc.dwid
WHERE
zc.dbtid =@dbtid
""").setParam("dbtid", dbtid);
return jdhDbtZcfghViService.list(sql);
}
/**
* 在该代表团下添加组成工会
*
* @param fghValue
* @param jdhid
* @param dbtid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object fghdoAdd(@Param(value = "fghValue", required = false) String[] fghValue,
@Param(value = "jdhid", required = false) String jdhid,
@Param(value = "dbtid", required = false) String dbtid) {
jdhDbtZcfghViService.clear(Cnd.where("jdhid", "=", jdhid).and("dbtid", "=", dbtid));
for (String fgh : fghValue) {
Jdh_dbt_zcfgh jdh_dbt_zcfgh = new Jdh_dbt_zcfgh();
jdh_dbt_zcfgh.setFghid(fgh);
jdh_dbt_zcfgh.setJdhid(jdhid);
jdh_dbt_zcfgh.setDbtid(dbtid);
jdhDbtZcfghViService.insert(jdh_dbt_zcfgh);
}
return null;
}
/**
* 在该代表团下添加组成单位
*
* @param dwValue
* @param jdhid
* @param dbtid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object dwdoAdd(@Param(value = "dwValue", required = false) String[] dwValue,
@Param(value = "jdhid", required = false) String jdhid,
@Param(value = "dbtid", required = false) String dbtid) {
jdhDbtZcfghViService.dao().clear(Jdh_dbt_zcdw.class, Cnd.where("jdhid", "=", jdhid).and("dbtid", "=", dbtid));
for (String id : dwValue) {
Jdh_dbt_zcdw jdh_dbt_zcdw = new Jdh_dbt_zcdw();
jdh_dbt_zcdw.setDwid(id);
jdh_dbt_zcdw.setJdhid(jdhid);
jdh_dbt_zcdw.setDbtid(dbtid);
jdhDbtZcdwViService.insert(jdh_dbt_zcdw);
}
return null;
}
/**
* 删除该代表团下的分工会
*
* @param id
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object fghdoDelete(String id) {
jdhDbtZcfghViService.clear(Cnd.where("id", "=", id));
return null;
}
/**
* 删除该代表团下的单位
*
* @param id
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object dwdoDelete(String id) {
jdhDbtZcfghViService.dao().clear(Jdh_dbt_zcdw.class, Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object userDoDelete(String userid, @Param(value = "dbtid", required = false) String dbtid, String jdhid, String roleid) {
sysUserRoleService.clear(Cnd.where("userid", "=", userid)
.and("dbtid", "=", dbtid)
.and("jdhid", "=", jdhid)
.and("roleid", "=", roleid));
sysRoleService.clearCache();
return null;
}
/**
* 查询该代表团下的没有被设为团长副团长的代表
*
* @param dbtid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object queryUser(@Param(value = "dbtid", required = false) String dbtid, String jdhid) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.mobile,
u.sex,
dw.NAME AS dwname
FROM
sys_user_role ur
LEFT JOIN jdh_db db ON db.dbid=ur.userId
LEFT JOIN sys_user u ON u.id = ur.userid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
WHERE
ur.roleid = @roleid
AND db.dbtid = @dbtid
and ur.jdhid=@jdhid
AND ur.userid NOT IN
(SELECT
userid
FROM
sys_user_role
WHERE
roleid IN ( '6445f21685c5489aa212a986cfbeecce', 'c1765c03459840c2b621d140f575c869' )
AND dbtid = @dbtid
AND jdhid=@jdhid
)
""").setParam("roleid", Roles.ZSDB).setParam("dbtid", dbtid).setParam("jdhid", jdhid);
return sysUserRoleService.list(sql);
}
/**
* 添加团长副团长
*
* @param dbtid
* @param jdhid
* @param userid
* @param num
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object doAddTz(@Param(value = "dbtid", required = false) String dbtid, String jdhid, String userid, Integer num) {
if (num == 2) {
int count = sysUserRoleService.count(Cnd.where("jdhid", "=", jdhid)
.and("dbtid", "=", dbtid).and("roleid", "=", JDH_DBT_TZ_ROLE_ID));
if (count > 0) {
return Result.error().addMsg("团长只能设置一位!");
}
}
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(userid);
userRole.setJdhid(jdhid);
userRole.setDbtid(dbtid);
userRole.setRoleId(num == 1 ? JDH_DBT_FTZ_ROLE_ID : JDH_DBT_TZ_ROLE_ID);
sysUserRoleService.insert(userRole);
sysRoleService.clearCache();
return Result.success();
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.delegation")
public Object dbTableData(@Param(value = "dbtid", required = false) String dbtid,
@Param(value = "unitid", required = false) String unitid,
@Param(value = "unionid", required = false) String unionid,
PageForm page, @Param(value = "jdhid", required = false) String jdhid) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.loginname,
u.username,
db.dbunitname as unitname,
db.dbfghname as unionname,
r.`name` as rolename
FROM
jdh_db db
LEFT JOIN sys_user u ON u.id = db.dbid
left join sys_role r on r.id = db.roleid
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("db.dbtid", "=", dbtid);
cnd.and("db.jdhid", "=", jdhid);
cnd.desc("db.roleid");
cnd.asc("db.dbunitid");
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%");
}
if (Strings.isNotBlank(unitid)) {
cnd.and("db.dbunitid", "=", unitid);
}
if (Strings.isNotBlank(unionid)) {
cnd.and("db.dbfghid", "=", unionid);
}
sql.setCondition(cnd);
return sysUserRoleService.list(sql);
}
}
@@ -0,0 +1,496 @@
package io.v.nutz.zhgh.jdh.controller.zzjg;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysRoleService;
import org.apache.shiro.authz.annotation.Logical;
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.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 17:38
*/
@IocBean
@At("/platform/jdh/zzjg/dbt")
@Ok("json:full")
public class JdhDbtController {
@Inject
private SysRoleService sysRoleService;
@Inject
private BaseService baseService;
private static final String SYS_DICT_DBT_ID = "9373a8db35ca428f9b24d7ceac96a550";
private static final String SYS_FGH_ZX_ROLE_ID = "9c1f19e385914fef82bc35da7c9ded36";
private static final String JDH_DBT_CZY_ROLE_ID = "0af36fa65ee742deb46a1fb1ded268ff";
private static final String JDH_DBT_TZ_ROLE_ID = "c1765c03459840c2b621d140f575c869";
private static final String JDH_DBT_FTZ_ROLE_ID = "6445f21685c5489aa212a986cfbeecce";
@At("")
@Ok("re")
@RequiresPermissions("sys.jdh.zzjg.dtb")
public String index() {
return "beetl:/platform/jdh/zzjg/dbt.html";
}
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object queryKyDbtMc(String jdhid) {
try {
if (Strings.isNotBlank(jdhid)) {
Sql sql = Sqls.create("""
SELECT
dict.id,
dict.`name`
FROM
sys_dict dict
WHERE
dict.`parentId` = @dbtid
AND dict.`name` NOT IN ( SELECT dbt.dbtname FROM jdh_dbt dbt WHERE dbt.`jdhid` = @jdhid )\s
ORDER BY
`code`
""");
sql.setParam("dbtid", SYS_DICT_DBT_ID);
sql.setParam("jdhid", jdhid);
List list = baseService.list(sql);
return Result.success().addData(list);
}
return Result.error();
} catch (Exception e) {
return Result.error();
}
}
@At
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object doDelete(String id) {
try {
baseService.clear("jdh_dbt", Cnd.where("id", "=", id));
//删除组成基层工会
baseService.clear("jdh_dbt_zcfgh", Cnd.where("dbtid", "=", id));
//删除团长 副团长 操作员的权限
baseService.clear("sys_user_role", Cnd.where("dbtid", "=", id).and("roleid", "in", "'c1765c03459840c2b621d140f575c869','6445f21685c5489aa212a986cfbeecce','0af36fa65ee742deb46a1fb1ded268ff'"));
//删除正式代表权限
baseService.clear("sys_user_role", Cnd.where("dbtid", "=", id).and("roleid", "=", "1427083503b74aa0885d104419b33170"));
//删除jdh_db 表用户
baseService.clear("jdh_db", Cnd.where("dbtid", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object doAdd(Jdh_dbt dbt, @Param("dbtname[]") String[] dbtname) {
try {
for (int i = 0; i < dbtname.length; i++) {
dbt.setId(R.UU32());
dbt.setDbtname(dbtname[i]);
dbt.setCjsj(DateUtil.getDate());
baseService.insert("jdh_dbt", Chain.from(dbt));
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions(value = {"sys.jdh.zzjg.dtb", "jdh.cxtj.sjzl"}, logical = Logical.OR)
public Object pageData(String union_id, Integer pageSize, Integer pageNumber, String jdhid, String dbtid) {
try {
Sql sql = Sqls.create("""
SELECT
dbt.*,
jdh.jdhallname,
jdh.jdhkqsj,
dict.`code` dictcode
FROM
jdh_dbt dbt
LEFT JOIN jdh_dbt_zcfgh jdz ON jdz.dbtid = dbt.id
AND jdz.jdhid = dbt.jdhid
LEFT JOIN jdh_jdhxx jdh ON dbt.`jdhid` = dbt.jdhid
LEFT JOIN sys_dict dict ON dict.`name` = dbt.dbtname $condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("jdh.jdhkqzt", "=", 1).and("dbt.jdhid", "=", jdhid);
if (Strings.isNotBlank(union_id)) {
cnd.and("jdz.fghid", "=", union_id);
}
if (Strings.isNotBlank(dbtid)) {
cnd.and("dbt.id", "=", dbtid);
}
cnd.groupBy("dbt.id");
cnd.asc("dictcode");
sql.setCondition(cnd);
Pagination pagination = baseService.listPage(pageNumber, pageSize, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 查询当前教代会还没有被代表团设置的基层工会
*
* @param jdhid
* @return
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object queryNoSetFgh(String jdhid) {
try {
Sql sql = Sqls.create("""
SELECT
un.id,
un.unionname
FROM
sys_union un
WHERE
un.id NOT IN ( SELECT fghid FROM jdh_dbt_zcfgh dz WHERE dz.jdhid = @jdhid )
""");
sql.setParam("jdhid", jdhid);
List list = baseService.list(sql);
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 代表团操作员默认为基层工会的主席
*
* @param id 代表团id
* @param jdhid 教代会id
* @param fghid 基层工会id
* @return
*/
@At
public Object fghdoAdd(String id, String jdhid, String fghid) {
try {
Chain add = Chain.make("id", R.UU32()).add("dbtid", id).add("fghid", fghid).add("jdhid", jdhid);
baseService.insert("jdh_dbt_zcfgh", add);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 查询该代表团下的组成基层工会
*
* @param id 代表团id
* @return
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object getDbtFghData(String id) {
try {
Sql sql = Sqls.create("""
SELECT
zc.*,
un.unionname
FROM
jdh_dbt_zcfgh zc
LEFT JOIN sys_union un ON un.id = zc.fghid
WHERE
zc.dbtid = @dbtid
""");
sql.setParam("dbtid", id);
List list = baseService.list(sql);
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 删除组成基层工会
*
* @param id
* @return
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object fghdoDelete(String id) {
try {
baseService.clear("jdh_dbt_zcfgh", Cnd.where("id", "=", id));
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 查询代表团组成基层工会下的所有人 查询可以被设置为操作员的用户
*
* @param dbtid
* @return
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object getReadyCzyList(String dbtid, String keyword) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.id = dw.unionid
WHERE
gh.id IN ( SELECT fghid FROM jdh_dbt_zcfgh WHERE dbtid = @dbtid )
AND ( u.username LIKE @keyword OR u.loginname LIKE @keyword )
AND u.id NOT IN ( SELECT userid FROM sys_user_role WHERE dbtid = @dbtid AND roleid = @roleid)
""");
sql.setParam("dbtid", dbtid);
sql.setParam("keyword", "%" + keyword + "%");
sql.setParam("roleid", JDH_DBT_CZY_ROLE_ID);
Pagination pagination = baseService.listPage(1, 10, sql);
return Result.success().addData(pagination);
} catch (Exception e) {
e.printStackTrace();
return Result.success();
}
}
/**
* 设置操作员
*
* @param userid
* @param dbtid
* @return
* @Param jdhid
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object czydoAdd(String userid, String dbtid, String jdhid) {
try {
Chain add = Chain.make("userid", userid).add("roleid", JDH_DBT_CZY_ROLE_ID).add("dbtid", dbtid).add("jdhid", jdhid);
baseService.insert("sys_user_role", add);
sysRoleService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 获取操作员数据
*
* @param dbtid
* @return
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object getCzyTableData(String dbtid) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.mobile,
u.sex,
dw.name as dwname
FROM
sys_user u
LEFT JOIN sys_unit dw ON dw.id = u.unitid
LEFT JOIN sys_union gh ON gh.id = dw.unionid
WHERE
u.id IN ( SELECT userid FROM sys_user_role WHERE dbtid = @dbtid AND roleid = @roleid )
""");
sql.setParam("dbtid", dbtid).setParam("roleid", JDH_DBT_CZY_ROLE_ID);
List list = baseService.list(sql);
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 删除操作员
*
* @param userid
* @param dbtid
* @return
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object czydoDelete(String userid, String dbtid) {
try {
baseService.clear("sys_user_role", Cnd.where("userid", "=", userid)
.and("dbtid", "=", dbtid).and("roleid", "=", JDH_DBT_CZY_ROLE_ID));
sysRoleService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
/**
* 查询该代表团下的没有被设为团长副团长的代表
*
* @param id
* @return
*/
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object queryUser(String id) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.mobile,
u.sex,
dw.NAME AS dwname
FROM
sys_user_role ur
LEFT JOIN sys_user u ON u.id = ur.userid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
WHERE
ur.roleid = '1427083503b74aa0885d104419b33170'
AND ur.dbtid = @dbtid
AND ur.userid NOT IN
( SELECT userid FROM sys_user_role
WHERE roleid IN ( '6445f21685c5489aa212a986cfbeecce', 'c1765c03459840c2b621d140f575c869' )
AND dbtid = @dbtid )
""");
sql.setParam("dbtid", id);
List list = baseService.list(sql);
return Result.success().addData(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object doAddTz(String id, String jdhid, String userid, Integer num) {
try {
if (num == 2) {
int count = baseService.count("sys_user_role", Cnd.where("jdhid", "=", jdhid)
.and("dbtid", "=", id).and("roleid", "=", JDH_DBT_TZ_ROLE_ID));
if (count > 0) {
return Result.error().addMsg("团长只能设置一位!");
}
}
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(userid);
userRole.setJdhid(jdhid);
userRole.setDbtid(id);
userRole.setRoleId(num == 1 ? JDH_DBT_FTZ_ROLE_ID : JDH_DBT_TZ_ROLE_ID);
baseService.insert("sys_user_role", Chain.from(userRole));
sysRoleService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object getTzList(String id) {
try {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.mobile,
u.sex,
r.id as roleid,
r.name as rolename,
dw.NAME AS dwname
FROM
sys_user_role ur
LEFT JOIN sys_role r ON r.id = ur.roleid
LEFT JOIN sys_user u ON u.id = ur.userid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
WHERE
ur.dbtid = @dbtid
AND ur.roleid IN ( @TZROLEID, @FTZROLEID )
""");
sql.setParam("dbtid", id);
sql.setParam("TZROLEID", JDH_DBT_TZ_ROLE_ID);
sql.setParam("FTZROLEID", JDH_DBT_FTZ_ROLE_ID);
List list = baseService.list(sql);
return Result.success(list);
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.jdh.zzjg.dtb")
public Object delUser(String userid, String dbtid, String jdhid, String roleid) {
try {
Cnd cnd = Cnd.where("userid", "=", userid)
.and("dbtid", "=", dbtid)
.and("jdhid", "=", jdhid)
.and("roleid", "=", roleid);
baseService.clear("sys_user_role", cnd);
sysRoleService.clearCache();
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,421 @@
package io.v.nutz.zhgh.jdh.controller.zzjg;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.constants.MechanismRolesEnum;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_jgcy;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_jgsz;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.AsyncService;
import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUserRoleService;
import io.v.nutz.sys.services.SysUserService;
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.Criteria;
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;
import java.util.ArrayList;
import java.util.List;
import static io.v.nutz.base.utils.Roles.SYS_DICT_WYH_PARENT_ID;
/**
* @author zhf
* @date 2021/2/21 11:10
* @description 机构设置
*/
@IocBean
@At("/platform/jdh/zzjg/mechanism")
@RequiresAuthentication
@Ok("json:full")
public class MechanismController {
@Inject
private AsyncService asyncService;
@Inject("Jdh_jgsz")
private ViService<Jdh_jgsz> jgszViService;
@Inject("Jdh_db")
private ViService<Jdh_db> jdhDbViService;
@Inject("Jdh_jgcy")
private ViService<Jdh_jgcy> jgcyViService;
@Inject
private SysUserRoleService sysUserRoleService;
@Inject
private SysRoleService sysRoleService;
@Inject
private SysDictService sysDictService;
@Inject
private SysUserService sysUserService;
@At("")
@Ok("beetl:/platform/jdh/zzjg/mechanism.html")
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object pageData(@Param(value = "parentId",required = false) String parentId, PageForm pageForm,
@Param(value = "jdhid",required = false) String jdhid) {
Sql sql = Sqls.create("""
SELECT jgsz.*,jdh.jdhallname FROM `jdh_jgsz` jgsz LEFT JOIN jdh_jdhxx jdh ON jdh.id=jgsz.jdhid $condition
""");
CndPlus cnd = CndPlus.create();
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.desc("jgsz.mechanismcode");
cnd.andEx("parentId", "=", StrUtil.isBlank(parentId) ? "5972c34ff68e4b0cbc6d0834fe88982b" : parentId);
/* cnd.andEx("jgsz.jdhid", "=", jdhid);*/
sql.setCondition(cnd);
return jgszViService.list(pageForm, sql);
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object doAdd(Jdh_jgsz jdh_jgsz) {
if (jgszViService.count(Cnd.where("mechanismcode", "=", jdh_jgsz.getMechanismcode())) > 0) {
return Result.error("机构代码已存在");
}
jgszViService.update(Chain.make("hasChildren", true), Cnd.where("id", "=", jdh_jgsz.getParentId()));
jgszViService.insert(jdh_jgsz);
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object doEdit(Jdh_jgsz jdh_jgsz) {
jgszViService.updateIgnoreNull(jdh_jgsz);
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object doDelete(String id) {
jgszViService.delete(id);
jgcyViService.clear(Cnd.where("jgid", "=", id));
return null;
}
private List<Jdh_jgsz> child(String parentId) {
List<Jdh_jgsz> jgsz = jgszViService.query(Cnd.where("parentId", "=", parentId).desc("mechanismcode"));
asyncService.exe2(jgsz, jdhJgsz -> {
jdhJgsz.setChild(child(jdhJgsz.getId()));
});
return jgsz;
}
/**
* 查询机构设置表有几个机构
*
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object getJgszTreeData() {
List list = new ArrayList();
Jdh_jgsz jdhJgsz = jgszViService.fetch(Cnd.where("parentId", "=", "0").asc("mechanismcode"));
if (jdhJgsz != null) {
jdhJgsz.setChild(child(jdhJgsz.getId()));
list.add(jdhJgsz);
return Result.success().addData(list);
}
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object cyPageData(@Param(value = "jgid",required = false) String jgid,
@Param(value = "jdhid",required = false) String jdhid, PageForm pageForm) {
Sql sql = Sqls.create("""
SELECT
cy.*,
us.username ,
us.mobile,
us.unitname,
us.unitcode,
us.sex,
us.loginname,
user.jobtitle,
jdh.jdhallname
FROM
jdh_jgcy cy
LEFT JOIN jdh_jdhxx jdh ON jdh.id=cy.jdhid
LEFT JOIN sys_user user ON user.id = cy.userid
LEFT JOIN `user` us ON us.id = cy.userid $condition
""");
CndPlus cnd = CndPlus.create();
cnd.andEx("cy.jgid", "=", jgid);
cnd.andEx("cy.jdhid", "=", jdhid);
cnd.desc("cy.sf");
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and(pageForm.getSearchName(), "LIKE", "%" + pageForm.getSearchKeyword() + "%");
}
sql.setCondition(cnd);
return jgcyViService.list(pageForm, sql);
}
/**
* 添加成员
*
* @param jdhid
* @param jgid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object cydoAdd(String userid, String jdhid, String jgid, Integer sf) {
Jdh_jgcy jdhJgcy = new Jdh_jgcy();
jdhJgcy.setUserid(userid);
jdhJgcy.setJdhid(jdhid);
jdhJgcy.setJgid(jgid);
jdhJgcy.setSf(sf);
jgcyViService.insert(jdhJgcy);
/* if (Lang.list(Roles.WYH_ZR, WYH_FZR).contains(getRoleId(sf,jgid))) {
Chain wyChain = Chain.make("userid", userid).add("roleid", Roles.JDH_TA_WXY_WY_ROLE_ID).add("jdhid", jdhid).add("jgid", jgid);
sysUserRoleService.insert("sys_user_role", wyChain);
}
sysRoleService.clearCache();*/
Sys_user_role user_role = new Sys_user_role();
user_role.setRoleId(getRoleId(sf, jgid));
user_role.setUserId(userid);
user_role.setJdhid(jdhid);
user_role.setJgid(jgid);
sysUserRoleService.insert(user_role);
sysUserService.clearCache();
sysRoleService.clearCache();
return null;
}
/**
* 删除人员
*
* @param userid
* @param id
* @param sf
* @param jgid
* @param jdhid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object doDeleteCy(String userid, String id, Integer sf, String jgid, String jdhid) {
Jdh_jgsz jdhJgsz = jgszViService.fetch(Cnd.where("id", "=", jgid));
//如果传过来的是提案工作委员会
/* if (jdhJgsz.getMcid() != null && jdhJgsz.getMcid().equals(SYS_DICT_TA_WYH_ID)) {
sysUserRoleService.clear(Cnd.where("userid", "=", userid)
.and("roleid", "=", getRoleId(sf)).and("jdhid", "=", jdhid).and("jgid", "=", jgid));
if (Lang.list(Roles.WYH_ZR, WYH_FZR).contains(getRoleId(sf))) {
Cnd wyCnd = Cnd.where("userid", "=", userid)
.and("roleid", "=", Roles.JDH_TA_WXY_WY_ROLE_ID).and("jdhid", "=", jdhid).and("jgid", "=", jgid);
sysUserRoleService.clear("sys_user_role", wyCnd);
}
}
if (jgid.equals(JDHZXWYH)) {
Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", Roles.JDHZXWYH01)
.and("jdhid", "=", jdhid);
sysUserRoleService.clear(surCnd);
}*/
Cnd cnd = Cnd.where("userid", "=", userid)
.and("roleid", "=", getRoleId(sf, jgid)).and("jdhid", "=", jdhid).and("jgid", "=", jgid);
sysUserRoleService.clear(cnd);
jgcyViService.delete(id);
sysUserService.clearCache();
sysRoleService.clearCache();
return null;
}
private String getRoleId(Integer sf, String jgid) {
MechanismRolesEnum byId = MechanismRolesEnum.getById(jgid);
if (sf == 1) {
return byId.getCommitteeRoleId();
} else if (sf == 2) {
return byId.getViceDirectorRoleId();
} else if (sf == 3) {
return byId.getDirectorRoleId();
} else {
return null;
}
}
/**
* 查询字典表专门委员会
*
* @param
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object queryKyWyhMc() {
Sql sql = Sqls.create("""
SELECT
id,
`name`,
`code`
FROM
sys_dict
WHERE
parentid = @WYHDICTID
AND `name` NOT IN (
SELECT
`name`
FROM
jdh_jgsz
)
""");
sql.setParam("WYHDICTID", SYS_DICT_WYH_PARENT_ID);
List list = sysDictService.list(sql);
return Result.success().addData(list);
}
/**
* 设置主任副主任
*
* @param userid
* @param jgid
* @param sf
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object updateSf(String jdhid, String userid, String jgid, Integer sf) {
Jdh_jgsz jdhJgsz = jgszViService.fetch(Cnd.where("id", "=", jgid));
Jdh_jgcy jgcy = jgcyViService.fetch(Cnd.where("jgid", "=", jgid).and("userid", "=", userid).and("jdhid", "=", jdhid));
//如果传过来的机构id是提案工作委员会
/* if (jdhJgsz.getMcid() != null && jdhJgsz.getMcid().equals(SYS_DICT_TA_WYH_ID)) {
Chain surChain = Chain.make("roleid", getRoleId(sf));
if (getRoleId(sf).equals(Roles.JDH_TA_WXY_WY_ROLE_ID)) {
Cnd wyCnd = Cnd.where("userid", "=", userid)
.and("roleid", "in", Lang.list(Roles.WYH_ZR, WYH_FZR)).and("jdhid", "=", jdhid).and("jgid", "=", jgid);
sysUserRoleService.clear("sys_user_role", wyCnd);
}
Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf()))
.and("jdhid", "=", jdhid);
sysUserRoleService.update(surChain, surCnd);
if (Lang.list(Roles.WYH_ZR, WYH_FZR).contains(getRoleId(sf))) {
Cnd wyCnd = Cnd.where("userid", "=", userid)
.and("roleid", "=", Roles.JDH_TA_WXY_WY_ROLE_ID).and("jdhid", "=", jdhid).and("jgid", "=", jgid);
sysUserRoleService.clear("sys_user_role", wyCnd);
Chain wyChain = Chain.make("userid", userid).add("roleid", Roles.JDH_TA_WXY_WY_ROLE_ID).add("jdhid", jdhid).add("jgid", jgid);
sysUserRoleService.insert("sys_user_role", wyChain);
} else {
Cnd wyCnd = Cnd.where("userid", "=", userid)
.and("roleid", "in", Lang.list(Roles.WYH_ZR, WYH_FZR)).and("jdhid", "=", jdhid).and("jgid", "=", jgid);
sysUserRoleService.clear("sys_user_role", wyCnd);
}
}*/
Chain surChain = Chain.make("roleid", getRoleId(sf, jgid));
Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", getRoleId(jgcy.getSf(), jgid))
.and("jdhid", "=", jdhid);
sysUserRoleService.update(surChain, surCnd);
/* Cnd surCnd = Cnd.where("userid", "=", userid).and("roleid", "=", Roles.JDHZXWYH01)
.and("jdhid", "=", jdhid);
sysUserRoleService.clear(surCnd);
*/
Chain cyChain = Chain.make("sf", sf);
jgcyViService.update(cyChain, Cnd.where("userid", "=", userid)
.and("jgid", "=", jgid));
sysUserService.clearCache();
sysRoleService.clearCache();
return Result.success();
}
/**
* 查询当前教代会的代表
*
* @param jdhid
* @param jgid
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.jdh.zzjg.mechanism")
public Object queryUser(String jdhid, String jgid, String query) {
Sql sql = Sqls.create("""
SELECT
us.id userid,
us.mobile,
us.username,
us.loginname,
us.unitname AS dwname,
us.unionname
FROM
`user` us
WHERE
$condition
and us.id NOT IN ( SELECT userid FROM jdh_jgcy WHERE jdhid = @jdhid and jgid=@jgid) GROUP BY us.loginname
limit 50
""");
sql.setParam("jdhid", jdhid);
sql.setParam("jgid", jgid);
Criteria criteria = Cnd.cri();
criteria.where().setTop(false);
// criteria.where().and("us.member", "=", 1);
criteria.where().and(Cnd.exps(Cnd.likeEX("username", query.trim())).or(Cnd.likeEX("loginname", query.trim())));
if (!criteria.where().isEmpty()) {
sql.vars().set("condition", criteria.toSql(null));
}
return sysUserService.list(sql);
}
}
@@ -0,0 +1,57 @@
package io.v.nutz.zhgh.jdh.model.cb;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 8:44
*/
@Table("jdh_cbwj")
@Data
public class Jdh_cbwj implements Serializable {
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userid;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String username;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
private String time;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
private String zlname;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String zllx;
@Column
@ColDefine(type = ColType.INT, width = 1)
private boolean ispass;
@Column
@Comment("附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
}
@@ -0,0 +1,120 @@
package io.v.nutz.zhgh.jdh.model.cb;
import org.nutz.dao.entity.annotation.*;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/17 15:40
*/
@Table("jdh_jdhxx")
public class Jdh_jdhxx {
private static final long serialVersionUID = 1L;
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("教代会年份")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhnf;
@Column
@Comment("教代会届数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhjs;
@Column
@Comment("教代会次数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhcs;
@Column
@Comment("教代会全称")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String jdhallname;
@Column
@Comment("教代会开启时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String jdhkqsj;
@Column
@Comment("教代会描述")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String jdhms;
@Column
@Comment("教代会开启状态")
@ColDefine(type = ColType.INT, width = 1)
private boolean jdhkqzt;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getJdhnf() {
return jdhnf;
}
public void setJdhnf(String jdhnf) {
this.jdhnf = jdhnf;
}
public String getJdhjs() {
return jdhjs;
}
public void setJdhjs(String jdhjs) {
this.jdhjs = jdhjs;
}
public String getJdhcs() {
return jdhcs;
}
public void setJdhcs(String jdhcs) {
this.jdhcs = jdhcs;
}
public String getJdhkqsj() {
return jdhkqsj;
}
public void setJdhkqsj(String jdhkqsj) {
this.jdhkqsj = jdhkqsj;
}
public String getJdhms() {
return jdhms;
}
public void setJdhms(String jdhms) {
this.jdhms = jdhms;
}
public boolean isJdhkqzt() {
return jdhkqzt;
}
public void setJdhkqzt(boolean jdhkqzt) {
this.jdhkqzt = jdhkqzt;
}
public String getJdhallname() {
return jdhallname;
}
public void setJdhallname(String jdhallname) {
this.jdhallname = jdhallname;
}
}
@@ -0,0 +1,90 @@
package io.v.nutz.zhgh.jdh.model.cb;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
@Table("jdh_mefp")
public class Jdh_mefp implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("对应教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("基层工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fghid;
@Column
@Comment("代表团id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbtid;
@Column
@Comment("名额分配数")
@ColDefine(type = ColType.INT, width = 4)
private int fps;
@Column
@Comment("不占指标数")
@ColDefine(type = ColType.INT, width = 4)
private int bzzbs;
public String getJdhid() {
return jdhid;
}
public void setJdhid(String jdhid) {
this.jdhid = jdhid;
}
public String getFghid() {
return fghid;
}
public void setFghid(String fghid) {
this.fghid = fghid;
}
public int getFps() {
return fps;
}
public void setFps(int fps) {
this.fps = fps;
}
public int getBzzbs() {
return bzzbs;
}
public void setBzzbs(int bzzbs) {
this.bzzbs = bzzbs;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDbtid() {
return dbtid;
}
public void setDbtid(String dbtid) {
this.dbtid = dbtid;
}
}
@@ -0,0 +1,105 @@
package io.v.nutz.zhgh.jdh.model.db;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;
import java.io.Serializable;
import java.util.List;
@Table("jdh_db")
@Data
public class Jdh_db implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("代表用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbid;
@Column
@Comment("所属教代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("代表单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbunitid;
@Column
@Comment("代表单位名称")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String dbunitname;
@Column
@Comment("代表基层工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbfghid;
@Column
@Comment("代表基层工会名称")
@J4EIgnore
@ColDefine(type = ColType.VARCHAR, width = 50)
private String dbfghname;
@Column
@Comment("所属角色ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String roleid;
@Column
@Comment("近几年奖惩情况")
@ColDefine(type = ColType.TEXT)
private String rewards;
@Column
@Comment("代表状态:1待校工会确认 2正式代表")
@ColDefine(type = ColType.INT, width = 1)
private Integer dbzt;
@Column
@Comment("是否是通过预选代表选上来的")
@ColDefine(type = ColType.BOOLEAN)
private boolean sfyx;
@Column
@Comment("所属代表团 当用户为校领导是该字段不为空")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbtid;
@Column
@Comment("附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
@Column
@Comment("政治面貌")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String political;
@Column
@Comment("学历")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String education;
@Column
@Comment("职称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String jobTitle;
@Column
@Comment("职务")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String position;
}
@@ -0,0 +1,136 @@
package io.v.nutz.zhgh.jdh.model.db;
import cn.afterturn.easypoi.excel.annotation.Excel;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/9/8 17:33
*/
public class Jdh_db_Excel {
@Excel(name = "工号")
private String loginname;
@Excel(name = "姓名")
private String username;
@Excel(name = "代表类型")
private String role;
private String userid;
private String dbtname;
private String dwid;
private String dwname;
private String ghid;
private String unionname;
private String dbtid;
private String info;
private Boolean isok;
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDbtname() {
return dbtname;
}
public void setDbtname(String dbtname) {
this.dbtname = dbtname;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getDwname() {
return dwname;
}
public void setDwname(String dwname) {
this.dwname = dwname;
}
public Boolean getIsok() {
return isok;
}
public void setIsok(Boolean isok) {
this.isok = isok;
}
public String getDwid() {
return dwid;
}
public void setDwid(String dwid) {
this.dwid = dwid;
}
public String getGhid() {
return ghid;
}
public void setGhid(String ghid) {
this.ghid = ghid;
}
public String getUnionname() {
return unionname;
}
public void setUnionname(String unionname) {
this.unionname = unionname;
}
public String getDbtid() {
return dbtid;
}
public void setDbtid(String dbtid) {
this.dbtid = dbtid;
}
}
@@ -0,0 +1,135 @@
package io.v.nutz.zhgh.jdh.model.db;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;
import java.io.Serializable;
/**
* 特邀列席代表
*/
@Table("Jdh_lxty_db")
public class Jdh_lxty_db implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("代表用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbid;
@Column
@Comment("所属教代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("代表单位ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbunitid;
@Column
@Comment("代表单位名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String dbunitname;
@Column
@Comment("代表基层工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbfghid;
@Column
@Comment("代表基层工会名称")
@J4EIgnore
@ColDefine(type = ColType.VARCHAR, width = 50)
private String dbfghname;
@Column
@Comment("所属角色ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String roleid;
@Column
@Comment("所属代表团")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbtid;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDbid() {
return dbid;
}
public void setDbid(String dbid) {
this.dbid = dbid;
}
public String getJdhid() {
return jdhid;
}
public void setJdhid(String jdhid) {
this.jdhid = jdhid;
}
public String getDbunitid() {
return dbunitid;
}
public void setDbunitid(String dbunitid) {
this.dbunitid = dbunitid;
}
public String getDbunitname() {
return dbunitname;
}
public void setDbunitname(String dbunitname) {
this.dbunitname = dbunitname;
}
public String getDbfghid() {
return dbfghid;
}
public void setDbfghid(String dbfghid) {
this.dbfghid = dbfghid;
}
public String getDbfghname() {
return dbfghname;
}
public void setDbfghname(String dbfghname) {
this.dbfghname = dbfghname;
}
public String getRoleid() {
return roleid;
}
public void setRoleid(String roleid) {
this.roleid = roleid;
}
public String getDbtid() {
return dbtid;
}
public void setDbtid(String dbtid) {
this.dbtid = dbtid;
}
}
@@ -0,0 +1,107 @@
package io.v.nutz.zhgh.jdh.model.db;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
@Data
@Table
public class TeacherMeetDelegate {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("代表用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("所属教代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String teacherMeetId;
@Column
@Comment("所属代表团 当用户为校领导是该字段不为空")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String delegationId;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String userName;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String loginName;
@Column
@Comment("性别")
@ColDefine(type = ColType.VARCHAR, width = 2)
private String sex;
@Column
@Comment("民族")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String nation;
@Column
@Comment("政治面貌")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String politicalOutlook;
@Column
@Comment("学历")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String education;
@Column
@Comment("技术职称===>jobTitle")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String technicalTitle;
@Column
@Comment("行政职称===>position")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String administrativeTitle;
@Column
@Comment("年龄")
@ColDefine(type = ColType.INT)
private Integer age;
@Column
@Comment("是否双肩挑")
@ColDefine(type = ColType.BOOLEAN)
private Boolean twoWork;
@Column
@Comment("流程审核状态")
@ColDefine(type = ColType.INT)
private Integer stateCode;
@Column
@Comment("教代会代表类型")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String roleId;
@Column
@Comment("教代会")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isJdh;
@Column
@Comment("工代会")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isGdh;
@Column
@Comment("工代会")
@ColDefine(type = ColType.VARCHAR,width = 20)
private String bz;
}
@@ -0,0 +1,70 @@
package io.v.nutz.zhgh.jdh.model.gzzl;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 9:16
*/
@Table("jdh_gzzllx")
public class Jdh_gzzllx implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("类型编码")
@ColDefine(type = ColType.VARCHAR, width = 80)
private String code;
@Column
@Comment("工作资料类型名称")
@ColDefine(type = ColType.VARCHAR, width = 80)
private String lxname;
@Column
@Comment("序号")
@ColDefine(type = ColType.INT, width = 1)
private Integer xh;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLxname() {
return lxname;
}
public void setLxname(String lxname) {
this.lxname = lxname;
}
public Integer getXh() {
return xh;
}
public void setXh(Integer xh) {
this.xh = xh;
}
}
@@ -0,0 +1,154 @@
package io.v.nutz.zhgh.jdh.model.hyjhd;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
@Table("jdh_hyhd")
public class Jdh_hyhd implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("发布人id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userid;
@Column
@Comment("类型(1:会议/2:活动)")
@ColDefine(type = ColType.INT, width = 1)
private Integer lx;
@Column
@Comment("名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String name;
//老王逼我的 不要限制。。。
@Column
@Comment("经费预算")
@ColDefine(type = ColType.TEXT)
private String jfys;
@Column
@Comment("所属教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("开始时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String kssj;
@Column
@Comment("结束时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String jssj;
@Column
@Comment("场地")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String cd;
@Column
@Comment("内容")
@ColDefine(type = ColType.VARCHAR,width = 500)
private String nr;
@Column
@Comment("纪要")
@ColDefine(type = ColType.VARCHAR,width = 500)
private String jy;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public Integer getLx() {
return lx;
}
public void setLx(Integer lx) {
this.lx = lx;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getJfys() {
return jfys;
}
public void setJfys(String jfys) {
this.jfys = jfys;
}
public String getJdhid() {
return jdhid;
}
public void setJdhid(String jdhid) {
this.jdhid = jdhid;
}
public String getKssj() {
return kssj;
}
public void setKssj(String kssj) {
this.kssj = kssj;
}
public String getJssj() {
return jssj;
}
public void setJssj(String jssj) {
this.jssj = jssj;
}
public String getCd() {
return cd;
}
public void setCd(String cd) {
this.cd = cd;
}
public String getNr() {
return nr;
}
public void setNr(String nr) {
this.nr = nr;
}
public String getJy() {
return jy;
}
public void setJy(String jy) {
this.jy = jy;
}
}
@@ -0,0 +1,67 @@
package io.v.nutz.zhgh.jdh.model.two;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 8:44
*/
@Table("jdh2_gzzl")
@Data
public class Jdh2_gzzl implements Serializable {
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userid;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String username;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
private String time;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
private String zlname;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
private String zllx;
@Column
@ColDefine(type = ColType.INT, width = 1)
private boolean ispass;
@Column
@Comment("0待审核,1审核拒绝,2审核通过")
@ColDefine(type = ColType.INT, width = 10)
private Integer state;
@Column
@Comment("附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
@Column
@Comment("来源id(因为这个记录可能是通过会议请示或者会议批复同步过来的)")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fromid;
}
@@ -0,0 +1,70 @@
package io.v.nutz.zhgh.jdh.model.two;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 9:16
*/
@Table("jdh2_gzzllx")
public class Jdh2_gzzllx implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("类型编码")
@ColDefine(type = ColType.VARCHAR, width = 80)
private String code;
@Column
@Comment("工作资料类型名称")
@ColDefine(type = ColType.VARCHAR, width = 80)
private String lxname;
@Column
@Comment("序号")
@ColDefine(type = ColType.INT, width = 1)
private Integer xh;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLxname() {
return lxname;
}
public void setLxname(String lxname) {
this.lxname = lxname;
}
public Integer getXh() {
return xh;
}
public void setXh(Integer xh) {
this.xh = xh;
}
}
@@ -0,0 +1,167 @@
package io.v.nutz.zhgh.jdh.model.two;
import cn.wizzer.framework.base.model.BaseModel;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.util.List;
/**
* @author: Aaron
* @create: 2021-01-19 17:25
* @description: 二级教代会信息
**/
@Data
@Table("jdh_level2")
public class JdhLevel2 extends BaseModel {
@Column
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("会议名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String meeting_name;
@Column
@Comment("所属单位")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unit_id;
@Column
@Comment("所属工会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_id;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String create_time;
@Column
@Comment("创建人ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String founder;
@Column
@Comment("届次")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String session_id;
@Column
@Comment("会议时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String meeting_time;
@Column
@Comment("上一次会议时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String before_meeting_time;
@Column
@Comment("正式代表人数")
@ColDefine(type = ColType.INT, width = 4)
private Integer official_delegate;
@Column
@Comment("教师代表人数")
@ColDefine(type = ColType.INT, width = 4)
private Integer teacher_delegate;
@Column
@Comment("列席代表人数")
@ColDefine(type = ColType.INT, width = 4)
private Integer attend_delegate;
@Column
@Comment("特邀代表人数")
@ColDefine(type = ColType.INT, width = 4)
private Integer special_delegate;
@Column
@Comment("会议议题")
@ColDefine(type = ColType.TEXT)
private String meeting_topic;
@Column
@Comment("有无选举事项")
@ColDefine(type = ColType.BOOLEAN)
private Boolean have_elect;
@Column
@Comment("备注")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String remark;
@Column
@Comment("文件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
@Column
@Comment("审核状态")
@ColDefine(type = ColType.INT, width = 3)
private Integer audit_state;
@Column
@Comment("院级党委审核人")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String party_committee_id;
@Column
@Comment("院级党委审核时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String party_committee_time;
@Column
@Comment("院级党委审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String party_committee_opinion;
@Column
@Comment("校工会审核人")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String school_union_id;
@Column
@Comment("校工会审核时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String school_union_time;
@Column
@Comment("校工会审核意见")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String school_union_opinion;
/*2022-07-11新增字段*/
@Column
@Comment("校工会审核附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> school_files;
@Column
@Comment("教代会届数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhjs;
@Column
@Comment("教代会次数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhcs;
@Column
@Comment("教代会全称")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String jdhallname;
@Column
@Comment("类型")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String type;
}
@@ -0,0 +1,41 @@
package io.v.nutz.zhgh.jdh.model.two;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* 二级教代会代表
*/
@Table("jdh_db2")
@Data
public class Jdh_db2 implements Serializable {
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("代表用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userid;
@Column
@Comment("所属教代会ID(关联二级教代会申请表)")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("代表分工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionid;
@Column
@Comment("所属角色ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String roleid;
}
@@ -0,0 +1,60 @@
package io.v.nutz.zhgh.jdh.model.two;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/24 8:47
*/
@Data
@Table("jdh_jdh2_hyjl")
public class Jdh_jdh2_hyjl implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("会议id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String hyid;
@Column
@Comment("会议时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String hysj;
@Column
@Comment("会议地点")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String hydd;
@Column
@Comment("主持人")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String zcrname;
@Column
@Comment("记录人")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String jlrname;
@Column
@Comment("参加人员")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String cjry;
@Column
@Comment("会议内容")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String hynr;
}
@@ -0,0 +1,64 @@
package io.v.nutz.zhgh.jdh.model.two;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/17 15:40
*/
@Data
@Table("jdh_jdhxx2")
public class Jdh_jdhxx2 {
private static final long serialVersionUID = 1L;
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("教代会年份")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhnf;
@Column
@Comment("教代会届数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhjs;
@Column
@Comment("教代会次数")
@ColDefine(type = ColType.VARCHAR, width = 8)
private String jdhcs;
@Column
@Comment("教代会全称")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String jdhallname;
@Column
@Comment("教代会描述")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String jdhms;
@Column
@Comment("教代会开启状态")
@ColDefine(type = ColType.INT, width = 1)
private boolean jdhkqzt;
@Column
@Comment("教代会创建时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String jdhcjsj;
@Column
@Comment("所属分工会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionid;
}
@@ -0,0 +1,81 @@
package io.v.nutz.zhgh.jdh.model.two;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/24 8:42
*/
@Table("jdh_jdh2")
@Data
public class Jdh_jdj2 implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String id;
@Column
@Comment("会议名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String hyname;
@Column
@Comment("所属分工会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fghid;
@Column
@Comment("填表人")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String tbrname;
@Column
@Comment("会议时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String hysj;
@Column
@Comment("会议届")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String session;
@Column
@Comment("会议次")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String second;
@Column
@Comment("会议地点")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String hydd;
@Column
@Comment("指导思想")
@ColDefine(type = ColType.TEXT)
private String zdsx;
@Column
@Comment("会议议题")
@ColDefine(type = ColType.TEXT)
private String hyyt;
@Column
@Comment("会议进程")
@ColDefine(type = ColType.TEXT)
private String hyjc;
@Column
@Comment("审核状态")
@ColDefine(type = ColType.INT, width = 2)
private Integer shzt;
}
@@ -0,0 +1,58 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.util.List;
/**
* @Author JyuHsin
* @Date 2023/5/5
* @Description
*/
@Data
@Table("jdh_group")
public class JdhGroup {
@Column
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("小组名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String groupName;
@Column
@Comment("所属教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhId;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String createTime;
@Column
@Comment("小组编码")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String code;
@Column
@Comment("工作人员")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String workUser;
@Column
@Comment("讨论地点")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String talkAddress;
@Column
@Comment("校领导")
@ColDefine(type = ColType.VARCHAR, width = 200)
private List<String> schoolLeaderList;
}
@@ -0,0 +1,36 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
/**
* @Author JyuHsin
* @Date 2023/5/6
* @Description
*/
@Data
@Table("jdh_group_dbt")
public class JdhGroupAndDbt {
@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 groupId;
@Column
@Comment("代表团id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbtId;
@Column
@Comment("所属教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhId;
}
@@ -0,0 +1,40 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
@Data
@Table("jdh_dbt")
public class Jdh_dbt implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("代表团名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String dbtname;
@Column
@Comment("所属教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String cjsj;
@Column
@Comment("代表团编码")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String code;
}
@@ -0,0 +1,37 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
/**
* @ClassName Jdh_dbt_zcdw
* @Description TODO
* @Author zhf
* @Date 2023/8/1 11:33
*/
@Table
@Data
public class Jdh_dbt_zcdw {
@Name
@Comment("id")
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("代表团id")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String dbtid;
@Column
@Comment("单位id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dwid;
@Column
@Comment("所属教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
}
@@ -0,0 +1,65 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
@Table("jdh_dbt_zcfgh")
public class Jdh_dbt_zcfgh implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("代表团id")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String dbtid;
@Column
@Comment("基层工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fghid;
@Column
@Comment("所属教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDbtid() {
return dbtid;
}
public void setDbtid(String dbtid) {
this.dbtid = dbtid;
}
public String getFghid() {
return fghid;
}
public void setFghid(String fghid) {
this.fghid = fghid;
}
public String getJdhid() {
return jdhid;
}
public void setJdhid(String jdhid) {
this.jdhid = jdhid;
}
}
@@ -0,0 +1,46 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
/**
* @author zhf
* @date 2021/2/22 10:14
* @description 教代会机构成员
*/
@Data
@Table("jdh_jgcy")
public class Jdh_jgcy extends BaseModel implements Serializable {
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("组员对应的用户id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userid;
@Column
@Comment("组员对应的教代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("组员对应的机构id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jgid;
@Column
@Comment("组员身份(1:组员,2:副组长,3:组长)")
@ColDefine(type = ColType.INT, width = 1)
private int sf;
}
@@ -0,0 +1,73 @@
package io.v.nutz.zhgh.jdh.model.zzjg;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
import java.util.List;
/**
* @author zhf
* @date 2021/2/21 11:32
* @description 教代会机构设置
*/
@Data
@Table("jdh_jgsz")
public class Jdh_jgsz extends BaseModel implements Serializable {
@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 parentId;
@Column
@Comment("委员会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String mcid;
@Column
@Comment("机构名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String name;
@Column
@Comment("机构别名")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String mechanismName;
@Column
@Comment("机构编码")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String mechanismcode;
@Column
@Comment("所属教代会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String jdhid;
@Column
@Comment("有子节点")
private boolean hasChildren;
@Column
@Comment("排序字段")
@Prev({
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM jdh_jgsz"),
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM jdh_jgsz")
})
private Integer location;
private List<Jdh_jgsz> child;
}
@@ -0,0 +1,34 @@
package io.v.nutz.zhgh.jdh.services;
import cn.wizzer.framework.base.service.BaseService;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.model.two.JdhLevel2;
import io.v.nutz.base.query.PageForm;
/**
* @author: Aaron
* @create: 2021-01-21 08:45
* @description:
**/
public interface MeetingLevelTwoService extends BaseService<JdhLevel2> {
/**
* 初始化表格
*
* @param cnd
* @param page
* @return
*/
Pagination pageData(CndPlus cnd, PageForm page, String unionId, String unitId);
/**
* 撤回
*
* @param id:
* @return java.lang.Object
* @author JyuHsin
* @date 2022/7/12
*/
Object callback(String id);
}
@@ -0,0 +1,101 @@
package io.v.nutz.zhgh.jdh.services.impl;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.utils.FileService;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.zhgh.jdh.model.two.JdhLevel2;
import io.v.nutz.zhgh.jdh.services.MeetingLevelTwoService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_file;
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.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.ArrayList;
import java.util.List;
/**
* @author: Aaron
* @create: 2021-01-21 08:46
* @description:
**/
@IocBean(args = {"refer:dao"})
public class MeetingLevelTwoServiceImpl extends BaseServiceImpl<JdhLevel2> implements MeetingLevelTwoService {
public MeetingLevelTwoServiceImpl(Dao dao) {
super(dao);
}
@Inject
private FileService fileService;
@Override
public Pagination pageData(CndPlus cnd, PageForm page, String unionId, String unitId) {
Sql sql = Sqls.create("""
SELECT
jdh2.*,
s.color,
s.`name` state_name,
fo.username,
party.username party_name,
school.username school_name,
un.`name` unit_name,
uni.unionname union_name
FROM
jdh_level2 jdh2
LEFT JOIN jdh_level2_state s ON s.id = jdh2.audit_state
LEFT JOIN sys_user fo ON fo.id = jdh2.founder
LEFT JOIN sys_user party ON party.id = jdh2.party_committee_id
LEFT JOIN sys_user school ON school.id = jdh2.school_union_id
LEFT JOIN sys_unit un ON un.id = jdh2.unit_id
LEFT JOIN sys_union uni ON uni.id = un.unionid $condition
""");
if (StrUtil.isNotBlank(page.getSearchName()) && StrUtil.isNotBlank(page.getSearchKeyword())) {
cnd.and(Cnd.likeEX(page.getSearchName(), page.getSearchKeyword()));
}
cnd.andEx("un.id", "=", unitId);
cnd.andEx("uni.id", "=", unionId);
cnd.asc("jdh2.audit_state").desc("jdh2.create_time");
sql.setCondition(cnd);
return listPage(page.getPageNumber(), page.getPageSize(), sql);
}
@Override
public Object callback(String id) {
JdhLevel2 jdhLevel2 = dao().fetch(JdhLevel2.class, id);
//找到小于当前状态的第一个审核节点
List<Record> auditPoints = dao().query("jdh_level2_state",
Cnd.NEW().and("id", "<", jdhLevel2.getAudit_state()).and("type", "=", "0").orderBy("id", "desc"));
if (auditPoints == null || auditPoints.size() == 0) {
return Result.error("没有可退回的状态!");
}
jdhLevel2.setAudit_state(auditPoints.get(0).getInt("id"));
jdhLevel2.setSchool_union_id("");
jdhLevel2.setSchool_union_time("");
jdhLevel2.setSchool_union_opinion("");
jdhLevel2.setSchool_files(new ArrayList<>());
dao().updateIgnoreNull(jdhLevel2);
//删除批复附件
dao().clear("jdh2_gzzl", Cnd.NEW().and("fromid", "=", id));
//删除文件
List<Sys_file> files = jdhLevel2.getFiles();
for (Sys_file file : files) {
fileService.delete(file.getId(), file.getFilepath());
}
return Result.success("撤回成功");
}
}
@@ -0,0 +1,35 @@
package io.v.nutz.zhgh.jdh.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* 代表excel导入
*/
@Data
public class TeacherDelegateExcelImportVo {
@Excel(name = "序号")
private String no;
@Excel(name = "姓名")
private String userName;
@Excel(name = "工号")
private String loginName;
@Excel(name = "所在代表团")
private String delegationName;
@Excel(name = "所在单位")
private String unitName;
@Excel(name = "所在分工会")
private String unionName;
@Excel(name = "代表身份")
private String roleName;
@Excel(name = "错误信息")
private String errors;
}