|
@@ -27,6 +27,7 @@ import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
|
import com.sckw.payment.api.model.dto.WalletDto;
|
|
import com.sckw.payment.api.model.dto.WalletDto;
|
|
|
import com.sckw.payment.api.model.dto.common.R;
|
|
import com.sckw.payment.api.model.dto.common.R;
|
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
|
|
|
+import com.sckw.product.api.model.GoodsDetail;
|
|
|
import com.sckw.product.api.model.KwpGoods;
|
|
import com.sckw.product.api.model.KwpGoods;
|
|
|
import com.sckw.redis.constant.RedisConstant;
|
|
import com.sckw.redis.constant.RedisConstant;
|
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
@@ -118,8 +119,16 @@ public class KwoTradeOrderService {
|
|
|
GoodsInfo goodsInfo = param.getGoodsInfo();
|
|
GoodsInfo goodsInfo = param.getGoodsInfo();
|
|
|
KwoTradeOrderGoods goods = BeanUtils.copyProperties(goodsInfo, KwoTradeOrderGoods.class);
|
|
KwoTradeOrderGoods goods = BeanUtils.copyProperties(goodsInfo, KwoTradeOrderGoods.class);
|
|
|
if (Objects.nonNull(goods)) {
|
|
if (Objects.nonNull(goods)) {
|
|
|
- goods.setTOrderId(id).setTOrderNo(tOrderNo);
|
|
|
|
|
|
|
+ GoodsDetail goodsDetail = goodsInfoService.getDetailById(goods.getGoodsId());
|
|
|
|
|
+ if (Objects.isNull(goodsDetail) || !Objects.equals(goodsDetail.getStatus(), 1)
|
|
|
|
|
+ || Objects.equals(goodsDetail.getDelFlag(), Global.YES)) {
|
|
|
|
|
+ throw new BusinessException("商品不存在或已下架!");
|
|
|
|
|
+ }
|
|
|
|
|
+ goods.setTOrderId(id).setTOrderNo(tOrderNo).setGoodsType(goodsDetail.getGoodsType());
|
|
|
kwoTradeOrderGoodsService.insert(goods);
|
|
kwoTradeOrderGoodsService.insert(goods);
|
|
|
|
|
+ order.setGoodsId(goodsDetail.getId()).setUnit(goodsDetail.getUnit()).setUnitPrice(goods.getUnitPrice())
|
|
|
|
|
+ .setGoodsName(goodsDetail.getName()).setGoodsType(goodsDetail.getGoodsType()).setGoodsCode(goodsDetail.getCode())
|
|
|
|
|
+ .setGoodsTaxRate(goodsDetail.getTaxRate()).setGoodsSpec(goodsDetail.getSpec());
|
|
|
BeanUtils.copyProperties(goodsInfo, order);
|
|
BeanUtils.copyProperties(goodsInfo, order);
|
|
|
}
|
|
}
|
|
|
//单位信息
|
|
//单位信息
|
|
@@ -389,7 +398,7 @@ public class KwoTradeOrderService {
|
|
|
.setGoodsId(goods.getId()).setGoodsCode(goods.getCode()).setGoodsName(goods.getName())
|
|
.setGoodsId(goods.getId()).setGoodsCode(goods.getCode()).setGoodsName(goods.getName())
|
|
|
.setGoodsType(goods.getGoodsType()).setGoodsTaxRate(goods.getTaxRate()).setGoodsSpec(goods.getSpec())
|
|
.setGoodsType(goods.getGoodsType()).setGoodsTaxRate(goods.getTaxRate()).setGoodsSpec(goods.getSpec())
|
|
|
.setUnit(goods.getUnit()).setPriceRangeId(orderGoods.getPriceRangeId()).setUnitPrice(orderGoods.getUnitPrice())
|
|
.setUnit(goods.getUnit()).setPriceRangeId(orderGoods.getPriceRangeId()).setUnitPrice(orderGoods.getUnitPrice())
|
|
|
- .setSkuId(orderGoods.getSkuId()).setCollectionUnitId(goods.getEntId()).setCollectionUnitId(goods.getEntId())
|
|
|
|
|
|
|
+ .setSkuId(orderGoods.getSkuId()).setCollectionUnitId(goods.getEntId())
|
|
|
.setCollectionUnit(Objects.isNull(entCache) ? null : entCache.getFirmName());
|
|
.setCollectionUnit(Objects.isNull(entCache) ? null : entCache.getFirmName());
|
|
|
detail.setGoodsInfo(goodsDetail);
|
|
detail.setGoodsInfo(goodsDetail);
|
|
|
}
|
|
}
|
|
@@ -539,36 +548,15 @@ public class KwoTradeOrderService {
|
|
|
if (Objects.isNull(goodsInfo.getGoodsId())) {
|
|
if (Objects.isNull(goodsInfo.getGoodsId())) {
|
|
|
throw new BusinessException("商品id不能为空!");
|
|
throw new BusinessException("商品id不能为空!");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isBlank(goodsInfo.getGoodsCode())) {
|
|
|
|
|
- throw new BusinessException("商品编号不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isBlank(goodsInfo.getGoodsName())) {
|
|
|
|
|
- throw new BusinessException("商品名称不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isBlank(goodsInfo.getGoodsType())) {
|
|
|
|
|
- throw new BusinessException("商品类型不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isBlank(goodsInfo.getGoodsTaxRate())) {
|
|
|
|
|
- throw new BusinessException("商品发票税率不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isBlank(goodsInfo.getGoodsSpec())) {
|
|
|
|
|
- throw new BusinessException("商品尺寸大小不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
if (StringUtils.isBlank(goodsInfo.getUnit())) {
|
|
if (StringUtils.isBlank(goodsInfo.getUnit())) {
|
|
|
throw new BusinessException("商品单位不能为空!");
|
|
throw new BusinessException("商品单位不能为空!");
|
|
|
}
|
|
}
|
|
|
- if (Objects.isNull(goodsInfo.getPriceRangeId())) {
|
|
|
|
|
|
|
+ if (Objects.isNull(goodsInfo.getPriceRangeId()) && Objects.equals(source, DictEnum.TORDER_SOURCE_1.getValue())) {
|
|
|
throw new BusinessException("价格段id不能为空!");
|
|
throw new BusinessException("价格段id不能为空!");
|
|
|
}
|
|
}
|
|
|
if (Objects.isNull(goodsInfo.getUnitPrice()) || goodsInfo.getUnitPrice().compareTo(BigDecimal.ZERO) < 0) {
|
|
if (Objects.isNull(goodsInfo.getUnitPrice()) || goodsInfo.getUnitPrice().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
throw new BusinessException("订单成交单价不能为空且不能为负数!");
|
|
throw new BusinessException("订单成交单价不能为空且不能为负数!");
|
|
|
}
|
|
}
|
|
|
- if (Objects.isNull(goodsInfo.getCollectionUnitId())) {
|
|
|
|
|
- throw new BusinessException("收款单位id不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isBlank(goodsInfo.getCollectionUnit())) {
|
|
|
|
|
- throw new BusinessException("收款单位名称不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
List<UnitInfo> unitInfos = param.getUnitInfo();
|
|
List<UnitInfo> unitInfos = param.getUnitInfo();
|
|
|
if (CollectionUtils.isEmpty(unitInfos)) {
|
|
if (CollectionUtils.isEmpty(unitInfos)) {
|