|
|
@@ -1417,14 +1417,10 @@ public class KwpGoodsService {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty(goods)) {
|
|
|
return new GoodsInfoResp();
|
|
|
}
|
|
|
- List<SysDictResDto> dictResDtos = remoteSystemService.queryDictByType(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
|
- Map<String, SysDictResDto> valueAndDictResDtoMap = Maps.newHashMap();
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(dictResDtos)){
|
|
|
- valueAndDictResDtoMap = dictResDtos.stream()
|
|
|
- .collect(Collectors.toMap(SysDictResDto::getValue, Function.identity(), (v1, v2) -> v1));
|
|
|
- }
|
|
|
+ List<String> types = Arrays.asList(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.UNIT_TYPE.getType());
|
|
|
//组装商品参数
|
|
|
- Map<String, SysDictResDto> finalValueAndDictResDtoMap = valueAndDictResDtoMap;
|
|
|
+ Map<String, Map<String, String>> finalValueAndDictResDtoMap = remoteSystemService.queryDictByType(types);
|
|
|
+
|
|
|
List<GoodsInfoResp.GoodsInfo> goodsInfos = goods.stream()
|
|
|
.filter(e -> Objects.equals(e.getStatus(), GoodsStatusEnum.PUT_ON_SHELVES.getCode()))
|
|
|
.map(x->KwpGoodsService.getGoodsInfo(x, finalValueAndDictResDtoMap))
|
|
|
@@ -1434,12 +1430,16 @@ public class KwpGoodsService {
|
|
|
return goodsInfoResp;
|
|
|
}
|
|
|
|
|
|
- private static GoodsInfoResp.GoodsInfo getGoodsInfo(KwpGoods x,Map<String, SysDictResDto> valueAndDictResDtoMap ) {
|
|
|
+ private static GoodsInfoResp.GoodsInfo getGoodsInfo(KwpGoods x,Map<String, Map<String, String>> valueAndDictResDtoMap ) {
|
|
|
GoodsInfoResp.GoodsInfo goodsInfo = new GoodsInfoResp.GoodsInfo();
|
|
|
goodsInfo.setGoodsId(x.getId());
|
|
|
- SysDictResDto dictResDto = valueAndDictResDtoMap.getOrDefault(x.getGoodsType(), new SysDictResDto());
|
|
|
- goodsInfo.setGoodsName(x.getName()+"/"+dictResDto.getLabel()+"/"+x.getSpec());
|
|
|
- goodsInfo.setAmountUnit(x.getUnit());
|
|
|
+
|
|
|
+ Map<String, String> productNameMap = valueAndDictResDtoMap.getOrDefault(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), new HashMap<>());
|
|
|
+ String productType = productNameMap.get(x.getGoodsType());
|
|
|
+ goodsInfo.setGoodsName(x.getName()+"/"+productType+"/"+x.getSpec());
|
|
|
+
|
|
|
+ Map<String, String> unitMap = valueAndDictResDtoMap.getOrDefault(DictTypeEnum.UNIT_TYPE.getType(), new HashMap<>());
|
|
|
+ goodsInfo.setAmountUnit(unitMap.get(x.getUnit()));
|
|
|
goodsInfo.setPriceUnit(x.getPriceUnit());
|
|
|
return goodsInfo;
|
|
|
}
|