update 催办
This commit is contained in:
@@ -118,6 +118,11 @@ public class ResultCommon {
|
|||||||
*/
|
*/
|
||||||
public static final String TASK_NOT_EXISTS = "task.not.exists";
|
public static final String TASK_NOT_EXISTS = "task.not.exists";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只能催办待办任务
|
||||||
|
*/
|
||||||
|
public static final String TASK_URGING_ERROR = "task.urging.error";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 草稿不存在
|
* 草稿不存在
|
||||||
*/
|
*/
|
||||||
|
|||||||
+38
-6
@@ -17,16 +17,19 @@ import com.jero.modules.activiti.vo.DelegateTaskParam;
|
|||||||
import com.jero.modules.activiti.vo.ResolveTaskParam;
|
import com.jero.modules.activiti.vo.ResolveTaskParam;
|
||||||
import com.jero.common.api.vo.ResultCommon;
|
import com.jero.common.api.vo.ResultCommon;
|
||||||
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
|
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.HistoryService;
|
||||||
import org.activiti.engine.RuntimeService;
|
import org.activiti.engine.RuntimeService;
|
||||||
import org.activiti.engine.TaskService;
|
import org.activiti.engine.TaskService;
|
||||||
import org.activiti.engine.history.HistoricTaskInstance;
|
import org.activiti.engine.history.HistoricTaskInstance;
|
||||||
import org.activiti.engine.history.HistoricTaskInstanceQuery;
|
import org.activiti.engine.history.HistoricTaskInstanceQuery;
|
||||||
import org.activiti.engine.task.Task;
|
import org.activiti.engine.task.Task;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.modules.activiti.mapper.ProcessAllMapper;
|
import com.jero.modules.activiti.mapper.ProcessAllMapper;
|
||||||
@@ -158,20 +161,49 @@ public class ProcessAllService extends ServiceImpl<ProcessAllMapper, ProcessAll>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void urging(String taskId) {
|
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<>();
|
LambdaQueryWrapper<ProcessApprovalRecord> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(ProcessApprovalRecord::getTaskId,taskId);
|
wrapper.in(ProcessApprovalRecord::getTaskId, taskIds);
|
||||||
ProcessApprovalRecord approvalRecord = approvalRecordService.getOne(wrapper);
|
List<ProcessApprovalRecord> approvalRecordList = approvalRecordService.list(wrapper);
|
||||||
String processInstanceId = approvalRecord.getProcessInstanceId();
|
if (approvalRecordList.isEmpty()){
|
||||||
//获得流程总表
|
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||||
ProcessAll processAll = getByProcessInstanceId(processInstanceId);
|
}
|
||||||
|
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 sendMessageDTO = new SendMessageDTO();
|
||||||
sendMessageDTO.setTemplateCode(MessageTemplateCodeCommon.URGING);
|
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<>();
|
Map<String, String> sendMap = new HashMap<>();
|
||||||
sendMap.put("prcNum", processAll.getPrcNum());
|
sendMap.put("prcNum", processAll.getPrcNum());
|
||||||
sendMap.put("prcName", processAll.getPrcName());
|
sendMap.put("prcName", processAll.getPrcName());
|
||||||
sendMessageDTO.setMap(sendMap);
|
sendMessageDTO.setMap(sendMap);
|
||||||
sendMessageAPI.sendMessage(sendMessageDTO);
|
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
|
task.not.exists=\u4EFB\u52A1\u4E0D\u5B58\u5728
|
||||||
draft.not.exists=\u8349\u7A3F\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
|
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
|
draft.not.exists=Draft not exists
|
||||||
en.standard.number.conflict=English standard number conflict
|
en.standard.number.conflict=English standard number conflict
|
||||||
tag.add.error.2=each table can have a maximum of 50 fields.
|
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
|
draft.not.exists=\u8349\u7A3F\u4E0D\u5B58\u5728
|
||||||
en.standard.number.conflict=\u4F01\u6807\u7F16\u53F7\u51B2\u7A81\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user