Commit d35574da by “zcwang”

modify:待办工单名字

parent 3cf7f493
......@@ -400,7 +400,7 @@
<dependency>
<groupId>com.netease.yanxuan.flowx</groupId>
<artifactId>yanxuan-flowx-sdk</artifactId>
<version>1.3</version>
<version>1.4</version>
<exclusions>
<exclusion>
<artifactId>logback-classic</artifactId>
......
......@@ -227,9 +227,39 @@ public class ChangeFlowBiz {
content.put("createTime", System.currentTimeMillis());
content.put("updateTime", System.currentTimeMillis());
content.put(CommonConstants.FLOW_OPERATION_KEY, FlowOperationTypeEnum.PASS.getValue());
// 变更类型, 一级变更类型>二级变更类型
ChangeConfigPo changeConfigPo = changeConfigService.queryInfoPo(parentChangeClassId, sonChangeClassId);
StringBuilder changeType = new StringBuilder();
try {
changeType.append(changeConfigPo.getChangeTypes().get(0).getTypeName());
changeType.append(changeConfigPo.getChangeTypes().get(1).getTypeName());
} catch (Exception e) {
log.error("queryInfoPo error:{}", JSON.toJSONString(changeConfigPo));
}
// 变更工单命名:变更主体+变更类型+变更商品(SPU+商品名称)/变更供应商(供应商ID+供应商名称)
String subject = ChangeSubjectEnum.getDescByType(changeFlowCreateReq.getChangeSubject());
String flowName = subject + changeType;
// 商品变更
if (ChangeSubjectEnum.PRODUCT.getType().equals(changeFlowCreateReq.getChangeSubject())) {
// 批量查询spu信息
List<SpuTO> spuTOS = itemService.batchQuerySpuInfo(BatchQuerySpuInfoParam.builder().ids(itemIds)
.commonProps(new ArrayList<>()).spuProps(new ArrayList<>()).build());
log.debug("[createAndSubmit] uid:{}, spuTOS:{}", uid, JSON.toJSONString(spuTOS));
String spuList = spuTOS.stream().map(spu -> "(" + spu.getId() + spu.getName() + ")")
.collect(Collectors.joining(","));
flowName += spuList;
}
if (ChangeSubjectEnum.SUPPLIER.getType().equals(changeFlowCreateReq.getChangeSubject())) {
List<SupplierSimpleRsp> supplierSimple = supplierService
.getSupplierName(changeFlowCreateReq.getChangeSupplier());
if (CollectionUtils.isNotEmpty(supplierSimple)) {
SupplierSimpleRsp supplier = supplierSimple.get(0);
flowName += supplier.getSupplierId() + supplier.getSupplierName();
}
}
// 组装工单创建数据
FlowCreateReqDTO flowCreateReqDTO = buildFlowCreateReqDTO(ChangeFlowEnum.CHANGE_FLOW_START.getTopoId(), uid,
JSON.toJSONString(content), FlowxOperationEnum.CREATE.getName(), name);
JSON.toJSONString(content), FlowxOperationEnum.CREATE.getName(), name, flowName);
// 创建工单
String flowId = flowService.createFlow(flowCreateReqDTO);
// 查询工单详情
......@@ -293,18 +323,6 @@ public class ChangeFlowBiz {
dataList.add(changeExecuteEmailDTO);
});
param.put("dataList", dataList);
ChangeConfigPo changeConfigPo = changeConfigService.queryInfoPo(parentChangeClassId, sonChangeClassId);
StringBuilder changeType = new StringBuilder();
try {
changeType.append(changeConfigPo.getChangeTypes().get(0).getTypeName());
} catch (Exception e) {
log.error("queryInfoPo error:{}", JSON.toJSONString(changeConfigPo));
}
try {
changeType.append(changeConfigPo.getChangeTypes().get(1).getTypeName());
} catch (Exception e) {
log.error("queryInfoPo error:{}", JSON.toJSONString(changeConfigPo));
}
String subjectParam = ChangeSubjectEnum.getChangeSubjectEnum(changeRecord.getChangeSubject()).getDesc() + changeType
+ changeRecord.getFlowId().toString();
......@@ -330,18 +348,7 @@ public class ChangeFlowBiz {
HashMap<String, Object> param = new HashMap<>();
param.put("changeId", changeRecord.getFlowId());
param.put("changeSubject", ChangeSubjectEnum.getChangeSubjectEnum(changeRecord.getChangeSubject()).getDesc());
ChangeConfigPo changeConfigPo = changeConfigService.queryInfoPo(parentChangeClassId, sonChangeClassId);
StringBuilder changeType = new StringBuilder();
try {
changeType.append(changeConfigPo.getChangeTypes().get(0).getTypeName());
} catch (Exception e) {
log.error("queryInfoPo error:{}", JSON.toJSONString(changeConfigPo));
}
try {
changeType.append(changeConfigPo.getChangeTypes().get(1).getTypeName());
} catch (Exception e) {
log.error("queryInfoPo error:{}", JSON.toJSONString(changeConfigPo));
}
param.put("changeType", changeType.toString());
param.put("flowUrl", changeRecord.getFlowId());
String subjectParam = changeRecord.getFlowId().toString();
......@@ -445,7 +452,8 @@ public class ChangeFlowBiz {
}
}
private FlowCreateReqDTO buildFlowCreateReqDTO(String topoId, String uid, String content, String operateResult, String name) {
private FlowCreateReqDTO buildFlowCreateReqDTO(String topoId, String uid, String content, String operateResult,
String name, String flowName) {
FlowCreateReqDTO flowCreateReqDTO = new FlowCreateReqDTO();
flowCreateReqDTO.setTopoId(topoId);
flowCreateReqDTO.setUid(uid);
......@@ -453,6 +461,7 @@ public class ChangeFlowBiz {
flowCreateReqDTO.setOperateResult(operateResult);
flowCreateReqDTO.setWorkOrderId(StringUtils.joinWith("-", topoId, UUID.randomUUID().toString()));
flowCreateReqDTO.setContent(content);
flowCreateReqDTO.setFlowName(flowName);
return flowCreateReqDTO;
}
......@@ -930,7 +939,7 @@ public class ChangeFlowBiz {
List<Long> itemIds = itemList.stream().map(ItemVO::getItemId).collect(Collectors.toList());
// 批量查询spu信息
List<SpuTO> spuTOS = itemService.batchQuerySpuInfo(BatchQuerySpuInfoParam.builder().ids(itemIds)
.commonProps(new ArrayList<>()).spuProps(Arrays.asList("itemSetupType", "+")).build());
.commonProps(new ArrayList<>()).spuProps(Arrays.asList("itemSetupType", "businessForm")).build());
log.debug("[detail] spuTOS:{}", JSON.toJSONString(spuTOS));
// 批量查询物理类目
Map<Long, List<SimplePhyCateGoryResultCo>> categoryChain = itemService
......
......@@ -43,6 +43,15 @@ public enum ChangeSubjectEnum {
return null;
}
public static String getDescByType(Integer type) {
for (ChangeSubjectEnum value : ChangeSubjectEnum.values()) {
if (value.getType().equals(type)) {
return value.getDesc();
}
}
return "";
}
public static ChangeSubjectEnum getChangeSubjectEnum(Integer id){
for (ChangeSubjectEnum day : ChangeSubjectEnum.values()) {
if (id == day.getType()){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment