zk 2 лет назад
Родитель
Сommit
8b7f680242
27 измененных файлов с 1223 добавлено и 63 удалено
  1. 3 5
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java
  2. 175 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java
  3. 1 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverCardMapper.java
  4. 1 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverLicenseMapper.java
  5. 1 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverQualificationMapper.java
  6. 1 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTransportLicenseMapper.java
  7. 1 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckLicenseMapper.java
  8. 26 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java
  9. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfTransportLicense.java
  10. 1 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfTruckEnt.java
  11. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/KwfTruckLicense.java
  12. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverCardDto.java
  13. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverLicenseDto.java
  14. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverQualificationDto.java
  15. 73 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTransportLicenseDto.java
  16. 109 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckDto.java
  17. 74 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckLicenseDto.java
  18. 174 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckVo.java
  19. 18 18
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  20. 349 19
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  21. 5 2
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverEntMapper.xml
  22. 12 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml
  23. 6 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetMapper.xml
  24. 10 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTransportLicenseMapper.xml
  25. 6 3
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckEntMapper.xml
  26. 9 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckLicenseMapper.xml
  27. 158 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

+ 3 - 5
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java

@@ -7,7 +7,6 @@ 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;
@@ -24,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
-
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -70,8 +68,8 @@ public class KwfDriverController {
     }
 
     /**
-     * @param params {page:页数、pageSize:每页条数、。。。}
-     * @desc 分页查询
+     * @param params
+     * @desc 统计
      * @author zk
      * @date 2023/7/6
      **/
@@ -115,7 +113,7 @@ public class KwfDriverController {
      **/
     @PostMapping("/export")
     public HttpResult export(@RequestBody HashMap params) {
-        /**查询分页数据**/
+        /**分页数据**/
         List<KwfDriverVo> drivers = driverService.findPage(params);
 
         if (!CollectionUtils.isEmpty(drivers)) {

+ 175 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -1,7 +1,28 @@
 package com.sckw.fleet.controller;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+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.response.HttpResult;
+import com.sckw.excel.easyexcel.RequestHolder;
+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.service.KwfTruckService;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author zk
@@ -11,4 +32,156 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/kwfTruck")
 public class KwfTruckController {
+
+    @Autowired
+    KwfTruckService truckService;
+
+    /**
+     * @param id 主键ID
+     * @desc 根据主键查询
+     * @author zk
+     * @date 2023/7/6
+     **/
+    @GetMapping("/detail")
+    public HttpResult selectByKey(Long id) throws SystemException {
+        //车辆信息
+        KwfTruck truck = truckService.selectByKey(id);
+
+        //车辆行驶证信息
+        KwfTruckLicense truckLicense = truckService.findTruckLicenseByKey(id);
+
+        //车辆道路运输许可证
+        KwfTransportLicense transportLicense = truckService.findTransportLicenseByKey(id);
+
+        //数据组装
+        JSONObject truckJson = JSONObject.parseObject(JSON.toJSONString(truck));
+        truckJson.put("truckLicense", truckLicense);
+        truckJson.put("transportLicense", transportLicense);
+        return HttpResult.ok(truckJson);
+    }
+
+    /**
+     * @param params
+     * @desc 统计
+     * @author zk
+     * @date 2023/7/6
+     **/
+    @PostMapping("/statistics")
+    public HttpResult statistics(@RequestBody HashMap params) throws SystemException {
+        Map countMaps = truckService.statistics(params);
+        return HttpResult.ok(countMaps);
+    }
+
+    /**
+     * @param params {page:页数、pageSize:每页条数、。。。}
+     * @desc 分页查询
+     * @author zk
+     * @date 2023/7/6
+     **/
+    @PostMapping("/select")
+    public HttpResult findPage(@RequestBody HashMap params) throws SystemException {
+        // 设置分页参数
+        PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
+        List<KwfDriverVo> list = truckService.findPage(params);
+        PageResult pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));
+        return HttpResult.ok(pageResult);
+    }
+
+    /**
+     * @param params {。。。}
+     * @desc 查询
+     * @author zk
+     * @date 2023/7/6
+     **/
+    @PostMapping("/findList")
+    public HttpResult findList(@RequestBody HashMap params) throws SystemException {
+        return HttpResult.ok(truckService.findList(params));
+    }
+
+    /**
+     * @param params 查询参数
+     * @description 导出
+     * @author zk
+     * @date 2023/07/11
+     **/
+    @PostMapping("/export")
+    public HttpResult export(@RequestBody HashMap params) {
+        /**查询数据**/
+        List<KwfDriverVo> drivers = truckService.findPage(params);
+
+        if (!CollectionUtils.isEmpty(drivers)) {
+            HttpServletResponse response = RequestHolder.getResponse();
+            ExcelUtil.download(response, KwfDriverVo.class, drivers);
+            return null;
+        }
+        return HttpResult.error("无数据!");
+    }
+
+    /**
+     * @param file 导入文件
+     * @description 导入
+     * @author zk
+     * @date 2023/07/11
+     **/
+    @PostMapping("/import")
+    public HttpResult importExcel(@RequestParam("file") MultipartFile file) {
+        return truckService.importExcel(file);
+    }
+
+    /**
+     * @param params 新增参数
+     * @return HttpResult
+     * @desc 新增用户
+     * @author czh
+     * @date 2023/6/14
+     */
+    @PostMapping("/add")
+    public HttpResult add(@Valid @RequestBody KwfTruckDto params) throws SystemException{
+        return truckService.add(params);
+    }
+
+    /**
+     * @param params {}
+     * @description 更新
+     * @author zk
+     * @date 2023/5/30
+     **/
+    @PostMapping("/update")
+    public HttpResult update(@Valid @RequestBody KwfTruckDto params) throws SystemException {
+        return truckService.update(params);
+    }
+
+    /**
+     * @param {ids:主键ID(多个以逗号隔开)}
+     * @description 删除
+     * @author zk
+     * @date 2023/7/7
+     **/
+    @DeleteMapping("/dels")
+    public HttpResult del(@RequestParam String ids) throws SystemException {
+        return truckService.del(ids);
+    }
+
+    /**
+     * @param params {}
+     * @description 车辆行驶证信息编辑
+     * @author zk
+     * @date 2023/7/7
+     **/
+    @PostMapping("/truckLicenseEdit")
+    public HttpResult truckLicenseEdit(@Valid @RequestBody KwfTruckLicenseDto params) throws SystemException {
+        return truckService.truckLicenseEdit(params);
+    }
+
+    /**
+     * @param params {}
+     * @description 车辆道路运输许可证编辑
+     * @author zk
+     * @date 2023/7/7
+     **/
+    @PostMapping("/transportLicenseEdit")
+    public HttpResult transportLicenseEdit(@Valid @RequestBody KwfTransportLicenseDto params) throws SystemException {
+        return truckService.transportLicenseEdit(params);
+    }
+
 }

+ 1 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverCardMapper.java

@@ -17,6 +17,6 @@ public interface KwfDriverCardMapper extends BaseMapper<KwfDriverCard> {
      * @param driverId 司机id
      * @return
      */
-    KwfDriverCard findByDriverId(String driverId);
+    KwfDriverCard findByDriverId(Long driverId);
 
 }

+ 1 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverLicenseMapper.java

@@ -17,5 +17,5 @@ public interface KwfDriverLicenseMapper extends BaseMapper<KwfDriverLicense> {
      * @param driverId 司机id
      * @return
      */
-    KwfDriverLicense findByDriverId(String driverId);
+    KwfDriverLicense findByDriverId(Long driverId);
 }

+ 1 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverQualificationMapper.java

@@ -17,6 +17,6 @@ public interface KwfDriverQualificationMapper extends BaseMapper<KwfDriverQualif
      * @param driverId 司机id
      * @return
      */
-    KwfDriverQualification findByDriverId(String driverId);
+    KwfDriverQualification findByDriverId(Long driverId);
 
 }

+ 1 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTransportLicenseMapper.java

@@ -12,4 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfTransportLicenseMapper extends BaseMapper<KwfTransportLicense> {
 
+    KwfTransportLicense findByTruckId(Long truckId);
 }

+ 1 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckLicenseMapper.java

@@ -12,4 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfTruckLicenseMapper extends BaseMapper<KwfTruckLicense> {
 
+    KwfTruckLicense findByTruckId(Long truckId);
 }

+ 26 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java

@@ -2,8 +2,14 @@ package com.sckw.fleet.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.fleet.model.KwfTruck;
+import com.sckw.fleet.model.vo.KwfDriverVo;
+import com.sckw.fleet.model.vo.KwfTableTopCount;
+import com.sckw.fleet.model.vo.KwfTruckVo;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * @desc 车辆信息 Mapper 接口
  * @author zk
@@ -12,4 +18,24 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
 
+    /**
+     * 统计
+     * @param params
+     * @return
+     */
+    List<KwfTableTopCount> statistics(Map<String, Object> params);
+
+    /**
+     * 分页查询
+     * @param params
+     * @return
+     */
+    List<KwfTruckVo> findPage(Map<String, Object> params);
+
+    /**
+     * 查询
+     * @param params
+     * @return
+     */
+    List<Map<String, Object>> findList(Map<String, Object> params);
 }

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

@@ -17,9 +17,9 @@ import java.util.Date;
 public class KwfTransportLicense extends BaseModel {
 
     /**
-     * 车牌号
+     * 车辆主键ID
      */
-    private String truckNo;
+    private Long truckId;
 
     /**
      * 道路运输证号

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

@@ -23,6 +23,6 @@ public class KwfTruckEnt extends BaseModel {
     /**
      * 车牌号
      */
-    private String truckNo;
+    private Long truckId;
 
 }

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

@@ -17,9 +17,9 @@ import java.util.Date;
 public class KwfTruckLicense extends BaseModel {
 
     /**
-     * 车牌号
+     * 车辆主键ID
      */
-    private String truckNo;
+    private Long truckId;
 
     /**
      * 车辆识别码

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

@@ -17,12 +17,12 @@ public class KwfDriverCardDto {
     /**
      * 主键
      */
-    private String id;
+    private Long id;
 
     /**
      * 司机主键
      */
-    private String driverId;
+    private Long driverId;
 
     /**
      * 身份证号

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

@@ -16,12 +16,12 @@ public class KwfDriverLicenseDto {
     /**
      * 主键
      */
-    private String id;
+    private Long id;
 
     /**
      * 司机主键
      */
-    private String driverId;
+    private Long driverId;
 
     /**
      * 驾驶证号

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

@@ -16,12 +16,12 @@ public class KwfDriverQualificationDto {
     /**
      * 主键
      */
-    private String id;
+    private Long id;
 
     /**
      * 司机主键
      */
-    private String driverId;
+    private Long driverId;
 
     /**
      * 从业资格证号

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

@@ -0,0 +1,73 @@
+package com.sckw.fleet.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc 车辆道路运输许可证
+ * @date 2023/7/12 0012
+ */
+@Data
+public class KwfTransportLicenseDto {
+
+    /**
+     * 车辆道路运输许可证信息主键ID
+     */
+    private Long id;
+
+    /**
+     * 车辆信息主键ID
+     */
+    private Long truckId;
+
+    /**
+     * 道路运输证号
+     */
+    @Size(max=20, message = "道路运输证号不能大于20个字符!")
+    private String roadTranNo;
+
+    /**
+     * 企业名称
+     */
+    @Size(max=20, message = "企业名称长度不能大于20个字符!")
+    private String firmName;
+
+    /**
+     * 经营许可证号
+     */
+    @Size(max=20, message = "经营许可证号长度不能大于20个字符!")
+    private String businessLicenseNo;
+
+    /**
+     * 发证日期
+     */
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date grantTime;
+
+    /**
+     * 有效期至
+     */
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date expireTime;
+
+    /**
+     * 发证机关单位
+     */
+    @Size(max=20, message = "发证机关单位长度不能大于20个字符!")
+    private String grantUnit;
+
+    /**
+     * 证书正面URL地址
+     */
+    @Size(max=100, message = "证书正面URL地址长度不能大于100个字符!")
+    private String certificateMain;
+
+    /**
+     * 证书反面URL地址
+     */
+    @Size(max=100, message = "证书反面URL地址长度不能大于100个字符!")
+    private String certificateRevolt;
+}

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

@@ -1,7 +1,10 @@
 package com.sckw.fleet.model.dto;
 
+import jakarta.validation.constraints.*;
 import lombok.Data;
 
+import java.util.regex.Matcher;
+
 /**
  * @author zk
  * @desc 车辆信息
@@ -9,4 +12,110 @@ import lombok.Data;
  */
 @Data
 public class KwfTruckDto {
+
+    /**
+     * 车辆信息主键ID
+     */
+    private Long id;
+
+    /**
+     * 车牌号
+     */
+    @NotBlank(message = "车牌号不能为空!")
+    @Size(max=7, message = "车牌号长度不能大于7个字符!")
+    private String truckNo;
+
+    /**
+     * 车辆类型(牵引车、自卸、高栏、平板、厢式、集装箱车、罐车、封闭式、专项作业车、其他)
+     */
+    @Positive(message = "车辆类型格式不正确!")
+    private String type;
+
+    /**
+     * 能源类型(柴油、汽油、电动、氢能、天然气、液化石油气、甲醇、油电混动、油气混动、其他)
+     */
+    @Positive(message = "能源类型格式不正确!")
+    private String energyType;
+
+    /**
+     * 使用性质(营运车、租赁车辆、货运车、危化品运输车、非营运车、其他)
+     */
+    @Positive(message = "使用性质格式不正确!")
+    private String useType;
+
+    /**
+     * 外廓尺寸
+     */
+    @Size(max=10, message = "外廓尺寸长度不能大于10个字符!")
+    private String spec;
+
+    /**
+     * 标准荷载(净重)
+     */
+    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "标准荷载格式不正确!")
+    private Double actualWeight;
+
+    /**
+     * 车辆总质量(毛重)
+     */
+    @Digits(integer=1, fraction=0)
+    private Double grossWeight;
+
+    /**
+     * 皮重
+     */
+    private Double tareWeight;
+
+    /**
+     * 车辆颜色
+     */
+    @Positive(message = "车辆颜色格式不正确!")
+    private String color;
+
+    /**
+     * 环保等级(国标)
+     */
+    @Positive(message = "环保等级格式不正确!")
+    private String eev;
+
+    /**
+     * 挂车号
+     */
+    @Size(max=7, message = "挂车号长度不能大于7个字符!")
+    private String trailerNo;
+
+    /**
+     * 车队id
+     */
+    private Long fleetId;
+
+    /**
+     * 备注
+     */
+    @Size(max=200, message = "remark长度不能大于200个字符!")
+    private String remark;
+
+    /**
+     * 车辆行驶证信息
+     */
+    private KwfTruckLicenseDto truckLicense;
+
+    /**
+     * 车辆道路运输许可证
+     */
+    private KwfTransportLicenseDto transportLicense;
+
+    public static boolean matchs(String regular, String str){
+        java.util.regex.Pattern p = java.util.regex.Pattern.compile(regular);
+        Matcher m = p.matcher(str);
+        boolean isMatch = m.matches();
+        return isMatch;
+    }
+
+    public static void main(String[] args) {
+        String regular = "^[0-9]+(.[0-9]{2})?$";
+        String str = "1.2";
+        boolean bool = matchs(regular, str);
+        System.out.println(bool);
+    }
 }

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

@@ -0,0 +1,74 @@
+package com.sckw.fleet.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc 车辆行驶证信息
+ * @date 2023/7/12 0012
+ */
+@Data
+public class KwfTruckLicenseDto {
+
+    /**
+     * 车辆行驶证信息主键ID
+     */
+    private Long id;
+
+    /**
+     * 车牌号
+     */
+    private Long truckId;
+
+    /**
+     * 车辆识别码
+     */
+    @Size(max=20, message = "车辆识别码长度不能大于20个字符!")
+    private String vin;
+
+    /**
+     * 车辆行驶证号
+     */
+    @Size(max=20, message = "车辆行驶证号长度不能大于20个字符!")
+    private String drivingNo;
+
+    /**
+     * 车辆所有人
+     */
+    @Size(max=10, message = "车辆所有人长度不能大于10个字符!")
+    private String owner;
+
+    /**
+     * 注册日期
+     */
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date regTime;
+
+    /**
+     * 发证日期
+     */
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date grantTime;
+
+    /**
+     * 发证机关单位
+     */
+    @Size(max=20, message = "发证机关单位长度不能大于20个字符!")
+    private String grantUnit;
+
+    /**
+     * 证书正面URL地址
+     */
+    @Size(max=100, message = "证书正面URL地址长度不能大于100个字符!")
+    private String certificateMain;
+
+    /**
+     * 证书反面URL地址
+     */
+    @Size(max=100, message = "证书反面URL地址长度不能大于100个字符!")
+    private String certificateRevolt;
+
+}

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

@@ -1,8 +1,12 @@
 package com.sckw.fleet.model.vo;
 
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.sckw.excel.annotation.ExcelContext;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * @author zk
  * @desc 车辆信息
@@ -12,4 +16,174 @@ import lombok.Data;
 @ExcelContext(fileName = "车辆信息", sheetName = "车辆信息")
 public class KwfTruckVo {
 
+    /**
+     * 车辆信息主键id
+     */
+    @ExcelIgnore
+    private String id;
+
+    /**
+     * 状态
+     */
+    @ExcelIgnore
+    private int status;
+    /**
+     * 状态名称
+     */
+    @ExcelProperty(value = "状态")
+    private int statusName;
+
+    /**
+     * 车牌号
+     */
+    @ExcelProperty(value = "车牌号")
+    private String truckNo;
+
+    /**
+     * 车牌颜色
+     */
+    @ExcelProperty(value = "车牌颜色")
+    private String color;
+
+    /**
+     * 车辆类型
+     */
+    @ExcelProperty(value = "车辆类型")
+    private String truckTypeName;
+
+    /**
+     * 能源类型
+     */
+    @ExcelProperty(value = "能源类型")
+    private String energyTypeName;
+
+    /**
+     * 核定载质量/吨
+     */
+    @ExcelProperty(value = "核定载质量/吨")
+    private String actualWeight;
+
+    /**
+     * 总质量/吨
+     */
+    @ExcelProperty(value = "总质量/吨")
+    private String grossWeight;
+
+    /**
+     * 外廓尺寸
+     */
+    @ExcelProperty(value = "外廓尺寸")
+    private String spec;
+
+    /**
+     * 使用性质
+     */
+    @ExcelProperty(value = "使用性质")
+    private String useTypeName;
+
+    /**
+     * 车辆所有人
+     */
+    @ExcelProperty(value = "车辆所有人")
+    private String owner;
+
+    /**
+     * 车辆识别代码
+     */
+    @ExcelProperty(value = "车辆识别代码")
+    private String vin;
+
+    /**
+     * 注册日期
+     */
+    @ExcelProperty(value = "注册日期")
+    private Date regTime;
+
+    /**
+     * 发证日期
+     */
+    @ExcelProperty(value = "发证日期")
+    private Date grantTime;
+
+    /**
+     * 发证机关
+     */
+    @ExcelProperty(value = "发证机关")
+    private String grantUnit;
+
+    /**
+     * 车辆行驶证号
+     */
+    @ExcelProperty(value = "车辆行驶证号")
+    private String drivingNo;
+
+    /**
+     * 道路运输证号
+     */
+    @ExcelProperty(value = "道路运输证号")
+    private String roadTranNo;
+
+    /**
+     * 业户名称
+     */
+    @ExcelProperty(value = "业户名称")
+    private String tranFirmName;
+
+    /**
+     * 道路运输经营许可证号
+     */
+    @ExcelProperty(value = "道路运输经营许可证号")
+    private String businessLicenseNo;
+
+    /**
+     * 挂车号
+     */
+    @ExcelProperty(value = "挂车号")
+    private String trailerNo;
+
+    /**
+     * 归档单位企业ID
+     */
+    @ExcelIgnore
+    private String entId;
+
+    /**
+     * 归档单位
+     */
+    @ExcelProperty(value = "归档单位")
+    private String firmName;
+
+    /**
+     * 车队班组
+     */
+    @ExcelProperty(value = "车队班组")
+    private String fleetName;
+
+    /**
+     * 创建人
+     */
+    @ExcelIgnore
+    private String createBy;
+
+    /**
+     * 创建人
+     */
+    @ExcelProperty(value = "创建人")
+    private String createByName;
+
+    /**
+     * 创建时间
+     */
+    @ExcelProperty(value = "创建时间")
+    private Date crateTime;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    public String getStatusName() {
+        return status == 1 ? "已认证" : status == 2 ? "临时" : "异常";
+    }
 }

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

@@ -114,9 +114,9 @@ public class KwfDriverService {
         /**获取查询数据**/
         List<Long> createBys = new ArrayList<>();
         List<Long> entIds = new ArrayList<>();
-        for (KwfDriverVo driverVo:drivers) {
-            createBys.add(Long.parseLong(driverVo.getCreateBy()));
-            entIds.add(Long.parseLong(driverVo.getEntId()));
+        for (KwfDriverVo driver:drivers) {
+            createBys.add(Long.parseLong(driver.getCreateBy()));
+            entIds.add(Long.parseLong(driver.getEntId()));
         }
         //用户数据集
         createBys = createBys.stream().distinct().collect(Collectors.toList());
@@ -126,17 +126,17 @@ public class KwfDriverService {
         Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
 
         /**数据组装**/
-        for (KwfDriverVo driverVo:drivers) {
-            UserCacheResDto user = users == null ? null : users.get(Long.parseLong(driverVo.getCreateBy()));
-            EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(driverVo.getEntId()));
-            driverVo.setCreateByName(user != null ? user.getName() : null);
-            driverVo.setFirmName(ent != null ? ent.getFirmName() : null);
+        for (KwfDriverVo driver:drivers) {
+            UserCacheResDto user = users == null ? null : users.get(Long.parseLong(driver.getCreateBy()));
+            EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(driver.getEntId()));
+            driver.setCreateByName(user != null ? user.getName() : null);
+            driver.setFirmName(ent != null ? ent.getFirmName() : null);
         }
         return drivers;
     }
 
     /**
-     * @param params 分页参数
+     * @param params 查询参数
      * @desc 查询
      * @author zk
      * @date 2023/7/6
@@ -180,21 +180,21 @@ public class KwfDriverService {
         /**身份证信息**/
         KwfDriverCardDto driverCardDto = params.getDriverCard();
         if (driverCardDto != null) {
-            driverCardDto.setDriverId(String.valueOf(driver.getId()));
+            driverCardDto.setDriverId(driver.getId());
             driverCardEdit(driverCardDto);
         }
 
         /**司机驾驶证信息**/
         KwfDriverLicenseDto driverLicenseDto = params.getDriverLicense();
         if (driverLicenseDto != null) {
-            driverLicenseDto.setDriverId(String.valueOf(driver.getId()));
+            driverLicenseDto.setDriverId(driver.getId());
             driverLicenseEdit(driverLicenseDto);
         }
 
         /**司机从业资格证**/
         KwfDriverQualificationDto driverQualificationDto = params.getDriverQualification();
         if (driverQualificationDto != null) {
-            driverQualificationDto.setDriverId(String.valueOf(driver.getId()));
+            driverQualificationDto.setDriverId(driver.getId());
             driverQualificationEdit(driverQualificationDto);
         }
 
@@ -234,21 +234,21 @@ public class KwfDriverService {
         /**身份证信息**/
         KwfDriverCardDto driverCardDto = params.getDriverCard();
         if (driverCardDto != null) {
-            driverCardDto.setDriverId(String.valueOf(driver.getId()));
+            driverCardDto.setDriverId(driver.getId());
             driverCardEdit(driverCardDto);
         }
 
         /**司机驾驶证信息**/
         KwfDriverLicenseDto driverLicenseDto = params.getDriverLicense();
         if (driverLicenseDto != null) {
-            driverLicenseDto.setDriverId(String.valueOf(driver.getId()));
+            driverLicenseDto.setDriverId(driver.getId());
             driverLicenseEdit(driverLicenseDto);
         }
 
         /**司机从业资格证**/
         KwfDriverQualificationDto driverQualificationDto = params.getDriverQualification();
         if (driverQualificationDto != null) {
-            driverQualificationDto.setDriverId(String.valueOf(driver.getId()));
+            driverQualificationDto.setDriverId(driver.getId());
             driverQualificationEdit(driverQualificationDto);
         }
         return HttpResult.ok("司机信息修改成功!");
@@ -354,7 +354,7 @@ public class KwfDriverService {
      * @date 2023/7/7
      **/
     public KwfDriverCard findCarByKey(Long key) {
-        return KwfDriverCardDao.findByDriverId(String.valueOf(key));
+        return KwfDriverCardDao.findByDriverId(key);
     }
 
     /**
@@ -391,7 +391,7 @@ public class KwfDriverService {
      * @date 2023/7/7
      **/
     public KwfDriverLicense findLicenseByKey(Long key) {
-        return KwfDriverLicenseDao.findByDriverId(String.valueOf(key));
+        return KwfDriverLicenseDao.findByDriverId(key);
     }
 
     /**
@@ -427,7 +427,7 @@ public class KwfDriverService {
      * @date 2023/7/7
      **/
     public KwfDriverQualification findQualificationByKey(Long key) {
-        return KwfDriverQualificationDao.findByDriverId(String.valueOf(key));
+        return KwfDriverQualificationDao.findByDriverId(key);
     }
 
     /**

+ 349 - 19
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -1,19 +1,33 @@
 package com.sckw.fleet.service;
 
+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.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.model.KwfTruck;
+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.UserCacheResDto;
 import org.apache.dubbo.config.annotation.DubboReference;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author zk
@@ -34,10 +48,8 @@ public class KwfTruckService {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
-
-
     /**
-     * @param key 主键id
+     * @param key 逐渐id
      * @desc 根据主键查询
      * @author zk
      * @date 2023/7/6
@@ -46,6 +58,33 @@ public class KwfTruckService {
         return truckDao.selectById(key);
     }
 
+    /**
+     * @param params 参数
+     * @desc 统计
+     * @author zk
+     * @date 2023/7/11
+     **/
+    public Map statistics(Map<String, Object> params) {
+        /**统计数据**/
+        List<KwfTableTopCount> counts = truckDao.statistics(params);
+        long tatol = 0;
+        for (KwfTableTopCount topCount:counts) {
+            tatol += topCount.getTotal();
+        }
+
+        /**全部数据-处理**/
+        KwfTableTopCount allCount = new KwfTableTopCount();
+        allCount.setValue(String.valueOf(Global.NUMERICAL_ZERO));
+        allCount.setTotal(tatol);
+        counts.add(allCount);
+
+        /**数据组装**/
+        Map tableCount = new HashMap();
+        tableCount.put("tableTop", counts);
+        tableCount.put("tableBottom", tatol);
+        return tableCount;
+    }
+
     /**
      * @param params 分页参数
      * @desc 分页查询
@@ -53,38 +92,329 @@ public class KwfTruckService {
      * @date 2023/7/6
      **/
     public List<KwfTruckVo> findPage(Map<String, Object> params) {
-        return truckDao.selectPage(null, null);
+        /**查询分页数据**/
+        List<KwfTruckVo> trucks = truckDao.findPage(params);
+        if (CollectionUtils.isEmpty(trucks)) {
+            return trucks;
+        }
+
+        /**获取查询数据**/
+        List<Long> createBys = new ArrayList<>();
+        List<Long> entIds = new ArrayList<>();
+        for (KwfTruckVo truck:trucks) {
+            createBys.add(Long.parseLong(truck.getCreateBy()));
+            entIds.add(Long.parseLong(truck.getEntId()));
+        }
+        //用户数据集
+        createBys = createBys.stream().distinct().collect(Collectors.toList());
+        Map<Long, UserCacheResDto> users = remoteSystemService.queryUserCacheMapByIds(createBys);
+        //企业数据集
+        entIds = entIds.stream().distinct().collect(Collectors.toList());
+        Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
+
+        /**数据组装**/
+        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()));
+            truck.setCreateByName(user != null ? user.getName() : null);
+            truck.setFirmName(ent != null ? ent.getFirmName() : null);
+        }
+        return trucks;
     }
 
     /**
-     * @param params 分页参数
+     * @param params 查询参数
      * @desc 查询
      * @author zk
      * @date 2023/7/6
      **/
-    public List<KwfTruckVo> findList(Map<String, Object> params) {
-        return truckDao.selectPage(null, null);
+    public List<Map<String, Object>> findList(Map<String, Object> params) {
+        return truckDao.findList(params);
     }
 
     /**
-     * @param params 分页参数
-     * @desc 新增司机
+     * @param {}
+     * @description 导出
      * @author zk
-     * @date 2023/7/6
+     * @date 2023/07/11
      **/
-    public HttpResult add(KwfTruck params) {
-        truckDao.insert(params);
+    public HttpResult importExcel(MultipartFile file) {
         return null;
     }
 
     /**
-     * @param params 分页参数
-     * @desc 修改司机
+     * @param params 参数
+     * @desc 新增车辆
      * @author zk
      * @date 2023/7/6
      **/
-    public HttpResult update(KwfTruck params) {
-        truckDao.updateById(params);
-        return null;
+    public HttpResult add(KwfTruckDto params) {
+        /**车辆信息**/
+        KwfTruck truck = new KwfTruck();
+        BeanUtils.copyProperties(params, truck);
+        //证件都有数据则为已认证(前端校验认证数据必填)
+        boolean bool = checkLicense(params);
+        if (bool) {
+            truck.setStatus(Global.NUMERICAL_ONE);
+        } else {
+            truck.setStatus(Global.NUMERICAL_TWO);
+        }
+        HttpResult result = truckEdit(truck);
+        if (result.getCode() != HttpStatus.SUCCESS_CODE) {
+            return result;
+        }
+
+        /**车辆行驶证信息**/
+        KwfTruckLicenseDto truckLicenseDto = params.getTruckLicense();
+        if (truckLicenseDto != null) {
+            truckLicenseDto.setTruckId(truck.getId());
+            truckLicenseEdit(truckLicenseDto);
+        }
+
+        /**车辆行驶证信息**/
+        KwfTransportLicenseDto transportLicenseDto = params.getTransportLicense();
+        if (transportLicenseDto != null) {
+            truckLicenseDto.setTruckId(truck.getId());
+            transportLicenseEdit(transportLicenseDto);
+        }
+
+        /**车辆信息与企业关联信息**/
+        truckEntEdit(truck);
+        return HttpResult.ok("车辆信息新增成功!");
+    }
+
+    /**
+     * @param params 参数
+     * @desc 修改车辆
+     * @author zk
+     * @date 2023/7/6
+     **/
+    public HttpResult update(KwfTruckDto params) {
+        /**数据校验**/
+        if (StringUtils.isBlank(params.getId())) {
+            return HttpResult.error(HttpStatus.PARAMETERS_PATTERN_ERROR_CODE,"车辆信息ID不能为空!");
+        }
+        KwfTruck truck = truckDao.selectById(params.getId());
+        if (truck == null) {
+            return HttpResult.error("车辆信息不存在!");
+        }
+
+        /**车辆信息**/
+        BeanUtils.copyProperties(params, truck);
+        //证件都有数据则为已认证(前端校验认证数据必填)
+        boolean bool = checkLicense(params);
+        if (bool) {
+            truck.setStatus(Global.NUMERICAL_ONE);
+        }
+        HttpResult result = truckEdit(truck);
+        if (result.getCode() != HttpStatus.SUCCESS_CODE) {
+            return result;
+        }
+
+        /**车辆行驶证信息**/
+        KwfTruckLicenseDto truckLicenseDto = params.getTruckLicense();
+        if (truckLicenseDto != null) {
+            truckLicenseDto.setTruckId(truck.getId());
+            truckLicenseEdit(truckLicenseDto);
+        }
+
+        /**车辆行驶证信息**/
+        KwfTransportLicenseDto transportLicenseDto = params.getTransportLicense();
+        if (transportLicenseDto != null) {
+            truckLicenseDto.setTruckId(truck.getId());
+            transportLicenseEdit(transportLicenseDto);
+        }
+        return HttpResult.ok("车辆信息修改成功!");
+    }
+
+    /**
+     * @param {ids:主键ID(多个以逗号隔开)}
+     * @description 删除
+     * @author zk
+     * @date 2023/7/6
+     **/
+    public HttpResult del(String ids) {
+        /**数据校验**/
+        if (StringUtils.isBlank(ids)) {
+            return HttpResult.error("请选择要删除的数据!");
+        }
+
+        /**数据组装**/
+        String[] idArray = ids.split(",");
+        KwfTruckEnt truckEntQuery = new KwfTruckEnt();
+        truckEntQuery.setEntId(LoginUserHolder.getEntId());
+        for (String id : idArray) {
+            truckEntQuery.setTruckId(Long.parseLong(id));
+            KwfTruckEnt truckEnt = truckEntDao.findByTruckEnt(truckEntQuery);
+            if (truckEnt != null) {
+                truckEnt.setDelFlag(Global.YES);
+                if (truckEntDao.updateById(truckEnt) <= 0) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
+                }
+            }
+        }
+        return HttpResult.ok("删除成功!");
+    }
+
+    /**
+     * @param params 参数
+     * @desc 更新车辆信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult truckEdit(KwfTruck params) {
+        if (StringUtils.isBlank(params.getId())) {
+            /**唯一性交易**/
+            List<Map<String, Object>> drivers = truckDao.findList(new HashMap(){{ put("truckNo", params.getTruckNo()); }});
+            if (!CollectionUtils.isEmpty(drivers)) {
+                return HttpResult.error("车牌号已存在!");
+            }
+
+            /**新增**/
+            params.setEntId(LoginUserHolder.getEntId());
+            params.setEntId(params.getEntId() == null ? 1 : params.getEntId());// 暂时处理---------------zk
+            int count = truckDao.insert(params);
+            return count > 0 ? HttpResult.ok() : HttpResult.error("车辆信息新增失败!");
+        } else {
+            /**唯一性交易**/
+            List<Map<String, Object>> drivers = truckDao.findList(new HashMap(){{ put("truckNo", params.getTruckNo()); }});
+            //校验list中对象key值是否存在与value不一致的情况
+            boolean bool = CollectionUtils.listByKeyValueV1(drivers, "id", String.valueOf(params.getId()));
+            if (bool) {
+                return HttpResult.error("车辆信息已存在!");
+            }
+
+            /**更新**/
+            int count = truckDao.updateById(params);
+            return count > 0 ? HttpResult.ok() : HttpResult.error("车辆信息修改失败!");
+        }
+    }
+
+    /**
+     * @param params 参数
+     * @desc 更新车辆行驶证信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult truckLicenseEdit(KwfTruckLicenseDto params) {
+        /**数据copy**/
+        KwfTruckLicense truckLicense = new KwfTruckLicense();
+        BeanUtils.copyProperties(params, truckLicense);
+
+        /**数据更新**/
+        int count = 0;
+        KwfTruckLicense license = truckLicenseDao.findByTruckId(params.getTruckId());
+        if (license == null) {
+            count = truckLicenseDao.insert(truckLicense);
+        } else {
+            truckLicense.setId(license.getId());
+            count = truckLicenseDao.updateById(truckLicense);
+        }
+
+        /**校验车辆是否有证书并更新状态**/
+        checkLicense(truckLicense.getId());
+        return count > 0 ? HttpResult.ok("车辆行驶证信息修改成功!") : HttpResult.error("车辆行驶证信息修改失败!");
+    }
+
+    /**
+     * @param key 参数
+     * @desc 查询车辆行驶证信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public KwfTruckLicense findTruckLicenseByKey(Long key) {
+        return truckLicenseDao.findByTruckId(key);
+    }
+
+    /**
+     * @param params 参数
+     * @desc 更新车辆道路运输许可证
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult transportLicenseEdit(KwfTransportLicenseDto params) {
+        /**数据copy**/
+        KwfTransportLicense transportLicense = new KwfTransportLicense();
+        BeanUtils.copyProperties(params, transportLicense);
+
+        /**数据更新**/
+        int count = 0;
+        KwfTransportLicense license = transportLicenseDao.findByTruckId(params.getTruckId());
+        if (license == null) {
+            count = transportLicenseDao.insert(transportLicense);
+            return count > 0 ? HttpResult.ok("车辆驾驶证信息更新成功!") : HttpResult.error("车辆驾驶证信息更新失败!");
+        } else {
+            transportLicense.setId(license.getId());
+            count = transportLicenseDao.updateById(transportLicense);
+        }
+
+        /**校验车辆是否有证书并更新状态**/
+        checkLicense(transportLicense.getTruckId());
+        return count > 0 ? HttpResult.ok("车辆驾驶证信息修改成功!") : HttpResult.error("车辆驾驶证信息修改失败!");
+    }
+
+    /**
+     * @param key 参数
+     * @desc 查询车辆道路运输许可证
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public KwfTransportLicense findTransportLicenseByKey(Long key) {
+        return transportLicenseDao.findByTruckId(key);
+    }
+
+    /**
+     * @param params 参数
+     * @desc 新增车辆信息与企业关联信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public void truckEntEdit(KwfTruck params) {
+        KwfTruckEnt truckEnt = new KwfTruckEnt();
+        truckEnt.setTruckId(params.getId());
+        truckEnt.setEntId(params.getEntId());
+        truckEntDao.insert(truckEnt);
+    }
+
+    /**
+     * @param params 参数
+     * @desc 校验车辆是否有证书
+     * @author zk
+     * @date 2023/7/11
+     **/
+    public boolean checkLicense(KwfTruckDto params) {
+        //车辆行驶证信息
+        if (params.getTruckLicense() == null || StringUtils.isBlank(params.getTruckLicense().getDrivingNo())) {
+            return false;
+        }
+        //车辆道路运输许可证
+        if (params.getTransportLicense() == null || StringUtils.isBlank(params.getTransportLicense().getRoadTranNo())) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * @param truckId 车辆主键id
+     * @desc 校验车辆是否有证书并更新状态
+     * @author zk
+     * @date 2023/7/11
+     **/
+    public void checkLicense(Long truckId) {
+        //车辆行驶证信息
+        KwfTruckLicense license = this.findTruckLicenseByKey(truckId);
+        if (license == null || StringUtils.isBlank(license.getDrivingNo())) {
+            return;
+        }
+        //车辆道路运输许可证
+        KwfTransportLicense transportLicense = this.findTransportLicenseByKey(truckId);
+        if (transportLicense == null || StringUtils.isBlank(transportLicense.getRoadTranNo())) {
+            return;
+        }
+        //更新数据
+        KwfTruck truck = new KwfTruck();
+        truck.setId(truckId);
+        truck.setStatus(Global.NUMERICAL_ONE);
+        truckDao.updateById(truck);
     }
 }

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

@@ -5,8 +5,11 @@
     <select id="findByDriverEnt" resultType="com.sckw.fleet.model.KwfDriverEnt" parameterType="com.sckw.fleet.model.KwfDriverEnt" >
         SELECT
             id, ent_id entId, driver_id driverId, remark, status, create_by createBy,
-            create_time createTime, update_by updateBy, update_time updateTime from kwf_driver_ent
-        where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR} and driver_id = #{driverId, jdbcType=VARCHAR}
+            create_time createTime, update_by updateBy, update_time updateTime
+        from kwf_driver_ent
+        where del_flag = 0
+        and ent_id = #{entId, jdbcType=VARCHAR}
+        and driver_id = #{driverId, jdbcType=VARCHAR}
     </select>
 
 </mapper>

+ 12 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml

@@ -35,6 +35,12 @@
         <if test="fleetName != null and fleetName != ''">
             and fl.name like concat('%',#{fleetName},'%')
         </if>
+        <if test="startTime != null and startTime != '' " >
+            and DATE( dr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != '' " >
+            and DATE( dr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
         <if test="keywords != null and keywords != ''">
             and (
             dr.name like concat('%',#{keyWords},'%')
@@ -83,6 +89,12 @@
         <if test="status != null and status != ''">
             and dr.status = #{status, jdbcType=VARCHAR}
         </if>
+        <if test="startTime != null and startTime != '' " >
+            and DATE( fl.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != '' " >
+            and DATE( fl.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
         <if test="keywords != null and keywords != ''">
             and (
             dr.name like concat('%',#{keyWords},'%')

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

@@ -20,6 +20,12 @@
         <if test="phone != null and phone != ''">
             and fl.phone = #{phone, jdbcType=VARCHAR}
         </if>
+        <if test="startTime != null and startTime != '' " >
+            and DATE( fl.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != '' " >
+            and DATE( fl.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
         <if test="keywords != null and keywords != ''">
             and (
                 fl.name like concat('%',#{keywords},'%')

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

@@ -2,4 +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, 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}
+    </select>
+
 </mapper>

+ 6 - 3
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckEntMapper.xml

@@ -4,9 +4,12 @@
 
     <select id="findByTruckEnt" resultType="com.sckw.fleet.model.KwfTruckEnt" parameterType="com.sckw.fleet.model.KwfTruckEnt" >
         SELECT
-        id, ent_id entId, driver_id driverId, remark, status, create_by createBy,
-        create_time createTime, update_by updateBy, update_time updateTime from kwf_driver_ent
-        where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR} and driver_id = #{driverId, jdbcType=VARCHAR}
+            id, ent_id entId, truck_id truckId, remark, status, create_by createBy,
+            create_time createTime, update_by updateBy, update_time updateTime
+        from kwf_truck_ent
+        where del_flag = 0
+        and ent_id = #{entId, jdbcType=VARCHAR}
+        and truck_id = #{truckId, jdbcType=VARCHAR}
     </select>
 
 

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

@@ -2,4 +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, 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}
+    </select>
+
 </mapper>

+ 158 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -2,4 +2,162 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfTruckMapper">
 
+    <select id="statistics" resultType="com.sckw.fleet.model.vo.KwfTableTopCount" parameterType="java.util.Map" >
+        SELECT
+            tr.`status` value, count(0) total
+        from kwf_truck tr
+        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 fl on fl.id = flt.fleet_id and fl.del_flag = 0
+        where tre.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 != ''">
+            and tr.type = #{type, jdbcType=VARCHAR}
+        </if>
+        <if test="energyType != null and energyType != ''">
+            and tr.energy_type = #{energyType, jdbcType=VARCHAR}
+        </if>
+        <if test="useType != null and useType != ''">
+            and tr.use_type = #{useType, jdbcType=VARCHAR}
+        </if>
+        <if test="fleetId != null and fleetId != ''">
+            and fl.id = #{fleetId, jdbcType=VARCHAR}
+        </if>
+        <if test="fleetName != null and fleetName != ''">
+            and fl.name like concat('%',#{fleetName},'%')
+        </if>
+        <if test="status != null and status != ''">
+            and tr.status = #{status, jdbcType=VARCHAR}
+        </if>
+        <if test="startTime != null and startTime != '' " >
+            and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != '' " >
+            and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (
+            tr.truck_no like concat('%',#{keyWords},'%')
+            )
+        </if>
+        GROUP BY tr.`status`
+    </select>
+
+    <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.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,
+        tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime,
+        trl.owner, trl.vin, trl.reg_time regTime, trl.grant_time grantTime, trl.grant_unit grantUnit,
+        trl.driving_no drivingNo, tranl.road_tran_no roadTranNo, tranl.firm_name tranFirmName,
+        tranl.business_license_no businessLicenseNo, fl.`name` fleetName
+        from kwf_truck tr
+        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 fl on fl.id = flt.fleet_id and fl.del_flag = 0
+        where tre.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 != ''">
+            and tr.type = #{type, jdbcType=VARCHAR}
+        </if>
+        <if test="energyType != null and energyType != ''">
+            and tr.energy_type = #{energyType, jdbcType=VARCHAR}
+        </if>
+        <if test="useType != null and useType != ''">
+            and tr.use_type = #{useType, jdbcType=VARCHAR}
+        </if>
+        <if test="fleetId != null and fleetId != ''">
+            and fl.id = #{fleetId, jdbcType=VARCHAR}
+        </if>
+        <if test="fleetName != null and fleetName != ''">
+            and fl.name like concat('%',#{fleetName},'%')
+        </if>
+        <if test="status != null and status != ''">
+            and tr.status = #{status, jdbcType=VARCHAR}
+        </if>
+        <if test="startTime != null and startTime != '' " >
+            and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != '' " >
+            and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (
+            tr.truck_no like concat('%',#{keyWords},'%')
+            )
+        </if>
+        ORDER BY tr.create_time desc
+    </select>
+
+    <select id="findList" resultType="java.util.Map" parameterType="java.util.Map" >
+        SELECT
+            tr.id, tre.ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
+            spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
+            color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
+            total_weight totalWeight, business_status businessStatus, tr.remark, tr.status,
+            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
+        <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 != ''">
+            and tr.type = #{type, jdbcType=VARCHAR}
+        </if>
+        <if test="energyType != null and energyType != ''">
+            and tr.energy_type = #{energyType, jdbcType=VARCHAR}
+        </if>
+        <if test="useType != null and useType != ''">
+            and tr.use_type = #{useType, jdbcType=VARCHAR}
+        </if>
+        <if test="status != null and status != ''">
+            and tr.status = #{status, jdbcType=VARCHAR}
+        </if>
+        <if test="startTime != null and startTime != '' " >
+            and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != '' " >
+            and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (
+            tr.truck_no like concat('%',#{keyWords},'%')
+            )
+        </if>
+        ORDER BY tr.create_time desc
+    </select>
+
+    <select id="findEntTruck" resultType="com.sckw.fleet.model.KwfTruck" parameterType="com.sckw.fleet.model.KwfTruck" >
+        SELECT
+            tr.id, tre.ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
+            spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
+            color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
+            total_weight totalWeight, business_status businessStatus, tr.remark, tr.status,
+            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
+        and tre.ent_id = #{entId, jdbcType=VARCHAR}
+        and tr.id = #{id, jdbcType=VARCHAR}
+    </select>
 </mapper>