|
@@ -1,7 +1,9 @@
|
|
|
package com.sckw.transport.dubbo;
|
|
package com.sckw.transport.dubbo;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
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;
|
|
@@ -49,31 +51,39 @@ import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.*;
|
|
import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.dto.AddLogisticOrderDTO;
|
|
import com.sckw.transport.model.dto.AddLogisticOrderDTO;
|
|
|
import com.sckw.transport.model.dto.LogisticData;
|
|
import com.sckw.transport.model.dto.LogisticData;
|
|
|
|
|
+import com.sckw.transport.model.dto.WaybillOrderRequest;
|
|
|
|
|
+import com.sckw.transport.model.param.QueryLogisticsOrderReq;
|
|
|
|
|
+import com.sckw.transport.model.param.WaybillOrderReq;
|
|
|
import com.sckw.transport.model.vo.OrderFinishReq;
|
|
import com.sckw.transport.model.vo.OrderFinishReq;
|
|
|
|
|
+import com.sckw.transport.model.vo.OrderStatusStatisticsResp;
|
|
|
|
|
+import com.sckw.transport.model.vo.StatisticsWaybillResp;
|
|
|
|
|
+import com.sckw.transport.model.vo.WaybillOrderDetailResp;
|
|
|
import com.sckw.transport.repository.*;
|
|
import com.sckw.transport.repository.*;
|
|
|
import com.sckw.transport.service.KwtAcceptCarriageOrderService;
|
|
import com.sckw.transport.service.KwtAcceptCarriageOrderService;
|
|
|
import com.sckw.transport.service.KwtCommonService;
|
|
import com.sckw.transport.service.KwtCommonService;
|
|
|
import com.sckw.transport.service.KwtLogisticsConsignmentService;
|
|
import com.sckw.transport.service.KwtLogisticsConsignmentService;
|
|
|
|
|
+import com.sckw.transport.service.KwtWaybillOrderV1Service;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import jodd.util.StringUtil;
|
|
import jodd.util.StringUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
-import org.checkerframework.checker.units.qual.C;
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cloud.stream.function.StreamBridge;
|
|
import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author lfdc
|
|
* @author lfdc
|
|
@@ -121,6 +131,9 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private KwtWaybillOrderV1Mapper waybillOrderV1Mapper;
|
|
private KwtWaybillOrderV1Mapper waybillOrderV1Mapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private KwtWaybillOrderMapper kwtWaybillOrderMapper;
|
|
|
|
|
+ private final RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private KwtWaybillOrderSubtaskMapper waybillOrderSubtaskMapper;
|
|
private KwtWaybillOrderSubtaskMapper waybillOrderSubtaskMapper;
|
|
@@ -142,6 +155,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
private final KwtLogisticsConsignmentService logisticsConsignmentService;
|
|
private final KwtLogisticsConsignmentService logisticsConsignmentService;
|
|
|
private final KwtLogisticsOrderGoodsRepository logisticsOrderGoodsRepository;
|
|
private final KwtLogisticsOrderGoodsRepository logisticsOrderGoodsRepository;
|
|
|
private final KwtLogisticsOrderAddressRepository logisticsOrderAddressRepository;
|
|
private final KwtLogisticsOrderAddressRepository logisticsOrderAddressRepository;
|
|
|
|
|
+ private final KwtWaybillOrderV1Service waybillOrderV1Service;
|
|
|
|
|
|
|
|
// 定义禁止关联车辆删除的状态集合
|
|
// 定义禁止关联车辆删除的状态集合
|
|
|
private static final List<Integer> FORBIDDEN_STATUSES = Arrays.asList(
|
|
private static final List<Integer> FORBIDDEN_STATUSES = Arrays.asList(
|
|
@@ -152,6 +166,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
CarWaybillV1Enum.WAIT_LOADING.getCode(),
|
|
CarWaybillV1Enum.WAIT_LOADING.getCode(),
|
|
|
CarWaybillV1Enum.REVIEW_REJECTION.getCode()
|
|
CarWaybillV1Enum.REVIEW_REJECTION.getCode()
|
|
|
);
|
|
);
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 对账管理-ids查询
|
|
* 对账管理-ids查询
|
|
|
*
|
|
*
|
|
@@ -845,29 +860,29 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<RWaybillOrderVo> queryWaybillOrderByEntId(Long entId) {
|
|
public List<RWaybillOrderVo> queryWaybillOrderByEntId(Long entId) {
|
|
|
- List<KwtWaybillOrder> waybillOrders = waybillOrderRepository.queryWaybillOrderByEntId(entId);
|
|
|
|
|
- if (CollectionUtils.isEmpty(waybillOrders)){
|
|
|
|
|
|
|
+ List<KwtWaybillOrder> waybillOrders = waybillOrderRepository.queryWaybillOrderByEntId(entId);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(waybillOrders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
- return waybillOrders.stream()
|
|
|
|
|
- .map(TransportServiceImpl::getWaybillOrderVo)
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
|
+ return waybillOrders.stream()
|
|
|
|
|
+ .map(TransportServiceImpl::getWaybillOrderVo)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<RTransportEntVo> queryTransportEnt(Set<Long> tradeOrderIds) {
|
|
public List<RTransportEntVo> queryTransportEnt(Set<Long> tradeOrderIds) {
|
|
|
List<KwtLogisticsOrder> logisticsOrders = logisticsOrderRepository.queryByTradeOrderIds(tradeOrderIds);
|
|
List<KwtLogisticsOrder> logisticsOrders = logisticsOrderRepository.queryByTradeOrderIds(tradeOrderIds);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(logisticsOrders)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(logisticsOrders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
List<Long> logIds = logisticsOrders.stream()
|
|
List<Long> logIds = logisticsOrders.stream()
|
|
|
.map(KwtLogisticsOrder::getId)
|
|
.map(KwtLogisticsOrder::getId)
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
List<KwtLogisticsOrderUnit> units = logisticsOrderUnitRepository.queryByLogOrderIds(logIds);
|
|
List<KwtLogisticsOrderUnit> units = logisticsOrderUnitRepository.queryByLogOrderIds(logIds);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(units)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(units)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
- return units.stream().map(unit -> {
|
|
|
|
|
|
|
+ return units.stream().map(unit -> {
|
|
|
RTransportEntVo rTransportEntVo = new RTransportEntVo();
|
|
RTransportEntVo rTransportEntVo = new RTransportEntVo();
|
|
|
rTransportEntVo.setTransportEntType(unit.getUnitType());
|
|
rTransportEntVo.setTransportEntType(unit.getUnitType());
|
|
|
rTransportEntVo.setTransportEntId(unit.getEntId());
|
|
rTransportEntVo.setTransportEntId(unit.getEntId());
|
|
@@ -879,20 +894,20 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<RWaybillSubOrderVo> queryWaybillOrderByTradeOrderIds(Set<Long> tradeOrderIds) {
|
|
public List<RWaybillSubOrderVo> queryWaybillOrderByTradeOrderIds(Set<Long> tradeOrderIds) {
|
|
|
List<KwtLogisticsOrder> logisticsOrders = logisticsOrderRepository.queryByTradeOrderIds(tradeOrderIds);
|
|
List<KwtLogisticsOrder> logisticsOrders = logisticsOrderRepository.queryByTradeOrderIds(tradeOrderIds);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(logisticsOrders)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(logisticsOrders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
List<Long> logIds = logisticsOrders.stream()
|
|
List<Long> logIds = logisticsOrders.stream()
|
|
|
.map(KwtLogisticsOrder::getId)
|
|
.map(KwtLogisticsOrder::getId)
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
List<KwtWaybillOrderSubtask> subtasks = waybillOrderSubtaskRepository.queryByLogIds(logIds);
|
|
List<KwtWaybillOrderSubtask> subtasks = waybillOrderSubtaskRepository.queryByLogIds(logIds);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(subtasks)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(subtasks)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
//查询物流订单和的商品关系
|
|
//查询物流订单和的商品关系
|
|
|
List<KwtLogisticsOrderGoods> logOrderGoods = logisticsOrderGoodsRepository.queryByLogIds(logIds);
|
|
List<KwtLogisticsOrderGoods> logOrderGoods = logisticsOrderGoodsRepository.queryByLogIds(logIds);
|
|
|
Map<Long, KwtLogisticsOrderGoods> logisticsOrderGoodsMap = Maps.newHashMap();
|
|
Map<Long, KwtLogisticsOrderGoods> logisticsOrderGoodsMap = Maps.newHashMap();
|
|
|
- if (CollectionUtils.isNotEmpty(logOrderGoods)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(logOrderGoods)) {
|
|
|
logisticsOrderGoodsMap = logOrderGoods.stream()
|
|
logisticsOrderGoodsMap = logOrderGoods.stream()
|
|
|
.collect(Collectors.toMap(KwtLogisticsOrderGoods::getLOrderId, Function.identity(), (x, y) -> x));
|
|
.collect(Collectors.toMap(KwtLogisticsOrderGoods::getLOrderId, Function.identity(), (x, y) -> x));
|
|
|
}
|
|
}
|
|
@@ -909,7 +924,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
List<RWaybillSubOrderVo.BillSubOrder> subOrdersList = Lists.newArrayList();
|
|
List<RWaybillSubOrderVo.BillSubOrder> subOrdersList = Lists.newArrayList();
|
|
|
List<RWaybillSubOrderVo.LogisticGoodsInfo> goodsInfos = Lists.newArrayList();
|
|
List<RWaybillSubOrderVo.LogisticGoodsInfo> goodsInfos = Lists.newArrayList();
|
|
|
logisticsOrderList.forEach(l -> {
|
|
logisticsOrderList.forEach(l -> {
|
|
|
- KwtLogisticsOrderGoods goods = finalLogisticsOrderGoodsMap.getOrDefault(l.getId(),new KwtLogisticsOrderGoods());
|
|
|
|
|
|
|
+ KwtLogisticsOrderGoods goods = finalLogisticsOrderGoodsMap.getOrDefault(l.getId(), new KwtLogisticsOrderGoods());
|
|
|
RWaybillSubOrderVo.LogisticGoodsInfo logisticGoodsInfo = new RWaybillSubOrderVo.LogisticGoodsInfo();
|
|
RWaybillSubOrderVo.LogisticGoodsInfo logisticGoodsInfo = new RWaybillSubOrderVo.LogisticGoodsInfo();
|
|
|
logisticGoodsInfo.setLOrderId(l.getId());
|
|
logisticGoodsInfo.setLOrderId(l.getId());
|
|
|
logisticGoodsInfo.setGoodsId(goods.getGoodsId());
|
|
logisticGoodsInfo.setGoodsId(goods.getGoodsId());
|
|
@@ -917,7 +932,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
List<KwtWaybillOrderSubtask> waybillOrderSubtasks = logIdAndSubtasksMap.get(l.getId());
|
|
List<KwtWaybillOrderSubtask> waybillOrderSubtasks = logIdAndSubtasksMap.get(l.getId());
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(waybillOrderSubtasks)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(waybillOrderSubtasks)) {
|
|
|
List<RWaybillSubOrderVo.BillSubOrder> collect = waybillOrderSubtasks.stream()
|
|
List<RWaybillSubOrderVo.BillSubOrder> collect = waybillOrderSubtasks.stream()
|
|
|
- .map(x -> getRWaybillSubOrderVo(x, goods.getGoodsId(),null))
|
|
|
|
|
|
|
+ .map(x -> getRWaybillSubOrderVo(x, goods.getGoodsId(), null))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
subOrdersList.addAll(collect);
|
|
subOrdersList.addAll(collect);
|
|
|
}
|
|
}
|
|
@@ -934,7 +949,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
public List<LogisticContractVo> queryLogisticContractByTradeId(Long tradeId) {
|
|
public List<LogisticContractVo> queryLogisticContractByTradeId(Long tradeId) {
|
|
|
//查询物流id
|
|
//查询物流id
|
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByTradeOrderId(tradeId);
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByTradeOrderId(tradeId);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwtLogisticsOrders)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwtLogisticsOrders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
//获取物流订单
|
|
//获取物流订单
|
|
@@ -943,21 +958,21 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|
|
|
//根据物流订单id获取物流合同
|
|
//根据物流订单id获取物流合同
|
|
|
List<KwtLogisticsOrderContract> contracts = logisticsOrderContractRepository.queryByLogOrderIds(logOrderIds);
|
|
List<KwtLogisticsOrderContract> contracts = logisticsOrderContractRepository.queryByLogOrderIds(logOrderIds);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(contracts)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(contracts)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
//获取物流合同id
|
|
//获取物流合同id
|
|
|
- return contracts.stream().map(c->{
|
|
|
|
|
- LogisticContractVo logisticContractVo = new LogisticContractVo();
|
|
|
|
|
- logisticContractVo.setLogContractId(c.getContractId());
|
|
|
|
|
- return logisticContractVo;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
|
|
+ return contracts.stream().map(c -> {
|
|
|
|
|
+ LogisticContractVo logisticContractVo = new LogisticContractVo();
|
|
|
|
|
+ logisticContractVo.setLogContractId(c.getContractId());
|
|
|
|
|
+ return logisticContractVo;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<RTransportEntVo> queryTransportEntByTradeOrderId(Long tradeId) {
|
|
public List<RTransportEntVo> queryTransportEntByTradeOrderId(Long tradeId) {
|
|
|
List<KwtLogisticsOrder> logisticsOrders = logisticsOrderRepository.queryByTradeOrderId(tradeId);
|
|
List<KwtLogisticsOrder> logisticsOrders = logisticsOrderRepository.queryByTradeOrderId(tradeId);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(logisticsOrders)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(logisticsOrders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
List<Long> logIds = logisticsOrders.stream()
|
|
List<Long> logIds = logisticsOrders.stream()
|
|
@@ -966,10 +981,10 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
//物流订单映射物流信息
|
|
//物流订单映射物流信息
|
|
|
Map<Long, KwtLogisticsOrder> logIdAndLogisticsOrderMap =
|
|
Map<Long, KwtLogisticsOrder> logIdAndLogisticsOrderMap =
|
|
|
logisticsOrders.stream().collect(Collectors.toMap(KwtLogisticsOrder::getId,
|
|
logisticsOrders.stream().collect(Collectors.toMap(KwtLogisticsOrder::getId,
|
|
|
- Function.identity(),
|
|
|
|
|
- (e1, e2) -> e1));
|
|
|
|
|
|
|
+ Function.identity(),
|
|
|
|
|
+ (e1, e2) -> e1));
|
|
|
List<KwtLogisticsOrderUnit> units = logisticsOrderUnitRepository.queryByLogOrderIds(logIds);
|
|
List<KwtLogisticsOrderUnit> units = logisticsOrderUnitRepository.queryByLogOrderIds(logIds);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(units)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(units)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -989,7 +1004,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<KwtLogisticsOrderVO> queryLogisticOrderByTradeId(Long tradeId) {
|
|
public List<KwtLogisticsOrderVO> queryLogisticOrderByTradeId(Long tradeId) {
|
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByTradeOrderId(tradeId);
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByTradeOrderId(tradeId);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwtLogisticsOrders)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwtLogisticsOrders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
return kwtLogisticsOrders.stream()
|
|
return kwtLogisticsOrders.stream()
|
|
@@ -1002,7 +1017,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
public List<KwtLogisticsOrderVO> queryTransportEntByEntId(Long entId) {
|
|
public List<KwtLogisticsOrderVO> queryTransportEntByEntId(Long entId) {
|
|
|
//通过承运单位查询物流订单
|
|
//通过承运单位查询物流订单
|
|
|
List<KwtLogisticsOrderUnit> unitList = logisticsOrderUnitRepository.queryByEntId(entId);
|
|
List<KwtLogisticsOrderUnit> unitList = logisticsOrderUnitRepository.queryByEntId(entId);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(unitList)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(unitList)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
// 物流订单号
|
|
// 物流订单号
|
|
@@ -1011,10 +1026,10 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|
|
|
//通过物流订单号查询物流订单
|
|
//通过物流订单号查询物流订单
|
|
|
List<KwtLogisticsOrder> logOrders = logisticsOrderRepository.queryByLogOrderIds(logOrderIds);
|
|
List<KwtLogisticsOrder> logOrders = logisticsOrderRepository.queryByLogOrderIds(logOrderIds);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(logOrders)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(logOrders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
- return logOrders.stream()
|
|
|
|
|
|
|
+ return logOrders.stream()
|
|
|
.map(TransportServiceImpl::getLogisticsOrderVo)
|
|
.map(TransportServiceImpl::getLogisticsOrderVo)
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
@@ -1038,10 +1053,10 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
kwtLogisticsOrderVO.setLossUnit(logOrder.getLossUnit());
|
|
kwtLogisticsOrderVO.setLossUnit(logOrder.getLossUnit());
|
|
|
kwtLogisticsOrderVO.setGoodsPrice(logOrder.getGoodsPrice());
|
|
kwtLogisticsOrderVO.setGoodsPrice(logOrder.getGoodsPrice());
|
|
|
kwtLogisticsOrderVO.setGoodsPriceUnit(logOrder.getGoodsPriceUnit());
|
|
kwtLogisticsOrderVO.setGoodsPriceUnit(logOrder.getGoodsPriceUnit());
|
|
|
- if (logOrder.getStartTime() != null){
|
|
|
|
|
|
|
+ if (logOrder.getStartTime() != null) {
|
|
|
kwtLogisticsOrderVO.setStartTime(Date.from(logOrder.getStartTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
kwtLogisticsOrderVO.setStartTime(Date.from(logOrder.getStartTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
}
|
|
}
|
|
|
- if (logOrder.getEndTime() != null){
|
|
|
|
|
|
|
+ if (logOrder.getEndTime() != null) {
|
|
|
kwtLogisticsOrderVO.setEntTime(Date.from(logOrder.getEndTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
kwtLogisticsOrderVO.setEntTime(Date.from(logOrder.getEndTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
}
|
|
}
|
|
|
kwtLogisticsOrderVO.setSubcontractAmount(logOrder.getSubcontractAmount());
|
|
kwtLogisticsOrderVO.setSubcontractAmount(logOrder.getSubcontractAmount());
|
|
@@ -1064,7 +1079,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
|
- private static RWaybillSubOrderVo.BillSubOrder getRWaybillSubOrderVo(KwtWaybillOrderSubtask subtask,Long goodsId,KwtLogisticsOrder logisticsOrder) {
|
|
|
|
|
|
|
+ private static RWaybillSubOrderVo.BillSubOrder getRWaybillSubOrderVo(KwtWaybillOrderSubtask subtask, Long goodsId, KwtLogisticsOrder logisticsOrder) {
|
|
|
RWaybillSubOrderVo.BillSubOrder billSubOrder = new RWaybillSubOrderVo.BillSubOrder();
|
|
RWaybillSubOrderVo.BillSubOrder billSubOrder = new RWaybillSubOrderVo.BillSubOrder();
|
|
|
billSubOrder.setEntId(subtask.getEntId());
|
|
billSubOrder.setEntId(subtask.getEntId());
|
|
|
billSubOrder.setLOrderId(subtask.getLOrderId());
|
|
billSubOrder.setLOrderId(subtask.getLOrderId());
|
|
@@ -1109,6 +1124,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询物流订单已派运力车辆
|
|
* 查询物流订单已派运力车辆
|
|
|
|
|
+ *
|
|
|
* @param param
|
|
* @param param
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
@@ -1116,8 +1132,8 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
log.info("查询物流订单已派运力车辆:{}", com.alibaba.fastjson.JSON.toJSONString(param));
|
|
log.info("查询物流订单已派运力车辆:{}", com.alibaba.fastjson.JSON.toJSONString(param));
|
|
|
LambdaQueryWrapper<KwtLogisticsOrderCirculate> queryWrapper = Wrappers.<KwtLogisticsOrderCirculate>lambdaQuery()
|
|
LambdaQueryWrapper<KwtLogisticsOrderCirculate> queryWrapper = Wrappers.<KwtLogisticsOrderCirculate>lambdaQuery()
|
|
|
.in(KwtLogisticsOrderCirculate::getEntId, param.getEntId())
|
|
.in(KwtLogisticsOrderCirculate::getEntId, param.getEntId())
|
|
|
- .eq(KwtLogisticsOrderCirculate::getDelFlag,0)
|
|
|
|
|
- .eq(KwtLogisticsOrderCirculate::getTruckNo,param.getTruckNo())
|
|
|
|
|
|
|
+ .eq(KwtLogisticsOrderCirculate::getDelFlag, 0)
|
|
|
|
|
+ .eq(KwtLogisticsOrderCirculate::getTruckNo, param.getTruckNo())
|
|
|
.orderByDesc(KwtLogisticsOrderCirculate::getCreateTime)
|
|
.orderByDesc(KwtLogisticsOrderCirculate::getCreateTime)
|
|
|
.orderByAsc(KwtLogisticsOrderCirculate::getId);
|
|
.orderByAsc(KwtLogisticsOrderCirculate::getId);
|
|
|
//TODO 是否考虑订单状态
|
|
//TODO 是否考虑订单状态
|
|
@@ -1143,14 +1159,15 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询物流订单已派运力车辆
|
|
* 查询物流订单已派运力车辆
|
|
|
|
|
+ *
|
|
|
* @param param
|
|
* @param param
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public List<RWaybillOrderVo> queryWaybillOrder(CapacityTruckParam param) {
|
|
public List<RWaybillOrderVo> queryWaybillOrder(CapacityTruckParam param) {
|
|
|
log.info("查询物流运单已派运力车辆:{}", com.alibaba.fastjson.JSON.toJSONString(param));
|
|
log.info("查询物流运单已派运力车辆:{}", com.alibaba.fastjson.JSON.toJSONString(param));
|
|
|
LambdaQueryWrapper<KwtWaybillOrder> queryWrapper = Wrappers.<KwtWaybillOrder>lambdaQuery()
|
|
LambdaQueryWrapper<KwtWaybillOrder> queryWrapper = Wrappers.<KwtWaybillOrder>lambdaQuery()
|
|
|
- .eq(KwtWaybillOrder::getDelFlag,0)
|
|
|
|
|
- .eq(KwtWaybillOrder::getTruckNo,param.getTruckNo())
|
|
|
|
|
|
|
+ .eq(KwtWaybillOrder::getDelFlag, 0)
|
|
|
|
|
+ .eq(KwtWaybillOrder::getTruckNo, param.getTruckNo())
|
|
|
.in(KwtWaybillOrder::getStatus, FORBIDDEN_STATUSES)
|
|
.in(KwtWaybillOrder::getStatus, FORBIDDEN_STATUSES)
|
|
|
.orderByDesc(KwtWaybillOrder::getCreateTime)
|
|
.orderByDesc(KwtWaybillOrder::getCreateTime)
|
|
|
.orderByAsc(KwtWaybillOrder::getId);
|
|
.orderByAsc(KwtWaybillOrder::getId);
|
|
@@ -1174,7 +1191,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean logisticOrderFinish(OrderFinishParam req) {
|
|
public Boolean logisticOrderFinish(OrderFinishParam req) {
|
|
|
log.info("流程完结物流订单:{}", JSON.toJSONString(req));
|
|
log.info("流程完结物流订单:{}", JSON.toJSONString(req));
|
|
|
- if (Objects.isNull( req.getTradeOrderId())){
|
|
|
|
|
|
|
+ if (Objects.isNull(req.getTradeOrderId())) {
|
|
|
throw new BusinessException("贸易订单id不能为空");
|
|
throw new BusinessException("贸易订单id不能为空");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1186,11 +1203,11 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<KwtLogisticsOrderVO> getLogisticOrderList(OrderFinishParam param) {
|
|
public List<KwtLogisticsOrderVO> getLogisticOrderList(OrderFinishParam param) {
|
|
|
- if(Objects.isNull(param.getTradeOrderId())){
|
|
|
|
|
|
|
+ if (Objects.isNull(param.getTradeOrderId())) {
|
|
|
throw new BusinessException("贸易订单id不能为空");
|
|
throw new BusinessException("贸易订单id不能为空");
|
|
|
}
|
|
}
|
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByTradeOrderId(param.getTradeOrderId());
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByTradeOrderId(param.getTradeOrderId());
|
|
|
- if (CollectionUtils.isEmpty(kwtLogisticsOrders)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(kwtLogisticsOrders)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
return kwtLogisticsOrders.stream()
|
|
return kwtLogisticsOrders.stream()
|
|
@@ -1201,31 +1218,31 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<RWaybillSubOrderVo> queryWaybillOrderByLogContractIds(Set<Long> logContractIds) {
|
|
public List<RWaybillSubOrderVo> queryWaybillOrderByLogContractIds(Set<Long> logContractIds) {
|
|
|
- if (CollectionUtils.isEmpty(logContractIds)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(logContractIds)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
//根据物流合同查询物流id
|
|
//根据物流合同查询物流id
|
|
|
List<KwtLogisticsOrderContract> logisticsOrderContracts = logisticsOrderContractRepository.queryByLogContractIds(logContractIds);
|
|
List<KwtLogisticsOrderContract> logisticsOrderContracts = logisticsOrderContractRepository.queryByLogContractIds(logContractIds);
|
|
|
- if (CollectionUtils.isEmpty(logisticsOrderContracts)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(logisticsOrderContracts)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
List<Long> logIds = logisticsOrderContracts.stream()
|
|
List<Long> logIds = logisticsOrderContracts.stream()
|
|
|
.map(KwtLogisticsOrderContract::getLOrderId)
|
|
.map(KwtLogisticsOrderContract::getLOrderId)
|
|
|
.distinct()
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isEmpty(logIds)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(logIds)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
//查询物流运单
|
|
//查询物流运单
|
|
|
List<KwtWaybillOrderSubtask> waybillOrderSubtasks = waybillOrderSubtaskRepository.queryByLogIds(logIds);
|
|
List<KwtWaybillOrderSubtask> waybillOrderSubtasks = waybillOrderSubtaskRepository.queryByLogIds(logIds);
|
|
|
- if (CollectionUtils.isEmpty(waybillOrderSubtasks)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(waybillOrderSubtasks)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
Map<Long, List<KwtWaybillOrderSubtask>> logIdAndWaybillOrderSubtasksMap = waybillOrderSubtasks.stream()
|
|
Map<Long, List<KwtWaybillOrderSubtask>> logIdAndWaybillOrderSubtasksMap = waybillOrderSubtasks.stream()
|
|
|
.collect(Collectors.groupingBy(KwtWaybillOrderSubtask::getLOrderId));
|
|
.collect(Collectors.groupingBy(KwtWaybillOrderSubtask::getLOrderId));
|
|
|
//查询物流 订单
|
|
//查询物流 订单
|
|
|
List<KwtLogisticsOrder> logOrders = logisticsOrderRepository.queryByLogisticsOrderIds(logIds);
|
|
List<KwtLogisticsOrder> logOrders = logisticsOrderRepository.queryByLogisticsOrderIds(logIds);
|
|
|
- if (CollectionUtils.isEmpty(logOrders)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(logOrders)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
Map<Long, KwtLogisticsOrder> logIdAndLogOrderMap = logOrders.stream()
|
|
Map<Long, KwtLogisticsOrder> logIdAndLogOrderMap = logOrders.stream()
|
|
@@ -1233,12 +1250,12 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
//查询物流订单和的商品关系
|
|
//查询物流订单和的商品关系
|
|
|
List<KwtLogisticsOrderGoods> logOrderGoods = logisticsOrderGoodsRepository.queryByLogIds(logIds);
|
|
List<KwtLogisticsOrderGoods> logOrderGoods = logisticsOrderGoodsRepository.queryByLogIds(logIds);
|
|
|
Map<Long, KwtLogisticsOrderGoods> logisticsOrderGoodsMap = Maps.newHashMap();
|
|
Map<Long, KwtLogisticsOrderGoods> logisticsOrderGoodsMap = Maps.newHashMap();
|
|
|
- if (CollectionUtils.isNotEmpty(logOrderGoods)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(logOrderGoods)) {
|
|
|
logisticsOrderGoodsMap = logOrderGoods.stream()
|
|
logisticsOrderGoodsMap = logOrderGoods.stream()
|
|
|
.collect(Collectors.toMap(KwtLogisticsOrderGoods::getLOrderId, Function.identity(), (x, y) -> x));
|
|
.collect(Collectors.toMap(KwtLogisticsOrderGoods::getLOrderId, Function.identity(), (x, y) -> x));
|
|
|
}
|
|
}
|
|
|
Map<Long, KwtLogisticsOrderGoods> finalLogisticsOrderGoodsMap = logisticsOrderGoodsMap;
|
|
Map<Long, KwtLogisticsOrderGoods> finalLogisticsOrderGoodsMap = logisticsOrderGoodsMap;
|
|
|
- return logisticsOrderContracts.stream().map(x->{
|
|
|
|
|
|
|
+ return logisticsOrderContracts.stream().map(x -> {
|
|
|
RWaybillSubOrderVo rWaybillSubOrderVo = new RWaybillSubOrderVo();
|
|
RWaybillSubOrderVo rWaybillSubOrderVo = new RWaybillSubOrderVo();
|
|
|
rWaybillSubOrderVo.setLogContractId(x.getContractId());
|
|
rWaybillSubOrderVo.setLogContractId(x.getContractId());
|
|
|
KwtLogisticsOrder logisticsOrder = logIdAndLogOrderMap.getOrDefault(x.getLOrderId(), new KwtLogisticsOrder());
|
|
KwtLogisticsOrder logisticsOrder = logIdAndLogOrderMap.getOrDefault(x.getLOrderId(), new KwtLogisticsOrder());
|
|
@@ -1339,7 +1356,8 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询司机的当天完成量、7天完成量、30天完成量
|
|
* 查询司机的当天完成量、7天完成量、30天完成量
|
|
|
- * @param entId 企业id
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param entId 企业id
|
|
|
* @param driverId
|
|
* @param driverId
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
@@ -1362,7 +1380,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
// 3. 定义时间范围
|
|
// 3. 定义时间范围
|
|
|
Date todayStart = DateUtil.beginOfDay(new Date()); // 当天00:00:00
|
|
Date todayStart = DateUtil.beginOfDay(new Date()); // 当天00:00:00
|
|
|
Date todayEnd = DateUtil.endOfDay(new Date()); // 当天23:59:59
|
|
Date todayEnd = DateUtil.endOfDay(new Date()); // 当天23:59:59
|
|
|
- Date sevenDaysStart = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -7)); // 7天前的00:00:00
|
|
|
|
|
|
|
+ Date sevenDaysStart = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -7)); // 7天前的00:00:00
|
|
|
Date thirtyDaysStart = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30)); // 30天前的00:00:00
|
|
Date thirtyDaysStart = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30)); // 30天前的00:00:00
|
|
|
//4. 初始化计数器
|
|
//4. 初始化计数器
|
|
|
int todayCount = 0;
|
|
int todayCount = 0;
|
|
@@ -1393,7 +1411,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
if (Objects.equals(billingMode, String.valueOf(1))) {
|
|
if (Objects.equals(billingMode, String.valueOf(1))) {
|
|
|
statusValid = CarWaybillV1Enum.COMPLETION_LOADING.getCode().equals(order.getStatus())
|
|
statusValid = CarWaybillV1Enum.COMPLETION_LOADING.getCode().equals(order.getStatus())
|
|
|
- ||CarWaybillV1Enum.COMPLETED.getCode().equals(order.getStatus());
|
|
|
|
|
|
|
+ || CarWaybillV1Enum.COMPLETED.getCode().equals(order.getStatus());
|
|
|
} else {
|
|
} else {
|
|
|
//按照卸货量结算(统计“已完成”运单)
|
|
//按照卸货量结算(统计“已完成”运单)
|
|
|
statusValid = order.getStatus().equals(CarWaybillV1Enum.COMPLETED.getCode());
|
|
statusValid = order.getStatus().equals(CarWaybillV1Enum.COMPLETED.getCode());
|
|
@@ -1424,13 +1442,13 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
@Override
|
|
@Override
|
|
|
public RWaybillOrderVo queryWaybillOrderByWayBillOrderId(Long wayBillOrderId) {
|
|
public RWaybillOrderVo queryWaybillOrderByWayBillOrderId(Long wayBillOrderId) {
|
|
|
KwtWaybillOrder waybillOrder = waybillOrderRepository.queryByBillOrderId(wayBillOrderId);
|
|
KwtWaybillOrder waybillOrder = waybillOrderRepository.queryByBillOrderId(wayBillOrderId);
|
|
|
- if (Objects.isNull(waybillOrder)){
|
|
|
|
|
|
|
+ if (Objects.isNull(waybillOrder)) {
|
|
|
return new RWaybillOrderVo();
|
|
return new RWaybillOrderVo();
|
|
|
}
|
|
}
|
|
|
//查询子运单
|
|
//查询子运单
|
|
|
KwtWaybillOrderSubtask subtasks = waybillOrderSubtaskRepository.queryByWOrderId(waybillOrder.getId());
|
|
KwtWaybillOrderSubtask subtasks = waybillOrderSubtaskRepository.queryByWOrderId(waybillOrder.getId());
|
|
|
- List<KwtLogisticsOrderAddress> addressList =null;
|
|
|
|
|
- if (Objects.nonNull(subtasks) && Objects.nonNull(subtasks.getLOrderId())){
|
|
|
|
|
|
|
+ List<KwtLogisticsOrderAddress> addressList = null;
|
|
|
|
|
+ if (Objects.nonNull(subtasks) && Objects.nonNull(subtasks.getLOrderId())) {
|
|
|
addressList = logisticsOrderAddressRepository.queryByLogOrderId(subtasks.getLOrderId());
|
|
addressList = logisticsOrderAddressRepository.queryByLogOrderId(subtasks.getLOrderId());
|
|
|
}
|
|
}
|
|
|
RWaybillOrderVo rWaybillOrderVo = new RWaybillOrderVo();
|
|
RWaybillOrderVo rWaybillOrderVo = new RWaybillOrderVo();
|
|
@@ -1448,12 +1466,12 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
rWaybillOrderVo.setStartTime(waybillOrder.getStartTime());
|
|
rWaybillOrderVo.setStartTime(waybillOrder.getStartTime());
|
|
|
rWaybillOrderVo.setEndTime(waybillOrder.getEndTime());
|
|
rWaybillOrderVo.setEndTime(waybillOrder.getEndTime());
|
|
|
rWaybillOrderVo.setStatus(waybillOrder.getStatus());
|
|
rWaybillOrderVo.setStatus(waybillOrder.getStatus());
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(addressList)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(addressList)) {
|
|
|
addressList.forEach(address -> {
|
|
addressList.forEach(address -> {
|
|
|
- if (Objects.equals(address.getAddressType(), AddressTypeEnum.SHIPMENT.getCode())){
|
|
|
|
|
|
|
+ if (Objects.equals(address.getAddressType(), AddressTypeEnum.SHIPMENT.getCode())) {
|
|
|
rWaybillOrderVo.setStartLng(address.getLng());
|
|
rWaybillOrderVo.setStartLng(address.getLng());
|
|
|
rWaybillOrderVo.setStartLat(address.getLat());
|
|
rWaybillOrderVo.setStartLat(address.getLat());
|
|
|
- }else if (Objects.equals(address.getAddressType(), AddressTypeEnum.TAKE.getCode())){
|
|
|
|
|
|
|
+ } else if (Objects.equals(address.getAddressType(), AddressTypeEnum.TAKE.getCode())) {
|
|
|
rWaybillOrderVo.setEndLng(address.getLng());
|
|
rWaybillOrderVo.setEndLng(address.getLng());
|
|
|
rWaybillOrderVo.setEndLat(address.getLat());
|
|
rWaybillOrderVo.setEndLat(address.getLat());
|
|
|
}
|
|
}
|
|
@@ -1466,7 +1484,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
@Override
|
|
@Override
|
|
|
public WaybillOrderSubtaskVo queryWaybillOrderId(Long wayBillOrderId) {
|
|
public WaybillOrderSubtaskVo queryWaybillOrderId(Long wayBillOrderId) {
|
|
|
KwtWaybillOrderSubtask kwtWaybillOrder = waybillOrderSubtaskRepository.queryByBillOrderId(wayBillOrderId);
|
|
KwtWaybillOrderSubtask kwtWaybillOrder = waybillOrderSubtaskRepository.queryByBillOrderId(wayBillOrderId);
|
|
|
- if (Objects.isNull(kwtWaybillOrder)){
|
|
|
|
|
|
|
+ if (Objects.isNull(kwtWaybillOrder)) {
|
|
|
return new WaybillOrderSubtaskVo();
|
|
return new WaybillOrderSubtaskVo();
|
|
|
}
|
|
}
|
|
|
WaybillOrderSubtaskVo rWaybillOrderVo = new WaybillOrderSubtaskVo();
|
|
WaybillOrderSubtaskVo rWaybillOrderVo = new WaybillOrderSubtaskVo();
|
|
@@ -1479,7 +1497,7 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<KwtLogisticsOrderAddressVo> queryByWOrderId(Long wayBillOrderId) {
|
|
public List<KwtLogisticsOrderAddressVo> queryByWOrderId(Long wayBillOrderId) {
|
|
|
List<KwtLogisticsOrderAddress> addressList = logisticsOrderAddressRepository.queryByLogOrderId(wayBillOrderId);
|
|
List<KwtLogisticsOrderAddress> addressList = logisticsOrderAddressRepository.queryByLogOrderId(wayBillOrderId);
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(addressList)){
|
|
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(addressList)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
return addressList.stream().map(address -> {
|
|
return addressList.stream().map(address -> {
|
|
@@ -1496,12 +1514,12 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<WayContaractbillOrderVo> queryLogisticContractByContTradeIds(Set<Long> contractIds) {
|
|
public List<WayContaractbillOrderVo> queryLogisticContractByContTradeIds(Set<Long> contractIds) {
|
|
|
- if (CollectionUtils.isEmpty(contractIds)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(contractIds)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
//根据物流合同查询物流id
|
|
//根据物流合同查询物流id
|
|
|
List<KwtLogisticsOrderContract> logisticsOrderContracts = logisticsOrderContractRepository.queryByLogContractIds(contractIds);
|
|
List<KwtLogisticsOrderContract> logisticsOrderContracts = logisticsOrderContractRepository.queryByLogContractIds(contractIds);
|
|
|
- if (CollectionUtils.isEmpty(logisticsOrderContracts)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(logisticsOrderContracts)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1511,12 +1529,12 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
.map(KwtLogisticsOrderContract::getLOrderId)
|
|
.map(KwtLogisticsOrderContract::getLOrderId)
|
|
|
.distinct()
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isEmpty(logIds)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(logIds)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
//查询物流订单
|
|
//查询物流订单
|
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByLogisticsOrderIds(logIds);
|
|
List<KwtLogisticsOrder> kwtLogisticsOrders = logisticsOrderRepository.queryByLogisticsOrderIds(logIds);
|
|
|
- if (CollectionUtils.isEmpty(kwtLogisticsOrders)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(kwtLogisticsOrders)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
List<WayContaractbillOrderVo> result = Lists.newArrayList();
|
|
List<WayContaractbillOrderVo> result = Lists.newArrayList();
|
|
@@ -1570,4 +1588,163 @@ public class TransportServiceImpl implements TransportRemoteService {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long queryLogisticsCount() {
|
|
|
|
|
+ OrderStatusStatisticsResp orderStatusStatisticsResp = logisticsConsignmentService.orderStatusStatistics(new QueryLogisticsOrderReq());
|
|
|
|
|
+ List<OrderStatusStatisticsResp.OrderStatusStatistics> orderStatusStatistics = orderStatusStatisticsResp.getOrderStatusStatistics();
|
|
|
|
|
+
|
|
|
|
|
+ if (CollUtil.isEmpty(orderStatusStatistics)) {
|
|
|
|
|
+ return 0L;
|
|
|
|
|
+ }
|
|
|
|
|
+ Optional<OrderStatusStatisticsResp.OrderStatusStatistics> first = orderStatusStatistics.stream().filter(d -> StrUtil.equals(d.getOrderStatus(), "5")).findFirst();
|
|
|
|
|
+ return first.map(contractStatusCount -> Long.parseLong(contractStatusCount.getOrderNum())).orElse(0L);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long queryWaybillCount() {
|
|
|
|
|
+ StatisticsWaybillResp statisticsWaybillResp = waybillOrderV1Service.statisticsWaybillOrder(new WaybillOrderReq());
|
|
|
|
|
+ List<StatisticsWaybillResp.OrderBillStatusStatistics> orderStatusStatistics = statisticsWaybillResp.getOrderStatusStatistics();
|
|
|
|
|
+ if (CollUtil.isEmpty(orderStatusStatistics)) {
|
|
|
|
|
+ return 0L;
|
|
|
|
|
+ }
|
|
|
|
|
+ Optional<StatisticsWaybillResp.OrderBillStatusStatistics> first = orderStatusStatistics.stream().filter(d -> StrUtil.equals(d.getOrderStatus(), "20")).findFirst();
|
|
|
|
|
+ return first.map(contractStatusCount -> Long.parseLong(contractStatusCount.getOrderNum())).orElse(0L);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long queryCount() {
|
|
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
|
|
+ if (!LoginUserHolder.isManager()) {
|
|
|
|
|
+ ids = LoginUserHolder.getChildEntList();
|
|
|
|
|
+ }
|
|
|
|
|
+ return logisticsOrderMapper.queryCount(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<LogisticsVo> logisticsList() {
|
|
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
|
|
+ if (!LoginUserHolder.isManager()) {
|
|
|
|
|
+ ids = LoginUserHolder.getChildEntList();
|
|
|
|
|
+ }
|
|
|
|
|
+ return kwtWaybillOrderMapper.queryList(ids, false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public LogisticsDto logisticsRank(TimePara timePara) {
|
|
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
|
|
+ if (!LoginUserHolder.isManager()) {
|
|
|
|
|
+ ids = LoginUserHolder.getChildEntList();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<WaybillRankVo> waybillRankVos = kwtWaybillOrderMapper.logisticsRank(ids, timePara);
|
|
|
|
|
+ if (CollUtil.isEmpty(waybillRankVos)) {
|
|
|
|
|
+ waybillRankVos = new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ LogisticsDto logisticsDto = new LogisticsDto();
|
|
|
|
|
+ List<String> strings = new ArrayList<>();
|
|
|
|
|
+ List<BigDecimal> strings1 = new ArrayList<>();
|
|
|
|
|
+ for (WaybillRankVo waybillRankVo : waybillRankVos) {
|
|
|
|
|
+ strings.add(waybillRankVo.getFirmName());
|
|
|
|
|
+ strings1.add(Objects.nonNull(waybillRankVo.getAmount()) ? waybillRankVo.getAmount() : new BigDecimal("0"));
|
|
|
|
|
+ }
|
|
|
|
|
+ logisticsDto.setFirmName(strings);
|
|
|
|
|
+ logisticsDto.setAmount(strings1);
|
|
|
|
|
+
|
|
|
|
|
+ return logisticsDto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<Long> separateAndRotate(List<Long> list, long pivot) {
|
|
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查找分隔元素的索引
|
|
|
|
|
+ int pivotIndex = list.indexOf(pivot);
|
|
|
|
|
+ if (pivotIndex == -1) {
|
|
|
|
|
+ // 如果元素不存在,返回原列表的副本
|
|
|
|
|
+ return new ArrayList<>(list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<Long> result = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 添加右边的元素(分隔元素之后的部分)
|
|
|
|
|
+ for (int i = pivotIndex + 1; i < list.size(); i++) {
|
|
|
|
|
+ result.add(list.get(i));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 添加左边的元素(分隔元素之前的部分)
|
|
|
|
|
+ for (int i = 0; i < pivotIndex; i++) {
|
|
|
|
|
+ result.add(list.get(i));
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public WaybillOrderDetailVo auditLogisticsTask(LogisticsOrderAuditPara para) {
|
|
|
|
|
+ Long orderId = para.getOrderId();
|
|
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
|
|
+ if (!LoginUserHolder.isManager()) {
|
|
|
|
|
+ ids = LoginUserHolder.getChildEntList();
|
|
|
|
|
+ }
|
|
|
|
|
+ String key = String.format(RedisConstant.AUDIT_LOGISTICS_TASK, LoginUserHolder.getEntId());
|
|
|
|
|
+
|
|
|
|
|
+ if (para.getStart()) {//首次加载,合同id为第一个合同
|
|
|
|
|
+ if (Boolean.TRUE.equals(redisTemplate.hasKey(key))) {
|
|
|
|
|
+ redisTemplate.delete(key);
|
|
|
|
|
+ }
|
|
|
|
|
+ //写入缓存
|
|
|
|
|
+ List<LogisticsVo> tradeVos = kwtWaybillOrderMapper.queryList(ids, true);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tradeVos)) {
|
|
|
|
|
+ List<Long> list = tradeVos.stream().map(LogisticsVo::getId).toList();
|
|
|
|
|
+ List<Long> longs = separateAndRotate(list, orderId);
|
|
|
|
|
+ redisTemplate.opsForList().rightPushAll(key, longs);
|
|
|
|
|
+ redisTemplate.expire(key, 24, TimeUnit.HOURS);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //继续审核合同,合同id为上一次的合同id。
|
|
|
|
|
+ orderId = (Long) redisTemplate.opsForList().leftPop(key);
|
|
|
|
|
+ if (Objects.isNull(orderId)) {
|
|
|
|
|
+ throw new BusinessException("已审核完成");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ WaybillOrderRequest waybillOrderRequest = new WaybillOrderRequest();
|
|
|
|
|
+ waybillOrderRequest.setOrderId(orderId);
|
|
|
|
|
+ WaybillOrderDetailResp waybillOrderDetailResp = waybillOrderV1Service.queryBillOrderDetail(waybillOrderRequest);
|
|
|
|
|
+
|
|
|
|
|
+ WaybillOrderDetailVo order = BeanUtil.copyProperties(waybillOrderDetailResp, WaybillOrderDetailVo.class);
|
|
|
|
|
+
|
|
|
|
|
+ if (Objects.nonNull(order)) {
|
|
|
|
|
+ return order;
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new BusinessException("未找到贸易订单");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Object countLogistics(CountPara2 countPara) {
|
|
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
|
|
+ if (!LoginUserHolder.isManager()) {
|
|
|
|
|
+ ids = LoginUserHolder.getChildEntList();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<WaybillVo> waybillVos = kwtWaybillOrderMapper.countLogistics(countPara, ids);
|
|
|
|
|
+ if (CollUtil.isEmpty(waybillVos)) {
|
|
|
|
|
+ waybillVos = new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
|
|
|
|
|
+ List<String> two = new ArrayList<>();
|
|
|
|
|
+ List<BigDecimal> three = new ArrayList<>();
|
|
|
|
|
+ for (WaybillVo saleVo : waybillVos) {
|
|
|
|
|
+ two.add(saleVo.getFirmName());
|
|
|
|
|
+ three.add(Objects.nonNull(saleVo.getMoney()) ? saleVo.getMoney().divide(new BigDecimal("10000"), RoundingMode.HALF_UP) : new BigDecimal("0"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ jsonObject.put("firm", two);
|
|
|
|
|
+ jsonObject.put("amount", three);
|
|
|
|
|
+
|
|
|
|
|
+ return jsonObject;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|