update 催办

This commit is contained in:
lijiarao
2024-01-10 15:34:46 +08:00
parent e017306845
commit 9e6fcdcce0
5 changed files with 47 additions and 7 deletions
@@ -118,6 +118,11 @@ public class ResultCommon {
*/
public static final String TASK_NOT_EXISTS = "task.not.exists";
/**
* 只能催办待办任务
*/
public static final String TASK_URGING_ERROR = "task.urging.error";
/**
* 草稿不存在
*/
@@ -17,16 +17,19 @@ import com.jero.modules.activiti.vo.DelegateTaskParam;
import com.jero.modules.activiti.vo.ResolveTaskParam;
import com.jero.common.api.vo.ResultCommon;
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.history.HistoricTaskInstanceQuery;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.activiti.mapper.ProcessAllMapper;
@@ -158,20 +161,49 @@ public class ProcessAllService extends ServiceImpl<ProcessAllMapper, ProcessAll>
}
public void urging(String taskId) {
if (StringUtils.isBlank(taskId)) {
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
}
//查询任务判断是否可以催办
List<String> taskIds = Arrays.asList(taskId.split(","));
LambdaQueryWrapper<ProcessApprovalRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ProcessApprovalRecord::getTaskId,taskId);
ProcessApprovalRecord approvalRecord = approvalRecordService.getOne(wrapper);
String processInstanceId = approvalRecord.getProcessInstanceId();
//获得流程总表
ProcessAll processAll = getByProcessInstanceId(processInstanceId);
wrapper.in(ProcessApprovalRecord::getTaskId, taskIds);
List<ProcessApprovalRecord> approvalRecordList = approvalRecordService.list(wrapper);
if (approvalRecordList.isEmpty()){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
for (ProcessApprovalRecord approvalRecord : approvalRecordList) {
Integer finishFlag = approvalRecord.getFinishFlag();
if (!FinishFlagEnum.INCOMPLETE.getValue().equals(finishFlag)){
throw new JeroBootException(ResultCommon.TASK_URGING_ERROR);
}
}
String processInstanceId = approvalRecordList.get(0).getProcessInstanceId();
//判断是否有权限
LambdaQueryWrapper<ProcessApprovalRecord> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.select(ProcessApprovalRecord::getUserId);
wrapper1.in(ProcessApprovalRecord::getProcessInstanceId, processInstanceId);
List<ProcessApprovalRecord> approvalRecordAllList = approvalRecordService.list(wrapper1);
List<String> canUrgingUserList = approvalRecordAllList.stream()
.map(ProcessApprovalRecord::getUserId)
.distinct()
.collect(Collectors.toList());
String loginUserId = CurrentUserUtil.getId();
if (!canUrgingUserList.contains(loginUserId)){
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
}
//获得流程总表,发送消息
ProcessAll processAll = getByProcessInstanceId(processInstanceId);
SendMessageDTO sendMessageDTO = new SendMessageDTO();
sendMessageDTO.setTemplateCode(MessageTemplateCodeCommon.URGING);
sendMessageDTO.setToUserId(approvalRecord.getUserId());
String userIds = approvalRecordList.stream().map(ProcessApprovalRecord::getUserId).collect(Collectors.joining(","));
sendMessageDTO.setToUserId(userIds);
Map<String, String> sendMap = new HashMap<>();
sendMap.put("prcNum", processAll.getPrcNum());
sendMap.put("prcName", processAll.getPrcName());
sendMessageDTO.setMap(sendMap);
sendMessageAPI.sendMessage(sendMessageDTO);
}
}
@@ -65,4 +65,5 @@ please.search.to.import=\u8BF7\u8F93\u5165\u68C0\u7D22\u5185\u5BB9
task.not.exists=\u4EFB\u52A1\u4E0D\u5B58\u5728
draft.not.exists=\u8349\u7A3F\u4E0D\u5B58\u5728
en.standard.number.conflict=\u4F01\u6807\u7F16\u53F7\u51B2\u7A81\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210
tag.add.error.2=\u6BCF\u5F20\u8868\u6700\u591A\u670950\u4E2A\u5B57\u6BB5\u3002
tag.add.error.2=\u6BCF\u5F20\u8868\u6700\u591A\u670950\u4E2A\u5B57\u6BB5\u3002
task.urging.error=\u53EA\u80FD\u50AC\u529E\u5F85\u529E\u4EFB\u52A1
@@ -71,3 +71,4 @@ task.not.exists=Task not exists
draft.not.exists=Draft not exists
en.standard.number.conflict=English standard number conflict
tag.add.error.2=each table can have a maximum of 50 fields.
task.urging.error=Can only remind to do tasks
@@ -71,3 +71,4 @@ task.not.exists=\u4EFB\u52A1\u4E0D\u5B58\u5728
draft.not.exists=\u8349\u7A3F\u4E0D\u5B58\u5728
en.standard.number.conflict=\u4F01\u6807\u7F16\u53F7\u51B2\u7A81\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210
tag.add.error.2=\u6BCF\u5F20\u8868\u6700\u591A\u670950\u4E2A\u5B57\u6BB5\u3002
task.urging.error=\u53EA\u80FD\u50AC\u529E\u5F85\u529E\u4EFB\u52A1