|
|
@@ -1,6 +1,7 @@
|
|
|
package com.sckw.transport.service;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
@@ -12,11 +13,10 @@ import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.core.utils.NumberUtils;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
-import com.sckw.transport.dao.KwtLogisticsOrderGoodsUnitMapper;
|
|
|
-import com.sckw.transport.dao.KwtWaybillOrderMapper;
|
|
|
-import com.sckw.transport.dao.KwtWaybillOrderTicketMapper;
|
|
|
+import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.dto.WaybillOrderTicketLoadingDto;
|
|
|
+import com.sckw.transport.model.vo.WaybillCountVo;
|
|
|
import com.sckw.transport.model.vo.WaybillOrderLoadingVO;
|
|
|
import com.sckw.transport.model.vo.WaybillTicketVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* @author zk
|
|
|
@@ -42,6 +43,10 @@ public class KwtWaybillOrderTicketService {
|
|
|
@Autowired
|
|
|
KwtLogisticsOrderGoodsUnitMapper goodsUnitMapper;
|
|
|
@Autowired
|
|
|
+ KwtLogisticsOrderAddressMapper logisticsOrderAddressMapper;
|
|
|
+ @Autowired
|
|
|
+ KwtWaybillOrderV1Mapper waybillOrderV1Mapper;
|
|
|
+ @Autowired
|
|
|
KwtWaybillOrderTicketMapper ticketMapper;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
RemoteSystemService remoteSystemService;
|
|
|
@@ -363,4 +368,43 @@ public class KwtWaybillOrderTicketService {
|
|
|
return loadLoading;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算地址下所有的地址
|
|
|
+ * @param lAddressId 地址ID
|
|
|
+ * @return 地址ID
|
|
|
+ */
|
|
|
+ public List<Long> getLAddressIds(Long lAddressId) {
|
|
|
+ LambdaQueryWrapper<KwtLogisticsOrderAddress> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(KwtLogisticsOrderAddress::getPAddressId, lAddressId);
|
|
|
+ wrapper.eq(KwtLogisticsOrderAddress::getDelFlag, Global.NO);
|
|
|
+ List<KwtLogisticsOrderAddress> list = logisticsOrderAddressMapper.selectList(wrapper);
|
|
|
+ List<Long> lAddressIds = list.stream().map(KwtLogisticsOrderAddress::getId).toList();
|
|
|
+ if (CollectionUtils.isNotEmpty(lAddressIds)) {
|
|
|
+ for (Long lAddressId1:lAddressIds) {
|
|
|
+ List<Long> lAddressIds1 = getLAddressIds(lAddressId1);
|
|
|
+ if (CollectionUtils.isNotEmpty(lAddressIds1)) {
|
|
|
+ lAddressIds.addAll(lAddressIds1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return lAddressIds;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算地址下所有的运单榜单上的运量
|
|
|
+ * @param lAddressId 地址ID
|
|
|
+ * @return 运载量
|
|
|
+ */
|
|
|
+ public BigDecimal getAmount(Long lAddressId, String unit, int type) {
|
|
|
+ List<Long> lAddressIds = new ArrayList<>(){{add(lAddressId);}};
|
|
|
+ lAddressIds.addAll(getLAddressIds(lAddressId));
|
|
|
+ Map<String, Object> queryParams = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
+ queryParams.put("lAddressIds", lAddressIds);
|
|
|
+ queryParams.put("unit", unit);
|
|
|
+ queryParams.put("type", type);
|
|
|
+ queryParams.put("passStatus", Global.NUMERICAL_ONE);
|
|
|
+ WaybillCountVo loadCount = waybillOrderV1Mapper.findTicketAmountByAddress(queryParams);
|
|
|
+ return loadCount.getAmount();
|
|
|
+ }
|
|
|
+
|
|
|
}
|