待办中心:待办、已办、已发接口开发。

清单确认业务-集成待办中心。
This commit is contained in:
wangzhijiang
2022-10-17 17:40:27 +08:00
parent e52d589ef1
commit 46ee43c512
10 changed files with 618 additions and 17 deletions
@@ -0,0 +1,63 @@
package com.jero.modules.project.enums;
import com.alibaba.druid.util.StringUtils;
import com.jero.common.constant.enums.CutEnum;
/**
* 清单确认节点枚举类
*/
public enum InventoryAffirmNodeEnum {
INITIATED_BY_STUDIO_ENGINEERS("studiofq","R&H Studio发起","R&H Studio initiate"),
HOMOLOGATION_ENGINEER_AUDIT ("homologationEngineer audit","认证审核","homologationEngineer audit"),
REGULATION_OWNER_AUDIT("regulationOwner audit","法规审核","regulationOwner audit"),
;
String key;
String cnName;
String enName;
private InventoryAffirmNodeEnum(String key, String cnName, String enName) {
this.key = key;
this.cnName = cnName;
this.enName = enName;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getCnName() {
return cnName;
}
public void setCnName(String cnName) {
this.cnName = cnName;
}
public String getEnName() {
return enName;
}
public void setEnName(String enName) {
this.enName = enName;
}
public static String getTextByValue(String key,String cut) {
InventoryAffirmNodeEnum[] values = values();
for (InventoryAffirmNodeEnum inventoryAffirmNodeEnum : values) {
if (inventoryAffirmNodeEnum.key.equals(key)) {
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
return inventoryAffirmNodeEnum.cnName;
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
return inventoryAffirmNodeEnum.enName;
}
}
}
return null;
}
}
@@ -58,6 +58,11 @@ import com.jero.modules.system.service.ISysAnnouncementService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum;
import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService;
import com.jero.modules.todoCenter.service.IProcessInfoEOService;
import com.jero.modules.wkflow.entity.ProcessHistoryEO;
import com.jero.modules.wkflow.enums.DesignComplianceNodeEnum;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
@@ -104,6 +109,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.*;
@@ -218,6 +224,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
@Autowired
private IProjectLawsInventoryRejectCauseEOService projectLawsInventoryRejectCauseEOService;
@Autowired
private IProcessInfoEOService processInfoEOService;
@Autowired
private IProcessInfoDetailEOService processInfoDetailEOService;
/**
* 保存
*
@@ -1391,9 +1402,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper);
List<String> userIdList = new ArrayList<>();
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) {
List<String> tempUserIdList = new ArrayList<>();
//如果该数据的状态为 未发起或拒绝 可以发起清单确认
//tempUserIdList 未发起或拒绝 可以发起清单确认
boolean checkStatus = (StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(),InventoryAffirmStatusEnum.NOT_STARTED.getValue())
||StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(),InventoryAffirmStatusEnum.REJECTED.getValue()));
//如果该数据的法规工程师认证工程师都不为空
@@ -1418,10 +1431,22 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(homologationEngineerFlag){
updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerSubmitStatus,null);
userIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId());
processInfoDetailEO.setUserId(projectLawsInventoryEO.getHomologationEngineerId());
processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.HOMOLOGATION_ENGINEER_AUDIT.getKey());
processInfoDetailEOList.add(processInfoDetailEO);
}
if(regulationOwnerFlag){
updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerSubmitStatus,null);
userIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId());
processInfoDetailEO.setUserId(projectLawsInventoryEO.getRegulationOwnerId());
processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.REGULATION_OWNER_AUDIT.getKey());
processInfoDetailEOList.add(processInfoDetailEO);
}
if(homologationEngineerFlag || regulationOwnerFlag){
@@ -1469,6 +1494,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
//发送消息
sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,currentUser.getUsername());
//往待办中心添加数据
ProcessInfoEO processInfoEO = new ProcessInfoEO();
this.addProcessInfo(processInfoEO,projectLibraryId,inventoryAffirmDueDate);
this.addProcessInfoDetail(processInfoEO.getId(),processInfoDetailEOList);
}
result = "发起清单确认";
@@ -1654,6 +1684,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
projectLawsInventoryEO.setInventoryAffirmStatus(inventoryAffirmStatus);
}
super.baseMapper.updateById(projectLawsInventoryEO);
this.updateProcessInfoDetail(projectLawsInventoryEO.getId());
//如果法规认证工程师都提交通过法规清单 清单确认状态为接受 并且给当前项目的studio发送消息
if(StringUtils.equals(inventoryAffirmStatus,InventoryAffirmStatusEnum.ACCEPTED.getValue())){
@@ -8587,4 +8618,124 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
conditionAssessmentEO.setConditionAssessment(CurrentProjectStatusEnum.BLUE.getValue());
this.conditionAssessmentEOService.addOrUpdate(conditionAssessmentEO);
}
/**
* 添加流程信息
* @param processInfoEO
* @param projectLibraryId
* @param inventoryAffirmDueDate
*/
public void addProcessInfo(ProcessInfoEO processInfoEO,String projectLibraryId,String inventoryAffirmDueDate){
String id = null;
//查询当前项目之前有没有启动过清单确认
QueryWrapper<ProcessInfoEO> processInfoQueryWrap = new QueryWrapper<>();
processInfoQueryWrap.lambda().eq(ProcessInfoEO::getProjectLibraryId,projectLibraryId);
processInfoQueryWrap.lambda().eq(ProcessInfoEO::getFlowType,FlowTypeEnum.QDQR.getValue());
List<ProcessInfoEO> processInfoEOList = this.processInfoEOService.list(processInfoQueryWrap);
if(CollectionUtils.isNotEmpty(processInfoEOList)){
id = processInfoEOList.get(0).getId();
//删除之前创建的数据
this.processInfoEOService.remove(processInfoQueryWrap);
}else {
id = UUID.randomUUID().toString().replace("-", "");
}
processInfoEO.setId(id);
processInfoEO.setProjectLibraryId(projectLibraryId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date endTime = new Date();
try {
endTime = sdf.parse(inventoryAffirmDueDate);
} catch (ParseException e) {
e.printStackTrace();
}
processInfoEO.setEndTime(endTime);
processInfoEO.setStatus(TodoCenterStatusEnum.LIST_TO_CONFIRM.getValue());
processInfoEO.setFlowType(FlowTypeEnum.QDQR.getValue());
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
processInfoEO.setCreateBy(currentUser.getId());
this.processInfoEOService.add(processInfoEO);
}
/**
* 添加流程信息用户的待办已办信息
* @param processInfoId
* @param processInfoDetailEOList
*/
public void addProcessInfoDetail(String processInfoId,List<ProcessInfoDetailEO> processInfoDetailEOList){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
processInfoDetailEOList.forEach(detail -> {
detail.setCreateTime(new Date());
detail.setCreateBy(currentUser.getId());
detail.setStatus(TaskStatusEnum.NOT_DONE.getValue());
detail.setProcessInfoId(processInfoId);
detail.setFlowType(FlowTypeEnum.QDQR.getValue());
QueryWrapper<ProcessInfoDetailEO> deleteDetailWrap = new QueryWrapper<>();
deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId,detail.getProjectLawsInventoryId());
deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getUserId,detail.getUserId());
this.processInfoDetailEOService.remove(deleteDetailWrap);
});
//创建一条当前发起清单确认的studio的已办任务
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setStatus(TaskStatusEnum.HAVE_DONE.getValue());
processInfoDetailEO.setUserId(currentUser.getId());
processInfoDetailEO.setProcessInfoId(processInfoId);
processInfoDetailEO.setFlowType(FlowTypeEnum.QDQR.getValue());
processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.INITIATED_BY_STUDIO_ENGINEERS.getKey());
processInfoDetailEO.setSubmitTime(new Date());
processInfoDetailEO.setCreateTime(new Date());
processInfoDetailEO.setUpdateTime(new Date());
processInfoDetailEO.setCreateBy(currentUser.getId());
processInfoDetailEOList.add(processInfoDetailEO);
//删除studio在这个项目的清单确认已办任务
QueryWrapper<ProcessInfoDetailEO> deleteStudioDetailWrap = new QueryWrapper<>();
deleteStudioDetailWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,InventoryAffirmNodeEnum.INITIATED_BY_STUDIO_ENGINEERS.getKey());
deleteStudioDetailWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,processInfoId);
this.processInfoDetailEOService.remove(deleteStudioDetailWrap);
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
}
/**
* 更新流程信息用户的待办已办任务信息
* @param projeceLawsInventoryId
*/
public void updateProcessInfoDetail(String projeceLawsInventoryId){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<ProcessInfoDetailEO> detailQueryWrapper = new QueryWrapper<>();
detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId,projeceLawsInventoryId);
detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getUserId,currentUser.getId());
detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.QDQR.getValue());
List<ProcessInfoDetailEO> detailEOList = this.processInfoDetailEOService.list(detailQueryWrapper);
if(CollectionUtils.isNotEmpty(detailEOList)){
String processInfoId = detailEOList.get(0).getProcessInfoId();
detailEOList.forEach(detail -> {
detail.setSubmitTime(new Date());
detail.setStatus(TaskStatusEnum.HAVE_DONE.getValue());
});
this.processInfoDetailEOService.updateBatchById(detailEOList);
//查询当前项目下还有没有未完成的任务
QueryWrapper<ProcessInfoDetailEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,processInfoId);
queryWrapper.lambda().eq(ProcessInfoDetailEO::getStatus,TaskStatusEnum.NOT_DONE.getValue());
int count = this.processInfoDetailEOService.count(queryWrapper);
//如果没有待办任务
if(count == 0){
ProcessInfoEO processInfoEO = new ProcessInfoEO();
processInfoEO.setStatus(TodoCenterStatusEnum.COMPLETED.getValue());
processInfoEO.setId(processInfoId);
this.processInfoEOService.updateById(processInfoEO);
}
}
}
}
@@ -0,0 +1,50 @@
package com.jero.modules.todoCenter.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.modules.todoCenter.service.IProcessInfoEOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Api(tags="待办中心-项目流程")
@RestController
@RequestMapping("/todoCenter/projectProcess")
@Slf4j
public class ProjectProcessTodoCenterController {
@Autowired
private IProcessInfoEOService processInfoEOService;
@AutoLog(value = "分页查询-待办任务列表")
@ApiOperation(value="分页查询-待办任务列表", notes="分页查询-待办任务列表")
@GetMapping(value = "/todoTaskList")
public Result<?> todoTaskList(@RequestParam Map<String,Object> params) {
IPage page = this.processInfoEOService.todoTaskList(params);
return Result.OK(page);
}
@AutoLog(value = "分页查询-已办任务列表")
@ApiOperation(value="分页查询-已办任务列表", notes="分页查询-已办任务列表")
@GetMapping(value = "/doneProcess")
public Result<?> doneProcess(@RequestParam Map<String,Object> params) {
IPage page = this.processInfoEOService.doneProcess(params);
return Result.OK(page);
}
@AutoLog(value = "分页查询-已发任务列表")
@ApiOperation(value="分页查询-已发任务列表", notes="分页查询-已发任务列表")
@GetMapping(value = "/issuedProcess")
public Result<?> issuedProcess(@RequestParam Map<String,Object> params) {
IPage page = this.processInfoEOService.issuedProcess(params);
return Result.OK(page);
}
}
@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -98,4 +99,30 @@ public class ProcessInfoEO implements Serializable {
@ApiModelProperty(value = "任务状态")
private java.lang.String status;
/**流程类型展示字段*/
@TableField(exist = false)
private String flowTypeShow;
/**任务状态展示字段*/
@TableField(exist = false)
private String statusShow;
/**上一个操作人 用户id*/
@TableField(exist = false)
private String lastAssignee;
@TableField(exist = false)
private String lastAssigneeName;
/**当前操作人/代理人 用户id*/
@TableField(exist = false)
private String assignee;
@TableField(exist = false)
private String assigneeName;
/**标准编号*/
@TableField(exist = false)
private String serialNumber;
/**标准标题*/
@TableField(exist = false)
private String title;
}
@@ -50,12 +50,12 @@ public enum TodoCenterStatusEnum {
public static String getTextByValue(String value,String cut) {
TodoCenterStatusEnum[] values = values();
for (TodoCenterStatusEnum operatorTypeEnum : values) {
if (operatorTypeEnum.value.equals(value)) {
for (TodoCenterStatusEnum todoCenterStatusEnum : values) {
if (todoCenterStatusEnum.value.equals(value)) {
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
return operatorTypeEnum.cnName;
return todoCenterStatusEnum.cnName;
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
return operatorTypeEnum.enName;
return todoCenterStatusEnum.enName;
}
}
}
@@ -1,7 +1,9 @@
package com.jero.modules.todoCenter.mapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -14,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ProcessInfoEOMapper extends BaseMapper<ProcessInfoEO> {
IPage<ProcessInfoEO> queryPageList(IPage page,Map<String, Object> params);
}
@@ -16,4 +16,74 @@
<result column="end_time" property="endTime" />
<result column="status" property="status" />
</resultMap>
</mapper>
<sql id="BaseQuerySql">
<where>
(
pi.id IN (
SELECT
pid.process_info_id
FROM
process_info_detail pid
<where>
pid.user_id = #{params.currentUserId}
<if test="params.taskStatus != null and params.taskStatus != ''">
and pid.status = #{params.taskStatus}
</if>
</where>
)
)
<if test="params.projectName != null and params.projectName !=''">
and (
pni.project_name like CONCAT(CONCAT('%',#{params.projectName}),'%')
or pyni.year_name like CONCAT(CONCAT('%',#{params.projectName}),'%')
)
</if>
<if test="params.serialNumber != null and params.serialNumber !=''">
and (
pli.serial_number like CONCAT(CONCAT('%',#{params.serialNumber}),'%')
)
</if>
<if test="params.flowType != null and params.flowType !=''">
and pi.flow_type = #{params.flowType}
</if>
<if test="params.status != null and params.status !=''">
and pi.status = #{params.status}
</if>
<if test="params.flowTypeList != null">
and pi.flow_type in
<foreach collection="params.flowTypeList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.createBy != null and params.createBy != ''">
and pi.create_by = #{params.createBy}
</if>
</where>
</sql>
<select id="queryPageList" resultType="com.jero.modules.todoCenter.entity.ProcessInfoEO">
SELECT
pi.id,
pi.project_library_id,
pi.project_laws_inventory_id,
pi.buss_document_library_id,
pi.acti_proc_inst_id,
pni.project_name,
pyni.year_name,
pli.serial_number,
pli.title,
pi.flow_type,
createBy.username as "create_by",
pi.end_time,
pi.status
FROM
process_info pi
left join project_library_base plb on plb.id = pi.project_library_id
left join project_name_info pni on pni.id = plb.project_name_id
left join project_year_name_info pyni on pyni.id = plb.year_name_id
left join project_laws_inventory pli on pi.project_laws_inventory_id = pli.id
LEFT JOIN sys_user createBy on createBy.id = pi.create_by
<include refid="BaseQuerySql"/>
</select>
</mapper>
@@ -1,10 +1,12 @@
package com.jero.modules.todoCenter.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @Description: 流程信息表
@@ -67,4 +69,25 @@ public interface IProcessInfoEOService extends IService<ProcessInfoEO> {
* @return
*/
Result<?> processCall(JSONObject jsonObject);
/**
* 待办任务列表
* @param params
* @return
*/
IPage todoTaskList(Map<String,Object> params);
/**
* 已办任务列表
* @param params
* @return
*/
IPage doneProcess(Map<String, Object> params);
/**
* 已发任务列表
* @param params
* @return
*/
IPage issuedProcess(Map<String, Object> params);
}
@@ -1,19 +1,33 @@
package com.jero.modules.todoCenter.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.RequestSourceEnum;
import com.jero.modules.project.enums.TaskStatusEnum;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum;
import com.jero.modules.todoCenter.mapper.ProcessInfoEOMapper;
import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService;
import com.jero.modules.todoCenter.service.IProcessInfoEOService;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
@@ -25,6 +39,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class ProcessInfoEOServiceImpl extends ServiceImpl<ProcessInfoEOMapper, ProcessInfoEO> implements IProcessInfoEOService {
@Autowired
private IProcessInfoDetailEOService processInfoDetailEOService;
@Autowired
private ISysUserService sysUserService;
/**
* 保存
*
@@ -121,4 +140,168 @@ public class ProcessInfoEOServiceImpl extends ServiceImpl<ProcessInfoEOMapper, P
}
return new Result<>().success("调用成功!");
}
@Override
public IPage todoTaskList(Map<String, Object> params) {
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
String cut = (String) params.get("cut");
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> flowTypeList = new ArrayList<>();
this.setFlowTypeList(flowTypeList);
params.put("flowTypeList",flowTypeList);
params.put("taskStatus", TaskStatusEnum.NOT_DONE.getValue());
params.put("currentUserId",currentUser.getId());
IPage page = new Page(pageNo, pageSize);
IPage<ProcessInfoEO> result = this.baseMapper.queryPageList(page,params);
this.disposeData(result.getRecords(),cut);
return result;
}
@Override
public IPage doneProcess(Map<String, Object> params) {
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
String cut = (String) params.get("cut");
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> flowTypeList = new ArrayList<>();
this.setFlowTypeList(flowTypeList);
params.put("flowTypeList",flowTypeList);
params.put("taskStatus", TaskStatusEnum.HAVE_DONE.getValue());
params.put("currentUserId",currentUser.getId());
IPage page = new Page(pageNo, pageSize);
IPage<ProcessInfoEO> result = this.baseMapper.queryPageList(page,params);
this.disposeData(result.getRecords(),cut);
return result;
}
@Override
public IPage issuedProcess(Map<String, Object> params) {
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
String cut = (String) params.get("cut");
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
params.put("createBy",currentUser.getId());
List<String> flowTypeList = new ArrayList<>();
this.setFlowTypeList(flowTypeList);
params.put("flowTypeList",flowTypeList);
params.put("currentUserId",currentUser.getId());
IPage page = new Page(pageNo, pageSize);
IPage<ProcessInfoEO> result = this.baseMapper.queryPageList(page,params);
this.disposeData(result.getRecords(),cut);
return result;
}
public void setFlowTypeList(List<String> flowTypeList){
flowTypeList.add(FlowTypeEnum.QDQR.getValue());
flowTypeList.add(FlowTypeEnum.RWQRLC.getValue());
flowTypeList.add(FlowTypeEnum.SJFHXSHLC.getValue());
flowTypeList.add(FlowTypeEnum.YZFHXSCLC.getValue());
flowTypeList.add(FlowTypeEnum.PREHOMOQRLC.getValue());
}
public void disposeData(List<ProcessInfoEO> datas,String cut){
if(CollectionUtils.isNotEmpty(datas)){
List<String> processInfoIdList = datas.stream().map(ProcessInfoEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<ProcessInfoDetailEO> processInfoDetailQueryWrap = new QueryWrapper<>();
processInfoDetailQueryWrap.lambda().in(ProcessInfoDetailEO::getProcessInfoId,processInfoIdList);
List<ProcessInfoDetailEO> processInfoDetailEOList = this.processInfoDetailEOService.list(processInfoDetailQueryWrap);
Map<String, List<ProcessInfoDetailEO>> lastAssigneeDetailMap = processInfoDetailEOList.stream().filter(processInfoDetailEO -> {
boolean flag = false;
if(StringUtils.equals(processInfoDetailEO.getStatus(),TaskStatusEnum.HAVE_DONE.getValue()) && processInfoDetailEO.getSubmitTime() != null){
flag = true;
}
return flag;
}).collect(Collectors.groupingBy(ProcessInfoDetailEO::getProcessInfoId));
Map<String, List<ProcessInfoDetailEO>> assigneeDetailMap = processInfoDetailEOList.stream().filter(processInfoDetailEO -> {
boolean flag = false;
if(StringUtils.equals(processInfoDetailEO.getStatus(),TaskStatusEnum.NOT_DONE.getValue()) && processInfoDetailEO.getSubmitTime() == null){
flag = true;
}
return flag;
}).collect(Collectors.groupingBy(ProcessInfoDetailEO::getProcessInfoId));
List<String> userIdList = new ArrayList<>();
datas.forEach(data -> {
//设置上一个操作人。
for (Map.Entry<String, List<ProcessInfoDetailEO>> detailMap : lastAssigneeDetailMap.entrySet()) {
if(StringUtils.equals(data.getId(),detailMap.getKey())){
List<ProcessInfoDetailEO> detailEOList = detailMap.getValue();
Collections.sort(detailEOList,new Comparator<ProcessInfoDetailEO>(){
@Override
public int compare(ProcessInfoDetailEO o1, ProcessInfoDetailEO o2) {
return o2.getSubmitTime().compareTo(o1.getSubmitTime());
}
});
String userId = detailEOList.get(0).getUserId();
userIdList.add(userId);
data.setLastAssignee(userId);
break;
}
}
//设置当前操作人
for (Map.Entry<String, List<ProcessInfoDetailEO>> detailMap : assigneeDetailMap.entrySet()) {
if(StringUtils.equals(data.getId(),detailMap.getKey())){
List<ProcessInfoDetailEO> detailEOList = detailMap.getValue();
data.setAssignee(detailEOList.stream().map(ProcessInfoDetailEO::getUserId).collect(Collectors.joining(",")));
userIdList.addAll(detailEOList.stream().map(ProcessInfoDetailEO::getUserId).collect(Collectors.toList()));
break;
}
}
});
List<SysUser> sysUserList = this.sysUserService.querySysUserListByIdList(userIdList);
datas.forEach(data -> {
if(StringUtils.isNotEmpty(data.getFlowType())){
data.setFlowTypeShow(FlowTypeEnum.getTextByValue(data.getFlowType(),cut));
}
if(StringUtils.isNotEmpty(data.getStatus())){
data.setStatusShow(TodoCenterStatusEnum.getTextByValue(data.getStatus(),cut));
}
if(CollectionUtils.isNotEmpty(sysUserList)){
if(StringUtils.isNotEmpty(data.getLastAssignee())){
String lastUserName = sysUserList.stream().filter(sysUser -> {
boolean flag = false;
if (StringUtils.equals(data.getLastAssignee(), sysUser.getId())) {
flag = true;
}
return flag;
}).map(SysUser::getUsername).collect(Collectors.joining(","));
data.setLastAssigneeName(lastUserName);
}
if(StringUtils.isNotEmpty(data.getAssignee())){
String[] assigneeArr = data.getAssignee().split(",");
String currentUserName = sysUserList.stream().filter(sysUser -> {
boolean flag = false;
for (String assignee : assigneeArr) {
if (StringUtils.equals(assignee, sysUser.getId())) {
flag = true;
}
}
return flag;
}).map(SysUser::getUsername).collect(Collectors.joining(","));
data.setAssigneeName(currentUserName);
}
}
});
}
}
}
@@ -1,16 +1,21 @@
package com.jero.modules.wkflow.enums;
import com.jero.common.constant.enums.CutEnum;
import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum;
import org.apache.commons.lang3.StringUtils;
/**
* 流程类型枚举类
*/
public enum FlowTypeEnum {
RWQRLC("1","任务确认流程","RWQRLC","任务确认流程","rwqrlc"),
SJFHXSHLC("2","设计符合性审查流程","SJFHXSHLC","设计符合性审查流程","sjfhxlc"),
PREHOMOQRLC("3","prehomo确认流程","PREHOMOQRLC","prehomo确认流程","prehomoqrlc"),
YZFHXSCLC("4","验证符合性审查流程","YZFHXSCLC","验证符合性审查流程","yzfhxsclc"),
FGYJSJLC("5","法规意见收集流程","FGYJSJLC","法规意见收集流程","fgyjsjlc"),
FGJSPG("6","法规技术评估","FGJSPG","法规技术评估流程","fgjspglc"),
RWQRLC("1","任务确认流程","RWQRLC","任务确认流程","rwqrlc","清单任务确认","List task Confirmation"),
SJFHXSHLC("2","设计符合性审查流程","SJFHXSHLC","设计符合性审查流程","sjfhxlc","设计符合性确认","Design conformance verification"),
PREHOMOQRLC("3","prehomo确认流程","PREHOMOQRLC","prehomo确认流程","prehomoqrlc","Pre-Homo确认","The Pre - Homo confirmation"),
YZFHXSCLC("4","验证符合性审查流程","YZFHXSCLC","验证符合性审查流程","yzfhxsclc","验证符合性确认","Verify conformance confirmation"),
FGYJSJLC("5","法规意见收集流程","FGYJSJLC","法规意见收集流程","fgyjsjlc","法规意见收集","Collection of Legislative Comments"),
FGJSPG("6","法规技术评估流程","FGJSPG","法规技术评估流程","fgjspglc","法规技术评估","Regulatory and technical assessment"),
QDQR("10","清单确认","QDQR","清单确认流程","qdqr","法规清单确认","Regulation list confirmation"),
;
private String value;
@@ -18,13 +23,17 @@ public enum FlowTypeEnum {
private String prcNum;
private String prcName;
private String processDefinitionKey;
private String cnName;
private String enName;
private FlowTypeEnum(String value, String lable, String prcNum, String prcName, String processDefinitionKey) {
private FlowTypeEnum(String value, String lable, String prcNum, String prcName, String processDefinitionKey,String cnName,String enName) {
this.value = value;
this.lable = lable;
this.prcNum = prcNum;
this.prcName = prcName;
this.processDefinitionKey = processDefinitionKey;
this.cnName = cnName;
this.enName = enName;
}
public String getValue() {
return value;
@@ -43,4 +52,26 @@ public enum FlowTypeEnum {
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getCnName() {
return cnName;
}
public String getEnName() {
return enName;
}
public static String getTextByValue(String value, String cut) {
FlowTypeEnum[] values = values();
for (FlowTypeEnum flowTypeEnum : values) {
if (flowTypeEnum.value.equals(value)) {
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
return flowTypeEnum.cnName;
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
return flowTypeEnum.enName;
}
}
}
return null;
}
}