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

update 修改运单统计分类查询状态

chenlin 2 лет назад
Родитель
Сommit
097f8d0989

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

@@ -202,6 +202,11 @@ public class KwTransportService {
                 statuses.add(CarWaybillEnum.REVOKED.getCode().longValue());
                 statuses.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode().longValue());
                 criteria.and("status").in(statuses);
+            } else if (query.getStatus().equals(String.valueOf(CarWaybillEnum.COMPLETION_UNLOADING.getCode()))) {
+                List<Long> statuses = new ArrayList<>();
+                statuses.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode().longValue());
+                statuses.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode().longValue());
+                criteria.and("status").in(statuses);
             } else if (!query.getStatus().equals("all")) {
                 criteria.and("status").is(Integer.valueOf(query.getStatus()));
             }

+ 6 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/WayBillDetailDTO.java

@@ -146,10 +146,15 @@ public class WayBillDetailDTO{
     private String unloadDetailAddress;
 
     /**
-     * 承运企业
+     * 托运企业名称
      */
     private String checkFirmName;
 
+    /**
+     * 承运企业
+     */
+    private String carrierFirmName;
+
     /**
      * 运单状态
      */

+ 11 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/WaybillTicketVO.java

@@ -38,4 +38,15 @@ public class WaybillTicketVO {
      * 卸货重量
      */
     private String unloadWeight;
+
+    /**
+     * 亏吨重量
+     */
+    private String deficitAmount;
+
+    /**
+     * 扣亏量(合理损耗-(实装-实卸))-单位
+     */
+    private String deficitRealAmount;
+
 }

+ 30 - 14
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/WaybillManagementService.java

@@ -116,6 +116,8 @@ public class WaybillManagementService {
             wayBillDetailDTO.setUnloadDetailAddress(info.getUnloadCityName().concat(info.getUnloadDetailAddress()));
             wayBillDetailDTO.setLoadName(info.getLoadName());
             wayBillDetailDTO.setUnloadName(info.getUnloadName());
+            wayBillDetailDTO.setCarrierFirmName(info.getCarrierFirmName());
+            wayBillDetailDTO.setCheckFirmName(info.getCheckFirmName());
             // 计费方式
             KwtLogisticsOrder kwtLogisticsOrder = kwtLogisticsOrderMapper.selectById(info.getLOrderId());
             if(!ObjectUtils.isEmpty(kwtLogisticsOrder)) {
@@ -150,9 +152,15 @@ public class WaybillManagementService {
             waybillTicketVO.setUnloadTime(DateUtil.getDateTime(info.getUnloadTime()));
             waybillTicketVO.setUnloadWeight(String.valueOf(info.getUnloadAmount()));
             waybillTicketVO.setUnloadUrl(String.valueOf(info.getUnloadUrls()));
+            waybillTicketVO.setDeficitAmount(String.valueOf(info.getDeficitAmount()));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) {
+                deficitRealAmount = deficitLoss.subtract(deficitAmount);
+            }
+            waybillTicketVO.setDeficitRealAmount(deficitRealAmount.toString());
 //            waybillBoardListVO.setLoadUrls(sckwWaybillOrder.getLoadUrls() != null ? FileUtils.getOSSAddressPrefix() + sckwWaybillOrder.getLoadUrls() : null);
 //            waybillBoardListVO.setUnloadUrls(sckwWaybillOrder.getUnloadUrls() != null ? FileUtils.getOSSAddressPrefix() + sckwWaybillOrder.getUnloadUrls() : null);
-
         }
         List<Integer> statuses = initWaybillIndexStatus();
         // 初始化各状态
@@ -293,7 +301,7 @@ public class WaybillManagementService {
             statusVOS.add(waybillStatusVO);
         });
 
-        Criteria criteria = buildWaybillIndexQuery(query, statuses);
+        Criteria criteria = buildWaybillIndexQuery(query);
         Query queryFormat = new Query(criteria);
         long total = mongoTemplate.count(queryFormat, SckwWaybillOrder.class);
         queryFormat.with(PageRequest.of(query.getPage() - 1, query.getPageSize(),
@@ -391,10 +399,9 @@ public class WaybillManagementService {
     /**
      * 运单看板 查询条件构造
      * @param query
-     * @param statuses
      * @return
      */
-    public Criteria buildWaybillIndexQuery(WaybillOrderDTO query,List<Integer> statuses) {
+    public Criteria buildWaybillIndexQuery(WaybillOrderDTO query) {
         Criteria criteria = new Criteria();
         criteria.and("entId").is(LoginUserHolder.getEntId());
         criteria.and("delFlag").is(NumberConstant.ZERO);
@@ -403,12 +410,18 @@ public class WaybillManagementService {
         if (CollectionUtils.isNotEmpty(wOrderIds)) {
             Criteria.where("wOrderId").in(wOrderIds);
         }
-
-        if (StringUtils.isNotBlank(query.getStatus()) && !query.getStatus().equals("all")) {
-            criteria.and("status").is(Integer.valueOf(query.getStatus()));
-        } else {
-            criteria.and("status").in(statuses);
+        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")) {
+                criteria.and("status").is(Integer.valueOf(query.getStatus()));
+            }
         }
+
         // 装载时间
         if (Objects.nonNull(query.getStartLoadTime()) && Objects.nonNull(query.getEndLoadTime())) {
             criteria.and("loadTime").gte(query.getStartLoadTime()).lte(DateUtil.offsetDay(query.getEndLoadTime(), 1));
@@ -475,7 +488,7 @@ public class WaybillManagementService {
      */
     public HttpResult waybillIndexStatistics(WaybillOrderDTO query){
         List<Integer> statuses = initWaybillIndexStatus();
-        Criteria criteria = buildWaybillIndexQuery(query, statuses);
+        Criteria criteria = buildWaybillIndexQuery(query);
         Aggregation aggregation = Aggregation.newAggregation(
                 Aggregation.match(criteria),
                 Aggregation.group("status").count().as("total"),
@@ -483,12 +496,12 @@ public class WaybillManagementService {
         );
         AggregationResults<TableTops> outputTypeCount = mongoTemplate.aggregate(aggregation, SckwWaybillOrder.class, TableTops.class);
         List<TableTops> results = outputTypeCount.getMappedResults();
-
+        Integer allTotal = 0;
         Map<String, TableTops> listMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         TableTops topTotal = new TableTops();
         topTotal.setName("全部");
         topTotal.setValue("all");
-        topTotal.setTotal(0);
+        topTotal.setTotal(allTotal);
         listMap.put("all", topTotal);
         statuses.forEach(e -> {
             TableTops top = new TableTops();
@@ -499,10 +512,13 @@ public class WaybillManagementService {
         });
         if(CollectionUtils.isNotEmpty(results)) {
             for(TableTops result: results) {
-                listMap.get(result.getValue()).setTotal(result.getTotal());
+                if(listMap.containsKey(result.getValue())) {
+                    listMap.get(result.getValue()).setTotal(result.getTotal());
+                }
+                allTotal += result.getTotal();
             }
         }
-        listMap.get("all").setTotal(listMap.values().parallelStream().mapToInt(e -> e.getTotal()).sum());
+        listMap.get("all").setTotal(allTotal);
         return HttpResult.ok(listMap.values());
     }