Quellcode durchsuchen

Merge remote-tracking branch 'origin/dev' into dev

czh vor 2 Jahren
Ursprung
Commit
6c8b16a28a
28 geänderte Dateien mit 905 neuen und 121 gelöschten Zeilen
  1. 18 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictEnum.java
  2. 6 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java
  3. 3 3
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java
  4. 10 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/StringUtils.java
  5. 21 0
      sckw-modules/sckw-fleet/pom.xml
  6. 72 5
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java
  7. 8 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java
  8. 131 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverExport.java
  9. 29 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/ReplacePhoneDto.java
  10. 33 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/UpdatePasswordDto.java
  11. 144 3
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java
  12. 26 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTableTopCount.java
  13. 233 16
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  14. 53 30
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml
  15. 4 4
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoTradeOrder.java
  16. 2 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoTradeOrderAddress.java
  17. 1 1
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwpTransportDemand.java
  18. 1 1
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwpWantBuy.java
  19. 13 2
      sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java
  20. 5 1
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/GoodsListExport.java
  21. 8 10
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java
  22. 18 0
      sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwFleetController.java
  23. 2 2
      sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwTransportController.java
  24. 43 37
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java
  25. 2 0
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/ConsignOrderQuery.java
  26. 11 0
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/ConsignOrderVo.java
  27. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java
  28. 7 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/dubbo/TransportDubboServiceImpl.java

+ 18 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictEnum.java

@@ -20,6 +20,24 @@ public enum DictEnum {
     TRADE_TYPE_0("trade_type", "0", "预付款"),
     TRADE_TYPE_1("trade_type", "1", "货到付款"),
     TRADE_TYPE_2("trade_type", "2", "线下付款"),
+    PICKUP_TYPE_0("pickup_type", "0", "供应配送"),
+    PICKUP_TYPE_1("pickup_type", "1", "采方自提"),
+    DELIVERY_TYPE_0("delivery_type", "0", "签发交付"),
+    DELIVERY_TYPE_1("delivery_type", "1", "签收交付"),
+    TORDER_SOURCE_0("tOrder_source", "0", "采购下单"),
+    TORDER_SOURCE_1("tOrder_source", "1", "销售代客下单"),
+    TORDER_STATUS_0("tOrder_status", "0", "已保存"),
+    TORDER_STATUS_1("tOrder_status", "1", "待受理"),
+    TORDER_STATUS_2("tOrder_status", "2", "已退回"),
+    TORDER_STATUS_3("tOrder_status", "3", "待签约"),
+    TORDER_STATUS_4("tOrder_status", "4", "执行中"),
+    TORDER_STATUS_5("tOrder_status", "5", "已完结"),
+    TORDER_STATUS_6("tOrder_status", "6", "已对账"),
+    TORDER_STATUS_7("tOrder_status", "7", "已结算"),
+    TORDER_ADDRESS_TYPE_0("tOrder_address_type", "0", "装货地址"),
+    TORDER_ADDRESS_TYPE_1("tOrder_address_type", "1", "卸货地址"),
+    TORDER_UNIT_TYPE_1("tOrder_unit_type", "1", "销售单位"),
+    TORDER_UNIT_TYPE_2("tOrder_unit_type", "2", "采购单位"),
     ADDRESS_TYPE_0("address_type", "0", "矿山"),
     INDUSTRY_TYPE_0("industry_type", "0", "砂石"),
     CLASSIFICATION_TYPE_0("classification_type", "0", "石料"),

+ 6 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java

@@ -14,6 +14,12 @@ public enum DictTypeEnum {
     INTEGRAL_TYPE("integral_type", "积分类型"),
     PRICE_TYPE("price_type", "运价方式"),
     TRADE_TYPE("trade_type", "交易方式"),
+    PICKUP_TYPE("pickup_type", "提货方式"),
+    DELIVERY_TYPE("delivery_type", "交付类型"),
+    TORDER_SOURCE("tOrder_source", "交易订单来源"),
+    TORDER_STATUS("tOrder_status", "交易订单状态"),
+    TORDER_ADDRESS_TYPE("tOrder_address_type", "交易订单地址类型"),
+    TORDER_UNIT_TYPE("tOrder_unit_type", "交易订单单位类型"),
     ADDRESS_TYPE("address_type", "地址类型"),
     INDUSTRY_TYPE("industry_type", "行业类型"),
     CLASSIFICATION_TYPE("classification_type", "分类类型"),

+ 3 - 3
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java

@@ -122,13 +122,13 @@ public class PasswordUtils {
 
     public static void main(String[] args) {
 
-        String password = PasswordUtils.entryptPassword(PasswordUtils.md5("18482106067"));
-        String md5 = PasswordUtils.md5("123456");
+        String password = PasswordUtils.entryptPassword(PasswordUtils.md5("17358629958"));
+        String md5 = PasswordUtils.md5("17358629958");
         System.out.println(password);
         System.out.println(md5);
         System.out.println(validatePassword(md5, password));
 //        System.out.println(PasswordUtils.md5("czh"));
 //        System.out.println(PasswordUtils.entryptPassword(PasswordUtils.md5("czh")));
-
+        System.out.println(validatePassword(md5, "86e07d48c04c8a4bd9fe9dc819c608c43efda576b215995e9f138809"));
     }
 }

+ 10 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/StringUtils.java

@@ -683,6 +683,16 @@ public class StringUtils {
         return new String(newCodePoints, 0, outOffset);
     }
 
+    /**
+     * 值替换
+     * @param prefix
+     * @param args
+     * @return
+     */
+    public static String getKey(String prefix, String args) {
+        return String.format(prefix, args);
+    }
+
     public static void main(String[] args){
         Map<String, Object> param = new HashMap();
         param.put("account", "17358629955");

+ 21 - 0
sckw-modules/sckw-fleet/pom.xml

@@ -54,6 +54,11 @@
             <artifactId>sckw-common-sentinel</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-common-excel</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>com.sckw</groupId>
             <artifactId>sckw-system-api</artifactId>
@@ -61,4 +66,20 @@
 
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

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

@@ -7,24 +7,27 @@ 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.excel.easyexcel.RequestHolder;
+import com.sckw.excel.utils.ExcelUtil;
 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.model.dto.*;
 import com.sckw.fleet.model.vo.KwfDriverVo;
 import com.sckw.fleet.service.KwfDriverService;
+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;
 
 /**
  * @desc 司机
@@ -66,6 +69,18 @@ public class KwfDriverController {
         return HttpResult.ok(driverJson);
     }
 
+    /**
+     * @param params {page:页数、pageSize:每页条数、。。。}
+     * @desc 分页查询
+     * @author zk
+     * @date 2023/7/6
+     **/
+    @PostMapping("/statistics")
+    public HttpResult statistics(@RequestBody HashMap params) throws SystemException {
+        Map countMaps = driverService.statistics(params);
+        return HttpResult.ok(countMaps);
+    }
+
     /**
      * @param params {page:页数、pageSize:每页条数、。。。}
      * @desc 分页查询
@@ -92,6 +107,36 @@ public class KwfDriverController {
         return HttpResult.ok(driverService.findList(params));
     }
 
+    /**
+     * @param params 查询参数
+     * @description 导出
+     * @author zk
+     * @date 2023/07/11
+     **/
+    @PostMapping("/export")
+    public HttpResult export(@RequestBody HashMap params) {
+        /**查询分页数据**/
+        List<KwfDriverVo> drivers = driverService.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 driverService.importExcel(file);
+    }
+
     /**
      * @param params 新增参数
      * @return HttpResult
@@ -159,4 +204,26 @@ public class KwfDriverController {
         return driverService.driverQualificationEdit(params);
     }
 
+    /**
+     * @param {password 旧密码、newPassword 新密码、account 账号}
+     * @description 修改密码
+     * @author zk
+     * @date 2023/07/11
+     **/
+    @PostMapping("/updatePassword")
+    public HttpResult updatePassword(@Valid @RequestBody UpdatePasswordDto params) {
+        return driverService.updatePassword(params);
+    }
+
+    /**
+     * @param {driverId 司机主键id/登陆后缓存中取、phone 手机号、captcha 短信验证码}
+     * @description 更换手机号
+     * @author zk
+     * @date 2023/07/11
+     **/
+    @PostMapping("/replacePhone")
+    public HttpResult replacePhone(@Valid @RequestBody ReplacePhoneDto params) {
+        return driverService.replacePhone(params);
+    }
+
 }

+ 8 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.sckw.fleet.model.KwfDriver;
 import com.sckw.fleet.model.vo.KwfDriverVo;
+import com.sckw.fleet.model.vo.KwfTableTopCount;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -19,6 +20,13 @@ import java.util.Map;
 @Mapper
 public interface KwfDriverMapper extends BaseMapper<KwfDriver> {
 
+    /**
+     * 统计
+     * @param params
+     * @return
+     */
+    List<KwfTableTopCount> statistics(Map<String, Object> params);
+
     /**
      * 分页查询
      * @param params
@@ -26,8 +34,6 @@ public interface KwfDriverMapper extends BaseMapper<KwfDriver> {
      */
     List<KwfDriverVo> findPage(Map<String, Object> params);
 
-    IPage<KwfDriverVo> findPageV1(IPage<KwfDriverVo> page, @Param("params") KwfDriverVo params);
-
     /**
      * 查询
      * @param params

+ 131 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverExport.java

@@ -0,0 +1,131 @@
+package com.sckw.fleet.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author zk
+ * @desc 司机信息导出
+ * @date 2023/7/11 0011
+ */
+@Data
+@Accessors(chain = true)
+@ExcelContext(fileName = "司机信息", sheetName = "司机信息")
+public class KwfDriverExport {
+
+    @ExcelProperty(value = "司机姓名", index = 0)
+    private String name;
+
+    /**
+     * 电话
+     */
+    @ExcelProperty(value = "电话", index = 1)
+    private String phone;
+
+    /**
+     * 身份证号
+     */
+    @ExcelProperty(value = "身份证号", index = 2)
+    private String idcard;
+
+    /**
+     * 身份证有效时间
+     */
+    @ExcelProperty(value = "身份证有效时间", index = 3)
+    private String idcardExpireTime;
+
+    /**
+     * 身份证住址
+     */
+    @ExcelProperty(value = "身份证住址", index = 4)
+    private String address;
+
+    /**
+     * 驾驶证编号
+     */
+    @ExcelProperty(value = "驾驶证编号", index = 5)
+    private String driverNo;
+
+    /**
+     * 准驾车型
+     */
+    @ExcelProperty(value = "准驾车型", index = 6)
+    private String licenseType;
+
+    /**
+     * 驾驶证有效期至
+     */
+    @ExcelProperty(value = "驾驶证有效期至", index = 7)
+    private String licenseExpireTime;
+
+    /**
+     * 驾驶证发证机关
+     */
+    @ExcelProperty(value = "驾驶证发证机关", index = 8)
+    private String licenseGrantUnit;
+
+    /**
+     * 从业资格证号
+     */
+    @ExcelProperty(value = "从业资格证号", index = 9)
+    private String qualiNo;
+
+    /**
+     * 企业名称
+     */
+    @ExcelProperty(value = "企业名称", index = 10)
+    private String firmName;
+
+    /**
+     * 车队班组
+     */
+    @ExcelProperty(value = "车队班组", index = 11)
+    private String fleetName;
+
+    /**
+     * 车牌号
+     */
+    @ExcelProperty(value = "车牌号", index = 12)
+    private String truckNo;
+
+    /**
+     * 创建人
+     */
+    @ExcelProperty(value = "创建人", index = 13)
+    private String createByName;
+
+    /**
+     * 创建时间
+     */
+    @ExcelProperty(value = "创建时间", index = 14)
+    private String crateTime;
+
+    /**
+     * 更新时间
+     */
+    @ExcelProperty(value = "更新时间", index = 15)
+    private String updateTime;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注", index = 16)
+    private String remark;
+
+    /**
+     * 状态
+     */
+    @ExcelProperty(value = "状态", index = 17)
+    private String statusName;
+
+    /**
+     * 状态
+     */
+    private int status;
+
+    public String getStatusName() {
+        return status == 1 ? "已认证" : status == 2 ? "临时" : "异常";
+    }
+}

+ 29 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/ReplacePhoneDto.java

@@ -0,0 +1,29 @@
+package com.sckw.fleet.model.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Pattern;
+import lombok.Data;
+
+/**
+ * @author zk
+ * @desc 更换手机
+ * @date 2023/7/11 0011
+ */
+@Data
+public class ReplacePhoneDto {
+
+    /**
+     * 手机号
+     */
+    @NotBlank(message = "手机号不能为空!")
+    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "电话号码格式不正确!")
+    private String phone;
+
+    /**
+     * 验证码
+     */
+    @NotBlank(message = "验证码不能为空!")
+    private String captcha;
+
+    private Long driverId;
+}

+ 33 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/UpdatePasswordDto.java

@@ -0,0 +1,33 @@
+package com.sckw.fleet.model.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+/**
+ * @author zk
+ * @desc 修改密码
+ * @date 2023/7/11 0011
+ */
+@Data
+public class UpdatePasswordDto {
+
+    /**
+     * 账号
+     */
+    @NotBlank(message = "账号不能为空!")
+    private String account;
+
+    /**
+     * 旧密码
+     */
+    @NotBlank(message = "旧密码不能为空!")
+    private String password;
+
+    /**
+     * 新密码
+     */
+    @NotBlank(message = "新密码不能为空!")
+    private String newPassword;
+
+    private Long driverId;
+}

+ 144 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java

@@ -1,11 +1,152 @@
 package com.sckw.fleet.model.vo;
 
-import com.sckw.fleet.model.KwfDriver;
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Data;
 
 /**
  * @author zk
- * @desc TODO
+ * @desc 司机档案
  * @date 2023/7/7 0007
  */
-public class KwfDriverVo extends KwfDriver {
+@Data
+@ExcelContext(fileName = "司机信息", sheetName = "司机信息")
+public class KwfDriverVo {
+
+    /**
+     * 司机主键id
+     */
+    @ExcelIgnore
+    private String id;
+
+    /**
+     * 司机姓名
+     */
+    @ExcelProperty(value = "司机姓名", index = 0)
+    private String name;
+
+    /**
+     * 电话
+     */
+    @ExcelProperty(value = "电话", index = 1)
+    private String phone;
+
+    /**
+     * 状态
+     */
+    @ExcelProperty(value = "状态", index = 2)
+    private String statusName;
+
+    /**
+     * 身份证号
+     */
+    @ExcelProperty(value = "身份证号", index = 3)
+    private String idcard;
+
+    /**
+     * 身份证有效时间
+     */
+    @ExcelProperty(value = "身份证有效时间", index = 4)
+    private String idcardExpireTime;
+
+    /**
+     * 身份证住址
+     */
+    @ExcelProperty(value = "身份证住址", index = 5)
+    private String address;
+
+    /**
+     * 驾驶证编号
+     */
+    @ExcelProperty(value = "驾驶证编号", index = 6)
+    private String driverNo;
+
+    /**
+     * 准驾车型
+     */
+    @ExcelProperty(value = "准驾车型", index = 7)
+    private String licenseType;
+
+    /**
+     * 驾驶证有效期至
+     */
+    @ExcelProperty(value = "驾驶证有效期至", index = 8)
+    private String licenseExpireTime;
+
+    /**
+     * 驾驶证发证机关
+     */
+    @ExcelProperty(value = "驾驶证发证机关", index = 9)
+    private String licenseGrantUnit;
+
+    /**
+     * 从业资格证号
+     */
+    @ExcelProperty(value = "从业资格证号", index = 10)
+    private String qualiNo;
+
+    /**
+     * 车牌号
+     */
+    @ExcelProperty(value = "车牌号", index = 11)
+    private String truckNo;
+
+    /**
+     * 企业主键ID
+     */
+    @ExcelIgnore
+    private String entId;
+
+    /**
+     * 企业名称
+     */
+    @ExcelProperty(value = "企业名称", index = 12)
+    private String firmName;
+
+    /**
+     * 车队班组
+     */
+    @ExcelProperty(value = "车队班组", index = 13)
+    private String fleetName;
+
+    /**
+     * 创建人
+     */
+    @ExcelIgnore
+    private String createBy;
+
+    /**
+     * 创建人
+     */
+    @ExcelProperty(value = "创建人", index = 14)
+    private String createByName;
+
+    /**
+     * 创建时间
+     */
+    @ExcelProperty(value = "创建时间", index = 15)
+    private String crateTime;
+
+    /**
+     * 更新时间
+     */
+    @ExcelProperty(value = "更新时间", index = 16)
+    private String updateTime;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注", index = 17)
+    private String remark;
+
+    /**
+     * 状态
+     */
+    @ExcelIgnore
+    private int status;
+
+    public String getStatusName() {
+        return status == 1 ? "已认证" : status == 2 ? "临时" : "异常";
+    }
 }

+ 26 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTableTopCount.java

@@ -0,0 +1,26 @@
+package com.sckw.fleet.model.vo;
+
+import lombok.Data;
+
+/**
+ * @author zk
+ * @desc 表头统计值
+ * @date 2023/7/11 0011
+ */
+@Data
+public class KwfTableTopCount {
+    /**
+     * tab名称
+     */
+    private String name;
+
+    /**
+     * 状态值
+     */
+    private String value;
+
+    /**
+     * 统计值
+     */
+    private long total;
+}

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.sckw.core.exception.BusinessException;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.page.PageHelperUtil;
@@ -15,19 +16,28 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.excel.utils.EasyExcelUtil;
 import com.sckw.fleet.dao.*;
 import com.sckw.fleet.model.*;
-import com.sckw.fleet.model.dto.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.dto.*;
 import com.sckw.fleet.model.vo.KwfDriverVo;
+import com.sckw.fleet.model.vo.KwfTableTopCount;
+import com.sckw.redis.constant.RedisConstant;
+import com.sckw.redis.utils.RedissonUtils;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @desc 司机
@@ -48,6 +58,8 @@ public class KwfDriverService {
     KwfDriverLicenseMapper KwfDriverLicenseDao;
     @Autowired
     KwfDriverQualificationMapper KwfDriverQualificationDao;
+    @DubboReference(version = "2.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
 
     /**
      * @param key 逐渐id
@@ -59,6 +71,33 @@ public class KwfDriverService {
         return driverDao.selectById(key);
     }
 
+    /**
+     * @param params 参数
+     * @desc 统计
+     * @author zk
+     * @date 2023/7/11
+     **/
+    public Map statistics(Map<String, Object> params) {
+        /**统计数据**/
+        List<KwfTableTopCount> counts = driverDao.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 分页查询
@@ -66,7 +105,34 @@ public class KwfDriverService {
      * @date 2023/7/6
      **/
     public List<KwfDriverVo> findPage(Map<String, Object> params) {
-        return driverDao.findPage(params);
+        /**查询分页数据**/
+        List<KwfDriverVo> drivers = driverDao.findPage(params);
+        if (CollectionUtils.isEmpty(drivers)) {
+            return drivers;
+        }
+
+        /**获取查询数据**/
+        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()));
+        }
+        //用户数据集
+        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 (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);
+        }
+        return drivers;
     }
 
     /**
@@ -79,6 +145,16 @@ public class KwfDriverService {
         return driverDao.findList(params);
     }
 
+    /**
+     * @param {}
+     * @description 导出
+     * @author zk
+     * @date 2023/07/11
+     **/
+    public HttpResult importExcel(MultipartFile file) {
+        return null;
+    }
+
     /**
      * @param params 参数
      * @desc 新增司机
@@ -89,6 +165,13 @@ public class KwfDriverService {
         /**司机信息**/
         KwfDriver driver = new KwfDriver();
         BeanUtils.copyProperties(params, driver);
+        //证件都有数据则为已认证(前端校验认证数据必填)
+        boolean bool = checkLicense(params);
+        if (bool) {
+            driver.setStatus(Global.NUMERICAL_ONE);
+        } else {
+            driver.setStatus(Global.NUMERICAL_TWO);
+        }
         HttpResult result = driverEdit(driver);
         if (result.getCode() != HttpStatus.SUCCESS_CODE) {
             return result;
@@ -138,6 +221,11 @@ public class KwfDriverService {
 
         /**司机信息**/
         BeanUtils.copyProperties(params, driver);
+        //证件都有数据则为已认证(前端校验认证数据必填)
+        boolean bool = checkLicense(params);
+        if (bool) {
+            driver.setStatus(Global.NUMERICAL_ONE);
+        }
         HttpResult result = driverEdit(driver);
         if (result.getCode() != HttpStatus.SUCCESS_CODE) {
             return result;
@@ -245,15 +333,18 @@ public class KwfDriverService {
         BeanUtils.copyProperties(params, driverCard);
 
         /**数据更新**/
+        int count = 0;
         KwfDriverCard card = KwfDriverCardDao.findByDriverId(params.getDriverId());
         if (card == null) {
-            int count = KwfDriverCardDao.insert(driverCard);
-            return count > 0 ? HttpResult.ok("身份证信息更新成功!") : HttpResult.error("身份证信息更新失败!");
+            count = KwfDriverCardDao.insert(driverCard);
         } else {
             driverCard.setId(card.getId());
-            int count = KwfDriverCardDao.updateById(driverCard);
-            return count > 0 ? HttpResult.ok("身份证信息修改成功!") : HttpResult.error("身份证信息修改失败!");
+            count = KwfDriverCardDao.updateById(driverCard);
         }
+
+        /**校验司机是否有证书并更新状态**/
+        checkLicense(driverCard.getDriverId());
+        return count > 0 ? HttpResult.ok("身份证信息修改成功!") : HttpResult.error("身份证信息修改失败!");
     }
 
     /**
@@ -278,15 +369,19 @@ public class KwfDriverService {
         BeanUtils.copyProperties(params, driverLicense);
 
         /**数据更新**/
+        int count = 0;
         KwfDriverLicense license = KwfDriverLicenseDao.findByDriverId(params.getDriverId());
         if (license == null) {
-            int count = KwfDriverLicenseDao.insert(driverLicense);
+            count = KwfDriverLicenseDao.insert(driverLicense);
             return count > 0 ? HttpResult.ok("司机驾驶证信息更新成功!") : HttpResult.error("司机驾驶证信息更新失败!");
         } else {
             driverLicense.setId(license.getId());
-            int count = KwfDriverLicenseDao.updateById(driverLicense);
-            return count > 0 ? HttpResult.ok("司机驾驶证信息修改成功!") : HttpResult.error("司机驾驶证信息修改失败!");
+            count = KwfDriverLicenseDao.updateById(driverLicense);
         }
+
+        /**校验司机是否有证书并更新状态**/
+        checkLicense(driverLicense.getDriverId());
+        return count > 0 ? HttpResult.ok("司机驾驶证信息修改成功!") : HttpResult.error("司机驾驶证信息修改失败!");
     }
 
     /**
@@ -311,15 +406,18 @@ public class KwfDriverService {
         BeanUtils.copyProperties(params, driverQual);
 
         /**数据更新**/
+        int count = 0;
         KwfDriverQualification qualification = KwfDriverQualificationDao.findByDriverId(params.getDriverId());
         if (qualification == null) {
-            int count = KwfDriverQualificationDao.insert(driverQual);
-            return count > 0 ? HttpResult.ok("司机从业资格证信息更新成功!") : HttpResult.error("司机从业资格证信息更新失败!");
+            count = KwfDriverQualificationDao.insert(driverQual);
         } else {
             driverQual.setId(qualification.getId());
-            int count = KwfDriverQualificationDao.updateById(driverQual);
-            return count > 0 ? HttpResult.ok("司机从业资格证信息修改成功!") : HttpResult.error("司机从业资格证信息修改失败!");
+            count = KwfDriverQualificationDao.updateById(driverQual);
         }
+
+        /**校验司机是否有证书并更新状态**/
+        checkLicense(driverQual.getDriverId());
+        return count > 0 ? HttpResult.ok("司机从业资格证信息修改成功!") : HttpResult.error("司机从业资格证信息修改失败!");
     }
 
     /**
@@ -345,4 +443,123 @@ public class KwfDriverService {
         driverEntDao.insert(driverEnt);
     }
 
+    /**
+     * @param params 参数
+     * @desc: 修改密码
+     * @author: zk
+     * @date: 2023/7/11
+     */
+    public HttpResult updatePassword(UpdatePasswordDto params) {
+        /**获取信息**/
+        Long driverId = null;//LoginUserHolder.getUserId(); //暂时----------------zk
+        driverId = driverId == null ? params.getDriverId() : driverId;
+        KwfDriver driver = driverDao.selectById(driverId);
+        if (driver == null) {
+            return HttpResult.error("信息不存在!");
+        }
+
+        /**原密码校验**/
+        if (!PasswordUtils.validatePassword(params.getPassword(), driver.getPassword())) {
+            return HttpResult.error("原密码不正确!");
+        }
+
+        /**新旧密码不能一只**/
+        if (PasswordUtils.validatePassword(params.getNewPassword(), driver.getPassword())) {
+            return HttpResult.error("原密码与新密码不能一致!");
+        }
+
+        /**更新数据**/
+        driver.setPassword(PasswordUtils.entryptPassword(params.getNewPassword()));
+        driver.setSalt(PasswordUtils.getSaltSubPwd(driver.getPassword()));
+        int count = driverDao.updateById(driver);
+        return count > 0 ? HttpResult.ok("密码修改成功!") : HttpResult.error("密码修改失败!");
+    }
+
+    /**
+     * @param {driverId 司机主键id/登陆后缓存中取、phone 手机号、captcha 短信验证码}
+     * @description 更换手机号
+     * @author zk
+     * @date 2023/07/11
+     **/
+    public HttpResult replacePhone(ReplacePhoneDto params) {
+        /**获取信息**/
+        Long driverId = null;//LoginUserHolder.getUserId(); //暂时----------------zk
+        driverId = driverId == null ? params.getDriverId() : driverId;
+        KwfDriver driver = driverDao.selectById(driverId);
+        if (driver == null) {
+            return HttpResult.error("信息不存在!");
+        }
+
+        /**从缓存中取出验证码/校验**/
+        String valueKey = StringUtils.getKey(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, params.getPhone());
+        String phoneCaptcha = RedissonUtils.getString(valueKey);
+        if (StringUtils.isBlank(phoneCaptcha)) {
+            return HttpResult.error("手机验证码不正确请确认!");
+        }
+        if (!phoneCaptcha.equals(params.getCaptcha())) {
+            return HttpResult.error("手机验证码不正确请确认!");
+        }
+
+        /**唯一性交易**/
+        List<Map<String, Object>> drivers = driverDao.findList(new HashMap(){{ put("phone", params.getPhone()); }});
+        if (!CollectionUtils.isEmpty(drivers)) {
+            return HttpResult.error("电话号码已存在!");
+        }
+
+        /**更新数据**/
+        driver.setPhone(params.getPhone());
+        int count = driverDao.updateById(driver);
+        return count > 0 ? HttpResult.ok("手机号更换成功!") : HttpResult.error("手机号更换失败!");
+    }
+
+    /**
+     * @param params 参数
+     * @desc 校验司机是否有证书
+     * @author zk
+     * @date 2023/7/11
+     **/
+    public boolean checkLicense(KwfDriverDto params) {
+        //身份证
+        if (params.getDriverCard() == null || StringUtils.isBlank(params.getDriverCard().getIdcard())) {
+            return false;
+        }
+        //司机驾驶证信息
+        if (params.getDriverLicense() == null || StringUtils.isBlank(params.getDriverLicense().getDriverNo())) {
+            return false;
+        }
+        //司机从业资格证
+        if (params.getDriverQualification() == null || StringUtils.isBlank(params.getDriverQualification().getQualiNo())) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * @param driverId 司机id
+     * @desc 校验司机是否有证书并更新状态
+     * @author zk
+     * @date 2023/7/11
+     **/
+    public void checkLicense(Long driverId) {
+        //身份证
+        KwfDriverCard card = this.findCarByKey(driverId);
+        if (card == null || StringUtils.isBlank(card)) {
+            return;
+        }
+        //司机驾驶证信息
+        KwfDriverLicense license = this.findLicenseByKey(driverId);
+        if (license == null || StringUtils.isBlank(license.getDriverNo())) {
+            return;
+        }
+        //司机从业资格证
+        KwfDriverQualification quali = this.findQualificationByKey(driverId);
+        if (quali == null || StringUtils.isBlank(quali.getQualiNo())) {
+            return;
+        }
+        //更新数据
+        KwfDriver driver = new KwfDriver();
+        driver.setId(driverId);
+        driver.setStatus(Global.NUMERICAL_ONE);
+        driverDao.updateById(driver);
+    }
 }

+ 53 - 30
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml

@@ -2,19 +2,18 @@
 <!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 id="statistics" resultType="com.sckw.fleet.model.vo.KwfTableTopCount" 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
+        dr.`status` value, count(0) total
         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_driver_card drc on drc.driver_id = dr.id and drc.del_flag = 0
+        left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
+        left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
         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
+        left join kwf_fleet_driver flr on flr.id = dr.id and flr.del_flag = 0
+        left join kwf_fleet fl on fl.id = flr.fleet_id and fl.del_flag = 0
+        where dr.del_flag = 0 and dre.del_flag = 0
         <if test="entId != null and entId != ''">
             and dre.ent_id = #{entId, jdbcType=VARCHAR}
         </if>
@@ -27,46 +26,67 @@
         <if test="phone != null and phone != ''">
             and dr.phone = #{phone, jdbcType=VARCHAR}
         </if>
+        <if test="licenseType != null and licenseType != ''">
+            and drl.type = #{licenseType, 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="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
+        GROUP BY dr.`status`
     </select>
 
-    <select id="findPageV1" resultType="com.sckw.fleet.model.vo.KwfDriverVo" parameterType="java.util.Map" >
+    <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,
+        dr.id, dr.name, dr.phone, dr.idcard, dr.status, 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
+        dr.update_time updateTime, dr.remark, trr.truck_no truckNo, fl.name fleetName
         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_driver_card drc on drc.driver_id = dr.id and drc.del_flag = 0
+        left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
+        left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
         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="params.entId != null and params.entId != ''">
-            and dre.ent_id = #{params.entId, jdbcType=VARCHAR}
+        left join kwf_fleet_driver flr on flr.id = dr.id and flr.del_flag = 0
+        left join kwf_fleet fl on fl.id = flr.fleet_id and fl.del_flag = 0
+        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="params.name != null and params.name != ''">
-            and dr.name = #{params.name, jdbcType=VARCHAR}
+        <if test="name != null and name != ''">
+            and dr.name = #{name, jdbcType=VARCHAR}
         </if>
-        <if test="params.idcard != null and params.idcard != ''">
-            and dr.idcard = #{params.idcard, jdbcType=VARCHAR}
+        <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="licenseType != null and licenseType != ''">
+            and drl.type = #{licenseType, jdbcType=VARCHAR}
         </if>
-        <if test="params.phone != null and params.phone != ''">
-            and dr.phone = #{params.phone, jdbcType=VARCHAR}
+        <if test="fleetId != null and fleetId != ''">
+            and fl.id = #{fleetId, jdbcType=VARCHAR}
         </if>
-        <if test="params.keywords != null and params.keywords != ''">
+        <if test="fleetName != null and fleetName != ''">
+            and fl.name like concat('%',#{fleetName},'%')
+        </if>
+        <if test="status != null and status != ''">
+            and dr.status = #{status, jdbcType=VARCHAR}
+        </if>
+        <if test="keywords != null and keywords != ''">
             and (
-            dr.name like concat('%',#{params.keyWords},'%')
-            or dr.idcard like concat('%',#{params.keyWords},'%')
-            or dr.phone like concat('%',#{params.keyWords},'%')
+            dr.name like concat('%',#{keyWords},'%')
+            or dr.phone like concat('%',#{keyWords},'%')
             )
         </if>
         ORDER BY dr.create_time desc
@@ -91,6 +111,9 @@
         <if test="phone != null and phone != ''">
             and dr.phone = #{phone, jdbcType=VARCHAR}
         </if>
+        <if test="status != null and status != ''">
+            and dr.status = #{status, jdbcType=VARCHAR}
+        </if>
         <if test="keywords != null and keywords != ''">
             and (
             dr.name like concat('%',#{keyWords},'%')

+ 4 - 4
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoTradeOrder.java

@@ -45,17 +45,17 @@ public class KwoTradeOrder extends BaseModel {
     /**
      * 交易方式(预付款、货到付款)
      */
-    private Long trading;
+    private String trading;
 
     /**
      * 提货方式(采方自提、供应配送)
      */
-    private Long pickupType;
+    private String pickupType;
 
     /**
      * 交付类型(签发交付、签收交付)
      */
-    private Long deliveryType;
+    private String deliveryType;
 
     /**
      * 开始日期
@@ -80,6 +80,6 @@ public class KwoTradeOrder extends BaseModel {
     /**
      * 订单创建来源类型(采购下单/销售代客下单)
      */
-    private Integer source;
+    private String source;
 
 }

+ 2 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoTradeOrderAddress.java

@@ -32,7 +32,7 @@ public class KwoTradeOrderAddress extends BaseModel {
     /**
      * 地址类型(1装货地址、2卸货地址)
      */
-    private Integer addressType;
+    private String addressType;
 
     /**
      * 地址名称
@@ -42,7 +42,7 @@ public class KwoTradeOrderAddress extends BaseModel {
     /**
      * 地址类型
      */
-    private Long type;
+    private String type;
 
     /**
      * 联系人姓名

+ 1 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwpTransportDemand.java

@@ -49,7 +49,7 @@ public class KwpTransportDemand extends BaseModel {
     /**
      * 交易方式(预付款、货到付款、线下付款)
      */
-    private Long trading;
+    private String trading;
 
     /**
      * 运需单价(元)

+ 1 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwpWantBuy.java

@@ -49,7 +49,7 @@ public class KwpWantBuy extends BaseModel {
     /**
      * 交易方式(预付款、货到付款、线下付款)
      */
-    private Integer trading;
+    private String trading;
 
     /**
      * 求购单价(元)

+ 13 - 2
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java

@@ -1,8 +1,13 @@
 package com.sckw.product.controller;
 
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.excel.easyexcel.RequestHolder;
+import com.sckw.excel.utils.ExcelUtil;
+import com.sckw.product.model.GoodsListExport;
 import com.sckw.product.model.vo.req.*;
 import com.sckw.product.service.KwpGoodsService;
+import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
 import org.springframework.validation.annotation.Validated;
@@ -106,8 +111,14 @@ public class KwpGoodsController {
      * @return: com.sckw.core.web.response.HttpResult
      */
     @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
-    public void export(@RequestBody ExportGoodsListParam params) {
-        kwpGoodsService.export(params);
+    public HttpResult export(@RequestBody ExportGoodsListParam params) {
+        HttpServletResponse response = RequestHolder.getResponse();
+        List<GoodsListExport> list = kwpGoodsService.export(params);
+        if (CollectionUtils.isNotEmpty(list)) {
+            ExcelUtil.download(response, GoodsListExport.class, list);
+            return HttpResult.ok();
+        }
+        return HttpResult.error("没有可导出的数据");
     }
 
 

+ 5 - 1
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/GoodsListExport.java

@@ -1,9 +1,12 @@
 package com.sckw.product.model;
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.sckw.excel.annotation.ExcelContext;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+
 /**
  * @desc: 商品列表导出对象
  * @author: yzc
@@ -11,7 +14,8 @@ import lombok.experimental.Accessors;
  */
 @Data
 @Accessors(chain = true)
-public class GoodsListExport {
+@ExcelContext(fileName = "商品列表信息", sheetName = "商品列表信息")
+public class GoodsListExport implements Serializable {
 
     @ExcelProperty(value = "上架状态", index = 0)
     private String statusLabel;

+ 8 - 10
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

@@ -17,7 +17,6 @@ import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.excel.utils.DateUtil;
-import com.sckw.excel.utils.EasyExcelUtil;
 import com.sckw.product.dao.KwpGoodsMapper;
 import com.sckw.product.enums.GoodsStatusEnum;
 import com.sckw.product.model.*;
@@ -33,7 +32,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -408,7 +406,7 @@ public class KwpGoodsService {
                 List<Long> entIds = entList.stream().map(EntCacheResDto::getId).toList();
                 if (CollectionUtils.isEmpty(entIds)) {
                     wrapper.like(KwpGoods::getName, params.getKeywords());
-                }else {
+                } else {
                     wrapper.and(e -> e.in(KwpGoods::getSupplyEntId, entIds).or().like(KwpGoods::getName, params.getKeywords()));
                 }
             }
@@ -458,9 +456,12 @@ public class KwpGoodsService {
      * @Param params:
      * @return: void
      */
-    public void export(ExportGoodsListParam params) {
+    public List<GoodsListExport> export(ExportGoodsListParam params) {
         PageResult pageResult = select(BeanUtils.copyProperties(params, SelectGoodsListParam.class), false);
         List<GoodsList> goodsLists = pageResult.getList();
+        if (CollectionUtils.isEmpty(goodsLists)) {
+            return Collections.emptyList();
+        }
         List<GoodsListExport> list = new ArrayList<>();
         goodsLists.forEach(e -> {
             GoodsListExport export = BeanUtils.copyProperties(e, GoodsListExport.class);
@@ -470,11 +471,8 @@ public class KwpGoodsService {
                     .setAddedTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime()));
             list.add(export);
         });
-        try {
-            EasyExcelUtil.writeSingleExcel("商品列表信息", "sheet1", list, GoodsListExport.class);
-        } catch (IOException e) {
-            throw new BusinessException("导出商品列表异常", e.getMessage());
-        }
+        return list;
+
     }
 
     /**
@@ -564,7 +562,7 @@ public class KwpGoodsService {
             List<Long> entIds = entList.stream().map(EntCacheResDto::getId).toList();
             if (CollectionUtils.isNotEmpty(entIds)) {
                 wrapper.and(e -> e.in(KwpGoods::getSupplyEntId, entIds).or().like(KwpGoods::getName, params.getKeywords()));
-            }else {
+            } else {
                 wrapper.like(KwpGoods::getName, params.getKeywords());
             }
         }

+ 18 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwFleetController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -51,6 +52,23 @@ public class KwFleetController {
         streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
 
 
+        for (int i =0; i<10000; i++) {
+            order.setTOrderId(System.currentTimeMillis());
+            order.setTOrderNo("D" + order.getTOrderId());
+            order.setContractName(new Date()+"");
+            order.setActualAmount(new BigDecimal(0));
+            order.setContractId(1);
+            order.setContractNo("11");
+            order.setEndTime(new Date());
+            order.setSupplyEntId(1L);
+
+            busSum.setBusSumType("tradeOrder");
+            busSum.setMethod(method);
+            busSum.setObject(order);
+            streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
+        }
+
+
         //根据条件查询所有并排序,且分页
         Pageable pageable = PageRequest.of(0, 2);
         Page<SckwTradeOrder> all3 = tradeOrderRepository.findAll(pageable);

+ 2 - 2
sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwTransportController.java

@@ -74,14 +74,14 @@ public class KwTransportController {
      * @return
      */
     @RequestMapping(value = "/export", method = RequestMethod.GET)
-    public HttpResult export(ConsignOrderQuery query) {
+    public HttpResult export(@Validated @RequestBody ConsignOrderQuery query) {
         HttpServletResponse response = RequestHolder.getResponse();
         List<ConsignOrderVo> list = transportService.export(query);
         if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
             ExcelUtil.download(response, ConsignOrderVo.class, list);
             return null;
         }
-        return HttpResult.error("没有可导出的数据");
+        return HttpResult.ok("没有可导出的数据");
     }
 
 }

+ 43 - 37
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java

@@ -70,19 +70,26 @@ public class KwTransportService {
         Criteria c3 = new Criteria();
         Criteria c4 = new Criteria();
         Criteria c5 = new Criteria();
-        Pattern pattern = Pattern.compile("^.*" + query.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
-        c1 = Criteria.where("firmName").regex(pattern);
-        c2 = Criteria.where("carrierFirmName").regex(pattern);
-        c3 = Criteria.where("checkFirmName").regex(pattern);
-        c4 = Criteria.where("tOrderNo").regex(pattern);
-        c5 = Criteria.where("lOrderNo").regex(pattern);
-        criteria.orOperator(c1, c2, c3, c4, c5);
+        if (StringUtils.isNotBlank(query.getKeywords())) {
+            Pattern pattern = Pattern.compile("^.*" + query.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
+            c1 = Criteria.where("firmName").regex(pattern);
+            c2 = Criteria.where("carrierFirmName").regex(pattern);
+            c3 = Criteria.where("checkFirmName").regex(pattern);
+            c4 = Criteria.where("tOrderNo").regex(pattern);
+            c5 = Criteria.where("lOrderNo").regex(pattern);
+            criteria.orOperator(c1, c2, c3, c4, c5);
+        }
+
         Query query1 = new Query(criteria);
+        //in查询
+        if (CollectionUtils.isNotEmpty(query.getIds())) {
+            query1.addCriteria(Criteria.where("lOrderId").in(query.getIds()));
+        }
         // 12. 总记录数
         long total = mongoTemplate.count(query1, SckwLogisticsOrder.class);
         // 10. 分页
         query1.with(PageRequest.of(query.getPage() - 1, query.getPageSize(),
-                // 11. 排序
+                // 11. 排序list = {ArrayList@27436}  size = 3returnList = {ArrayList@27393}  size = 3
                 Sort.by(Sort.Order.desc("createTime"))));
         // 执行查询
         List<SckwLogisticsOrder> list = mongoTemplate.find(query1, SckwLogisticsOrder.class);
@@ -116,28 +123,24 @@ public class KwTransportService {
             criteria.andOperator(Criteria.where("createTime").gte(param.getStartDateTime()), Criteria.where("createTime")
                     .lte(param.getEndDateTime()));
         }
+        if (CollectionUtils.isNotEmpty(param.getIds())) {
+            criteria = Criteria.where("lOrderId").in(param.getIds());
+        }
         //多条件模糊查询
         Criteria c1 = new Criteria();
         Criteria c2 = new Criteria();
         Criteria c3 = new Criteria();
         Criteria c4 = new Criteria();
         Criteria c5 = new Criteria();
-        Pattern pattern = Pattern.compile("^.*" + param.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
-        c1 = Criteria.where("firmName").regex(pattern);
-        c2 = Criteria.where("carrierFirmName").regex(pattern);
-        c3 = Criteria.where("checkFirmName").regex(pattern);
-        c4 = Criteria.where("tOrderNo").regex(pattern);
-        c5 = Criteria.where("lOrderNo").regex(pattern);
-        criteria.orOperator(c1, c2, c3, c4, c5);
-//        if (StringUtils.isNotBlank(param.getKeywords() )) {
-//            criteria.and("firmName").regex(Pattern.compile("^.*" + param.getKeywords()  + ".*$", Pattern.CASE_INSENSITIVE));
-//            criteria.and("carrierFirmName").regex(Pattern.compile("^.*" + param.getKeywords()  + ".*$", Pattern.CASE_INSENSITIVE));
-//            criteria.and("checkFirmName").regex(Pattern.compile("^.*" + param.getKeywords()  + ".*$", Pattern.CASE_INSENSITIVE));
-//            criteria.and("tOrderNo").regex(Pattern.compile("^.*" + param.getKeywords()  + ".*$", Pattern.CASE_INSENSITIVE));
-//            criteria.and("tOrderNo").regex(Pattern.compile("^.*" + param.getKeywords()  + ".*$", Pattern.CASE_INSENSITIVE));
-//            criteria.and("lOrderNo").regex(Pattern.compile("^.*" + param.getKeywords()  + ".*$", Pattern.CASE_INSENSITIVE));
-//
-//        }
+        if (StringUtils.isNotBlank(param.getKeywords())) {
+            Pattern pattern = Pattern.compile("^.*" + param.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
+            c1 = Criteria.where("firmName").regex(pattern);
+            c2 = Criteria.where("carrierFirmName").regex(pattern);
+            c3 = Criteria.where("checkFirmName").regex(pattern);
+            c4 = Criteria.where("tOrderNo").regex(pattern);
+            c5 = Criteria.where("lOrderNo").regex(pattern);
+            criteria.orOperator(c1, c2, c3, c4, c5);
+        }
         Aggregation aggregation = Aggregation.newAggregation(
                 Aggregation.match(criteria),
                 Aggregation.group("status").count().as("total"),
@@ -177,20 +180,19 @@ public class KwTransportService {
         Criteria c3 = new Criteria();
         Criteria c4 = new Criteria();
         Criteria c5 = new Criteria();
-        Pattern pattern = Pattern.compile("^.*" + query.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
-        c1 = Criteria.where("firmName").regex(pattern);
-        c2 = Criteria.where("carrierFirmName").regex(pattern);
-        c3 = Criteria.where("checkFirmName").regex(pattern);
-        c4 = Criteria.where("tOrderNo").regex(pattern);
-        c5 = Criteria.where("lOrderNo").regex(pattern);
-        criteria.orOperator(c1, c2, c3, c4, c5);
+        if (StringUtils.isNotBlank(query.getKeywords())) {
+            Pattern pattern = Pattern.compile("^.*" + query.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
+            c1 = Criteria.where("firmName").regex(pattern);
+            c2 = Criteria.where("carrierFirmName").regex(pattern);
+            c3 = Criteria.where("checkFirmName").regex(pattern);
+            c4 = Criteria.where("tOrderNo").regex(pattern);
+            c5 = Criteria.where("lOrderNo").regex(pattern);
+            criteria.orOperator(c1, c2, c3, c4, c5);
+        }
         Query query1 = new Query(criteria);
-        // 12. 总记录数
-        long total = mongoTemplate.count(query1, SckwLogisticsOrder.class);
-        // 10. 分页
-        query1.with(PageRequest.of(query.getPage() - 1, query.getPageSize(),
-                // 11. 排序
-                Sort.by(Sort.Order.desc("createTime"))));
+        if (CollectionUtils.isNotEmpty(query.getIds())) {
+            query1.addCriteria(Criteria.where("lOrderId").in(query.getIds()));
+        }
         // 执行查询
         List<SckwLogisticsOrder> list = mongoTemplate.find(query1, SckwLogisticsOrder.class);
 //        PageResult build = PageResult.build(query.getPage(), query.getPageSize(), total, list);
@@ -240,6 +242,10 @@ public class KwTransportService {
             vo.setStatus(logisticsOrder.getStatus());
             vo.setUnloadAddress(logisticsOrder.getUnloadDetailAddress());
             vo.setWOrderNo(logisticsOrder.getWOrderNo());
+            vo.setCreateTime(logisticsOrder.getCreateTime() == null ?
+                    null : DateUtil.getDateTime(logisticsOrder.getCreateTime()));
+            vo.setUpdateTime(logisticsOrder.getUpdateTime() == null ?
+                    null : DateUtil.getDateTime(logisticsOrder.getUpdateTime()));
             returnList.add(vo);
         }
     }

+ 2 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/ConsignOrderQuery.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * @author lfdc
@@ -14,6 +15,7 @@ import java.io.Serializable;
 @Data
 @Accessors(chain = true)
 public class ConsignOrderQuery extends PageRequest implements Serializable {
+    private List<Long> ids;
     /**
      * 计费方式
      */

+ 11 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/ConsignOrderVo.java

@@ -1,6 +1,8 @@
 package com.sckw.report.service.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.sckw.core.model.page.PageResult;
+import com.sckw.excel.annotation.ExcelContext;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -11,30 +13,37 @@ import java.io.Serializable;
  * @date 2023-07-07 09:07:06
  */
 @Data
+@ExcelContext(fileName = "托运订单列表", sheetName = "托运订单列表")
 public class ConsignOrderVo extends PageResult implements Serializable {
     /**
      * 结算周期
      */
+    @ExcelProperty(value = "结算周期")
     private String accountsCycle;
     /**
      * 发起人
      */
+    @ExcelProperty(value = "发起人")
     private String appointor;
     /**
      * 计费方式
      */
+    @ExcelProperty(value = "计费方式")
     private String billingMode;
     /**
      * 承运单位
      */
+    @ExcelProperty(value = "承运单位")
     private String carrierCompany;
     /**
      * 承运联系人
      */
+    @ExcelProperty(value = "承运联系人")
     private String carrierContacts;
     /**
      * 承运订单
      */
+    @ExcelProperty(value = "承运订单")
     private String carrierOrder;
     /**
      * 承运联系电话
@@ -136,4 +145,6 @@ public class ConsignOrderVo extends PageResult implements Serializable {
      * 关联承运订单号
      */
     private String wOrderNo;
+    private String createTime;
+    private String updateTime;
 }

+ 1 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java

@@ -198,7 +198,7 @@ public class LogisticsConsignmentService {
         logisticsOrder.setUpdateByName(LoginUserHolder.getUserName());
         logisticsOrder.setUpdateTime(new Date());
         logisticsOrder.setGoodsPriceUnit(bo.getGoodsPriceUnit());
-        logisticsOrder.setContractName(new Date() + bo.getContractName());
+        logisticsOrder.setContractName(bo.getContractName());
         logisticsOrder.setBillingMode(bo.getBillingMode());
         //rabbitMq业务汇总数据发送/消费对象
         SckwBusSum busSum = new SckwBusSum();

+ 7 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/dubbo/TransportDubboServiceImpl.java

@@ -1,10 +1,16 @@
 package com.sckw.transport.service.dubbo;
 
+import com.sckw.transport.api.dubbo.TransportDubboService;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.stereotype.Service;
+
 /**
  * @author lfdc
  * @description 运输服务dubbo接口
  * @date 2023-07-11 14:07:28
  */
-public class TransportDubboServiceImpl implements TransportDubboService{
+@Service
+@DubboService(group = "design", version = "2.0.0")
+public class TransportDubboServiceImpl implements TransportDubboService {
 
 }