|
@@ -232,45 +232,113 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
return this.baseMapper.selectDynamicSop(tableName, flowDeploymentId, flowId);
|
|
|
}
|
|
|
|
|
|
+ // /**
|
|
|
+ // * sop发布信息
|
|
|
+ // *
|
|
|
+ // * @param sopPublishParam
|
|
|
+ // * @return
|
|
|
+ // * @throws InterruptedException
|
|
|
+ // */
|
|
|
+ // @Override
|
|
|
+ // @Transactional
|
|
|
+ // @Deprecated
|
|
|
+ // public Boolean sopPublish(SopPublishParam sopPublishParam) throws InterruptedException {
|
|
|
+ // Optional.ofNullable(sopPublishParam.getCrmNo())
|
|
|
+ // .orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
+ //// if (sopPublishParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
+ //// throw ExceptionResultEnum.PARAMS_ERROR.exception("sop发布只能为草稿");
|
|
|
+ //// }
|
|
|
+ // return tbSopInfoService.sopApplyOrPublish(sopPublishParam.getSopNo(), sopPublishParam.getCrmNo(),
|
|
|
+ // sopPublishParam.getFlowDeploymentId(), sopPublishParam.getApprove(),
|
|
|
+ // sopPublishParam.getFormProperties());
|
|
|
+ // }
|
|
|
+
|
|
|
/**
|
|
|
* sop发布信息
|
|
|
*
|
|
|
* @param sopPublishParam
|
|
|
* @return
|
|
|
- * @throws InterruptedException
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Boolean sopPublish(SopPublishParam sopPublishParam) throws InterruptedException {
|
|
|
- Optional.ofNullable(sopPublishParam.getCrmNo())
|
|
|
- .orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
- if (sopPublishParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
- throw ExceptionResultEnum.PARAMS_ERROR.exception("sop发布只能为草稿");
|
|
|
+ public String sopPublish(SopPublishParam sopPublishParam) throws InterruptedException {
|
|
|
+ Objects.requireNonNull(sopPublishParam.getCrmNo(), "crm编号不能为空");
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopPublishParam.getSopNo(),
|
|
|
+ sopPublishParam.getCrmNo());
|
|
|
+ Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
+
|
|
|
+ //todo 项目经理、工程师待验证
|
|
|
+ // Optional.ofNullable(crmProjectResult.getRegionManagerId())
|
|
|
+ // .orElseThrow(() -> ExceptionResultEnum.ERROR.exception("该派单号[" + crmNo + "]未设置大区经理"));
|
|
|
+ //TODO 测试人员
|
|
|
+ sopPublishParam.setApproveUserIds(Arrays.asList("517302850875817984"));
|
|
|
+
|
|
|
+ TBService tbService = tbServiceService.getById(crmProjectResult.getServiceUnitId());
|
|
|
+ Optional.ofNullable(tbService).orElseThrow(() -> ExceptionResultEnum.SERVICE_NO_DATA.exception());
|
|
|
+ Optional.ofNullable(tbService.getStatus()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("服务单元状态为空"));
|
|
|
+
|
|
|
+ if (Objects.isNull(tbService.getEnable()) || !tbService.getEnable()) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("服务单元已作废");
|
|
|
+ }
|
|
|
+ if (tbService.getStatus() != ServiceStatusEnum.PUBLISH) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("只有发布状态的服务单元才能新增sop");
|
|
|
}
|
|
|
- return tbSopInfoService.sopApplyOrPublish(sopPublishParam.getSopNo(), sopPublishParam.getCrmNo(),
|
|
|
- sopPublishParam.getFlowDeploymentId(), sopPublishParam.getApprove(),
|
|
|
- sopPublishParam.getFormProperties());
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * sop申请信息
|
|
|
- *
|
|
|
- * @param sopApplyParam
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public Boolean sopApply(SopApplyParam sopApplyParam) throws InterruptedException {
|
|
|
- Optional.ofNullable(sopApplyParam.getCrmNo())
|
|
|
- .orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
- if (sopApplyParam.getApprove() != FlowApprovePassEnum.START
|
|
|
- && sopApplyParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
- throw ExceptionResultEnum.PARAMS_ERROR.exception("sop申请只能为提交或草稿");
|
|
|
+ TFCustomFlow tfCustomFlow = tfCustomFlowService.getOne(new QueryWrapper<TFCustomFlow>().lambda()
|
|
|
+ .eq(TFCustomFlow::getFlowDeploymentId, sopPublishParam.getFlowDeploymentId()));
|
|
|
+ Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
+ TFCustomFlow maxTfCustomFlow = tfCustomFlowService.findMaxVersion(null, null, tfCustomFlow.getType());
|
|
|
+ Optional.ofNullable(maxTfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
+ if (maxTfCustomFlow.getVersion().intValue() != tfCustomFlow.getVersion().intValue()) {//说明版本发生变化
|
|
|
+ BeanUtils.copyProperties(maxTfCustomFlow, tfCustomFlow);
|
|
|
}
|
|
|
- return tbSopInfoService.sopApplyOrPublish(sopApplyParam.getSopNo(), sopApplyParam.getCrmNo(),
|
|
|
- sopApplyParam.getFlowDeploymentId(), sopApplyParam.getApprove(), sopApplyParam.getFormProperties());
|
|
|
+
|
|
|
+ if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
+ && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("sop流程类型错误");
|
|
|
+ }
|
|
|
+ Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(sopPublishParam));
|
|
|
+ map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
+
|
|
|
+ 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);
|
|
|
+ tbSopInfoService.save(tbSopInfo);
|
|
|
+ return tfCustomFlowEntity.getCode();
|
|
|
}
|
|
|
|
|
|
+ // /**
|
|
|
+ // * sop申请信息
|
|
|
+ // *
|
|
|
+ // * @param sopApplyParam
|
|
|
+ // * @return
|
|
|
+ // */
|
|
|
+ // @Override
|
|
|
+ // @Transactional
|
|
|
+ // @Deprecated
|
|
|
+ // public Boolean sopApply(SopApplyParam sopApplyParam) throws InterruptedException {
|
|
|
+ // Optional.ofNullable(sopApplyParam.getCrmNo())
|
|
|
+ // .orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("crm编号不能为空"));
|
|
|
+ // if (sopApplyParam.getApprove() != FlowApprovePassEnum.START
|
|
|
+ // && sopApplyParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
|
+ // throw ExceptionResultEnum.PARAMS_ERROR.exception("sop申请只能为提交或草稿");
|
|
|
+ // }
|
|
|
+ // return tbSopInfoService.sopApplyOrPublish(sopApplyParam.getSopNo(), sopApplyParam.getCrmNo(),
|
|
|
+ // sopApplyParam.getFlowDeploymentId(), sopApplyParam.getApprove(), sopApplyParam.getFormProperties());
|
|
|
+ // }
|
|
|
+
|
|
|
/**
|
|
|
* sop填报信息
|
|
|
*
|
|
@@ -837,105 +905,106 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
// return map;
|
|
|
// }
|
|
|
|
|
|
- /**
|
|
|
- * sop申请或发布
|
|
|
- *
|
|
|
- * @param sopNo
|
|
|
- * @param crmNo
|
|
|
- * @param flowDeploymentId
|
|
|
- * @param approve
|
|
|
- * @param formProperties
|
|
|
- * @return
|
|
|
- * @throws InterruptedException
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public Boolean sopApplyOrPublish(String sopNo, String crmNo, String flowDeploymentId, FlowApprovePassEnum approve,
|
|
|
- String formProperties) throws InterruptedException {
|
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
|
|
|
- Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
- Optional.ofNullable(crmProjectResult.getRegionManagerId())
|
|
|
- .orElseThrow(() -> ExceptionResultEnum.ERROR.exception("该派单号[" + crmNo + "]未设置大区经理"));
|
|
|
-
|
|
|
- TBService tbService = tbServiceService.getById(crmProjectResult.getServiceUnitId());
|
|
|
- Optional.ofNullable(tbService).orElseThrow(() -> ExceptionResultEnum.SERVICE_NO_DATA.exception());
|
|
|
- Optional.ofNullable(tbService.getStatus()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("服务单元状态为空"));
|
|
|
-
|
|
|
- if (Objects.isNull(tbService.getEnable()) || !tbService.getEnable()) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("服务单元已作废");
|
|
|
- }
|
|
|
- if (tbService.getStatus() != ServiceStatusEnum.PUBLISH) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("只有发布状态的服务单元才能新增sop");
|
|
|
- }
|
|
|
-
|
|
|
- TFCustomFlow tfCustomFlow = null;
|
|
|
- TBSopInfoDetail tbSopInfoDetail = null;
|
|
|
- List<String> approveUserIds = new ArrayList<>();
|
|
|
- if (approve == FlowApprovePassEnum.DRAFT) {
|
|
|
- approveUserIds.add(String.valueOf(crmProjectResult.getRegionManagerId()));
|
|
|
- } else if (approve == FlowApprovePassEnum.START) {
|
|
|
- Optional.ofNullable(formProperties)
|
|
|
- .orElseThrow(() -> ExceptionResultEnum.FLOW_FORM_PROPERTIES_IS_NULL.exception());
|
|
|
-
|
|
|
- tfCustomFlow = tfCustomFlowService.getOne(
|
|
|
- new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getFlowDeploymentId, flowDeploymentId));
|
|
|
- Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
- TFCustomFlow maxTfCustomFlow = tfCustomFlowService.findMaxVersion(null, null, tfCustomFlow.getType());
|
|
|
- Optional.ofNullable(maxTfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
- if (maxTfCustomFlow.getVersion().intValue() != tfCustomFlow.getVersion().intValue()) {//说明版本发生变化
|
|
|
- BeanUtils.copyProperties(maxTfCustomFlow, tfCustomFlow);
|
|
|
- }
|
|
|
-
|
|
|
- if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
- && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("sop流程类型错误");
|
|
|
- }
|
|
|
-
|
|
|
- FlowTaskResult flowTaskResult = JSONObject.parseObject(formProperties, FlowTaskResult.class);
|
|
|
- // Map<String, Object> map = this.getApproveUserIds(flowTaskResult);
|
|
|
- // Long regionUserId = (Long) map.get(SystemConstant.REGION_USER_ID);
|
|
|
- // Long engineerUserId = (Long) map.get(SystemConstant.ENGINEER_USER_ID);
|
|
|
- // String assistantEngineerUserIds = (String) map.get(SystemConstant.ASSISTANT_ENGINEER_USER_ID);
|
|
|
- // tbSopInfoDetail = new TBSopInfoDetail(crmProjectResult.getRegionManagerId(), regionUserId, engineerUserId,
|
|
|
- // assistantEngineerUserIds);
|
|
|
- approveUserIds = this.getNextApproveUserIds(tfCustomFlow.getType(), flowTaskResult, tbSopInfoDetail, null);
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> map = activitiService.taskApprove(
|
|
|
- new FlowApproveParam(flowDeploymentId, approve, approveUserIds, crmNo, formProperties));
|
|
|
- if (approve != FlowApprovePassEnum.DRAFT) {
|
|
|
- map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
- map.put(SystemConstant.SOP_ID, null);
|
|
|
- map.put(SystemConstant.SOURCE, "sopApplyOrPublish");
|
|
|
- tbSopInfoService.saveJobRemind(map);
|
|
|
- }
|
|
|
-
|
|
|
- tfCustomFlow = Objects.isNull(tfCustomFlow) ? (TFCustomFlow) map.get(SystemConstant.FLOW_CUSTOM) : tfCustomFlow;
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
|
|
|
-
|
|
|
- TBSopInfo tbSopInfo = new TBSopInfo(crmNo, tfCustomFlowEntity.getCode(), crmProjectResult.getServiceUnitId(),
|
|
|
- crmProjectResult.getCustomId(), crmProjectResult.getProductId(), tfCustomFlow.getType(),
|
|
|
- SopStatusEnum.valueOf(approve.name()), sysUser.getId());
|
|
|
- if (Objects.isNull(tbSopInfoDetail)) {
|
|
|
- tbSopInfoDetail = new TBSopInfoDetail(tbSopInfo.getId(), crmProjectResult.getRegionManagerId());
|
|
|
- } else {
|
|
|
- tbSopInfoDetail.setSopInfoId(tbSopInfo.getId());
|
|
|
- }
|
|
|
- tbSopInfoDetailService.save(tbSopInfoDetail);
|
|
|
- TBSopPlanDateLog tbSopPlanDateLog = tbSopPlanDateLogService.getOne(new QueryWrapper<TBSopPlanDateLog>().lambda()
|
|
|
- .eq(TBSopPlanDateLog::getFlowId, tfCustomFlowEntity.getFlowId())
|
|
|
- .orderByDesc(TBSopPlanDateLog::getCreateTime).last(" limit 1 "));
|
|
|
- if (Objects.nonNull(tbSopPlanDateLog)) {
|
|
|
- tbSopPlanDateLog.setSopId(tbSopInfo.getId());
|
|
|
- tbSopPlanDateLogService.updateById(tbSopPlanDateLog);
|
|
|
- }
|
|
|
-
|
|
|
- tfCustomFlowEntity.setObjId(tbSopInfo.getId());
|
|
|
- tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
|
|
|
- tbCrmService.updateCrmStatus(crmNo, CrmStatusEnum.PUBLISH);
|
|
|
- return tbSopInfoService.save(tbSopInfo);
|
|
|
- }
|
|
|
+ // /**
|
|
|
+ // * sop申请或发布
|
|
|
+ // *
|
|
|
+ // * @param sopNo
|
|
|
+ // * @param crmNo
|
|
|
+ // * @param flowDeploymentId
|
|
|
+ // * @param approve
|
|
|
+ // * @param formProperties
|
|
|
+ // * @return
|
|
|
+ // * @throws InterruptedException
|
|
|
+ // */
|
|
|
+ // @Override
|
|
|
+ // @Transactional
|
|
|
+ // @Deprecated
|
|
|
+ // public Boolean sopApplyOrPublish(String sopNo, String crmNo, String flowDeploymentId, FlowApprovePassEnum approve,
|
|
|
+ // String formProperties) throws InterruptedException {
|
|
|
+ // SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ // CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
|
|
|
+ // Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
+ // Optional.ofNullable(crmProjectResult.getRegionManagerId())
|
|
|
+ // .orElseThrow(() -> ExceptionResultEnum.ERROR.exception("该派单号[" + crmNo + "]未设置大区经理"));
|
|
|
+ //
|
|
|
+ // TBService tbService = tbServiceService.getById(crmProjectResult.getServiceUnitId());
|
|
|
+ // Optional.ofNullable(tbService).orElseThrow(() -> ExceptionResultEnum.SERVICE_NO_DATA.exception());
|
|
|
+ // Optional.ofNullable(tbService.getStatus()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("服务单元状态为空"));
|
|
|
+ //
|
|
|
+ // if (Objects.isNull(tbService.getEnable()) || !tbService.getEnable()) {
|
|
|
+ // throw ExceptionResultEnum.ERROR.exception("服务单元已作废");
|
|
|
+ // }
|
|
|
+ // if (tbService.getStatus() != ServiceStatusEnum.PUBLISH) {
|
|
|
+ // throw ExceptionResultEnum.ERROR.exception("只有发布状态的服务单元才能新增sop");
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // TFCustomFlow tfCustomFlow = null;
|
|
|
+ // TBSopInfoDetail tbSopInfoDetail = null;
|
|
|
+ // List<String> approveUserIds = new ArrayList<>();
|
|
|
+ // if (approve == FlowApprovePassEnum.DRAFT) {
|
|
|
+ // approveUserIds.add(String.valueOf(crmProjectResult.getRegionManagerId()));
|
|
|
+ // } else if (approve == FlowApprovePassEnum.START) {
|
|
|
+ // Optional.ofNullable(formProperties)
|
|
|
+ // .orElseThrow(() -> ExceptionResultEnum.FLOW_FORM_PROPERTIES_IS_NULL.exception());
|
|
|
+ //
|
|
|
+ // tfCustomFlow = tfCustomFlowService.getOne(
|
|
|
+ // new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getFlowDeploymentId, flowDeploymentId));
|
|
|
+ // Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
+ // TFCustomFlow maxTfCustomFlow = tfCustomFlowService.findMaxVersion(null, null, tfCustomFlow.getType());
|
|
|
+ // Optional.ofNullable(maxTfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_CUSTOM_NO_DATA.exception());
|
|
|
+ // if (maxTfCustomFlow.getVersion().intValue() != tfCustomFlow.getVersion().intValue()) {//说明版本发生变化
|
|
|
+ // BeanUtils.copyProperties(maxTfCustomFlow, tfCustomFlow);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if (tfCustomFlow.getType() != TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
+ // && tfCustomFlow.getType() != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
+ // throw ExceptionResultEnum.ERROR.exception("sop流程类型错误");
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // FlowTaskResult flowTaskResult = JSONObject.parseObject(formProperties, FlowTaskResult.class);
|
|
|
+ // // Map<String, Object> map = this.getApproveUserIds(flowTaskResult);
|
|
|
+ // // Long regionUserId = (Long) map.get(SystemConstant.REGION_USER_ID);
|
|
|
+ // // Long engineerUserId = (Long) map.get(SystemConstant.ENGINEER_USER_ID);
|
|
|
+ // // String assistantEngineerUserIds = (String) map.get(SystemConstant.ASSISTANT_ENGINEER_USER_ID);
|
|
|
+ // // tbSopInfoDetail = new TBSopInfoDetail(crmProjectResult.getRegionManagerId(), regionUserId, engineerUserId,
|
|
|
+ // // assistantEngineerUserIds);
|
|
|
+ // approveUserIds = this.getNextApproveUserIds(tfCustomFlow.getType(), flowTaskResult, tbSopInfoDetail, null);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // Map<String, Object> map = activitiService.taskApprove(
|
|
|
+ // new FlowApproveParam(flowDeploymentId, approve, approveUserIds, crmNo, formProperties));
|
|
|
+ // if (approve != FlowApprovePassEnum.DRAFT) {
|
|
|
+ // map.put(SystemConstant.CRM_INFO, crmProjectResult);
|
|
|
+ // map.put(SystemConstant.SOP_ID, null);
|
|
|
+ // map.put(SystemConstant.SOURCE, "sopApplyOrPublish");
|
|
|
+ // tbSopInfoService.saveJobRemind(map);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // tfCustomFlow = Objects.isNull(tfCustomFlow) ? (TFCustomFlow) map.get(SystemConstant.FLOW_CUSTOM) : tfCustomFlow;
|
|
|
+ // TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
|
|
|
+ //
|
|
|
+ // TBSopInfo tbSopInfo = new TBSopInfo(crmNo, tfCustomFlowEntity.getCode(), crmProjectResult.getServiceUnitId(),
|
|
|
+ // crmProjectResult.getCustomId(), crmProjectResult.getProductId(), tfCustomFlow.getType(),
|
|
|
+ // SopStatusEnum.valueOf(approve.name()), sysUser.getId());
|
|
|
+ // if (Objects.isNull(tbSopInfoDetail)) {
|
|
|
+ // tbSopInfoDetail = new TBSopInfoDetail(tbSopInfo.getId(), crmProjectResult.getRegionManagerId());
|
|
|
+ // } else {
|
|
|
+ // tbSopInfoDetail.setSopInfoId(tbSopInfo.getId());
|
|
|
+ // }
|
|
|
+ // tbSopInfoDetailService.save(tbSopInfoDetail);
|
|
|
+ // TBSopPlanDateLog tbSopPlanDateLog = tbSopPlanDateLogService.getOne(new QueryWrapper<TBSopPlanDateLog>().lambda()
|
|
|
+ // .eq(TBSopPlanDateLog::getFlowId, tfCustomFlowEntity.getFlowId())
|
|
|
+ // .orderByDesc(TBSopPlanDateLog::getCreateTime).last(" limit 1 "));
|
|
|
+ // if (Objects.nonNull(tbSopPlanDateLog)) {
|
|
|
+ // tbSopPlanDateLog.setSopId(tbSopInfo.getId());
|
|
|
+ // tbSopPlanDateLogService.updateById(tbSopPlanDateLog);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // tfCustomFlowEntity.setObjId(tbSopInfo.getId());
|
|
|
+ // tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
|
|
|
+ // tbCrmService.updateCrmStatus(crmNo, CrmStatusEnum.PUBLISH);
|
|
|
+ // return tbSopInfoService.save(tbSopInfo);
|
|
|
+ // }
|
|
|
|
|
|
/**
|
|
|
* 保存提醒/延时任务
|
|
@@ -967,93 +1036,99 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
Long processLimitedTime = null;
|
|
|
String execField = null;
|
|
|
if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop
|
|
|
- if (tfFlowApprove.getSetup().intValue() == 2) {//项目关键信息
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey());
|
|
|
- execField = ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey();
|
|
|
- tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(),
|
|
|
- sysUser.getId());
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 3) {//内审
|
|
|
- processLimitedTime = tfFlowApprove.getUpdateTime();
|
|
|
- execField = ProcessLimitedEnum.APPROVE_RADIO.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 5) {//扫描准备
|
|
|
- String source = (String) map.get(SystemConstant.SOURCE);
|
|
|
- if (Objects.nonNull(source) && !Objects.equals(source, "save")) {
|
|
|
- tbSopInfoService.sopDeviceInOutSave(map, 4);
|
|
|
- }
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 7) {//校验收尾
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.SCAN_END_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 8) {//设备入库登记
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- String source = (String) map.get(SystemConstant.SOURCE);
|
|
|
- //审批过程中,如果外包服务范围为"仅扫描",则释放实施工程师资源,后续有区域协调人兼任
|
|
|
- if (Objects.nonNull(source) && Objects.equals(source, "sopApprove")) {
|
|
|
- List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
|
|
|
- Long engineerUserId = null;
|
|
|
- for (FlowFormWidgetResult f : formProperty) {
|
|
|
- if (f.getFormId().contains(SystemConstant.THIRD_SERVICE_REGION_CB) && Objects.nonNull(
|
|
|
- f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
- String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
- if (Objects.nonNull(value) && Objects.nonNull(sopId) && value.equals("SCAN")) {
|
|
|
- TBSopInfoDetail tbSopInfoDetail = tbSopInfoDetailService.getOne(
|
|
|
- new QueryWrapper<TBSopInfoDetail>().lambda()
|
|
|
- .eq(TBSopInfoDetail::getSopInfoId, sopId));
|
|
|
- engineerUserId = tbSopInfoDetail.getEngineerUserId();
|
|
|
- tbSopInfoDetail.setAfterRegionToEnginess(true);
|
|
|
- tbSopInfoDetailService.updateById(tbSopInfoDetail);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (Objects.nonNull(engineerUserId)) {
|
|
|
- List<Map<String, Object>> sopPassageMap = this.findSopPassage(null);
|
|
|
- if (!CollectionUtils.isEmpty(sopPassageMap)) {
|
|
|
- for (Map m : sopPassageMap) {
|
|
|
- String engineerUserStr =
|
|
|
- Objects.nonNull(m) && Objects.nonNull(m.get("engineerUserIds")) ?
|
|
|
- m.get("engineerUserIds").toString() :
|
|
|
- null;
|
|
|
- if (Objects.nonNull(engineerUserStr)) {
|
|
|
- String[] strs = engineerUserStr.split(",");
|
|
|
- Set<String> set = new HashSet<>(Arrays.asList(strs));
|
|
|
- if (!set.contains(engineerUserId)) {
|
|
|
- TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(
|
|
|
- engineerUserId);
|
|
|
- if (Objects.nonNull(tbUserArchives)) {
|
|
|
- tbUserArchives.setStatus(UserArchivesStatusEnum.FREE);
|
|
|
- tbUserArchives.updateInfo(sysUser.getId());
|
|
|
- tbUserArchivesService.updateById(tbUserArchives);
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
- execField = ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 9) {//评卷准备
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 10) {//评卷收尾
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- 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());
|
|
|
+
|
|
|
+ // if (tfFlowApprove.getSetup().intValue() == 2) {//项目关键信息
|
|
|
+ // FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
+ // processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ // ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey());
|
|
|
+ // execField = ProcessLimitedEnum.PROJECT_KEY_INFO_DATE.getKey();
|
|
|
+ // tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(),
|
|
|
+ // sysUser.getId());
|
|
|
+ // } else if (tfFlowApprove.getSetup().intValue() == 3) {//内审
|
|
|
+ // processLimitedTime = tfFlowApprove.getUpdateTime();
|
|
|
+ // execField = ProcessLimitedEnum.APPROVE_RADIO.getKey();
|
|
|
+ // } else if (tfFlowApprove.getSetup().intValue() == 5) {//扫描准备
|
|
|
+ // String source = (String) map.get(SystemConstant.SOURCE);
|
|
|
+ // if (Objects.nonNull(source) && !Objects.equals(source, "save")) {
|
|
|
+ // tbSopInfoService.sopDeviceInOutSave(map, 4);
|
|
|
+ // }
|
|
|
+ // FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
+ // processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ // ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
+ // execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
+ // } else if (tfFlowApprove.getSetup().intValue() == 7) {//校验收尾
|
|
|
+ // FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
+ // processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ // ProcessLimitedEnum.SCAN_END_TIME.getKey());
|
|
|
+ // execField = ProcessLimitedEnum.SCAN_END_TIME.getKey();
|
|
|
+ // } else if (tfFlowApprove.getSetup().intValue() == 8) {//设备入库登记
|
|
|
+ // FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
+ // String source = (String) map.get(SystemConstant.SOURCE);
|
|
|
+ // //审批过程中,如果外包服务范围为"仅扫描",则释放实施工程师资源,后续有区域协调人兼任
|
|
|
+ // if (Objects.nonNull(source) && Objects.equals(source, "sopApprove")) {
|
|
|
+ // List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
|
|
|
+ // Long engineerUserId = null;
|
|
|
+ // for (FlowFormWidgetResult f : formProperty) {
|
|
|
+ // if (f.getFormId().contains(SystemConstant.THIRD_SERVICE_REGION_CB) && Objects.nonNull(
|
|
|
+ // f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
+ // JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
+ // String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
+ // if (Objects.nonNull(value) && Objects.nonNull(sopId) && value.equals("SCAN")) {
|
|
|
+ // TBSopInfoDetail tbSopInfoDetail = tbSopInfoDetailService.getOne(
|
|
|
+ // new QueryWrapper<TBSopInfoDetail>().lambda()
|
|
|
+ // .eq(TBSopInfoDetail::getSopInfoId, sopId));
|
|
|
+ // engineerUserId = tbSopInfoDetail.getEngineerUserId();
|
|
|
+ // tbSopInfoDetail.setAfterRegionToEnginess(true);
|
|
|
+ // tbSopInfoDetailService.updateById(tbSopInfoDetail);
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (Objects.nonNull(engineerUserId)) {
|
|
|
+ // List<Map<String, Object>> sopPassageMap = this.findSopPassage(null);
|
|
|
+ // if (!CollectionUtils.isEmpty(sopPassageMap)) {
|
|
|
+ // for (Map m : sopPassageMap) {
|
|
|
+ // String engineerUserStr =
|
|
|
+ // Objects.nonNull(m) && Objects.nonNull(m.get("engineerUserIds")) ?
|
|
|
+ // m.get("engineerUserIds").toString() :
|
|
|
+ // null;
|
|
|
+ // if (Objects.nonNull(engineerUserStr)) {
|
|
|
+ // String[] strs = engineerUserStr.split(",");
|
|
|
+ // Set<String> set = new HashSet<>(Arrays.asList(strs));
|
|
|
+ // if (!set.contains(engineerUserId)) {
|
|
|
+ // TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(
|
|
|
+ // engineerUserId);
|
|
|
+ // if (Objects.nonNull(tbUserArchives)) {
|
|
|
+ // tbUserArchives.setStatus(UserArchivesStatusEnum.FREE);
|
|
|
+ // tbUserArchives.updateInfo(sysUser.getId());
|
|
|
+ // tbUserArchivesService.updateById(tbUserArchives);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ // ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
+ // execField = ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey();
|
|
|
+ // } else if (tfFlowApprove.getSetup().intValue() == 9) {//评卷准备
|
|
|
+ // FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
+ // processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ // ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
+ // execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
+ // } else if (tfFlowApprove.getSetup().intValue() == 10) {//评卷收尾
|
|
|
+ // FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
+ // processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
+ // ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
+ // execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
|
+ // }
|
|
|
} else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
|
|
|
if (tfFlowApprove.getSetup().intValue() == 2) {//项目关键信息
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
@@ -1427,19 +1502,19 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
Long serviceFinishPlanEndDate = this.getProcessLimitedTime(flowTaskResult,
|
|
|
ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
if (Objects.nonNull(serviceFinishPlanBeginDate)) {
|
|
|
- TBSopPlanDateLog tbSopPlanDateLog = tbSopPlanDateLogService.getOne(
|
|
|
+ TBSopPlanDateLog tbSopPlanDateLogDb = tbSopPlanDateLogService.getOne(
|
|
|
new QueryWrapper<TBSopPlanDateLog>().lambda().eq(TBSopPlanDateLog::getFlowId, flowId)
|
|
|
.orderByDesc(TBSopPlanDateLog::getCreateTime).last(" limit 1 "));
|
|
|
- if (Objects.isNull(tbSopPlanDateLog)) {
|
|
|
- tbSopPlanDateLog = new TBSopPlanDateLog(sopId, flowId, serviceFinishPlanBeginDate,
|
|
|
+ if (Objects.isNull(tbSopPlanDateLogDb)) {
|
|
|
+ tbSopPlanDateLogDb = new TBSopPlanDateLog(sopId, flowId, serviceFinishPlanBeginDate,
|
|
|
serviceFinishPlanEndDate, userId);
|
|
|
- tbSopPlanDateLogService.save(tbSopPlanDateLog);
|
|
|
+ tbSopPlanDateLogService.save(tbSopPlanDateLogDb);
|
|
|
} else {
|
|
|
TBSopPlanDateLog tbSopPlanDateLogNew = new TBSopPlanDateLog();
|
|
|
- BeanUtils.copyProperties(tbSopPlanDateLog, tbSopPlanDateLogNew);
|
|
|
+ BeanUtils.copyProperties(tbSopPlanDateLogDb, tbSopPlanDateLogNew);
|
|
|
tbSopPlanDateLogNew.setBeginTime(serviceFinishPlanBeginDate);
|
|
|
tbSopPlanDateLogNew.setEndTime(serviceFinishPlanEndDate);
|
|
|
- if (!tbSopPlanDateLogNew.equals(tbSopPlanDateLog)) {
|
|
|
+ if (!tbSopPlanDateLogNew.equals(tbSopPlanDateLogDb)) {
|
|
|
tbSopPlanDateLogNew.updateInfo(userId);
|
|
|
tbSopPlanDateLogService.save(tbSopPlanDateLogNew);
|
|
|
}
|