Răsfoiți Sursa

1、车辆档案接口自测修改;

zk 2 ani în urmă
părinte
comite
288d2bf626
25 a modificat fișierele cu 208 adăugiri și 58 ștergeri
  1. 5 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java
  2. 0 3
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfFleetController.java
  3. 6 4
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java
  4. 6 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfFleetDriverMapper.java
  5. 7 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfFleetTruckMapper.java
  6. 5 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfFleetDriver.java
  7. 7 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfFleetTruck.java
  8. 3 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfTransportLicense.java
  9. 1 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverDto.java
  10. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTransportLicenseDto.java
  11. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckDto.java
  12. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckLicenseDto.java
  13. 25 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckVo.java
  14. 38 9
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  15. 0 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfFleetService.java
  16. 0 4
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckReportService.java
  17. 62 7
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  18. 2 2
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverCardMapper.xml
  19. 2 2
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverLicenseMapper.xml
  20. 2 2
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverQualificationMapper.xml
  21. 8 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetDriverMapper.xml
  22. 8 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetTruckMapper.xml
  23. 2 2
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTransportLicenseMapper.xml
  24. 2 2
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckLicenseMapper.xml
  25. 11 8
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

+ 5 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java

@@ -27,7 +27,11 @@ public enum DictTypeEnum {
     CATEGORY_TYPE("category_type", "类别类型"),
     PRODUCT_NAME_TYPE("product_name_type", "品名类型"),
     GOODS_STATUS("goods_status", "商品状态"),
-    CHARGING_TYPE("charging_type", "计费方式");
+    CHARGING_TYPE("charging_type", "计费方式") ,
+    COLOR_TYPE("color_type", "车辆颜色"),
+    ENERGY_TYPE("energy_type", "能源类型"),
+    TRUCK_TYPE("truck_type", "车辆类型"),
+    USE_TYPE("use_type", "使用性质");
 
     private final String type;
     private final String name;

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

@@ -5,14 +5,11 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
-import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
-import com.sckw.fleet.model.KwfDriver;
 import com.sckw.fleet.model.KwfFleet;
 import com.sckw.fleet.model.dto.KwfFleetDto;
-import com.sckw.fleet.model.vo.KwfDriverVo;
 import com.sckw.fleet.model.vo.KwfFleetVo;
 import com.sckw.fleet.service.KwfFleetService;
 import jakarta.servlet.http.HttpServletResponse;

+ 6 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -13,9 +13,11 @@ import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.fleet.model.*;
 import com.sckw.fleet.model.dto.*;
 import com.sckw.fleet.model.vo.KwfDriverVo;
+import com.sckw.fleet.model.vo.KwfTruckVo;
 import com.sckw.fleet.service.KwfTruckService;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
+import org.checkerframework.checker.units.qual.K;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
@@ -107,11 +109,11 @@ public class KwfTruckController {
     @PostMapping("/export")
     public HttpResult export(@RequestBody HashMap params) {
         /**查询数据**/
-        List<KwfDriverVo> drivers = truckService.findPage(params);
+        List<KwfTruckVo> trucks = truckService.findPage(params);
 
-        if (!CollectionUtils.isEmpty(drivers)) {
+        if (!CollectionUtils.isEmpty(trucks)) {
             HttpServletResponse response = RequestHolder.getResponse();
-            ExcelUtil.download(response, KwfDriverVo.class, drivers);
+            ExcelUtil.download(response, KwfTruckVo.class, trucks);
             return null;
         }
         return HttpResult.error("无数据!");
@@ -179,7 +181,7 @@ public class KwfTruckController {
      * @author zk
      * @date 2023/7/7
      **/
-    @PostMapping("/transportLicenseEdit")
+    @PostMapping("/tranLicenseEdit")
     public HttpResult transportLicenseEdit(@Valid @RequestBody KwfTransportLicenseDto params) throws SystemException {
         return truckService.transportLicenseEdit(params);
     }

+ 6 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfFleetDriverMapper.java

@@ -12,4 +12,10 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfFleetDriverMapper extends BaseMapper<KwfFleetDriver> {
 
+    /**
+     * 查询
+     * @param params 参数
+     * @return
+     */
+    KwfFleetDriver findByTruckDriver(KwfFleetDriver params);
 }

+ 7 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfFleetTruckMapper.java

@@ -2,6 +2,7 @@ package com.sckw.fleet.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.fleet.model.KwfFleetTruck;
+import com.sckw.fleet.model.KwfTruckEnt;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -12,4 +13,10 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfFleetTruckMapper extends BaseMapper<KwfFleetTruck> {
 
+    /**
+     * 查询
+     * @param params 参数
+     * @return
+     */
+    KwfFleetTruck findByTruckFleet(KwfFleetTruck params);
 }

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

@@ -25,4 +25,9 @@ public class KwfFleetDriver extends BaseModel {
      */
     private Long driverId;
 
+    /**
+     * 企业id
+     */
+    private Long entId;
+
 }

+ 7 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfFleetTruck.java

@@ -21,8 +21,13 @@ public class KwfFleetTruck extends BaseModel {
     private Long fleetId;
 
     /**
-     * 车牌号
+     * 车辆档案主键id
      */
-    private String truckNo;
+    private Long truckId;
+
+    /**
+     * 企业id
+     */
+    private Long entId;
 
 }

+ 3 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfTransportLicense.java

@@ -1,5 +1,6 @@
 package com.sckw.fleet.model;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.sckw.core.model.base.BaseModel;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -44,11 +45,13 @@ public class KwfTransportLicense extends BaseModel {
     /**
      * 发证日期
      */
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date grantTime;
 
     /**
      * 有效期至
      */
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date expireTime;
 
     /**

+ 1 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverDto.java

@@ -40,7 +40,7 @@ public class KwfDriverDto {
     /**
      * 车队班组主键ID
      */
-    private String fleetId;
+    private Long fleetId;
 
     /**
      * 身份证信息

+ 2 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTransportLicenseDto.java

@@ -44,13 +44,13 @@ public class KwfTransportLicenseDto {
     /**
      * 发证日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date grantTime;
 
     /**
      * 有效期至
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date expireTime;
 
     /**

+ 2 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckDto.java

@@ -52,13 +52,13 @@ public class KwfTruckDto {
     /**
      * 标准荷载(净重)
      */
-    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "标准荷载格式不正确!")
+    //@Pattern(regexp = "^1[3456789]\\d{9}$", message = "标准荷载格式不正确!")
     private Double actualWeight;
 
     /**
      * 车辆总质量(毛重)
      */
-    @Digits(integer=1, fraction=0)
+    //@Digits(integer=1, fraction=0)
     private Double grossWeight;
 
     /**

+ 2 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckLicenseDto.java

@@ -44,13 +44,13 @@ public class KwfTruckLicenseDto {
     /**
      * 注册日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date regTime;
 
     /**
      * 发证日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
     private Date grantTime;
 
     /**

+ 25 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckVo.java

@@ -39,11 +39,23 @@ public class KwfTruckVo {
     @ExcelProperty(value = "车牌号")
     private String truckNo;
 
+    /**
+     * 车牌颜色
+     */
+    @ExcelIgnore
+    private Integer color;
+
     /**
      * 车牌颜色
      */
     @ExcelProperty(value = "车牌颜色")
-    private String color;
+    private String colorName;
+
+    /**
+     * 车辆类型
+     */
+    @ExcelIgnore
+    private Integer type;
 
     /**
      * 车辆类型
@@ -51,6 +63,12 @@ public class KwfTruckVo {
     @ExcelProperty(value = "车辆类型")
     private String truckTypeName;
 
+    /**
+     * 能源类型
+     */
+    @ExcelIgnore
+    private Integer energyType;
+
     /**
      * 能源类型
      */
@@ -75,6 +93,12 @@ public class KwfTruckVo {
     @ExcelProperty(value = "外廓尺寸")
     private String spec;
 
+    /**
+     * 使用性质
+     */
+    @ExcelIgnore
+    private Integer useType;
+
     /**
      * 使用性质
      */

+ 38 - 9
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -1,14 +1,7 @@
 package com.sckw.fleet.service;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import com.sckw.core.exception.BusinessException;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
-import com.sckw.core.model.page.PageHelperUtil;
-import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.PasswordUtils;
@@ -16,7 +9,6 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
-import com.sckw.excel.utils.EasyExcelUtil;
 import com.sckw.fleet.dao.*;
 import com.sckw.fleet.model.*;
 import com.sckw.fleet.model.dto.*;
@@ -32,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -58,6 +49,8 @@ public class KwfDriverService {
     KwfDriverLicenseMapper KwfDriverLicenseDao;
     @Autowired
     KwfDriverQualificationMapper KwfDriverQualificationDao;
+    @Autowired
+    KwfFleetDriverMapper fleetDriverDao;
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
@@ -200,6 +193,10 @@ public class KwfDriverService {
 
         /**司机信息与企业关联信息**/
         driverEntEdit(driver);
+
+        /**车队班组绑定**/
+        driverFleetEdit(driver.getId(), params.getFleetId());
+
         return HttpResult.ok("司机信息新增成功!");
     }
 
@@ -251,6 +248,10 @@ public class KwfDriverService {
             driverQualificationDto.setDriverId(driver.getId());
             driverQualificationEdit(driverQualificationDto);
         }
+
+        /**车队班组绑定**/
+        driverFleetEdit(driver.getId(), params.getFleetId());
+
         return HttpResult.ok("司机信息修改成功!");
     }
 
@@ -443,6 +444,34 @@ public class KwfDriverService {
         driverEntDao.insert(driverEnt);
     }
 
+    /**
+     * @param driverId 司机档案主键id fleetId 车队班组主键id
+     * @desc 车队班组绑定
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult driverFleetEdit(Long driverId, Long fleetId) {
+        /**数据校验**/
+        if (fleetId == null) {
+            return HttpResult.ok("未选择车队班组!");
+        }
+        KwfFleetDriver queryFleetDriver = new KwfFleetDriver();
+        queryFleetDriver.setEntId(LoginUserHolder.getEntId());
+        queryFleetDriver.setDriverId(driverId);
+        KwfFleetDriver fleetDriver = fleetDriverDao.findByTruckDriver(queryFleetDriver);
+
+        /**数据更新**/
+        queryFleetDriver.setFleetId(fleetId);
+        if (fleetDriver == null) {
+            int count = fleetDriverDao.insert(queryFleetDriver);
+            return count > 0 ? HttpResult.ok("车队班组绑定成功!") : HttpResult.error("车队班组绑定失败!");
+        } else {
+            queryFleetDriver.setId(fleetDriver.getId());
+            int count = fleetDriverDao.updateById(queryFleetDriver);
+            return count > 0 ? HttpResult.ok("车队班组绑定成功!") : HttpResult.error("车队班组绑定失败!");
+        }
+    }
+
     /**
      * @param params 参数
      * @desc: 修改密码

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

@@ -11,10 +11,8 @@ 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.KwfDriverVo;
 import com.sckw.fleet.model.vo.KwfFleetVo;
 import com.sckw.system.api.RemoteSystemService;
-import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;

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

@@ -3,7 +3,6 @@ package com.sckw.fleet.service;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.auth.context.LoginUserHolder;
 import com.sckw.core.model.constant.Global;
-import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
@@ -11,9 +10,6 @@ import com.sckw.core.web.response.HttpResult;
 import com.sckw.fleet.dao.KwfDriverMapper;
 import com.sckw.fleet.dao.KwfTruckMapper;
 import com.sckw.fleet.dao.KwfTruckReportMapper;
-import com.sckw.fleet.model.KwfDriver;
-import com.sckw.fleet.model.KwfTruck;
-import com.sckw.fleet.model.KwfTruckEnt;
 import com.sckw.fleet.model.KwfTruckReport;
 import com.sckw.fleet.model.dto.*;
 import com.sckw.fleet.model.vo.KwfTableTopCount;

+ 62 - 7
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -1,5 +1,6 @@
 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;
@@ -8,16 +9,14 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
-import com.sckw.fleet.dao.KwfTransportLicenseMapper;
-import com.sckw.fleet.dao.KwfTruckEntMapper;
-import com.sckw.fleet.dao.KwfTruckLicenseMapper;
-import com.sckw.fleet.dao.KwfTruckMapper;
+import com.sckw.fleet.dao.*;
 import com.sckw.fleet.model.*;
 import com.sckw.fleet.model.dto.*;
 import com.sckw.fleet.model.vo.KwfTableTopCount;
 import com.sckw.fleet.model.vo.KwfTruckVo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +44,8 @@ public class KwfTruckService {
     KwfTruckLicenseMapper truckLicenseDao;
     @Autowired
     KwfTransportLicenseMapper transportLicenseDao;
+    @Autowired
+    KwfFleetTruckMapper fleetTruckDao;
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
@@ -99,11 +100,18 @@ public class KwfTruckService {
         }
 
         /**获取查询数据**/
+        String prefix = Global.REDIS_SYS_DICT_PREFIX, pound = Global.POUND;
         List<Long> createBys = new ArrayList<>();
         List<Long> entIds = new ArrayList<>();
+        List<String> dictKey = new ArrayList<>();
+
         for (KwfTruckVo truck:trucks) {
             createBys.add(Long.parseLong(truck.getCreateBy()));
             entIds.add(Long.parseLong(truck.getEntId()));
+            dictKey.add(prefix + DictTypeEnum.COLOR_TYPE.getType() + pound + truck.getColor());
+            dictKey.add(prefix + DictTypeEnum.TRUCK_TYPE.getType() + pound + truck.getType());
+            dictKey.add(prefix + DictTypeEnum.USE_TYPE.getType() + pound + truck.getUseType());
+            dictKey.add(prefix + DictTypeEnum.ENERGY_TYPE.getType() + pound + truck.getEnergyType());
         }
         //用户数据集
         createBys = createBys.stream().distinct().collect(Collectors.toList());
@@ -111,13 +119,24 @@ public class KwfTruckService {
         //企业数据集
         entIds = entIds.stream().distinct().collect(Collectors.toList());
         Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
+        //数据字典
+        dictKey = dictKey.stream().distinct().collect(Collectors.toList());
+        Map<Long, SysDictResDto> dicts = null;//remoteSystemService.queryDictByType(dictKey);
 
         /**数据组装**/
         for (KwfTruckVo truck:trucks) {
             UserCacheResDto user = users == null ? null : users.get(Long.parseLong(truck.getCreateBy()));
             EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(truck.getEntId()));
+            SysDictResDto color = dicts == null ? null : dicts.get(prefix + DictTypeEnum.COLOR_TYPE.getType() + pound + truck.getColor());
+            SysDictResDto type = dicts == null ? null : dicts.get(prefix + DictTypeEnum.COLOR_TYPE.getType() + pound + truck.getType());
+            SysDictResDto useType = dicts == null ? null : dicts.get(prefix + DictTypeEnum.COLOR_TYPE.getType() + pound + truck.getUseType());
+            SysDictResDto energyType = dicts == null ? null : dicts.get(prefix + DictTypeEnum.COLOR_TYPE.getType() + pound + truck.getEnergyType());
             truck.setCreateByName(user != null ? user.getName() : null);
             truck.setFirmName(ent != null ? ent.getFirmName() : null);
+            truck.setColorName(color != null ? color.getLabel() : null);
+            truck.setTruckTypeName(type != null ? type.getLabel() : null);
+            truck.setUseTypeName(useType != null ? useType.getLabel() : null);
+            truck.setEnergyTypeName(energyType != null ? energyType.getLabel() : null);
         }
         return trucks;
     }
@@ -174,12 +193,16 @@ public class KwfTruckService {
         /**车辆行驶证信息**/
         KwfTransportLicenseDto transportLicenseDto = params.getTransportLicense();
         if (transportLicenseDto != null) {
-            truckLicenseDto.setTruckId(truck.getId());
+            transportLicenseDto.setTruckId(truck.getId());
             transportLicenseEdit(transportLicenseDto);
         }
 
         /**车辆信息与企业关联信息**/
         truckEntEdit(truck);
+
+        /**车队班组绑定**/
+        truckFleetEdit(truck.getId(), params.getFleetId());
+
         return HttpResult.ok("车辆信息新增成功!");
     }
 
@@ -221,9 +244,12 @@ public class KwfTruckService {
         /**车辆行驶证信息**/
         KwfTransportLicenseDto transportLicenseDto = params.getTransportLicense();
         if (transportLicenseDto != null) {
-            truckLicenseDto.setTruckId(truck.getId());
+            transportLicenseDto.setTruckId(truck.getId());
             transportLicenseEdit(transportLicenseDto);
         }
+
+        /**车队班组绑定**/
+        truckFleetEdit(truck.getId(), params.getFleetId());
         return HttpResult.ok("车辆信息修改成功!");
     }
 
@@ -281,7 +307,7 @@ public class KwfTruckService {
             //校验list中对象key值是否存在与value不一致的情况
             boolean bool = CollectionUtils.listByKeyValueV1(trucks, "id", String.valueOf(params.getId()));
             if (bool) {
-                return HttpResult.error("车辆信息已存在!");
+                return HttpResult.error("车牌号已存在!");
             }
 
             /**更新**/
@@ -376,6 +402,35 @@ public class KwfTruckService {
         truckEntDao.insert(truckEnt);
     }
 
+    /**
+     * @param truckId 车辆档案主键id fleetId 车队班组主键id
+     * @desc 车队班组绑定
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult truckFleetEdit(Long truckId, Long fleetId) {
+        /**数据校验**/
+        if (fleetId == null) {
+            return HttpResult.ok("未选择车队班组!");
+        }
+        KwfFleetTruck queryFleetTruck = new KwfFleetTruck();
+        queryFleetTruck.setEntId(LoginUserHolder.getEntId());
+        queryFleetTruck.setTruckId(truckId);
+        KwfFleetTruck fleetTruck = fleetTruckDao.findByTruckFleet(queryFleetTruck);
+
+        /**数据更新**/
+        queryFleetTruck.setFleetId(fleetId);
+        if (fleetTruck == null) {
+            int count = fleetTruckDao.insert(queryFleetTruck);
+            return count > 0 ? HttpResult.ok("车队班组绑定成功!") : HttpResult.error("车队班组绑定失败!");
+        } else {
+            queryFleetTruck.setId(fleetTruck.getId());
+            int count = fleetTruckDao.updateById(queryFleetTruck);
+            return count > 0 ? HttpResult.ok("车队班组绑定成功!") : HttpResult.error("车队班组绑定失败!");
+        }
+    }
+
+
     /**
      * @param params 参数
      * @desc 校验车辆是否有证书

+ 2 - 2
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverCardMapper.xml

@@ -2,13 +2,13 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfDriverCardMapper">
 
-    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverCard" parameterType="java.lang.String" >
+    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverCard" parameterType="java.lang.Long" >
         SELECT
             id, driver_id driverId, idcard, expire_time expireTime, address, certificate_main certificateMain,
             certificate_revolt certificateRevolt, remark, status, create_by createBy, create_time createTime,
             update_by updateBy, update_time updateTime
         from kwf_driver_card
-        where del_flag = 0 and driver_id = #{driverId, jdbcType=VARCHAR}
+        where del_flag = 0 and driver_id = #{driverId, jdbcType=BIGINT}
     </select>
 
 </mapper>

+ 2 - 2
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverLicenseMapper.xml

@@ -2,13 +2,13 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfDriverLicenseMapper">
 
-    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverLicense" parameterType="java.lang.String" >
+    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverLicense" parameterType="java.lang.Long" >
         SELECT
             id, driver_id driverId, driver_no driverNo, type, expire_time expireTime, grant_unit grantUnit,
             certificate_main certificateMain, certificate_revolt certificateRevolt, remark, status, create_by createBy,
             create_time createTime, update_by updateBy, update_time updateTime
         from kwf_driver_license
-        where del_flag = 0 and driver_id = #{driverId, jdbcType=VARCHAR}
+        where del_flag = 0 and driver_id = #{driverId, jdbcType=BIGINT}
     </select>
 
 </mapper>

+ 2 - 2
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverQualificationMapper.xml

@@ -2,13 +2,13 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfDriverQualificationMapper">
 
-    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverQualification" parameterType="java.lang.String" >
+    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverQualification" parameterType="java.lang.Long" >
         SELECT
             id, driver_id driverId, quali_no qualiNo, type, expire_time expireTime, grant_unit grantUnit,
             certificate_main certificateMain, certificate_revolt certificateRevolt, remark, status, create_by createBy,
             create_time createTime, update_by updateBy, update_time updateTime
         from kwf_driver_qualification
-        where del_flag = 0 and driver_id = #{driverId, jdbcType=VARCHAR}
+        where del_flag = 0 and driver_id = #{driverId, jdbcType=BIGINT}
     </select>
 
 </mapper>

+ 8 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetDriverMapper.xml

@@ -2,4 +2,12 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfFleetDriverMapper">
 
+    <select id="findByTruckDriver" resultType="com.sckw.fleet.model.KwfFleetDriver" parameterType="com.sckw.fleet.model.KwfFleetDriver" >
+        SELECT
+        id, fleet_id fleetId, driver_id driverId, ent_id entId, remark, status, create_by createBy, create_time createTime,
+        update_by updateBy, update_time updateTime FROM kwf_fleet_driver
+        where del_flag = 0
+        and driver_id = #{driverId, jdbcType=VARCHAR}
+        and ent_id = #{entId, jdbcType=VARCHAR}
+    </select>
 </mapper>

+ 8 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetTruckMapper.xml

@@ -2,4 +2,12 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfFleetTruckMapper">
 
+    <select id="findByTruckFleet" resultType="com.sckw.fleet.model.KwfFleetTruck" parameterType="com.sckw.fleet.model.KwfFleetTruck" >
+        SELECT
+            id, fleet_id fleetId, truck_id truckId, ent_id entId, remark, status, create_by createBy, create_time createTime,
+            update_by updateBy, update_time updateTime FROM kwf_fleet_truck
+        where del_flag = 0
+        and truck_id = #{truckId, jdbcType=VARCHAR}
+        and ent_id = #{entId, jdbcType=VARCHAR}
+    </select>
 </mapper>

+ 2 - 2
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTransportLicenseMapper.xml

@@ -2,14 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfTransportLicenseMapper">
 
-    <select id="findByTruckId" resultType="com.sckw.fleet.model.KwfTransportLicense" parameterType="java.lang.String" >
+    <select id="findByTruckId" resultType="com.sckw.fleet.model.KwfTransportLicense" parameterType="java.lang.Long" >
         SELECT
             id, truck_id truckId, road_tran_no roadTranNo, firm_name firmName, business_license_no businessLicenseNo,
             grant_unit grantUnit, grant_time grantTime, expire_time expireTime, certificate_main certificateMain,
             certificate_revolt certificateRevolt, remark, create_by createBy, create_time createTime, update_by updateBy,
             update_time updateTime
         from kwf_transport_license
-        where del_flag = 0 and truck_id = #{truckId, jdbcType=VARCHAR}
+        where del_flag = 0 and truck_id = #{truckId, jdbcType=BIGINT}
     </select>
 
 </mapper>

+ 2 - 2
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckLicenseMapper.xml

@@ -2,13 +2,13 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfTruckLicenseMapper">
 
-    <select id="findByTruckId" resultType="com.sckw.fleet.model.KwfTruckLicense" parameterType="java.lang.String" >
+    <select id="findByTruckId" resultType="com.sckw.fleet.model.KwfTruckLicense" parameterType="java.lang.Long" >
         SELECT
             id, truck_id truckId, vin, driving_no drivingNo, owner, reg_time regTime, grant_unit grantUnit,
             grant_time grantTime, certificate_main certificateMain, certificate_revolt certificateRevolt,
             remark, create_by createBy, create_time createTime, update_by updateBy, update_time updateTime
         from kwf_truck_license
-        where del_flag = 0 and truck_id = #{truckId, jdbcType=VARCHAR}
+        where del_flag = 0 and truck_id = #{truckId, jdbcType=BIGINT}
     </select>
 
 </mapper>

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

@@ -9,9 +9,9 @@
         left join kwf_truck_ent tre on tre.truck_id = tr.id
         left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
         left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
-        left join kwf_fleet_truck flt on flt.id = tr.id and flt.del_flag = 0
+        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 tre.del_flag = 0 and tre.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>
@@ -52,7 +52,7 @@
 
     <select id="findPage" resultType="com.sckw.fleet.model.vo.KwfTruckVo" parameterType="java.util.Map" >
         SELECT
-        tr.id, tre.ent_id entId, tr.truck_no truckNo, tr.type, tr.energy_type energyType, tr.use_type useType,
+        tr.id, tr.ent_id entId, tr.truck_no truckNo, tr.type, tr.energy_type energyType, tr.use_type useType,
         tr.spec, tr.actual_weight actualWeight, tr.gross_weight grossWeight, tr.tare_weight tareWeight,
         tr.color, tr.eev, tr.trailer_no trailerNo, tr.total_complete totalComplete, tr.total_take totalTake,
         tr.total_weight totalWeight, tr.business_status businessStatus, tr.remark, tr.status,
@@ -64,16 +64,16 @@
         left join kwf_truck_ent tre on tre.truck_id = tr.id
         left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
         left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
-        left join kwf_fleet_truck flt on flt.id = tr.id and flt.del_flag = 0
+        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 tre.del_flag = 0 and tre.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="truckNo != null and truckNo != ''">
             and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
         </if>
-        <if test="type != null and type != ''">
+        <if test="truckType != null and truckType != ''">
             and tr.type = #{type, jdbcType=VARCHAR}
         </if>
         <if test="energyType != null and energyType != ''">
@@ -114,7 +114,7 @@
             tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime
         from kwf_truck tr
         left join kwf_truck_ent tre on tre.truck_id = tr.id
-        where tre.del_flag = 0 and tre.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>
@@ -156,8 +156,11 @@
             tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime
         from kwf_truck tr
         left join kwf_truck_ent tre on tre.truck_id = tr.id
-        where tre.del_flag = 0 and tre.del_flag = 0
+        where tr.del_flag = 0 and tre.del_flag = 0
         and tre.ent_id = #{entId, jdbcType=VARCHAR}
         and tr.id = #{id, jdbcType=VARCHAR}
     </select>
+
+
+
 </mapper>