|
@@ -303,11 +303,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(sopPublishParam));
|
|
|
tfCustomFlow = Objects.isNull(tfCustomFlow) ? (TFCustomFlow) map.get(SystemConstant.FLOW_CUSTOM) : tfCustomFlow;
|
|
|
TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
|
|
|
-
|
|
|
TBSopInfo tbSopInfo = new TBSopInfo(sopPublishParam.getCrmNo(), tfCustomFlowEntity.getCode(),
|
|
|
crmProjectResult.getServiceUnitId(), crmProjectResult.getCustomId(), crmProjectResult.getProductId(),
|
|
|
tfCustomFlow.getType(), SopStatusEnum.valueOf(sopPublishParam.getApprove().name()), sysUser.getId());
|
|
|
|
|
|
+ map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
+ map.put(SystemConstant.SOP_ID, tbSopInfo.getId());
|
|
|
+ tbSopInfoService.saveJobRemind(map);
|
|
|
tfCustomFlowEntity.setObjId(tbSopInfo.getId());
|
|
|
tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
|
|
|
tbCrmService.updateCrmStatus(sopPublishParam.getCrmNo(), CrmStatusEnum.PUBLISH);
|
|
@@ -500,9 +502,21 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
*/
|
|
|
@Override
|
|
|
public SopStatusEnum findBySopNo(String sopNo) {
|
|
|
+ TBSopInfo tbSopInfo = this.findByCode(sopNo);
|
|
|
+ return tbSopInfo.getStatus();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询sop信息
|
|
|
+ *
|
|
|
+ * @param sopNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TBSopInfo findByCode(String sopNo) {
|
|
|
TBSopInfo tbSopInfo = this.getOne(new QueryWrapper<TBSopInfo>().lambda().eq(TBSopInfo::getSopNo, sopNo));
|
|
|
Objects.requireNonNull(tbSopInfo, "未找到sop信息");
|
|
|
- return tbSopInfo.getStatus();
|
|
|
+ return tbSopInfo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -812,7 +826,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
map.put(SystemConstant.SOP_ID, tbSopInfo.getId());
|
|
|
- map.put(SystemConstant.SOURCE, "sopApprove");
|
|
|
tbSopInfoService.saveJobRemind(map);
|
|
|
|
|
|
//新增sop日志
|
|
@@ -1321,90 +1334,93 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
Long sopId = (Long) map.get(SystemConstant.SOP_ID);
|
|
|
List<Task> taskList = taskService.createTaskQuery()
|
|
|
.processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId())).list();
|
|
|
- if (!CollectionUtils.isEmpty(taskList) && (tfFlowApprove.getStatus() != FlowStatusEnum.DRAFT
|
|
|
- && tfFlowApprove.getStatus() != FlowStatusEnum.FINISH
|
|
|
+ if (!CollectionUtils.isEmpty(taskList) && (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH
|
|
|
&& tfFlowApprove.getStatus() != FlowStatusEnum.END)) {
|
|
|
Long processLimitedTime = null;
|
|
|
String execField = null;
|
|
|
- if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- if (tfFlowApprove.getSetup().intValue() == 2) {//扫描准备流程
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 3) {//扫描收尾检查
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.SCAN_END_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 4) {//阅卷参数检查
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 5) {//阅卷收尾检查
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
+ || tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//教务处sop
|
|
|
+ FlowTaskResult flowTaskResult = null;
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {
|
|
|
+ flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
+ } else {
|
|
|
+ flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
+ }
|
|
|
+ for (Task task : taskList) {
|
|
|
+ tsJobRemindService.updateJobRemind(Long.parseLong(task.getId()));
|
|
|
}
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
+ execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
+ createJobRemind(execField, processLimitedTime, taskList, tfCustomFlowEntity, tfCustomFlow, tfFlowLog,
|
|
|
+ sysUser.getId());
|
|
|
+
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
+ execField = ProcessLimitedEnum.SCAN_END_TIME.getKey();
|
|
|
+ createJobRemind(execField, processLimitedTime, taskList, tfCustomFlowEntity, tfCustomFlow, tfFlowLog,
|
|
|
+ sysUser.getId());
|
|
|
+
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
+ execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
+ createJobRemind(execField, processLimitedTime, taskList, tfCustomFlowEntity, tfCustomFlow, tfFlowLog,
|
|
|
+ sysUser.getId());
|
|
|
+
|
|
|
+ processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
+ execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
|
+ createJobRemind(execField, processLimitedTime, taskList, tfCustomFlowEntity, tfCustomFlow, tfFlowLog,
|
|
|
+ sysUser.getId());
|
|
|
tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(), sysUser.getId(),
|
|
|
tfCustomFlow.getType());
|
|
|
- } else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- if (tfFlowApprove.getSetup().intValue() == 5) {//扫描准备流程
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 6) {//扫描收尾检查
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.SCAN_END_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 7) {//阅卷参数检查
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 9) {//阅卷收尾检查
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
|
- }
|
|
|
- tbSopInfoService.saveSopPlanDate(this.getFormProperties(tfCustomFlowEntity, 1), sopId,
|
|
|
- tfCustomFlowEntity.getFlowId(), sysUser.getId(), tfCustomFlow.getType());
|
|
|
}
|
|
|
- if (Objects.nonNull(execField)) {
|
|
|
- for (Task task : taskList) {
|
|
|
- tsJobRemindService.updateJobRemind(Long.parseLong(task.getId()));
|
|
|
- List<TSJobRemind> tsJobRemindList = new ArrayList<>();
|
|
|
- if (Objects.nonNull(task.getAssignee())) {
|
|
|
- tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
- Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
- JobTypeEnum.BEFORE, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(),
|
|
|
- processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
- tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
- Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
- JobTypeEnum.AFTER, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(),
|
|
|
- processLimitedTime, execField, sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
- } else {
|
|
|
- List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
|
|
|
- if (!CollectionUtils.isEmpty(identityLinkList)) {
|
|
|
- for (IdentityLink i : identityLinkList) {
|
|
|
- tsJobRemindList.add(
|
|
|
- new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
- Long.parseLong(i.getTaskId()),
|
|
|
- tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
- JobTypeEnum.BEFORE, Long.parseLong(i.getUserId()),
|
|
|
- tfFlowLog.getApproveOperation(), processLimitedTime, execField,
|
|
|
- sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
- tsJobRemindList.add(
|
|
|
- new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
- Long.parseLong(i.getTaskId()),
|
|
|
- tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
- JobTypeEnum.AFTER, Long.parseLong(i.getUserId()),
|
|
|
- tfFlowLog.getApproveOperation(), processLimitedTime, execField,
|
|
|
- sysUser.getId(), tfCustomFlowEntity.getCrmNo()));
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建定时任务
|
|
|
+ *
|
|
|
+ * @param execField
|
|
|
+ * @param processLimitedTime
|
|
|
+ * @param taskList
|
|
|
+ * @param tfCustomFlowEntity
|
|
|
+ * @param tfCustomFlow
|
|
|
+ * @param tfFlowLog
|
|
|
+ * @param userId
|
|
|
+ */
|
|
|
+ protected void createJobRemind(String execField, Long processLimitedTime, List<Task> taskList,
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity, TFCustomFlow tfCustomFlow, TFFlowLog tfFlowLog, Long userId) {
|
|
|
+ if (Objects.nonNull(execField) && Objects.nonNull(processLimitedTime)) {
|
|
|
+ for (Task task : taskList) {
|
|
|
+ List<TSJobRemind> tsJobRemindList = new ArrayList<>();
|
|
|
+ if (Objects.nonNull(task.getAssignee())) {
|
|
|
+ tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
+ JobTypeEnum.BEFORE, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(),
|
|
|
+ processLimitedTime, execField, userId, tfCustomFlowEntity.getCrmNo()));
|
|
|
+ tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(task.getId()), tfCustomFlow.getType().getTitle() + ";" + task.getName(),
|
|
|
+ JobTypeEnum.AFTER, Long.parseLong(task.getAssignee()), tfFlowLog.getApproveOperation(),
|
|
|
+ processLimitedTime, execField, userId, tfCustomFlowEntity.getCrmNo()));
|
|
|
+ } else {
|
|
|
+ List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
|
|
|
+ if (!CollectionUtils.isEmpty(identityLinkList)) {
|
|
|
+ for (IdentityLink i : identityLinkList) {
|
|
|
+ tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(i.getTaskId()),
|
|
|
+ tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.BEFORE,
|
|
|
+ Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), processLimitedTime,
|
|
|
+ execField, userId, tfCustomFlowEntity.getCrmNo()));
|
|
|
+ tsJobRemindList.add(new TSJobRemind(JobQuartzTypeEnum.FLOW, tfCustomFlowEntity.getCode(),
|
|
|
+ Long.parseLong(i.getTaskId()),
|
|
|
+ tfCustomFlow.getType().getTitle() + ";" + task.getName(), JobTypeEnum.AFTER,
|
|
|
+ Long.parseLong(i.getUserId()), tfFlowLog.getApproveOperation(), processLimitedTime,
|
|
|
+ execField, userId, tfCustomFlowEntity.getCrmNo()));
|
|
|
}
|
|
|
}
|
|
|
- tsJobRemindService.saveJobRemind(tsJobRemindList);
|
|
|
}
|
|
|
+ tsJobRemindService.saveJobRemind(tsJobRemindList);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1603,10 +1619,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
tbCrmDetail.getId(), tfCustomFlowEntity.getCrmNo());
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
|
|
|
- TFFlowLog tfFlowLog = tfFlowLogService.getOne(
|
|
|
- new QueryWrapper<TFFlowLog>().lambda().eq(TFFlowLog::getFlowId, tfCustomFlowEntity.getFlowId())
|
|
|
- .last(" order by create_time limit 1 "));
|
|
|
- Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_LOG_NO_DATA.exception());
|
|
|
+ TFFlowLog tfFlowLog = tfFlowLogService.findByLastFlowLogByFlowId(tfCustomFlowEntity.getFlowId());
|
|
|
|
|
|
map.put(SystemConstant.FLOW_CUSTOM, tfCustomFlow);
|
|
|
map.put(SystemConstant.FLOW_ENTITY, tfCustomFlowEntity);
|
|
@@ -1614,7 +1627,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
map.put(SystemConstant.FLOW_APPROVE_LOG, tfFlowLog);
|
|
|
map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
map.put(SystemConstant.SOP_ID, tbSopInfo.getId());
|
|
|
- map.put(SystemConstant.SOURCE, "save");
|
|
|
tbSopInfoService.saveJobRemind(map);
|
|
|
|
|
|
if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
@@ -1733,10 +1745,10 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if (!fieldId.contains(ProcessLimitedEnum.SERVICE_FINISH_PLAN_BEGIN_DATE.getKey())) {
|
|
|
- Optional.ofNullable(processLimitedTime).orElseThrow(() -> ExceptionResultEnum.ERROR.exception(
|
|
|
- ProcessLimitedEnum.convertKeyToEnum(fieldId).getTitle() + "处理时限时间为空"));
|
|
|
- }
|
|
|
+ // if (!fieldId.contains(ProcessLimitedEnum.SERVICE_FINISH_PLAN_BEGIN_DATE.getKey())) {
|
|
|
+ // Optional.ofNullable(processLimitedTime).orElseThrow(() -> ExceptionResultEnum.ERROR.exception(
|
|
|
+ // ProcessLimitedEnum.convertKeyToEnum(fieldId).getTitle() + "处理时限时间为空"));
|
|
|
+ // }
|
|
|
return processLimitedTime;
|
|
|
}
|
|
|
|
|
@@ -1754,12 +1766,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
public void saveSopPlanDate(FlowTaskResult flowTaskResult, Long sopId, Long flowId, Long userId,
|
|
|
TFCustomTypeEnum type) {
|
|
|
Long serviceFinishPlanBeginDate = null, serviceFinishPlanEndDate = null;
|
|
|
- if (type == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
- serviceFinishPlanBeginDate = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SERVICE_FINISH_PLAN_BEGIN_DATE.getKey());
|
|
|
- serviceFinishPlanEndDate = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
- } else if (type == TFCustomTypeEnum.OFFICE_SOP_FLOW) {
|
|
|
+ if (type == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW || type == TFCustomTypeEnum.OFFICE_SOP_FLOW) {
|
|
|
serviceFinishPlanBeginDate = this.getProcessLimitedTime(flowTaskResult,
|
|
|
ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
serviceFinishPlanEndDate = this.getProcessLimitedTime(flowTaskResult,
|