|
|
@@ -3,6 +3,8 @@ package com.sckw.order.serivce;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.sckw.contract.api.RemoteContractService;
|
|
|
+import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
|
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
@@ -53,6 +55,9 @@ public class KwoTradeOrderService {
|
|
|
@DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
private GoodsInfoService goodsInfoService;
|
|
|
|
|
|
+ @DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
+ private RemoteContractService remoteContractService;
|
|
|
+
|
|
|
private final KwoTradeOrderMapper kwoTradeOrderMapper;
|
|
|
private final StreamBridge streamBridge;
|
|
|
private final KwoTradeOrderAddressService kwoTradeOrderAddressService;
|
|
|
@@ -117,7 +122,9 @@ public class KwoTradeOrderService {
|
|
|
Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
|
|
|
unitInfos.forEach(e -> {
|
|
|
KwoTradeOrderUnit unit = BeanUtils.copyProperties(e, KwoTradeOrderUnit.class);
|
|
|
- unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(entMap.get(e.getEntId()).getId());
|
|
|
+ //todo:目前获取顶级企业dubbo接口有bug,暂时取自身企业id
|
|
|
+// unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(entMap.get(e.getEntId()).getId());
|
|
|
+ unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(e.getEntId());
|
|
|
list.add(unit);
|
|
|
if (Objects.equals(e.getUnitType(), DictEnum.TORDER_UNIT_TYPE_1.getValue())) {
|
|
|
order.setSupplyEntId(e.getEntId()).setSupplyTopEntId(e.getEntId()).setSupplyFirmName(e.getFirmName())
|
|
|
@@ -314,7 +321,7 @@ public class KwoTradeOrderService {
|
|
|
GoodsInfoDetailRes goodsDetail = new GoodsInfoDetailRes();
|
|
|
goodsDetail.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), goods.getGoodsType()))
|
|
|
.setGoodsUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), goods.getUnit()))
|
|
|
- .setGoodsTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), String.valueOf(goods.getTaxRate())))
|
|
|
+ .setGoodsTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), goods.getTaxRate()))
|
|
|
.setGoodsId(goods.getId()).setGoodsCode(goods.getCode()).setGoodsName(goods.getName())
|
|
|
.setGoodsType(goods.getGoodsType()).setGoodsTaxRate(goods.getTaxRate()).setGoodsSpec(goods.getSpec())
|
|
|
.setUnit(goods.getUnit()).setPriceRangeId(orderGoods.getPriceRangeId()).setUnitPrice(orderGoods.getUnitPrice())
|
|
|
@@ -347,7 +354,12 @@ public class KwoTradeOrderService {
|
|
|
KwoTradeOrderContract contract = kwoTradeOrderContractService.getByOrderId(id);
|
|
|
if (Objects.nonNull(contract)) {
|
|
|
ContractInfo contractInfo = BeanUtils.copyProperties(contract, ContractInfo.class);
|
|
|
- //todo:获取合同信息
|
|
|
+ Map<Long, ContractCommonInfoResDto> contractMap = remoteContractService.queryContractBaseInfo(List.of(contractInfo.getContractId()));
|
|
|
+ ContractCommonInfoResDto contractRes = contractMap.get(contractInfo.getContractId());
|
|
|
+ if (Objects.nonNull(contractRes)) {
|
|
|
+ contractInfo.setContractName(contractRes.getContactName());
|
|
|
+ contractInfo.setContractSigningWay(contractRes.getSigningWayName());
|
|
|
+ }
|
|
|
detail.setContractInfo(contractInfo);
|
|
|
}
|
|
|
return detail;
|
|
|
@@ -430,6 +442,9 @@ public class KwoTradeOrderService {
|
|
|
}
|
|
|
ContractInfo contractInfo = param.getContractInfo();
|
|
|
if (Objects.equals(source, DictEnum.TORDER_SOURCE_2.getValue())) {
|
|
|
+ if (StringUtils.isBlank(param.getDeliveryType())) {
|
|
|
+ throw new BusinessException("交付类型不能为空!");
|
|
|
+ }
|
|
|
if (Objects.isNull(contractInfo)) {
|
|
|
throw new BusinessException("代客下单合同信息不能为空");
|
|
|
}
|
|
|
@@ -465,8 +480,8 @@ public class KwoTradeOrderService {
|
|
|
if (StringUtils.isBlank(goodsInfo.getGoodsType())) {
|
|
|
throw new BusinessException("商品类型不能为空!");
|
|
|
}
|
|
|
- if (Objects.isNull(goodsInfo.getGoodsTaxRate()) || goodsInfo.getGoodsTaxRate().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
- throw new BusinessException("商品发票税率不能为空且不能为负数!");
|
|
|
+ if (StringUtils.isBlank(goodsInfo.getGoodsTaxRate())) {
|
|
|
+ throw new BusinessException("商品发票税率不能为空!");
|
|
|
}
|
|
|
if (StringUtils.isBlank(goodsInfo.getGoodsSpec())) {
|
|
|
throw new BusinessException("商品尺寸大小不能为空!");
|
|
|
@@ -693,7 +708,7 @@ public class KwoTradeOrderService {
|
|
|
KwoTradeOrderTrack track = new KwoTradeOrderTrack();
|
|
|
track.setTOrderId(order.getId()).setTOrderNo(order.getTOrderNo()).setRemark(param.getRemark()).setStatus(order.getStatus());
|
|
|
kwoTradeOrderTrackService.insert(track);
|
|
|
- if (param.getActualAmount().compareTo(order.getActualAmount()) != 0) {
|
|
|
+ if (param.getActualAmount().compareTo(order.getAmount()) != 0) {
|
|
|
KwoTradeOrderGoods goods = kwoTradeOrderGoodsService.getByOrderId(param.getId());
|
|
|
if (Objects.isNull(goods)) {
|
|
|
throw new BusinessException("商品信息异常!");
|
|
|
@@ -707,8 +722,8 @@ public class KwoTradeOrderService {
|
|
|
}
|
|
|
//mongodb更新订单状态
|
|
|
SckwTradeOrder updateParam = new SckwTradeOrder();
|
|
|
- updateParam.setTOrderId(order.getId()).setStatus(order.getStatus()).setUpdateBy(LoginUserHolder.getUserId())
|
|
|
- .setUpdateByName(LoginUserHolder.getUserName()).setUpdateTime(new Date());
|
|
|
+ updateParam.setTOrderId(order.getId()).setActualAmount(order.getActualAmount()).setStatus(order.getStatus())
|
|
|
+ .setUpdateBy(LoginUserHolder.getUserId()).setUpdateByName(LoginUserHolder.getUserName()).setUpdateTime(new Date());
|
|
|
saveMongoDb(3, updateParam);
|
|
|
|
|
|
}
|