Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/v4
This commit is contained in:
+14
@@ -68,6 +68,20 @@ public class ExecutiveCommitteeConfigController {
|
||||
""").setParam("sessionId",sessionId);
|
||||
List<NutMap> 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<NutMap> listMap2 = committeeConfigService.listMap(sql2);
|
||||
config.setDelegationQuotaList(listMap2);
|
||||
}
|
||||
return Result.success(config);
|
||||
}
|
||||
|
||||
+43
-37
@@ -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<ExecutiveCommitteeOnePush> onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW());
|
||||
List<String> 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<NutMap> userData = baseService.listMap(sql);
|
||||
|
||||
|
||||
List<NutMap> 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<NutMap> 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<NutMap> unionQuotaList = config.getUnionQuotaList();
|
||||
List<NutMap> 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));
|
||||
|
||||
+197
@@ -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<NutMap> 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<ExecutiveCommitteeOnePush> 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+291
@@ -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<NutMap> 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<ExecutiveCommitteeOnePush> userValue = dao.query(ExecutiveCommitteeOnePush.class,
|
||||
Cnd.where("teacherMeetId", "=", teacherMeetId));
|
||||
List<ExecutiveCommitteeOnePush> onePushList = dao.query(ExecutiveCommitteeOnePush.class, Cnd.NEW());
|
||||
List<String> userIds = onePushList.stream().map(v -> v.getUserId()).collect(Collectors.toList());
|
||||
|
||||
|
||||
List<ExecutiveCommitteeUnionPushInfo> pushInfoList = dao.query(ExecutiveCommitteeUnionPushInfo.class, Cnd.where(ExecutiveCommitteeUnionPushInfo::getTeacherMeetId, "=", teacherMeetId));
|
||||
List<String> 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<NutMap> userData = baseService.listMap(sql);
|
||||
|
||||
|
||||
List<NutMap> 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<NutMap> 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<Teacher_congress_delegate> dbList = baseService.listVO(sql, Teacher_congress_delegate.class);
|
||||
|
||||
List<ExecutiveCommitteeUnionPushInfo> 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<ProcessTask> 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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -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<NutMap> unionQuotaList;
|
||||
|
||||
@Column
|
||||
@Comment("各代表团名额数")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> delegationQuotaList;
|
||||
|
||||
}
|
||||
|
||||
+52
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user