feat: 中类、小类、细分类(若有),分类代码和名称都传给OA
This commit is contained in:
parent
8c54292602
commit
bc596f3e1a
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.nflg.product.bomnew.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹鹏飞
|
||||||
|
* @date 2024/6/21 13:57:30
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum MaterialMainGetTypeEnum {
|
||||||
|
ZZ(1, "自制"),
|
||||||
|
WX(2, "外协"),
|
||||||
|
CG(3, "采购");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
public static MaterialMainGetTypeEnum findCodeByDescription(String description) {
|
||||||
|
for (MaterialMainGetTypeEnum valueEnum : MaterialMainGetTypeEnum.values()) {
|
||||||
|
if (valueEnum.getDescription().equals(description)) {
|
||||||
|
return valueEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.nflg.product.bomnew.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹鹏飞
|
||||||
|
* @date 2024/6/21 13:56:32
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum MaterialRelCategoryCodeEnum {
|
||||||
|
relCategoryCode_11("11", "采购物料"),
|
||||||
|
relCategoryCode_21("21", "制作物料"),
|
||||||
|
relCategoryCode_22("22", "制作物料-发货直发制作包、非图纸物料"),
|
||||||
|
relCategoryCode_31("31", "整机物料"),
|
||||||
|
relCategoryCode_41("41", "配件"),
|
||||||
|
relCategoryCode_51("51", "劳保办公用品"),
|
||||||
|
relCategoryCode_61("61", "服务"),
|
||||||
|
relCategoryCode_71("71", "工具工装");
|
||||||
|
|
||||||
|
private final String relCategoryCode;
|
||||||
|
private final String description;
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,8 @@ import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
import com.nflg.product.bomnew.client.MaterialMainClient;
|
import com.nflg.product.bomnew.client.MaterialMainClient;
|
||||||
import com.nflg.product.bomnew.config.NacosConfig;
|
import com.nflg.product.bomnew.config.NacosConfig;
|
||||||
|
import com.nflg.product.bomnew.constant.MaterialMainGetTypeEnum;
|
||||||
|
import com.nflg.product.bomnew.constant.MaterialRelCategoryCodeEnum;
|
||||||
import com.nflg.product.bomnew.pojo.dto.*;
|
import com.nflg.product.bomnew.pojo.dto.*;
|
||||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||||
import com.nflg.product.bomnew.util.FlowUtil;
|
import com.nflg.product.bomnew.util.FlowUtil;
|
||||||
|
|
@ -34,7 +36,6 @@ import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -328,14 +329,31 @@ public class MaterialService {
|
||||||
material.put("MEINS", u.getMaterialUnit());
|
material.put("MEINS", u.getMaterialUnit());
|
||||||
material.put("DUPLICATEITEMS", u.getReuseOfOnceState().equals(1) ? "2" : "1");// 是否一次性使用物料 0:否1:是
|
material.put("DUPLICATEITEMS", u.getReuseOfOnceState().equals(1) ? "2" : "1");// 是否一次性使用物料 0:否1:是
|
||||||
material.put("categoryTreeName", u.getCategoryNameTree());
|
material.put("categoryTreeName", u.getCategoryNameTree());
|
||||||
//流程类型 1|自制;2|外协;3|采购
|
material.put("FWEIGHT", u.getMaterialWeight());
|
||||||
material.put("materialGetType","1");
|
if (StringUtils.isNotEmpty(relCategoryCode)) {
|
||||||
|
if (relCategoryCode.equals(MaterialRelCategoryCodeEnum.relCategoryCode_21.getRelCategoryCode()) || relCategoryCode.equals(MaterialRelCategoryCodeEnum.relCategoryCode_22.getRelCategoryCode())) {
|
||||||
|
material.put("materialGetType", String.valueOf(u.getMaterialGetType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (relCategoryCode.equals(MaterialRelCategoryCodeEnum.relCategoryCode_71.getRelCategoryCode())) {
|
||||||
|
if ("701301".equals(u.getMaterialCategoryCode())) {
|
||||||
|
material.put("materialGetType", String.valueOf(u.getMaterialGetType()));
|
||||||
|
} else if ("701303".equals(u.getMaterialCategoryCode())) {
|
||||||
|
// 701303 虽然按照采购形式申请,但是OA流程类型 强制按照 自制
|
||||||
|
material.put("materialGetType", String.valueOf(MaterialMainGetTypeEnum.ZZ.getCode()));
|
||||||
|
} else {
|
||||||
|
material.put("materialGetType", String.valueOf(MaterialMainGetTypeEnum.CG.getCode()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(String.valueOf(u.getUseOfYear()))) {
|
if (StringUtils.isNotEmpty(String.valueOf(u.getUseOfYear()))) {
|
||||||
material.put("USAGEYEAR", String.valueOf(u.getUseOfYear()));
|
material.put("USAGEYEAR", String.valueOf(u.getUseOfYear()));
|
||||||
}
|
}
|
||||||
|
|
||||||
material.put("picUrl", u.getPicUrl());
|
material.put("picUrl", u.getPicUrl());
|
||||||
|
// 中类、小类、细分类(若有),分类代码和名称都传给OA
|
||||||
|
handleCategoryCodeAndName(material, u);
|
||||||
list.add(material);
|
list.add(material);
|
||||||
});
|
});
|
||||||
result.put("List", list);
|
result.put("List", list);
|
||||||
|
|
@ -397,4 +415,24 @@ public class MaterialService {
|
||||||
materialMainService.updateBatchById(entityList);
|
materialMainService.updateBatchById(entityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleCategoryCodeAndName(Map<String, String> material, AddMaterialMainDTO materialMainVO) {
|
||||||
|
String categoryNameTree = materialMainVO.getCategoryNameTree();
|
||||||
|
String[] trees = categoryNameTree.split("/");
|
||||||
|
if (trees.length >= 4 && Objects.nonNull(materialMainVO.getFourthMaterialCategoryCode())) {
|
||||||
|
material.put("ThinTypeCode", materialMainVO.getFourthMaterialCategoryCode());
|
||||||
|
// material.put("ThinTypeDes", trees[3]);
|
||||||
|
// 细分类可能也含/,所以用截取到末尾方式
|
||||||
|
int startIndex = (trees[0] + "/" + trees[1] + "/" + trees[2] + "/").length();
|
||||||
|
material.put("ThinTypeDes", categoryNameTree.substring(startIndex));
|
||||||
|
}
|
||||||
|
if (trees.length >= 3 && Objects.nonNull(materialMainVO.getThirdMaterialCategoryCode())) {
|
||||||
|
material.put("SmallTypeCode", materialMainVO.getThirdMaterialCategoryCode());
|
||||||
|
material.put("SmallTypeDes", trees[2]);
|
||||||
|
}
|
||||||
|
if (trees.length >= 2 && Objects.nonNull(materialMainVO.getSecondMaterialCategoryCode())) {
|
||||||
|
material.put("MiddleTypeCode", materialMainVO.getSecondMaterialCategoryCode());
|
||||||
|
material.put("MiddleTypeDes", trees[1]);
|
||||||
|
}
|
||||||
|
material.put("ATTYPDES", trees[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue