|
@@ -17,10 +17,14 @@ import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.model.vo.TableBottom;
|
|
import com.sckw.core.model.vo.TableBottom;
|
|
|
import com.sckw.core.model.vo.TableStatisticRes;
|
|
import com.sckw.core.model.vo.TableStatisticRes;
|
|
|
import com.sckw.core.model.vo.TableTop;
|
|
import com.sckw.core.model.vo.TableTop;
|
|
|
-import com.sckw.core.utils.*;
|
|
|
|
|
|
|
+import com.sckw.core.utils.BeanUtils;
|
|
|
|
|
+import com.sckw.core.utils.CollectionUtils;
|
|
|
|
|
+import com.sckw.core.utils.FileUtils;
|
|
|
|
|
+import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.excel.utils.DateUtil;
|
|
import com.sckw.excel.utils.DateUtil;
|
|
|
|
|
+import com.sckw.fleet.api.RemoteFleetService;
|
|
|
import com.sckw.payment.api.dubbo.PayCenterDubboService;
|
|
import com.sckw.payment.api.dubbo.PayCenterDubboService;
|
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
|
import com.sckw.payment.api.model.dto.WalletDto;
|
|
import com.sckw.payment.api.model.dto.WalletDto;
|
|
@@ -44,11 +48,9 @@ import com.sckw.system.api.model.dto.res.KwsUserResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
-import jakarta.validation.Valid;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
-import org.jetbrains.annotations.NotNull;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.cloud.stream.function.StreamBridge;
|
|
import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -78,6 +80,10 @@ public class KwpGoodsService {
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private PayCenterDubboService payCenterDubboService;
|
|
private PayCenterDubboService payCenterDubboService;
|
|
|
|
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
|
|
+ private RemoteFleetService remoteFleetService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private final KwpGoodsMapper kwpGoodsMapper;
|
|
private final KwpGoodsMapper kwpGoodsMapper;
|
|
|
private final KwpGoodsAddressService kwpGoodsAddressService;
|
|
private final KwpGoodsAddressService kwpGoodsAddressService;
|
|
|
private final KwpGoodsAttributeService kwpGoodsAttributeService;
|
|
private final KwpGoodsAttributeService kwpGoodsAttributeService;
|
|
@@ -269,7 +275,7 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
UserCacheResDto managerInfo = remoteSystemService.queryUserCacheById(detail.getManager());
|
|
UserCacheResDto managerInfo = remoteSystemService.queryUserCacheById(detail.getManager());
|
|
|
if (Objects.nonNull(managerInfo)) {
|
|
if (Objects.nonNull(managerInfo)) {
|
|
|
- detail.setManagerName(managerInfo.getName()).setManagerPhone(managerInfo.getPhone());
|
|
|
|
|
|
|
+ detail.setManagerName(managerInfo.getName());
|
|
|
}
|
|
}
|
|
|
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.UNIT_TYPE.getType(),
|
|
@@ -278,13 +284,11 @@ public class KwpGoodsService {
|
|
|
DictTypeEnum.ADDRESS_TYPE.getType()));
|
|
DictTypeEnum.ADDRESS_TYPE.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> taxRateMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> goodsStatusMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> addressMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> addressMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
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());
|
|
|
addressMap = dict.get(DictTypeEnum.ADDRESS_TYPE.getType());
|
|
addressMap = dict.get(DictTypeEnum.ADDRESS_TYPE.getType());
|
|
|
}
|
|
}
|
|
@@ -295,9 +299,7 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null)
|
|
detail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(productNameMap) ? productNameMap.get(detail.getGoodsType()) : null)
|
|
|
.setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null)
|
|
.setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(detail.getUnit()) : null)
|
|
|
-// .setTaxRateLabel(CollectionUtils.isNotEmpty(taxRateMap) ? taxRateMap.get(detail.getTaxRate()) : null)
|
|
|
|
|
.setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null);
|
|
.setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null);
|
|
|
-// .setPrepaidLimitLabel(Objects.equals(detail.getPrepaidLimit(), 1) ? "是" : "否");
|
|
|
|
|
//商品图片信息
|
|
//商品图片信息
|
|
|
if (Objects.nonNull(goods.getThumb())) {
|
|
if (Objects.nonNull(goods.getThumb())) {
|
|
|
detail.setThumb(FileUtils.splice(goods.getThumb()));
|
|
detail.setThumb(FileUtils.splice(goods.getThumb()));
|
|
@@ -334,10 +336,15 @@ public class KwpGoodsService {
|
|
|
e.setToUnitName(finalUnitMap != null ? finalUnitMap.get(e.getToUnit()) : null);
|
|
e.setToUnitName(finalUnitMap != null ? finalUnitMap.get(e.getToUnit()) : null);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- detail.setImages(images).setPriceRanges(price).setAttributes(attributes).setAddressInfo(addressInfo).setAssistUnit(assistUnit);
|
|
|
|
|
|
|
+ detail.setImages(images).setPrice(price).setAttributes(attributes).setAddressInfo(addressInfo).setAssistUnit(assistUnit);
|
|
|
|
|
+ //轴数
|
|
|
|
|
+ String carAxisName = remoteFleetService.getCarAxisInfo(goods.getCarAxis());
|
|
|
|
|
+ detail.setCarAxis(carAxisName);
|
|
|
|
|
+
|
|
|
return detail;
|
|
return detail;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @desc: 更新商品信息
|
|
* @desc: 更新商品信息
|
|
|
* @author: yzc
|
|
* @author: yzc
|
|
@@ -360,10 +367,6 @@ public class KwpGoodsService {
|
|
|
if (StringUtils.isNotBlank(msg)) {
|
|
if (StringUtils.isNotBlank(msg)) {
|
|
|
throw new BusinessException(msg);
|
|
throw new BusinessException(msg);
|
|
|
}
|
|
}
|
|
|
- if (Objects.equals(goods.getStatus(), GoodsStatusEnum.PUT_ON_SHELVES.getCode()) &&
|
|
|
|
|
- goods.getAmount().compareTo(param.getAmount()) != 0) {
|
|
|
|
|
- throw new BusinessException("上架商品不可修改库存数量!");
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
AddressInfo address = param.getAddressInfo();
|
|
AddressInfo address = param.getAddressInfo();
|
|
|
Integer areaCode = Objects.isNull(address) ? null : address.getCityCode();
|
|
Integer areaCode = Objects.isNull(address) ? null : address.getCityCode();
|
|
@@ -373,13 +376,10 @@ public class KwpGoodsService {
|
|
|
.set(KwpGoods::getGoodsType, param.getGoodsType())
|
|
.set(KwpGoods::getGoodsType, param.getGoodsType())
|
|
|
.set(KwpGoods::getUnit, param.getUnit())
|
|
.set(KwpGoods::getUnit, param.getUnit())
|
|
|
.set(KwpGoods::getSpec, param.getSpec())
|
|
.set(KwpGoods::getSpec, param.getSpec())
|
|
|
- .set(KwpGoods::getAmount, param.getAmount())
|
|
|
|
|
- .set(KwpGoods::getTaxRate, param.getTaxRate())
|
|
|
|
|
- .set(KwpGoods::getPrepaidLimit, param.getPrepaidLimit())
|
|
|
|
|
- .set(KwpGoods::getAdvancePrice, param.getAdvancePrice())
|
|
|
|
|
|
|
+ .set(KwpGoods::getCode, param.getCode())
|
|
|
|
|
+ .set(KwpGoods::getCarAxis, param.getCarAxis())
|
|
|
|
|
+ .set(KwpGoods::getContent, param.getContent())
|
|
|
.set(KwpGoods::getSupplyEntId, param.getSupplyEntId())
|
|
.set(KwpGoods::getSupplyEntId, param.getSupplyEntId())
|
|
|
- .set(KwpGoods::getManager, param.getManager())
|
|
|
|
|
- .set(KwpGoods::getRemark, param.getRemark())
|
|
|
|
|
.set(KwpGoods::getThumb, FileUtils.replaceAll(param.getThumb()))
|
|
.set(KwpGoods::getThumb, FileUtils.replaceAll(param.getThumb()))
|
|
|
.set(KwpGoods::getAreaCode, areaCode)
|
|
.set(KwpGoods::getAreaCode, areaCode)
|
|
|
.set(KwpGoods::getAddressName, addressName)
|
|
.set(KwpGoods::getAddressName, addressName)
|
|
@@ -431,14 +431,11 @@ public class KwpGoodsService {
|
|
|
|
|
|
|
|
//更新商品价格梯度信息
|
|
//更新商品价格梯度信息
|
|
|
kwpGoodsPriceRangeService.delByGoodsIds(Collections.singletonList(goodsId));
|
|
kwpGoodsPriceRangeService.delByGoodsIds(Collections.singletonList(goodsId));
|
|
|
- if (CollectionUtils.isNotEmpty(param.getPriceRanges())) {
|
|
|
|
|
- List<KwpGoodsPriceRange> list = new ArrayList<>(param.getPriceRanges().size());
|
|
|
|
|
- param.getPriceRanges().forEach(e -> {
|
|
|
|
|
- KwpGoodsPriceRange priceRange = BeanUtils.copyProperties(e, KwpGoodsPriceRange.class);
|
|
|
|
|
- priceRange.setGoodsId(goodsId);
|
|
|
|
|
- list.add(priceRange);
|
|
|
|
|
- });
|
|
|
|
|
- kwpGoodsPriceRangeService.insertBatch(list);
|
|
|
|
|
|
|
+ if (param.getPrice() != null) {
|
|
|
|
|
+ KwpGoodsPriceRange priceRange = new KwpGoodsPriceRange();
|
|
|
|
|
+ priceRange.setGoodsId(goodsId);
|
|
|
|
|
+ priceRange.setPrice(param.getPrice());
|
|
|
|
|
+ kwpGoodsPriceRangeService.insertBatch(Lists.newArrayList(priceRange));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//更新商品辅助单位信息
|
|
//更新商品辅助单位信息
|
|
@@ -472,18 +469,6 @@ public class KwpGoodsService {
|
|
|
if (StringUtils.isBlank(param.getUnit())) {
|
|
if (StringUtils.isBlank(param.getUnit())) {
|
|
|
return "计量单位不能为空!";
|
|
return "计量单位不能为空!";
|
|
|
}
|
|
}
|
|
|
- if (Objects.isNull(param.getAmount())) {
|
|
|
|
|
- return "库存数量不能为空!";
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isBlank(param.getTaxRate())) {
|
|
|
|
|
- return "发票税率不能为空!";
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.isNull(param.getPrepaidLimit())) {
|
|
|
|
|
- return "是否设置预付限额不能为空!";
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.equals(param.getPrepaidLimit(), 1) && Objects.isNull(param.getAdvancePrice())) {
|
|
|
|
|
- return "设置预付限额时,预付款最低限额不能为空!";
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
List<GoodsAttributes> attributes = param.getAttributes();
|
|
List<GoodsAttributes> attributes = param.getAttributes();
|
|
|
if (CollectionUtils.isNotEmpty(attributes)) {
|
|
if (CollectionUtils.isNotEmpty(attributes)) {
|
|
@@ -504,24 +489,11 @@ public class KwpGoodsService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- List<GoodsPriceRanges> priceRanges = param.getPriceRanges();
|
|
|
|
|
- if (CollectionUtils.isEmpty(priceRanges)) {
|
|
|
|
|
- return "价格梯度不能为空!";
|
|
|
|
|
- }
|
|
|
|
|
- for (GoodsPriceRanges e : priceRanges) {
|
|
|
|
|
- if (Objects.isNull(e.getStartAmount()) || e.getStartAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
- return "起售量不能为空且必须大于零!";
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.isNull(e.getEndAmount()) || e.getEndAmount().compareTo(new BigDecimal("-1.00")) < 0) {
|
|
|
|
|
- return "上限售量不能为空且必须大于零!";
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.isNull(e.getPrice()) || e.getStartAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
- return "含税价不能为空且必须大于零!";
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.isNull(e.getSort())) {
|
|
|
|
|
- return "价格梯度顺序不能为空!";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ BigDecimal price = param.getPrice();
|
|
|
|
|
+ if (price == null) {
|
|
|
|
|
+ return "价格不能为空!";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
AddressInfo address = param.getAddressInfo();
|
|
AddressInfo address = param.getAddressInfo();
|
|
|
if (Objects.isNull(address)) {
|
|
if (Objects.isNull(address)) {
|
|
|
return "地址信息不能为空!";
|
|
return "地址信息不能为空!";
|
|
@@ -553,9 +525,6 @@ public class KwpGoodsService {
|
|
|
if (Objects.isNull(param.getSupplyEntId())) {
|
|
if (Objects.isNull(param.getSupplyEntId())) {
|
|
|
return "供应企业不能为空!";
|
|
return "供应企业不能为空!";
|
|
|
}
|
|
}
|
|
|
- if (Objects.isNull(param.getManager())) {
|
|
|
|
|
- return "客户经理不能为空!";
|
|
|
|
|
- }
|
|
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -637,8 +606,6 @@ public class KwpGoodsService {
|
|
|
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()))
|
|
export.setAmount(Objects.isNull(e.getAmount()) ? null : String.valueOf(e.getAmount()))
|
|
|
- .setHighestPrice(Objects.isNull(e.getHighestPrice()) ? null : String.valueOf(e.getHighestPrice()))
|
|
|
|
|
- .setLowestPrice(Objects.isNull(e.getLowestPrice()) ? null : String.valueOf(e.getLowestPrice()))
|
|
|
|
|
.setAddedTime(Objects.isNull(e.getAddedTime()) ? null : DateUtil.getDateTime(e.getAddedTime()))
|
|
.setAddedTime(Objects.isNull(e.getAddedTime()) ? null : DateUtil.getDateTime(e.getAddedTime()))
|
|
|
.setShelfTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime()))
|
|
.setShelfTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime()))
|
|
|
.setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()));
|
|
.setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()));
|
|
@@ -744,7 +711,6 @@ public class KwpGoodsService {
|
|
|
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)
|
|
@@ -752,11 +718,15 @@ public class KwpGoodsService {
|
|
|
.setSupplyEnt(entMap.get(e.getSupplyEntId()))
|
|
.setSupplyEnt(entMap.get(e.getSupplyEntId()))
|
|
|
.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);
|
|
|
- if (CollectionUtils.isNotEmpty(priceRanges)) {
|
|
|
|
|
- goodsList.setHighestPrice(priceRanges.get(priceRanges.size() - 1).getPrice())
|
|
|
|
|
- .setLowestPrice(priceRanges.get(0).getPrice());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ BigDecimal price = Optional.ofNullable(priceRanges)
|
|
|
|
|
+ .filter(priceRangeList -> !priceRangeList.isEmpty())
|
|
|
|
|
+ .map(priceRangeList -> priceRangeList.get(0))
|
|
|
|
|
+ .map(KwpGoodsPriceRange::getPrice)
|
|
|
|
|
+ .orElse(null);
|
|
|
|
|
+ goodsList.setPrice(price);
|
|
|
|
|
+
|
|
|
result.add(goodsList);
|
|
result.add(goodsList);
|
|
|
});
|
|
});
|
|
|
return result;
|
|
return result;
|
|
@@ -780,13 +750,17 @@ public class KwpGoodsService {
|
|
|
if (Objects.equals(GoodsStatusEnum.PUT_ON_SHELVES.getCode(), goods.getStatus())) {
|
|
if (Objects.equals(GoodsStatusEnum.PUT_ON_SHELVES.getCode(), goods.getStatus())) {
|
|
|
throw new BusinessException("上架操作仅针对“已下架”“草稿”状态的单据!");
|
|
throw new BusinessException("上架操作仅针对“已下架”“草稿”状态的单据!");
|
|
|
}
|
|
}
|
|
|
- if (goods.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
- throw new BusinessException("商品上架必须库存大于零!");
|
|
|
|
|
- }
|
|
|
|
|
if (Objects.equals(GoodsStatusEnum.SAVED.getCode(), goods.getStatus())) {
|
|
if (Objects.equals(GoodsStatusEnum.SAVED.getCode(), goods.getStatus())) {
|
|
|
UpdateGoodsParam updateParam = BeanUtils.copyProperties(goods, UpdateGoodsParam.class);
|
|
UpdateGoodsParam updateParam = BeanUtils.copyProperties(goods, UpdateGoodsParam.class);
|
|
|
updateParam.setAttributes(BeanUtils.copyToList(kwpGoodsAttributeService.getByGoodsId(id), GoodsAttributes.class));
|
|
updateParam.setAttributes(BeanUtils.copyToList(kwpGoodsAttributeService.getByGoodsId(id), GoodsAttributes.class));
|
|
|
- updateParam.setPriceRanges(BeanUtils.copyToList(kwpGoodsPriceRangeService.getByGoodsId(id), GoodsPriceRanges.class));
|
|
|
|
|
|
|
+ //价格
|
|
|
|
|
+ List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(id);
|
|
|
|
|
+ BigDecimal price = Optional.ofNullable(priceRanges)
|
|
|
|
|
+ .filter(priceRangeList -> !priceRangeList.isEmpty())
|
|
|
|
|
+ .map(priceRangeList -> priceRangeList.get(0))
|
|
|
|
|
+ .map(KwpGoodsPriceRange::getPrice)
|
|
|
|
|
+ .orElse(null);
|
|
|
|
|
+ updateParam.setPrice(price);
|
|
|
updateParam.setImages(BeanUtils.copyToList(kwpGoodsImageService.getByGoodsId(id), GoodsImages.class));
|
|
updateParam.setImages(BeanUtils.copyToList(kwpGoodsImageService.getByGoodsId(id), GoodsImages.class));
|
|
|
updateParam.setAddressInfo(BeanUtils.copyProperties(kwpGoodsAddressService.getByGoodsId(id), AddressInfo.class));
|
|
updateParam.setAddressInfo(BeanUtils.copyProperties(kwpGoodsAddressService.getByGoodsId(id), AddressInfo.class));
|
|
|
String msg = judgeParameters(updateParam);
|
|
String msg = judgeParameters(updateParam);
|
|
@@ -1325,7 +1299,7 @@ public class KwpGoodsService {
|
|
|
public GoodsInfoResp getGoods( GoodsInfoReq req) {
|
|
public GoodsInfoResp getGoods( GoodsInfoReq req) {
|
|
|
log.info("查询商品信息,请求参数 :{}", JSON.toJSONString(req));
|
|
log.info("查询商品信息,请求参数 :{}", JSON.toJSONString(req));
|
|
|
//查询上商品信息
|
|
//查询上商品信息
|
|
|
- List<KwpGoods> goods = kwpGoodsRepository.queryByEntIdAndGoodsName(req.getEntId(), req.getGoodsName());
|
|
|
|
|
|
|
+ List<KwpGoods> goods = kwpGoodsRepository.queryByEntIdAndGoodsName(Long.valueOf(req.getEntId()), req.getGoodsName());
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty( goods)){
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty( goods)){
|
|
|
return new GoodsInfoResp();
|
|
return new GoodsInfoResp();
|
|
|
}
|
|
}
|