diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeFormalPushController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeFormalPushController.java new file mode 100644 index 00000000..9dce55a3 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeFormalPushController.java @@ -0,0 +1,179 @@ +package com.budwk.app.zhgh.democratic.executiveCommittee.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.budwk.app.base.annotation.SLog; +import com.budwk.app.base.constant.RoleConstant; +import com.budwk.app.base.param.PageForm; +import com.budwk.app.base.result.Result; +import com.budwk.app.base.service.BaseService; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeTwoPush; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +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.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; + +/** + * @author zhf + * @date 2026/3/20 10:51 + * @description 正式委员录入 + */ +@IocBean +@At("/platform/executiveCommittee/formalPush") +@Ok("json:full") +@Slf4j +@Api(tags = "执委会推选-正式委员录入") +public class ExecutiveCommitteeFormalPushController { + + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + + @At("/index") + @SaCheckPermission("executiveCommittee.formalPush") + @Ok("beetl:/platform/zhgh/democratic/executiveCommittee/formalPush/index.html") + public void index() { + } + + + @At + @ApiOperation("分页查询") + @SaCheckPermission("executiveCommittee.formalPush") + public Result pageData(PageForm pageForm, + String teacherMeetId, + String delegationId, + String unionId, + String roleCode) { + Sql sql = Sqls.create(""" + SELECT + t1.*, + t2.loginName, + t2.userName, + t3.name AS unitName, + t4.name unionName, + t5.sex, + TIMESTAMPDIFF( + YEAR, + t5.birthday, + CURDATE()) AS age, + t6.name AS delegationName + FROM + `executive_committee_two_push` t1 + LEFT JOIN executive_committee_one_push t2 on t2.userId=t1.userId and t2.teacherMeetId=t1.teacherMeetId + LEFT JOIN sys_unit t3 ON t2.unitId = t3.id + LEFT JOIN `sys_union` t4 ON t4.id = t3.unionid + LEFT JOIN `vw_user` t5 ON t5.id = t1.userId + LEFT JOIN teacher_congress_delegation t6 ON t6.id = t2.delegationId + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("t1.teacherMeetId", "=", teacherMeetId); + cnd.andEX("t2.delegationId", "=", delegationId); + cnd.andEX("t1.roleCode", "=", roleCode); + cnd.andEX("t1.isFormal", "=", true); + if (StpUtil.hasRole(RoleConstant.SYSADMIN.name()) || + StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()) || + StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { + cnd.andEX("t4.id", "=", unionId); + } else { + cnd.andEX("t4.id", "=", SecurityUtil.getUnionId()); + } + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("t2.userName", pageForm.getSearchKeyword()); + group.orLike("t2.loginName", pageForm.getSearchKeyword()); + cnd.and(group); + } + cnd.asc("t6.code").asc("t2.firstLetter"); + sql.setCondition(cnd); + return Result.success(baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql)); + } + + + @At + @SaCheckPermission("executiveCommittee.formalPush") + @ApiOperation("查询可以推选委员和已经推选的人员") + public Result getDelegationUser(String teacherMeetId) { + List twoPushList = dao.query(ExecutiveCommitteeTwoPush.class, + Cnd.where("teacherMeetId", "=", teacherMeetId).and(ExecutiveCommitteeTwoPush::getRoleCode, "is not", null)); + + List userValue = twoPushList.stream().filter(ExecutiveCommitteeTwoPush::getIsFormal).toList(); + List userIds = userValue.stream().map(ExecutiveCommitteeTwoPush::getUserId).toList(); + Sql sql = Sqls.create(""" + SELECT + t2.id userId, + t2.username userName, + t2.loginname loginName, + t2.unitName, + t2.sex, + t2.professionalTitle, + t2.professionalLevel, + t1.roleCode, + TIMESTAMPDIFF( + YEAR, + t2.birthday, + CURDATE()) age + FROM + executive_committee_two_push t1 + LEFT JOIN `vw_user` t2 ON t1.userId = t2.id + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.andEX("t1.teacherMeetId", "=", teacherMeetId); + cnd.andEX("t1.userId", "not in", userIds); + sql.setCondition(cnd); + List userData = baseService.listMap(sql); + return Result.success(Map.of("userData", userData, "userValue", userValue)); + } + + @At + @SaCheckPermission("executiveCommittee.formalPush") + @SLog(tag = "执委会推选-正式委员录入", msg = "推选委员") + public Result addOnePush(@Param("userValue") String[] userValue, + String teacherMeetId) { + try { + if (ObjectUtil.isEmpty(userValue)) { + return Result.error("请选择要录入的委员!"); + } + if (ObjectUtil.isEmpty(teacherMeetId)) { + return Result.error("请选择教代会!"); + } + List twoPushList = dao.query(ExecutiveCommitteeTwoPush.class, Cnd.where(ExecutiveCommitteeTwoPush::getTeacherMeetId, "=", teacherMeetId).and(ExecutiveCommitteeTwoPush::getUserId, "in", userValue)); + List ids = twoPushList.stream().map(ExecutiveCommitteeTwoPush::getId).toList(); + dao.update(ExecutiveCommitteeTwoPush.class, Chain.make("isFormal", true), Cnd.where("id", "in", ids)); + return Result.success("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + return Result.error("添加失败!"); + } + } + + @At + @SaCheckPermission("executiveCommittee.formalPush") + @SLog(tag = "执委会推选-正式委员录入", msg = "删除推选的人") + public Result doDelete(@Valid String id, @Valid String teacherMeetId) { + dao.update(ExecutiveCommitteeTwoPush.class, Chain.make("isFormal", false), Cnd.where("id", "=", id)); + return Result.success("删除成功!"); + } + +} diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/formalPush/index.html b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/formalPush/index.html new file mode 100644 index 00000000..6f7a7dc4 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/formalPush/index.html @@ -0,0 +1,223 @@ + + +
+ + + + + +
+ + + + + diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/formalPush/pushFormalDialog.js b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/formalPush/pushFormalDialog.js new file mode 100644 index 00000000..3320ea1f --- /dev/null +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/formalPush/pushFormalDialog.js @@ -0,0 +1,95 @@ +const PUSH_FORMAL_DIALOG = { + template: /*language=HTML*/ ` +
+ + +
+
+
{{ option.userName }} - {{ option.loginName }} - + {{option.unitName}} +
+
+ + {{option.sex}} + + {{ option.age }}岁 + {{ option.professionalTitle }} + {{ option.roleCode==='1'?'执委会委员':option.roleCode==='2'?'工会委员会委员':'经审委员会委员' }} +
+
+
+
+ + + 取 消 + 确 定 + + +
+
+ `, + data() { + return { + dialogVisible: false, + userValue: [], + userData: [], + rightChecked: [], + attendanceRightChecked: [], + teacherMeetId: null, + prepareGroupQuotaCount: 0 + } + }, + methods: { + async onOpen(teacherMeetId) { + this.dialogVisible = true + this.teacherMeetId = teacherMeetId + this.userValue = [] + this.userData = [] + const { + code, + data + } = await this.$axios.post('/platform/executiveCommittee/formalPush/getDelegationUser', {teacherMeetId: teacherMeetId}) + if (code === 0) { + data.userData.forEach(v => { + this.userData.push({userId: v.userId, ...v}) + }) + this.prepareGroupQuotaCount = data.prepareGroupQuotaCount + } + }, + filterMethod(query, item) { + return item.userName.indexOf(query) > -1 + }, + async onConfirm() { + const { + code, + msg + } = await this.$axios.post('/platform/executiveCommittee/formalPush/addOnePush', { + userValue: JSON.stringify(this.userValue), + teacherMeetId: this.teacherMeetId + }) + if (code === 0) { + this.dialogVisible = false + this.$message.success(msg) + this.$emit('refresh') + } + } + }, + +} diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/preparatoryGroupPush/pushFormalDialog.js b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/preparatoryGroupPush/pushFormalDialog.js index b56060ac..2987fc63 100644 --- a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/preparatoryGroupPush/pushFormalDialog.js +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/preparatoryGroupPush/pushFormalDialog.js @@ -31,12 +31,12 @@ const PUSH_FORMAL_DIALOG = { {{ option.age }}岁 {{ option.professionalTitle }} - {{ option.roleCode==='1'?'执委会委员':option.roleCode==='2'?'工会委员会委员':'经审委员会委员' }} + 推选名额:{{prepareGroupQuotaCount}}个 取 消 确 定