zk 2 лет назад
Родитель
Сommit
dad8c6d24a

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

@@ -20,6 +20,7 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author zk
@@ -123,4 +124,15 @@ public class KwfFleetController {
     public HttpResult del(@RequestParam String ids) throws SystemException {
         return fleetService.del(ids);
     }
+
+    /**
+     * @param params {entId 企业ID, fleetName 车队班组名称}
+     * @desc 车辆实况统计
+     * @author zk
+     * @date 2023/8/4
+     **/
+    @PostMapping("/findTruckList")
+    public HttpResult findTruckList(@RequestBody Map params) throws SystemException {
+        return HttpResult.ok(fleetService.findTruckList(params));
+    }
 }

+ 8 - 21
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -271,19 +271,6 @@ public class KwfTruckController {
                 put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);}});
         }
 
-        for (int i=0; i<5; i++) {
-            int index1 = i;
-            for (int j=0; j<10; j++) {
-                int aaa = new Random().nextInt(10) / 3;
-                int bbb = new Random().nextInt(10) / 4;
-                data.add(new HashMap(){{put("truckNo", "川A"+new Random().nextInt(100000));
-                    put("entId", "1000000" + index1);
-                    put("firmName", "物流企业"+ index1);
-                    put("businessStatus", aaa == 0 ? 0 : 1);
-                    put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);}});
-            }
-        }
-
         return HttpResult.ok(data);
     }
 
@@ -306,8 +293,8 @@ public class KwfTruckController {
             data.add(new HashMap(){{
                 put("truckNo", truckNo);
                 put("speed", new Random().nextInt(100));
-                put("lat", "30.58"+new Random().nextInt(10000));
-                put("lng", "104.06"+new Random().nextInt(10000));
+                put("lat", "29.48"+new Random().nextInt(10000));
+                put("lng", "103.53"+new Random().nextInt(10000));
                 put("businessStatus", aaa == 0 ? 0 : 1);
                 put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);
                 put("gpsTime", DateUtils.getCurrentTime());}});
@@ -326,7 +313,7 @@ public class KwfTruckController {
         Long hours = (params.getEndTime().getTime() - params.getStartTime().getTime()) /1000/60;
         List data = new ArrayList();
         data.add(new HashMap(){{put("truckNo", params.getTruckNo()); put("speed", 95.0);
-            put("lng", "30.60513"); put("lat", "104.05079");
+            put("lng", "103.53"); put("lat", "29.48");
             put("gpsTime", DateUtils.format(params.getStartTime(), DateUtils.DATE_TIME_PATTERN));}});
         for (long i=0; i<hours; i++) {
             int aaa = new Random().nextInt(10) / 3;
@@ -334,14 +321,14 @@ public class KwfTruckController {
             data.add(new HashMap(){{
                 put("truckNo", params.getTruckNo());
                 put("speed", new Random().nextInt(100));
-                put("lat", "30.58"+new Random().nextInt(10000));
-                put("lng", "104.06"+new Random().nextInt(10000));
+                put("lat", "29.48"+new Random().nextInt(10000));
+                put("lng", "103.53"+new Random().nextInt(10000));
                 put("businessStatus", aaa == 0 ? 0 : 1);
                 put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);
                 put("gpsTime", DateUtils.getCurrentTime());}});
         }
         data.add(new HashMap(){{put("truckNo", params.getTruckNo()); put("speed", 95.0);
-            put("lat", "29.524931"); put("lng", "103.734587");
+            put("lat", "29.48"); put("lng", "103.53");
             put("gpsTime", DateUtils.format(params.getEndTime(), DateUtils.DATE_TIME_PATTERN));}});
         return HttpResult.ok(data);
     }
@@ -360,8 +347,8 @@ public class KwfTruckController {
         detail.put("driverPhone", "17358629955");
         detail.put("firmName", "东旭物流有限公司");
         detail.put("detailAddress", "四川省成都市xxx路10号");
-        detail.put("lat", "30.58"+new Random().nextInt(10000));
-        detail.put("lng", "104.06"+new Random().nextInt(10000));
+        detail.put("lat", "29.48"+new Random().nextInt(10000));
+        detail.put("lng", "103.53"+new Random().nextInt(10000));
         detail.put("speed", new Random().nextInt(100));
         detail.put("gpsTime", DateUtils.getCurrentTime());
         return HttpResult.ok(detail);

+ 8 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfFleetMapper.java

@@ -2,6 +2,7 @@ package com.sckw.fleet.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.fleet.model.KwfFleet;
+import com.sckw.fleet.model.vo.KwfFleetTruckCountVo;
 import com.sckw.fleet.model.vo.KwfFleetVo;
 import org.apache.ibatis.annotations.Mapper;
 import java.util.List;
@@ -28,4 +29,11 @@ public interface KwfFleetMapper extends BaseMapper<KwfFleet> {
      * @return
      */
     List<Map<String, Object>> findList(Map<String, Object> params);
+
+    /**
+     * 车辆实况统计
+     * @param params {entId 企业ID, fleetName 车队班组名称}
+     * @return
+     */
+    List<KwfFleetTruckCountVo> findTruckList(Map<String, Object> params);
 }

+ 39 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfFleetTruckCountVo.java

@@ -0,0 +1,39 @@
+package com.sckw.fleet.model.vo;
+
+import com.sckw.core.model.constant.Global;
+import lombok.Data;
+
+/**
+ * @author zk
+ * @desc 运力统计
+ * @date 2023/8/4 0004
+ */
+@Data
+public class KwfFleetTruckCountVo {
+
+    /**
+     * 车队名称
+     */
+    private String fleetName;
+
+    /**
+     * 空闲
+     */
+    private Integer idleTotal = Global.NUMERICAL_ZERO;
+
+    /**
+     * 任务中
+     */
+    private Integer busyTotal = Global.NUMERICAL_ZERO;
+
+    /**
+     * 车队数量
+     */
+    private Integer fleetTotal = Global.NUMERICAL_ZERO;
+
+    /**
+     * 车辆数
+     */
+    private Integer truckTotal = Global.NUMERICAL_ZERO;
+
+}

+ 1 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -331,6 +331,7 @@ public class KwfDriverService {
             params.setPassword(password);
             params.setEntId(LoginUserHolder.getEntId());
             params.setEntId(params.getEntId() == null ? 1 : params.getEntId());// 暂时处理---------------zk
+            params.setBusinessStatus(Global.NO);
             int count = driverDao.insert(params);
             return count > 0 ? HttpResult.ok() : HttpResult.error("司机信息新增失败!");
         } else {

+ 29 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfFleetService.java

@@ -11,6 +11,7 @@ import com.sckw.core.web.response.HttpResult;
 import com.sckw.fleet.dao.KwfFleetMapper;
 import com.sckw.fleet.model.KwfFleet;
 import com.sckw.fleet.model.dto.KwfFleetDto;
+import com.sckw.fleet.model.vo.KwfFleetTruckCountVo;
 import com.sckw.fleet.model.vo.KwfFleetVo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
@@ -156,4 +157,32 @@ public class KwfFleetService {
         return HttpResult.ok("删除成功!");
     }
 
+    /**
+     * @param params {entId 企业ID, fleetName 车队班组名称}
+     * @desc 车辆实况统计
+     * @author zk
+     * @date 2023/8/4
+     **/
+    public Map<String, Object> findTruckList(Map<String, Object> params) {
+        //全量数据统计
+        params.put("entId", LoginUserHolder.getEntId());
+        List<KwfFleetTruckCountVo> truckCounts = fleetDao.findTruckList(new HashMap(){{put("entId", LoginUserHolder.getEntId());}});
+        KwfFleetTruckCountVo truck = new KwfFleetTruckCountVo();
+        truck.setFleetTotal(truckCounts != null ? truckCounts.size() : Global.NUMERICAL_ZERO);
+        for (KwfFleetTruckCountVo truckCount:truckCounts) {
+            truck.setIdleTotal(truckCount.getIdleTotal() != null ? truckCount.getIdleTotal() + truck.getIdleTotal() : truck.getIdleTotal());
+            truck.setTruckTotal(truckCount.getTruckTotal() != null ? truckCount.getTruckTotal() + truck.getTruckTotal() : truck.getTruckTotal());
+            truck.setBusyTotal(truckCount.getBusyTotal() != null ? truckCount.getBusyTotal() + truck.getBusyTotal() : truck.getBusyTotal());
+        }
+
+        //筛选数据统计
+        truckCounts = fleetDao.findTruckList(params);
+
+        //返回数据
+        Map result = new HashMap();
+        result.put("truckCount", truck);
+        result.put("truckCounts", truckCounts);
+        return result;
+    }
+
 }

+ 1 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -319,6 +319,7 @@ public class KwfTruckService {
             /**新增**/
             params.setEntId(LoginUserHolder.getEntId());
             params.setEntId(params.getEntId() == null ? 1 : params.getEntId());// 暂时处理---------------zk
+            params.setBusinessStatus(Global.NO);
             int count = truckDao.insert(params);
             return count > 0 ? HttpResult.ok() : HttpResult.error("车辆信息新增失败!");
         } else {

+ 19 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetMapper.xml

@@ -66,4 +66,23 @@
         ORDER BY fl.create_time desc
     </select>
 
+    <select id="findTruckList" resultType="com.sckw.fleet.model.vo.KwfFleetTruckCountVo" >
+        SELECT
+        IFNULL(fl.name, '未归属车队车辆') fleetName, count(tr.id) truckTotal,
+        count(case when tr.business_status = 0 then 1 end) idleTotal,
+        count(case when tr.business_status = 1 then 1 end) busyTotal
+        from kwf_truck tr
+        left join kwf_truck_ent tre on tre.truck_id = tr.id
+        left join kwf_fleet_truck flt on flt.truck_id = tr.id and flt.del_flag = 0
+        left join kwf_fleet fl on fl.id = flt.fleet_id and fl.del_flag = 0
+        where tr.del_flag = 0 and tre.del_flag = 0
+        <if test="entId != null and entId != ''">
+            and tre.ent_id = #{entId, jdbcType=VARCHAR}
+        </if>
+        <if test="fleetName != null and fleetName != ''">
+            and fl.name like concat('%',#{fleetName},'%')
+        </if>
+        GROUP BY fl.name ORDER BY truckTotal desc
+    </select>
+
 </mapper>

+ 8 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java

@@ -1526,6 +1526,7 @@ public class KwtWaybillOrderService {
                 if (!LogisticsOrderEnum.transportCompleted(logisticsOrder1.getStatus())) {
                     //下级分包承运订单运输未完成
                     subcontractBool = false;
+                    continue;
                 }
             }
         }
@@ -1771,4 +1772,11 @@ public class KwtWaybillOrderService {
         truck.setBusinessStatus(countVo.getTotalExecute() != null && countVo.getTotalExecute() > 0 ? 1 : 0 );
         remoteFleetService.updateById(truck);
     }
+
+    /** 当前物流订单是全量下游则只能全量、否则可委托量或全量
+     1、派车、循环派车接单需校验贸易订单/物流订单是否委派完成;
+     2、装货需要统计物流订单总装货量;
+     3、卸货需要统计物流订单总卸货量,变更上游状态;
+
+     */
 }