|
|
|
@ -492,10 +492,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
taskData = taskList.get(0);
|
|
|
|
|
}
|
|
|
|
|
OcrTaskchildPicture childPicture = ocrTaskchildPictureService.getById(Long.parseLong(formId));
|
|
|
|
|
childPicture.setTaskNode(taskData.getDescription());
|
|
|
|
|
if (ObjectUtils.isEmpty(taskData)) {
|
|
|
|
|
model.setFinishtime(System.currentTimeMillis());
|
|
|
|
|
model.setStates(SystemConstantsOa.OA_STATUS_TYPE_END);
|
|
|
|
|
ocrTaskchildPictureService.updateById(model);
|
|
|
|
|
OcrPicture picture = ocrPictureService.getById(model.getPictureid());
|
|
|
|
|
ocrTaskchildPictureService.sendFlowTaskResult(childPicture, picture, approve);
|
|
|
|
|
} else {
|
|
|
|
@ -508,8 +508,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
this.sendMsg(childPicture, userToken);
|
|
|
|
|
childPicture.setTaskId(taskData.getId());
|
|
|
|
|
childPicture.setTaskname(taskData.getName());
|
|
|
|
|
ocrTaskchildPictureService.updateById(childPicture);
|
|
|
|
|
}
|
|
|
|
|
ocrTaskchildPictureService.updateById(childPicture);
|
|
|
|
|
//增加未查看记录
|
|
|
|
|
userViewApproeService.saveUserViewApproe(formData.getAssignee(), formData.getFormid().toString(), formData.getTenantid().toString());
|
|
|
|
|
|
|
|
|
@ -518,7 +518,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
/**
|
|
|
|
|
* 处理失败任务
|
|
|
|
|
*/
|
|
|
|
|
private void disposeFailureTask(Task task, String formId, Map<String, Object> variables, FlowApprove approve) throws Exception {
|
|
|
|
|
private void disposeFailureTask(Task task, String formId, Map<String, Object> variables, FlowApprove approve) throws
|
|
|
|
|
Exception {
|
|
|
|
|
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
|
|
|
|
|
//我这里以 流程定义key(oa_category_t定义的关键字,逻辑唯一) + 业务表主键(请假表、调岗表等) + 业务表对应的servicename
|
|
|
|
|
String businesskey = processInstance.getBusinessKey();
|
|
|
|
@ -587,7 +588,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
*
|
|
|
|
|
* @param processDefinition
|
|
|
|
|
*/
|
|
|
|
|
public void updateAssignee(String processInstanceId, String processDefinitionId, ProcessDefinition processDefinition,String deptid) {
|
|
|
|
|
public void updateAssignee(String processInstanceId, String processDefinitionId, ProcessDefinition
|
|
|
|
|
processDefinition,String deptid) {
|
|
|
|
|
|
|
|
|
|
//如果是多个候选人或者是候选组,做任务拾取
|
|
|
|
|
FlowTaskCompleteVO flowTaskCompleteVO = updateNowTaskAssignee(processInstanceId, processDefinitionId,deptid);
|
|
|
|
@ -1301,7 +1303,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
* @param tenantId
|
|
|
|
|
* @param pageUtils
|
|
|
|
|
*/
|
|
|
|
|
public void getMyProcessInstances(User user, String tenantId, Map<String, Object> searchQuery, PageUtils pageUtils, String userSearchId) {
|
|
|
|
|
public void getMyProcessInstances(User user, String tenantId, Map<String, Object> searchQuery, PageUtils
|
|
|
|
|
pageUtils, String userSearchId) {
|
|
|
|
|
ParamterPage paramterPage = new ParamterPage();
|
|
|
|
|
paramterPage.setStart((pageUtils.getCurrPage() - 1) * pageUtils.getPageSize());
|
|
|
|
|
paramterPage.setPagesize(pageUtils.getPageSize());
|
|
|
|
@ -1350,91 +1353,91 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
taskchildPicture.setPicture(ocrPictureOne);
|
|
|
|
|
taskchildPicture.setFinishTime(ocrPictureOne.getSubmitDateTimestamp());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询对应的流程分类
|
|
|
|
|
Category category = categoryService.selectDtoById(Long.parseLong(taskchildPicture.getCategoryid()));
|
|
|
|
|
taskchildPicture.setCategoryDto(category);
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(taskchildPicture.getProcessdefinitionid())) {
|
|
|
|
|
|
|
|
|
|
List<Task> taskList = this.nowRunTask(taskchildPicture.getProcessinstanceid(), taskchildPicture.getProcessdefinitionid());
|
|
|
|
|
if (null != taskList && !taskList.isEmpty()) {
|
|
|
|
|
taskchildPicture.setTaskId(taskList.get(0).getId());
|
|
|
|
|
|
|
|
|
|
Task tasknow = taskService.createTaskQuery().taskId(taskchildPicture.getTaskId()).singleResult();
|
|
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(tasknow.getProcessDefinitionId());
|
|
|
|
|
// 获取节点定义id
|
|
|
|
|
String taskDefinitionKey = tasknow.getTaskDefinitionKey();
|
|
|
|
|
// 根据节点定义id获取节点元素
|
|
|
|
|
FlowElement flowElement = bpmnModel.getFlowElement(taskDefinitionKey);
|
|
|
|
|
if (flowElement instanceof UserTask) {
|
|
|
|
|
UserTask userTask = (UserTask) flowElement;
|
|
|
|
|
|
|
|
|
|
taskchildPicture.setDocumentation(userTask.getDocumentation());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询历史
|
|
|
|
|
List<HistoricTaskInstanceDto> historicTaskInstanceDtos = new ArrayList<>();
|
|
|
|
|
// 查询当前任务的流转信息
|
|
|
|
|
List<HistoricTaskInstance> taskHiInstances = historyService.createHistoricTaskInstanceQuery()
|
|
|
|
|
.processInstanceId(taskchildPicture.getProcessinstanceid())
|
|
|
|
|
.includeProcessVariables()
|
|
|
|
|
.orderByHistoricTaskInstanceStartTime()
|
|
|
|
|
.asc()
|
|
|
|
|
.list();
|
|
|
|
|
for (HistoricTaskInstance taskHiInstance : taskHiInstances) {
|
|
|
|
|
HistoricTaskInstanceDto dto = new HistoricTaskInstanceDto();
|
|
|
|
|
dto.setTaskId(taskHiInstance.getId());
|
|
|
|
|
dto.setTaskName(taskHiInstance.getName());
|
|
|
|
|
dto.setFinishTime(taskHiInstance.getEndTime());
|
|
|
|
|
if (taskHiInstance.getDurationInMillis() != null) {
|
|
|
|
|
dto.setDuration(taskHiInstance.getDurationInMillis() / 1000 + "秒");
|
|
|
|
|
}
|
|
|
|
|
dto.setTaskDefKey(taskHiInstance.getTaskDefinitionKey());
|
|
|
|
|
|
|
|
|
|
//Map<String,Object> variables = taskHiInstance.getTaskLocalVariables();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> variables = taskHiInstance.getProcessVariables();
|
|
|
|
|
|
|
|
|
|
if (null != variables && null != variables.get("approvd")) {
|
|
|
|
|
dto.setState(variables.get("approvd").toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(taskHiInstance.getAssignee())) {
|
|
|
|
|
if (SystemConstantsOa.OA_TASK_SKIP_ASSIGINE.equals(taskHiInstance.getAssignee())) {
|
|
|
|
|
dto.setAssigneeName(taskHiInstance.getAssignee());
|
|
|
|
|
} else {
|
|
|
|
|
User user1 = userService.findByLoginname(taskHiInstance.getAssignee());
|
|
|
|
|
|
|
|
|
|
dto.setAssigneeName(user1.getUsername());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(taskchildPicture.getProcessdefinitionid());
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// //查询对应的流程分类
|
|
|
|
|
// Category category = categoryService.selectDtoById(Long.parseLong(taskchildPicture.getCategoryid()));
|
|
|
|
|
// taskchildPicture.setCategoryDto(category);
|
|
|
|
|
//
|
|
|
|
|
// if (StringUtils.isNotBlank(taskchildPicture.getProcessdefinitionid())) {
|
|
|
|
|
//
|
|
|
|
|
// List<Task> taskList = this.nowRunTask(taskchildPicture.getProcessinstanceid(), taskchildPicture.getProcessdefinitionid());
|
|
|
|
|
// if (null != taskList && !taskList.isEmpty()) {
|
|
|
|
|
// taskchildPicture.setTaskId(taskList.get(0).getId());
|
|
|
|
|
//
|
|
|
|
|
// Task tasknow = taskService.createTaskQuery().taskId(taskchildPicture.getTaskId()).singleResult();
|
|
|
|
|
// BpmnModel bpmnModel = repositoryService.getBpmnModel(tasknow.getProcessDefinitionId());
|
|
|
|
|
// // 获取节点定义id
|
|
|
|
|
// String taskDefinitionKey = tasknow.getTaskDefinitionKey();
|
|
|
|
|
// // 根据节点定义id获取节点元素
|
|
|
|
|
FlowElement flowElement = bpmnModel.getFlowElement(taskHiInstance.getTaskDefinitionKey());
|
|
|
|
|
if (flowElement instanceof UserTask) {
|
|
|
|
|
UserTask userTask = (UserTask) flowElement;
|
|
|
|
|
|
|
|
|
|
taskchildPicture.setDocumentation(userTask.getDocumentation());
|
|
|
|
|
}
|
|
|
|
|
// 还需要根据 HistoricTaskInstance 找到对应的 审批意见
|
|
|
|
|
List<Comment> processInstanceComments = taskService.getProcessInstanceComments(taskchildPicture.getProcessinstanceid());
|
|
|
|
|
for (Comment comment : processInstanceComments) {
|
|
|
|
|
|
|
|
|
|
if (comment.getTaskId().equals(taskHiInstance.getId())) {
|
|
|
|
|
// 审批意见
|
|
|
|
|
String fullMessage = comment.getFullMessage();
|
|
|
|
|
dto.setComment(fullMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
historicTaskInstanceDtos.add(dto);
|
|
|
|
|
}
|
|
|
|
|
taskchildPicture.setTransferRecords(historicTaskInstanceDtos);
|
|
|
|
|
}
|
|
|
|
|
// FlowElement flowElement = bpmnModel.getFlowElement(taskDefinitionKey);
|
|
|
|
|
// if (flowElement instanceof UserTask) {
|
|
|
|
|
// UserTask userTask = (UserTask) flowElement;
|
|
|
|
|
//
|
|
|
|
|
// taskchildPicture.setDocumentation(userTask.getDocumentation());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //查询历史
|
|
|
|
|
// List<HistoricTaskInstanceDto> historicTaskInstanceDtos = new ArrayList<>();
|
|
|
|
|
// // 查询当前任务的流转信息
|
|
|
|
|
// List<HistoricTaskInstance> taskHiInstances = historyService.createHistoricTaskInstanceQuery()
|
|
|
|
|
// .processInstanceId(taskchildPicture.getProcessinstanceid())
|
|
|
|
|
// .includeProcessVariables()
|
|
|
|
|
// .orderByHistoricTaskInstanceStartTime()
|
|
|
|
|
// .asc()
|
|
|
|
|
// .list();
|
|
|
|
|
// for (HistoricTaskInstance taskHiInstance : taskHiInstances) {
|
|
|
|
|
// HistoricTaskInstanceDto dto = new HistoricTaskInstanceDto();
|
|
|
|
|
// dto.setTaskId(taskHiInstance.getId());
|
|
|
|
|
// dto.setTaskName(taskHiInstance.getName());
|
|
|
|
|
// dto.setFinishTime(taskHiInstance.getEndTime());
|
|
|
|
|
// if (taskHiInstance.getDurationInMillis() != null) {
|
|
|
|
|
// dto.setDuration(taskHiInstance.getDurationInMillis() / 1000 + "秒");
|
|
|
|
|
// }
|
|
|
|
|
// dto.setTaskDefKey(taskHiInstance.getTaskDefinitionKey());
|
|
|
|
|
//
|
|
|
|
|
// //Map<String,Object> variables = taskHiInstance.getTaskLocalVariables();
|
|
|
|
|
//
|
|
|
|
|
// Map<String, Object> variables = taskHiInstance.getProcessVariables();
|
|
|
|
|
//
|
|
|
|
|
// if (null != variables && null != variables.get("approvd")) {
|
|
|
|
|
// dto.setState(variables.get("approvd").toString());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (StringUtils.isNotBlank(taskHiInstance.getAssignee())) {
|
|
|
|
|
// if (SystemConstantsOa.OA_TASK_SKIP_ASSIGINE.equals(taskHiInstance.getAssignee())) {
|
|
|
|
|
// dto.setAssigneeName(taskHiInstance.getAssignee());
|
|
|
|
|
// } else {
|
|
|
|
|
// User user1 = userService.findByLoginname(taskHiInstance.getAssignee());
|
|
|
|
|
//
|
|
|
|
|
// dto.setAssigneeName(user1.getUsername());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// BpmnModel bpmnModel = repositoryService.getBpmnModel(taskchildPicture.getProcessdefinitionid());
|
|
|
|
|
//
|
|
|
|
|
//// // 根据节点定义id获取节点元素
|
|
|
|
|
// FlowElement flowElement = bpmnModel.getFlowElement(taskHiInstance.getTaskDefinitionKey());
|
|
|
|
|
// if (flowElement instanceof UserTask) {
|
|
|
|
|
// UserTask userTask = (UserTask) flowElement;
|
|
|
|
|
//
|
|
|
|
|
// taskchildPicture.setDocumentation(userTask.getDocumentation());
|
|
|
|
|
// }
|
|
|
|
|
// // 还需要根据 HistoricTaskInstance 找到对应的 审批意见
|
|
|
|
|
// List<Comment> processInstanceComments = taskService.getProcessInstanceComments(taskchildPicture.getProcessinstanceid());
|
|
|
|
|
// for (Comment comment : processInstanceComments) {
|
|
|
|
|
//
|
|
|
|
|
// if (comment.getTaskId().equals(taskHiInstance.getId())) {
|
|
|
|
|
// // 审批意见
|
|
|
|
|
// String fullMessage = comment.getFullMessage();
|
|
|
|
|
// dto.setComment(fullMessage);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// historicTaskInstanceDtos.add(dto);
|
|
|
|
|
// }
|
|
|
|
|
// taskchildPicture.setTransferRecords(historicTaskInstanceDtos);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pageUtils.setTotalCount(count.intValue());
|
|
|
|
@ -1508,7 +1511,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
* @param tenantId
|
|
|
|
|
* @param pageUtils
|
|
|
|
|
*/
|
|
|
|
|
public List<OcrTaskchildPictureAppro> getMyProcessInstancesNew(User user, String tenantId, Map<String, Object> searchQuery, PageUtils pageUtils) {
|
|
|
|
|
public List<OcrTaskchildPictureAppro> getMyProcessInstancesNew(User user, String
|
|
|
|
|
tenantId, Map<String, Object> searchQuery, PageUtils pageUtils) {
|
|
|
|
|
ParamterPage paramterPage = new ParamterPage();
|
|
|
|
|
paramterPage.setStart((pageUtils.getCurrPage() - 1) * pageUtils.getPageSize());
|
|
|
|
|
paramterPage.setPagesize(pageUtils.getPageSize());
|
|
|
|
@ -1653,7 +1657,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public IPage<FlowUnionVo> getMyListCc(Map<String, Object> query, UserToken userToken, ParamterPage paramterPage) {
|
|
|
|
|
public IPage<FlowUnionVo> getMyListCc(Map<String, Object> query, UserToken userToken, ParamterPage
|
|
|
|
|
paramterPage) {
|
|
|
|
|
|
|
|
|
|
//查询抄送给当前用户的fromid集合
|
|
|
|
|
QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
|
@ -1857,7 +1862,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
* @param usersearchchild
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private QueryWrapper<OcrTaskchildPicture> formattingSearchChild(QueryWrapper<OcrTaskchildPicture> queryWrapper, OcrUsersearchchild usersearchchild) {
|
|
|
|
|
private QueryWrapper<OcrTaskchildPicture> formattingSearchChild
|
|
|
|
|
(QueryWrapper<OcrTaskchildPicture> queryWrapper, OcrUsersearchchild usersearchchild) {
|
|
|
|
|
switch (usersearchchild.getSearchRelationType()) {
|
|
|
|
|
case "where":
|
|
|
|
|
this.formattingSearchType(queryWrapper, usersearchchild);
|
|
|
|
@ -1881,7 +1887,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
* @param usersearchchild
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private QueryWrapper<OcrTaskchildPicture> formattingSearchType(QueryWrapper<OcrTaskchildPicture> queryWrapper, OcrUsersearchchild usersearchchild) {
|
|
|
|
|
private QueryWrapper<OcrTaskchildPicture> formattingSearchType
|
|
|
|
|
(QueryWrapper<OcrTaskchildPicture> queryWrapper, OcrUsersearchchild usersearchchild) {
|
|
|
|
|
//查询类型 相等true 不相等fase
|
|
|
|
|
boolean queryType = "eq".equals(usersearchchild.getSearchtype());
|
|
|
|
|
|
|
|
|
|