Просмотр исходного кода

还原运单列表和运单看板查询报错

lengfaqiang 2 лет назад
Родитель
Сommit
2de1e51118

+ 12 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/LogisticsOrderDTO.java

@@ -289,4 +289,16 @@ public class LogisticsOrderDTO implements Serializable {
      */
     @JsonProperty("taxMoney")
     private BigDecimal taxMoney;
+
+    /**
+     * 发货单位
+     */
+    @JsonProperty("forwardingUnit")
+   private  String forwardingUnit;
+
+    /**
+     * 收货单位
+     */
+    @JsonProperty("consignee")
+   private  String consignee;
 }

+ 20 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java

@@ -2260,6 +2260,26 @@ public class AcceptCarriageOrderService {
                 }
             }
             vo.setWaitDistributionAmount(vo.getCarryingCapacity().subtract(vo.getSubcontractAmount()).subtract(vo.getEntrustAmount()));
+            String tOrderId = vo.getTOrderId();
+            if (StringUtils.isNotBlank(tOrderId)) {
+                OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
+                if (orderDetailById != null) {
+                    List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
+                    if (CollectionUtils.isNotEmpty(unitInfo)) {
+                        for (UnitInfoDetailRes detailRes : unitInfo) {
+                            if ("1".equals(detailRes.getUnitType())) {
+                                vo.setReceiveGoodsUnit(detailRes.getFirmName());
+                                vo.setReceiveGoodsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                            }
+                            if ("2".equals(detailRes.getUnitType())) {
+                                vo.setShipmentsUnit(detailRes.getFirmName());
+                                vo.setShipmentsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                            }
+                        }
+                    }
+                }
+            }
+
         }
         return PageRes.build(pageInfo, list);
     }

+ 20 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java

@@ -1637,6 +1637,26 @@ public class ConsignOrderService {
                 }
             }
             vo.setWaitDistributionAmount(vo.getCarryingCapacity().subtract(vo.getSubcontractAmount()).subtract(vo.getEntrustAmount()));
+            String tOrderId = vo.getTOrderId();
+            if (StringUtils.isNotBlank(tOrderId)) {
+                OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
+                if (orderDetailById != null) {
+                    List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
+                    if (CollectionUtils.isNotEmpty(unitInfo)) {
+                        for (UnitInfoDetailRes detailRes : unitInfo) {
+                            if ("1".equals(detailRes.getUnitType())) {
+                                vo.setReceiveGoodsUnit(detailRes.getFirmName());
+                                vo.setReceiveGoodsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                            }
+                            if ("2".equals(detailRes.getUnitType())) {
+                                vo.setShipmentsUnit(detailRes.getFirmName());
+                                vo.setShipmentsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                            }
+                        }
+                    }
+                }
+            }
+
         }
         return PageRes.build(pageInfo, list);
     }

+ 43 - 34
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/WaybillManagementService.java

@@ -99,7 +99,7 @@ public class WaybillManagementService {
         WayBillDetailDTO wayBillDetailDTO = new WayBillDetailDTO();
         WaybillTicketVO waybillTicketVO = new WaybillTicketVO();
         WaybillCarVO waybillCarVO = new WaybillCarVO();
-        if(!ObjectUtils.isEmpty(info)) {
+        if (!ObjectUtils.isEmpty(info)) {
             // 基础信息
             wayBillDetailDTO.setTruckId(info.getTruckId());
             wayBillDetailDTO.setStatus(String.valueOf(info.getStatus()));
@@ -128,22 +128,22 @@ public class WaybillManagementService {
             wayBillDetailDTO.setCheckFirmName(info.getCheckFirmName());
             // 计费方式
             KwtLogisticsOrder kwtLogisticsOrder = kwtLogisticsOrderMapper.selectById(info.getLOrderId());
-            if(!ObjectUtils.isEmpty(kwtLogisticsOrder)) {
+            if (!ObjectUtils.isEmpty(kwtLogisticsOrder)) {
                 wayBillDetailDTO.setPriceType(kwtLogisticsOrder.getBillingMode());
                 SysDictResDto billingMode = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.CHARGING_TYPE.getType(), kwtLogisticsOrder.getBillingMode());
-                if(!ObjectUtils.isEmpty(billingMode)) {
+                if (!ObjectUtils.isEmpty(billingMode)) {
                     wayBillDetailDTO.setPriceTypeLabe(billingMode.getLabel());
                 }
             }
             wayBillDetailDTO.setCheckFirmName(info.getCheckFirmName());
             // 派车人信息
             UserCacheResDto createUser = remoteSystemService.queryUserCacheById(info.getCreateBy());
-            if(!ObjectUtils.isEmpty(createUser)) {
+            if (!ObjectUtils.isEmpty(createUser)) {
                 wayBillDetailDTO.setCreateByPhone(createUser.getPhone());
             }
             // 车辆信息
             SysDictResDto truckTypeString = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.TRUCK_TYPE.getType(), info.getTruckType());
-            if(!ObjectUtils.isEmpty(truckTypeString)) {
+            if (!ObjectUtils.isEmpty(truckTypeString)) {
                 waybillCarVO.setTypeLabel(truckTypeString.getLabel());
             }
             waybillCarVO.setTruckId(String.valueOf(info.getTruckId()));
@@ -154,12 +154,12 @@ public class WaybillManagementService {
             waybillCarVO.setDriverId(String.valueOf(info.getTruckId()));
             waybillCarVO.setTrailerNo(info.getTruckTrailerNo());
             // 票据
-            if (info.getLoadTime()!=null){
+            if (info.getLoadTime() != null) {
                 waybillTicketVO.setLoadTime(DateUtil.getDateTime(info.getLoadTime()));
             }
             waybillTicketVO.setLoadWeight(String.valueOf(info.getLoadAmount()));
             waybillTicketVO.setLoadUrl(String.valueOf(info.getLoadUrls()));
-            if (info.getUnloadTime()!=null){
+            if (info.getUnloadTime() != null) {
                 waybillTicketVO.setUnloadTime(DateUtil.getDateTime(info.getUnloadTime()));
             }
             waybillTicketVO.setUnloadWeight(String.valueOf(info.getUnloadAmount()));
@@ -168,7 +168,7 @@ public class WaybillManagementService {
             BigDecimal deficitLoss = info.getLoss() == null ? BigDecimal.valueOf(0) : info.getLoss();
             BigDecimal deficitAmount = info.getDeficitAmount() == null ? BigDecimal.valueOf(0) : info.getDeficitAmount();
             BigDecimal deficitRealAmount = BigDecimal.valueOf(0);
-            if(deficitAmount.compareTo(BigDecimal.valueOf(0)) > 0) {
+            if (deficitAmount.compareTo(BigDecimal.valueOf(0)) > 0) {
                 deficitRealAmount = deficitLoss.subtract(deficitAmount);
             }
             waybillTicketVO.setDeficitRealAmount(deficitRealAmount.toString());
@@ -194,9 +194,9 @@ public class WaybillManagementService {
             List<UserCacheResDto> users = remoteSystemService.queryUserCacheByIds(userIds);
             Map<Long, UserCacheResDto> usersMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
             users.forEach(e -> usersMap.put(e.getId(), e));
-            for (KwtWaybillOrderTrack kwtWaybillOrderTrack: kwtWaybillOrderTracks) {
-                for (WaybillStatusVO statusVO:statusVOS) {
-                    if(statusVO.getCode().equals(kwtWaybillOrderTrack.getStatus())) {
+            for (KwtWaybillOrderTrack kwtWaybillOrderTrack : kwtWaybillOrderTracks) {
+                for (WaybillStatusVO statusVO : statusVOS) {
+                    if (statusVO.getCode().equals(kwtWaybillOrderTrack.getStatus())) {
                         statusVO.setStatus(true);
                         statusVO.setId(kwtWaybillOrderTrack.getId());
                         statusVO.setCreateTime(DateUtil.getDateTime(kwtWaybillOrderTrack.getCreateTime()));
@@ -231,10 +231,11 @@ public class WaybillManagementService {
 
     /**
      * 简洁版运单详情
+     *
      * @param id
      * @return
      */
-    public HttpResult waybillSimpleData(Long id){
+    public HttpResult waybillSimpleData(Long id) {
         // 数据校验
         if (id == null) {
             return HttpResult.error("车辆运单ID不能为空!");
@@ -347,8 +348,10 @@ public class WaybillManagementService {
         waybillSimpleDataVO.setProcess(statusVOS);
         return HttpResult.ok(waybillSimpleDataVO);*/
     }
+
     /**
      * 运单看板列表
+     *
      * @param query
      * @return
      * @throws Exception
@@ -381,12 +384,11 @@ public class WaybillManagementService {
     }
 
     /**
-     *
      * @return
      */
     public void packageWaybillIndexResult(List<SckwWaybillOrder> list, List<WaybillStatusVO> statusVOS, List<WaybillBoardListVO> returnList) {
         // 执行查询
-        for (SckwWaybillOrder sckwWaybillOrder:list) {
+        for (SckwWaybillOrder sckwWaybillOrder : list) {
             WaybillBoardListVO waybillBoardListVO = new WaybillBoardListVO();
             waybillBoardListVO.setWOrderId(String.valueOf(sckwWaybillOrder.getWOrderId()));
             waybillBoardListVO.setWOrderNo(String.valueOf(sckwWaybillOrder.getWOrderNo()));
@@ -432,11 +434,11 @@ public class WaybillManagementService {
                 users.forEach(e -> usersMap.put(e.getId(), e.getName()));
                 waybillBoardListVO.getTracks().forEach(e -> {
                     kwtWaybillOrderTracks.forEach(e2 -> {
-                        if(e.getCode().equals(e2.getStatus())) {
+                        if (e.getCode().equals(e2.getStatus())) {
                             e.setStatus(true);
                             e.setId(e2.getId());
-                            e.setOperateTime(DateUtil.getDateTime(e2.getOperateTime()));
-                            e.setCreateTime(DateUtil.getDateTime(e2.getCreateTime()));
+                            e.setOperateTime(e2.getOperateTime() == null ? null : DateUtil.getDateTime(e2.getOperateTime()));
+                            e.setCreateTime(e2.getCreateTime() == null ? null : DateUtil.getDateTime(e2.getCreateTime()));
                             e.setCreateByName(usersMap.get(e2.getCreateBy()) == null ? null : usersMap.get(e2.getCreateBy()));
                         }
                     });
@@ -447,10 +449,9 @@ public class WaybillManagementService {
     }
 
     /**
-     *
      * @return
      */
-    public  List<Integer> initWaybillIndexStatus() {
+    public List<Integer> initWaybillIndexStatus() {
         List<Integer> statuses = new ArrayList<>();
         statuses.add(CarWaybillEnum.PENDING_ORDER.getCode());
         statuses.add(CarWaybillEnum.PENDING_VEHICLE.getCode());
@@ -465,6 +466,7 @@ public class WaybillManagementService {
 
     /**
      * 运单看板 查询条件构造
+     *
      * @param query
      * @return
      */
@@ -477,14 +479,13 @@ public class WaybillManagementService {
         if (CollectionUtils.isNotEmpty(wOrderIds)) {
             Criteria.where("wOrderId").in(wOrderIds);
         }
-        if (StringUtils.isNotBlank(query.getStatus())){
+        if (StringUtils.isNotBlank(query.getStatus())) {
             if (query.getStatus().equals(String.valueOf(CarWaybillEnum.COMPLETION_UNLOADING.getCode()))) {
                 List<Integer> _statuses = new ArrayList<>();
                 _statuses.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
                 _statuses.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode());
                 criteria.and("status").in(_statuses);
-            }
-            if (!query.getStatus().equals("all")) {
+            } else if (!query.getStatus().equals("all") && (!query.getStatus().equals(String.valueOf(CarWaybillEnum.COMPLETION_UNLOADING.getCode())))) {
                 criteria.and("status").is(Integer.valueOf(query.getStatus()));
             }
         }
@@ -513,6 +514,7 @@ public class WaybillManagementService {
         } else if (Objects.nonNull(query.getEndUnloadTime())) {
             criteria.and("unloadTime").lte(DateUtil.offsetDay(query.getEndUnloadTime(), 1));
         }
+
         // 装货地址
         String loadCode = query.getLoadCityCode();
         if (StringUtils.isNotBlank(loadCode)) {
@@ -524,6 +526,7 @@ public class WaybillManagementService {
                 case 3 -> criteria.and("loadCityCode").is(loadCode);
             }
         }
+
         // 卸货地址
         String unloadCode = query.getUnloadCityCode();
         if (StringUtils.isNotBlank(unloadCode)) {
@@ -535,6 +538,7 @@ public class WaybillManagementService {
                 case 3 -> criteria.and("unloadCityCode").is(unloadCode);
             }
         }
+
         // 多条件模糊查询
         List<Criteria> orCriteria = new ArrayList<>();
         if (StringUtils.isNotBlank(query.getKeywords())) {
@@ -549,11 +553,12 @@ public class WaybillManagementService {
     }
 
     /**
-     *  运单看板TOP
+     * 运单看板TOP
+     *
      * @param query
      * @return
      */
-    public HttpResult waybillIndexStatistics(WaybillOrderDTO query){
+    public HttpResult waybillIndexStatistics(WaybillOrderDTO query) {
         List<Integer> statuses = initWaybillIndexStatus();
         Criteria criteria = buildWaybillIndexQuery(query);
         Aggregation aggregation = Aggregation.newAggregation(
@@ -577,9 +582,9 @@ public class WaybillManagementService {
             top.setName(CarWaybillEnum.getName(e));
             listMap.put(String.valueOf(e), top);
         });
-        if(CollectionUtils.isNotEmpty(results)) {
-            for(TableTops result: results) {
-                if(listMap.containsKey(result.getValue())) {
+        if (CollectionUtils.isNotEmpty(results)) {
+            for (TableTops result : results) {
+                if (listMap.containsKey(result.getValue())) {
                     listMap.get(result.getValue()).setTotal(result.getTotal());
                 }
                 allTotal += result.getTotal();
@@ -591,10 +596,11 @@ public class WaybillManagementService {
 
     /**
      * app 运单分类统计数据 [运输中|已完成]
+     *
      * @param keyword
      * @return
      */
-    public HttpResult waybillDataStatisticApp(String keyword){
+    public HttpResult waybillDataStatisticApp(String keyword) {
         Long entId = LoginUserHolder.getEntId();
         // 运输途中
         Map<String, String> _onway = new HashMap<>();
@@ -620,10 +626,11 @@ public class WaybillManagementService {
 
     /**
      * app 运单列表 [运输中|已完成]
+     *
      * @param query
      * @return
      */
-    public HttpResult waybillDataApp(WaybillListAppDTO query){
+    public HttpResult waybillDataApp(WaybillListAppDTO query) {
         List<Integer> processStatuses = initWaybillIndexStatus();
         List<Long> _statuses = getWallBillStatues(query.getStatus());
         Criteria criteria = new Criteria();
@@ -669,12 +676,13 @@ public class WaybillManagementService {
 
     /**
      * app 运单分类吨量统计数据 [运输中|已完成]
+     *
      * @param query
      * @return
      */
-    public HttpResult waybillAmountStatistic(WaybillListAppDTO query){
+    public HttpResult waybillAmountStatistic(WaybillListAppDTO query) {
         List<Long> _statuses = getWallBillStatues(query.getStatus());
-        Map<String,Object> amount = kwtWaybillOrderMapper.selectWaybillOrderAmountByStatus(
+        Map<String, Object> amount = kwtWaybillOrderMapper.selectWaybillOrderAmountByStatus(
                 LoginUserHolder.getEntId(),
                 _statuses,
                 query.getKeyword(),
@@ -686,12 +694,13 @@ public class WaybillManagementService {
 
     /**
      * 获取 [运输中|已完成] 状态列表
+     *
      * @param status
      * @return
      */
     public List<Long> getWallBillStatues(String status) {
         List<Long> _list = new ArrayList<>();
-        if(status.equals("onway")) {
+        if (status.equals("onway")) {
             _list.add(CarWaybillEnum.PENDING_ORDER.getCode().longValue());
             _list.add(CarWaybillEnum.PENDING_VEHICLE.getCode().longValue());
             _list.add(CarWaybillEnum.EXIT_COMPLETED.getCode().longValue());
@@ -699,7 +708,7 @@ public class WaybillManagementService {
             _list.add(CarWaybillEnum.COMPLETION_LOADING.getCode().longValue());
             _list.add(CarWaybillEnum.WAIT_UNLOADING.getCode().longValue());
         }
-        if(status.equals("finish")) {
+        if (status.equals("finish")) {
             _list.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode().longValue());
             _list.add(CarWaybillEnum.APPROVAL_PASS.getCode().longValue());
         }
@@ -713,7 +722,7 @@ public class WaybillManagementService {
      **/
     public AddressDropListDTO findAddressList() {
         AddressDropListDTO res = new AddressDropListDTO();
-       //装货地址树
+        //装货地址树
         List<Integer> loadAddressList = kwtWaybillOrderAddressMapper.findAddressCodeList(LoginUserHolder.getEntId(), Global.NUMERICAL_ONE);
         //卸货地址树
         List<Integer> unloadAddressList = kwtWaybillOrderAddressMapper.findAddressCodeList(LoginUserHolder.getEntId(), Global.NUMERICAL_TWO);

+ 24 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/dubbo/TransportDubboServiceImpl.java

@@ -18,6 +18,9 @@ import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.mongo.enums.BusinessTypeEnum;
 import com.sckw.mongo.model.SckwLogisticsOrder;
+import com.sckw.order.api.dubbo.TradeOrderInfoService;
+import com.sckw.order.api.model.OrderDetailRes;
+import com.sckw.order.api.model.UnitInfoDetailRes;
 import com.sckw.redis.constant.RedisConstant;
 import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.stream.model.SckwBusSum;
@@ -62,6 +65,9 @@ public class TransportDubboServiceImpl implements TransportDubboService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     RemoteSystemService remoteSystemService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
+    private TradeOrderInfoService tradeOrderInfoService;
+
     @Autowired
     private KwtLogisticsOrderMapper logisticsOrderMapper;
 
@@ -121,6 +127,24 @@ public class TransportDubboServiceImpl implements TransportDubboService {
         Map<String, String> taxRateTypeDictData = getDictData(DictTypeEnum.TAX_RATE_TYPE.getType());
         if (CollectionUtils.isNotEmpty(list)) {
             for (LogisticsOrderDTO logisticsOrderDTO : list) {
+                String tOrderId = logisticsOrderDTO.getTOrderId();
+                if (StringUtils.isNotBlank(tOrderId)) {
+                    OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
+                    if (orderDetailById != null) {
+                        List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
+                        if (CollectionUtils.isNotEmpty(unitInfo)){
+                            for (UnitInfoDetailRes detailRes : unitInfo) {
+                                if ("1".equals(detailRes.getUnitType())){
+                                    logisticsOrderDTO.setConsignee(detailRes.getFirmName());
+                                }
+                                if ("2".equals(detailRes.getUnitType())){
+                                    logisticsOrderDTO.setForwardingUnit(detailRes.getFirmName());
+                                }
+                            }
+                        }
+                    }
+                }
+
                 KwtLogisticsOrderUnit consignOrderUnit = logisticsOrderUnitMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderUnit>()
                         .eq(KwtLogisticsOrderUnit::getLOrderId, logisticsOrderDTO.getLOrderId())
                         .eq(KwtLogisticsOrderUnit::getUnitType, NumberConstant.ONE));