Parcourir la source

运单管理/运单看板bugfixSAS-929
运单管理/运单列表bugfixSAS-929

lengfaqiang il y a 2 ans
Parent
commit
8873bfd987

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

@@ -1005,6 +1005,7 @@ public class AcceptCarriageOrderService {
                         driverListVo.setTransportStatusLabel((driverListVo.getTransportStatus() == 0) ? "空闲" : "任务中");
                     }
                     driverListVo.setCarType(truck.get(driverListVo.getTruckNo()) == null ? null : truck.get(driverListVo.getTruckNo()).getTruckType());
+//                    driverListVo.setCount(truck.get(driverListVo.getTruckNo()) == null ? null : truck.get(driverListVo.getTruckNo()).getTotalComplete());
                 }
             }
             result.setData(list);

+ 41 - 35
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/WaybillManagementService.java

@@ -94,7 +94,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()));
@@ -123,22 +123,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()));
@@ -149,12 +149,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()));
@@ -163,7 +163,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());
@@ -189,9 +189,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()));
@@ -226,10 +226,11 @@ public class WaybillManagementService {
 
     /**
      * 简洁版运单详情
+     *
      * @param id
      * @return
      */
-    public HttpResult waybillSimpleData(Long id){
+    public HttpResult waybillSimpleData(Long id) {
         WaybillSimpleDataVO waybillSimpleDataVO = new WaybillSimpleDataVO();
         Criteria criteria = new Criteria();
         criteria.and("wOrderId").is(id);
@@ -237,7 +238,7 @@ public class WaybillManagementService {
         criteria.and("delFlag").is(NumberConstant.ZERO);
         Query queryFormat = new Query(criteria);
         SckwWaybillOrder info = mongoTemplate.findOne(queryFormat, SckwWaybillOrder.class);
-        if(!ObjectUtils.isEmpty(info)) {
+        if (!ObjectUtils.isEmpty(info)) {
             waybillSimpleDataVO.setWOrderId(info.getWOrderId() == null ?
                     String.valueOf(info.get_id()) : String.valueOf(info.getWOrderId()));
             waybillSimpleDataVO.setWOrderNo(info.getWOrderNo());
@@ -289,8 +290,10 @@ public class WaybillManagementService {
         waybillSimpleDataVO.setProcess(statusVOS);
         return HttpResult.ok(waybillSimpleDataVO);
     }
+
     /**
      * 运单看板列表
+     *
      * @param query
      * @return
      * @throws Exception
@@ -323,12 +326,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()));
@@ -374,11 +376,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()));
                         }
                     });
@@ -389,10 +391,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());
@@ -407,6 +408,7 @@ public class WaybillManagementService {
 
     /**
      * 运单看板 查询条件构造
+     *
      * @param query
      * @return
      */
@@ -419,14 +421,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()));
             }
         }
@@ -491,11 +492,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(
@@ -519,9 +521,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();
@@ -533,10 +535,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<>();
@@ -562,10 +565,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();
@@ -611,12 +615,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(),
@@ -628,12 +633,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());
@@ -641,7 +647,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());
         }
@@ -655,7 +661,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);

+ 19 - 6
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -457,7 +457,8 @@
     </select>
 
     <select id="selectDriverListById" resultType="com.sckw.transport.model.vo.DriverListVo">
-        SELECT a.id AS lOrderId,
+        SELECT COUNT( b.truck_no ) AS count,
+        a.id AS lOrderId,
         a.l_order_no AS lOrderNo,
         b.driver_id AS driverId,
         b.id AS wOrderId,
@@ -466,11 +467,23 @@
         b.driver_phone AS driverPhone,
         b.driver_idcard AS driverIdCard,
         b.truck_no AS truckNo
+        FROM
+        kwt_waybill_order b
+        LEFT JOIN kwt_logistics_order a ON b.l_order_id = a.id
+        <!--        SELECT a.id AS lOrderId,-->
+        <!--        a.l_order_no AS lOrderNo,-->
+        <!--        b.driver_id AS driverId,-->
+        <!--        b.id AS wOrderId,-->
+        <!--        b.w_order_no AS wOrderNo,-->
+        <!--        b.driver_name AS driverName,-->
+        <!--        b.driver_phone AS driverPhone,-->
+        <!--        b.driver_idcard AS driverIdCard,-->
+        <!--        b.truck_no AS truckNo-->
         <!--        ,-->
         <!--        COUNT( b.id ) AS count-->
-        FROM
-        kwt_waybill_order b,
-        kwt_logistics_order a
+<!--        FROM-->
+<!--        kwt_waybill_order b,-->
+<!--        kwt_logistics_order a-->
         <where>
             a.id = b.l_order_id
             AND a.del_flag = 0
@@ -493,8 +506,8 @@
                 </if>
                 )
             </if>
-            <!--        GROUP BY-->
-            <!--        b.truck_no-->
+            GROUP BY
+            b.truck_no
             <!--        a.l_order_no,-->
         </where>
     </select>