diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java index 7b27f06c..c6664a01 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeConfigController.java @@ -68,6 +68,20 @@ public class ExecutiveCommitteeConfigController { """).setParam("sessionId",sessionId); List listMap = committeeConfigService.listMap(sql); config.setUnionQuotaList(listMap); + Sql sql2 = Sqls.create(""" + SELECT + dbt.id as delegationId, + dbt.name as delegationName, + dbt.code as delegationCode, + (SELECT count(1) FROM teacher_congress_delegate WHERE delegationId =dbt.id) AS dbCount, + 0 as quotaCount + FROM + teacher_congress_delegation dbt + WHERE dbt.sessionId = @sessionId + ORDER BY CODE ASC + """).setParam("sessionId", sessionId); + List listMap2 = committeeConfigService.listMap(sql2); + config.setDelegationQuotaList(listMap2); } return Result.success(config); } diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java index 369dfcc6..9d67f241 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeDelegationOnePushController.java @@ -15,6 +15,7 @@ import com.budwk.app.base.service.BaseService; import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig; import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeOnePush; +import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -40,13 +41,13 @@ import java.util.stream.Collectors; /** * @author zhf * @date 2025/8/25 15:18 - * @description 分工会一次推选 + * @description 团长一次推选 */ @IocBean @At("/platform/executiveCommittee/delegationOnePush") @Ok("json:full") @Slf4j -@Api(tags = "执委会推选-分工会主席一次推选") +@Api(tags = "执委会推选-团长一次推选") public class ExecutiveCommitteeDelegationOnePushController { @Inject @@ -60,9 +61,8 @@ public class ExecutiveCommitteeDelegationOnePushController { public void index() { } - @At - @ApiOperation("查询某个分工会的一次推选的委员") + @ApiOperation("查询某个代表团的团长一次推选的委员") @SaCheckPermission("executiveCommittee.delegationOnePush") public Result pageData(PageForm pageForm, String teacherMeetId, @@ -91,13 +91,19 @@ public class ExecutiveCommitteeDelegationOnePushController { Cnd cnd = Cnd.NEW(); cnd.andEX("t1.teacherMeetId", "=", teacherMeetId); if (StpUtil.hasRole(RoleConstant.SYSADMIN.name()) || - StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()) || - StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { - cnd.andEX("t3.id", "=", unionId); + StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name())) { + cnd.andEX("t1.delegationId", "=", delegationId); }else{ - cnd.andEX("t3.id", "=", SecurityUtil.getUnionId()); + Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class, + Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId) + .and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId())); + if (ObjectUtil.isEmpty(db)) { + return Result.error("没有权限,只有代表团团长才能推选"); + } + cnd.andEX("t1.delegationId", "=", db.getDelegationId()); } - cnd.andEX("t1.delegationId", "=", delegationId); + + cnd.andEX("t3.id", "=", unionId); cnd.andEX("t1.addType", "=", 1); if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { SqlExpressionGroup group = new SqlExpressionGroup(); @@ -115,10 +121,11 @@ public class ExecutiveCommitteeDelegationOnePushController { @ApiOperation("查询可以推选委员和已经推选的人员") @SaCheckPermission("executiveCommittee.delegationOnePush") public Result getDelegationUser(String teacherMeetId) { - if (!(StpUtil.hasRole(RoleConstant.SYSADMIN.name()) || - StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()) || - StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()))) { - return Result.error("没有权限,只有分工会主席才能推选"); + Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class, + Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId) + .and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId())); + if (ObjectUtil.isEmpty(db)) { + return Result.error("没有权限,只有代表团团长才能推选"); } ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.where(ExecutiveCommitteeConfig::getTeacherMeetId, "=", teacherMeetId)); @@ -137,6 +144,11 @@ public class ExecutiveCommitteeDelegationOnePushController { List onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW()); List userIds = onePushList.stream().map(v -> v.getUserId()).collect(Collectors.toList()); + Cnd cnd = Cnd.NEW(); + cnd.andEX("db.sessionId", "=", teacherMeetId); + cnd.andEX("db.userId", "not in", userIds); + cnd.andEX("db.userId", "!=", SecurityUtil.getUserId()); + cnd.and("db.delegationId", "=", db.getDelegationId()); Sql sql = Sqls.create(""" SELECT db.*, @@ -148,33 +160,29 @@ public class ExecutiveCommitteeDelegationOnePushController { LEFT JOIN `vw_user` u ON db.userId = u.id $condition """); - Cnd cnd = Cnd.NEW(); - cnd.andEX("db.sessionId", "=", teacherMeetId); - cnd.andEX("db.userId", "not in", userIds); - cnd.andEX("db.userId", "!=", SecurityUtil.getUserId()); - cnd.and("db.unionId", "=", SecurityUtil.getUnionId()); sql.setCondition(cnd); List userData = baseService.listMap(sql); - List unionQuotaList = config.getUnionQuotaList(); - NutMap unionQuota = unionQuotaList.stream().filter(v -> v.get("unionId").equals(SecurityUtil.getUnionId())).findFirst().orElse(null); - if (Lang.isNotEmpty(unionQuota)) { - return Result.success(Map.of("userData", userData, "userValue", userValue, "quotaCount", unionQuota.getInt("quotaCount"))); + List delegationQuotaList = config.getDelegationQuotaList(); + NutMap delegationQuota = delegationQuotaList.stream().filter(v -> v.get("delegationId").equals(db.getDelegationId())).findFirst().orElse(null); + if (Lang.isNotEmpty(delegationQuota)) { + return Result.success(Map.of("userData", userData, "userValue", userValue, "quotaCount", delegationQuota.getInt("quotaCount"))); } return Result.success(Map.of("userData", userData, "userValue", userValue, "quotaCount", 0)); } @At @SaCheckPermission("executiveCommittee.delegationOnePush") - @SLog(tag = "执委会推选-分工会主席推选委员", msg = "推选委员") + @SLog(tag = "执委会推选-团长推选委员", msg = "推选委员") public Result addOnePush(@Param("userValue") String[] userValue, String teacherMeetId) { try { - if (!(StpUtil.hasRole(RoleConstant.SYSADMIN.name()) || - StpUtil.hasRole(RoleConstant.SCHOOL_UNION_ADMIN.name()) || - StpUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name()))) { - return Result.error("没有权限,只有分工会主席才能推选"); + Teacher_congress_delegate db = dao.fetch(Teacher_congress_delegate.class, + Cnd.where(Teacher_congress_delegate::getSessionId, "=", teacherMeetId) + .and(Teacher_congress_delegate::getUserId, "=", SecurityUtil.getUserId())); + if (ObjectUtil.isEmpty(db)) { + return Result.error("没有权限,只有代表团团长才能推选"); } ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, @@ -188,20 +196,19 @@ public class ExecutiveCommitteeDelegationOnePushController { if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) { return Result.error("一次预选已结束"); } - List unionQuotaList = config.getUnionQuotaList(); + List delegationQuotaList = config.getDelegationQuotaList(); - NutMap unionQuota = unionQuotaList.stream().filter(v -> v.getString("unionId").equals(SecurityUtil.getUnionId())).findFirst().orElse(null); - if (ObjectUtil.isEmpty(unionQuota)) { - return Result.error("请先配置分工会人数"); + NutMap delegationQuota = delegationQuotaList.stream().filter(v -> v.getString("delegationId").equals(db.getDelegationId())).findFirst().orElse(null); + if (ObjectUtil.isEmpty(delegationQuota)) { + return Result.error("请先配置代表团人数"); } int dbCount = dao.count(ExecutiveCommitteeOnePush.class, - Cnd.where("unionId", "=", SecurityUtil.getUnionId()) + Cnd.where("delegationId", "=", db.getDelegationId()) .and("teacherMeetId", "=", teacherMeetId) .and("addType", "=", 1)); - assert unionQuota != null; - if (dbCount + userValue.length > unionQuota.getInt("quotaCount")) { - return Result.error("推选人数限制" + unionQuota.getInt("quotaCount") + "人"); + if (dbCount + userValue.length > delegationQuota.getInt("quotaCount")) { + return Result.error("推选人数限制" + delegationQuota.getInt("quotaCount") + "人"); } Sql sql = Sqls.create(""" SELECT @@ -229,7 +236,6 @@ public class ExecutiveCommitteeDelegationOnePushController { onePush.setUserName(jdhDb.getString("userName")); onePush.setLoginName(jdhDb.getString("loginName")); onePush.setDelegationId(jdhDb.getString("delegationId")); - onePush.setUnionId(jdhDb.getString("unionId")); onePush.setUnitId(jdhDb.getString("unitId")); onePush.setTeacherMeetId(teacherMeetId); String firstLetter = String.valueOf(getFirstLetter(jdhDb.getString("userName"))); @@ -247,7 +253,7 @@ public class ExecutiveCommitteeDelegationOnePushController { @At @SaCheckPermission("executiveCommittee.delegationOnePush") - @SLog(tag = "执委会推选-分工会主席推选委员", msg = "删除推选的人") + @SLog(tag = "执委会推选-团长推选委员", msg = "删除推选的人") public Result doDelete(@Valid String id, @Valid String teacherMeetId) { ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, Cnd.where("teacherMeetId", "=", teacherMeetId)); diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteePushDwSjAuditController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteePushDwSjAuditController.java new file mode 100644 index 00000000..b63bae36 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteePushDwSjAuditController.java @@ -0,0 +1,197 @@ +package com.budwk.app.zhgh.democratic.executiveCommittee.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.lang.Validator; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.pinyin.PinyinUtil; +import com.budwk.app.base.constant.RoleConstant; +import com.budwk.app.base.page.Pagination; +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.base.utils.PageUtil; +import com.budwk.app.flow.engine.FlowEngine; +import com.budwk.app.flow.enums.ProcessTaskStateEnum; +import com.budwk.app.flow.service.FlowCommonService; +import com.budwk.app.web.commons.auth.utils.AuthUtil; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeOnePush; +import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeUnionPushInfo; +import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.nutz.dao.Cnd; +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.json.Json; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author zhf + * @date 2026/3/13 16:09 + * @description 党委书记审核 + */ +@IocBean +@At("/platform/executiveCommittee/pushDwSjAudit") +@Ok("json:full") +@Slf4j +@Api(tags = "两委会委员推选-党委书记审查") +public class ExecutiveCommitteePushDwSjAuditController { + + + @Inject + private BaseService baseService; + + + @Inject + private FlowCommonService flowCommonService; + + @Inject + private FlowEngine flowEngine; + + + @At("") + @SaCheckPermission("executiveCommittee.pushDwSjAudit") + @Ok("beetl:/platform/zhgh/democratic/executiveCommittee/pushDwSjAudit/index.html") + public void index() { + } + + + @At + @ApiOperation("分页查询") + @SaCheckPermission("executiveCommittee.pushDwSjAudit") + public Result pageData(PageForm pageForm, + @Param(value = "teacherMeetId") String teacherMeetId, + @Param(value = "unionId") String unionId, + @Param(value = "approval") Boolean approval) { + + Sql sql = Sqls.create(""" + SELECT + info.*, + tcd.loginName, + tcd.userName, + tcd.age, + tcd.sex, + tcd.unitName, + tcd.unionName, + ion.`name` delegationName, + ins.id AS instanceId, + ins.businessNo, + ins.state instanceState, + ins.variable instanceVariable, + ins.processDefineId instanceProcessDefineId, + t.id taskId, + t.taskName AS taskKey, + t.displayName taskName, + t.taskType, + t.performType taskPerformType, + t.taskState, + t.finishTime, + t.taskParentId, + t.variable taskVariable, + IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName, + IF(rt.id IS NOT NULL, 1, 0) AS canRevoke + FROM + wf_process_task t + LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId + LEFT JOIN executive_committee_union_push_info info ON info.id = ins.businessNo + LEFT JOIN teacher_congress_delegate tcd on tcd.sessionId=@sessionId and tcd.userId=info.userId + LEFT JOIN teacher_congress_delegation ion on ion.id=tcd.delegationId + LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id + LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10 + LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10 + $condition + """).setParam("sessionId", teacherMeetId); + Cnd cnd = Cnd.NEW(); + cnd.and("t.taskName", "=", "4d57210e-076e-4446-a3b3-139397e4e6de"); + if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name())) { + cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId())); + } + cnd.andEX("info.teacherMeetId", "=", teacherMeetId); + cnd.andEX("info.unionId", "=", unionId); + if (approval) { + cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode())); + } else { + cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode()); + } + + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("info.userName", pageForm.getSearchKeyword()); + group.orLike("info.loginName", pageForm.getSearchKeyword()); + cnd.and(group); + } + + cnd.groupBy("t.id"); + if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { + cnd.desc("t.createdAt"); + } else { + cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); + } + sql.setCondition(cnd); + Pagination pageVO = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pageVO); + } + + + @At + @ApiOperation("提交") + @SaCheckPermission("executiveCommittee.pushDwSjAudit") + public Result executeTask(@Param("data") String data) { + Dict args = Json.fromJson(Dict.class, data); + flowCommonService.executeTask(args); + + List pushArrayList = new ArrayList<>(); + if (args.getInt("submitType") == 1) { + ExecutiveCommitteeUnionPushInfo pushInfo = baseService.dao().fetch(ExecutiveCommitteeUnionPushInfo.class, args.getStr("bizId")); + Teacher_congress_delegate delegate = baseService.dao().fetch(Teacher_congress_delegate.class, + Cnd.where(Teacher_congress_delegate::getUserId, "=", pushInfo.getUserId()) + .and(Teacher_congress_delegate::getSessionId, "=", pushInfo.getTeacherMeetId())); + + ExecutiveCommitteeOnePush onePush = new ExecutiveCommitteeOnePush(); + onePush.setUserId(pushInfo.getUserId()); + onePush.setTeacherMeetId(pushInfo.getTeacherMeetId()); + onePush.setUnionId(delegate.getUnionId()); + onePush.setUnitId(delegate.getUnitId()); + onePush.setDelegationId(delegate.getDelegationId()); + onePush.setUserName(delegate.getUserName()); + onePush.setLoginName(delegate.getLoginName()); + String firstLetter = String.valueOf(getFirstLetter(delegate.getUserName())); + onePush.setFirstLetter(firstLetter); + onePush.setAddType(3); + onePush.setPushDate(DateUtil.date()); + pushArrayList.add(onePush); + } + baseService.dao().insert(pushArrayList); + return Result.success(); + } + + + public static char getFirstLetter(String str) { + if (str == null || str.isEmpty()) { + throw new IllegalArgumentException("字符串不能为空"); + } + char firstChar = str.charAt(0); + if (Validator.isChinese(String.valueOf(firstChar))) { + return Character.toUpperCase(PinyinUtil.getPinyin(firstChar).charAt(0)); + } else if (Character.isLetter(firstChar)) { + return Character.toUpperCase(firstChar); + } else { + return firstChar; + } + } + + +} diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeUnionPushController.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeUnionPushController.java new file mode 100644 index 00000000..837a37f9 --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/controller/ExecutiveCommitteeUnionPushController.java @@ -0,0 +1,291 @@ +package com.budwk.app.zhgh.democratic.executiveCommittee.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Dict; +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.page.Pagination; +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.flow.constant.FlowConst; +import com.budwk.app.flow.engine.FlowEngine; +import com.budwk.app.flow.entity.ProcessInstance; +import com.budwk.app.flow.entity.ProcessTask; +import com.budwk.app.flow.enums.ProcessSubmitTypeEnum; +import com.budwk.app.web.commons.auth.utils.AuthUtil; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeConfig; +import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeOnePush; +import com.budwk.app.zhgh.democratic.executiveCommittee.models.ExecutiveCommitteeUnionPushInfo; +import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.dao.Sqls; +import org.nutz.dao.sql.Sql; +import org.nutz.dao.util.cri.SqlExpressionGroup; +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.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author zhf + * @date 2026/3/13 11:32 + * @description 分工会推选 + */ +@IocBean +@At("/platform/executiveCommittee/unionPush") +@Ok("json:full") +@Slf4j +@Api(tags = "两委会委员推选-分工会推选") +public class ExecutiveCommitteeUnionPushController { + + + @Inject + private Dao dao; + @Inject + private BaseService baseService; + + + @Inject + private FlowEngine flowEngine; + + @At("") + @SaCheckPermission("executiveCommittee.unionPush") + @Ok("beetl:/platform/zhgh/democratic/executiveCommittee/unionPush/index.html") + public void index() { + } + + + @At + @ApiOperation("分页查询") + @SaCheckPermission("executiveCommittee.unionPush") + public Result pageData(PageForm pageForm, + @Param(value = "teacherMeetId") String teacherMeetId, + @Param(value = "unionId") String unionId) { + Sql sql = Sqls.create(""" + SELECT + info.*, + tcd.loginName, + tcd.userName, + tcd.age, + tcd.sex, + tcd.unitName, + tcd.unionName, + ion.`name` delegationName, + ins.id AS instanceId, + ins.businessNo, + ins.state instanceState, + ins.variable instanceVariable, + ins.processDefineId instanceProcessDefineId, + t.id taskId, + t.taskName AS taskKey, + t.displayName taskName, + t.taskType, + t.performType taskPerformType, + t.taskState, + t.finishTime, + t.taskParentId, + t.variable taskVariable, + IFNULL(GROUP_CONCAT(DISTINCT t.displayName),'结束') curTaskName, + IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke, + (select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask') AS startTaskId + FROM + executive_committee_union_push_info info + LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id + LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10 + LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id + LEFT JOIN teacher_congress_delegate tcd on tcd.sessionId=@sessionId and tcd.userId=info.userId + LEFT JOIN teacher_congress_delegation ion on ion.id=tcd.delegationId + $condition + """).setParam("sessionId", teacherMeetId); + Cnd cnd = Cnd.NEW(); + cnd.andEX("info.teacherMeetId", "=", teacherMeetId); + cnd.andEX("info.unionId", "=", unionId); + + if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("info.userName", pageForm.getSearchKeyword()); + group.orLike("info.loginName", pageForm.getSearchKeyword()); + cnd.and(group); + } + cnd.desc("info.createdAt"); + if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { + if (AuthUtil.hasRole(RoleConstant.UNIT_PARTY_SECRETARY.name())) { + cnd.andEX("info.unionId", "=", SecurityUtil.getUnionId()); + } else { + cnd.and("info.createdBy", "=", SecurityUtil.getUserId()); + } + + } + cnd.groupBy("info.id"); + sql.setCondition(cnd); + Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); + return Result.success(pagination); + } + + + @At + @ApiOperation("查询可以推选委员和已经推选的人员") + @SaCheckPermission("executiveCommittee.unionPush") + public Result getUnionUser(String teacherMeetId) { + + ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, + Cnd.where(ExecutiveCommitteeConfig::getTeacherMeetId, "=", teacherMeetId)); + if (ObjectUtil.isEmpty(config)) { + return Result.error("请先配置基础信息"); + } + if (config.getFirstStartTime().getTime() > System.currentTimeMillis()) { + return Result.error("请等待一次预选开始时间"); + } + if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) { + return Result.error("一次预选已结束"); + } + List userValue = dao.query(ExecutiveCommitteeOnePush.class, + Cnd.where("teacherMeetId", "=", teacherMeetId)); + List onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW()); + List userIds = onePushList.stream().map(v -> v.getUserId()).collect(Collectors.toList()); + + + List pushInfoList = dao.query(ExecutiveCommitteeUnionPushInfo.class, Cnd.where(ExecutiveCommitteeUnionPushInfo::getTeacherMeetId, "=", teacherMeetId)); + List unionPushUserIds = pushInfoList.stream().map(v -> v.getUserId()).toList(); + + + Cnd cnd = Cnd.NEW(); + cnd.andEX("db.sessionId", "=", teacherMeetId); + cnd.andEX("db.userId", "not in", userIds); + cnd.andEX("db.userId", "not in", unionPushUserIds); + cnd.andEX("db.userId", "!=", SecurityUtil.getUserId()); + cnd.and("u.unionId", "=", SecurityUtil.getUnionId()); + Sql sql = Sqls.create(""" + SELECT + db.*, + u.professionalTitle, + u.professionalLevel, + TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) AS age + FROM + teacher_congress_delegate db + LEFT JOIN `vw_user` u ON db.userId = u.id + $condition + """); + sql.setCondition(cnd); + List userData = baseService.listMap(sql); + + + List unionQuotaList = config.getUnionQuotaList(); + NutMap unionQuota = unionQuotaList.stream().filter(v -> v.getString("unionId").equals(SecurityUtil.getUnionId())).findFirst().orElse(null); + if (Lang.isNotEmpty(unionQuota)) { + return Result.success(Map.of("userData", userData, "userValue", userValue, "quotaCount", unionQuota.getInt("quotaCount"))); + } + return Result.success(Map.of("userData", userData, "userValue", userValue, "quotaCount", 0)); + } + + + @At + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission("executiveCommittee.unionPush") + @SLog(tag = "执委会推选-分工会推选委员", msg = "推选委员") + public Result addPush(@Param("userValue") String[] userValue, + String teacherMeetId) { + + + ExecutiveCommitteeConfig config = dao.fetch(ExecutiveCommitteeConfig.class, + Cnd.where("teacherMeetId", "=", teacherMeetId)); + if (ObjectUtil.isEmpty(config)) { + return Result.error("请先配置基础信息"); + } + if (config.getFirstStartTime().getTime() > System.currentTimeMillis()) { + return Result.error("请等待一次预选开始时间"); + } + if (config.getFirstEndTime().getTime() < System.currentTimeMillis()) { + return Result.error("一次预选已结束"); + } + List unionQuotaList = config.getUnionQuotaList(); + + NutMap unionQuota = unionQuotaList.stream().filter(v -> v.getString("unionId").equals(SecurityUtil.getUnionId())).findFirst().orElse(null); + if (ObjectUtil.isEmpty(unionQuota)) { + return Result.error("请先配置分工会人数"); + } + + int dbCount = dao.count(ExecutiveCommitteeUnionPushInfo.class, + Cnd.where(ExecutiveCommitteeUnionPushInfo::getUnionId, "=", SecurityUtil.getUnionId()) + .and(ExecutiveCommitteeUnionPushInfo::getTeacherMeetId, "=", teacherMeetId)); + if (dbCount + userValue.length > unionQuota.getInt("quotaCount")) { + return Result.error("推选人数限制" + unionQuota.getInt("quotaCount") + "人"); + } + Sql sql = Sqls.create(""" + SELECT + t1.* + FROM + teacher_congress_delegate t1 + $condition + """); + Cnd cnd = Cnd.NEW(); + cnd.and("t1.sessionId", "=", teacherMeetId); + cnd.andEX("t1.userId", "in", userValue); + sql.setCondition(cnd); + List dbList = baseService.listVO(sql, Teacher_congress_delegate.class); + + List list = new ArrayList<>(); + for (String id : userValue) { + Teacher_congress_delegate jdhDb = dbList.stream().filter(v -> v.getUserId().equals(id)).findFirst().orElse(null); + if (ObjectUtil.isEmpty(jdhDb)) { + return Result.error("请选择正确的代表!"); + } + + ExecutiveCommitteeUnionPushInfo pushInfo = new ExecutiveCommitteeUnionPushInfo(); + pushInfo.setPushDate(DateUtil.date()); + pushInfo.setUserId(jdhDb.getUserId()); + pushInfo.setUnionId(jdhDb.getUnionId()); + pushInfo.setUnitId(jdhDb.getUnitId()); + pushInfo.setTeacherMeetId(teacherMeetId); + list.add(pushInfo); + } + dao.insert(list); + + list.forEach(ExecutiveCommitteeUnionPushInfo -> { + // 开启流程实例 + Dict args = Dict.create(); + args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode()); + args.set(FlowConst.FORM_DATA, ExecutiveCommitteeUnionPushInfo); + ProcessInstance instance = flowEngine.startProcessInstanceByKey("LWHHY", ExecutiveCommitteeUnionPushInfo.getId(), SecurityUtil.getUserId(), args); + + // 自动完成第一个申请任务 + List doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null); + for (ProcessTask task : doingTaskList) { + args.put(FlowConst.NEXT_NODE_OPERATOR, ExecutiveCommitteeUnionPushInfo.getUserId()); + flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args); + } + }); + return Result.success(); + } + + @At + @ApiOperation("删除") + @SaCheckPermission("executiveCommittee.unionPush") + @SLog(tag = "删除推选代表", msg = "删除推选代表") + public Result doDelete(String id){ + baseService.dao().delete(ExecutiveCommitteeUnionPushInfo.class, id); + flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id); + return Result.success(); + } + + +} diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/models/ExecutiveCommitteeConfig.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/models/ExecutiveCommitteeConfig.java index 98306646..01e61572 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/models/ExecutiveCommitteeConfig.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/models/ExecutiveCommitteeConfig.java @@ -51,6 +51,11 @@ public class ExecutiveCommitteeConfig extends BaseModel implements Serializable @ColDefine(type = ColType.INT) private Integer unionQuotaCount; + @Column + @Comment("代表团推荐名额总数") + @ColDefine(type = ColType.INT) + private Integer delegationQuotaCount; + @Column @Comment("一次预选开始时间") @ColDefine(type = ColType.DATETIME) @@ -76,4 +81,9 @@ public class ExecutiveCommitteeConfig extends BaseModel implements Serializable @ColDefine(type = ColType.MYSQL_JSON) private List unionQuotaList; + @Column + @Comment("各代表团名额数") + @ColDefine(type = ColType.MYSQL_JSON) + private List delegationQuotaList; + } diff --git a/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/models/ExecutiveCommitteeUnionPushInfo.java b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/models/ExecutiveCommitteeUnionPushInfo.java new file mode 100644 index 00000000..d2fc014a --- /dev/null +++ b/src/main/java/com/budwk/app/zhgh/democratic/executiveCommittee/models/ExecutiveCommitteeUnionPushInfo.java @@ -0,0 +1,52 @@ +package com.budwk.app.zhgh.democratic.executiveCommittee.models; + +import cn.hutool.core.date.DateTime; +import com.budwk.app.base.model.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.nutz.dao.entity.annotation.*; +import org.nutz.dao.interceptor.annotation.PrevInsert; + +/** + * @author zhf + * @date 2026/3/13 14:32 + * @description 分工会推选记录表 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Table("executive_committee_union_push_info") +@TableMeta("{'mysql-charset':'utf8mb4'}") +@Comment("分工会推选记录表") +public class ExecutiveCommitteeUnionPushInfo extends BaseModel { + + @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 unionId; + + @Column + @Comment("单位ID") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String unitId; + + @Column + @Comment("推选时间") + @ColDefine(type = ColType.DATETIME) + private DateTime pushDate; +} diff --git a/src/main/resources/db/quartz/dm.sql b/src/main/resources/db/quartz/dm.sql index 723f6971..2529be7f 100644 --- a/src/main/resources/db/quartz/dm.sql +++ b/src/main/resources/db/quartz/dm.sql @@ -59,4 +59,4 @@ create index qz_ft_jg on sys_qrtz_fired_triggers(SCHED_NAME,JOB_GROUP) /*QUARTZ_52*/ create index qz_ft_t_g on sys_qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) /*QUARTZ_53*/ -create index qz_ft_tg on sys_qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP) \ No newline at end of file +create index qz_ft_tg on sys_qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP) diff --git a/src/main/resources/db/quartz/oracle.sql b/src/main/resources/db/quartz/oracle.sql index 723f6971..2529be7f 100644 --- a/src/main/resources/db/quartz/oracle.sql +++ b/src/main/resources/db/quartz/oracle.sql @@ -59,4 +59,4 @@ create index qz_ft_jg on sys_qrtz_fired_triggers(SCHED_NAME,JOB_GROUP) /*QUARTZ_52*/ create index qz_ft_t_g on sys_qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) /*QUARTZ_53*/ -create index qz_ft_tg on sys_qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP) \ No newline at end of file +create index qz_ft_tg on sys_qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP) diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/onePushFormalDialog.js b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/onePushFormalDialog.js index 7ea7e9eb..3c4c991b 100644 --- a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/onePushFormalDialog.js +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/delegationOnePush/onePushFormalDialog.js @@ -4,7 +4,7 @@ const DELEGATION_ONE_PUSH_FORMAL_DIALOG = { diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/executiveCommitteeConfig/index.html b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/executiveCommitteeConfig/index.html index 6f7e1c3c..b62d77e3 100644 --- a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/executiveCommitteeConfig/index.html +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/executiveCommitteeConfig/index.html @@ -3,8 +3,8 @@ layout("/layouts/platform.html"){ #-->
- - + + - - - - - - - - - - - - - - - - - - - - - - 提 交 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -
+ diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/unionPush/index.html b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/unionPush/index.html new file mode 100644 index 00000000..e3199c39 --- /dev/null +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/unionPush/index.html @@ -0,0 +1,196 @@ + + +
+ + + + + + + + + + + + + + + + + + + + 委员推选 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + diff --git a/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/unionPush/pushFormalDialog.js b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/unionPush/pushFormalDialog.js new file mode 100644 index 00000000..5b85ab3e --- /dev/null +++ b/src/main/resources/views/platform/zhgh/democratic/executiveCommittee/unionPush/pushFormalDialog.js @@ -0,0 +1,104 @@ +const UNION_PUSH_FORMAL_DIALOG = { + template: /*language=HTML*/ ` +
+ + + +
+
+
{{ option.userName }} - {{ option.loginName + }} - {{option.unitName}} - {{option.unionName}} +
+
+ + {{option.sex}} + + {{ option.age }}岁 + {{ option.professionalTitle }} +
+
+
+
+ + 推选名额:{{quotaCount}}个 + + 取 消 + 确 定 + + +
+
+ `, + data() { + return { + dialogVisible: false, + userValue: [], + userData: [], + rightChecked: [], + attendanceRightChecked: [], + teacherMeetId: null, + quotaCount: 0 + } + }, + methods: { + async onOpen(teacherMeetId) { + + this.teacherMeetId = teacherMeetId + this.userValue = [] + this.userData = [] + const { + code, + msg, + data + } = await this.$axios.post('/platform/executiveCommittee/unionPush/getUnionUser', {teacherMeetId: teacherMeetId}) + if (code === 0) { + data.userData.forEach(v => { + this.userData.push({userId: v.userId, ...v}) + }) + this.quotaCount = data.quotaCount + this.dialogVisible = true + } else { + this.$message.error(msg) + } + }, + filterMethod(query, item) { + return item.userName.indexOf(query) > -1 + }, + async onConfirm() { + const { + code, + msg + } = await this.$axios.post('/platform/executiveCommittee/unionPush/addPush', { + userValue: JSON.stringify(this.userValue), + teacherMeetId: this.teacherMeetId + }) + if (code === 0) { + this.dialogVisible = false + this.$message.success(msg) + this.$emit('refresh') + } else { + this.$message.error(msg) + } + } + }, + style: /*language=CSS*/ ` + + ` +} diff --git a/src/main/resources/views/platform/zhgh/democratic/teachercongress/delegate/push/dwSjAudit.html b/src/main/resources/views/platform/zhgh/democratic/teachercongress/delegate/push/dwSjAudit.html index cc4946fb..1dda33c5 100644 --- a/src/main/resources/views/platform/zhgh/democratic/teachercongress/delegate/push/dwSjAudit.html +++ b/src/main/resources/views/platform/zhgh/democratic/teachercongress/delegate/push/dwSjAudit.html @@ -231,7 +231,6 @@ layout("/layouts/platform.html"){ } this.$refs.auditInfoRef.onOpen(row) }) - }, onView(row) { this.$refs.guava.edit(() => {