|
@@ -1,9 +1,13 @@
|
|
|
package com.sckw.order.serivce;
|
|
package com.sckw.order.serivce;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
import com.sckw.contract.api.RemoteContractService;
|
|
import com.sckw.contract.api.RemoteContractService;
|
|
|
import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
|
|
import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
@@ -15,7 +19,11 @@ import com.sckw.core.model.enums.ClientTypeEnum;
|
|
|
import com.sckw.core.model.enums.CooperateTypeEnum;
|
|
import com.sckw.core.model.enums.CooperateTypeEnum;
|
|
|
import com.sckw.core.model.enums.OrderRuleEnum;
|
|
import com.sckw.core.model.enums.OrderRuleEnum;
|
|
|
import com.sckw.core.model.enums.RedisOrderGenerateEnum;
|
|
import com.sckw.core.model.enums.RedisOrderGenerateEnum;
|
|
|
-import com.sckw.core.utils.*;
|
|
|
|
|
|
|
+import com.sckw.core.model.page.PageResult;
|
|
|
|
|
+import com.sckw.core.utils.CollectionUtils;
|
|
|
|
|
+import com.sckw.core.utils.DateUtils;
|
|
|
|
|
+import com.sckw.core.utils.OrderGenerateSeqNoUtils;
|
|
|
|
|
+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.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
@@ -27,6 +35,7 @@ import com.sckw.order.dao.KwoTradeOrderMapper;
|
|
|
import com.sckw.order.enums.*;
|
|
import com.sckw.order.enums.*;
|
|
|
import com.sckw.order.model.*;
|
|
import com.sckw.order.model.*;
|
|
|
import com.sckw.order.model.dto.OrderCheckDTO;
|
|
import com.sckw.order.model.dto.OrderCheckDTO;
|
|
|
|
|
+import com.sckw.order.model.dto.TradeOrderListSelectDTO;
|
|
|
import com.sckw.order.model.dto.WbTOrderExcelStsReqDTO;
|
|
import com.sckw.order.model.dto.WbTOrderExcelStsReqDTO;
|
|
|
import com.sckw.order.model.dto.WbTOrderExcelStsResDTO;
|
|
import com.sckw.order.model.dto.WbTOrderExcelStsResDTO;
|
|
|
import com.sckw.order.model.vo.req.*;
|
|
import com.sckw.order.model.vo.req.*;
|
|
@@ -122,7 +131,7 @@ public class KwoTradeOrderService {
|
|
|
* @return: void
|
|
* @return: void
|
|
|
*/
|
|
*/
|
|
|
public void addPurchaseOrderDraft(PurchaseOrderDraftParam param) {
|
|
public void addPurchaseOrderDraft(PurchaseOrderDraftParam param) {
|
|
|
- KwoTradeOrder order = BeanUtils.copyProperties(param, KwoTradeOrder.class);
|
|
|
|
|
|
|
+ KwoTradeOrder order = BeanUtil.copyProperties(param, KwoTradeOrder.class);
|
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
|
.setTOrderNo(getOrderNo())
|
|
.setTOrderNo(getOrderNo())
|
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
@@ -130,7 +139,7 @@ public class KwoTradeOrderService {
|
|
|
.setUnit(Objects.nonNull(param.getGoodsInfo()) ? param.getGoodsInfo().getUnit() : null)
|
|
.setUnit(Objects.nonNull(param.getGoodsInfo()) ? param.getGoodsInfo().getUnit() : null)
|
|
|
.setSource(OrderSourceEnum.PURCHASE.getType()).setStatus(OrderStatusEnum.SAVED.getCode());
|
|
.setSource(OrderSourceEnum.PURCHASE.getType()).setStatus(OrderStatusEnum.SAVED.getCode());
|
|
|
kwoTradeOrderMapper.insert(order);
|
|
kwoTradeOrderMapper.insert(order);
|
|
|
- addOtherOrderInfo(order, BeanUtils.copyProperties(param, ValetOrderParam.class), false);
|
|
|
|
|
|
|
+ addOtherOrderInfo(order, BeanUtil.copyProperties(param, ValetOrderParam.class), false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -143,154 +152,152 @@ public class KwoTradeOrderService {
|
|
|
* @return: void
|
|
* @return: void
|
|
|
*/
|
|
*/
|
|
|
private void addOtherOrderInfo(KwoTradeOrder tradeOrder, ValetOrderParam param, Boolean isUpdate) {
|
|
private void addOtherOrderInfo(KwoTradeOrder tradeOrder, ValetOrderParam param, Boolean isUpdate) {
|
|
|
- try {
|
|
|
|
|
- Long id = tradeOrder.getId();
|
|
|
|
|
- String tOrderNo = tradeOrder.getTOrderNo();
|
|
|
|
|
- SckwTradeOrder order = new SckwTradeOrder();
|
|
|
|
|
- order.setFirmName(LoginUserHolder.getEntName())
|
|
|
|
|
- .setCreateByName(LoginUserHolder.getUserName())
|
|
|
|
|
- .setUpdateByName(LoginUserHolder.getUserName())
|
|
|
|
|
- .setTOrderId(id)
|
|
|
|
|
- .setAssociateStatement(0)
|
|
|
|
|
- .setPrice(tradeOrder.getPrice().doubleValue())
|
|
|
|
|
- .setAmount(tradeOrder.getAmount().doubleValue())
|
|
|
|
|
- .setEntrustAmount(tradeOrder.getEntrustAmount().doubleValue())
|
|
|
|
|
- .setActualAmount(tradeOrder.getActualAmount().doubleValue());
|
|
|
|
|
-
|
|
|
|
|
- BeanUtils.copyProperties(tradeOrder, order);
|
|
|
|
|
-
|
|
|
|
|
- //商品信息
|
|
|
|
|
- kwoTradeOrderGoodsService.delByOrderId(id);
|
|
|
|
|
- GoodsInfo goodsInfo = param.getGoodsInfo();
|
|
|
|
|
- KwoTradeOrderGoods goods = BeanUtils.copyProperties(goodsInfo, KwoTradeOrderGoods.class);
|
|
|
|
|
- if (Objects.nonNull(goods) && Objects.nonNull(goods.getGoodsId())) {
|
|
|
|
|
- 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);
|
|
|
|
|
-
|
|
|
|
|
- //商品辅助单位
|
|
|
|
|
- kwoTradeOrderGoodsUnitService.delByOrderId(id);
|
|
|
|
|
- List<GoodsUnitDetail> assistUnit = goodsDetail.getAssistUnit();
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(assistUnit)) {
|
|
|
|
|
- List<KwoTradeOrderGoodsUnit> units = new ArrayList<>(assistUnit.size());
|
|
|
|
|
- assistUnit.forEach(e -> {
|
|
|
|
|
- KwoTradeOrderGoodsUnit unit = BeanUtils.copyProperties(e, KwoTradeOrderGoodsUnit.class);
|
|
|
|
|
- unit.setGoodsId(goodsDetail.getId());
|
|
|
|
|
- unit.setTOrderId(id);
|
|
|
|
|
- unit.setUnit(order.getUnit().equals(e.getFromUnit()) ? e.getToUnit() : e.getFromUnit());
|
|
|
|
|
- units.add(unit);
|
|
|
|
|
- });
|
|
|
|
|
- kwoTradeOrderGoodsUnitService.insertBatch(units);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Long id = tradeOrder.getId();
|
|
|
|
|
+ String tOrderNo = tradeOrder.getTOrderNo();
|
|
|
|
|
+ SckwTradeOrder order = new SckwTradeOrder();
|
|
|
|
|
+ order.setFirmName(LoginUserHolder.getEntName())
|
|
|
|
|
+ .setCreateByName(LoginUserHolder.getUserName())
|
|
|
|
|
+ .setUpdateByName(LoginUserHolder.getUserName())
|
|
|
|
|
+ .setTOrderId(id)
|
|
|
|
|
+ .setAssociateStatement(0)
|
|
|
|
|
+ .setPrice(tradeOrder.getPrice().doubleValue())
|
|
|
|
|
+ .setAmount(tradeOrder.getAmount().doubleValue())
|
|
|
|
|
+ .setEntrustAmount(tradeOrder.getEntrustAmount().doubleValue())
|
|
|
|
|
+ .setActualAmount(tradeOrder.getActualAmount().doubleValue());
|
|
|
|
|
|
|
|
- //订单关联商品信息
|
|
|
|
|
- order.setGoodsId(goodsDetail.getId()).setUnit(goodsDetail.getUnit()).setUnitPrice(goods.getUnitPrice().doubleValue())
|
|
|
|
|
- .setGoodsName(goodsDetail.getName()).setGoodsType(goodsDetail.getGoodsType()).setGoodsCode(goodsDetail.getCode())
|
|
|
|
|
- .setGoodsTaxRate(goodsDetail.getTaxRate()).setGoodsSpec(goodsDetail.getSpec()).setGoodsThumb(goodsDetail.getThumb());
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.isNull(order.getUnitPrice())) {
|
|
|
|
|
- order.setUnitPrice(BigDecimal.ZERO.doubleValue());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ BeanUtil.copyProperties(tradeOrder, order);
|
|
|
|
|
|
|
|
- //单位信息
|
|
|
|
|
- kwoTradeOrderUnitService.delByOrderId(id);
|
|
|
|
|
- List<UnitInfo> unitInfos = param.getUnitInfo();
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(unitInfos)) {
|
|
|
|
|
- List<KwoTradeOrderUnit> list = new ArrayList<>(unitInfos.size());
|
|
|
|
|
- List<Long> entIds = unitInfos.stream().map(UnitInfo::getEntId).distinct().toList();
|
|
|
|
|
- Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
|
|
|
|
|
- unitInfos.forEach(e -> {
|
|
|
|
|
- EntCacheResDto ent = entMap.get(e.getEntId());
|
|
|
|
|
- if (Objects.isNull(ent)) {
|
|
|
|
|
- throw new BusinessException("企业:" + e.getFirmName() + "的一级企业信息不存在!");
|
|
|
|
|
- }
|
|
|
|
|
- KwoTradeOrderUnit unit = BeanUtils.copyProperties(e, KwoTradeOrderUnit.class);
|
|
|
|
|
- unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(ent.getId());
|
|
|
|
|
- list.add(unit);
|
|
|
|
|
- if (Objects.equals(e.getUnitType(), OrderUnitTypeEnum.PURCHASE.getType())) {
|
|
|
|
|
- order.setProcureEntId(e.getEntId()).setProcureTopEntId(unit.getTopEntId()).setProcureFirmName(e.getFirmName())
|
|
|
|
|
- .setProcureContacts(e.getContacts()).setProcurePhone(e.getPhone()).setProcureContactsId(e.getContactsId());
|
|
|
|
|
- } else {
|
|
|
|
|
- order.setSupplyEntId(e.getEntId()).setSupplyTopEntId(unit.getTopEntId()).setSupplyFirmName(e.getFirmName())
|
|
|
|
|
- .setSupplyContacts(e.getContacts()).setSupplyPhone(e.getPhone()).setSupplyContactsId(e.getContactsId());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //商品信息
|
|
|
|
|
+ kwoTradeOrderGoodsService.delByOrderId(id);
|
|
|
|
|
+ GoodsInfo goodsInfo = param.getGoodsInfo();
|
|
|
|
|
+ KwoTradeOrderGoods goods = BeanUtil.copyProperties(goodsInfo, KwoTradeOrderGoods.class);
|
|
|
|
|
+ if (Objects.nonNull(goods) && Objects.nonNull(goods.getGoodsId())) {
|
|
|
|
|
+ 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);
|
|
|
|
|
+
|
|
|
|
|
+ //商品辅助单位
|
|
|
|
|
+ kwoTradeOrderGoodsUnitService.delByOrderId(id);
|
|
|
|
|
+ List<GoodsUnitDetail> assistUnit = goodsDetail.getAssistUnit();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(assistUnit)) {
|
|
|
|
|
+ List<KwoTradeOrderGoodsUnit> units = new ArrayList<>(assistUnit.size());
|
|
|
|
|
+ assistUnit.forEach(e -> {
|
|
|
|
|
+ KwoTradeOrderGoodsUnit unit = BeanUtil.copyProperties(e, KwoTradeOrderGoodsUnit.class);
|
|
|
|
|
+ unit.setGoodsId(goodsDetail.getId());
|
|
|
|
|
+ unit.setTOrderId(id);
|
|
|
|
|
+ unit.setUnit(order.getUnit().equals(e.getFromUnit()) ? e.getToUnit() : e.getFromUnit());
|
|
|
|
|
+ units.add(unit);
|
|
|
});
|
|
});
|
|
|
- kwoTradeOrderUnitService.insertBatch(list);
|
|
|
|
|
|
|
+ kwoTradeOrderGoodsUnitService.insertBatch(units);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //地址信息
|
|
|
|
|
- kwoTradeOrderAddressService.delByOrderId(id);
|
|
|
|
|
- tradeOrderAmountService.delByOrderId(id);
|
|
|
|
|
- List<AddressInfo> addressInfos = param.getAddressInfo();
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(addressInfos)) {
|
|
|
|
|
- BigDecimal amount = Objects.isNull(param.getAmount()) ? BigDecimal.ZERO : param.getAmount();
|
|
|
|
|
- List<KwoTradeOrderAddress> list = new ArrayList<>(addressInfos.size());
|
|
|
|
|
- BigDecimal totalLoadAmount = BigDecimal.ZERO;
|
|
|
|
|
- BigDecimal totalUnloadAmount = BigDecimal.ZERO;
|
|
|
|
|
- boolean loadFlag = false;
|
|
|
|
|
- boolean unloadFlag = false;
|
|
|
|
|
- for (AddressInfo e : addressInfos) {
|
|
|
|
|
- KwoTradeOrderAddress address = BeanUtils.copyProperties(e, KwoTradeOrderAddress.class);
|
|
|
|
|
- address.setTOrderId(id).setTOrderNo(tOrderNo);
|
|
|
|
|
- list.add(address);
|
|
|
|
|
- if (Objects.equals(e.getAddressType(), OrderAddressTypeEnum.LOAD.getType())) {
|
|
|
|
|
- //todo MongoDB如何存多个地址信息?
|
|
|
|
|
- order.setLoadName(e.getName()).setLoadType(e.getType()).setLoadContacts(e.getContacts())
|
|
|
|
|
- .setLoadPhone(e.getPhone()).setLoadCityCode(String.valueOf(e.getCityCode())).setLoadCityName(e.getCityName())
|
|
|
|
|
- .setLoadDetailAddress(e.getDetailAddress()).setLoadLat(e.getLat()).setLoadLng(e.getLng());
|
|
|
|
|
- totalLoadAmount = totalLoadAmount.add(e.getAmount());
|
|
|
|
|
- loadFlag = true;
|
|
|
|
|
- } else {
|
|
|
|
|
- //todo MongoDB如何存多个地址信息?
|
|
|
|
|
- order.setUnloadName(e.getName()).setUnloadType(e.getType()).setUnloadContacts(e.getContacts())
|
|
|
|
|
- .setUnloadPhone(e.getPhone()).setUnloadCityCode(String.valueOf(e.getCityCode())).setUnloadCityName(e.getCityName())
|
|
|
|
|
- .setUnloadDetailAddress(e.getDetailAddress()).setUnloadLat(e.getLat()).setUnloadLng(e.getLng());
|
|
|
|
|
- totalUnloadAmount = totalUnloadAmount.add(e.getAmount());
|
|
|
|
|
- unloadFlag = true;
|
|
|
|
|
- }
|
|
|
|
|
- //地址信息
|
|
|
|
|
- Long addressId = kwoTradeOrderAddressService.add(address);
|
|
|
|
|
- //分配量信息
|
|
|
|
|
- KwoTradeOrderAmount orderAmount = new KwoTradeOrderAmount();
|
|
|
|
|
- orderAmount.setTOrderId(id).setAmount(e.getAmount())
|
|
|
|
|
- .setTAddressId(addressId);
|
|
|
|
|
- tradeOrderAmountService.add(orderAmount);
|
|
|
|
|
|
|
+ //订单关联商品信息
|
|
|
|
|
+ order.setGoodsId(goodsDetail.getId()).setUnit(goodsDetail.getUnit()).setUnitPrice(goods.getUnitPrice().doubleValue())
|
|
|
|
|
+ .setGoodsName(goodsDetail.getName()).setGoodsType(goodsDetail.getGoodsType()).setGoodsCode(goodsDetail.getCode())
|
|
|
|
|
+ .setGoodsTaxRate(goodsDetail.getTaxRate()).setGoodsSpec(goodsDetail.getSpec()).setGoodsThumb(goodsDetail.getThumb());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Objects.isNull(order.getUnitPrice())) {
|
|
|
|
|
+ order.setUnitPrice(BigDecimal.ZERO.doubleValue());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //单位信息
|
|
|
|
|
+ kwoTradeOrderUnitService.delByOrderId(id);
|
|
|
|
|
+ List<UnitInfo> unitInfos = param.getUnitInfo();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(unitInfos)) {
|
|
|
|
|
+ List<KwoTradeOrderUnit> list = new ArrayList<>(unitInfos.size());
|
|
|
|
|
+ List<Long> entIds = unitInfos.stream().map(UnitInfo::getEntId).distinct().toList();
|
|
|
|
|
+ Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
|
|
|
|
|
+ unitInfos.forEach(e -> {
|
|
|
|
|
+ EntCacheResDto ent = entMap.get(e.getEntId());
|
|
|
|
|
+ if (Objects.isNull(ent)) {
|
|
|
|
|
+ throw new BusinessException("企业:" + e.getFirmName() + "的一级企业信息不存在!");
|
|
|
}
|
|
}
|
|
|
- if (loadFlag && totalLoadAmount.compareTo(amount) != 0) {
|
|
|
|
|
- throw new BusinessException("装货分配量总量与订单总量不符!");
|
|
|
|
|
|
|
+ KwoTradeOrderUnit unit = BeanUtil.copyProperties(e, KwoTradeOrderUnit.class);
|
|
|
|
|
+ unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(ent.getId());
|
|
|
|
|
+ list.add(unit);
|
|
|
|
|
+ if (Objects.equals(e.getUnitType(), OrderUnitTypeEnum.PURCHASE.getType())) {
|
|
|
|
|
+ order.setProcureEntId(e.getEntId()).setProcureTopEntId(unit.getTopEntId()).setProcureFirmName(e.getFirmName())
|
|
|
|
|
+ .setProcureContacts(e.getContacts()).setProcurePhone(e.getPhone()).setProcureContactsId(e.getContactsId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ order.setSupplyEntId(e.getEntId()).setSupplyTopEntId(unit.getTopEntId()).setSupplyFirmName(e.getFirmName())
|
|
|
|
|
+ .setSupplyContacts(e.getContacts()).setSupplyPhone(e.getPhone()).setSupplyContactsId(e.getContactsId());
|
|
|
}
|
|
}
|
|
|
- if (unloadFlag && totalUnloadAmount.compareTo(amount) != 0) {
|
|
|
|
|
- throw new BusinessException("卸货分配量总量与订单总量不符!");
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ kwoTradeOrderUnitService.insertBatch(list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //地址信息
|
|
|
|
|
+ kwoTradeOrderAddressService.delByOrderId(id);
|
|
|
|
|
+ tradeOrderAmountService.delByOrderId(id);
|
|
|
|
|
+ List<AddressInfo> addressInfos = param.getAddressInfo();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(addressInfos)) {
|
|
|
|
|
+ BigDecimal amount = Objects.isNull(param.getAmount()) ? BigDecimal.ZERO : param.getAmount();
|
|
|
|
|
+ BigDecimal totalLoadAmount = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal totalUnloadAmount = BigDecimal.ZERO;
|
|
|
|
|
+ boolean loadFlag = false;
|
|
|
|
|
+ boolean unloadFlag = false;
|
|
|
|
|
+ for (AddressInfo e : addressInfos) {
|
|
|
|
|
+ if (Objects.equals(e.getAddressType(), OrderAddressTypeEnum.LOAD.getType())) {
|
|
|
|
|
+ totalLoadAmount = totalLoadAmount.add(e.getAmount());
|
|
|
|
|
+ loadFlag = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ totalUnloadAmount = totalUnloadAmount.add(e.getAmount());
|
|
|
|
|
+ unloadFlag = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //合同信息
|
|
|
|
|
- kwoTradeOrderContractService.delByOrderId(id);
|
|
|
|
|
- ContractInfo contractInfo = param.getContractInfo();
|
|
|
|
|
- KwoTradeOrderContract contract = BeanUtils.copyProperties(contractInfo, KwoTradeOrderContract.class);
|
|
|
|
|
- if (Objects.nonNull(contract)) {
|
|
|
|
|
- contract.setTOrderId(id).setTOrderNo(tOrderNo);
|
|
|
|
|
- kwoTradeOrderContractService.insert(contract);
|
|
|
|
|
- BeanUtils.copyProperties(contractInfo, order);
|
|
|
|
|
|
|
+ if (loadFlag && totalLoadAmount.compareTo(amount) != 0) {
|
|
|
|
|
+ throw new BusinessException("装货分配量总量与订单总量不符!");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //状态信息(草稿更新不加状态记录)
|
|
|
|
|
- if (!isUpdate || !Objects.equals(OrderStatusEnum.SAVED.getCode(), tradeOrder.getStatus())) {
|
|
|
|
|
- KwoTradeOrderTrack track = new KwoTradeOrderTrack();
|
|
|
|
|
- track.setTOrderId(id).setTOrderNo(tOrderNo).setStatus(tradeOrder.getStatus()).setRemark(tradeOrder.getRemark());
|
|
|
|
|
- kwoTradeOrderTrackService.insert(track);
|
|
|
|
|
|
|
+ if (unloadFlag && totalUnloadAmount.compareTo(amount) != 0) {
|
|
|
|
|
+ throw new BusinessException("卸货分配量总量与订单总量不符!");
|
|
|
}
|
|
}
|
|
|
- int method = isUpdate ? 2 : 1;
|
|
|
|
|
- //存MongoDb
|
|
|
|
|
- saveMongoDb(method, order);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ addressInfos.forEach(e -> {
|
|
|
|
|
+ KwoTradeOrderAddress address = BeanUtil.copyProperties(e, KwoTradeOrderAddress.class);
|
|
|
|
|
+ address.setTOrderId(id).setTOrderNo(tOrderNo);
|
|
|
|
|
+ //todo MongoDB如何存多个地址信息?
|
|
|
|
|
+ if (Objects.equals(address.getAddressType(), OrderAddressTypeEnum.LOAD.getType())) {
|
|
|
|
|
+ order.setLoadName(e.getName()).setLoadType(e.getType()).setLoadContacts(e.getContacts())
|
|
|
|
|
+ .setLoadPhone(e.getPhone()).setLoadCityCode(String.valueOf(e.getCityCode())).setLoadCityName(e.getCityName())
|
|
|
|
|
+ .setLoadDetailAddress(e.getDetailAddress()).setLoadLat(e.getLat()).setLoadLng(e.getLng());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ order.setUnloadName(e.getName()).setUnloadType(e.getType()).setUnloadContacts(e.getContacts())
|
|
|
|
|
+ .setUnloadPhone(e.getPhone()).setUnloadCityCode(String.valueOf(e.getCityCode())).setUnloadCityName(e.getCityName())
|
|
|
|
|
+ .setUnloadDetailAddress(e.getDetailAddress()).setUnloadLat(e.getLat()).setUnloadLng(e.getLng());
|
|
|
|
|
+ }
|
|
|
|
|
+ //地址信息
|
|
|
|
|
+ Long addressId = kwoTradeOrderAddressService.add(address);
|
|
|
|
|
+ //分配量信息
|
|
|
|
|
+ KwoTradeOrderAmount orderAmount = new KwoTradeOrderAmount();
|
|
|
|
|
+ orderAmount.setTOrderId(id).setAmount(e.getAmount())
|
|
|
|
|
+ .setTAddressId(addressId);
|
|
|
|
|
+ tradeOrderAmountService.add(orderAmount);
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //合同信息
|
|
|
|
|
+ kwoTradeOrderContractService.delByOrderId(id);
|
|
|
|
|
+ ContractInfo contractInfo = param.getContractInfo();
|
|
|
|
|
+ KwoTradeOrderContract contract = BeanUtil.copyProperties(contractInfo, KwoTradeOrderContract.class);
|
|
|
|
|
+ if (Objects.nonNull(contract)) {
|
|
|
|
|
+ contract.setTOrderId(id).setTOrderNo(tOrderNo);
|
|
|
|
|
+ kwoTradeOrderContractService.insert(contract);
|
|
|
|
|
+ BeanUtil.copyProperties(contractInfo, order);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //状态信息(草稿更新不加状态记录)
|
|
|
|
|
+ if (!isUpdate || !Objects.equals(OrderStatusEnum.SAVED.getCode(), tradeOrder.getStatus())) {
|
|
|
|
|
+ KwoTradeOrderTrack track = new KwoTradeOrderTrack();
|
|
|
|
|
+ track.setTOrderId(id).setTOrderNo(tOrderNo).setStatus(tradeOrder.getStatus()).setRemark(tradeOrder.getRemark());
|
|
|
|
|
+ kwoTradeOrderTrackService.insert(track);
|
|
|
|
|
+ }
|
|
|
|
|
+ int method = isUpdate ? 2 : 1;
|
|
|
|
|
+ //存MongoDb
|
|
|
|
|
+ saveMongoDb(method, order);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -318,7 +325,7 @@ public class KwoTradeOrderService {
|
|
|
* @return: void
|
|
* @return: void
|
|
|
*/
|
|
*/
|
|
|
public void addValetOrderDraft(ValetOrderDraftParam param) {
|
|
public void addValetOrderDraft(ValetOrderDraftParam param) {
|
|
|
- KwoTradeOrder order = BeanUtils.copyProperties(param, KwoTradeOrder.class);
|
|
|
|
|
|
|
+ KwoTradeOrder order = BeanUtil.copyProperties(param, KwoTradeOrder.class);
|
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
|
.setTOrderNo(getOrderNo())
|
|
.setTOrderNo(getOrderNo())
|
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
@@ -326,7 +333,7 @@ public class KwoTradeOrderService {
|
|
|
.setUnit(Objects.nonNull(param.getGoodsInfo()) ? param.getGoodsInfo().getUnit() : null)
|
|
.setUnit(Objects.nonNull(param.getGoodsInfo()) ? param.getGoodsInfo().getUnit() : null)
|
|
|
.setSource(OrderSourceEnum.SALE.getType()).setStatus(OrderStatusEnum.SAVED.getCode());
|
|
.setSource(OrderSourceEnum.SALE.getType()).setStatus(OrderStatusEnum.SAVED.getCode());
|
|
|
kwoTradeOrderMapper.insert(order);
|
|
kwoTradeOrderMapper.insert(order);
|
|
|
- addOtherOrderInfo(order, BeanUtils.copyProperties(param, ValetOrderParam.class), false);
|
|
|
|
|
|
|
+ addOtherOrderInfo(order, BeanUtil.copyProperties(param, ValetOrderParam.class), false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -341,12 +348,12 @@ public class KwoTradeOrderService {
|
|
|
if (Objects.isNull(goodsInfo.getPriceRangeId())) {
|
|
if (Objects.isNull(goodsInfo.getPriceRangeId())) {
|
|
|
throw new BusinessException("采购下单价格梯度信息不能为空!");
|
|
throw new BusinessException("采购下单价格梯度信息不能为空!");
|
|
|
}
|
|
}
|
|
|
- OrderCheckDTO orderCheck = BeanUtils.copyProperties(param, OrderCheckDTO.class);
|
|
|
|
|
|
|
+ OrderCheckDTO orderCheck = BeanUtil.copyProperties(param, OrderCheckDTO.class);
|
|
|
getTopEnt(orderCheck, param.getUnitInfo());
|
|
getTopEnt(orderCheck, param.getUnitInfo());
|
|
|
orderCheck.setGoodsId(goodsInfo.getGoodsId()).setUnitPrice(goodsInfo.getUnitPrice())
|
|
orderCheck.setGoodsId(goodsInfo.getGoodsId()).setUnitPrice(goodsInfo.getUnitPrice())
|
|
|
.setOrderSource(OrderSourceEnum.PURCHASE.getType());
|
|
.setOrderSource(OrderSourceEnum.PURCHASE.getType());
|
|
|
orderCheck(orderCheck, false);
|
|
orderCheck(orderCheck, false);
|
|
|
- KwoTradeOrder order = BeanUtils.copyProperties(param, KwoTradeOrder.class);
|
|
|
|
|
|
|
+ KwoTradeOrder order = BeanUtil.copyProperties(param, KwoTradeOrder.class);
|
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
|
.setTOrderNo(getOrderNo())
|
|
.setTOrderNo(getOrderNo())
|
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
@@ -361,7 +368,7 @@ public class KwoTradeOrderService {
|
|
|
throw new BusinessException(updateResult.getMsg());
|
|
throw new BusinessException(updateResult.getMsg());
|
|
|
}
|
|
}
|
|
|
//添加订单其他信息
|
|
//添加订单其他信息
|
|
|
- addOtherOrderInfo(order, BeanUtils.copyProperties(param, ValetOrderParam.class), false);
|
|
|
|
|
|
|
+ addOtherOrderInfo(order, BeanUtil.copyProperties(param, ValetOrderParam.class), false);
|
|
|
//发送消息提醒
|
|
//发送消息提醒
|
|
|
submitOrderSendMsg(orderCheck, order.getTOrderNo());
|
|
submitOrderSendMsg(orderCheck, order.getTOrderNo());
|
|
|
}
|
|
}
|
|
@@ -538,7 +545,7 @@ public class KwoTradeOrderService {
|
|
|
* @return: void
|
|
* @return: void
|
|
|
*/
|
|
*/
|
|
|
public void addValetOrderSubmit(ValetOrderParam param) {
|
|
public void addValetOrderSubmit(ValetOrderParam param) {
|
|
|
- OrderCheckDTO orderCheck = BeanUtils.copyProperties(param, OrderCheckDTO.class);
|
|
|
|
|
|
|
+ OrderCheckDTO orderCheck = BeanUtil.copyProperties(param, OrderCheckDTO.class);
|
|
|
getTopEnt(orderCheck, param.getUnitInfo());
|
|
getTopEnt(orderCheck, param.getUnitInfo());
|
|
|
orderCheck.setGoodsId(param.getGoodsInfo().getGoodsId()).setUnitPrice(param.getGoodsInfo().getUnitPrice())
|
|
orderCheck.setGoodsId(param.getGoodsInfo().getGoodsId()).setUnitPrice(param.getGoodsInfo().getUnitPrice())
|
|
|
.setOrderSource(OrderSourceEnum.SALE.getType());
|
|
.setOrderSource(OrderSourceEnum.SALE.getType());
|
|
@@ -546,7 +553,7 @@ public class KwoTradeOrderService {
|
|
|
ContractInfo contract = param.getContractInfo();
|
|
ContractInfo contract = param.getContractInfo();
|
|
|
contractCheck(contract);
|
|
contractCheck(contract);
|
|
|
param.setContractInfo(contract);
|
|
param.setContractInfo(contract);
|
|
|
- KwoTradeOrder order = BeanUtils.copyProperties(param, KwoTradeOrder.class);
|
|
|
|
|
|
|
+ KwoTradeOrder order = BeanUtil.copyProperties(param, KwoTradeOrder.class);
|
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
order.setEntId(LoginUserHolder.getEntId())
|
|
|
.setTOrderNo(getOrderNo())
|
|
.setTOrderNo(getOrderNo())
|
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
@@ -575,7 +582,7 @@ public class KwoTradeOrderService {
|
|
|
throw new BusinessException(freezeResult.getMsg());
|
|
throw new BusinessException(freezeResult.getMsg());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- addOtherOrderInfo(order, BeanUtils.copyProperties(param, ValetOrderParam.class), false);
|
|
|
|
|
|
|
+ addOtherOrderInfo(order, BeanUtil.copyProperties(param, ValetOrderParam.class), false);
|
|
|
//发送消息提醒
|
|
//发送消息提醒
|
|
|
submitOrderSendMsg(orderCheck, order.getTOrderNo());
|
|
submitOrderSendMsg(orderCheck, order.getTOrderNo());
|
|
|
}
|
|
}
|
|
@@ -595,7 +602,7 @@ public class KwoTradeOrderService {
|
|
|
if (Boolean.FALSE.equals(RedissonUtils.tryLock(lockKey, 5L, 10L))) {
|
|
if (Boolean.FALSE.equals(RedissonUtils.tryLock(lockKey, 5L, 10L))) {
|
|
|
throw new BusinessException("业务繁忙,请稍后再试!");
|
|
throw new BusinessException("业务繁忙,请稍后再试!");
|
|
|
}
|
|
}
|
|
|
- DateTime dateTime = DateUtils.beginOfDay(date);
|
|
|
|
|
|
|
+ DateTime dateTime = DateUtil.beginOfDay(date);
|
|
|
String maxOrderNo = kwoTradeOrderMapper.getMaxOrderNoByDate(dateTime);
|
|
String maxOrderNo = kwoTradeOrderMapper.getMaxOrderNoByDate(dateTime);
|
|
|
if (StringUtils.isNotBlank(maxOrderNo)) {
|
|
if (StringUtils.isNotBlank(maxOrderNo)) {
|
|
|
Long maxNum = Long.valueOf(StringUtils.subStrFromIndexToEnd(maxOrderNo, 4));
|
|
Long maxNum = Long.valueOf(StringUtils.subStrFromIndexToEnd(maxOrderNo, 4));
|
|
@@ -648,11 +655,11 @@ public class KwoTradeOrderService {
|
|
|
List<Long> createBys = tracks.stream().map(KwoTradeOrderTrack::getCreateBy).distinct().toList();
|
|
List<Long> createBys = tracks.stream().map(KwoTradeOrderTrack::getCreateBy).distinct().toList();
|
|
|
Map<Long, UserCacheResDto> map = remoteSystemService.queryUserCacheMapByIds(createBys);
|
|
Map<Long, UserCacheResDto> map = remoteSystemService.queryUserCacheMapByIds(createBys);
|
|
|
tracks.forEach(e -> {
|
|
tracks.forEach(e -> {
|
|
|
- OrderProcess process = BeanUtils.copyProperties(e, OrderProcess.class);
|
|
|
|
|
|
|
+ OrderProcess process = BeanUtil.copyProperties(e, OrderProcess.class);
|
|
|
UserCacheResDto user = map.get(process.getCreateBy());
|
|
UserCacheResDto user = map.get(process.getCreateBy());
|
|
|
if (Objects.nonNull(user)) {
|
|
if (Objects.nonNull(user)) {
|
|
|
process.setCreateByName(user.getName());
|
|
process.setCreateByName(user.getName());
|
|
|
- if (CollectionUtils.isNotEmpty(user.getRoleInfo())) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(user.getRoleInfo())) {
|
|
|
List<String> roleNames = user.getRoleInfo().stream().map(KwsRoleResDto::getName).distinct().toList();
|
|
List<String> roleNames = user.getRoleInfo().stream().map(KwsRoleResDto::getName).distinct().toList();
|
|
|
process.setRoleName(String.join(",", roleNames));
|
|
process.setRoleName(String.join(",", roleNames));
|
|
|
}
|
|
}
|
|
@@ -690,7 +697,7 @@ public class KwoTradeOrderService {
|
|
|
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> taxRateMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<String, String> orderUnitMap, orderAddressMap, addressMap;
|
|
Map<String, String> orderUnitMap, orderAddressMap, addressMap;
|
|
|
- if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dict)) {
|
|
|
tradeMap = dict.get(DictTypeEnum.TRADE_TYPE.getType());
|
|
tradeMap = dict.get(DictTypeEnum.TRADE_TYPE.getType());
|
|
|
pickupMap = dict.get(DictTypeEnum.PICKUP_TYPE.getType());
|
|
pickupMap = dict.get(DictTypeEnum.PICKUP_TYPE.getType());
|
|
|
deleveryMap = dict.get(DictTypeEnum.DELIVERY_TYPE.getType());
|
|
deleveryMap = dict.get(DictTypeEnum.DELIVERY_TYPE.getType());
|
|
@@ -708,16 +715,16 @@ public class KwoTradeOrderService {
|
|
|
addressMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
addressMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
}
|
|
}
|
|
|
//订单基本信息
|
|
//订单基本信息
|
|
|
- OrderDetailRes detail = BeanUtils.copyProperties(order, OrderDetailRes.class);
|
|
|
|
|
|
|
+ OrderDetailRes detail = BeanUtil.copyProperties(order, OrderDetailRes.class);
|
|
|
UserCacheResDto createUser = remoteSystemService.queryUserCacheById(detail.getCreateBy());
|
|
UserCacheResDto createUser = remoteSystemService.queryUserCacheById(detail.getCreateBy());
|
|
|
EntCacheResDto ent = remoteSystemService.queryEntCacheById(detail.getEntId());
|
|
EntCacheResDto ent = remoteSystemService.queryEntCacheById(detail.getEntId());
|
|
|
detail.setFirmName(Objects.isNull(ent) ? null : ent.getFirmName())
|
|
detail.setFirmName(Objects.isNull(ent) ? null : ent.getFirmName())
|
|
|
.setCreateByName(Objects.isNull(createUser) ? null : createUser.getName())
|
|
.setCreateByName(Objects.isNull(createUser) ? null : createUser.getName())
|
|
|
- .setTradingLabel(CollectionUtils.isNotEmpty(tradeMap) ? tradeMap.get(detail.getTrading()) : null)
|
|
|
|
|
- .setPickupTypeLabel(CollectionUtils.isNotEmpty(pickupMap) ? pickupMap.get(detail.getPickupType()) : null)
|
|
|
|
|
- .setDeliveryTypeLabel(CollectionUtils.isNotEmpty(deleveryMap) ? deleveryMap.get(detail.getDeliveryType()) : null)
|
|
|
|
|
- .setSourceLabel(CollectionUtils.isNotEmpty(sourceMap) ? sourceMap.get(detail.getSource()) : null)
|
|
|
|
|
- .setStatusLabel(CollectionUtils.isNotEmpty(statusMap) ? statusMap.get(String.valueOf(detail.getStatus())) : null);
|
|
|
|
|
|
|
+ .setTradingLabel(CollUtil.isNotEmpty(tradeMap) ? tradeMap.get(detail.getTrading()) : null)
|
|
|
|
|
+ .setPickupTypeLabel(CollUtil.isNotEmpty(pickupMap) ? pickupMap.get(detail.getPickupType()) : null)
|
|
|
|
|
+ .setDeliveryTypeLabel(CollUtil.isNotEmpty(deleveryMap) ? deleveryMap.get(detail.getDeliveryType()) : null)
|
|
|
|
|
+ .setSourceLabel(CollUtil.isNotEmpty(sourceMap) ? sourceMap.get(detail.getSource()) : null)
|
|
|
|
|
+ .setStatusLabel(CollUtil.isNotEmpty(statusMap) ? statusMap.get(String.valueOf(detail.getStatus())) : null);
|
|
|
//商品信息
|
|
//商品信息
|
|
|
KwoTradeOrderGoods orderGoods = kwoTradeOrderGoodsService.getByOrderId(id);
|
|
KwoTradeOrderGoods orderGoods = kwoTradeOrderGoodsService.getByOrderId(id);
|
|
|
if (Objects.nonNull(orderGoods)) {
|
|
if (Objects.nonNull(orderGoods)) {
|
|
@@ -725,9 +732,9 @@ public class KwoTradeOrderService {
|
|
|
if (Objects.nonNull(goods)) {
|
|
if (Objects.nonNull(goods)) {
|
|
|
EntCacheResDto entCache = remoteSystemService.queryEntCacheById(goods.getEntId());
|
|
EntCacheResDto entCache = remoteSystemService.queryEntCacheById(goods.getEntId());
|
|
|
GoodsInfoDetailRes goodsDetail = new GoodsInfoDetailRes();
|
|
GoodsInfoDetailRes goodsDetail = new GoodsInfoDetailRes();
|
|
|
- goodsDetail.setGoodsTypeLabel(CollectionUtils.isNotEmpty(prodcutNameMap) ? prodcutNameMap.get(goods.getGoodsType()) : null)
|
|
|
|
|
- .setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(goods.getUnit()) : null)
|
|
|
|
|
- .setTaxRateLabel(CollectionUtils.isNotEmpty(taxRateMap) ? taxRateMap.get(goods.getTaxRate()) : null)
|
|
|
|
|
|
|
+ goodsDetail.setGoodsTypeLabel(CollUtil.isNotEmpty(prodcutNameMap) ? prodcutNameMap.get(goods.getGoodsType()) : null)
|
|
|
|
|
+ .setUnitLabel(CollUtil.isNotEmpty(unitMap) ? unitMap.get(goods.getUnit()) : null)
|
|
|
|
|
+ .setTaxRateLabel(CollUtil.isNotEmpty(taxRateMap) ? taxRateMap.get(goods.getTaxRate()) : null)
|
|
|
.setGoodsAmount(goods.getAmount())
|
|
.setGoodsAmount(goods.getAmount())
|
|
|
.setGoodsId(goods.getId()).setCode(goods.getCode()).setName(goods.getName())
|
|
.setGoodsId(goods.getId()).setCode(goods.getCode()).setName(goods.getName())
|
|
|
.setGoodsType(goods.getGoodsType()).setTaxRate(goods.getTaxRate()).setSpec(goods.getSpec())
|
|
.setGoodsType(goods.getGoodsType()).setTaxRate(goods.getTaxRate()).setSpec(goods.getSpec())
|
|
@@ -739,11 +746,11 @@ public class KwoTradeOrderService {
|
|
|
|
|
|
|
|
//商品辅助单位信息
|
|
//商品辅助单位信息
|
|
|
List<GoodsUnitDetailRes> assistUnit = kwoTradeOrderGoodsUnitService.findGoodsUnitDetail(id);
|
|
List<GoodsUnitDetailRes> assistUnit = kwoTradeOrderGoodsUnitService.findGoodsUnitDetail(id);
|
|
|
- if (CollectionUtils.isNotEmpty(assistUnit)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(assistUnit)) {
|
|
|
Map<String, String> finalUnitMap = unitMap;
|
|
Map<String, String> finalUnitMap = unitMap;
|
|
|
assistUnit.forEach(e -> {
|
|
assistUnit.forEach(e -> {
|
|
|
- e.setFromUnitName(CollectionUtils.isNotEmpty(finalUnitMap) ? finalUnitMap.get(e.getFromUnit()) : null);
|
|
|
|
|
- e.setToUnitName(CollectionUtils.isNotEmpty(finalUnitMap) ? finalUnitMap.get(e.getToUnit()) : null);
|
|
|
|
|
|
|
+ e.setFromUnitName(CollUtil.isNotEmpty(finalUnitMap) ? finalUnitMap.get(e.getFromUnit()) : null);
|
|
|
|
|
+ e.setToUnitName(CollUtil.isNotEmpty(finalUnitMap) ? finalUnitMap.get(e.getToUnit()) : null);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
detail.setAssistUnit(assistUnit);
|
|
detail.setAssistUnit(assistUnit);
|
|
@@ -752,26 +759,26 @@ public class KwoTradeOrderService {
|
|
|
|
|
|
|
|
//单位信息
|
|
//单位信息
|
|
|
List<KwoTradeOrderUnit> units = kwoTradeOrderUnitService.getByOrderId(id);
|
|
List<KwoTradeOrderUnit> units = kwoTradeOrderUnitService.getByOrderId(id);
|
|
|
- if (CollectionUtils.isNotEmpty(units)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(units)) {
|
|
|
List<UnitInfoDetailRes> unitInfos = new ArrayList<>(units.size());
|
|
List<UnitInfoDetailRes> unitInfos = new ArrayList<>(units.size());
|
|
|
units.forEach(e -> {
|
|
units.forEach(e -> {
|
|
|
- UnitInfoDetailRes unit = BeanUtils.copyProperties(e, UnitInfoDetailRes.class);
|
|
|
|
|
- unit.setUnitTypeLabel(CollectionUtils.isNotEmpty(orderUnitMap) ? orderUnitMap.get(unit.getUnitType()) : null);
|
|
|
|
|
|
|
+ UnitInfoDetailRes unit = BeanUtil.copyProperties(e, UnitInfoDetailRes.class);
|
|
|
|
|
+ unit.setUnitTypeLabel(CollUtil.isNotEmpty(orderUnitMap) ? orderUnitMap.get(unit.getUnitType()) : null);
|
|
|
unitInfos.add(unit);
|
|
unitInfos.add(unit);
|
|
|
});
|
|
});
|
|
|
detail.setUnitInfo(unitInfos);
|
|
detail.setUnitInfo(unitInfos);
|
|
|
}
|
|
}
|
|
|
//地址信息
|
|
//地址信息
|
|
|
List<KwoTradeOrderAddress> addressList = kwoTradeOrderAddressService.getByOrderId(id);
|
|
List<KwoTradeOrderAddress> addressList = kwoTradeOrderAddressService.getByOrderId(id);
|
|
|
- if (CollectionUtils.isNotEmpty(addressList)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(addressList)) {
|
|
|
//分配量信息
|
|
//分配量信息
|
|
|
List<KwoTradeOrderAmount> amountList = tradeOrderAmountService.getByOrderId(id);
|
|
List<KwoTradeOrderAmount> amountList = tradeOrderAmountService.getByOrderId(id);
|
|
|
Map<Long, KwoTradeOrderAmount> amountMap = amountList.stream().collect(Collectors.toMap(KwoTradeOrderAmount::getTAddressId, e -> e, (k1, k2) -> k1));
|
|
Map<Long, KwoTradeOrderAmount> amountMap = amountList.stream().collect(Collectors.toMap(KwoTradeOrderAmount::getTAddressId, e -> e, (k1, k2) -> k1));
|
|
|
List<AddressInfoDetailRes> addressInfoDetails = new ArrayList<>(addressList.size());
|
|
List<AddressInfoDetailRes> addressInfoDetails = new ArrayList<>(addressList.size());
|
|
|
addressList.forEach(e -> {
|
|
addressList.forEach(e -> {
|
|
|
- AddressInfoDetailRes address = BeanUtils.copyProperties(e, AddressInfoDetailRes.class);
|
|
|
|
|
- address.setAddressTypeLabel(CollectionUtils.isNotEmpty(orderAddressMap) ? orderAddressMap.get(address.getAddressType()) : null);
|
|
|
|
|
- address.setTypeLabel(CollectionUtils.isNotEmpty(addressMap) ? addressMap.get(address.getType()) : null);
|
|
|
|
|
|
|
+ AddressInfoDetailRes address = BeanUtil.copyProperties(e, AddressInfoDetailRes.class);
|
|
|
|
|
+ address.setAddressTypeLabel(CollUtil.isNotEmpty(orderAddressMap) ? orderAddressMap.get(address.getAddressType()) : null);
|
|
|
|
|
+ address.setTypeLabel(CollUtil.isNotEmpty(addressMap) ? addressMap.get(address.getType()) : null);
|
|
|
KwoTradeOrderAmount orderAmount = amountMap.get(e.getId());
|
|
KwoTradeOrderAmount orderAmount = amountMap.get(e.getId());
|
|
|
if (Objects.nonNull(orderAmount)) {
|
|
if (Objects.nonNull(orderAmount)) {
|
|
|
address.setAmount(orderAmount.getAmount());
|
|
address.setAmount(orderAmount.getAmount());
|
|
@@ -783,7 +790,7 @@ public class KwoTradeOrderService {
|
|
|
//合同信息
|
|
//合同信息
|
|
|
KwoTradeOrderContract contract = kwoTradeOrderContractService.getByOrderId(id);
|
|
KwoTradeOrderContract contract = kwoTradeOrderContractService.getByOrderId(id);
|
|
|
if (Objects.nonNull(contract)) {
|
|
if (Objects.nonNull(contract)) {
|
|
|
- ContractInfo contractInfo = BeanUtils.copyProperties(contract, ContractInfo.class);
|
|
|
|
|
|
|
+ ContractInfo contractInfo = BeanUtil.copyProperties(contract, ContractInfo.class);
|
|
|
Map<Long, ContractCommonInfoResDto> contractMap = remoteContractService.queryContractBaseInfo(List.of(contractInfo.getContractId()));
|
|
Map<Long, ContractCommonInfoResDto> contractMap = remoteContractService.queryContractBaseInfo(List.of(contractInfo.getContractId()));
|
|
|
ContractCommonInfoResDto contractRes = contractMap.get(contractInfo.getContractId());
|
|
ContractCommonInfoResDto contractRes = contractMap.get(contractInfo.getContractId());
|
|
|
if (Objects.nonNull(contractRes)) {
|
|
if (Objects.nonNull(contractRes)) {
|
|
@@ -839,7 +846,7 @@ public class KwoTradeOrderService {
|
|
|
throw new BusinessException("Invalid contract status");
|
|
throw new BusinessException("Invalid contract status");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- orderCheck = BeanUtils.copyProperties(param, OrderCheckDTO.class);
|
|
|
|
|
|
|
+ orderCheck = BeanUtil.copyProperties(param, OrderCheckDTO.class);
|
|
|
getTopEnt(orderCheck, param.getUnitInfo());
|
|
getTopEnt(orderCheck, param.getUnitInfo());
|
|
|
orderCheck.setGoodsId(param.getGoodsInfo().getGoodsId()).setUnitPrice(param.getGoodsInfo().getUnitPrice())
|
|
orderCheck.setGoodsId(param.getGoodsInfo().getGoodsId()).setUnitPrice(param.getGoodsInfo().getUnitPrice())
|
|
|
.setOrderSource(source);
|
|
.setOrderSource(source);
|
|
@@ -877,7 +884,7 @@ public class KwoTradeOrderService {
|
|
|
.set(KwoTradeOrder::getStatus, order.getStatus())
|
|
.set(KwoTradeOrder::getStatus, order.getStatus())
|
|
|
.eq(KwoTradeOrder::getId, order.getId());
|
|
.eq(KwoTradeOrder::getId, order.getId());
|
|
|
kwoTradeOrderMapper.update(null, wrapper);
|
|
kwoTradeOrderMapper.update(null, wrapper);
|
|
|
- ValetOrderParam valetOrderParam = BeanUtils.copyProperties(param, ValetOrderParam.class);
|
|
|
|
|
|
|
+ ValetOrderParam valetOrderParam = BeanUtil.copyProperties(param, ValetOrderParam.class);
|
|
|
|
|
|
|
|
addOtherOrderInfo(order, valetOrderParam, true);
|
|
addOtherOrderInfo(order, valetOrderParam, true);
|
|
|
//订单提交发送提醒消息
|
|
//订单提交发送提醒消息
|
|
@@ -1006,6 +1013,23 @@ public class KwoTradeOrderService {
|
|
|
* @return: void
|
|
* @return: void
|
|
|
*/
|
|
*/
|
|
|
public void acceptanceOrder(AcceptanceOrderParam param) {
|
|
public void acceptanceOrder(AcceptanceOrderParam param) {
|
|
|
|
|
+ BigDecimal amount = param.getAmount();
|
|
|
|
|
+ List<UpdateAddressAmountParam> addressAmountParams = param.getAddressAmountParams();
|
|
|
|
|
+ BigDecimal totalLoadAmount = addressAmountParams.stream()
|
|
|
|
|
+ .map(UpdateAddressAmountParam::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
+ if (amount.compareTo(totalLoadAmount) != 0) {
|
|
|
|
|
+ throw new BusinessException("分配卸货量总量与订单总量不相符!");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<AddressInfo> loadAddressInfo = param.getAddressInfo();
|
|
|
|
|
+ long unloadCount = loadAddressInfo.stream().filter(e -> Objects.equals(OrderAddressTypeEnum.UNLOAD.getType(), e.getAddressType())).count();
|
|
|
|
|
+ if (unloadCount > 0) {
|
|
|
|
|
+ throw new BusinessException("装货地址类型信息有误!");
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal totalUnLoadAmount = loadAddressInfo.stream()
|
|
|
|
|
+ .map(AddressInfo::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
+ if (amount.compareTo(totalUnLoadAmount) != 0) {
|
|
|
|
|
+ throw new BusinessException("分配装货量总量与订单总量不相符!");
|
|
|
|
|
+ }
|
|
|
if (param.getPrice().compareTo(param.getUnitPrice().multiply(param.getAmount())) != 0) {
|
|
if (param.getPrice().compareTo(param.getUnitPrice().multiply(param.getAmount())) != 0) {
|
|
|
throw new BusinessException("订单总金额不等于商品单价*订单总量!");
|
|
throw new BusinessException("订单总金额不等于商品单价*订单总量!");
|
|
|
}
|
|
}
|
|
@@ -1023,16 +1047,31 @@ public class KwoTradeOrderService {
|
|
|
if (Objects.isNull(goods)) {
|
|
if (Objects.isNull(goods)) {
|
|
|
throw new BusinessException("订单商品信息异常!");
|
|
throw new BusinessException("订单商品信息异常!");
|
|
|
}
|
|
}
|
|
|
- //受理订单总量-原订单总量=订单变化量
|
|
|
|
|
List<KwoTradeOrderUnit> units = kwoTradeOrderUnitService.getByOrderId(order.getId());
|
|
List<KwoTradeOrderUnit> units = kwoTradeOrderUnitService.getByOrderId(order.getId());
|
|
|
- List<UnitInfo> unitInfos = BeanUtils.copyToList(units, UnitInfo.class);
|
|
|
|
|
|
|
+ Long saleUnitId = param.getSaleUnitParam().getId();
|
|
|
|
|
+ KwoTradeOrderUnit saleUnit = units.stream().filter(e -> Objects.equals(e.getId(), saleUnitId) &&
|
|
|
|
|
+ Objects.equals(e.getUnitType(), OrderUnitTypeEnum.SALE.getType())).findFirst().orElse(null);
|
|
|
|
|
+ if (Objects.isNull(saleUnit)) {
|
|
|
|
|
+ throw new BusinessException("我方单位信息异常!");
|
|
|
|
|
+ }
|
|
|
|
|
+ Long contactsId = param.getSaleUnitParam().getContactsId();
|
|
|
|
|
+ boolean updateUnit = !Objects.equals(contactsId, saleUnit.getContactsId());
|
|
|
|
|
+ if (updateUnit) {
|
|
|
|
|
+ UserCacheResDto contactsInfo = remoteSystemService.queryUserCacheById(contactsId);
|
|
|
|
|
+ if (Objects.isNull(contactsInfo)) {
|
|
|
|
|
+ throw new BusinessException("未查询到我方联系人信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ saleUnit.setContactsId(contactsId).setContacts(contactsInfo.getName()).setPhone(contactsInfo.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<UnitInfo> unitInfos = BeanUtil.copyToList(units, UnitInfo.class);
|
|
|
if (CollectionUtils.isEmpty(unitInfos)) {
|
|
if (CollectionUtils.isEmpty(unitInfos)) {
|
|
|
throw new BusinessException("订单企业信息异常!");
|
|
throw new BusinessException("订单企业信息异常!");
|
|
|
}
|
|
}
|
|
|
- BigDecimal amount = param.getAmount().subtract(order.getAmount());
|
|
|
|
|
- OrderCheckDTO orderCheck = BeanUtils.copyProperties(param, OrderCheckDTO.class);
|
|
|
|
|
|
|
+ //受理订单总量-原订单总量=订单变化量
|
|
|
|
|
+ BigDecimal changeAmount = amount.subtract(order.getAmount());
|
|
|
|
|
+ OrderCheckDTO orderCheck = BeanUtil.copyProperties(param, OrderCheckDTO.class);
|
|
|
getTopEnt(orderCheck, unitInfos);
|
|
getTopEnt(orderCheck, unitInfos);
|
|
|
- orderCheck.setGoodsId(goods.getGoodsId()).setAmount(amount);
|
|
|
|
|
|
|
+ orderCheck.setGoodsId(goods.getGoodsId()).setAmount(changeAmount);
|
|
|
orderCheck(orderCheck, true);
|
|
orderCheck(orderCheck, true);
|
|
|
//冻结金额
|
|
//冻结金额
|
|
|
if (param.getTrading().startsWith("1")) {
|
|
if (param.getTrading().startsWith("1")) {
|
|
@@ -1043,7 +1082,7 @@ public class KwoTradeOrderService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//更新订单信息
|
|
//更新订单信息
|
|
|
- BeanUtils.copyProperties(param, order);
|
|
|
|
|
|
|
+ BeanUtil.copyProperties(param, order);
|
|
|
ContractInfo contractInfo = param.getContractInfo();
|
|
ContractInfo contractInfo = param.getContractInfo();
|
|
|
contractCheck(contractInfo);
|
|
contractCheck(contractInfo);
|
|
|
String contractStatus = contractInfo.getContractStatus();
|
|
String contractStatus = contractInfo.getContractStatus();
|
|
@@ -1059,8 +1098,32 @@ public class KwoTradeOrderService {
|
|
|
kwoTradeOrderMapper.updateById(order);
|
|
kwoTradeOrderMapper.updateById(order);
|
|
|
//更新商品价格
|
|
//更新商品价格
|
|
|
kwoTradeOrderGoodsService.updateUnitPrice(param.getId(), param.getUnitPrice());
|
|
kwoTradeOrderGoodsService.updateUnitPrice(param.getId(), param.getUnitPrice());
|
|
|
|
|
+ //更新单位信息
|
|
|
|
|
+ if (updateUnit) {
|
|
|
|
|
+ kwoTradeOrderUnitService.updateById(saleUnit);
|
|
|
|
|
+ }
|
|
|
|
|
+ //更新装货地址信息
|
|
|
|
|
+ List<Long> oldLoadAddressIds = kwoTradeOrderAddressService.getByOrderIdAndType(param.getId(), OrderAddressTypeEnum.LOAD.getType())
|
|
|
|
|
+ .stream().map(KwoTradeOrderAddress::getId).toList();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(oldLoadAddressIds)) {
|
|
|
|
|
+ kwoTradeOrderAddressService.delByIds(oldLoadAddressIds);
|
|
|
|
|
+ tradeOrderAmountService.delByOrderIdAndAddressIds(param.getId(), oldLoadAddressIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ loadAddressInfo.forEach(e -> {
|
|
|
|
|
+ KwoTradeOrderAddress address = BeanUtil.copyProperties(e, KwoTradeOrderAddress.class);
|
|
|
|
|
+ address.setTOrderId(param.getId()).setTOrderNo(order.getTOrderNo());
|
|
|
|
|
+ //地址信息
|
|
|
|
|
+ Long addressId = kwoTradeOrderAddressService.add(address);
|
|
|
|
|
+ //分配量信息
|
|
|
|
|
+ KwoTradeOrderAmount orderAmount = new KwoTradeOrderAmount();
|
|
|
|
|
+ orderAmount.setTOrderId(param.getId()).setAmount(e.getAmount())
|
|
|
|
|
+ .setTAddressId(addressId);
|
|
|
|
|
+ tradeOrderAmountService.add(orderAmount);
|
|
|
|
|
+ });
|
|
|
|
|
+ //更新卸货地址分配量信息
|
|
|
|
|
+ addressAmountParams.forEach(tradeOrderAmountService::update);
|
|
|
//保存合同信息
|
|
//保存合同信息
|
|
|
- KwoTradeOrderContract tradeOrderContract = BeanUtils.copyProperties(contractInfo, KwoTradeOrderContract.class);
|
|
|
|
|
|
|
+ KwoTradeOrderContract tradeOrderContract = BeanUtil.copyProperties(contractInfo, KwoTradeOrderContract.class);
|
|
|
tradeOrderContract.setTOrderId(order.getId()).setTOrderNo(order.getTOrderNo());
|
|
tradeOrderContract.setTOrderId(order.getId()).setTOrderNo(order.getTOrderNo());
|
|
|
kwoTradeOrderContractService.insert(tradeOrderContract);
|
|
kwoTradeOrderContractService.insert(tradeOrderContract);
|
|
|
//订单状态记录
|
|
//订单状态记录
|
|
@@ -1075,7 +1138,7 @@ public class KwoTradeOrderService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//更新mongodb
|
|
//更新mongodb
|
|
|
- SckwTradeOrder updateParam = BeanUtils.copyProperties(param, SckwTradeOrder.class);
|
|
|
|
|
|
|
+ SckwTradeOrder updateParam = BeanUtil.copyProperties(param, SckwTradeOrder.class);
|
|
|
updateParam.setTOrderId(param.getId())
|
|
updateParam.setTOrderId(param.getId())
|
|
|
.setStatus(order.getStatus())
|
|
.setStatus(order.getStatus())
|
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
.setStartTime(DateUtils.localDateToDateStart(param.getStartTime()))
|
|
@@ -1264,12 +1327,12 @@ public class KwoTradeOrderService {
|
|
|
LambdaQueryWrapper<KwoTradeOrder> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwoTradeOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(KwoTradeOrder::getId, ids).ne(KwoTradeOrder::getStatus, 0).eq(KwoTradeOrder::getDelFlag, Global.NO);
|
|
wrapper.in(KwoTradeOrder::getId, ids).ne(KwoTradeOrder::getStatus, 0).eq(KwoTradeOrder::getDelFlag, Global.NO);
|
|
|
List<KwoTradeOrder> list = kwoTradeOrderMapper.selectList(wrapper);
|
|
List<KwoTradeOrder> list = kwoTradeOrderMapper.selectList(wrapper);
|
|
|
- if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
throw new BusinessException("删除操作仅针对“已保存”状态的订单");
|
|
throw new BusinessException("删除操作仅针对“已保存”状态的订单");
|
|
|
}
|
|
}
|
|
|
//排除草稿状态权限匹配
|
|
//排除草稿状态权限匹配
|
|
|
List<Long> filterIds = list.stream().filter(e -> !(Objects.equals(e.getStatus(), 0))).map(KwoTradeOrder::getId).toList();
|
|
List<Long> filterIds = list.stream().filter(e -> !(Objects.equals(e.getStatus(), 0))).map(KwoTradeOrder::getId).toList();
|
|
|
- if (CollectionUtils.isNotEmpty(filterIds) &&
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(filterIds) &&
|
|
|
kwoTradeOrderUnitService.entBatchMatch(filterIds, LoginUserHolder.getEntId(), String.valueOf(param.getOrderType()))) {
|
|
kwoTradeOrderUnitService.entBatchMatch(filterIds, LoginUserHolder.getEntId(), String.valueOf(param.getOrderType()))) {
|
|
|
throw new BusinessException("无订单操作权限!");
|
|
throw new BusinessException("无订单操作权限!");
|
|
|
}
|
|
}
|
|
@@ -1328,7 +1391,7 @@ public class KwoTradeOrderService {
|
|
|
wrapper.eq(KwoTradeOrder::getStatus, OrderStatusEnum.WAIT_SIGNED.getCode())
|
|
wrapper.eq(KwoTradeOrder::getStatus, OrderStatusEnum.WAIT_SIGNED.getCode())
|
|
|
.in(KwoTradeOrder::getId, tOrderIds).eq(KwoTradeOrder::getDelFlag, Global.NO);
|
|
.in(KwoTradeOrder::getId, tOrderIds).eq(KwoTradeOrder::getDelFlag, Global.NO);
|
|
|
List<KwoTradeOrder> list = kwoTradeOrderMapper.selectList(wrapper);
|
|
List<KwoTradeOrder> list = kwoTradeOrderMapper.selectList(wrapper);
|
|
|
- return CollectionUtils.emptyIfNull(list);
|
|
|
|
|
|
|
+ return CollUtil.emptyIfNull(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1390,7 +1453,7 @@ public class KwoTradeOrderService {
|
|
|
wrapper.in(KwoTradeOrder::getId, tOrderIds).eq(KwoTradeOrder::getDelFlag, Global.NO)
|
|
wrapper.in(KwoTradeOrder::getId, tOrderIds).eq(KwoTradeOrder::getDelFlag, Global.NO)
|
|
|
.in(KwoTradeOrder::getStatus, 1, 2, 3, 4);
|
|
.in(KwoTradeOrder::getStatus, 1, 2, 3, 4);
|
|
|
List<KwoTradeOrder> list = kwoTradeOrderMapper.selectList(wrapper);
|
|
List<KwoTradeOrder> list = kwoTradeOrderMapper.selectList(wrapper);
|
|
|
- return CollectionUtils.emptyIfNull(list);
|
|
|
|
|
|
|
+ return CollUtil.emptyIfNull(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1413,7 +1476,7 @@ public class KwoTradeOrderService {
|
|
|
*/
|
|
*/
|
|
|
public List<WbTOrderExcelStsResDTO> workbenchExcel(WbTOrderExcelStsReqDTO reqDTO) {
|
|
public List<WbTOrderExcelStsResDTO> workbenchExcel(WbTOrderExcelStsReqDTO reqDTO) {
|
|
|
List<WbTOrderExcelStsResDTO> list = kwoTradeOrderMapper.workbenchExcel(reqDTO);
|
|
List<WbTOrderExcelStsResDTO> list = kwoTradeOrderMapper.workbenchExcel(reqDTO);
|
|
|
- return CollectionUtils.emptyIfNull(list);
|
|
|
|
|
|
|
+ return CollUtil.emptyIfNull(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1431,27 +1494,27 @@ public class KwoTradeOrderService {
|
|
|
|
|
|
|
|
//商品辅助单位
|
|
//商品辅助单位
|
|
|
List<GoodsUnitDetailRes> assistUnit = kwoTradeOrderGoodsUnitService.findGoodsUnitDetail(tOrderId);
|
|
List<GoodsUnitDetailRes> assistUnit = kwoTradeOrderGoodsUnitService.findGoodsUnitDetail(tOrderId);
|
|
|
- if (CollectionUtils.isNotEmpty(assistUnit)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(assistUnit)) {
|
|
|
assistUnit.forEach(e -> {
|
|
assistUnit.forEach(e -> {
|
|
|
unitDetails.add(new GoodsUnitRes(e.getToUnit(), null, false));
|
|
unitDetails.add(new GoodsUnitRes(e.getToUnit(), null, false));
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//数据组装
|
|
//数据组装
|
|
|
- if (CollectionUtils.isNotEmpty(unitDetails)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(unitDetails)) {
|
|
|
//货物单位与合理损耗单位
|
|
//货物单位与合理损耗单位
|
|
|
List<SysDictResDto> dicts = remoteSystemService.queryDictByType(DictTypeEnum.UNIT_LOSS_TYPE.getType());
|
|
List<SysDictResDto> dicts = remoteSystemService.queryDictByType(DictTypeEnum.UNIT_LOSS_TYPE.getType());
|
|
|
//单位
|
|
//单位
|
|
|
Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.UNIT_TYPE.getType()));
|
|
Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.UNIT_TYPE.getType()));
|
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
Map<String, String> unitMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
- if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dict)) {
|
|
|
unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
|
|
unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
|
|
|
}
|
|
}
|
|
|
Map<String, String> finalUnitMap = unitMap;
|
|
Map<String, String> finalUnitMap = unitMap;
|
|
|
unitDetails.forEach(e -> {
|
|
unitDetails.forEach(e -> {
|
|
|
e.setLabel(finalUnitMap != null ? finalUnitMap.get(e.getValue()) : null);
|
|
e.setLabel(finalUnitMap != null ? finalUnitMap.get(e.getValue()) : null);
|
|
|
//组装合理损耗
|
|
//组装合理损耗
|
|
|
- if (CollectionUtils.isNotEmpty(dicts)) {
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dicts)) {
|
|
|
for (SysDictResDto ee : dicts)
|
|
for (SysDictResDto ee : dicts)
|
|
|
if (ee.getParentId().equals((long) NumberConstant.ZERO)) {
|
|
if (ee.getParentId().equals((long) NumberConstant.ZERO)) {
|
|
|
if (ee.getValue().equals(e.getValue())) {
|
|
if (ee.getValue().equals(e.getValue())) {
|
|
@@ -1475,9 +1538,9 @@ public class KwoTradeOrderService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @desc 根据id获取地址信息
|
|
|
|
|
* @param id
|
|
* @param id
|
|
|
* @return com.sckw.order.model.vo.res.OrderAddressInfoRes
|
|
* @return com.sckw.order.model.vo.res.OrderAddressInfoRes
|
|
|
|
|
+ * @desc 根据id获取地址信息
|
|
|
* @author yzc
|
|
* @author yzc
|
|
|
* @date 2024/3/5 15:50
|
|
* @date 2024/3/5 15:50
|
|
|
*/
|
|
*/
|
|
@@ -1503,4 +1566,43 @@ public class KwoTradeOrderService {
|
|
|
.setUnloadDetailAddressList(unloadDetailAddressList);
|
|
.setUnloadDetailAddressList(unloadDetailAddressList);
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public PageResult tradeOrderSelect(TradeOrderListSelectParam params) {
|
|
|
|
|
+ TradeOrderListSelectDTO dto = BeanUtil.copyProperties(params, TradeOrderListSelectDTO.class);
|
|
|
|
|
+ dto.setEntId(LoginUserHolder.getEntId())
|
|
|
|
|
+ .setUserId(LoginUserHolder.getUserId())
|
|
|
|
|
+ .setIsMain(LoginUserHolder.getIsMain())
|
|
|
|
|
+ .setAuthUserIdList(LoginUserHolder.getAuthUserIdList());
|
|
|
|
|
+ //装卸货地址
|
|
|
|
|
+ String loadCode = params.getShippingAddressCode();
|
|
|
|
|
+ if (StringUtils.isNotBlank(loadCode)) {
|
|
|
|
|
+ switch (params.getShippingAddressLevel()) {
|
|
|
|
|
+ case 1 -> dto.setLoadAddressCode(
|
|
|
|
|
+ loadCode.substring(0, 2).trim());
|
|
|
|
|
+ case 2 -> dto.setLoadAddressCode(
|
|
|
|
|
+ loadCode.substring(0, 4).trim());
|
|
|
|
|
+ case 3 -> dto.setLoadAddressCode(loadCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String unloadCode = params.getUnloadingAddressCode();
|
|
|
|
|
+ if (StringUtils.isNotBlank(unloadCode)) {
|
|
|
|
|
+ switch (params.getUnloadingAddressLevel()) {
|
|
|
|
|
+ case 1 -> dto.setUnloadAddressCode(
|
|
|
|
|
+ loadCode.substring(0, 2).trim());
|
|
|
|
|
+ case 2 -> dto.setUnloadAddressCode(
|
|
|
|
|
+ loadCode.substring(0, 4).trim());
|
|
|
|
|
+ case 3 -> dto.setUnloadAddressCode(loadCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String keywords = params.getKeywords();
|
|
|
|
|
+ if (StringUtils.isNotBlank(keywords)) {
|
|
|
|
|
+ List<Long> goodIds = goodsInfoService.selectIdsLikeGoodsName(keywords);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(goodIds)) {
|
|
|
|
|
+ dto.setGoodsIds(goodIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ PageHelper.startPage(params.getPage(), params.getPageSize());
|
|
|
|
|
+ List<OrderListResVO> result = kwoTradeOrderMapper.tradeOrderSelect(dto);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|