Commit 60b325e5 authored by 刘林's avatar 刘林

fix(jg):record添加跳转链接

parent a96fd127
...@@ -62,4 +62,7 @@ public class JgCertificateChangeRecordDto extends BaseModel { ...@@ -62,4 +62,7 @@ public class JgCertificateChangeRecordDto extends BaseModel {
@ApiModelProperty(value = "设备类别") @ApiModelProperty(value = "设备类别")
private String equCategory; private String equCategory;
@ApiModelProperty(value = "跳转路径")
private String routePath;
} }
...@@ -106,4 +106,10 @@ public class JgCertificateChangeRecord extends BaseEntity { ...@@ -106,4 +106,10 @@ public class JgCertificateChangeRecord extends BaseEntity {
@TableField("EQU_CATEGORY") @TableField("EQU_CATEGORY")
private String equCategory; private String equCategory;
/**
* 跳转路径
*/
@TableField("route_path")
private String routePath;
} }
...@@ -292,111 +292,123 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -292,111 +292,123 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) { if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空"); throw new IllegalArgumentException("参数不能为空");
} }
// 字段转换 try {
this.convertField(noticeDto); // 字段转换
JgInstallationNotice notice = this.getById(noticeDto.getSequenceNbr()); this.convertField(noticeDto);
this.checkRepeatUsed(submitType, notice); JgInstallationNotice notice = this.getById(noticeDto.getSequenceNbr());
if (SUBMIT_TYPE_FLOW.equals(submitType)) { this.checkRepeatUsed(submitType, notice);
if (!StringUtils.hasText(noticeDto.getInstanceId())) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程 if (!StringUtils.hasText(noticeDto.getInstanceId())) {
ProcessTaskDTO processTaskDTO = new ProcessTaskDTO(); // 发起流程
WorkflowResultDto workflowResultDto = new WorkflowResultDto(); ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
// 如果没有实例ID,说明是启动并执行一步 WorkflowResultDto workflowResultDto = new WorkflowResultDto();
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段 // 如果没有实例ID,说明是启动并执行一步
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO(); // 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
List<ActWorkflowStartDTO> list = new ArrayList<>(); ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); List<ActWorkflowStartDTO> list = new ArrayList<>();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setBusinessKey(noticeDto.getSequenceNbr().toString()); dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setCompleteFirstTask(Boolean.TRUE); dto.setBusinessKey(noticeDto.getSequenceNbr().toString());
// 下一节点执行人单位(下节点接收机构code) dto.setCompleteFirstTask(Boolean.TRUE);
dto.setNextExecuteUserCompanyCode(notice.getReceiveOrgCreditCode()); // 下一节点执行人单位(下节点接收机构code)
list.add(dto); dto.setNextExecuteUserCompanyCode(notice.getReceiveOrgCreditCode());
actWorkflowBatchDTO.setProcess(list); list.add(dto);
processTaskDTO = iCmWorkflowService.startBatch(actWorkflowBatchDTO).get(0); actWorkflowBatchDTO.setProcess(list);
// 提取节点等信息 processTaskDTO = iCmWorkflowService.startBatch(actWorkflowBatchDTO).get(0);
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0); // 提取节点等信息
BeanUtils.copyProperties(noticeDto, notice); workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) { BeanUtils.copyProperties(noticeDto, notice);
notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds()); if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
} else { notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds()); } else {
} notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
notice.setPromoter(RequestContext.getExeUserId()); }
notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds())); notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds()); notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds()));
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode())); notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
notice.setNextTaskId(workflowResultDto.getNextTaskId()); notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
notice.setInstanceId(workflowResultDto.getInstanceId()); notice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(notice); notice.setInstanceId(workflowResultDto.getInstanceId());
// 如果为保存并提交,则创建代办 this.updateById(notice);
buildTask(Collections.singletonList(notice), Collections.singletonList(workflowResultDto), Boolean.TRUE);
} else {
ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
// 只调用执行API,返回下个节点信息,用于填充业务字段
// 组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(notice.getNextTaskId());
HashMap<String, Object> commMap = new HashMap<>();
if (notice.getNoticeStatus().equals("6614") || notice.getNoticeStatus().equals("6615")) {
commMap.put("approvalStatus", "提交");
} else {
commMap.put("approvalStatus", op);
}
dto.setVariable(commMap);
// 下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(notice.getReceiveOrgCreditCode());
processTaskDTO = iCmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
} else {
notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
}
notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds()));
notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
notice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(notice);
// 上个代办改为已办
HashMap<String, Object> map = new HashMap<>();
map.put("taskStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
map.put("relationId", notice.getInstanceId());
map.put("flowStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
TaskV2Model taskV2Model = commonService.updateTaskModel(map);
if (ObjectUtils.isEmpty(taskV2Model)) {
// 如果为保存并提交,则创建代办 // 如果为保存并提交,则创建代办
buildTask(Collections.singletonList(notice), Collections.singletonList(workflowResultDto), Boolean.FALSE); buildTask(Collections.singletonList(notice), Collections.singletonList(workflowResultDto), Boolean.TRUE);
} else { } else {
TaskModelDto taskModelDto = new TaskModelDto(); ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
BeanUtils.copyProperties(taskV2Model, taskModelDto); WorkflowResultDto workflowResultDto = new WorkflowResultDto();
// 创建新的代办 // 只调用执行API,返回下个节点信息,用于填充业务字段
taskModelDto.setTaskName(workflowResultDto.getNextTaskName()); // 组装信息
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecutorUserIds()); TaskResultDTO dto = new TaskResultDTO();
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode()); dto.setResultCode("approvalStatus");
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName()); dto.setTaskId(notice.getNextTaskId());
taskModelDto.setFlowCode(notice.getNextTaskId()); HashMap<String, Object> commMap = new HashMap<>();
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorRoleIds()); if (notice.getNoticeStatus().equals("6614") || notice.getNoticeStatus().equals("6615")) {
TaskMessageDto taskMessageDto = new TaskMessageDto(); commMap.put("approvalStatus", "提交");
BeanUtils.copyProperties(notice, taskMessageDto); } else {
taskModelDto.setModel(taskMessageDto); commMap.put("approvalStatus", op);
commonService.buildTaskModel(Collections.singletonList(taskModelDto)); }
dto.setVariable(commMap);
// 下一节点执行人单位(下节点接收机构code)
dto.setNextExecuteUserCompanyCode(notice.getReceiveOrgCreditCode());
processTaskDTO = iCmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, op);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
} else {
notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
}
notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds()));
notice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
notice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(notice);
// 上个代办改为已办
HashMap<String, Object> map = new HashMap<>();
map.put("taskStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
map.put("relationId", notice.getInstanceId());
map.put("flowStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
TaskV2Model taskV2Model = commonService.updateTaskModel(map);
if (ObjectUtils.isEmpty(taskV2Model)) {
// 如果为保存并提交,则创建代办
buildTask(Collections.singletonList(notice), Collections.singletonList(workflowResultDto), Boolean.FALSE);
} else {
TaskModelDto taskModelDto = new TaskModelDto();
BeanUtils.copyProperties(taskV2Model, taskModelDto);
// 创建新的代办
taskModelDto.setTaskName(workflowResultDto.getNextTaskName());
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setFlowCode(notice.getNextTaskId());
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorRoleIds());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(notice, taskMessageDto);
taskModelDto.setModel(taskMessageDto);
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
}
} }
commonService.saveExecuteFlowData2Redis(notice.getInstanceId(), this.buildInstanceRuntimeData(notice));
} else {
JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto, bean);
this.updateById(bean);
} }
commonService.saveExecuteFlowData2Redis(notice.getInstanceId(), this.buildInstanceRuntimeData(notice)); return noticeDto;
} else { } catch (BadRequest | LocalBadRequest e) {
JgInstallationNotice bean = new JgInstallationNotice(); log.error(e.getMessage(), e);
BeanUtils.copyProperties(noticeDto, bean); this.rollBackForDelRedisData();
this.updateById(bean); throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!");
} finally {
FlowingEquipRedisContext.clean();
} }
return noticeDto;
} }
private void checkRepeatUsed(String submitType, JgInstallationNotice jgInstallationNotice) { private void checkRepeatUsed(String submitType, JgInstallationNotice jgInstallationNotice) {
...@@ -455,7 +467,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -455,7 +467,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
for (Long sequenceNbr : sequenceNbrs) { for (Long sequenceNbr : sequenceNbrs) {
// 删除待办 + 中止流程 // 删除待办 + 中止流程
JgInstallationNotice jgInstallationNotice = this.baseMapper.selectById(sequenceNbr); JgInstallationNotice jgInstallationNotice = this.baseMapper.selectById(sequenceNbr);
commonService.deleteTaskModel(String.valueOf(sequenceNbr),jgInstallationNotice.getInstanceId()); commonService.deleteTaskModel(String.valueOf(sequenceNbr), jgInstallationNotice.getInstanceId());
// 删除业务单 // 删除业务单
jgInstallationNotice.setIsDelete(true); jgInstallationNotice.setIsDelete(true);
this.getBaseMapper().deleteById(sequenceNbr); this.getBaseMapper().deleteById(sequenceNbr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment