|
|
@@ -703,11 +703,17 @@ public class KwoTradeOrderService {
|
|
|
OrderDetailRes detail = BeanUtil.copyProperties(order, OrderDetailRes.class);
|
|
|
UserCacheResDto createUser = remoteSystemService.queryUserCacheById(detail.getCreateBy());
|
|
|
EntCacheResDto ent = remoteSystemService.queryEntCacheById(detail.getEntId());
|
|
|
+ String trading = order.getTrading();
|
|
|
+ if (StrUtil.equals(trading, "1")) {
|
|
|
+ detail.setPayWayLabel("线上支付");
|
|
|
+ } else {
|
|
|
+ detail.setPayWayLabel("线下支付");
|
|
|
+ }
|
|
|
detail.setFirmName(Objects.isNull(ent) ? null : ent.getFirmName()).setCreateByName(Objects.isNull(createUser) ? null : createUser.getName()).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).setChargeTypeLabel(CollUtil.isNotEmpty(chargeTypeMap) ? chargeTypeMap.get(String.valueOf(detail.getChargeType())) : null).setConsignmentWayLabel(CollUtil.isNotEmpty(consignmentWayMap) ? consignmentWayMap.get(String.valueOf(detail.getConsignmentWay())) : null);
|
|
|
if (Objects.equals(detail.getChargeType(), 1)) {//按装货量
|
|
|
- detail.setDealAmount(detail.getLoadAmount());
|
|
|
+ detail.setActualAmount(detail.getLoadAmount());
|
|
|
} else {
|
|
|
- detail.setDealAmount(detail.getUnloadAmount());
|
|
|
+ detail.setActualAmount(detail.getUnloadAmount());
|
|
|
}
|
|
|
//商品信息
|
|
|
KwoTradeOrderGoods orderGoods = kwoTradeOrderGoodsService.getByOrderId(id);
|
|
|
@@ -724,16 +730,6 @@ public class KwoTradeOrderService {
|
|
|
detail.setDealMoney(NumberUtil.mul(orderGoods.getUnitPrice(), detail.getUnloadAmount()));
|
|
|
}
|
|
|
|
|
|
- //商品辅助单位信息
|
|
|
-// List<GoodsUnitDetailRes> assistUnit = kwoTradeOrderGoodsUnitService.findGoodsUnitDetail(id);
|
|
|
-// if (CollUtil.isNotEmpty(assistUnit)) {
|
|
|
-// Map<String, String> finalUnitMap = unitMap;
|
|
|
-// assistUnit.forEach(e -> {
|
|
|
-// e.setFromUnitName(CollUtil.isNotEmpty(finalUnitMap) ? finalUnitMap.get(e.getFromUnit()) : null);
|
|
|
-// e.setToUnitName(CollUtil.isNotEmpty(finalUnitMap) ? finalUnitMap.get(e.getToUnit()) : null);
|
|
|
-// });
|
|
|
-// }
|
|
|
-// detail.setAssistUnit(assistUnit);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1570,19 +1566,22 @@ public class KwoTradeOrderService {
|
|
|
Map<Long, UserCacheResDto> userMap = remoteSystemService.queryUserCacheMapByIds(createByIds);
|
|
|
Map<Long, KwpGoods> goodsMap = goodsInfoService.getGoodsByIds(goodIdList);
|
|
|
Map<Long, ContractCommonInfoResDto> contractMap = remoteContractService.queryContractBaseInfo(contracIdList);
|
|
|
- Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.TORDER_STATUS.getType(), DictTypeEnum.TRADE_TYPE.getType(), DictTypeEnum.SETTLEMENT_WAY.getType(), DictTypeEnum.CONSIGNMENT_WAY.getType(), DictTypeEnum.TORDER_SOURCE.getType()));
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.TORDER_STATUS.getType(), DictTypeEnum.TRADE_TYPE.getType(), DictTypeEnum.LOAD_UNLOAD_WAY.getType(), DictTypeEnum.SETTLEMENT_WAY.getType(), DictTypeEnum.CONSIGNMENT_WAY.getType(), DictTypeEnum.TORDER_SOURCE.getType()));
|
|
|
Map<String, SysDictResDto> unitType = remoteSystemService.queryDictMapByType(DictTypeEnum.UNIT_TYPE.getType());
|
|
|
- Map<String, String> tradeMap, deliveryMap, pickupMap, sourceMap;
|
|
|
+ Map<String, String> tradeMap, deliveryMap, pickupMap, sourceMap, unloadMap;
|
|
|
if (CollUtil.isNotEmpty(dict)) {
|
|
|
tradeMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ? dict.get(DictTypeEnum.TRADE_TYPE.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
deliveryMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.SETTLEMENT_WAY.getType())) ? dict.get(DictTypeEnum.SETTLEMENT_WAY.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
pickupMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.CONSIGNMENT_WAY.getType())) ? dict.get(DictTypeEnum.CONSIGNMENT_WAY.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
sourceMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.TORDER_SOURCE.getType())) ? dict.get(DictTypeEnum.TORDER_SOURCE.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
+ unloadMap = CollUtil.isNotEmpty(dict.get(DictTypeEnum.LOAD_UNLOAD_WAY.getType())) ? dict.get(DictTypeEnum.LOAD_UNLOAD_WAY.getType()) : new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
+
|
|
|
} else {
|
|
|
tradeMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
deliveryMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
pickupMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
sourceMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
+ unloadMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
}
|
|
|
|
|
|
list.forEach(e -> {
|
|
|
@@ -1601,31 +1600,8 @@ public class KwoTradeOrderService {
|
|
|
UserCacheResDto userCache = userMap.get(e.getCreateBy());
|
|
|
|
|
|
OrderListResVO vo = BeanUtil.copyProperties(e, OrderListResVO.class);
|
|
|
- vo.setStatusLabel(TradeOrderStatusEnum.getMsg(e.getStatus()))
|
|
|
- .setTradingLabel(tradeMap.get(e.getTrading()))
|
|
|
- .setTrading(tradeMap.get(e.getTrading()))
|
|
|
- .setDeliveryTypeLabel(deliveryMap.get(e.getDeliveryType()))
|
|
|
- .setDeliveryType(deliveryMap.get(e.getDeliveryType()))
|
|
|
- .setPickupTypeLabel(pickupMap.get(e.getPickupType()))
|
|
|
- .setSourceLabel(sourceMap.get(e.getSource()))
|
|
|
- .setSource(sourceMap.get(e.getSource()))
|
|
|
- .setContractName(Objects.isNull(contract) ? null : contract.getContactName())
|
|
|
- .setContractSigningWay(Objects.isNull(contract) ? null : contract.getSigningWayName())
|
|
|
- .setGoodsName(Objects.isNull(goods) ? null : goods.getName())
|
|
|
- .setGoodsSpec(Objects.isNull(goods) ? null : goods.getSpec())
|
|
|
- .setGoodsTaxRate(Objects.isNull(goods) ? null : goods.getTaxRate())
|
|
|
- .setGoodsThumb(Objects.isNull(goods) ? null : goods.getThumb())
|
|
|
- .setWaitEntrustAmount(setScale(getWaitEntrustAmount(e.getAmount(), e.getEntrustAmount())))
|
|
|
- .setActualPrice(actualAmount.multiply(unitPrice).setScale(2, RoundingMode.HALF_UP))
|
|
|
- .setUnitPrice(setScale(e.getUnitPrice()))
|
|
|
- .setPrice(setScale(e.getPrice()))
|
|
|
- .setUnit(e.getUnit())
|
|
|
- .setUnitLabel(unitType == null ? e.getUnit() : (unitType.get(e.getUnit()) == null ? e.getUnit() : unitType.get(e.getUnit()).getLabel()))
|
|
|
- .setAmount(setScale(vo.getAmount()))
|
|
|
- .setEntrustAmount(setScale(e.getEntrustAmount()))
|
|
|
- .setActualAmount(setScale(e.getActualAmount()))
|
|
|
- .setCreateByName(Objects.isNull(userCache) ? null : userCache.getName())
|
|
|
- ;
|
|
|
+ vo.setStatusLabel(TradeOrderStatusEnum.getMsg(e.getStatus())).setTradingLabel(tradeMap.get(e.getTrading())).setTrading(tradeMap.get(e.getTrading())).setDeliveryTypeLabel(deliveryMap.get(e.getDeliveryType())).setDeliveryType(deliveryMap.get(e.getDeliveryType())).setPickupTypeLabel(pickupMap.get(e.getPickupType())).setSourceLabel(sourceMap.get(e.getSource())).setSource(sourceMap.get(e.getSource())).setContractName(Objects.isNull(contract) ? null : contract.getContactName()).setContractSigningWay(Objects.isNull(contract) ? null : contract.getSigningWayName()).setGoodsName(Objects.isNull(goods) ? null : goods.getName()).setGoodsSpec(Objects.isNull(goods) ? null : goods.getSpec()).setGoodsTaxRate(Objects.isNull(goods) ? null : goods.getTaxRate()).setGoodsThumb(Objects.isNull(goods) ? null : goods.getThumb()).setWaitEntrustAmount(setScale(getWaitEntrustAmount(e.getAmount(), e.getEntrustAmount()))).setActualPrice(actualAmount.multiply(unitPrice).setScale(2, RoundingMode.HALF_UP)).setUnitPrice(setScale(e.getUnitPrice())).setPrice(setScale(e.getPrice())).setUnit(e.getUnit()).setUnitLabel(unitType == null ? e.getUnit() : (unitType.get(e.getUnit()) == null ? e.getUnit() : unitType.get(e.getUnit()).getLabel())).setAmount(setScale(vo.getAmount())).setEntrustAmount(setScale(e.getEntrustAmount())).setActualAmount(setScale(e.getActualAmount())).setCreateByName(Objects.isNull(userCache) ? null : userCache.getName());
|
|
|
+ vo.setDeliveryTypeLabel(unloadMap.getOrDefault(String.valueOf(e.getChargeType()), "-"));
|
|
|
loadAddress.ifPresent(d -> {
|
|
|
vo.setLoadName(d.getName());
|
|
|
vo.setLoadAddress(d.getCityName() + " " + d.getDetailAddress());
|
|
|
@@ -1652,11 +1628,7 @@ public class KwoTradeOrderService {
|
|
|
public TradeOrderListSelectDTO buildSelectParam(TradeOrderListStatisticParam params) {
|
|
|
TradeOrderListSelectDTO dto = BeanUtil.copyProperties(params, TradeOrderListSelectDTO.class);
|
|
|
EntTypeResDto entTypeResDto = remoteSystemService.queryEntTypeById(LoginUserHolder.getEntId());
|
|
|
- dto.setEntId(LoginUserHolder.getEntId())
|
|
|
- .setManager(LoginUserHolder.isManager())
|
|
|
- .setEntType(Objects.nonNull(entTypeResDto) ? entTypeResDto.getType() : null)
|
|
|
- .setEntList(LoginUserHolder.getChildEntList())
|
|
|
- .setIsMain(LoginUserHolder.getIsMain());
|
|
|
+ dto.setEntId(LoginUserHolder.getEntId()).setManager(LoginUserHolder.isManager()).setEntType(Objects.nonNull(entTypeResDto) ? entTypeResDto.getType() : null).setEntList(LoginUserHolder.getChildEntList()).setIsMain(LoginUserHolder.getIsMain());
|
|
|
//装卸货地址
|
|
|
String loadCode = params.getShippingAddressCode();
|
|
|
if (StringUtils.isNotBlank(loadCode) && Objects.nonNull(params.getShippingAddressLevel())) {
|
|
|
@@ -2038,8 +2010,7 @@ public class KwoTradeOrderService {
|
|
|
unitList.forEach(e -> {
|
|
|
KwoTradeOrderUnit unit = BeanUtil.copyProperties(e, KwoTradeOrderUnit.class);
|
|
|
unit.setId(new IdWorker(1).nextId());
|
|
|
- unit.setTOrderId(order.getId())
|
|
|
- .setTOrderNo(order.getTOrderNo()).setTopEntId(e.getEntId());
|
|
|
+ unit.setTOrderId(order.getId()).setTOrderNo(order.getTOrderNo()).setTopEntId(e.getEntId());
|
|
|
unit.setUnitType(StrUtil.equals(e.getUnitType(), "1") ? "2" : "1");//贸易合同和订单的单位类型相反
|
|
|
list.add(unit);
|
|
|
});
|
|
|
@@ -2072,12 +2043,14 @@ public class KwoTradeOrderService {
|
|
|
throw new BusinessException("当前贸易订单不存在交易商品");
|
|
|
}
|
|
|
order.setUnit(goodsInfoDto.getUnit());
|
|
|
- order.setPrice(goodsInfoDto.getPrice());
|
|
|
- order.setTrading(String.valueOf(tradeContractResDto.getTrading()));
|
|
|
order.setPickupType(String.valueOf(tradeContractResDto.getConsignment()));//来源于合同约束的托运方式
|
|
|
order.setDeliveryType("");
|
|
|
+ order.setTrading(String.valueOf(tradeContractResDto.getSigningWay()));//签约方式
|
|
|
+ order.setPrice(NumberUtil.mul(tradeOrderParam.getAmount(), goodsInfoDto.getPrice()));//总金额
|
|
|
order.setActualAmount(new BigDecimal("0"));
|
|
|
order.setAssociateStatement(0);
|
|
|
+ order.setLoadAmount(new BigDecimal("0"));
|
|
|
+ order.setUnloadAmount(new BigDecimal("0"));
|
|
|
order.setChargeType(tradeContractResDto.getUnloadWay());
|
|
|
order.setConsignmentWay(tradeContractResDto.getConsignment());
|
|
|
order.setEntId(LoginUserHolder.getEntId()).setTOrderNo(getOrderNo()).setAmount(tradeOrderParam.getAmount()).setStartTime(DateUtils.localDateToDateStart(tradeOrderParam.getStartTime())).setEndTime(DateUtils.localDateToDateEnd(tradeOrderParam.getEndTime())).setSource(OrderSourceEnum.PURCHASE.getType()).setStatus(TradeOrderStatusEnum.AUDIT.getCode()).setRemark(tradeOrderParam.getRemark());
|