chenlin 2 лет назад
Родитель
Сommit
27cae958b8

+ 1 - 1
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java

@@ -251,7 +251,7 @@ public class KwTransportService {
         List<TableTops> list = new ArrayList<>();
         TableTops topTotal = new TableTops();
         topTotal.setName("全部");
-        topTotal.setValue(null);
+        topTotal.setValue("all");
         topTotal.setTotal(0);
         list.add(topTotal);
 

+ 8 - 8
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/WaybillManagementController.java

@@ -9,10 +9,10 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
 
 
 /**
@@ -40,8 +40,8 @@ public class WaybillManagementController {
         }
     }
 
-    @RequestMapping(name = "运单看板", value = "/waybillIndex", method = RequestMethod.GET)
-    public HttpResult waybillIndex(WaybillOrderDTO waybillOrderDTO) {
+    @RequestMapping(name = "运单看板", value = "/waybillIndex", method = RequestMethod.POST)
+    public HttpResult waybillIndex(@Validated @RequestBody WaybillOrderDTO waybillOrderDTO) {
         try {
             return waybillManagementService.waybillIndex(waybillOrderDTO);
         } catch (Exception e) {
@@ -50,8 +50,8 @@ public class WaybillManagementController {
         }
     }
 
-    @RequestMapping(name = "运单看板TOP", value = "/waybillIndexStatistics", method = RequestMethod.GET)
-    public HttpResult waybillIndexStatistics(WaybillOrderDTO waybillOrderDTO) {
+    @RequestMapping(name = "运单看板TOP", value = "/waybillIndexStatistics", method = RequestMethod.POST)
+    public HttpResult waybillIndexStatistics(@Validated @RequestBody WaybillOrderDTO waybillOrderDTO) {
         try {
             return waybillManagementService.waybillIndexStatistics(waybillOrderDTO);
         } catch (Exception e) {

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

@@ -81,7 +81,7 @@ public class WaybillManagementService {
      * @param id
      * @return
      */
-    public HttpResult waybillData(@Param("id") Long id) {
+    public HttpResult waybillData(Long id) {
         WaybillDataVO waybillDataVO = new WaybillDataVO();
         Criteria criteria = new Criteria();
         criteria.and("wOrderId").is(id);
@@ -118,10 +118,9 @@ public class WaybillManagementService {
             waybillCarVO.setDriverPhone(info.getDriverPhone());
             List<String> list = new ArrayList<>();
             list.add(info.getTruckNo());
-//            Map<String, RTruckVo> trucks = remoteFleetService.findTruck(list);
-            Map<String, RTruckVo> trucks = new HashMap<>();
+            Map<String, RTruckVo> trucks = remoteFleetService.findTruck(list);
             if (CollectionUtils.isNotEmpty(trucks)) {
-                waybillCarVO.setTrailerNo(trucks.get(0).getTrailerNo());
+                waybillCarVO.setTrailerNo(trucks.get(info.getTruckNo()) != null ? trucks.get(info.getTruckNo()).getTrailerNo() : null);
             }
             // 票据
             waybillTicketVO.setLoadTime(DateUtil.getDateTime(info.getLoadTime()));
@@ -138,15 +137,7 @@ public class WaybillManagementService {
             WaybillStatusVO waybillStatusVO = new WaybillStatusVO();
             waybillStatusVO.setStatus(false);
             waybillStatusVO.setCode(e);
-            switch (e){
-                case 2 -> waybillStatusVO.setDestination("已接单");
-                case 3 -> waybillStatusVO.setDestination("已出车");
-                case 4 -> waybillStatusVO.setDestination("到达装货地");
-                case 5 -> waybillStatusVO.setDestination("已装货");
-                case 6 -> waybillStatusVO.setDestination("到达卸货点");
-                case 7 -> waybillStatusVO.setDestination("已卸货");
-                case 8 -> waybillStatusVO.setDestination("已核单");
-            }
+            waybillStatusVO.setDestination(CarWaybillEnum.getName(e));
             statusVOS.add(waybillStatusVO);
         });
         List<KwtWaybillOrderTrack> kwtWaybillOrderTracks = kwtWaybillOrderTrackMapper.selectList(new LambdaQueryWrapper<KwtWaybillOrderTrack>()
@@ -155,8 +146,7 @@ public class WaybillManagementService {
         if (CollectionUtils.isNotEmpty(kwtWaybillOrderTracks)) {
             List<Long> userIds = new ArrayList<>();
             kwtWaybillOrderTracks.forEach(e -> userIds.add(e.getCreateBy()));
-//            List<UserCacheResDto> users = remoteSystemService.queryUserCacheByIds(userIds);
-            List<UserCacheResDto> users = new ArrayList<>();
+            List<UserCacheResDto> users = remoteSystemService.queryUserCacheByIds(userIds);
             Map<Long, String> usersMap = new HashMap<>();
             users.forEach(e -> usersMap.put(e.getId(), e.getName()));
             for (KwtWaybillOrderTrack kwtWaybillOrderTrack: kwtWaybillOrderTracks) {
@@ -165,7 +155,8 @@ public class WaybillManagementService {
                         statusVO.setStatus(true);
                         statusVO.setId(kwtWaybillOrderTrack.getId());
                         statusVO.setCreateTime(DateUtil.getDateTime(kwtWaybillOrderTrack.getCreateTime()));
-                        statusVO.setCreateByName(usersMap.get(kwtWaybillOrderTrack.getCreateBy()));
+                        statusVO.setCreateByName(usersMap.get(kwtWaybillOrderTrack.getCreateBy()) == null
+                                ? null : usersMap.get(kwtWaybillOrderTrack.getCreateBy()));
                         break;
                     }
                 }
@@ -173,7 +164,8 @@ public class WaybillManagementService {
                 waybillTrackVO.setId(String.valueOf(kwtWaybillOrderTrack.getId()))
                         .setRemark(kwtWaybillOrderTrack.getRemark())
                         .setStatus(String.valueOf(kwtWaybillOrderTrack.getStatus()))
-                        .setCreateBy(usersMap.get(String.valueOf(kwtWaybillOrderTrack.getCreateBy())))
+                        .setCreateBy(usersMap.get(kwtWaybillOrderTrack.getCreateBy()) == null
+                                ? null : usersMap.get(kwtWaybillOrderTrack.getCreateBy()))
                         .setCreateTime(DateUtil.getDateTime(kwtWaybillOrderTrack.getCreateTime()));
                 waybillTrackVOS.add(waybillTrackVO);
             }
@@ -203,15 +195,7 @@ public class WaybillManagementService {
             WaybillStatusVO waybillStatusVO = new WaybillStatusVO();
             waybillStatusVO.setStatus(false);
             waybillStatusVO.setCode(e);
-            switch (e){
-                case 2 -> waybillStatusVO.setDestination("司机接单");
-                case 3 -> waybillStatusVO.setDestination("出车");
-                case 4 -> waybillStatusVO.setDestination("到装货地");
-                case 5 -> waybillStatusVO.setDestination("装货");
-                case 6 -> waybillStatusVO.setDestination("到卸货地");
-                case 7 -> waybillStatusVO.setDestination("卸货");
-                case 8 -> waybillStatusVO.setDestination("核单");
-            }
+            waybillStatusVO.setDestination(CarWaybillEnum.getName(e));
             statusVOS.add(waybillStatusVO);
         });
 
@@ -255,8 +239,7 @@ public class WaybillManagementService {
             if (CollectionUtils.isNotEmpty(kwtWaybillOrderTracks)) {
                 List<Long> userIds = new ArrayList<>();
                 kwtWaybillOrderTracks.forEach(e -> userIds.add(e.getCreateBy()));
-//                List<UserCacheResDto> users = remoteSystemService.queryUserCacheByIds(userIds);
-                List<UserCacheResDto> users = new ArrayList<>();
+                List<UserCacheResDto> users = remoteSystemService.queryUserCacheByIds(userIds);
                 Map<Long, String> usersMap = new HashMap<>();
                 users.forEach(e -> usersMap.put(e.getId(), e.getName()));
                 waybillBoardListVO.getTracks().forEach(e -> {
@@ -265,7 +248,7 @@ public class WaybillManagementService {
                             e.setStatus(true);
                             e.setId(e2.getId());
                             e.setCreateTime(DateUtil.getDateTime(e2.getCreateTime()));
-                            e.setCreateByName(usersMap.get(e2.getCreateBy()));
+                            e.setCreateByName(usersMap.get(e2.getCreateBy()) == null ? null : usersMap.get(e2.getCreateBy()));
                         }
                     });
                 });
@@ -309,7 +292,7 @@ public class WaybillManagementService {
             Criteria.where("wOrderId").in(wOrderIds);
         }
 
-        if (StringUtils.isNotBlank(query.getStatus())) {
+        if (StringUtils.isNotBlank(query.getStatus()) && !query.getStatus().equals("all")) {
             criteria.and("status").is(query.getStatus());
         } else {
             criteria.and("status").in(statuses);
@@ -376,22 +359,14 @@ public class WaybillManagementService {
         Map<String, TableTops> listMap = new HashMap<>();
         TableTops topTotal = new TableTops();
         topTotal.setName("全部");
-        topTotal.setValue("");
+        topTotal.setValue("all");
         topTotal.setTotal(0);
         listMap.put("", topTotal);
         statuses.forEach(e -> {
             TableTops top = new TableTops();
             top.setValue(String.valueOf(e));
             top.setTotal(0);
-            switch (e){
-                case 2 -> top.setName("司机接单");
-                case 3 -> top.setName("出车");
-                case 4 -> top.setName("到装货地");
-                case 5 -> top.setName("装货");
-                case 6 -> top.setName("到卸货地");
-                case 7 -> top.setName("卸货");
-                case 8 -> top.setName("核单");
-            }
+            top.setName(CarWaybillEnum.getName(e));
             listMap.put(String.valueOf(e), top);
         });
         if(CollectionUtils.isNotEmpty(results)) {
@@ -399,7 +374,7 @@ public class WaybillManagementService {
                 listMap.get(result.getValue()).setTotal(result.getTotal());
             }
         }
-        listMap.get("").setTotal(listMap.values().parallelStream().mapToInt(e -> e.getTotal()).sum());
+        listMap.get("all").setTotal(listMap.values().parallelStream().mapToInt(e -> e.getTotal()).sum());
         return HttpResult.ok(listMap.values());
     }
 }