Parcourir la source

1、司机档案接口

zk il y a 2 ans
Parent
commit
a3f667a03f
19 fichiers modifiés avec 816 ajouts et 24 suppressions
  1. 42 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/CollectionUtils.java
  2. 75 3
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java
  3. 14 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfFleetController.java
  4. 7 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverCardMapper.java
  5. 6 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverLicenseMapper.java
  6. 23 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java
  7. 7 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverQualificationMapper.java
  8. 54 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverCardDto.java
  9. 59 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverDto.java
  10. 58 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverLicenseDto.java
  11. 58 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverQualificationDto.java
  12. 4 4
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfFleetDto.java
  13. 9 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java
  14. 259 11
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  15. 40 4
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfFleetService.java
  16. 9 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverCardMapper.xml
  17. 9 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverLicenseMapper.xml
  18. 74 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml
  19. 9 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverQualificationMapper.xml

+ 42 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/CollectionUtils.java

@@ -2,6 +2,8 @@ package com.sckw.core.utils;
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
 import java.util.*;
 
 /**
@@ -375,4 +377,44 @@ public class CollectionUtils extends CollectionUtil {
 		}
 		return result;
     }
+
+	/**
+	 * 对象转Map
+	 * @param object
+	 * @return
+	 * @throws IllegalAccessException
+	 */
+	public static Map beanToMap(Object object) throws Exception {
+		Map<String, Object> map = new HashMap<String, Object>();
+		Field[] fields = object.getClass().getDeclaredFields();
+		for (Field field : fields) {
+			field.setAccessible(true);
+			map.put(field.getName(), field.get(object));
+		}
+		return map;
+	}
+
+	/**
+	 * map转对象
+	 * @param map
+	 * @param beanClass
+	 * @param <T>
+	 * @return
+	 * @throws Exception
+	 */
+	public static <T> T mapToBean(Map map, Class<T> beanClass) throws Exception {
+		T object = beanClass.newInstance();
+		Field[] fields = object.getClass().getDeclaredFields();
+		for (Field field : fields) {
+			int mod = field.getModifiers();
+			if (Modifier.isStatic(mod) || Modifier.isFinal(mod)) {
+				continue;
+			}
+			field.setAccessible(true);
+			if (map.containsKey(field.getName())) {
+				field.set(object, map.get(field.getName()));
+			}
+		}
+		return object;
+	}
 }

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

@@ -1,13 +1,23 @@
 package com.sckw.fleet.controller;
 
+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.utils.CollectionUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.fleet.model.KwfDriver;
+import com.sckw.fleet.model.KwfDriverCard;
+import com.sckw.fleet.model.KwfDriverLicense;
+import com.sckw.fleet.model.KwfDriverQualification;
+import com.sckw.fleet.model.dto.KwfDriverCardDto;
+import com.sckw.fleet.model.dto.KwfDriverDto;
+import com.sckw.fleet.model.dto.KwfDriverLicenseDto;
+import com.sckw.fleet.model.dto.KwfDriverQualificationDto;
 import com.sckw.fleet.service.KwfDriverService;
 import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,7 +45,24 @@ public class KwfDriverController {
      **/
     @GetMapping("/detail")
     public HttpResult selectByKey(Long id) throws SystemException {
-        return HttpResult.ok(driverService.selectByKey(id));
+        //司机信息
+        KwfDriver driver = driverService.selectByKey(id);
+
+        //身份证信息
+        KwfDriverCard cardJson = driverService.findCarByKey(driver.getId());
+
+        //司机驾驶证信息
+        KwfDriverLicense licenseJson = driverService.findLicenseByKey(driver.getId());
+
+        //司机从业资格证
+        KwfDriverQualification qualificationJson = driverService.findQualificationByKey(driver.getId());
+
+        //数据组装
+        JSONObject driverJson = JSONObject.parseObject(JSON.toJSONString(driver));
+        driverJson.put("driverCard", cardJson);
+        driverJson.put("driverLicense", licenseJson);
+        driverJson.put("driverQualification", qualificationJson);
+        return HttpResult.ok(driverJson);
     }
 
     /**
@@ -72,7 +99,7 @@ public class KwfDriverController {
      * @date 2023/6/14
      */
     @PostMapping("/add")
-    public HttpResult add(@Valid @RequestBody KwfDriver params) {
+    public HttpResult add(@Valid @RequestBody KwfDriverDto params) throws SystemException{
         return driverService.add(params);
     }
 
@@ -83,7 +110,52 @@ public class KwfDriverController {
      * @date 2023/5/30
      **/
     @PostMapping("/update")
-    public HttpResult update(@RequestBody KwfDriver params) throws SystemException {
+    public HttpResult update(@Valid @RequestBody KwfDriverDto params) throws SystemException {
         return driverService.update(params);
     }
+
+    /**
+     * @param {ids:主键ID(多个以逗号隔开)}
+     * @description 删除
+     * @author zk
+     * @date 2023/7/7
+     **/
+    @PostMapping("/dels")
+    public HttpResult del(@RequestParam String ids) throws SystemException {
+        return driverService.del(ids);
+    }
+
+    /**
+     * @param params {}
+     * @description 司机身份证信息编辑
+     * @author zk
+     * @date 2023/7/7
+     **/
+    @PostMapping("/driverCardEdit")
+    public HttpResult driverCardEdit(@Valid @RequestBody KwfDriverCardDto params) throws SystemException {
+        return driverService.driverCardEdit(params);
+    }
+
+    /**
+     * @param params {}
+     * @description 司机驾驶证信息编辑
+     * @author zk
+     * @date 2023/7/7
+     **/
+    @PostMapping("/driverLicenseEdit")
+    public HttpResult driverLicenseEdit(@Valid @RequestBody KwfDriverLicenseDto params) throws SystemException {
+        return driverService.driverLicenseEdit(params);
+    }
+
+    /**
+     * @param params {}
+     * @description 司机从业资格证信息编辑
+     * @author zk
+     * @date 2023/7/7
+     **/
+    @PostMapping("/driverQualiEdit")
+    public HttpResult driverQualiEdit(@Valid @RequestBody KwfDriverQualificationDto params) throws SystemException {
+        return driverService.driverQualificationEdit(params);
+    }
+
 }

+ 14 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfFleetController.java

@@ -5,6 +5,7 @@ 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.fleet.model.KwfDriver;
 import com.sckw.fleet.model.KwfFleet;
@@ -70,7 +71,7 @@ public class KwfFleetController {
      * @return HttpResult
      * @desc 新增用户
      * @author czh
-     * @date 2023/6/14
+     * @date 2023/7/6
      */
     @PostMapping("/add")
     public HttpResult add(@Valid @RequestBody KwfFleetDto params) {
@@ -81,10 +82,21 @@ public class KwfFleetController {
      * @param params {}
      * @description 更新
      * @author zk
-     * @date 2023/5/30
+     * @date 2023/7/6
      **/
     @PostMapping("/update")
     public HttpResult update(@Valid @RequestBody KwfFleetDto params) throws SystemException {
         return fleetService.update(params);
     }
+
+    /**
+     * @param {ids:主键ID(多个以逗号隔开)}
+     * @description 删除
+     * @author zk
+     * @date 2023/7/6
+     **/
+    @PostMapping("/dels")
+    public HttpResult del(@RequestParam String ids) throws SystemException {
+        return HttpResult.ok(HttpStatus.MSG_008);
+    }
 }

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

@@ -12,4 +12,11 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfDriverCardMapper extends BaseMapper<KwfDriverCard> {
 
+    /**
+     * 查询
+     * @param driverId 司机id
+     * @return
+     */
+    KwfDriverCard findByDriverId(String driverId);
+
 }

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

@@ -12,4 +12,10 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfDriverLicenseMapper extends BaseMapper<KwfDriverLicense> {
 
+    /**
+     * 查询
+     * @param driverId 司机id
+     * @return
+     */
+    KwfDriverLicense findByDriverId(String driverId);
 }

+ 23 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java

@@ -2,7 +2,10 @@ package com.sckw.fleet.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.fleet.model.KwfDriver;
+import com.sckw.fleet.model.vo.KwfDriverVo;
 import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @desc 司机信息 Mapper 接口
@@ -12,4 +15,24 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfDriverMapper extends BaseMapper<KwfDriver> {
 
+    /**
+     * 分页查询
+     * @param params
+     * @return
+     */
+    List<KwfDriverVo> findPage(Map<String, Object> params);
+
+    /**
+     * 查询
+     * @param params
+     * @return
+     */
+    List<Map<String, Object>> findList(Map<String, Object> params);
+
+    /**
+     * 查询企业下司机信息
+     * @param params
+     * @return
+     */
+    KwfDriver findEntDriver(KwfDriver params);
 }

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

@@ -12,4 +12,11 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfDriverQualificationMapper extends BaseMapper<KwfDriverQualification> {
 
+    /**
+     * 查询
+     * @param driverId 司机id
+     * @return
+     */
+    KwfDriverQualification findByDriverId(String driverId);
+
 }

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

@@ -0,0 +1,54 @@
+package com.sckw.fleet.model.dto;
+
+import jakarta.validation.constraints.Pattern;
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc 司机身份证信息
+ * @date 2023/7/7 0007
+ */
+@Data
+public class KwfDriverCardDto {
+
+    /**
+     * 主键
+     */
+    private String id;
+
+    /**
+     * 司机主键
+     */
+    private String driverId;
+
+    /**
+     * 身份证号
+     */
+    @Pattern(regexp = "(^\\d{18}$)|(^\\d{15}$)", message = "身份证号码格式不正确!")
+    private String idcard;
+
+    /**
+     * 有效日期
+     */
+    private Date expireTime;
+
+    /**
+     * 联系地址
+     */
+    @Size(max=30, message = "联系地址长度不能大于100个字符!")
+    private String address;
+
+    /**
+     * 证书正面URL地址
+     */
+    @Size(max=100, message = "证书正面URL地址长度不能大于100个字符!")
+    private String certificateMian;
+
+    /**
+     * 证书反面URL地址
+     */
+    @Size(max=100, message = "证书反面URL地址长度不能大于1000个字符!")
+    private String certificateRevolt;
+}

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

@@ -0,0 +1,59 @@
+package com.sckw.fleet.model.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Pattern;
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+
+/**
+ * @author zk
+ * @desc 车队
+ * @date 2023/7/6 0006
+ */
+@Data
+public class KwfDriverDto {
+    /**
+     * 主键
+     */
+    private String id;
+
+    /**
+     * 车队名称
+     */
+    @NotBlank(message = "司机姓名不能为空!")
+    @Size(max=10, message = "司机姓名长度不能大于10个字符!")
+    private String name;
+
+    /**
+     * 联系电话
+     */
+    @NotBlank(message = "电话号码不能为空!")
+    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "电话号码格式不正确!")
+    private String phone;
+
+    /**
+     * 身份证号
+     */
+    @Pattern(regexp = "(^\\d{18}$)|(^\\d{15}$)", message = "身份证号码格式不正确!")
+    private String idcard;
+
+    /**
+     * 车队班组主键ID
+     */
+    private String fleetId;
+
+    /**
+     * 身份证信息
+     */
+    private KwfDriverCardDto driverCard;
+
+    /**
+     *司机驾驶证信息
+     */
+    private KwfDriverLicenseDto driverLicense;
+
+    /**
+     *司机从业资格证
+     */
+    private KwfDriverQualificationDto driverQualification;
+}

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

@@ -0,0 +1,58 @@
+package com.sckw.fleet.model.dto;
+
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc 司机驾驶证信息
+ * @date 2023/7/7 0007
+ */
+@Data
+public class KwfDriverLicenseDto {
+
+    /**
+     * 主键
+     */
+    private String id;
+
+    /**
+     * 司机主键
+     */
+    private String driverId;
+
+    /**
+     * 驾驶证号
+     */
+    @Size(max=20, message = "驾驶证号长度不能大于20个字符!")
+    private String driverNo;
+
+    /**
+     * 准驾车型
+     */
+    private String type;
+
+    /**
+     * 有效日期
+     */
+    private Date expireTime;
+
+    /**
+     * 发证机关单位
+     */
+    @Size(max=20, message = "发证机关单位长度不能大于20个字符!")
+    private String grantUnit;
+
+    /**
+     * 证书正面URL地址
+     */
+    @Size(max=100, message = "证书正面URL地址长度不能大于100个字符!")
+    private String certificateMian;
+
+    /**
+     * 证书反面URL地址
+     */
+    @Size(max=100, message = "证书反面URL地址长度不能大于1000个字符!")
+    private String certificateRevolt;
+}

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

@@ -0,0 +1,58 @@
+package com.sckw.fleet.model.dto;
+
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc 司机从业资格证
+ * @date 2023/7/7 0007
+ */
+@Data
+public class KwfDriverQualificationDto {
+
+    /**
+     * 主键
+     */
+    private String id;
+
+    /**
+     * 司机主键
+     */
+    private String driverId;
+
+    /**
+     * 从业资格证号
+     */
+    @Size(max=20, message = "从业资格证号长度不能大于20个字符!")
+    private String qualiNo;
+
+    /**
+     * 准驾车型
+     */
+    private String type;
+
+    /**
+     * 有效日期
+     */
+    private Date expireTime;
+
+    /**
+     * 发证机关单位
+     */
+    @Size(max=20, message = "发证机关单位长度不能大于20个字符!")
+    private String grantUnit;
+
+    /**
+     * 证书正面URL地址
+     */
+    @Size(max=100, message = "证书正面URL地址长度不能大于100个字符!")
+    private String certificateMian;
+
+    /**
+     * 证书反面URL地址
+     */
+    @Size(max=100, message = "证书反面URL地址长度不能大于100个字符!")
+    private String certificateRevolt;
+}

+ 4 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfFleetDto.java

@@ -12,6 +12,7 @@ import lombok.Data;
  */
 @Data
 public class KwfFleetDto {
+
     /**
      * 主键
      */
@@ -21,25 +22,24 @@ public class KwfFleetDto {
      * 车队名称
      */
     @NotBlank(message = "车队班组不能为空!")
-    @Size(max=20, message = "输入长度不能大于20个字符!")
+    @Size(max=20, message = "车队班组长度不能大于20个字符!")
     private String name;
 
     /**
      * 车队联系人
      */
-    //@NotBlank(message = "车队长不能为空!")
-    @Size(max=20, message = "输入长度不能大于20个字符!")
+    @Size(max=20, message = "车队联系人长度不能大于20个字符!")
     private String contacts;
 
     /**
      * 联系电话
      */
-    //@NotBlank(message = "联系电话不能为空!")
     @Pattern(regexp = "^1[3456789]\\d{9}$", message = "联系电话格式不正确!")
     private String phone;
 
     /**
      * 备注
      */
+    @Size(max=200, message = "备注信息长度不能大于200个字符!")
     private String remark;
 }

+ 9 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java

@@ -0,0 +1,9 @@
+package com.sckw.fleet.model.vo;
+
+/**
+ * @author zk
+ * @desc TODO
+ * @date 2023/7/7 0007
+ */
+public class KwfDriverVo {
+}

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

@@ -1,10 +1,25 @@
 package com.sckw.fleet.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.PasswordUtils;
+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.KwfDriverMapper;
-import com.sckw.fleet.model.KwfDriver;
+import com.sckw.fleet.dao.*;
+import com.sckw.fleet.model.*;
+import com.sckw.fleet.model.dto.KwfDriverCardDto;
+import com.sckw.fleet.model.dto.KwfDriverDto;
+import com.sckw.fleet.model.dto.KwfDriverLicenseDto;
+import com.sckw.fleet.model.dto.KwfDriverQualificationDto;
+import com.sckw.fleet.model.vo.KwfDriverVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -18,6 +33,14 @@ public class KwfDriverService {
 
     @Autowired
     KwfDriverMapper driverDao;
+    @Autowired
+    KwfDriverEntMapper driverEntDao;
+    @Autowired
+    KwfDriverCardMapper KwfDriverCardDao;
+    @Autowired
+    KwfDriverLicenseMapper KwfDriverLicenseDao;
+    @Autowired
+    KwfDriverQualificationMapper KwfDriverQualificationDao;
 
     /**
      * @param key 逐渐id
@@ -35,8 +58,8 @@ public class KwfDriverService {
      * @author zk
      * @date 2023/7/6
      **/
-    public List<KwfDriver> findPage(Map<String, Object> params) {
-        return driverDao.selectPage(null, null);
+    public List<KwfDriverVo> findPage(Map<String, Object> params) {
+        return driverDao.findPage(params);
     }
 
     /**
@@ -50,24 +73,249 @@ public class KwfDriverService {
     }
 
     /**
-     * @param params 分页参数
+     * @param params 参数
      * @desc 新增司机
      * @author zk
      * @date 2023/7/6
      **/
-    public HttpResult add(KwfDriver params) {
-        driverDao.insert(params);
-        return null;
+    public HttpResult add(KwfDriverDto params) {
+        /**司机信息**/
+        KwfDriver driver = new KwfDriver();
+        BeanUtils.copyProperties(params, driver);
+        HttpResult result = driverEdit(driver);
+        if (result != null) {
+            return result;
+        }
+
+        /**身份证信息**/
+        params.getDriverCard().setDriverId(params.getId());
+        driverCardEdit(params.getDriverCard());
+
+        /**司机驾驶证信息**/
+        params.getDriverLicense().setDriverId(params.getId());
+        driverLicenseEdit(params.getDriverLicense());
+
+        /**司机从业资格证**/
+        params.getDriverQualification().setDriverId(params.getId());
+        driverQualificationEdit(params.getDriverQualification());
+
+        /**司机信息与企业关联信息**/
+        driverEntEdit(driver);
+        return HttpResult.ok("司机信息新增成功!");
     }
 
     /**
-     * @param params 分页参数
+     * @param params 参数
      * @desc 修改司机
      * @author zk
      * @date 2023/7/6
      **/
-    public HttpResult update(KwfDriver params) {
-        driverDao.updateById(params);
+    public HttpResult update(KwfDriverDto params) {
+        /**数据校验**/
+        if (StringUtils.isBlank(params.getId())) {
+            return HttpResult.error(HttpStatus.PARAMETERS_PATTERN_ERROR_CODE,"司机信息ID不能为空!");
+        }
+        KwfDriver driver = driverDao.selectById(params.getId());
+        if (driver == null) {
+            return HttpResult.error("司机信息不存在!");
+        }
+
+        /**司机信息**/
+        BeanUtils.copyProperties(params, driver);
+        HttpResult result = driverEdit(driver);
+        if (result != null) {
+            return result;
+        }
+
+        /**身份证信息**/
+        params.getDriverCard().setDriverId(params.getId());
+        driverCardEdit(params.getDriverCard());
+
+        /**司机驾驶证信息**/
+        params.getDriverLicense().setDriverId(params.getId());
+        driverLicenseEdit(params.getDriverLicense());
+
+        /**司机从业资格证**/
+        params.getDriverQualification().setDriverId(params.getId());
+        driverQualificationEdit(params.getDriverQualification());
+        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(",");
+        KwfDriver driverQuery = new KwfDriver();
+        driverQuery.setEntId(LoginUserHolder.getEntId());
+        for (String id : idArray) {
+            driverQuery.setId(Long.parseLong(id));
+            KwfDriver driver = driverDao.findEntDriver(driverQuery);
+            if (driver != null) {
+                driver.setDelFlag(Global.YES);
+                if (driverDao.updateById(driver) <= 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 driverEdit(KwfDriver params) {
+        if (StringUtils.isBlank(params.getId())) {
+            /**唯一性交易**/
+            List<Map<String, Object>> drivers = driverDao.findList(new HashMap(){{ put("phone", params.getPhone()); }});
+            if (!CollectionUtils.isEmpty(drivers)) {
+                return HttpResult.error("电话号码已存在!");
+            }
+
+            /**新增**/
+            String md5 = PasswordUtils.md5(params.getPhone());
+            String password = PasswordUtils.entryptPassword(md5);
+            params.setSalt(PasswordUtils.getSaltSubPwd(password));
+            params.setPassword(password);
+            params.setEntId(LoginUserHolder.getEntId());
+            int count = driverDao.insert(params);
+            return count > 0 ? null : HttpResult.error("司机信息新增失败!");
+        } else {
+            /**唯一性交易**/
+            List<Map<String, Object>> drivers = driverDao.findList(new HashMap(){{ put("phone", params.getPhone()); }});
+            //校验list中对象key值是否存在与value不一致的情况
+            boolean bool = CollectionUtils.listByKeyValueV1(drivers, "id", String.valueOf(params.getId()));
+            if (bool) {
+                return HttpResult.error("司机信息电话号码已存在!");
+            }
+
+            /**更新**/
+            int count = driverDao.updateById(params);
+            return count > 0 ? null : HttpResult.error("司机信息修改失败!");
+        }
+    }
+
+    /**
+     * @param params 参数
+     * @desc 新增身份证信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult driverCardEdit(KwfDriverCardDto params) {
+        /**数据copy**/
+        KwfDriverCard driverCard = new KwfDriverCard();
+        BeanUtils.copyProperties(params, driverCard);
+
+        /**数据更新**/
+        KwfDriverCard card = KwfDriverCardDao.findByDriverId(params.getDriverId());
+        if (card == null) {
+            int count = KwfDriverCardDao.insert(driverCard);
+        } else {
+            driverCard.setId(card.getId());
+            int count = KwfDriverCardDao.updateById(driverCard);
+        }
         return null;
     }
+
+    /**
+     * @param key 参数
+     * @desc 查询身份证信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public KwfDriverCard findCarByKey(Long key) {
+        return KwfDriverCardDao.findByDriverId(String.valueOf(key));
+    }
+
+    /**
+     * @param params 参数
+     * @desc 新增司机驾驶证信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult driverLicenseEdit(KwfDriverLicenseDto params) {
+        /**数据copy**/
+        KwfDriverLicense driverLicense = new KwfDriverLicense();
+        BeanUtils.copyProperties(params, driverLicense);
+
+        /**数据更新**/
+        KwfDriverLicense license = KwfDriverLicenseDao.findByDriverId(params.getDriverId());
+        if (license == null) {
+            int count = KwfDriverLicenseDao.insert(driverLicense);
+        } else {
+            driverLicense.setId(license.getId());
+            int count = KwfDriverLicenseDao.updateById(driverLicense);
+        }
+        return null;
+    }
+
+    /**
+     * @param key 参数
+     * @desc 查询司机驾驶证信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public KwfDriverLicense findLicenseByKey(Long key) {
+        return KwfDriverLicenseDao.findByDriverId(String.valueOf(key));
+    }
+
+    /**
+     * @param params 参数
+     * @desc 新增司机从业资格证
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public HttpResult driverQualificationEdit(KwfDriverQualificationDto params) {
+        /**数据copy**/
+        KwfDriverQualification driverQual = new KwfDriverQualification();
+        BeanUtils.copyProperties(params, driverQual);
+
+        /**数据更新**/
+        KwfDriverQualification qualification = KwfDriverQualificationDao.findByDriverId(params.getDriverId());
+        if (qualification == null) {
+            int count = KwfDriverQualificationDao.insert(driverQual);
+        } else {
+            driverQual.setId(qualification.getId());
+            int count = KwfDriverQualificationDao.updateById(driverQual);
+        }
+        return null;
+    }
+
+    /**
+     * @param key 参数
+     * @desc 查询司机从业资格证
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public KwfDriverQualification findQualificationByKey(Long key) {
+        return KwfDriverQualificationDao.findByDriverId(String.valueOf(key));
+    }
+
+    /**
+     * @param params 参数
+     * @desc 新增司机信息与企业关联信息
+     * @author zk
+     * @date 2023/7/7
+     **/
+    public void driverEntEdit(KwfDriver params) {
+        if (StringUtils.isBlank(params.getId())) {
+            KwfDriverEnt driverEnt = new KwfDriverEnt();
+            driverEnt.setDriverId(params.getId());
+            driverEnt.setEntId(params.getEntId());
+            driverEntDao.insert(driverEnt);
+        }
+    }
+
 }

+ 40 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfFleetService.java

@@ -1,7 +1,11 @@
 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.model.LoginUserInfo;
 import com.sckw.core.web.response.HttpResult;
@@ -44,8 +48,13 @@ public class KwfFleetService {
      * @date 2023/7/6
      **/
     public List<KwfFleetVo> findPage(Map<String, Object> params) {
+        /**获取查询数据集**/
         params.put("entId", LoginUserHolder.getEntId());
         List<KwfFleetVo> fleets = fleetDao.findPage(params);
+
+        /**数据组装**/
+        //dubbo获取用户信息
+
         return fleets;
     }
 
@@ -67,16 +76,17 @@ public class KwfFleetService {
      * @date 2023/7/6
      **/
     public HttpResult add(KwfFleetDto params) {
-        /**车队班组唯一性交易**/
+        /**唯一性交易**/
         List<Map<String, Object>> fleets = fleetDao.findList(new HashMap(){{
             put("name", params.getName()); put("entId", LoginUserHolder.getEntId());}});
         if (!CollectionUtils.isEmpty(fleets)) {
             return HttpResult.error("车队班组已存在!");
         }
 
-        /**车队班组新增**/
+        /**新增**/
         KwfFleet fleet = new KwfFleet();
         BeanUtils.copyProperties(params, fleet);
+        fleet.setEntId(LoginUserHolder.getEntId());
         int count = fleetDao.insert(fleet);
         return count > 0 ? HttpResult.ok("车队信息新增成功!") : HttpResult.error("车队信息新增失败!");
     }
@@ -88,7 +98,7 @@ public class KwfFleetService {
      * @date 2023/7/6
      **/
     public HttpResult update(KwfFleetDto params) {
-        /**车队班组唯一性交易**/
+        /**唯一性交易**/
         List<Map<String, Object>> fleets = fleetDao.findList(new HashMap(){{
             put("name", params.getName()); put("entId", LoginUserHolder.getEntId());}});
         //校验list中对象key值是否存在与value不一致的情况
@@ -97,10 +107,36 @@ public class KwfFleetService {
             return HttpResult.error("车队班组已存在!");
         }
 
-        /**车队班组更新**/
+        /**更新**/
         KwfFleet fleet = new KwfFleet();
         BeanUtils.copyProperties(params, fleet);
         int count = fleetDao.updateById(fleet);
         return count > 0 ? HttpResult.ok("车队信息修改成功!") : HttpResult.error("车队信息修改失败!");
     }
+
+    /**
+     * @param {ids:主键ID(多个以逗号隔开)}
+     * @description 删除
+     * @author zk
+     * @date 2023/7/6
+     **/
+    public HttpResult del(String ids) {
+        /*1.数据校验*/
+        if (StringUtils.isBlank(ids)) {
+            return HttpResult.error("请选择要删除的数据!");
+        }
+
+        String[] idArray = ids.split(",");
+        for (String id : idArray) {
+            KwfFleet fleet = fleetDao.selectById(id);
+            if (fleet != null) {
+                fleet.setDelFlag(Global.YES);
+                if (fleetDao.updateById(fleet) <= 0) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
+                }
+            }
+        }
+        return HttpResult.ok("删除成功!");
+    }
+
 }

+ 9 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverCardMapper.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.KwfDriverCardMapper">
 
+    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverCard" parameterType="java.lang.String" >
+        SELECT
+            id, driver_id driverId, idcard, expire_time expireTime, address, certificate_mian certificateMian,
+            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}
+    </select>
+
 </mapper>

+ 9 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverLicenseMapper.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.KwfDriverLicenseMapper">
 
+    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverLicense" parameterType="java.lang.String" >
+        SELECT
+            id, driver_id driverId, driver_no driverNo, type, expire_time expireTime, grant_unit grantUnit,
+            certificate_mian certificateMian, 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}
+    </select>
+
 </mapper>

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

@@ -2,4 +2,78 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfDriverMapper">
 
+    <select id="findPage" resultType="com.sckw.fleet.model.vo.KwfDriverVo" parameterType="java.util.Map" >
+        SELECT
+            dr.id, dr.name, dr.phone, dr.idcard, drc.expire_time idcardExpireTime, drc.address, drl.driver_no driverNo,
+            drl.type licenseType, drl.expire_time licenseExpireTime, drl.grant_unit licenseGrantUnit,
+            drq.quali_no qualiNo, dre.ent_id entId, dr.create_by createBy, dr.create_time crateTime,
+            dr.update_time updateTime, dr.remark, trr.truck_no truckNo
+        from kwf_driver dr
+        left join kwf_driver_ent dre on dre.driver_id = dr.id
+        left join kwf_driver_card drc on drc.driver_id = dr.id
+        left join kwf_driver_license drl on drl.driver_id = dr.id
+        left join kwf_driver_qualification drq on drq.driver_id = dr.id
+        left join kwf_truck_report trr on trr.ent_id = dre.ent_id and trr.driver_id = dr.id
+        where dr.del_flag = 0 and dre.del_flag = 0 and drc.del_flag = 0 and drl.del_flag = 0 and drq.del_flag = 0
+        <if test="entId != null and entId != ''">
+            and dre.ent_id = #{entId, jdbcType=VARCHAR}
+        </if>
+        <if test="name != null and name != ''">
+            and dr.name = #{name, jdbcType=VARCHAR}
+        </if>
+        <if test="idcard != null and idcard != ''">
+            and dr.idcard = #{idcard, jdbcType=VARCHAR}
+        </if>
+        <if test="phone != null and phone != ''">
+            and dr.phone = #{phone, jdbcType=VARCHAR}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (
+            dr.name like concat('%',#{keyWords},'%')
+            or dr.idcard like concat('%',#{keyWords},'%')
+            or dr.phone like concat('%',#{keyWords},'%')
+            )
+        </if>
+        ORDER BY dr.create_time desc
+    </select>
+
+    <select id="findList" resultType="java.util.Map" parameterType="java.util.Map" >
+        SELECT
+            dr.id, name, phone, salt, password, idcard, total_complete totalComplete,
+            total_take totalTake, total_weight totalWeight, dre.ent_id entId
+        from kwf_driver dr
+        left join kwf_driver_ent dre on dre.driver_id = dr.id
+        where dr.del_flag = 0 and dre.del_flag = 0
+        <if test="entId != null and entId != ''">
+            and dre.ent_id = #{entId, jdbcType=VARCHAR}
+        </if>
+        <if test="name != null and name != ''">
+            and dr.name = #{name, jdbcType=VARCHAR}
+        </if>
+        <if test="idcard != null and idcard != ''">
+            and dr.idcard = #{idcard, jdbcType=VARCHAR}
+        </if>
+        <if test="phone != null and phone != ''">
+            and dr.phone = #{phone, jdbcType=VARCHAR}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (
+            dr.name like concat('%',#{keyWords},'%')
+            or dr.idcard like concat('%',#{keyWords},'%')
+            or dr.phone like concat('%',#{keyWords},'%')
+            )
+        </if>
+        ORDER BY dr.create_time desc
+    </select>
+
+    <select id="findEntDriver" resultType="com.sckw.fleet.model.KwfDriver" parameterType="com.sckw.fleet.model.KwfDriver" >
+        SELECT
+            dr.id, name, phone, salt, password, idcard, total_complete totalComplete,
+            total_take totalTake, total_weight totalWeight, dre.ent_id entId
+            from kwf_driver dr
+            left join kwf_driver_ent dre on dre.driver_id = dr.id
+        where dr.del_flag = 0 and dre.del_flag = 0
+        and dre.ent_id = #{entId, jdbcType=VARCHAR}
+        and dr.id = #{id, jdbcType=VARCHAR}
+    </select>
 </mapper>

+ 9 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverQualificationMapper.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.KwfDriverQualificationMapper">
 
+    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverQualification" parameterType="java.lang.String" >
+        SELECT
+            id, driver_id driverId, quali_no qualiNo, type, expire_time expireTime, grant_unit grantUnit,
+            certificate_mian certificateMian, 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}
+    </select>
+
 </mapper>