|
@@ -324,55 +324,78 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
String processVar = (String) var.get(SystemConstant.PROCESS_VAR);
|
|
|
if (!CollectionUtils.isEmpty(propertiesMap)) {
|
|
|
FlowTaskResult flowTaskResult = (FlowTaskResult) propertiesMap.get(SystemConstant.FORM_PROPERTIES);
|
|
|
- List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
|
|
|
- if (!CollectionUtils.isEmpty(flowFormWidgetResultList)) {
|
|
|
- if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {
|
|
|
+ flowTaskResult = tbSopInfoService.updateSetupOne(flowTaskResult, tfCustomFlow, processVar, tbCrmDetail,
|
|
|
+ crmProjectResult);
|
|
|
+ sopPublishParam.setFormProperties(JacksonUtil.parseJson(flowTaskResult));
|
|
|
+ }
|
|
|
+ return sopPublishParam;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改流程第一步值
|
|
|
+ *
|
|
|
+ * @param flowTaskResult
|
|
|
+ * @param tfCustomFlow
|
|
|
+ * @param processVar
|
|
|
+ * @param tbCrmDetail
|
|
|
+ * @param crmProjectResult
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public FlowTaskResult updateSetupOne(FlowTaskResult flowTaskResult, TFCustomFlow tfCustomFlow, String processVar,
|
|
|
+ TBCrmDetail tbCrmDetail, CrmProjectResult crmProjectResult) {
|
|
|
+ List<FlowFormWidgetResult> flowFormWidgetResultList = flowTaskResult.getFormProperty();
|
|
|
+ if (!CollectionUtils.isEmpty(flowFormWidgetResultList)) {
|
|
|
+ if (tfCustomFlow.getType() == TFCustomTypeEnum.OFFICE_SOP_FLOW) {
|
|
|
+ Map<Long, FlowFormWidgetResult> flowFormWidgetResultMap = null;
|
|
|
+ if (Objects.nonNull(processVar)) {
|
|
|
List<FlowFormWidgetResult> flowFormWidgetResults = JSONArray.parseArray(processVar,
|
|
|
FlowFormWidgetResult.class);
|
|
|
- Map<Long, FlowFormWidgetResult> flowFormWidgetResultMap = flowFormWidgetResults.stream().collect(
|
|
|
+ flowFormWidgetResultMap = flowFormWidgetResults.stream().collect(
|
|
|
Collectors.toMap(FlowFormWidgetResult::getId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
- for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
- if (flowFormWidgetResultMap.containsKey(f.getId())) {
|
|
|
- f.setValue(flowFormWidgetResultMap.get(f.getId()).getValue());
|
|
|
- } else if (Objects.nonNull(tbCrmDetail.getContacts()) && f.getFormId()
|
|
|
- .contains(ProcessLimitedEnum.CONTACTS.getKey()) && Objects.nonNull(f.getValue())
|
|
|
- && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getContacts());
|
|
|
- f.setValue(jsonObject.toJSONString());
|
|
|
- } else if (Objects.nonNull(tbCrmDetail.getMobileNumber()) && f.getFormId()
|
|
|
- .contains(ProcessLimitedEnum.MOBILE_NUMBER.getKey()) && Objects.nonNull(f.getValue())
|
|
|
- && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMobileNumber());
|
|
|
- f.setValue(jsonObject.toJSONString());
|
|
|
- } else if (f.getFormId().contains(ProcessLimitedEnum.SERVICE_SCOPE_RADIO.getKey())
|
|
|
- && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getServiceScope());
|
|
|
- f.setValue(jsonObject.toJSONString());
|
|
|
- } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_START_TIME.getKey())
|
|
|
- && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getScanStartTime());
|
|
|
- f.setValue(jsonObject.toJSONString());
|
|
|
- } else if (f.getFormId().contains(ProcessLimitedEnum.SCAN_END_TIME.getKey()) && Objects.nonNull(
|
|
|
- f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getScanEndTime());
|
|
|
- f.setValue(jsonObject.toJSONString());
|
|
|
- } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_START_TIME.getKey())
|
|
|
- && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMarkPaperStartTime());
|
|
|
- f.setValue(jsonObject.toJSONString());
|
|
|
- } else if (f.getFormId().contains(ProcessLimitedEnum.MARK_END_TIME.getKey()) && Objects.nonNull(
|
|
|
- f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMarkPaperEndTime());
|
|
|
- f.setValue(jsonObject.toJSONString());
|
|
|
- } else if (f.getFormId().contains(ProcessLimitedEnum.ENGINEER_USERS_ID.getKey())
|
|
|
- && Objects.nonNull(f.getValue()) && !Objects.equals(f.getValue(), "{\"value\":null}")) {
|
|
|
+ }
|
|
|
+ for (FlowFormWidgetResult f : flowFormWidgetResultList) {
|
|
|
+ if (!CollectionUtils.isEmpty(flowFormWidgetResultMap) && flowFormWidgetResultMap.containsKey(
|
|
|
+ f.getId())) {
|
|
|
+ f.setValue(flowFormWidgetResultMap.get(f.getId()).getValue());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && Objects.nonNull(tbCrmDetail.getContacts())
|
|
|
+ && f.getFormId().contains(ProcessLimitedEnum.CONTACTS.getKey())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getContacts());
|
|
|
+ f.setValue(jsonObject.toJSONString());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && Objects.nonNull(tbCrmDetail.getMobileNumber())
|
|
|
+ && f.getFormId().contains(ProcessLimitedEnum.MOBILE_NUMBER.getKey())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMobileNumber());
|
|
|
+ f.setValue(jsonObject.toJSONString());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && f.getFormId()
|
|
|
+ .contains(ProcessLimitedEnum.SERVICE_SCOPE_RADIO.getKey())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getServiceScope());
|
|
|
+ f.setValue(jsonObject.toJSONString());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && f.getFormId()
|
|
|
+ .contains(ProcessLimitedEnum.SCAN_START_TIME.getKey())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getScanStartTime());
|
|
|
+ f.setValue(jsonObject.toJSONString());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && f.getFormId()
|
|
|
+ .contains(ProcessLimitedEnum.SCAN_END_TIME.getKey())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getScanEndTime());
|
|
|
+ f.setValue(jsonObject.toJSONString());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && f.getFormId()
|
|
|
+ .contains(ProcessLimitedEnum.MARK_START_TIME.getKey())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMarkPaperStartTime());
|
|
|
+ f.setValue(jsonObject.toJSONString());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && f.getFormId()
|
|
|
+ .contains(ProcessLimitedEnum.MARK_END_TIME.getKey())) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put(SystemConstant.VALUE, tbCrmDetail.getMarkPaperEndTime());
|
|
|
+ f.setValue(jsonObject.toJSONString());
|
|
|
+ } else if (Objects.nonNull(tbCrmDetail) && f.getFormId()
|
|
|
+ .contains(ProcessLimitedEnum.ENGINEER_USERS_ID.getKey())) {
|
|
|
+ if (!CollectionUtils.isEmpty(crmProjectResult.getEngineerList())) {
|
|
|
List<String> list = new ArrayList<>(crmProjectResult.getEngineerList().size());
|
|
|
crmProjectResult.getEngineerList().stream().peek(s -> list.add(s.getUserId().toString()))
|
|
|
.collect(Collectors.toList());
|
|
@@ -382,10 +405,9 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- sopPublishParam.setFormProperties(JacksonUtil.parseJson(flowTaskResult));
|
|
|
}
|
|
|
}
|
|
|
- return sopPublishParam;
|
|
|
+ return flowTaskResult;
|
|
|
}
|
|
|
|
|
|
/**
|