commit
This commit is contained in:
-1
@@ -49,7 +49,6 @@ public class OutlayReimburseSummaryServiceImpl extends BaseServiceImpl implement
|
||||
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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
+326
-12
@@ -1,34 +1,47 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegate.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
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.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.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.TeacherCongressDelegatePush;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.service.TeacherCongressDelegatePushService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.prepare.models.Teacher_congress_quota_allocation;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.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.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
@@ -47,6 +60,13 @@ public class TeacherCongressDelegatePushController {
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
|
||||
|
||||
@Inject
|
||||
private TeacherCongressDelegatePushService teacherCongressDelegatePushService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/delegate/push/index.html")
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
@@ -54,6 +74,58 @@ public class TeacherCongressDelegatePushController {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "sessionId") String sessionId,
|
||||
@Param(value = "isFormalOrAttendance") String isFormalOrAttendance) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
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,
|
||||
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
|
||||
teacher_congress_delegate_push 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("info.sessionId", "=", sessionId);
|
||||
|
||||
if (!"全部".equals(isFormalOrAttendance)) {
|
||||
cnd.and("info.representativeType", "=", isFormalOrAttendance);
|
||||
}
|
||||
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");
|
||||
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取本分工会下的非代表用户
|
||||
*
|
||||
@@ -68,15 +140,15 @@ public class TeacherCongressDelegatePushController {
|
||||
// 查询预选中的代表
|
||||
Cnd cndx = Cnd.where("sessionId", "=", sessionId);
|
||||
cndx.andEX("unionId", "=", SecurityUtil.getUnionId());
|
||||
List<Teacher_congress_delegate> delegateList = dao.query(Teacher_congress_delegate.class, cndx);
|
||||
// u.professionalTitle,
|
||||
// u.professionalLevel,
|
||||
List<TeacherCongressDelegatePush> delegateList = dao.query(TeacherCongressDelegatePush.class, cndx);
|
||||
List<String> userIds = delegateList.stream().map(TeacherCongressDelegatePush::getUserId).toList();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id AS userId,
|
||||
u.loginname as loginName,
|
||||
u.username as userName,
|
||||
|
||||
u.professionalTitle,
|
||||
u.professionalLevel,
|
||||
u.sex,
|
||||
u.birthday,
|
||||
u.nation,
|
||||
@@ -92,6 +164,7 @@ public class TeacherCongressDelegatePushController {
|
||||
sql.setParam("sessionId", sessionId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("u.member", "=", 1);
|
||||
cnd.andEX("u.id", "not in", userIds);
|
||||
cnd.and("tcd.userId", "is", null);
|
||||
cnd.and("tcdp.id", "is", null);
|
||||
cnd.and("u.unionId", "=", SecurityUtil.getUnionId());
|
||||
@@ -101,11 +174,10 @@ public class TeacherCongressDelegatePushController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推选代表
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("推选代表")
|
||||
public Object addPreselectionDb(@Param("userValue") String[] userValue, String sessionId, String representativeType) {
|
||||
List<TeacherCongressDelegatePush> list = new ArrayList<>();
|
||||
for (String id : userValue) {
|
||||
@@ -118,6 +190,7 @@ public class TeacherCongressDelegatePushController {
|
||||
tmd.setUserName(user.getUsername());
|
||||
tmd.setLoginName(user.getLoginname());
|
||||
tmd.setSex(user.getSex());
|
||||
tmd.setMobile(user.getMobile());
|
||||
tmd.setNation(user.getNation());
|
||||
tmd.setEducation(user.getEducation());
|
||||
tmd.setAcademicDegree(user.getAcademicDegree());
|
||||
@@ -155,8 +228,249 @@ public class TeacherCongressDelegatePushController {
|
||||
list.add(tmd);
|
||||
}
|
||||
dao.insert(list);
|
||||
|
||||
|
||||
list.forEach(teacherCongressDelegatePush -> {
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, teacherCongressDelegatePush);
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("TXDB", teacherCongressDelegatePush.getId(), SecurityUtil.getUserId(), args);
|
||||
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
});
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
@SLog(tag = "删除推选代表", msg = "删除推选代表")
|
||||
public Result delete(@Valid String id) {
|
||||
baseService.dao().delete(TeacherCongressDelegatePush.class, id);
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("提交到资格审查")
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
@SLog(tag = "代表管理-代表推选", msg = "提交到资格审查")
|
||||
public Result batchSubmit(@Param("ids") @Valid String[] ids, String sessionId) {
|
||||
|
||||
|
||||
Teacher_congress_quota_allocation allocation = dao.fetch(Teacher_congress_quota_allocation.class,
|
||||
Cnd.where(Teacher_congress_quota_allocation::getSessionId, "=", sessionId)
|
||||
.and(Teacher_congress_quota_allocation::getUnionId, "=", SecurityUtil.getUnionId()));
|
||||
|
||||
|
||||
if (allocation == null) {
|
||||
return Result.error("请先设置名额分配");
|
||||
}
|
||||
if (allocation.getAllocationNum() == 0) {
|
||||
return Result.error("请先设置名额分配");
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
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,
|
||||
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
|
||||
teacher_congress_delegate_push 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("info.sessionId", "=", sessionId);
|
||||
cnd.andEX("info.unionId", "=", SecurityUtil.getUnionId());
|
||||
cnd.andEX("t.taskName", "=", "53ff0c2a-ba93-45e9-a9fd-db51cdab3080");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> writeList = baseService.listMap(sql);
|
||||
|
||||
// 已上报总人数
|
||||
int total = writeList.size();
|
||||
// 已上报女代表人数
|
||||
int female = (int) writeList.stream().filter(v -> List.of("女", "女性").contains(v.getString("sex"))).count();
|
||||
// 已上报高级职称专任教师人数
|
||||
int seniorTeacher = (int) writeList.stream().filter(v -> v.getBoolean("seniorTeacher")).count();
|
||||
// 已上报专任教师人数
|
||||
int ordinaryTeacher = (int) writeList.stream().filter(v -> v.getBoolean("ordinaryTeacher")).count();
|
||||
// 已上报45岁以下代表
|
||||
int under45 = (int) writeList.stream().filter(v -> Convert.toInt(v.getInt("age"), 0) <= 45).count();
|
||||
|
||||
StringBuffer tips = new StringBuffer();
|
||||
|
||||
if (total > allocation.getAllocationNum()) {
|
||||
tips.append("上报总人数超出分配名额!");
|
||||
}
|
||||
/* if (female < allocation.getFemaleNum()) {
|
||||
tips.append("女教师代表数不满足分配名额数!");
|
||||
}
|
||||
|
||||
if (seniorTeacher < allocation.getSeniorTeaNum()) {
|
||||
tips.append("高级职称专任教师数不满足分配名额数!");
|
||||
}
|
||||
|
||||
if (ordinaryTeacher < allocation.getOrdinaryTeaNum()) {
|
||||
tips.append("专任教师数不满足分配名额数!");
|
||||
}
|
||||
|
||||
if (under45 < allocation.getLess45Num()) {
|
||||
tips.append("45岁以下教师代表数不满足分配名额数!");
|
||||
}*/
|
||||
|
||||
if (StrUtil.isNotBlank(tips)) {
|
||||
return Result.error(tips.toString());
|
||||
}
|
||||
teacherCongressDelegatePushService.batchSubmit(ids, sessionId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("本单位代表上报情况")
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
public Result selfUnionPushMetric(String sessionId, String unionId) {
|
||||
|
||||
Teacher_congress_quota_allocation allocation = dao.fetch(Teacher_congress_quota_allocation.class,
|
||||
Cnd.where(Teacher_congress_quota_allocation::getSessionId, "=", sessionId)
|
||||
.and(Teacher_congress_quota_allocation::getUnionId, "=", SecurityUtil.getUnionId()));
|
||||
if(allocation == null){
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariale,
|
||||
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 taskVariale,
|
||||
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' AND taskState IN (10, 20)) AS startTaskId
|
||||
FROM
|
||||
teacher_congress_delegate_push 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("info.sessionId", "=", sessionId);
|
||||
cnd.andEX("info.unionId", "=", SecurityUtil.getUnionId());
|
||||
cnd.andEX("info.representativeType", "=", "正式代表");
|
||||
cnd.and("ins.state", "=", ProcessTaskStateEnum.FINISHED.getCode());
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> writeList = baseService.listMap(sql);
|
||||
|
||||
|
||||
// 上报总人数
|
||||
int total = writeList.size();
|
||||
// 女代表人数
|
||||
int female = (int) writeList.stream().filter(v -> List.of("女", "女性").contains(v.getString("sex"))).count();
|
||||
// 高级职称专任教师人数
|
||||
int seniorTeacher = (int) writeList.stream().filter(v->v.getBoolean("seniorTeacher")).count();
|
||||
// 专任教师人数
|
||||
int ordinaryTeacher = (int) writeList.stream().filter(v->v.getBoolean("ordinaryTeacher")).count();
|
||||
// 45岁以下代表
|
||||
int under45 = (int) writeList.stream().filter(v -> Convert.toInt(v.getInt("age"), 0) <= 45).count();
|
||||
// 少数民族代表
|
||||
long ethnicMinority = writeList.stream().filter(v -> StrUtil.isNotBlank(v.getString("nation")) && !"汉族".equals(v.getString("nation"))).count();
|
||||
// 校领导数
|
||||
long schoolLeader = writeList.stream().filter(v->v.getBoolean("schoolLeader")).count();
|
||||
// 中层领导数
|
||||
long middleLevelLeader = writeList.stream().filter(v->v.getBoolean("middleLevelLeader")).count();
|
||||
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
|
||||
HashMap<String, Object> totalMap = new HashMap<>();
|
||||
totalMap.put("current", total);
|
||||
totalMap.put("target", allocation.getAllocationNum());
|
||||
totalMap.put("progress", allocation.getAllocationNum() != 0 ? (double) total / allocation.getAllocationNum() : 0.0);
|
||||
totalMap.put("remaining", allocation.getAllocationNum() - total);
|
||||
hashMap.put("total", totalMap);
|
||||
|
||||
HashMap<String, Object> femaleMap = new HashMap<>();
|
||||
femaleMap.put("current", female);
|
||||
femaleMap.put("target", allocation.getFemaleNum());
|
||||
femaleMap.put("progress", allocation.getFemaleNum() != 0 ? (double) female / allocation.getFemaleNum() : 0.0);
|
||||
femaleMap.put("remaining", allocation.getFemaleNum() - female);
|
||||
hashMap.put("female", femaleMap);
|
||||
|
||||
HashMap<String, Object> seniorTeaMap = new HashMap<>();
|
||||
seniorTeaMap.put("current", seniorTeacher);
|
||||
seniorTeaMap.put("target", allocation.getSeniorTeaNum());
|
||||
seniorTeaMap.put("progress", allocation.getSeniorTeaNum() != 0 ? (double) seniorTeacher / allocation.getSeniorTeaNum() : 0.0);
|
||||
seniorTeaMap.put("remaining", allocation.getSeniorTeaNum() - seniorTeacher);
|
||||
hashMap.put("seniorTeacher", seniorTeaMap);
|
||||
|
||||
HashMap<String, Object> ordinaryTeaMap = new HashMap<>();
|
||||
ordinaryTeaMap.put("current", ordinaryTeacher);
|
||||
ordinaryTeaMap.put("target", allocation.getOrdinaryTeaNum());
|
||||
ordinaryTeaMap.put("progress", allocation.getOrdinaryTeaNum() != 0 ? (double) ordinaryTeacher / allocation.getOrdinaryTeaNum() : 0.0);
|
||||
ordinaryTeaMap.put("remaining", allocation.getOrdinaryTeaNum() - ordinaryTeacher);
|
||||
hashMap.put("ordinaryTeacher", ordinaryTeaMap);
|
||||
|
||||
HashMap<String, Object> under45Map = new HashMap<>();
|
||||
under45Map.put("current", under45);
|
||||
under45Map.put("target", allocation.getLess45Num());
|
||||
under45Map.put("progress", allocation.getLess45Num() != 0 ? (double) under45 / allocation.getLess45Num() : 0.0);
|
||||
under45Map.put("remaining", allocation.getLess45Num() - under45);
|
||||
hashMap.put("under45", under45Map);
|
||||
|
||||
/* HashMap<String, Object> ethnicMinorityMap = new HashMap<>();
|
||||
ethnicMinorityMap.put("current", (int) ethnicMinority);
|
||||
ethnicMinorityMap.put("target", allocation.getEthnicMinorityNum());
|
||||
ethnicMinorityMap.put("progress", allocation.getEthnicMinorityNum() != 0 ? (double) (int) ethnicMinority / allocation.getEthnicMinorityNum() : 0.0);
|
||||
ethnicMinorityMap.put("remaining", allocation.getEthnicMinorityNum() - (int) ethnicMinority);
|
||||
hashMap.put("ethnicMinority", ethnicMinorityMap);
|
||||
|
||||
HashMap<String, Object> schoolLeaderMap = new HashMap<>();
|
||||
schoolLeaderMap.put("current", (int) schoolLeader);
|
||||
schoolLeaderMap.put("target", allocation.getSchoolLeaderNum());
|
||||
schoolLeaderMap.put("progress", allocation.getSchoolLeaderNum() != 0 ? (double) (int) schoolLeader / allocation.getSchoolLeaderNum() : 0.0);
|
||||
schoolLeaderMap.put("remaining", allocation.getSchoolLeaderNum() - (int) schoolLeader);
|
||||
hashMap.put("schoolLeader", schoolLeaderMap);
|
||||
|
||||
HashMap<String, Object> middleLevelLeaderMap = new HashMap<>();
|
||||
middleLevelLeaderMap.put("current", (int) middleLevelLeader);
|
||||
middleLevelLeaderMap.put("target", allocation.getMiddleLevelLeaderNum());
|
||||
middleLevelLeaderMap.put("progress", allocation.getMiddleLevelLeaderNum() != 0 ? (double) (int) middleLevelLeader / allocation.getMiddleLevelLeaderNum() : 0.0);
|
||||
middleLevelLeaderMap.put("remaining", allocation.getMiddleLevelLeaderNum() - (int) middleLevelLeader);
|
||||
hashMap.put("middleLevelLeader", middleLevelLeaderMap);*/
|
||||
|
||||
return Result.success(hashMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegate.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.TeacherCongressDelegatePush;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/9/23 14:04
|
||||
* @description 代表推选代表填写
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/teacherCongress/delegate/push/write")
|
||||
@Ok("json:full")
|
||||
@Api(value = "/platform/teacherCongress/delegate/push/write", tags = "代表推选代表填写")
|
||||
public class TeacherCongressDelegatePushWriteController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/delegate/push/write.html")
|
||||
@SaCheckPermission("tc.delegate.push.write")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("代表信息初始信息")
|
||||
@SaCheckPermission("tc.delegate.push.write")
|
||||
public Result info(String sessionId, String userId) {
|
||||
userId = StrUtil.blankToDefault(userId, SecurityUtil.getUserId());
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariale,
|
||||
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 taskVariale,
|
||||
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' AND taskState IN (10, 20)) AS startTaskId
|
||||
FROM
|
||||
teacher_congress_delegate_push 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.sessionId", "=", sessionId);
|
||||
cnd.and("info.userId", "=", userId);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao.execute(sql);
|
||||
NutMap delegate = (NutMap) sql.getResult();
|
||||
if (ObjectUtil.isNull(delegate)) {
|
||||
return Result.success(Map.of("isSelected", false));
|
||||
}
|
||||
return Result.success(Map.of("isSelected", true, "delegate", delegate));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("代表信息填写保存")
|
||||
@SaCheckPermission("tc.delegate.push.write")
|
||||
public Result save(TeacherCongressDelegatePush teacherCongressDelegatePush){
|
||||
dao.updateIgnoreNull(teacherCongressDelegatePush);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("代表信息填写提交")
|
||||
@SaCheckPermission("tc.delegate.push.write")
|
||||
public Result submit(TeacherCongressDelegatePush teacherCongressDelegatePush,String taskId){
|
||||
dao.updateIgnoreNull(teacherCongressDelegatePush);
|
||||
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.AGREE.getCode());
|
||||
flowCommonService.executeTask(dict);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegate.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.enums.ProcessTaskStateEnum;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/9/23 16:35
|
||||
* @description 代表推选资格审查
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/teacherCongress/delegate/push/zcAudit")
|
||||
@Ok("json:full")
|
||||
@Api(value = "/platform/teacherCongress/delegate/push/zcAudit", tags = "代表推选资格审查")
|
||||
public class TeacherCongressDelegatePushZgAuditController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/delegate/push/zcAudit.html")
|
||||
@SaCheckPermission("tc.delegate.push.zcAudit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("tc.delegate.push")
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "sessionId") String sessionId,
|
||||
@Param(value = "unionId") String unionId,
|
||||
@Param(value = "approval") Boolean approval,
|
||||
@Param(value = "isFormalOrAttendance") String isFormalOrAttendance) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
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 teacher_congress_delegate_push info ON info.id = ins.businessNo
|
||||
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
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "900217e4-4332-4a21-90dd-363b8be17801");
|
||||
// cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
if (!"全部".equals(isFormalOrAttendance)) {
|
||||
cnd.and("info.representativeType", "=", isFormalOrAttendance);
|
||||
}
|
||||
cnd.andEX("info.sessionId", "=", sessionId);
|
||||
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());
|
||||
}
|
||||
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);
|
||||
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-5
@@ -117,11 +117,6 @@ public class TeacherCongressDelegatePush extends BaseModel {
|
||||
@Default("0")
|
||||
private Boolean middleLevelLeader;
|
||||
|
||||
@Column
|
||||
@Comment("行政职称===>position")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String administrativeTitle;
|
||||
|
||||
@Column
|
||||
@Comment("年龄")
|
||||
@ColDefine(type = ColType.INT)
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegate.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.TeacherCongressDelegatePush;
|
||||
|
||||
public interface TeacherCongressDelegatePushService extends BaseService<TeacherCongressDelegatePush> {
|
||||
|
||||
void batchSubmit(String[] ids, String sessionId);
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.delegate.service;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.TeacherCongressDelegatePush;
|
||||
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.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/9/24 09:40
|
||||
* @description
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class TeacherCongressDelegatePushServiceImpl extends BaseServiceImpl<TeacherCongressDelegatePush> implements TeacherCongressDelegatePushService {
|
||||
public TeacherCongressDelegatePushServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@Override
|
||||
public void batchSubmit(String[] ids, String sessionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
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,
|
||||
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
|
||||
teacher_congress_delegate_push 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
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.id", "in", ids);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> delegatePushList = listMap(sql);
|
||||
|
||||
delegatePushList.forEach(push -> {
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, push.getString("taskId"));
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.AGREE.getCode());
|
||||
flowCommonService.executeTask(dict);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user