|
@@ -60,6 +60,7 @@ import com.sckw.transport.response.CollectZjxlResponse;
|
|
|
import com.sckw.transport.service.zj.VehicleCollectService;
|
|
import com.sckw.transport.service.zj.VehicleCollectService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.antlr.v4.runtime.misc.Array2DHashSet;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -133,8 +134,10 @@ public class kwfTruckTraceService {
|
|
|
MapVehicleQueryReq queryReq = new MapVehicleQueryReq();
|
|
MapVehicleQueryReq queryReq = new MapVehicleQueryReq();
|
|
|
queryReq.setCarrierEntId(req.getCarrierEntId());
|
|
queryReq.setCarrierEntId(req.getCarrierEntId());
|
|
|
queryReq.setLogisticOrderNo(req.getLogisticOrderNo());
|
|
queryReq.setLogisticOrderNo(req.getLogisticOrderNo());
|
|
|
- Set<Long> wayOrderIds = getWayOrderIds(queryReq);
|
|
|
|
|
- if (CollectionUtils.isEmpty(wayOrderIds) && (StringUtils.isNotBlank(req.getLogisticOrderNo()) || Objects.nonNull(req.getCarrierEntId()))) {
|
|
|
|
|
|
|
+ Set<Long> entList = new HashSet<>();
|
|
|
|
|
+ entList.add(LoginUserHolder.getEntId());
|
|
|
|
|
+ Set<Long> wayOrderIds = getWayOrderIds(queryReq,entList);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(wayOrderIds) && (StringUtils.isNotBlank(req.getLogisticOrderNo()) || Objects.nonNull(req.getCarrierEntId()) || Objects.nonNull(LoginUserHolder.getEntId()))) {
|
|
|
return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
}
|
|
}
|
|
|
Page<KwtWaybillOrder> page = kwtWaybillOrderRepository.findPage(wayOrderIds,req.getTruckNo(),req.getPageNum(), req.getPageSize(), startDate, endDate);
|
|
Page<KwtWaybillOrder> page = kwtWaybillOrderRepository.findPage(wayOrderIds,req.getTruckNo(),req.getPageNum(), req.getPageSize(), startDate, endDate);
|
|
@@ -992,14 +995,14 @@ public class kwfTruckTraceService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 前置条件:根据承运单位和托运单位筛选出符合条件的运单ID
|
|
// 前置条件:根据承运单位和托运单位筛选出符合条件的运单ID
|
|
|
- Set<Long> wayOrderIds = getWayOrderIds(req);
|
|
|
|
|
- if (CollectionUtils.isEmpty(wayOrderIds) && (StringUtils.isNotBlank(req.getLogisticOrderNo()) || Objects.nonNull(req.getCarrierEntId()) || Objects.nonNull(req.getConsignEntId()))) {
|
|
|
|
|
|
|
+ Set<Long> wayOrderIds = getWayOrderIds(req,allEnt);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(wayOrderIds) && (StringUtils.isNotBlank(req.getLogisticOrderNo()) || Objects.nonNull(req.getCarrierEntId()) || Objects.nonNull(req.getConsignEntId()) || Objects.nonNull(LoginUserHolder.getEntId()))) {
|
|
|
return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 使用 MyBatis-Plus 分页查询(如果有前置筛选条件,则添加运单ID的IN条件)
|
|
// 使用 MyBatis-Plus 分页查询(如果有前置筛选条件,则添加运单ID的IN条件)
|
|
|
|
|
|
|
|
- IPage<KwtWaybillOrder> page = kwtWaybillOrderRepository.queryMapVehicleListPage(allEnt,startDate, endDate, taskingStatus, wayOrderIds,req.getTrackNo(), req.getPageNum(),req.getPageSize() );
|
|
|
|
|
|
|
+ IPage<KwtWaybillOrder> page = kwtWaybillOrderRepository.queryMapVehicleListPage(startDate, endDate, taskingStatus, wayOrderIds,req.getTrackNo(), req.getPageNum(),req.getPageSize() );
|
|
|
|
|
|
|
|
List<KwtWaybillOrder> waybillOrders = page.getRecords();
|
|
List<KwtWaybillOrder> waybillOrders = page.getRecords();
|
|
|
if (CollectionUtils.isEmpty(waybillOrders)) {
|
|
if (CollectionUtils.isEmpty(waybillOrders)) {
|
|
@@ -1156,28 +1159,34 @@ public class kwfTruckTraceService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
|
- private Set<Long> getWayOrderIds(MapVehicleQueryReq req) {
|
|
|
|
|
|
|
+ private Set<Long> getWayOrderIds(MapVehicleQueryReq req,Set<Long> allEnt) {
|
|
|
Set<Long> wayOrderIds = Sets.newHashSet();
|
|
Set<Long> wayOrderIds = Sets.newHashSet();
|
|
|
- List<Long> entIds = new ArrayList<>();
|
|
|
|
|
|
|
+ // List<Long> entIds = new ArrayList<>();
|
|
|
if (req.getConsignEntId() != null){
|
|
if (req.getConsignEntId() != null){
|
|
|
- entIds.add(req.getConsignEntId());
|
|
|
|
|
|
|
+ allEnt.add(req.getConsignEntId());
|
|
|
}
|
|
}
|
|
|
if (req.getCarrierEntId() != null){
|
|
if (req.getCarrierEntId() != null){
|
|
|
- entIds.add(req.getCarrierEntId());
|
|
|
|
|
|
|
+ allEnt.add(req.getCarrierEntId());
|
|
|
}
|
|
}
|
|
|
- if (CollectionUtils.isNotEmpty(entIds)) {
|
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(allEnt)) {
|
|
|
// 第一步:从物流订单单位表查询符合条件的物流订单ID
|
|
// 第一步:从物流订单单位表查询符合条件的物流订单ID
|
|
|
// 同时有托运和承运单位条件,将企业ID和类型组合后批量查询
|
|
// 同时有托运和承运单位条件,将企业ID和类型组合后批量查询
|
|
|
List<KwtLogisticsOrderUnit> allUnits = kwtLogisticsOrderUnitRepository.list(
|
|
List<KwtLogisticsOrderUnit> allUnits = kwtLogisticsOrderUnitRepository.list(
|
|
|
Wrappers.<KwtLogisticsOrderUnit>lambdaQuery()
|
|
Wrappers.<KwtLogisticsOrderUnit>lambdaQuery()
|
|
|
.eq(KwtLogisticsOrderUnit::getDelFlag, 0)
|
|
.eq(KwtLogisticsOrderUnit::getDelFlag, 0)
|
|
|
- .in(KwtLogisticsOrderUnit::getEntId, entIds)
|
|
|
|
|
|
|
+ .in(KwtLogisticsOrderUnit::getEntId, allEnt)
|
|
|
.in(KwtLogisticsOrderUnit::getUnitType, Arrays.asList(1, 2)));
|
|
.in(KwtLogisticsOrderUnit::getUnitType, Arrays.asList(1, 2)));
|
|
|
if (CollectionUtils.isEmpty(allUnits)) {
|
|
if (CollectionUtils.isEmpty(allUnits)) {
|
|
|
return Set.of();
|
|
return Set.of();
|
|
|
}
|
|
}
|
|
|
|
|
+ Set<Long> logisticsOrderIds = allUnits.stream()
|
|
|
|
|
+ .filter(x -> Objects.equals(x.getEntId(), LoginUserHolder.getEntId()))
|
|
|
|
|
+ .map(KwtLogisticsOrderUnit::getLOrderId)
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
|
+
|
|
|
Set<Long> lOrderIds = allUnits.stream()
|
|
Set<Long> lOrderIds = allUnits.stream()
|
|
|
.map(KwtLogisticsOrderUnit::getLOrderId)
|
|
.map(KwtLogisticsOrderUnit::getLOrderId)
|
|
|
|
|
+ .filter(logisticsOrderIds::contains)
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|
|
|
if (CollectionUtils.isEmpty(lOrderIds)) {
|
|
if (CollectionUtils.isEmpty(lOrderIds)) {
|
|
|
return Set.of();
|
|
return Set.of();
|
|
@@ -1204,7 +1213,7 @@ public class kwfTruckTraceService {
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isNotBlank(req.getLogisticOrderNo())) {
|
|
if (StringUtils.isNotBlank(req.getLogisticOrderNo())) {
|
|
|
// 获取物流订单ID
|
|
// 获取物流订单ID
|
|
|
- KwtLogisticsOrder logOrder = kwtLogisticsOrderRepository.queryByLogisticOrderNo(req.getLogisticOrderNo());
|
|
|
|
|
|
|
+ KwtLogisticsOrder logOrder = kwtLogisticsOrderRepository.queryByLogisticOrderId(req.getLogisticOrderNo());
|
|
|
if (Objects.isNull(logOrder)) {
|
|
if (Objects.isNull(logOrder)) {
|
|
|
return Set.of();
|
|
return Set.of();
|
|
|
}
|
|
}
|
|
@@ -1481,15 +1490,15 @@ public class kwfTruckTraceService {
|
|
|
//根据企业类型查询企业
|
|
//根据企业类型查询企业
|
|
|
|
|
|
|
|
allEnt.add(LoginUserHolder.getEntId());
|
|
allEnt.add(LoginUserHolder.getEntId());
|
|
|
- EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(LoginUserHolder.getUserId());
|
|
|
|
|
- if (Objects.nonNull(entCacheResDto)) {
|
|
|
|
|
- EntCacheResDto entCacheResDto1 = remoteSystemService.queryEntTreeById(entCacheResDto.getId());
|
|
|
|
|
- List<EntCacheResDto> child = entCacheResDto1.getChild();
|
|
|
|
|
- if (com.sckw.core.utils.CollectionUtils.isNotEmpty(child)) {
|
|
|
|
|
- allEnt.addAll(child.stream()
|
|
|
|
|
- .map(EntCacheResDto::getId).toList());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(LoginUserHolder.getUserId());
|
|
|
|
|
+// if (Objects.nonNull(entCacheResDto)) {
|
|
|
|
|
+// EntCacheResDto entCacheResDto1 = remoteSystemService.queryEntTreeById(entCacheResDto.getId());
|
|
|
|
|
+// List<EntCacheResDto> child = entCacheResDto1.getChild();
|
|
|
|
|
+// if (com.sckw.core.utils.CollectionUtils.isNotEmpty(child)) {
|
|
|
|
|
+// allEnt.addAll(child.stream()
|
|
|
|
|
+// .map(EntCacheResDto::getId).toList());
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
return allEnt;
|
|
return allEnt;
|
|
|
}
|
|
}
|
|
|
|
|
|