|
@@ -139,6 +139,7 @@ public class KwpGoodsService {
|
|
|
.setThumb(FileUtils.replaceAll(goods.getThumb()))
|
|
.setThumb(FileUtils.replaceAll(goods.getThumb()))
|
|
|
.setEntId(LoginUserHolder.getEntId())
|
|
.setEntId(LoginUserHolder.getEntId())
|
|
|
.setAddedTime(new Date())
|
|
.setAddedTime(new Date())
|
|
|
|
|
+ .setPriceUnit("元")
|
|
|
.setStatus(GoodsStatusEnum.PUT_ON_SHELVES.getCode());
|
|
.setStatus(GoodsStatusEnum.PUT_ON_SHELVES.getCode());
|
|
|
kwpGoodsMapper.insert(goods);
|
|
kwpGoodsMapper.insert(goods);
|
|
|
//添加商品其他信息
|
|
//添加商品其他信息
|
|
@@ -716,47 +717,32 @@ public class KwpGoodsService {
|
|
|
userIds.add(e.getCreateBy());
|
|
userIds.add(e.getCreateBy());
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- //地址信息
|
|
|
|
|
- Map<Long, String> addressMap = kwpGoodsAddressService.getByGoodsIds(goodsIds).stream()
|
|
|
|
|
- .collect(Collectors.toMap(KwpGoodsAddress::getGoodsId, KwpGoodsAddress::getName, (k1, k2) -> k1));
|
|
|
|
|
|
|
+
|
|
|
//价格梯度信息
|
|
//价格梯度信息
|
|
|
Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
|
|
Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
|
|
|
.collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
.collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
//用户信息
|
|
//用户信息
|
|
|
Map<Long, UserCacheResDto> userMap = remoteSystemService.queryUserCacheMapByIds(userIds);
|
|
Map<Long, UserCacheResDto> userMap = remoteSystemService.queryUserCacheMapByIds(userIds);
|
|
|
- //供应企业信息
|
|
|
|
|
- List<EntCacheResDto> entList = new ArrayList<>();
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(supplyEntIds)) {
|
|
|
|
|
- entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
|
|
Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
|
|
|
DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.TAX_RATE.getType(), DictTypeEnum.GOODS_STATUS.getType()));
|
|
DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.TAX_RATE.getType(), DictTypeEnum.GOODS_STATUS.getType()));
|
|
|
- Map<String, String> productNameMap, unitMap, taxRateMap, goodsStatusMap;
|
|
|
|
|
|
|
+ Map<String, String> productNameMap, unitMap, goodsStatusMap;
|
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
|
unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
|
|
unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
|
|
|
- taxRateMap = dict.get(DictTypeEnum.TAX_RATE.getType());
|
|
|
|
|
goodsStatusMap = dict.get(DictTypeEnum.GOODS_STATUS.getType());
|
|
goodsStatusMap = dict.get(DictTypeEnum.GOODS_STATUS.getType());
|
|
|
} else {
|
|
} else {
|
|
|
productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
- taxRateMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
}
|
|
}
|
|
|
- Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
|
|
|
list.forEach(e -> {
|
|
list.forEach(e -> {
|
|
|
Long id = e.getId();
|
|
Long id = e.getId();
|
|
|
GoodsList goodsList = BeanUtils.copyProperties(e, GoodsList.class);
|
|
GoodsList goodsList = BeanUtils.copyProperties(e, GoodsList.class);
|
|
|
- UserCacheResDto manager = userMap.get(e.getManager());
|
|
|
|
|
UserCacheResDto createUser = userMap.get(e.getCreateBy());
|
|
UserCacheResDto createUser = userMap.get(e.getCreateBy());
|
|
|
goodsList.setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(goodsList.getStatus())) : null)
|
|
goodsList.setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(goodsList.getStatus())) : null)
|
|
|
.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(goodsList.getGoodsType()) : null)
|
|
.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(goodsList.getGoodsType()) : null)
|
|
|
.setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(goodsList.getUnit()) : null)
|
|
.setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(goodsList.getUnit()) : null)
|
|
|
- .setTaxRateLabel(CollectionUtils.isNotEmpty(taxRateMap) ? taxRateMap.get(goodsList.getTaxRate()) : null)
|
|
|
|
|
- .setPrepaidLimitLabel(Objects.equals(e.getPrepaidLimit(), 1) ? "是" : "否")
|
|
|
|
|
- .setAddress(addressMap.get(id)).setSupplyEnt(entMap.get(e.getSupplyEntId()))
|
|
|
|
|
- .setManageName(Objects.nonNull(manager) ? manager.getName() : null)
|
|
|
|
|
- .setPhone(Objects.nonNull(manager) ? manager.getPhone() : null)
|
|
|
|
|
.setThumb(FileUtils.splice(e.getThumb()))
|
|
.setThumb(FileUtils.splice(e.getThumb()))
|
|
|
.setCreateByName(Objects.nonNull(createUser) ? createUser.getName() : null);
|
|
.setCreateByName(Objects.nonNull(createUser) ? createUser.getName() : null);
|
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(id);
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(id);
|