新增修改库存添加组织信息;
This commit is contained in:
+50
@@ -249,6 +249,31 @@ public class MaterialBaseInfoApplicationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
Long shipperId = materialBaseInfoDO.getShipperId();
|
||||
String customerCodeNcJson = materialBaseInfoMapper.getCustomerCodeNcJson(shipperId.toString());
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> listNc = null;
|
||||
try {
|
||||
listNc = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new com.fasterxml.jackson.core.type.TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
String codeStr = "";
|
||||
if (listNc != null && listNc.size() > 0) {
|
||||
// 方式1:Stream拼接,逗号分隔
|
||||
codeStr = listNc.stream()
|
||||
.map(map -> map.get("code"))
|
||||
.filter(Objects::nonNull) // 过滤code为空
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.joining(","));
|
||||
materialBaseInfoDO.setOrgId(codeStr);
|
||||
}
|
||||
// codeStr 就是拼接好的字符串
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
Long materialBaseInfoId = materialBaseInfoDomainService.insert(materialBaseInfoDO);
|
||||
materialBaseInfoDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
//商品规则
|
||||
@@ -280,6 +305,31 @@ public class MaterialBaseInfoApplicationService {
|
||||
* 修改物料基础信息
|
||||
*/
|
||||
public Boolean update(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||
Long shipperId = materialBaseInfoDO.getShipperId();
|
||||
String customerCodeNcJson = materialBaseInfoMapper.getCustomerCodeNcJson(shipperId.toString());
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> listNc = null;
|
||||
try {
|
||||
listNc = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new com.fasterxml.jackson.core.type.TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
String codeStr = "";
|
||||
if (listNc != null && listNc.size() > 0) {
|
||||
// 方式1:Stream拼接,逗号分隔
|
||||
codeStr = listNc.stream()
|
||||
.map(map -> map.get("code"))
|
||||
.filter(Objects::nonNull) // 过滤code为空
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.joining(","));
|
||||
materialBaseInfoDO.setOrgId(codeStr);
|
||||
}
|
||||
// codeStr 就是拼接好的字符串
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
materialBaseInfoDomainService.update(materialBaseInfoDO);
|
||||
Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId();
|
||||
// 商品/公共/仓控 子表:Feign/前端常只带业务字段、未带子表主键,需按 material_base_info_id 补全后再 update,否则 WHERE xxx_id=? 为 null 导致 Updates: 0
|
||||
|
||||
Reference in New Issue
Block a user