Ver Fonte

车辆管理业务新增司机信息

donglang há 2 meses atrás
pai
commit
40a40380c2

+ 5 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckVo.java

@@ -222,6 +222,11 @@ public class KwfTruckVo implements Serializable {
     @ExcelProperty(value = "备注")
     private String remark;
 
+    /**
+     * 司机
+     */
+    private String driverName;
+
 
     public String getAuthStatusName() {
         return authStatus == 1 ? "正常" : authStatus == 2 ? "临时" : "异常";

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

@@ -6,6 +6,7 @@ import com.alibaba.excel.read.metadata.ReadSheet;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.google.common.collect.Lists;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.common.enums.enums.FileEnum;
@@ -36,6 +37,7 @@ import com.sckw.fleet.model.request.TruckInfoReq;
 import com.sckw.fleet.model.vo.*;
 import com.sckw.fleet.repository.KwfFleetRepository;
 import com.sckw.fleet.repository.KwfFleetTruckRepository;
+import com.sckw.fleet.repository.KwfTruckReportRepository;
 import com.sckw.fleet.repository.KwfTruckRepository;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.RemoteUserService;
@@ -86,6 +88,8 @@ public class KwfTruckService {
     KwfTruckImportMapper kwfTruckImportDao;
     @Autowired
     KwfFleetTruckMapper fleetTruckDao;
+
+    private final KwfTruckReportRepository kwfTruckReportRepository;
     private final KwfTruckRepository kwfTruckRepository;
     private final KwfFleetRepository kwfFleetRepository;
     private final UrlConfigProperties urlConfigProperties;
@@ -264,11 +268,17 @@ public class KwfTruckService {
         List<String> dictKey = new ArrayList<>();
 
         for (KwfTruckVo truck : trucks) {
+            //创建人id
             createBys.add(Long.parseLong(truck.getCreateBy()));
+            //企业id
             entIds.add(Long.parseLong(truck.getEntId()));
+            //车牌颜色
             dictKey.add(truck.getColor() != null ? DictTypeEnum.COLOR_TYPE.getType() + pound + truck.getColor() : null);
+            //车辆类型
             dictKey.add(truck.getType() != null ? DictTypeEnum.TRUCK_TYPE.getType() + pound + truck.getType() : null);
+            //使用性质
             dictKey.add(truck.getUseType() != null ? DictTypeEnum.USE_TYPE.getType() + pound + truck.getUseType() : null);
+            //能源类型
             dictKey.add(truck.getEnergyType() != null ? DictTypeEnum.ENERGY_TYPE.getType() + pound + truck.getEnergyType() : null);
         }
         //用户数据集
@@ -294,10 +304,32 @@ public class KwfTruckService {
             truck.setTruckTypeName(type != null ? type.getLabel() : null);
             truck.setUseTypeName(useType != null ? useType.getLabel() : null);
             truck.setEnergyTypeName(energyType != null ? energyType.getLabel() : null);
+
+            //查询司机信息
+            KwfTruckReport truckReport = getKwfTruckReport(truck, ents);
+            truck.setDriverName(truckReport.getRemark());
         }
         return trucks;
     }
 
+    /**
+     * 根据企业id和车辆id查询司机信息
+     * @param truck
+     * @param ents
+     * @return
+     */
+    private KwfTruckReport getKwfTruckReport(KwfTruckVo truck, Map<Long, EntCacheResDto> ents) {
+        //查询车辆关联司机信息
+        KwfTruckReport truckReport = kwfTruckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
+                .eq(BaseModel::getDelFlag, 0)
+                .eq(KwfTruckReport::getTruckId, truck.getId())
+                .eq(KwfTruckReport::getEntId, ents.get(Long.parseLong(truck.getEntId()))));
+        if (truckReport == null) {
+            return new KwfTruckReport();
+        }
+        return truckReport;
+    }
+
     /**
      * @param params 分页参数
      * @desc 分页查询

+ 1 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java

@@ -290,6 +290,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
             put("entIds", entIds);
             put("userName", userName);
         }};
+        //查询企业信息
         List<KwsUserResVo> users = kwsUserService.findList(params);
         List<Long> userIds = new ArrayList<>();
         users.forEach(user -> userIds.add(user.getId()));

+ 0 - 21
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/driver/DriverController.java

@@ -1,21 +0,0 @@
-package com.sckw.transport.controller.driver;
-
-
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Author: donglang
- * Time: 2025-10-20
- * Des: 司机管理
- * Version: 1.0
- */
-
-@RestController
-@RequestMapping("/driver")
-@Tag(name = "车辆管理", description = "车辆管理")
-public class DriverController {
-
-
-}