|
@@ -744,20 +744,66 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
flowApproveParam.setApproveUserIds(approveUserIds);
|
|
flowApproveParam.setApproveUserIds(approveUserIds);
|
|
}
|
|
}
|
|
|
|
|
|
- if (flowTaskResult.getSetup().intValue() == 3) {//内审时要set全部值
|
|
|
|
- FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
|
|
- FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(
|
|
|
|
- GsonUtil.toJson(flowResult.getSetupMap().get(flowTaskResult.getTaskKey())), FlowTaskResult.class);
|
|
|
|
- List<FlowFormWidgetResult> flowFormWidgetResultList = currFlowTaskResult.getFormProperty();
|
|
|
|
- Map<String, FlowFormWidgetResult> flowTaskResultMap = flowTaskResult.getFormProperty().stream().collect(
|
|
|
|
- Collectors.toMap(FlowFormWidgetResult::getFormId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
- for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
|
- if (flowTaskResultMap.containsKey(f.getFormId())) {
|
|
|
|
- f.setValue(flowTaskResultMap.get(f.getFormId()).getValue());
|
|
|
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
|
+ if (flowTaskResult.getSetup().intValue() == 2) {
|
|
|
|
+ List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
|
|
|
|
+ for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
|
+ if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey()) && Objects.nonNull(
|
|
|
|
+ f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
|
+ String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
|
+ tbCrmDetail.setScanStartTime(Long.parseLong(value));
|
|
|
|
+ } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_END_TIME.getKey()) && Objects.nonNull(
|
|
|
|
+ f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
|
+ String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
|
+ tbCrmDetail.setScanEndTime(Long.parseLong(value));
|
|
|
|
+ if (Objects.nonNull(tbCrmDetail.getScanStartTime())
|
|
|
|
+ && tbCrmDetail.getScanEndTime().longValue() <= tbCrmDetail.getScanStartTime()
|
|
|
|
+ .longValue()) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("扫描结束时间不能小于等于扫描开始时间");
|
|
|
|
+ }
|
|
|
|
+ } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_START_TIME.getKey()) && Objects.nonNull(
|
|
|
|
+ f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
|
+ String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
|
+ tbCrmDetail.setMarkPaperStartTime(Long.parseLong(value));
|
|
|
|
+ if (Objects.nonNull(tbCrmDetail.getScanEndTime())
|
|
|
|
+ && tbCrmDetail.getMarkPaperStartTime().longValue() <= tbCrmDetail.getScanEndTime()
|
|
|
|
+ .longValue()) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("阅卷开始时间不能小于等于扫描结束时间");
|
|
|
|
+ }
|
|
|
|
+ } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_END_TIME.getKey()) && Objects.nonNull(
|
|
|
|
+ f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
|
+ String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
|
+ tbCrmDetail.setMarkPaperEndTime(Long.parseLong(value));
|
|
|
|
+ if (Objects.nonNull(tbCrmDetail.getMarkPaperStartTime())
|
|
|
|
+ && tbCrmDetail.getMarkPaperEndTime().longValue() <= tbCrmDetail.getMarkPaperStartTime()
|
|
|
|
+ .longValue()) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("阅卷结束时间不能小于等于阅卷开始时间");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tbCrmDetail.updateInfo(sysUser.getId());
|
|
|
|
+ tbCrmDetailService.updateById(tbCrmDetail);
|
|
}
|
|
}
|
|
|
|
+ } else if (flowTaskResult.getSetup().intValue() == 3) {//内审时要set全部值
|
|
|
|
+ FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(),
|
|
|
|
+ FlowResult.class);
|
|
|
|
+ FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(
|
|
|
|
+ GsonUtil.toJson(flowResult.getSetupMap().get(flowTaskResult.getTaskKey())),
|
|
|
|
+ FlowTaskResult.class);
|
|
|
|
+ List<FlowFormWidgetResult> flowFormWidgetResultList = currFlowTaskResult.getFormProperty();
|
|
|
|
+ Map<String, FlowFormWidgetResult> flowTaskResultMap = flowTaskResult.getFormProperty().stream().collect(
|
|
|
|
+ Collectors.toMap(FlowFormWidgetResult::getFormId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
+ for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
|
+ if (flowTaskResultMap.containsKey(f.getFormId())) {
|
|
|
|
+ f.setValue(flowTaskResultMap.get(f.getFormId()).getValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ flowTaskResult.setFormProperty(flowFormWidgetResultList);
|
|
|
|
+ flowApproveParam.setFormProperties(JacksonUtil.parseJson(flowTaskResult));
|
|
}
|
|
}
|
|
- flowTaskResult.setFormProperty(flowFormWidgetResultList);
|
|
|
|
- flowApproveParam.setFormProperties(JacksonUtil.parseJson(flowTaskResult));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
String oldFlowProcessVar = tfCustomFlowEntity.getFlowProcessVar();
|
|
String oldFlowProcessVar = tfCustomFlowEntity.getFlowProcessVar();
|
|
@@ -856,6 +902,39 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 代理自动审批
|
|
|
|
+ *
|
|
|
|
+ * @param flowId
|
|
|
|
+ * @param sopNo
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ public void sopProxySystemApprove(Long flowId, String sopNo) throws InterruptedException {
|
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = Objects.nonNull(flowId) ?
|
|
|
|
+ tfCustomFlowEntityService.findByFlowId(flowId) :
|
|
|
|
+ tfCustomFlowEntityService.findByCode(sopNo);
|
|
|
|
+ Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
+ TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
|
|
|
|
+ Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
|
+ TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(tfCustomFlowEntity.getCode());
|
|
|
|
+ Objects.requireNonNull(tbCrmDetail, "未找到派单sop信息");
|
|
|
|
+ TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
|
|
|
|
+ Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ if (Objects.nonNull(tfFlowApprove.getStatus()) && (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH
|
|
|
|
+ || tfFlowApprove.getStatus() == FlowStatusEnum.END)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("流程已结束,无法自动审批");
|
|
|
|
+ }
|
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectInfo(tfCustomFlowEntity.getCode(),
|
|
|
|
+ tbCrmDetail.getId(), tfCustomFlowEntity.getCrmNo());
|
|
|
|
+ tbSopInfoService.sopSystemApprove(tfCustomFlow, tfCustomFlowEntity, tfFlowApprove, crmProjectResult,
|
|
|
|
+ tbCrmDetail.getCrmNo(), tbCrmDetail.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* sop管理列表
|
|
* sop管理列表
|
|
*
|
|
*
|
|
@@ -1265,13 +1344,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
}
|
|
}
|
|
- // FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
|
- // processLimitedTime = tfFlowApprove.getUpdateTime();
|
|
|
|
- // execField = ProcessLimitedEnum.FLOW_TASK.getKey();
|
|
|
|
tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(), sysUser.getId(),
|
|
tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(), sysUser.getId(),
|
|
tfCustomFlow.getType());
|
|
tfCustomFlow.getType());
|
|
} else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
|
|
} else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
|
|
-
|
|
|
|
|
|
+ FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
|
+ tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(), sysUser.getId(),
|
|
|
|
+ tfCustomFlow.getType());
|
|
}
|
|
}
|
|
if (Objects.nonNull(execField)) {
|
|
if (Objects.nonNull(execField)) {
|
|
for (Task task : taskList) {
|
|
for (Task task : taskList) {
|
|
@@ -1415,8 +1493,13 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(tfCustomFlowEntity.getCode());
|
|
TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(tfCustomFlowEntity.getCode());
|
|
Objects.requireNonNull(tbCrmDetail, "未找到派单sop信息");
|
|
Objects.requireNonNull(tbCrmDetail, "未找到派单sop信息");
|
|
|
|
|
|
- List<Long> enginessUserIds = new ArrayList<>();
|
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
|
|
|
+ List<Long> enginessUserIds = new ArrayList<>(), regionCoordinatorUserIds = new ArrayList<>(), projectManagerUserIds = new ArrayList<>();
|
|
|
|
+ FlowTaskResult flowTaskResult = null;
|
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {
|
|
|
|
+ flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
|
+ } else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
|
+ flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
|
+ }
|
|
List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
|
|
List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
|
|
for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey()) && Objects.nonNull(f.getValue())
|
|
if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey()) && Objects.nonNull(f.getValue())
|
|
@@ -1460,6 +1543,16 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
enginessUserIds.add(Long.parseLong(jsonArray.getString(i)));
|
|
enginessUserIds.add(Long.parseLong(jsonArray.getString(i)));
|
|
}
|
|
}
|
|
|
|
+ } else if (f.getFormId().contains(ProcessLimitedEnum.REGION_COORDINATOR_ID.getKey()) && Objects.nonNull(
|
|
|
|
+ f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
|
+ String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
|
+ regionCoordinatorUserIds.add(Long.parseLong(value));
|
|
|
|
+ } else if (f.getFormId().contains(ProcessLimitedEnum.PROJECT_MANAGER_ID.getKey()) && Objects.nonNull(
|
|
|
|
+ f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
|
+ String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
|
+ projectManagerUserIds.add(Long.parseLong(value));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END) {
|
|
if (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END) {
|
|
@@ -1481,8 +1574,11 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
map.put(SystemConstant.SOP_ID, tbSopInfo.getId());
|
|
map.put(SystemConstant.SOP_ID, tbSopInfo.getId());
|
|
map.put(SystemConstant.SOURCE, "save");
|
|
map.put(SystemConstant.SOURCE, "save");
|
|
tbSopInfoService.saveJobRemind(map);
|
|
tbSopInfoService.saveJobRemind(map);
|
|
- tbSopInfoService.saveSopPlanDate(flowTaskResult, tbSopInfo.getId(), tfCustomFlowEntity.getFlowId(),
|
|
|
|
- sysUser.getId(), tfCustomFlow.getType());
|
|
|
|
|
|
+
|
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
|
+ tbSopInfoService.saveSopPlanDate(this.getFormProperties(tfCustomFlowEntity, 1), tbSopInfo.getId(),
|
|
|
|
+ tfCustomFlowEntity.getFlowId(), sysUser.getId(), tfCustomFlow.getType());
|
|
|
|
+ }
|
|
|
|
|
|
//新增sop日志
|
|
//新增sop日志
|
|
if (!Objects.equals(oldFlowProcessVar, tfCustomFlowEntity.getFlowProcessVar())) {
|
|
if (!Objects.equals(oldFlowProcessVar, tfCustomFlowEntity.getFlowProcessVar())) {
|
|
@@ -1524,6 +1620,23 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
tbUserArchivesAllocationService.editCrmAllocation(
|
|
tbUserArchivesAllocationService.editCrmAllocation(
|
|
new UserArchivesAllocationParam(allocationParams, tbCrmDetail.getId()));
|
|
new UserArchivesAllocationParam(allocationParams, tbCrmDetail.getId()));
|
|
}
|
|
}
|
|
|
|
+ } else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
|
+ List<AllocationParam> allocationParams = new ArrayList<>();
|
|
|
|
+ if (!CollectionUtils.isEmpty(projectManagerUserIds)) {
|
|
|
|
+ allocationParams.add(
|
|
|
|
+ new AllocationParam(SopRoleTypeEnum.PROJECT_MANAGER, projectManagerUserIds, "[系统]"));
|
|
|
|
+ tbSopInfoService.sopApproverExchange(tbCrmDetail.getId(), new SopAllocationParam(
|
|
|
|
+ new UserArchivesAllocationParam(allocationParams, tbCrmDetail.getId())));
|
|
|
|
+ }
|
|
|
|
+ if (!CollectionUtils.isEmpty(enginessUserIds)) {
|
|
|
|
+ allocationParams.add(new AllocationParam(SopRoleTypeEnum.ENGINEER, enginessUserIds, "[系统]"));
|
|
|
|
+ }
|
|
|
|
+ if (!CollectionUtils.isEmpty(regionCoordinatorUserIds)) {
|
|
|
|
+ allocationParams.add(
|
|
|
|
+ new AllocationParam(SopRoleTypeEnum.REGION_COORDINATOR, regionCoordinatorUserIds, "[系统]"));
|
|
|
|
+ }
|
|
|
|
+ tbUserArchivesAllocationService.editCrmAllocation(
|
|
|
|
+ new UserArchivesAllocationParam(allocationParams, tbCrmDetail.getId()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!tbDingSubmitService.canUpdateDingSetting(tbSopInfo.getSopNo())) {
|
|
if (!tbDingSubmitService.canUpdateDingSetting(tbSopInfo.getSopNo())) {
|