|
@@ -67,6 +67,7 @@ import java.math.RoundingMode;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -133,8 +134,7 @@ public class KwpGoodsService {
|
|
|
if (Objects.nonNull(address)) {
|
|
if (Objects.nonNull(address)) {
|
|
|
goods.setAreaCode(address.getCityCode()).setAddressName(address.getName());
|
|
goods.setAreaCode(address.getCityCode()).setAddressName(address.getName());
|
|
|
}
|
|
}
|
|
|
- goods.setEntId(LoginUserHolder.getEntId()).setThumb(FileUtils.replaceAll(goods.getThumb()))
|
|
|
|
|
- .setStatus(GoodsStatusEnum.SAVED.getCode());
|
|
|
|
|
|
|
+ goods.setEntId(LoginUserHolder.getEntId()).setThumb(FileUtils.replaceAll(goods.getThumb())).setStatus(GoodsStatusEnum.SAVED.getCode());
|
|
|
kwpGoodsMapper.insert(goods);
|
|
kwpGoodsMapper.insert(goods);
|
|
|
//添加商品其他信息
|
|
//添加商品其他信息
|
|
|
addGoodsOtherInfo(goods.getId(), BeanUtils.copyProperties(param, AddGoodsParam.class));
|
|
addGoodsOtherInfo(goods.getId(), BeanUtils.copyProperties(param, AddGoodsParam.class));
|
|
@@ -155,14 +155,7 @@ public class KwpGoodsService {
|
|
|
//添加商品信息
|
|
//添加商品信息
|
|
|
KwpGoods goods = BeanUtils.copyProperties(param, KwpGoods.class);
|
|
KwpGoods goods = BeanUtils.copyProperties(param, KwpGoods.class);
|
|
|
AddressInfo address = param.getAddressInfo();
|
|
AddressInfo address = param.getAddressInfo();
|
|
|
- goods.setCode(param.getCode())
|
|
|
|
|
- .setAreaCode(address.getCityCode())
|
|
|
|
|
- .setAddressName(address.getName())
|
|
|
|
|
- .setThumb(goods.getThumb())
|
|
|
|
|
- .setEntId(LoginUserHolder.getEntId())
|
|
|
|
|
- .setAddedTime(new Date())
|
|
|
|
|
- .setPriceUnit("元")
|
|
|
|
|
- .setStatus(GoodsStatusEnum.PUT_ON_SHELVES.getCode());
|
|
|
|
|
|
|
+ goods.setCode(param.getCode()).setAreaCode(address.getCityCode()).setAddressName(address.getName()).setThumb(goods.getThumb()).setEntId(LoginUserHolder.getEntId()).setAddedTime(new Date()).setPriceUnit("元").setStatus(GoodsStatusEnum.PUT_ON_SHELVES.getCode());
|
|
|
kwpGoodsMapper.insert(goods);
|
|
kwpGoodsMapper.insert(goods);
|
|
|
//添加商品其他信息
|
|
//添加商品其他信息
|
|
|
addGoodsOtherInfo(goods.getId(), param);
|
|
addGoodsOtherInfo(goods.getId(), param);
|
|
@@ -259,13 +252,7 @@ public class KwpGoodsService {
|
|
|
if (Objects.nonNull(managerInfo)) {
|
|
if (Objects.nonNull(managerInfo)) {
|
|
|
detail.setManagerName(managerInfo.getName());
|
|
detail.setManagerName(managerInfo.getName());
|
|
|
}
|
|
}
|
|
|
- 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.ADDRESS_TYPE.getType(),
|
|
|
|
|
- DictTypeEnum.GOODS_SPEC.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.ADDRESS_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
Map<String, String> productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
@@ -280,13 +267,9 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
List<SysDictResDto> types = remoteSystemService.queryDictFrontAll(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), detail.getGoodsType());
|
|
List<SysDictResDto> types = remoteSystemService.queryDictFrontAll(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), detail.getGoodsType());
|
|
|
if (CollectionUtils.isNotEmpty(types)) {
|
|
if (CollectionUtils.isNotEmpty(types)) {
|
|
|
- detail.setGoodsTypes(types.stream().map(SysDictResDto::getValue).toList())
|
|
|
|
|
- .setGoodsTypeLabels(String.join(Global.RIGHT_SLASH, types.stream().map(SysDictResDto::getLabel).toList()));
|
|
|
|
|
|
|
+ detail.setGoodsTypes(types.stream().map(SysDictResDto::getValue).toList()).setGoodsTypeLabels(String.join(Global.RIGHT_SLASH, types.stream().map(SysDictResDto::getLabel).toList()));
|
|
|
}
|
|
}
|
|
|
- detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null)
|
|
|
|
|
- .setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null)
|
|
|
|
|
- .setSpec(CollectionUtils.isNotEmpty(goodsMap) ? goodsMap.get(detail.getSpec()) : null)
|
|
|
|
|
- .setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null);
|
|
|
|
|
|
|
+ detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null).setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null).setSpec(CollectionUtils.isNotEmpty(goodsMap) ? goodsMap.get(detail.getSpec()) : null).setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null);
|
|
|
//商品图片信息
|
|
//商品图片信息
|
|
|
if (Objects.nonNull(goods.getThumb())) {
|
|
if (Objects.nonNull(goods.getThumb())) {
|
|
|
detail.setThumb(goods.getThumb());
|
|
detail.setThumb(goods.getThumb());
|
|
@@ -295,11 +278,7 @@ public class KwpGoodsService {
|
|
|
List<GoodsImagesDetail> images = BeanUtils.copyToList(goodsImages, GoodsImagesDetail.class);
|
|
List<GoodsImagesDetail> images = BeanUtils.copyToList(goodsImages, GoodsImagesDetail.class);
|
|
|
//商品价格
|
|
//商品价格
|
|
|
List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(id);
|
|
List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(id);
|
|
|
- BigDecimal price = Optional.ofNullable(priceRanges)
|
|
|
|
|
- .filter(list -> !list.isEmpty())
|
|
|
|
|
- .map(list -> list.get(0))
|
|
|
|
|
- .map(KwpGoodsPriceRange::getPrice)
|
|
|
|
|
- .orElse(null);
|
|
|
|
|
|
|
+ BigDecimal price = Optional.ofNullable(priceRanges).filter(list -> !list.isEmpty()).map(list -> list.get(0)).map(KwpGoodsPriceRange::getPrice).orElse(null);
|
|
|
|
|
|
|
|
//商品属性信息
|
|
//商品属性信息
|
|
|
List<KwpGoodsAttribute> attributesList = kwpGoodsAttributeService.getByGoodsId(id);
|
|
List<KwpGoodsAttribute> attributesList = kwpGoodsAttributeService.getByGoodsId(id);
|
|
@@ -333,8 +312,7 @@ public class KwpGoodsService {
|
|
|
public GoodsDetail getDetail(Long id) {
|
|
public GoodsDetail getDetail(Long id) {
|
|
|
GoodsDetail detail = detail(id);
|
|
GoodsDetail detail = detail(id);
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(KwpGoods::getGoodsType, detail.getGoodsType()).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO).ne(KwpGoods::getId, id).last("LIMIT 4");
|
|
|
|
|
|
|
+ wrapper.eq(KwpGoods::getGoodsType, detail.getGoodsType()).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO).ne(KwpGoods::getId, id).last("LIMIT 4");
|
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
return detail;
|
|
return detail;
|
|
@@ -347,15 +325,12 @@ public class KwpGoodsService {
|
|
|
unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
}
|
|
}
|
|
|
List<Long> goodsIds = list.stream().map(KwpGoods::getId).toList();
|
|
List<Long> goodsIds = list.stream().map(KwpGoods::getId).toList();
|
|
|
- Map<Long, List<KwpGoodsPriceRange>> map = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
|
|
|
|
|
- .collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
|
|
|
|
+ Map<Long, List<KwpGoodsPriceRange>> map = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream().collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
List<RecommendGoods> recommendGoodsList = new ArrayList<>();
|
|
List<RecommendGoods> recommendGoodsList = new ArrayList<>();
|
|
|
list.forEach(e -> {
|
|
list.forEach(e -> {
|
|
|
RecommendGoods recommendGoods = BeanUtils.copyProperties(e, RecommendGoods.class);
|
|
RecommendGoods recommendGoods = BeanUtils.copyProperties(e, RecommendGoods.class);
|
|
|
List<KwpGoodsPriceRange> prices = map.get(recommendGoods.getId());
|
|
List<KwpGoodsPriceRange> prices = map.get(recommendGoods.getId());
|
|
|
- recommendGoods.setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(recommendGoods.getUnit()) : null)
|
|
|
|
|
- .setPrice(CollectionUtils.isNotEmpty(prices) ? prices.get(0).getPrice() : null)
|
|
|
|
|
- .setThumb(FileUtils.splice(e.getThumb()));
|
|
|
|
|
|
|
+ recommendGoods.setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(recommendGoods.getUnit()) : null).setPrice(CollectionUtils.isNotEmpty(prices) ? prices.get(0).getPrice() : null).setThumb(FileUtils.splice(e.getThumb()));
|
|
|
recommendGoodsList.add(recommendGoods);
|
|
recommendGoodsList.add(recommendGoods);
|
|
|
});
|
|
});
|
|
|
detail.setRecommendGoodsList(recommendGoodsList);
|
|
detail.setRecommendGoodsList(recommendGoodsList);
|
|
@@ -378,8 +353,7 @@ public class KwpGoodsService {
|
|
|
Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntCacheMapByIds(Arrays.asList(detail.getEntId(), detail.getSupplyEntId()));
|
|
Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntCacheMapByIds(Arrays.asList(detail.getEntId(), detail.getSupplyEntId()));
|
|
|
EntCacheResDto ent = entMap.get(detail.getEntId());
|
|
EntCacheResDto ent = entMap.get(detail.getEntId());
|
|
|
if (Objects.nonNull(ent)) {
|
|
if (Objects.nonNull(ent)) {
|
|
|
- detail.setEnt(ent.getFirmName()).setEntHead(ent.getHead())
|
|
|
|
|
- .setEntBusiness(ent.getBusiness()).setEntAddress(ent.getCityName());
|
|
|
|
|
|
|
+ detail.setEnt(ent.getFirmName()).setEntHead(ent.getHead()).setEntBusiness(ent.getBusiness()).setEntAddress(ent.getCityName());
|
|
|
}
|
|
}
|
|
|
EntCacheResDto supplyEnt = entMap.get(detail.getSupplyEntId());
|
|
EntCacheResDto supplyEnt = entMap.get(detail.getSupplyEntId());
|
|
|
if (Objects.nonNull(supplyEnt)) {
|
|
if (Objects.nonNull(supplyEnt)) {
|
|
@@ -389,13 +363,7 @@ public class KwpGoodsService {
|
|
|
if (Objects.nonNull(managerInfo)) {
|
|
if (Objects.nonNull(managerInfo)) {
|
|
|
detail.setManagerName(managerInfo.getName());
|
|
detail.setManagerName(managerInfo.getName());
|
|
|
}
|
|
}
|
|
|
- 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.ADDRESS_TYPE.getType(),
|
|
|
|
|
- DictTypeEnum.GOODS_SPEC.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.ADDRESS_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
Map<String, String> productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
@@ -410,13 +378,9 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
List<SysDictResDto> types = remoteSystemService.queryDictFrontAll(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), detail.getGoodsType());
|
|
List<SysDictResDto> types = remoteSystemService.queryDictFrontAll(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), detail.getGoodsType());
|
|
|
if (CollectionUtils.isNotEmpty(types)) {
|
|
if (CollectionUtils.isNotEmpty(types)) {
|
|
|
- detail.setGoodsTypes(types.stream().map(SysDictResDto::getValue).toList())
|
|
|
|
|
- .setGoodsTypeLabels(String.join(Global.RIGHT_SLASH, types.stream().map(SysDictResDto::getLabel).toList()));
|
|
|
|
|
|
|
+ detail.setGoodsTypes(types.stream().map(SysDictResDto::getValue).toList()).setGoodsTypeLabels(String.join(Global.RIGHT_SLASH, types.stream().map(SysDictResDto::getLabel).toList()));
|
|
|
}
|
|
}
|
|
|
- detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null)
|
|
|
|
|
- .setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null)
|
|
|
|
|
- .setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null)
|
|
|
|
|
- .setSpecLabel(CollectionUtils.isNotEmpty(goodsSpecMap) ? goodsSpecMap.get(String.valueOf(detail.getSpec())) : null);
|
|
|
|
|
|
|
+ detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null).setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null).setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null).setSpecLabel(CollectionUtils.isNotEmpty(goodsSpecMap) ? goodsSpecMap.get(String.valueOf(detail.getSpec())) : null);
|
|
|
//商品图片信息
|
|
//商品图片信息
|
|
|
if (Objects.nonNull(goods.getThumb())) {
|
|
if (Objects.nonNull(goods.getThumb())) {
|
|
|
detail.setThumb(goods.getThumb());
|
|
detail.setThumb(goods.getThumb());
|
|
@@ -425,11 +389,7 @@ public class KwpGoodsService {
|
|
|
List<GoodsImagesDetail> images = BeanUtils.copyToList(goodsImages, GoodsImagesDetail.class);
|
|
List<GoodsImagesDetail> images = BeanUtils.copyToList(goodsImages, GoodsImagesDetail.class);
|
|
|
//商品价格
|
|
//商品价格
|
|
|
List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(id);
|
|
List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(id);
|
|
|
- BigDecimal price = Optional.ofNullable(priceRanges)
|
|
|
|
|
- .filter(list -> !list.isEmpty())
|
|
|
|
|
- .map(list -> list.get(0))
|
|
|
|
|
- .map(KwpGoodsPriceRange::getPrice)
|
|
|
|
|
- .orElse(null);
|
|
|
|
|
|
|
+ BigDecimal price = Optional.ofNullable(priceRanges).filter(list -> !list.isEmpty()).map(list -> list.get(0)).map(KwpGoodsPriceRange::getPrice).orElse(null);
|
|
|
|
|
|
|
|
//商品属性信息
|
|
//商品属性信息
|
|
|
List<KwpGoodsAttribute> attributesList = kwpGoodsAttributeService.getByGoodsId(id);
|
|
List<KwpGoodsAttribute> attributesList = kwpGoodsAttributeService.getByGoodsId(id);
|
|
@@ -482,8 +442,7 @@ public class KwpGoodsService {
|
|
|
if (Objects.isNull(goods)) {
|
|
if (Objects.isNull(goods)) {
|
|
|
throw new BusinessException("当前商品不存在!");
|
|
throw new BusinessException("当前商品不存在!");
|
|
|
}
|
|
}
|
|
|
- if (Objects.equals(goods.getStatus(), GoodsStatusEnum.PUT_ON_SHELVES.getCode()) ||
|
|
|
|
|
- Objects.equals(goods.getStatus(), GoodsStatusEnum.TAKE_OFF_SHELVES.getCode())) {
|
|
|
|
|
|
|
+ if (Objects.equals(goods.getStatus(), GoodsStatusEnum.PUT_ON_SHELVES.getCode()) || Objects.equals(goods.getStatus(), GoodsStatusEnum.TAKE_OFF_SHELVES.getCode())) {
|
|
|
String msg = judgeParameters(param);
|
|
String msg = judgeParameters(param);
|
|
|
if (StringUtils.isNotBlank(msg)) {
|
|
if (StringUtils.isNotBlank(msg)) {
|
|
|
throw new BusinessException(msg);
|
|
throw new BusinessException(msg);
|
|
@@ -493,19 +452,7 @@ public class KwpGoodsService {
|
|
|
Integer areaCode = Objects.isNull(address) ? null : address.getCityCode();
|
|
Integer areaCode = Objects.isNull(address) ? null : address.getCityCode();
|
|
|
String addressName = Objects.isNull(address) ? null : address.getName();
|
|
String addressName = Objects.isNull(address) ? null : address.getName();
|
|
|
LambdaUpdateWrapper<KwpGoods> wrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<KwpGoods> wrapper = new LambdaUpdateWrapper<>();
|
|
|
- wrapper.set(KwpGoods::getName, param.getName())
|
|
|
|
|
- .set(KwpGoods::getGoodsType, param.getGoodsType())
|
|
|
|
|
- .set(KwpGoods::getUnit, param.getUnit())
|
|
|
|
|
- .set(KwpGoods::getSpec, param.getSpec())
|
|
|
|
|
- .set(KwpGoods::getCode, param.getCode())
|
|
|
|
|
- .set(KwpGoods::getCarAxis, param.getCarAxis())
|
|
|
|
|
- .set(KwpGoods::getContent, param.getContent())
|
|
|
|
|
- .set(KwpGoods::getSupplyEntId, param.getSupplyEntId())
|
|
|
|
|
- .set(KwpGoods::getRemark, param.getRemark())
|
|
|
|
|
- .set(KwpGoods::getThumb, param.getThumb())
|
|
|
|
|
- .set(KwpGoods::getAreaCode, areaCode)
|
|
|
|
|
- .set(KwpGoods::getAddressName, addressName)
|
|
|
|
|
- .eq(KwpGoods::getId, param.getId());
|
|
|
|
|
|
|
+ wrapper.set(KwpGoods::getName, param.getName()).set(KwpGoods::getGoodsType, param.getGoodsType()).set(KwpGoods::getUnit, param.getUnit()).set(KwpGoods::getSpec, param.getSpec()).set(KwpGoods::getCode, param.getCode()).set(KwpGoods::getCarAxis, param.getCarAxis()).set(KwpGoods::getContent, param.getContent()).set(KwpGoods::getSupplyEntId, param.getSupplyEntId()).set(KwpGoods::getRemark, param.getRemark()).set(KwpGoods::getThumb, param.getThumb()).set(KwpGoods::getAreaCode, areaCode).set(KwpGoods::getAddressName, addressName).eq(KwpGoods::getId, param.getId());
|
|
|
kwpGoodsMapper.update(null, wrapper);
|
|
kwpGoodsMapper.update(null, wrapper);
|
|
|
updateGoodsOtherInfo(param);
|
|
updateGoodsOtherInfo(param);
|
|
|
}
|
|
}
|
|
@@ -724,10 +671,7 @@ public class KwpGoodsService {
|
|
|
List<GoodsListExport> result = new ArrayList<>(list.size());
|
|
List<GoodsListExport> result = new ArrayList<>(list.size());
|
|
|
goodsLists.forEach(e -> {
|
|
goodsLists.forEach(e -> {
|
|
|
GoodsListExport export = BeanUtils.copyProperties(e, GoodsListExport.class);
|
|
GoodsListExport export = BeanUtils.copyProperties(e, GoodsListExport.class);
|
|
|
- export.setAmount(Objects.isNull(e.getAmount()) ? null : String.valueOf(e.getAmount()))
|
|
|
|
|
- .setAddedTime(Objects.isNull(e.getAddedTime()) ? null : DateUtil.getDateTime(e.getAddedTime()))
|
|
|
|
|
- .setShelfTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime()))
|
|
|
|
|
- .setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()));
|
|
|
|
|
|
|
+ export.setAmount(Objects.isNull(e.getAmount()) ? null : String.valueOf(e.getAmount())).setAddedTime(Objects.isNull(e.getAddedTime()) ? null : DateUtil.getDateTime(e.getAddedTime())).setShelfTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime())).setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()));
|
|
|
result.add(export);
|
|
result.add(export);
|
|
|
});
|
|
});
|
|
|
return result;
|
|
return result;
|
|
@@ -752,9 +696,7 @@ public class KwpGoodsService {
|
|
|
if (Objects.nonNull(params.getEndCreateTime())) {
|
|
if (Objects.nonNull(params.getEndCreateTime())) {
|
|
|
wrapper.le(KwpGoods::getCreateTime, params.getEndCreateTime());
|
|
wrapper.le(KwpGoods::getCreateTime, params.getEndCreateTime());
|
|
|
}
|
|
}
|
|
|
- wrapper.eq(Objects.nonNull(params.getSupplyEntId()), KwpGoods::getSupplyEntId, params.getSupplyEntId())
|
|
|
|
|
- .eq(Objects.nonNull(params.getPrepaidLimit()), KwpGoods::getPrepaidLimit, params.getPrepaidLimit())
|
|
|
|
|
- .eq(Objects.nonNull(params.getStatus()), KwpGoods::getStatus, params.getStatus());
|
|
|
|
|
|
|
+ wrapper.eq(Objects.nonNull(params.getSupplyEntId()), KwpGoods::getSupplyEntId, params.getSupplyEntId()).eq(Objects.nonNull(params.getPrepaidLimit()), KwpGoods::getPrepaidLimit, params.getPrepaidLimit()).eq(Objects.nonNull(params.getStatus()), KwpGoods::getStatus, params.getStatus());
|
|
|
if (StringUtils.isNotBlank(params.getGoodsType()) && StringUtils.isNotBlank(params.getGoodsTypeValue())) {
|
|
if (StringUtils.isNotBlank(params.getGoodsType()) && StringUtils.isNotBlank(params.getGoodsTypeValue())) {
|
|
|
List<SysDictResDto> goodsTypeList = remoteSystemService.queryDictBottom(params.getGoodsType(), params.getGoodsTypeValue());
|
|
List<SysDictResDto> goodsTypeList = remoteSystemService.queryDictBottom(params.getGoodsType(), params.getGoodsTypeValue());
|
|
|
if (CollectionUtils.isNotEmpty(goodsTypeList)) {
|
|
if (CollectionUtils.isNotEmpty(goodsTypeList)) {
|
|
@@ -798,8 +740,7 @@ public class KwpGoodsService {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
//价格信息
|
|
//价格信息
|
|
|
- Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
|
|
|
|
|
- .collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
|
|
|
|
+ Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream().collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
//用户信息
|
|
//用户信息
|
|
|
Map<Long, UserCacheResDto> userMap = remoteSystemService.queryUserCacheMapByIds(userIds);
|
|
Map<Long, UserCacheResDto> userMap = remoteSystemService.queryUserCacheMapByIds(userIds);
|
|
|
//供应企业信息
|
|
//供应企业信息
|
|
@@ -807,11 +748,7 @@ public class KwpGoodsService {
|
|
|
if (CollectionUtils.isNotEmpty(supplyEntIds)) {
|
|
if (CollectionUtils.isNotEmpty(supplyEntIds)) {
|
|
|
entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
|
}
|
|
}
|
|
|
- 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.GOODS_SPEC.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.GOODS_SPEC.getType()));
|
|
|
Map<String, String> productNameMap, unitMap, goodsStatusMap, goodsSpecMap;
|
|
Map<String, String> productNameMap, unitMap, goodsStatusMap, goodsSpecMap;
|
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
@@ -829,20 +766,10 @@ public class KwpGoodsService {
|
|
|
Long id = e.getId();
|
|
Long id = e.getId();
|
|
|
GoodsList goodsList = BeanUtils.copyProperties(e, GoodsList.class);
|
|
GoodsList goodsList = BeanUtils.copyProperties(e, GoodsList.class);
|
|
|
UserCacheResDto createUser = userMap.get(e.getCreateBy());
|
|
UserCacheResDto createUser = userMap.get(e.getCreateBy());
|
|
|
- goodsList.setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(goodsList.getStatus())) : null)
|
|
|
|
|
- .setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(goodsList.getGoodsType()) : null)
|
|
|
|
|
- .setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(goodsList.getUnit()) : null)
|
|
|
|
|
- .setSpecLabel(CollectionUtils.isNotEmpty(goodsSpecMap) ? goodsSpecMap.get(goodsList.getSpec()) : null)
|
|
|
|
|
- .setSupplyEnt(entMap.get(e.getSupplyEntId()))
|
|
|
|
|
- .setThumb(FileUtils.splice(e.getThumb()))
|
|
|
|
|
- .setCreateByName(Objects.nonNull(createUser) ? createUser.getName() : null);
|
|
|
|
|
|
|
+ goodsList.setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(goodsList.getStatus())) : null).setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(goodsList.getGoodsType()) : null).setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(goodsList.getUnit()) : null).setSpecLabel(CollectionUtils.isNotEmpty(goodsSpecMap) ? goodsSpecMap.get(goodsList.getSpec()) : null).setSupplyEnt(entMap.get(e.getSupplyEntId())).setThumb(FileUtils.splice(e.getThumb())).setCreateByName(Objects.nonNull(createUser) ? createUser.getName() : null);
|
|
|
|
|
|
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(id);
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(id);
|
|
|
- BigDecimal price = Optional.ofNullable(priceRanges)
|
|
|
|
|
- .filter(priceRangeList -> !priceRangeList.isEmpty())
|
|
|
|
|
- .map(priceRangeList -> priceRangeList.get(0))
|
|
|
|
|
- .map(KwpGoodsPriceRange::getPrice)
|
|
|
|
|
- .orElse(null);
|
|
|
|
|
|
|
+ BigDecimal price = Optional.ofNullable(priceRanges).filter(priceRangeList -> !priceRangeList.isEmpty()).map(priceRangeList -> priceRangeList.get(0)).map(KwpGoodsPriceRange::getPrice).orElse(null);
|
|
|
goodsList.setPrice(price);
|
|
goodsList.setPrice(price);
|
|
|
|
|
|
|
|
result.add(goodsList);
|
|
result.add(goodsList);
|
|
@@ -860,16 +787,13 @@ public class KwpGoodsService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void batchPutOnShelves(List<Long> ids) {
|
|
public void batchPutOnShelves(List<Long> ids) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(KwpGoods::getId, ids)
|
|
|
|
|
- .eq(KwpGoods::getEntId, LoginUserHolder.getEntId())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
|
|
|
|
+ wrapper.in(KwpGoods::getId, ids).eq(KwpGoods::getEntId, LoginUserHolder.getEntId()).eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
List<KwpGoods> goodsList = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> goodsList = kwpGoodsMapper.selectList(wrapper);
|
|
|
if (CollectionUtils.isEmpty(goodsList)) {
|
|
if (CollectionUtils.isEmpty(goodsList)) {
|
|
|
throw new BusinessException("商品不存在!");
|
|
throw new BusinessException("商品不存在!");
|
|
|
}
|
|
}
|
|
|
//校验
|
|
//校验
|
|
|
- boolean hasPutOnShelves = goodsList.stream()
|
|
|
|
|
- .anyMatch(good -> Objects.equals(GoodsStatusEnum.PUT_ON_SHELVES.getCode(), good.getStatus()));
|
|
|
|
|
|
|
+ boolean hasPutOnShelves = goodsList.stream().anyMatch(good -> Objects.equals(GoodsStatusEnum.PUT_ON_SHELVES.getCode(), good.getStatus()));
|
|
|
if (hasPutOnShelves) {
|
|
if (hasPutOnShelves) {
|
|
|
throw new BusinessException("上架操作仅针对“已下架”“草稿”状态的单据!");
|
|
throw new BusinessException("上架操作仅针对“已下架”“草稿”状态的单据!");
|
|
|
}
|
|
}
|
|
@@ -880,11 +804,7 @@ public class KwpGoodsService {
|
|
|
updateParam.setAttributes(BeanUtils.copyToList(kwpGoodsAttributeService.getByGoodsId(goods.getId()), GoodsAttributes.class));
|
|
updateParam.setAttributes(BeanUtils.copyToList(kwpGoodsAttributeService.getByGoodsId(goods.getId()), GoodsAttributes.class));
|
|
|
//价格
|
|
//价格
|
|
|
List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(goods.getId());
|
|
List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(goods.getId());
|
|
|
- BigDecimal price = Optional.ofNullable(priceRanges)
|
|
|
|
|
- .filter(priceRangeList -> !priceRangeList.isEmpty())
|
|
|
|
|
- .map(priceRangeList -> priceRangeList.get(0))
|
|
|
|
|
- .map(KwpGoodsPriceRange::getPrice)
|
|
|
|
|
- .orElse(null);
|
|
|
|
|
|
|
+ BigDecimal price = Optional.ofNullable(priceRanges).filter(priceRangeList -> !priceRangeList.isEmpty()).map(priceRangeList -> priceRangeList.get(0)).map(KwpGoodsPriceRange::getPrice).orElse(null);
|
|
|
updateParam.setPrice(price);
|
|
updateParam.setPrice(price);
|
|
|
updateParam.setImages(BeanUtils.copyToList(kwpGoodsImageService.getByGoodsId(goods.getId()), GoodsImages.class));
|
|
updateParam.setImages(BeanUtils.copyToList(kwpGoodsImageService.getByGoodsId(goods.getId()), GoodsImages.class));
|
|
|
updateParam.setAddressInfo(BeanUtils.copyProperties(kwpGoodsAddressService.getByGoodsId(goods.getId()), AddressInfo.class));
|
|
updateParam.setAddressInfo(BeanUtils.copyProperties(kwpGoodsAddressService.getByGoodsId(goods.getId()), AddressInfo.class));
|
|
@@ -895,9 +815,7 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
LambdaUpdateWrapper<KwpGoods> updateWrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<KwpGoods> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
|
|
- .set(KwpGoods::getAddedTime, new Date())
|
|
|
|
|
- .eq(KwpGoods::getId, goods.getId());
|
|
|
|
|
|
|
+ updateWrapper.set(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).set(KwpGoods::getAddedTime, new Date()).eq(KwpGoods::getId, goods.getId());
|
|
|
kwpGoodsMapper.update(null, updateWrapper);
|
|
kwpGoodsMapper.update(null, updateWrapper);
|
|
|
}
|
|
}
|
|
|
goodsList.forEach(e -> {
|
|
goodsList.forEach(e -> {
|
|
@@ -925,10 +843,7 @@ public class KwpGoodsService {
|
|
|
urlMap.put(ClientTypeEnum.app.getValue(), appGoodsListUrl);
|
|
urlMap.put(ClientTypeEnum.app.getValue(), appGoodsListUrl);
|
|
|
urlMap.put(ClientTypeEnum.pc.getValue(), pcGoodsListUrl);
|
|
urlMap.put(ClientTypeEnum.pc.getValue(), pcGoodsListUrl);
|
|
|
SckwMessage msg = new SckwMessage(msgEnum);
|
|
SckwMessage msg = new SckwMessage(msgEnum);
|
|
|
- msg.setParams(map)
|
|
|
|
|
- .setMsgUrls(urlMap)
|
|
|
|
|
- .setUserInfos(userInfos)
|
|
|
|
|
- .setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
|
|
+ msg.setParams(map).setMsgUrls(urlMap).setUserInfos(userInfos).setCreateBy(LoginUserHolder.getUserId());
|
|
|
log.info(msgEnum.getTitle() + "消息:{}", JSON.toJSONString(msg));
|
|
log.info(msgEnum.getTitle() + "消息:{}", JSON.toJSONString(msg));
|
|
|
streamBridge.send("sckw-message", JSON.toJSONString(msg));
|
|
streamBridge.send("sckw-message", JSON.toJSONString(msg));
|
|
|
}
|
|
}
|
|
@@ -967,8 +882,7 @@ public class KwpGoodsService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void batchDelete(List<Long> ids) {
|
|
public void batchDelete(List<Long> ids) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(KwpGoods::getId, ids).eq(KwpGoods::getStatus, 0)
|
|
|
|
|
- .eq(KwpGoods::getEntId, LoginUserHolder.getEntId()).eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
|
|
|
|
+ wrapper.in(KwpGoods::getId, ids).eq(KwpGoods::getStatus, 0).eq(KwpGoods::getEntId, LoginUserHolder.getEntId()).eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
|
if (!Objects.equals(ids.size(), list.size())) {
|
|
if (!Objects.equals(ids.size(), list.size())) {
|
|
|
throw new BusinessException("删除操作仅针对“草稿”状态的单据");
|
|
throw new BusinessException("删除操作仅针对“草稿”状态的单据");
|
|
@@ -1019,9 +933,7 @@ public class KwpGoodsService {
|
|
|
if (StringUtils.isNotBlank(params.getKeywords())) {
|
|
if (StringUtils.isNotBlank(params.getKeywords())) {
|
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByName(params.getKeywords());
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByName(params.getKeywords());
|
|
|
List<Long> entIds = entList.stream().map(EntCacheResDto::getId).toList();
|
|
List<Long> entIds = entList.stream().map(EntCacheResDto::getId).toList();
|
|
|
- wrapper.and(kwpGoodsLambdaQueryWrapper -> kwpGoodsLambdaQueryWrapper.like(KwpGoods::getName, params.getKeywords())
|
|
|
|
|
- .or(CollUtil.isNotEmpty(entIds)).in(CollUtil.isNotEmpty(entIds), KwpGoods::getSupplyEntId, entIds)
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ wrapper.and(kwpGoodsLambdaQueryWrapper -> kwpGoodsLambdaQueryWrapper.like(KwpGoods::getName, params.getKeywords()).or(CollUtil.isNotEmpty(entIds)).in(CollUtil.isNotEmpty(entIds), KwpGoods::getSupplyEntId, entIds));
|
|
|
}
|
|
}
|
|
|
wrapper.eq(StrUtil.isNotBlank(params.getSpec()), KwpGoods::getSpec, params.getSpec());
|
|
wrapper.eq(StrUtil.isNotBlank(params.getSpec()), KwpGoods::getSpec, params.getSpec());
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
Long entId = LoginUserHolder.getEntId();
|
|
@@ -1060,16 +972,13 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
//地址信息
|
|
//地址信息
|
|
|
- Map<Long, KwpGoodsAddress> addressMap = kwpGoodsAddressService.getByGoodsIds(goodsIds).stream()
|
|
|
|
|
- .collect(Collectors.toMap(KwpGoodsAddress::getGoodsId, e -> e, (k1, k2) -> k1));
|
|
|
|
|
|
|
+ Map<Long, KwpGoodsAddress> addressMap = kwpGoodsAddressService.getByGoodsIds(goodsIds).stream().collect(Collectors.toMap(KwpGoodsAddress::getGoodsId, e -> e, (k1, k2) -> k1));
|
|
|
//价格梯度信息
|
|
//价格梯度信息
|
|
|
- Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
|
|
|
|
|
- .collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
|
|
|
|
+ Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream().collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
//供应企业信息
|
|
//供应企业信息
|
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
|
Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
|
- Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
|
|
|
|
|
- DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
|
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
Map<String, String> productNameMap, unitMap, specMap;
|
|
Map<String, String> productNameMap, unitMap, specMap;
|
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
@@ -1084,14 +993,7 @@ public class KwpGoodsService {
|
|
|
BuildingMaterialsMarketList materials = BeanUtils.copyProperties(e, BuildingMaterialsMarketList.class);
|
|
BuildingMaterialsMarketList materials = BeanUtils.copyProperties(e, BuildingMaterialsMarketList.class);
|
|
|
KwpGoodsAddress address = addressMap.get(e.getId());
|
|
KwpGoodsAddress address = addressMap.get(e.getId());
|
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(e.getId());
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(e.getId());
|
|
|
- materials.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(e.getGoodsType()) : null)
|
|
|
|
|
- .setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(e.getUnit()) : null)
|
|
|
|
|
- .setSpec(CollectionUtils.isNotEmpty(specMap) ? specMap.get(e.getSpec()) : null)
|
|
|
|
|
- .setAddressName(Objects.isNull(address) ? null : address.getCityName())
|
|
|
|
|
- .setDetailAddress(Objects.isNull(address) ? null : address.getDetailAddress())
|
|
|
|
|
- .setPrice(CollectionUtils.isEmpty(priceRanges) ? null : priceRanges.get(0).getPrice())
|
|
|
|
|
- .setThumb(FileUtils.splice(e.getThumb()))
|
|
|
|
|
- .setSupplyEnt(entMap.get(e.getSupplyEntId()));
|
|
|
|
|
|
|
+ materials.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(e.getGoodsType()) : null).setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(e.getUnit()) : null).setSpec(CollectionUtils.isNotEmpty(specMap) ? specMap.get(e.getSpec()) : null).setAddressName(Objects.isNull(address) ? null : address.getCityName()).setDetailAddress(Objects.isNull(address) ? null : address.getDetailAddress()).setPrice(CollectionUtils.isEmpty(priceRanges) ? null : priceRanges.get(0).getPrice()).setThumb(FileUtils.splice(e.getThumb())).setSupplyEnt(entMap.get(e.getSupplyEntId()));
|
|
|
materials.setSignFlag(false);
|
|
materials.setSignFlag(false);
|
|
|
if (Objects.nonNull(entId)) {
|
|
if (Objects.nonNull(entId)) {
|
|
|
TradeContractGoodsDto tradeContractResDto = remoteContractService.queryTradeContractNew(entId, e.getId(), LocalDateTime.now());
|
|
TradeContractGoodsDto tradeContractResDto = remoteContractService.queryTradeContractNew(entId, e.getId(), LocalDateTime.now());
|
|
@@ -1121,9 +1023,7 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId);
|
|
wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId);
|
|
|
}
|
|
}
|
|
|
- wrapper.like(StringUtils.isNotBlank(params.getName()), KwpGoods::getName, params.getName())
|
|
|
|
|
- .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO).orderByDesc(KwpGoods::getAddedTime);
|
|
|
|
|
|
|
+ wrapper.like(StringUtils.isNotBlank(params.getName()), KwpGoods::getName, params.getName()).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO).orderByDesc(KwpGoods::getAddedTime);
|
|
|
|
|
|
|
|
//专场逻辑
|
|
//专场逻辑
|
|
|
String accessSpecial = request.getHeader("Access-Special");
|
|
String accessSpecial = request.getHeader("Access-Special");
|
|
@@ -1163,8 +1063,7 @@ public class KwpGoodsService {
|
|
|
*/
|
|
*/
|
|
|
public KwpGoods getGoodsById(Long id) {
|
|
public KwpGoods getGoodsById(Long id) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- LambdaQueryWrapper<KwpGoods> last = wrapper.eq(KwpGoods::getId, id).eq(KwpGoods::getEntId, LoginUserHolder.getEntId())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
|
|
|
|
+ LambdaQueryWrapper<KwpGoods> last = wrapper.eq(KwpGoods::getId, id).eq(KwpGoods::getEntId, LoginUserHolder.getEntId()).eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
return kwpGoodsMapper.selectOne(last);
|
|
return kwpGoodsMapper.selectOne(last);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1177,9 +1076,7 @@ public class KwpGoodsService {
|
|
|
*/
|
|
*/
|
|
|
public KwpGoods getOnShelfGoodsById(Long id) {
|
|
public KwpGoods getOnShelfGoodsById(Long id) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- LambdaQueryWrapper<KwpGoods> last = wrapper.eq(KwpGoods::getId, id)
|
|
|
|
|
- .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
|
|
|
|
+ LambdaQueryWrapper<KwpGoods> last = wrapper.eq(KwpGoods::getId, id).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
return kwpGoodsMapper.selectOne(last);
|
|
return kwpGoodsMapper.selectOne(last);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1236,8 +1133,7 @@ public class KwpGoodsService {
|
|
|
*/
|
|
*/
|
|
|
public BigDecimal maxPurchaseNum(MaxPurchaseNumParam param) {
|
|
public BigDecimal maxPurchaseNum(MaxPurchaseNumParam param) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- LambdaQueryWrapper<KwpGoods> last = wrapper.eq(KwpGoods::getId, param.getGoodsId()).eq(KwpGoods::getDelFlag, Global.NO)
|
|
|
|
|
- .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).last("LIMIT 1");
|
|
|
|
|
|
|
+ LambdaQueryWrapper<KwpGoods> last = wrapper.eq(KwpGoods::getId, param.getGoodsId()).eq(KwpGoods::getDelFlag, Global.NO).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).last("LIMIT 1");
|
|
|
KwpGoods goods = kwpGoodsMapper.selectOne(last);
|
|
KwpGoods goods = kwpGoodsMapper.selectOne(last);
|
|
|
if (Objects.isNull(goods)) {
|
|
if (Objects.isNull(goods)) {
|
|
|
throw new BusinessException("商品不存在或已下架!");
|
|
throw new BusinessException("商品不存在或已下架!");
|
|
@@ -1290,9 +1186,7 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(KwpGoods::getId, id)
|
|
|
|
|
- .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
|
|
|
|
+ wrapper.eq(KwpGoods::getId, id).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
KwpGoods goods = kwpGoodsMapper.selectOne(wrapper);
|
|
KwpGoods goods = kwpGoodsMapper.selectOne(wrapper);
|
|
|
if (Objects.isNull(goods)) {
|
|
if (Objects.isNull(goods)) {
|
|
|
throw new BusinessException("商品不存在或已下架!");
|
|
throw new BusinessException("商品不存在或已下架!");
|
|
@@ -1319,8 +1213,7 @@ public class KwpGoodsService {
|
|
|
|
|
|
|
|
public Long getCountByManager(Long managerId) {
|
|
public Long getCountByManager(Long managerId) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(KwpGoods::getManager, managerId).eq(KwpGoods::getDelFlag, Global.NO).
|
|
|
|
|
- ne(KwpGoods::getStatus, GoodsStatusEnum.SAVED.getCode());
|
|
|
|
|
|
|
+ wrapper.eq(KwpGoods::getManager, managerId).eq(KwpGoods::getDelFlag, Global.NO).ne(KwpGoods::getStatus, GoodsStatusEnum.SAVED.getCode());
|
|
|
return kwpGoodsMapper.selectCount(wrapper);
|
|
return kwpGoodsMapper.selectCount(wrapper);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1335,8 +1228,7 @@ public class KwpGoodsService {
|
|
|
*/
|
|
*/
|
|
|
public Boolean nameDuplicationJudgment(String name, Long supplyEntId, Long id) {
|
|
public Boolean nameDuplicationJudgment(String name, Long supplyEntId, Long id) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId)
|
|
|
|
|
- .eq(KwpGoods::getName, name).eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
|
|
|
|
+ wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId).eq(KwpGoods::getName, name).eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
if (Objects.nonNull(id)) {
|
|
if (Objects.nonNull(id)) {
|
|
|
wrapper.ne(KwpGoods::getId, id);
|
|
wrapper.ne(KwpGoods::getId, id);
|
|
|
}
|
|
}
|
|
@@ -1353,8 +1245,7 @@ public class KwpGoodsService {
|
|
|
*/
|
|
*/
|
|
|
public Long getCountBySupplyEnt(Long supplyEntId) {
|
|
public Long getCountBySupplyEnt(Long supplyEntId) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId).eq(KwpGoods::getDelFlag, Global.NO).
|
|
|
|
|
- ne(KwpGoods::getStatus, GoodsStatusEnum.SAVED.getCode());
|
|
|
|
|
|
|
+ wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId).eq(KwpGoods::getDelFlag, Global.NO).ne(KwpGoods::getStatus, GoodsStatusEnum.SAVED.getCode());
|
|
|
return kwpGoodsMapper.selectCount(wrapper);
|
|
return kwpGoodsMapper.selectCount(wrapper);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1399,10 +1290,7 @@ public class KwpGoodsService {
|
|
|
*/
|
|
*/
|
|
|
public Long getOnShelfGoodsNum(GoodsNumStsParam param) {
|
|
public Long getOnShelfGoodsNum(GoodsNumStsParam param) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(KwpGoods::getEntId, param.getTopEntId())
|
|
|
|
|
- .eq(StringUtils.isNotBlank(param.getUnit()), KwpGoods::getUnit, param.getUnit())
|
|
|
|
|
- .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
|
|
|
|
+ wrapper.eq(KwpGoods::getEntId, param.getTopEntId()).eq(StringUtils.isNotBlank(param.getUnit()), KwpGoods::getUnit, param.getUnit()).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO);
|
|
|
if (Objects.nonNull(param.getEndDate())) {
|
|
if (Objects.nonNull(param.getEndDate())) {
|
|
|
wrapper.le(KwpGoods::getShelfTime, param.getEndDate());
|
|
wrapper.le(KwpGoods::getShelfTime, param.getEndDate());
|
|
|
}
|
|
}
|
|
@@ -1418,21 +1306,13 @@ public class KwpGoodsService {
|
|
|
*/
|
|
*/
|
|
|
public List<KwpGoods> getWorkbenchList() {
|
|
public List<KwpGoods> getWorkbenchList() {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(KwpGoods::getEntId, LoginUserHolder.getEntId())
|
|
|
|
|
- .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, Global.NO)
|
|
|
|
|
- .orderByDesc(KwpGoods::getCreateTime)
|
|
|
|
|
- .last("LIMIT 10");
|
|
|
|
|
|
|
+ wrapper.eq(KwpGoods::getEntId, LoginUserHolder.getEntId()).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO).orderByDesc(KwpGoods::getCreateTime).last("LIMIT 10");
|
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
|
return CollUtil.emptyIfNull(list);
|
|
return CollUtil.emptyIfNull(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public com.sckw.product.api.model.KwpGoods getGoodsByGoodsName(String goodsName) {
|
|
public com.sckw.product.api.model.KwpGoods getGoodsByGoodsName(String goodsName) {
|
|
|
- List<KwpGoods> kwpGoods = kwpGoodsMapper.selectList(
|
|
|
|
|
- new LambdaQueryWrapper<KwpGoods>().eq(KwpGoods::getName, goodsName)
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, 0)
|
|
|
|
|
- .orderByDesc(KwpGoods::getCreateTime)
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ List<KwpGoods> kwpGoods = kwpGoodsMapper.selectList(new LambdaQueryWrapper<KwpGoods>().eq(KwpGoods::getName, goodsName).eq(KwpGoods::getDelFlag, 0).orderByDesc(KwpGoods::getCreateTime));
|
|
|
com.sckw.product.api.model.KwpGoods goods = new com.sckw.product.api.model.KwpGoods();
|
|
com.sckw.product.api.model.KwpGoods goods = new com.sckw.product.api.model.KwpGoods();
|
|
|
if (kwpGoods.size() > 0) {
|
|
if (kwpGoods.size() > 0) {
|
|
|
KwpGoods kwpGoods1 = kwpGoods.get(0);
|
|
KwpGoods kwpGoods1 = kwpGoods.get(0);
|
|
@@ -1443,8 +1323,7 @@ public class KwpGoodsService {
|
|
|
|
|
|
|
|
public List<Long> selectIdsTaxRateAndLikeGoodsName(String name, String taxRate) {
|
|
public List<Long> selectIdsTaxRateAndLikeGoodsName(String name, String taxRate) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(StringUtils.isNotBlank(taxRate), KwpGoods::getTaxRate, taxRate)
|
|
|
|
|
- .like(StringUtils.isNotBlank(name), KwpGoods::getName, name);
|
|
|
|
|
|
|
+ wrapper.eq(StringUtils.isNotBlank(taxRate), KwpGoods::getTaxRate, taxRate).like(StringUtils.isNotBlank(name), KwpGoods::getName, name);
|
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
@@ -1464,10 +1343,7 @@ public class KwpGoodsService {
|
|
|
//组装商品参数
|
|
//组装商品参数
|
|
|
Map<String, Map<String, String>> finalValueAndDictResDtoMap = remoteSystemService.queryDictByType(types);
|
|
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))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<GoodsInfoResp.GoodsInfo> goodsInfos = goods.stream().filter(e -> Objects.equals(e.getStatus(), GoodsStatusEnum.PUT_ON_SHELVES.getCode())).map(x -> KwpGoodsService.getGoodsInfo(x, finalValueAndDictResDtoMap)).collect(Collectors.toList());
|
|
|
GoodsInfoResp goodsInfoResp = new GoodsInfoResp();
|
|
GoodsInfoResp goodsInfoResp = new GoodsInfoResp();
|
|
|
goodsInfoResp.setGoodsInfoRespList(goodsInfos);
|
|
goodsInfoResp.setGoodsInfoRespList(goodsInfos);
|
|
|
return goodsInfoResp;
|
|
return goodsInfoResp;
|
|
@@ -1494,7 +1370,10 @@ public class KwpGoodsService {
|
|
|
|
|
|
|
|
private List<BuildingMaterialsMarketList> tran(List<KwpGoods> list) {
|
|
private List<BuildingMaterialsMarketList> tran(List<KwpGoods> list) {
|
|
|
List<BuildingMaterialsMarketList> result = new ArrayList<>(list.size());
|
|
List<BuildingMaterialsMarketList> result = new ArrayList<>(list.size());
|
|
|
-
|
|
|
|
|
|
|
+ list = new ArrayList<>(list.stream().collect(Collectors.toMap(KwpGoods::getId,
|
|
|
|
|
+ Function.identity(),
|
|
|
|
|
+ (existing, replacement) -> existing
|
|
|
|
|
+ )).values());
|
|
|
List<Long> goodsIds = new ArrayList<>(list.size());
|
|
List<Long> goodsIds = new ArrayList<>(list.size());
|
|
|
List<Long> supplyEntIds = new ArrayList<>(list.size());
|
|
List<Long> supplyEntIds = new ArrayList<>(list.size());
|
|
|
list.forEach(e -> {
|
|
list.forEach(e -> {
|
|
@@ -1505,16 +1384,13 @@ public class KwpGoodsService {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
//地址信息
|
|
//地址信息
|
|
|
- Map<Long, KwpGoodsAddress> addressMap = kwpGoodsAddressService.getByGoodsIds(goodsIds).stream()
|
|
|
|
|
- .collect(Collectors.toMap(KwpGoodsAddress::getGoodsId, e -> e, (k1, k2) -> k1));
|
|
|
|
|
|
|
+ Map<Long, KwpGoodsAddress> addressMap = kwpGoodsAddressService.getByGoodsIds(goodsIds).stream().collect(Collectors.toMap(KwpGoodsAddress::getGoodsId, e -> e, (k1, k2) -> k1));
|
|
|
//价格梯度信息
|
|
//价格梯度信息
|
|
|
- Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
|
|
|
|
|
- .collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
|
|
|
|
+ Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream().collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
|
|
|
//供应企业信息
|
|
//供应企业信息
|
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
|
|
|
Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
|
|
|
- Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
|
|
|
|
|
- DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
|
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
Map<String, String> productNameMap, unitMap, goodsMap;
|
|
Map<String, String> productNameMap, unitMap, goodsMap;
|
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
|
|
@@ -1531,15 +1407,7 @@ public class KwpGoodsService {
|
|
|
BuildingMaterialsMarketList materials = BeanUtils.copyProperties(e, BuildingMaterialsMarketList.class);
|
|
BuildingMaterialsMarketList materials = BeanUtils.copyProperties(e, BuildingMaterialsMarketList.class);
|
|
|
KwpGoodsAddress address = addressMap.get(e.getId());
|
|
KwpGoodsAddress address = addressMap.get(e.getId());
|
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(e.getId());
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(e.getId());
|
|
|
- materials.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(e.getGoodsType()) : null)
|
|
|
|
|
- .setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(e.getUnit()) : null)
|
|
|
|
|
- .setSpec(CollectionUtils.isNotEmpty(goodsMap) ? goodsMap.get(e.getSpec()) : null)
|
|
|
|
|
- .setAddressName(Objects.isNull(address) ? null : address.getCityName())
|
|
|
|
|
- .setDetailAddress(Objects.isNull(address) ? null : address.getDetailAddress())
|
|
|
|
|
- .setPrice(CollectionUtils.isEmpty(priceRanges) ? null : priceRanges.get(0).getPrice())
|
|
|
|
|
- .setThumb(FileUtils.splice(e.getThumb()))
|
|
|
|
|
- .setSupplyEnt(entMap.get(e.getSupplyEntId()))
|
|
|
|
|
- ;
|
|
|
|
|
|
|
+ materials.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(e.getGoodsType()) : null).setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(e.getUnit()) : null).setSpec(CollectionUtils.isNotEmpty(goodsMap) ? goodsMap.get(e.getSpec()) : null).setAddressName(Objects.isNull(address) ? null : address.getCityName()).setDetailAddress(Objects.isNull(address) ? null : address.getDetailAddress()).setPrice(CollectionUtils.isEmpty(priceRanges) ? null : priceRanges.get(0).getPrice()).setThumb(FileUtils.splice(e.getThumb())).setSupplyEnt(entMap.get(e.getSupplyEntId()));
|
|
|
materials.setSignFlag(false);
|
|
materials.setSignFlag(false);
|
|
|
if (Objects.nonNull(entId)) {
|
|
if (Objects.nonNull(entId)) {
|
|
|
TradeContractGoodsDto tradeContractResDto = remoteContractService.queryTradeContractNew(entId, e.getId(), LocalDateTime.now());
|
|
TradeContractGoodsDto tradeContractResDto = remoteContractService.queryTradeContractNew(entId, e.getId(), LocalDateTime.now());
|
|
@@ -1595,10 +1463,7 @@ public class KwpGoodsService {
|
|
|
//所有的商品id
|
|
//所有的商品id
|
|
|
Set<Long> longs = res.keySet();
|
|
Set<Long> longs = res.keySet();
|
|
|
if (CollUtil.isEmpty(longs)) { //查询商品信息,按创建时间倒叙取数据
|
|
if (CollUtil.isEmpty(longs)) { //查询商品信息,按创建时间倒叙取数据
|
|
|
- List<KwpGoods> kwpGoods = kwpGoodsMapper.selectList(new LambdaQueryWrapper<KwpGoods>()
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, 0)
|
|
|
|
|
- .orderByDesc(KwpGoods::getCreateTime).last("limit 10")
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ List<KwpGoods> kwpGoods = kwpGoodsMapper.selectList(new LambdaQueryWrapper<KwpGoods>().eq(KwpGoods::getDelFlag, 0).orderByDesc(KwpGoods::getCreateTime).last("limit 10"));
|
|
|
if (CollectionUtils.isEmpty(kwpGoods)) {
|
|
if (CollectionUtils.isEmpty(kwpGoods)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
@@ -1607,9 +1472,7 @@ public class KwpGoodsService {
|
|
|
if (CollUtil.size(longs) < 10) {//不足10个,查询商品信息,补足10个
|
|
if (CollUtil.size(longs) < 10) {//不足10个,查询商品信息,补足10个
|
|
|
List<KwpGoods> add = kwpGoodsMapper.selectBatchIds(longs);
|
|
List<KwpGoods> add = kwpGoodsMapper.selectBatchIds(longs);
|
|
|
|
|
|
|
|
- List<KwpGoods> kwpGoods = kwpGoodsMapper.selectList(new LambdaQueryWrapper<KwpGoods>()
|
|
|
|
|
- .eq(KwpGoods::getDelFlag, 0).orderByDesc(KwpGoods::getCreateTime).last("limit " + (10 - CollUtil.size(longs)))
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ List<KwpGoods> kwpGoods = kwpGoodsMapper.selectList(new LambdaQueryWrapper<KwpGoods>().eq(KwpGoods::getDelFlag, 0).orderByDesc(KwpGoods::getCreateTime).last("limit " + (10 - CollUtil.size(longs))));
|
|
|
add.addAll(kwpGoods);
|
|
add.addAll(kwpGoods);
|
|
|
return tran(add);
|
|
return tran(add);
|
|
|
}
|
|
}
|
|
@@ -1620,11 +1483,7 @@ public class KwpGoodsService {
|
|
|
|
|
|
|
|
public List<Long> selectByPara(String goodsName, List<String> goodsType, String goodsSpec) {
|
|
public List<Long> selectByPara(String goodsName, List<String> goodsType, String goodsSpec) {
|
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.and(w -> w.like(StringUtils.isNotBlank(goodsName), KwpGoods::getName, goodsName)
|
|
|
|
|
- .or()
|
|
|
|
|
- .in(CollUtil.isNotEmpty(goodsType), KwpGoods::getGoodsType, goodsType)
|
|
|
|
|
- .or()
|
|
|
|
|
- .like(StringUtils.isNotBlank(goodsSpec), KwpGoods::getSpec, goodsSpec));
|
|
|
|
|
|
|
+ wrapper.and(w -> w.like(StringUtils.isNotBlank(goodsName), KwpGoods::getName, goodsName).or().in(CollUtil.isNotEmpty(goodsType), KwpGoods::getGoodsType, goodsType).or().like(StringUtils.isNotBlank(goodsSpec), KwpGoods::getSpec, goodsSpec));
|
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
@@ -1640,13 +1499,7 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
GoodsDetails detail = BeanUtils.copyProperties(goods, GoodsDetails.class);
|
|
GoodsDetails detail = BeanUtils.copyProperties(goods, GoodsDetails.class);
|
|
|
|
|
|
|
|
- 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.ADDRESS_TYPE.getType(),
|
|
|
|
|
- DictTypeEnum.GOODS_SPEC.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.ADDRESS_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
Map<String, String> productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> productNameMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
@@ -1657,10 +1510,7 @@ public class KwpGoodsService {
|
|
|
goodsStatusMap = dict.get(DictTypeEnum.GOODS_STATUS.getType());
|
|
goodsStatusMap = dict.get(DictTypeEnum.GOODS_STATUS.getType());
|
|
|
goodsSpecMap = dict.get(DictTypeEnum.GOODS_SPEC.getType());
|
|
goodsSpecMap = dict.get(DictTypeEnum.GOODS_SPEC.getType());
|
|
|
}
|
|
}
|
|
|
- detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null)
|
|
|
|
|
- .setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null)
|
|
|
|
|
- .setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null)
|
|
|
|
|
- .setSpecLabel(CollectionUtils.isNotEmpty(goodsSpecMap) ? goodsSpecMap.get(String.valueOf(detail.getSpec())) : null);
|
|
|
|
|
|
|
+ detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null).setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null).setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null).setSpecLabel(CollectionUtils.isNotEmpty(goodsSpecMap) ? goodsSpecMap.get(String.valueOf(detail.getSpec())) : null);
|
|
|
|
|
|
|
|
return detail;
|
|
return detail;
|
|
|
}
|
|
}
|