Browse Source

1、调整车队服务dubbo接口

zk 2 years ago
parent
commit
3912b48748

+ 4 - 2
sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/RemoteFleetService.java

@@ -2,6 +2,8 @@ package com.sckw.fleet.api;
 
 import com.sckw.fleet.api.model.vo.RDriverVo;
 import com.sckw.fleet.api.model.vo.RTruckVo;
+
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -17,7 +19,7 @@ public interface RemoteFleetService {
      * @author zk
      * @date 2023/7/18
      **/
-    Map<Long, RDriverVo> findDriver(String driverIds);
+    Map<Long, RDriverVo> findDriver(List<Long> driverIds);
 
     /**
      * @param truckNos 车牌号,多个已逗号隔开
@@ -25,5 +27,5 @@ public interface RemoteFleetService {
      * @author zk
      * @date 2023/7/18
      **/
-    Map<Long, RTruckVo> findTruck(String truckNos);
+    Map<String, RTruckVo> findTruck(List<String> truckNos);
 }

+ 4 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dubbo/RemoteFleetServiceImpl.java

@@ -35,7 +35,7 @@ public class RemoteFleetServiceImpl implements RemoteFleetService {
      * @date 2023/7/18
      **/
     @Override
-    public Map<Long, RDriverVo> findDriver(String driverIds) {
+    public Map<Long, RDriverVo> findDriver(List<Long> driverIds) {
         /**获取数据**/
         Map<Long, RDriverVo> driverMap = new HashMap();
         List<Map<String, Object>> drivers = driverDao.findList(new HashMap(){{put("ids", driverIds);}});
@@ -66,9 +66,9 @@ public class RemoteFleetServiceImpl implements RemoteFleetService {
      * @date 2023/7/18
      **/
     @Override
-    public Map<Long, RTruckVo> findTruck(String truckNos) {
+    public Map<String, RTruckVo> findTruck(List<String> truckNos) {
         /**获取数据**/
-        Map<Long, RTruckVo> truckMap = new HashMap();
+        Map<String, RTruckVo> truckMap = new HashMap();
         List<Map<String, Object>> trucks = truckDao.findList(new HashMap(){{put("truckNos", truckNos);}});
         if (CollectionUtils.isEmpty(trucks)) {
             return truckMap;
@@ -85,7 +85,7 @@ public class RemoteFleetServiceImpl implements RemoteFleetService {
             truckVo.setTotalTake(truck.get("totalTake") != null ? Integer.parseInt(String.valueOf(truck.get("totalTake"))) : null);
             truckVo.setTotalWeight(truck.get("totalWeight") != null ? new BigDecimal(Double.parseDouble(String.valueOf(truck.get("totalWeight")))) : null);
             truckVo.setBusinessStatus(truck.get("businessStatus") != null ? Integer.parseInt(String.valueOf(truck.get("businessStatus"))) : null);
-            truckMap.put(truckVo.getId(), truckVo);
+            truckMap.put(truckVo.getTruckNo(), truckVo);
         }
 
         return truckMap;

+ 8 - 3
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml

@@ -121,9 +121,6 @@
         from kwf_driver dr
         left join kwf_driver_ent dre on dre.driver_id = dr.id
         where dr.del_flag = 0 and dre.del_flag = 0
-        <if test="ids != null and ids != ''">
-            and FIND_IN_SET(dr.id, #{ids, jdbcType=VARCHAR})
-        </if>
         <if test="entId != null and entId != ''">
             and dre.ent_id = #{entId, jdbcType=VARCHAR}
         </if>
@@ -144,6 +141,14 @@
                 select driver_id from kwf_truck_report where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR}
             )
         </if>
+        <choose>
+            <when test="ids != null">
+                and dr.id in
+                <foreach collection="ids" item="id" open="(" close=")" separator=",">
+                    #{id,jdbcType=BIGINT}
+                </foreach>
+            </when>
+        </choose>
         <if test="keywords != null and keywords != ''">
             and (
             dr.name like concat('%',#{keyWords},'%')

+ 8 - 3
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -123,9 +123,6 @@
         from kwf_truck tr
         left join kwf_truck_ent tre on tre.truck_id = tr.id
         where tr.del_flag = 0 and tre.del_flag = 0
-        <if test="truckNos != null and truckNos != ''">
-            and FIND_IN_SET(tr.truck_no, #{truckNos, jdbcType=VARCHAR})
-        </if>
         <if test="entId != null and entId != ''">
             and tre.ent_id = #{entId, jdbcType=VARCHAR}
         </if>
@@ -150,6 +147,14 @@
         <if test="endTime != null and endTime != '' " >
             and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
         </if>
+        <choose>
+            <when test="truckNos != null">
+                and tr.truck_no in
+                <foreach collection="truckNos" item="truckNo" open="(" close=")" separator=",">
+                    #{truckNo,jdbcType=VARCHAR}
+                </foreach>
+            </when>
+        </choose>
         <if test="keywords != null and keywords != ''">
             and (
             tr.truck_no like concat('%',#{keywords},'%')