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

Merge remote-tracking branch 'origin/dev' into dev

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

+ 12 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckReportController.java

@@ -96,6 +96,18 @@ public class KwfTruckReportController {
         return HttpResult.ok(reportService.findList(params));
     }
 
+    /**
+     * @param params {。。。}
+     * @desc 上报车辆业务状态统计
+     * @author zk
+     * @date 2023/7/6
+     **/
+    @PostMapping("/busStatusStatistics")
+    public HttpResult busStatusStatistics(@RequestBody HashMap params) throws SystemException {
+        params.put("entId", LoginUserHolder.getEntId());
+        return HttpResult.ok(reportService.busStatusStatistics(params));
+    }
+
     /**
      * @param file 导入文件
      * @description 导入

+ 9 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTableTopCount.java

@@ -23,4 +23,13 @@ public class KwfTableTopCount {
      * 统计值
      */
     private long total;
+
+    public KwfTableTopCount() {
+    }
+
+    public KwfTableTopCount(String name, String value, long total) {
+        this.name = name;
+        this.value = value;
+        this.total = total;
+    }
 }

+ 28 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckReportService.java

@@ -3,10 +3,7 @@ package com.sckw.fleet.service;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
-import com.sckw.core.utils.BeanUtils;
-import com.sckw.core.utils.CollectionUtils;
-import com.sckw.core.utils.RegularUtils;
-import com.sckw.core.utils.StringUtils;
+import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
@@ -29,6 +26,7 @@ import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.multipart.MultipartFile;
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -173,6 +171,32 @@ public class KwfTruckReportService {
         return HttpResult.ok(truckReportDao.findList(params));
     }
 
+    /**
+     * @param params {。。。}
+     * @desc 上报车辆业务状态统计
+     * @author zk
+     * @date 2023/7/6
+     **/
+    public HttpResult busStatusStatistics(@RequestBody HashMap params) throws SystemException {
+        params.put("entId", LoginUserHolder.getEntId());
+        List<Map<String, Object>> trucks = truckReportDao.findList(params);
+        /**全部数据-处理**/
+        List<KwfTableTopCount> countList = new ArrayList();
+        countList.add(new KwfTableTopCount("全部", null, trucks != null ? trucks.size() : 0));
+
+        //状态数据计算
+        int idle = 0;
+        for (Map<String, Object> truck:trucks) {
+            Object obj = truck.get("businessStatus");
+            if (StringUtils.isNotBlank(obj) && NumberUtils.parseInt(obj) == 0) {
+                idle ++;
+            }
+        }
+        countList.add(new KwfTableTopCount("空闲", String.valueOf(0), idle));
+        countList.add(new KwfTableTopCount("任务", String.valueOf(1), trucks != null ? (trucks.size() - idle) : 0));
+        return HttpResult.ok(countList);
+    }
+
     /**
      * @param {}
      * @description 导出