|
@@ -18,7 +18,6 @@ import com.qmth.sop.business.mapper.TBSopInfoMapper;
|
|
|
import com.qmth.sop.business.service.*;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.*;
|
|
|
-import com.qmth.sop.common.util.GsonUtil;
|
|
|
import com.qmth.sop.common.util.JacksonUtil;
|
|
|
import com.qmth.sop.common.util.ResultUtil;
|
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
@@ -65,9 +64,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
@Resource
|
|
|
TaskService taskService;
|
|
|
|
|
|
- @Resource
|
|
|
- TBSopInfoDetailService tbSopInfoDetailService;
|
|
|
-
|
|
|
@Resource
|
|
|
TBSopInfoService tbSopInfoService;
|
|
|
|
|
@@ -89,24 +85,15 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
@Value("${db.name}")
|
|
|
String databaseName;
|
|
|
|
|
|
- @Resource
|
|
|
- TBDeviceInOutService tbDeviceInOutService;
|
|
|
-
|
|
|
@Resource
|
|
|
TFFlowLogService tfFlowLogService;
|
|
|
|
|
|
- @Resource
|
|
|
- SysUserRoleService sysUserRoleService;
|
|
|
-
|
|
|
@Resource
|
|
|
TBServiceService tbServiceService;
|
|
|
|
|
|
@Resource
|
|
|
TBSopPlanDateLogService tbSopPlanDateLogService;
|
|
|
|
|
|
- @Resource
|
|
|
- TBDeviceDeliveryService tbDeviceDeliveryService;
|
|
|
-
|
|
|
@Resource
|
|
|
TBSopLogService tbSopLogService;
|
|
|
|
|
@@ -238,27 +225,6 @@ 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发布信息
|
|
|
*
|
|
@@ -403,26 +369,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
return sopPublishParam;
|
|
|
}
|
|
|
|
|
|
- // /**
|
|
|
- // * 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填报信息
|
|
|
*
|
|
@@ -473,27 +419,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
new QueryWrapper<TBSopInfo>().lambda().eq(TBSopInfo::getSopNo, tfCustomFlowEntity.getCode()));
|
|
|
Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
|
|
|
|
- // TBSopInfoDetail tbSopInfoDetail = tbSopInfoDetailService.getOne(
|
|
|
- // new QueryWrapper<TBSopInfoDetail>().lambda().eq(TBSopInfoDetail::getSopInfoId, tbSopInfo.getId()));
|
|
|
- // Optional.ofNullable(tbSopInfoDetail).orElseThrow(() -> ExceptionResultEnum.SOP_DETAIL_INFO_NO_DATA.exception());
|
|
|
-
|
|
|
- //更新表单信息
|
|
|
- // FlowTaskResult flowTaskResult = JSONObject.parseObject(flowApproveParam.getFormProperties(),
|
|
|
- // FlowTaskResult.class);
|
|
|
- // Long engineerUserId = null;
|
|
|
- // if (flowTaskResult.getSetup().intValue() == 1) {
|
|
|
- // // Long regionUserId = null;
|
|
|
- // String assistantEngineerUserIds = null;
|
|
|
- //// Map<String, Object> map = this.getApproveUserIds(flowTaskResult);
|
|
|
- // // regionUserId = (Long) map.get(SystemConstant.REGION_USER_ID);
|
|
|
- //// engineerUserId = (Long) map.get(SystemConstant.ENGINEER_USER_ID);
|
|
|
- // // assistantEngineerUserIds = (String) map.get(SystemConstant.ASSISTANT_ENGINEER_USER_ID);
|
|
|
- //
|
|
|
- // // tbSopInfoDetail.updateUserIdInfo(regionUserId, engineerUserId, assistantEngineerUserIds);
|
|
|
- // tbSopInfoDetailService.updateById(tbSopInfoDetail);
|
|
|
- // } else {
|
|
|
- // engineerUserId = Long.parseLong(taskApproveUserList.get(0));
|
|
|
- // }
|
|
|
TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(tfCustomFlowEntity.getCode());
|
|
|
Objects.requireNonNull(tbCrmDetail, "未找到派单sop信息");
|
|
|
CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectInfo(tfCustomFlowEntity.getCode(),
|
|
@@ -502,9 +427,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
|
|
|
if (flowApproveParam.getApprove() == FlowApprovePassEnum.PASS
|
|
|
|| flowApproveParam.getApprove() == FlowApprovePassEnum.START) {
|
|
|
- // List<String> approveUserIds = this.getNextApproveUserIds(tfCustomFlow.getType(), flowTaskResult,
|
|
|
- // tbSopInfoDetail, Long.parseLong(task.getProcessInstanceId()));
|
|
|
- // flowApproveParam.setApproveUserIds(approveUserIds);
|
|
|
FlowTaskResult flowTaskResultOne = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
FlowTaskResult currFlowTaskResult = JSONObject.parseObject(flowApproveParam.getFormProperties(),
|
|
|
FlowTaskResult.class);
|
|
@@ -513,23 +435,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
flowApproveParam.setApproveUserIds(approveUserIds);
|
|
|
}
|
|
|
|
|
|
- // if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW
|
|
|
- // && 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));
|
|
|
- // }
|
|
|
-
|
|
|
String oldFlowProcessVar = tfCustomFlowEntity.getFlowProcessVar();
|
|
|
Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
|
|
|
if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT) {
|
|
@@ -554,12 +459,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
SopStatusEnum.START);
|
|
|
tbSopInfo.updateInfo(sysUser.getId());
|
|
|
tbSopInfoService.updateById(tbSopInfo);
|
|
|
-
|
|
|
- // //如果下一步审批是大区经理内审并且区域协调人和大区经理为同一人时,后台自动审批
|
|
|
- // if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
|
|
|
- // tbSopInfoService.sopSystemApprove(tfCustomFlow, tfCustomFlowEntity, tfFlowApprove,
|
|
|
- // flowApproveParam.getCrmNo());
|
|
|
- // }
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -737,30 +636,20 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
sopInfoListParam.getServiceId(), tableName, fieldName, fieldValue, dpr, fieldOrder);
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
for (Map m : list.getRecords()) {
|
|
|
- String regionUserId = (String) m.get("region_user_id_1");
|
|
|
- String engineerUserId = (String) m.get("engineer_user_id_1");
|
|
|
- String assistantEngineerUserId = (String) m.get("assistant_engineer_user_id_1");
|
|
|
+ String engineerUsersId = (String) m.get("engineer_users_id");
|
|
|
List<Long> userIdList = new ArrayList<>(3);
|
|
|
Map<Long, String> map = new HashMap<>(3);
|
|
|
- Map<Long, String> assistantEngineerMap = new HashMap<>();//助理工程师map
|
|
|
- if (Objects.nonNull(regionUserId)) {
|
|
|
- userIdList.add(Long.parseLong(regionUserId));
|
|
|
- map.put(Long.parseLong(regionUserId), "region_user_id_1");
|
|
|
- }
|
|
|
- if (Objects.nonNull(engineerUserId)) {
|
|
|
- userIdList.add(Long.parseLong(engineerUserId));
|
|
|
- map.put(Long.parseLong(engineerUserId), "engineer_user_id_1");
|
|
|
- }
|
|
|
- if (Objects.nonNull(assistantEngineerUserId)) {
|
|
|
- if (assistantEngineerUserId.contains(SystemConstant.LIST_JOIN_SPLIT)) {
|
|
|
- String[] strs = assistantEngineerUserId.split(",");
|
|
|
+ Map<Long, String> engineerMap = new HashMap<>();//助理工程师map
|
|
|
+ if (Objects.nonNull(engineerUsersId)) {
|
|
|
+ if (engineerUsersId.contains(SystemConstant.LIST_JOIN_SPLIT)) {
|
|
|
+ String[] strs = engineerUsersId.split(",");
|
|
|
for (int i = 0; i < strs.length; i++) {
|
|
|
userIdList.add(Long.parseLong(strs[i]));
|
|
|
- assistantEngineerMap.put(Long.parseLong(strs[i]), "assistant_engineer_user_id_1");
|
|
|
+ engineerMap.put(Long.parseLong(strs[i]), "engineer_users_id_1");
|
|
|
}
|
|
|
} else {
|
|
|
- userIdList.add(Long.parseLong(assistantEngineerUserId));
|
|
|
- assistantEngineerMap.put(Long.parseLong(assistantEngineerUserId), "assistant_engineer_user_id_1");
|
|
|
+ userIdList.add(Long.parseLong(engineerUsersId));
|
|
|
+ engineerMap.put(Long.parseLong(engineerUsersId), "engineer_users_id_1");
|
|
|
}
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(userIdList)) {
|
|
@@ -770,12 +659,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
if (map.containsKey(s.getId())) {
|
|
|
m.put(map.get(s.getId()), s.getOrgUserName());
|
|
|
}
|
|
|
- if (assistantEngineerMap.containsKey(s.getId())) {
|
|
|
+ if (engineerMap.containsKey(s.getId())) {
|
|
|
stringJoiner.add(s.getOrgUserName());
|
|
|
}
|
|
|
}
|
|
|
- if (!CollectionUtils.isEmpty(assistantEngineerMap)) {
|
|
|
- m.put("assistant_engineer_user_id_1", stringJoiner.toString());
|
|
|
+ if (!CollectionUtils.isEmpty(engineerMap)) {
|
|
|
+ m.put("engineer_users_id_1", stringJoiner.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -833,64 +722,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * sop自动审批
|
|
|
- *
|
|
|
- * @param tfCustomFlow
|
|
|
- * @param tfCustomFlowEntity
|
|
|
- * @param tfFlowApprove
|
|
|
- * @param crmNo
|
|
|
- * @throws InterruptedException
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public void sopSystemApprove(TFCustomFlow tfCustomFlow, TFCustomFlowEntity tfCustomFlowEntity,
|
|
|
- TFFlowApprove tfFlowApprove, String crmNo) throws InterruptedException {
|
|
|
- //如果下一步审批是内审并且区域协调人和大区经理为同一人时,后台自动审批
|
|
|
- if (tfFlowApprove.getStatus() != FlowStatusEnum.FINISH && tfFlowApprove.getStatus() != FlowStatusEnum.END
|
|
|
- && tfFlowApprove.getStatus() == FlowStatusEnum.AUDITING && tfFlowApprove.getSetup().intValue() == 3) {
|
|
|
- //TODO 研究生SOP待修改
|
|
|
- // && tbSopInfoDetail.getLeadId().longValue() == tbSopInfoDetail.getRegionUserId().longValue()) {
|
|
|
- // Task taskNew = taskService.createTaskQuery().processInstanceId(String.valueOf(tfFlowApprove.getFlowId()))
|
|
|
- // .taskAssignee(String.valueOf(tbSopInfoDetail.getLeadId())).singleResult();
|
|
|
- // Optional.ofNullable(taskNew).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
|
|
|
-
|
|
|
- FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
|
- LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
|
|
|
- FlowTaskResult nextFlowTaskResult = null;
|
|
|
- for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
|
|
|
- if (entry.getValue().getSetup().intValue() == 3) {
|
|
|
- nextFlowTaskResult = entry.getValue();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (Objects.nonNull(nextFlowTaskResult)) {
|
|
|
- List<FlowFormWidgetResult> flowFormWidgetResultList = nextFlowTaskResult.getFormProperty();
|
|
|
- for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
- if (f.getFormId().contains(SystemConstant.APPROVE_RADIO_REGION)) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, "1");
|
|
|
- f.setValue(jsonObject.toString());
|
|
|
- } else if (f.getFormId().contains(SystemConstant.APPROVE_REMARK_REGION)) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, SystemConstant.SYSTEM_AUTO_APPROVE);
|
|
|
- f.setValue(jsonObject.toString());
|
|
|
- } else if (f.getFormId().contains(SystemConstant.SIGN_REGION)) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, "https://sop-file.qmth.com.cn/logo/logo.png");
|
|
|
- f.setValue(jsonObject.toString());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //TODO 研究生SOP待修改
|
|
|
- // activitiService.taskApprove(new FlowApproveParam(Long.parseLong(taskNew.getId()), FlowApprovePassEnum.PASS,
|
|
|
- // this.getNextApproveUserIds(tfCustomFlow.getType(), nextFlowTaskResult, tbSopInfoDetail,
|
|
|
- // tfCustomFlowEntity.getFlowId()), crmNo, SystemConstant.SYSTEM_AUTO_APPROVE,
|
|
|
- // JacksonUtil.parseJson(nextFlowTaskResult)));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取下一级审批人
|
|
|
*
|
|
@@ -939,204 +770,12 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
approveUserIds.add(crmProjectResult.getRegionManagerId().toString());
|
|
|
}
|
|
|
}
|
|
|
- // if (flowTaskResult.getSetup().intValue() == 1) {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getRegionUserId()));
|
|
|
- // } else if (flowTaskResult.getSetup().intValue() == 2) {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
- // String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
- // } else if (flowTaskResult.getSetup().intValue() == 3) {
|
|
|
- // List<Task> taskList = taskService.createTaskQuery().processInstanceId(String.valueOf(flowId)).list();
|
|
|
- // if (!CollectionUtils.isEmpty(taskList) && taskList.size() == 1) {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()));
|
|
|
- // } else {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
- // String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if (flowTaskResult.getSetup().intValue() >= 8 && tbSopInfoDetail.getAfterRegionToEnginess()) {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getRegionUserId()));
|
|
|
- // } else {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
- // }
|
|
|
- // }
|
|
|
} else if (type == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop流程待审核人
|
|
|
- // if (flowTaskResult.getSetup().intValue() == 1) {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getRegionUserId()));
|
|
|
- // } else if (flowTaskResult.getSetup().intValue() == 2) {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
- // String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
- // } else if (flowTaskResult.getSetup().intValue() == 3) {
|
|
|
- // List<Task> taskList = taskService.createTaskQuery().processInstanceId(String.valueOf(flowId)).list();
|
|
|
- // if (!CollectionUtils.isEmpty(taskList) && taskList.size() == 1) {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()));
|
|
|
- // } else {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getLeadId()),
|
|
|
- // String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // approveUserIds = Arrays.asList(String.valueOf(tbSopInfoDetail.getEngineerUserId()));
|
|
|
- // }
|
|
|
+
|
|
|
}
|
|
|
return approveUserIds;
|
|
|
}
|
|
|
|
|
|
- // /**
|
|
|
- // * 获取审批人
|
|
|
- // *
|
|
|
- // * @param flowTaskResult
|
|
|
- // * @return
|
|
|
- // */
|
|
|
- // public Map<String, Object> getApproveUserIds(FlowTaskResult flowTaskResult) {
|
|
|
- // Map<String, Object> map = new HashMap<>();
|
|
|
- // // Long regionUserId = null, engineerUserId = null;
|
|
|
- // // String assistantEngineerUserIds = null;
|
|
|
- // String engineerUsersIds = null;
|
|
|
- // List<FlowFormWidgetResult> formProperty = flowTaskResult.getFormProperty();
|
|
|
- // for (FlowFormWidgetResult f : formProperty) {
|
|
|
- // // if (f.getFormId().contains(SystemConstant.REGION_USER_ID) && Objects.nonNull(f.getValue())
|
|
|
- // // && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- // // JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
- // // String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
- // // regionUserId = Long.parseLong(value);
|
|
|
- // // } else if (f.getFormId().contains(SystemConstant.ASSISTANT_ENGINEER_USER_ID) && Objects.nonNull(
|
|
|
- // // f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- // // JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
- // // JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
- // // StringJoiner stringJoiner = new StringJoiner(",");
|
|
|
- // // for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- // // stringJoiner.add(jsonArray.getString(i));
|
|
|
- // // }
|
|
|
- // // assistantEngineerUserIds = stringJoiner.toString();
|
|
|
- // // }
|
|
|
- // // else if ((f.getFormId().contains(SystemConstant.ENGINEER_USER_ID) && Objects.nonNull(f.getValue()))
|
|
|
- // // && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- // // JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
- // // String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
- // // engineerUserId = Long.parseLong(value);
|
|
|
- // // }
|
|
|
- // if (f.getFormId().contains(SystemConstant.ENGINEER_USERS_ID) && Objects.nonNull(f.getValue())
|
|
|
- // && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- // JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
- // JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
- // StringJoiner stringJoiner = new StringJoiner(",");
|
|
|
- // for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- // stringJoiner.add(jsonArray.getString(i));
|
|
|
- // }
|
|
|
- // engineerUsersIds = stringJoiner.toString();
|
|
|
- // }
|
|
|
- // if (Objects.nonNull(engineerUsersIds)) {
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // // Optional.ofNullable(regionUserId).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("区域协调人不能为空"));
|
|
|
- // Optional.ofNullable(engineerUsersIds).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("工程师不能为空"));
|
|
|
- // // map.put(SystemConstant.REGION_USER_ID, regionUserId);
|
|
|
- // // map.put(SystemConstant.ENGINEER_USERS_ID, engineerUsersIds);
|
|
|
- // // map.put(SystemConstant.ASSISTANT_ENGINEER_USER_ID, assistantEngineerUserIds);
|
|
|
- // return map;
|
|
|
- // }
|
|
|
-
|
|
|
- // /**
|
|
|
- // * 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);
|
|
|
- // }
|
|
|
-
|
|
|
/**
|
|
|
* 保存提醒/延时任务
|
|
|
*
|
|
@@ -1172,144 +811,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
execField = ProcessLimitedEnum.FLOW_TASK.getKey();
|
|
|
tbSopInfoService.saveSopPlanDate(flowTaskResult, sopId, tfCustomFlowEntity.getFlowId(), sysUser.getId(),
|
|
|
tfCustomFlow.getType());
|
|
|
- // 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);
|
|
|
- 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(), tfCustomFlow.getType());
|
|
|
- } 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.ENV_DEPLOYMENT_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.ENV_DEPLOYMENT_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 6) {//扫描准备
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SCAN_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.SCAN_START_TIME.getKey();
|
|
|
-
|
|
|
- //现场环境测试后,设备发货管理里的设备通过序列号匹配更新为签收
|
|
|
- FlowTaskResult flowTaskResultDeviceOut = this.getFormProperties(tfCustomFlowEntity, 4);
|
|
|
- tbDeviceDeliveryService.updateStatusBySop(flowTaskResultDeviceOut, DeviceDeliveryStatusEnum.RECEIVE,
|
|
|
- sysUser.getId());
|
|
|
- } 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, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.MARK_START_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.MARK_START_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 9) {//成绩复核
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 2);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.MARK_END_TIME.getKey());
|
|
|
- execField = ProcessLimitedEnum.MARK_END_TIME.getKey();
|
|
|
- } else if (tfFlowApprove.getSetup().intValue() == 11) {//设备入库登记
|
|
|
- FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
- processLimitedTime = this.getProcessLimitedTime(flowTaskResult,
|
|
|
- ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey());
|
|
|
- execField = ProcessLimitedEnum.SERVICE_FINISH_PLAN_DATE.getKey();
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
if (Objects.nonNull(execField)) {
|
|
|
for (Task task : taskList) {
|
|
@@ -1349,67 +852,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // else if (tfFlowApprove.getStatus() == FlowStatusEnum.FINISH) {
|
|
|
- // if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {//教务处sop
|
|
|
- // tbSopInfoService.sopDeviceInOutSave(map, 10);
|
|
|
- // } else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {//研究生sop
|
|
|
- // tbSopInfoService.sopDeviceInOutSave(map, 11);
|
|
|
- // }
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * sop保存设备信息
|
|
|
- *
|
|
|
- * @param map
|
|
|
- * @param setup
|
|
|
- * @throws InterruptedException
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public void sopDeviceInOutSave(Map<String, Object> map, Integer setup) throws InterruptedException {
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
|
|
|
- Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
-
|
|
|
- FlowTaskResult flowTaskResultDeviceTable = this.getFormProperties(tfCustomFlowEntity, setup);
|
|
|
- if (Objects.nonNull(flowTaskResultDeviceTable)) {
|
|
|
- CrmProjectResult crmProjectResult = (CrmProjectResult) map.get(SystemConstant.CRM_INFO);
|
|
|
- List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResultDeviceTable.getFormProperty();
|
|
|
- List<DeviceInOutForm> deviceInOutFormList = new ArrayList<>();
|
|
|
- InOutTypeEnum type = null;
|
|
|
- Long deviceInOutTime = null;
|
|
|
- for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
- if ((f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) || f.getFormId()
|
|
|
- .contains(SystemConstant.DEVICE_IN_TIME)) && Objects.nonNull(f.getValue()) && !Objects.equals(
|
|
|
- f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
- String value = jsonObject.getString(SystemConstant.VALUE);
|
|
|
- deviceInOutTime = Long.parseLong(value);
|
|
|
- type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TIME) ?
|
|
|
- InOutTypeEnum.OUT :
|
|
|
- InOutTypeEnum.IN;
|
|
|
- } else if ((f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) || f.getFormId()
|
|
|
- .contains(SystemConstant.DEVICE_IN_TABLE)) && Objects.nonNull(f.getValue()) && !Objects.equals(
|
|
|
- f.getValue(), "{\"value\":null}")) {
|
|
|
- if (Objects.isNull(type)) {
|
|
|
- type = f.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE) ?
|
|
|
- InOutTypeEnum.OUT :
|
|
|
- InOutTypeEnum.IN;
|
|
|
- }
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(f.getValue());
|
|
|
- JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- deviceInOutFormList.add(
|
|
|
- GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)), DeviceInOutForm.class));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(deviceInOutFormList)) {
|
|
|
- tbDeviceInOutService.deviceInOutSubmit(
|
|
|
- new DeviceInOutSubmitParam(crmProjectResult.getServiceUnitId(), tfCustomFlowEntity.getCrmNo(),
|
|
|
- tfCustomFlowEntity.getCode(), deviceInOutTime, type, true, deviceInOutFormList));
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1526,19 +968,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
map.put(SystemConstant.SOURCE, "save");
|
|
|
tbSopInfoService.saveJobRemind(map);
|
|
|
|
|
|
- if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW
|
|
|
- && tfFlowApprove.getSetup().intValue() >= 4) {
|
|
|
- tbSopInfoService.sopDeviceInOutSave(map, 4);
|
|
|
- } else if (tfCustomFlow.getType() == TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW
|
|
|
- && tfFlowApprove.getSetup().intValue() >= 4) {
|
|
|
- tbSopInfoService.sopDeviceInOutSave(map, 4);
|
|
|
- if (tfFlowApprove.getSetup().intValue() > 5) {
|
|
|
- FlowTaskResult flowTaskResultDeviceOut = this.getFormProperties(tfCustomFlowEntity, 4);
|
|
|
- tbDeviceDeliveryService.updateStatusBySop(flowTaskResultDeviceOut, DeviceDeliveryStatusEnum.RECEIVE,
|
|
|
- sysUser.getId());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
FlowTaskResult flowTaskResult = this.getFormProperties(tfCustomFlowEntity, 1);
|
|
|
tbSopInfoService.saveSopPlanDate(flowTaskResult, tbSopInfo.getId(), tfCustomFlowEntity.getFlowId(),
|
|
|
sysUser.getId(), tfCustomFlow.getType());
|
|
@@ -1554,22 +983,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
return tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<SysUser> userList(Long id) {
|
|
|
- return this.baseMapper.userList(id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据服务单元查找在途的区域协调人、实施工程师、助理工程师
|
|
|
- *
|
|
|
- * @param serviceId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<Map<String, Object>> findSopPassage(Long serviceId) {
|
|
|
- return this.baseMapper.findSopPassage(serviceId);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取表单内容
|
|
|
*
|
|
@@ -1670,48 +1083,20 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<String> findFlowPassageByCrmNo(String crmNo, Long requestUserId) {
|
|
|
+ public List<String> findFlowPassageByCrmNo(String crmNo) {
|
|
|
Optional.ofNullable(crmNo).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
- SysUser sysUser = sysUserService.getById(requestUserId);
|
|
|
- List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(sysUser.getId());
|
|
|
- RoleTypeEnum roleTypeEnum = null;
|
|
|
- if (!CollectionUtils.isEmpty(sysRoleList)) {
|
|
|
- for (SysRole sysRole : sysRoleList) {
|
|
|
- if (sysRole.getType() == RoleTypeEnum.EFFECT_ENGINEER) {
|
|
|
- roleTypeEnum = sysRole.getType();
|
|
|
- break;
|
|
|
- } else if (sysRole.getType() == RoleTypeEnum.ASSISTANT_ENGINEER) {
|
|
|
- roleTypeEnum = sysRole.getType();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return this.baseMapper.findFlowPassageByCrmNo(crmNo, sysUser.getId(),
|
|
|
- Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
|
|
|
+ return this.baseMapper.findFlowPassageByCrmNo(crmNo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据serviceId和userId查询所有sop信息
|
|
|
+ * 根据serviceId查询所有sop信息
|
|
|
*
|
|
|
* @param serviceId
|
|
|
- * @param userId
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<SopInfoResult> findFlowByServiceId(Long serviceId, Long userId) {
|
|
|
- Optional.ofNullable(userId).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("用户id不能为空"));
|
|
|
- List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(userId);
|
|
|
- RoleTypeEnum roleTypeEnum = null;
|
|
|
- if (!CollectionUtils.isEmpty(sysRoleList)) {
|
|
|
- for (SysRole sysRole : sysRoleList) {
|
|
|
- if (sysRole.getType() == RoleTypeEnum.EFFECT_ENGINEER) {
|
|
|
- roleTypeEnum = sysRole.getType();
|
|
|
- break;
|
|
|
- } else if (sysRole.getType() == RoleTypeEnum.ASSISTANT_ENGINEER) {
|
|
|
- roleTypeEnum = sysRole.getType();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return this.baseMapper.findFlowByServiceId(serviceId, userId,
|
|
|
- Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
|
|
|
+ public List<SopInfoResult> findFlowByServiceId(Long serviceId) {
|
|
|
+ Objects.requireNonNull(serviceId, "服务单元id不能为空");
|
|
|
+ return this.baseMapper.findFlowByServiceId(serviceId);
|
|
|
}
|
|
|
}
|