Bladeren bron

1.导出优化注解翻译
2.导出新增注解翻译方式类型二
3.运营端新增物流订单导出接口

lengfaqiang 2 jaren geleden
bovenliggende
commit
eed2fc12d1
40 gewijzigde bestanden met toevoegingen van 1194 en 209 verwijderingen
  1. 21 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/SourceInitializeException.java
  2. 25 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/TranslateException.java
  3. 18 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/ProjectStatusEnum.java
  4. 18 3
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Data.java
  5. 44 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/I18nMessage.java
  6. 54 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Page.java
  7. 72 48
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Result.java
  8. 1 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Status.java
  9. 5 0
      sckw-common/sckw-common-excel/pom.xml
  10. 3 3
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/annotation/EasyExcel.java
  11. 42 19
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/config/easyexcel/ExcelConverter.java
  12. 50 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/SourceUtil.java
  13. 20 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/Sources.java
  14. 117 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/Translator.java
  15. 43 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/annotation/Translate.java
  16. 21 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/annotation/Translates.java
  17. 74 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/context/Enums.java
  18. 87 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/context/Organization.java
  19. 48 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/context/Source.java
  20. 50 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/enums/Source.java
  21. 40 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/properties/TranslateProperties.java
  22. 87 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/wrapper/AbstractTranslator.java
  23. 87 0
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/wrapper/TranslateWrapper.java
  24. 4 4
      sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/utils/ValidUtil.java
  25. 1 0
      sckw-common/sckw-common-excel/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  26. 2 2
      sckw-modules/sckw-example/src/main/java/com/sckw/example/model/vo/ProjectPageVo.java
  27. 2 2
      sckw-modules/sckw-example/src/main/java/com/sckw/example/service/ExcelExportService.java
  28. 2 2
      sckw-modules/sckw-file/src/main/java/com/sckw/file/controller/FileApiController.java
  29. 2 2
      sckw-modules/sckw-file/src/main/java/com/sckw/file/service/FileService.java
  30. 0 5
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfFleetVo.java
  31. 0 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckReportVo.java
  32. 0 1
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/WaybillOrderListExport.java
  33. 1 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/operationManagement/ManagementLogisticsOrderController.java
  34. 7 3
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java
  35. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/ManagementLogisticsOrderVO.java
  36. 8 4
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/ManagementLogisticsOrderExcelVo.java
  37. 49 36
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java
  38. 5 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java
  39. 31 31
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ManagementLogisticsOrderService.java
  40. 52 40
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

+ 21 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/SourceInitializeException.java

@@ -0,0 +1,21 @@
+package com.sckw.core.exception;
+
+import lombok.Getter;
+
+/**
+ *
+ * 数据源初始化失败异常
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 17:13:33
+ * @copyright
+ */
+@Getter
+public class SourceInitializeException extends Exception {
+
+    public SourceInitializeException(String msg) {
+        super(msg);
+    }
+}

+ 25 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/TranslateException.java

@@ -0,0 +1,25 @@
+package com.sckw.core.exception;
+
+import lombok.Getter;
+
+/**
+ *
+ * 翻译失败时的异常
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-12-01 11:53:03
+ * @copyright
+ */
+@Getter
+public class TranslateException extends RuntimeException {
+
+    public TranslateException(String msg) {
+        super(msg);
+    }
+
+    public TranslateException(String msg, Throwable e) {
+        super(msg, e);
+    }
+}

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

@@ -47,4 +47,22 @@ public enum ProjectStatusEnum {
         }
         return null;
     }
+
+    public static  String getDestination(Integer code){
+        for (ProjectStatusEnum logisticsOrderEnum : ProjectStatusEnum.values()) {
+            if (logisticsOrderEnum.getCode().equals(code)) {
+                return logisticsOrderEnum.getName();
+            }
+        }
+        return null;
+    }
+
+    public static  String getName(Integer code){
+        for (ProjectStatusEnum logisticsOrderEnum : ProjectStatusEnum.values()) {
+            if (logisticsOrderEnum.getCode().equals(code)) {
+                return logisticsOrderEnum.getName();
+            }
+        }
+        return null;
+    }
 }

+ 18 - 3
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/Data.java → sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Data.java

@@ -1,4 +1,4 @@
-package com.sckw.core.web.response;
+package com.sckw.core.web.response.result;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 
@@ -11,6 +11,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 public class Data {
     @JsonInclude(JsonInclude.Include.NON_NULL)
     private Object body;
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private Page page;
 
     public static Data getData() {
         return new Data();
@@ -22,25 +24,38 @@ public class Data {
         return da;
     }
 
+    public static Data getData(Object data, Page page) {
+        Data da = new Data();
+        da.setBody(data);
+        da.setPage(page);
+        return da;
+    }
 
     public Object getBody() {
         return this.body;
     }
 
+    public Page getPage() {
+        return this.page;
+    }
 
     public void setBody(Object body) {
         this.body = body;
     }
 
+    public void setPage(Page page) {
+        this.page = page;
+    }
 
     public String toString() {
-        return "Data(body=" + this.getBody() + ")";
+        return "Data(body=" + this.getBody() + ", page=" + this.getPage() + ")";
     }
 
     public Data() {
     }
 
-    public Data(Object body) {
+    public Data(Object body, Page page) {
         this.body = body;
+        this.page = page;
     }
 }

+ 44 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/I18nMessage.java

@@ -0,0 +1,44 @@
+package com.sckw.core.web.response.result;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.MessageSource;
+import org.springframework.context.i18n.LocaleContextHolder;
+
+import java.util.Objects;
+
+/**
+ * @author lfdc
+ * @description
+ * @date 2023-09-14 09:09:06
+ */
+public class I18nMessage {
+    private static final Logger log = LoggerFactory.getLogger(I18nMessage.class);
+    private static MessageSource messageSource;
+
+    public I18nMessage() {
+        throw new IllegalArgumentException("MessageSource can't be null");
+    }
+
+    public I18nMessage(MessageSource messageSource) {
+        Objects.requireNonNull(messageSource, "MessageSource can't be null");
+        I18nMessage.messageSource = messageSource;
+    }
+
+    public static String getMessage(String msgCode, Object[] args) {
+        try {
+            return messageSource.getMessage(msgCode, args, LocaleContextHolder.getLocale());
+        } catch (Exception var3) {
+            if (log.isDebugEnabled()) {
+                var3.printStackTrace();
+            }
+
+            log.error("===> 读取国际化消息失败, code:{}, args:{}, ex:{}", new Object[]{msgCode, args, var3.getMessage() == null ? var3.toString() : var3.getMessage()});
+            return "-Unknown-";
+        }
+    }
+
+    public static String getMessage(String msgCode) {
+        return getMessage(msgCode, (Object[])null);
+    }
+}

+ 54 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Page.java

@@ -0,0 +1,54 @@
+package com.sckw.core.web.response.result;
+
+/**
+ * @author lfdc
+ * @description
+ * @date 2023-09-14 09:09:06
+ */
+public class Page {
+    private static final long serialVersionUID = 7367318386929321066L;
+    private long total;
+    private int page;
+    private int pageSize;
+
+    public static Page getPage(long total, int page, int pageSize) {
+        return new Page(total, page, pageSize);
+    }
+
+    public long getTotal() {
+        return this.total;
+    }
+
+    public int getPage() {
+        return this.page;
+    }
+
+    public int getPageSize() {
+        return this.pageSize;
+    }
+
+    public void setTotal(long total) {
+        this.total = total;
+    }
+
+    public void setPage(int page) {
+        this.page = page;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public String toString() {
+        return "Page(total=" + this.getTotal() + ", page=" + this.getPage() + ", pageSize=" + this.getPageSize() + ")";
+    }
+
+    public Page() {
+    }
+
+    public Page(long total, int page, int pageSize) {
+        this.total = total;
+        this.page = page;
+        this.pageSize = pageSize;
+    }
+}

+ 72 - 48
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/Result.java → sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Result.java

@@ -1,6 +1,9 @@
-package com.sckw.core.web.response;
+package com.sckw.core.web.response.result;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
 
 /**
  * @description:
@@ -8,16 +11,12 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
  * @copyright
  * @create: 2022-01-27 10:17
  **/
-public class Result {
+public class Result implements Serializable {
     private static final long serialVersionUID = 8295075842951977226L;
     private int status;
     private String msg;
-    //    @JsonProperty
-    private Object data;
-
-
-    public Result() {
-    }
+    @JsonProperty
+    private Data data;
 
     public Result(Status status) {
         this.status = status.getCode();
@@ -27,35 +26,51 @@ public class Result {
 
     public Result(Status status, Object data) {
         this.status = status.getCode();
-        this.data = data;
+        this.msg = status.getMsg();
+        this.data = Data.getData(data);
     }
 
+    public Result(Status status, Object data, Page page) {
+        this.status = status.getCode();
+        this.msg = status.getMsg();
+        this.data = Data.getData(data, page);
+    }
 
     public Result(Status status, String msg) {
         this.status = status.getCode();
         this.msg = msg;
-//        this.data = Data.getData();
+        this.data = Data.getData();
     }
 
     public Result(Status status, int msgCode) {
         this.status = status.getCode();
-        this.msg = String.valueOf(msgCode);
-//        this.data = Data.getData();
+        this.msg = I18nMessage.getMessage(String.valueOf(msgCode));
+        this.data = Data.getData();
     }
 
-
     public Result(Status status, String msg, Object data) {
         this.status = status.getCode();
         this.msg = msg;
-        this.data = data;
+        this.data = Data.getData(data);
     }
 
     public Result(Status status, int msgCode, Object data) {
         this.status = status.getCode();
-        this.msg = String.valueOf(msgCode);
-        this.data = data;
+        this.msg = I18nMessage.getMessage(String.valueOf(msgCode));
+        this.data = Data.getData(data);
+    }
+
+    public Result(Status status, String msg, Object data, Page page) {
+        this.status = status.getCode();
+        this.msg = msg;
+        this.data = Data.getData(data, page);
     }
 
+    public Result(Status status, int msgCode, Object data, Page page) {
+        this.status = status.getCode();
+        this.msg = I18nMessage.getMessage(String.valueOf(msgCode));
+        this.data = Data.getData(data, page);
+    }
 
     @JsonIgnore
     public boolean isSuccess() {
@@ -67,34 +82,66 @@ public class Result {
         return this.status != Status.SUCCESS.getCode();
     }
 
-    public Result success() {
+    public static Result success() {
         return new Result(Status.SUCCESS);
     }
 
-    public Result illegal() {
+    public static Result illegal() {
         return new Result(Status.BAD_REQUEST);
     }
 
-    public Result unauthorized() {
+    public static Result unauthorized() {
         return new Result(Status.UNAUTHORIZED);
     }
 
-    public Result forbidden() {
+    public static Result forbidden() {
         return new Result(Status.FORBIDDEN);
     }
 
-    public Result notFound() {
+    public static Result notFound() {
         return new Result(Status.NOT_FOUND);
     }
 
-    public Result failure() {
+    public static Result failure() {
         return new Result(Status.FAILURE);
     }
 
-    public Result conflict() {
+    public static Result conflict() {
         return new Result(Status.CONFLICT);
     }
 
+    public static Result build(Status status, Object data) {
+        return new Result(status, data);
+    }
+
+    public static Result build(Status status, Object data, Page page) {
+        return new Result(status, data, page);
+    }
+
+    public static Result build(Status status, String msg) {
+        return new Result(status, msg);
+    }
+
+    public static Result build(Status status, int msgCode) {
+        return new Result(status, msgCode);
+    }
+
+    public static Result build(Status status, String msg, Object data) {
+        return new Result(status, msg, data);
+    }
+
+    public static Result build(Status status, int msgCode, Object data) {
+        return new Result(status, msgCode, data);
+    }
+
+    public static Result build(Status status, String msg, Object data, Page page) {
+        return new Result(status, msg, data, page);
+    }
+
+    public static Result build(Status status, int msgCode, Object data, Page page) {
+        return new Result(status, msgCode, data, page);
+    }
+
     public int getStatus() {
         return this.status;
     }
@@ -103,7 +150,7 @@ public class Result {
         return this.msg;
     }
 
-    public Object getData() {
+    public Data getData() {
         return this.data;
     }
 
@@ -123,29 +170,6 @@ public class Result {
         return "Result(status=" + this.getStatus() + ", msg=" + this.getMsg() + ", data=" + this.getData() + ")";
     }
 
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public void setData(Object data) {
-        this.data = data;
-    }
-
-    public Result(int status, String msg, Object data) {
-        this.status = status;
-        this.msg = msg;
-        this.data = data;
-    }
-
-    public static Result build(Status status, Object data) {
-        return new Result(status, data);
-    }
-
-    public static Result build(Status status, String msg, Object data) {
-        return new Result(status, msg, data);
-    }
-
-    public static Result build(Status status, String msg) {
-        return new Result(status, msg);
+    public Result() {
     }
 }

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/Status.java → sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/result/Status.java

@@ -1,4 +1,4 @@
-package com.sckw.core.web.response;
+package com.sckw.core.web.response.result;
 
 /**
  * @description: 状态枚举

+ 5 - 0
sckw-common/sckw-common-excel/pom.xml

@@ -45,5 +45,10 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-context</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 3 - 3
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/annotation/EasyExcel.java

@@ -6,21 +6,21 @@ import java.lang.annotation.*;
  * @author lfdc
  * @version v1
  * @create 2020-11-28 15:37:35
- * @copyright 指定枚举类注解
+ * @copyright 指定枚举类注解进行翻译处理
  */
 @Target({ElementType.FIELD})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
 public @interface EasyExcel {
     /**
-     * 控件类型
+     * 控件类型-指定枚举类翻译
      *
      * @return
      */
     Class<? extends Enum> type();
 
     /**
-     * 默认翻译字段类型
+     * 默认翻译字段类型-代表字段类型处理 1字符串  2 Integer
      *
      * @return
      */

+ 42 - 19
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/config/easyexcel/ExcelConverter.java

@@ -7,6 +7,7 @@ import com.alibaba.excel.metadata.data.WriteCellData;
 import com.alibaba.excel.metadata.property.ExcelContentProperty;
 import com.sckw.core.common.enums.NumberConstant;
 import com.sckw.excel.annotation.EasyExcel;
+import lombok.extern.slf4j.Slf4j;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
@@ -17,6 +18,7 @@ import java.lang.reflect.Method;
  * @description 状态枚举信息获取(code->value,1代表失败 进行转换)
  * @date 2023-07-28 10:07:51
  */
+@Slf4j
 public class ExcelConverter implements Converter<String> {
     @Override
     public Class supportJavaTypeKey() {
@@ -57,11 +59,15 @@ public class ExcelConverter implements Converter<String> {
             return new WriteCellData(value.toString());
         }
         //将转换的值进行返回
+        if (invoke == null) {
+            return new WriteCellData();
+        }
         return new WriteCellData(invoke.toString());
     }
 
     /**
      * 应对不同枚举处理
+     *
      * @param value
      * @param status
      * @param type
@@ -72,25 +78,42 @@ public class ExcelConverter implements Converter<String> {
      */
     private Object verifyTranslate(String value, int status, Class<? extends Enum> type) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
         Object invoke = null;
-        if (NumberConstant.ONE == status) {
-            //获取枚举类的方法名 【destination】就是自己编写的函数,String.class 指定入参类型
-            Method codeOf = type.getMethod("getDestination", String.class);
-            //反射执行方法,此方法得到的是一个枚举实例(具体得到什么,结合自身项目)
-            invoke = codeOf.invoke(type, value);
-        } else if (NumberConstant.TWO == status) {
-            //获取枚举类的方法名 【destination】就是自己编写的函数,String.class 指定入参类型
-            Method codeOf = type.getMethod("getName", Integer.class);
-            //反射执行方法,此方法得到的是一个枚举实例(具体得到什么,结合自身项目)
-            invoke = codeOf.invoke(type, Integer.getInteger(value));
-        } else {
-            //获取枚举类的方法名 “codeOf”就是自己编写的函数,Integer.class 指定入参类型
-            Method codeOf = type.getMethod("getEntityByCode", Integer.class);
-            //反射执行方法,此方法得到的是一个枚举实例(具体得到什么,结合自身项目)
-            invoke = codeOf.invoke(type, value);
-            //枚举实例调用getname方法,得到name的值
-            Method getName = invoke.getClass().getMethod("getDestination");
-            //将转换的值进行返回
-            invoke = String.valueOf(getName.invoke(invoke));
+        try {
+            if (NumberConstant.ONE == status) {
+                //获取枚举类的方法名 【getDestination】就是自己编写的函数,String.class 指定入参类型
+                Method codeOf = type.getMethod("getDestination", String.class);
+                //反射执行方法,此方法得到的是一个枚举实例(具体得到什么,结合自身项目)
+                invoke = codeOf.invoke(type, value);
+            } else if (NumberConstant.TWO == status) {
+                //获取枚举类的方法名 【getName】就是自己编写的函数,String.class 指定入参类型
+                Method codeOf = type.getMethod("getName", Integer.class);
+                //反射执行方法,此方法得到的是一个枚举实例(具体得到什么,结合自身项目)
+                invoke = codeOf.invoke(type, Integer.valueOf(value));
+            } else {
+                //获取枚举类的方法名 “codeOf”就是自己编写的函数,Integer.class 指定入参类型
+                Method codeOf = type.getMethod("getEntityByCode", Integer.class);
+                //反射执行方法,此方法得到的是一个枚举实例(具体得到什么,结合自身项目)
+                invoke = codeOf.invoke(type, value);
+                //枚举实例调用getname方法,得到name的值
+                Method getName = invoke.getClass().getMethod("getDestination");
+                //将转换的值进行返回
+                invoke = String.valueOf(getName.invoke(invoke));
+            }
+        } catch (NoSuchMethodException e) {
+            log.info("NoSuchMethodException ERROR:{}", e.getMessage(), e);
+            throw new RuntimeException(e);
+        } catch (SecurityException e) {
+            log.info("SecurityException ERROR:{}", e.getMessage(), e);
+            throw new RuntimeException(e);
+        } catch (IllegalAccessException e) {
+            log.info("IllegalAccessException ERROR:{}", e.getMessage(), e);
+            throw new RuntimeException(e);
+        } catch (IllegalArgumentException e) {
+            log.info("IllegalArgumentException ERROR:{}", e.getMessage(), e);
+            throw new RuntimeException(e);
+        } catch (InvocationTargetException e) {
+            log.info("InvocationTargetException ERROR:{}", e.getMessage(), e);
+            throw new RuntimeException(e);
         }
         return invoke;
     }

+ 50 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/SourceUtil.java

@@ -0,0 +1,50 @@
+package com.sckw.excel.translate;
+
+import com.sckw.core.exception.SourceInitializeException;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * 数据源工具类
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 16:33:14
+ * @copyright
+ */
+@Slf4j
+//@Component
+//@Configuration
+public class SourceUtil {
+
+    public static Map<com.sckw.excel.translate.enums.Source,
+            com.sckw.excel.translate.context.Source> SOURCES_INSTANCE = new HashMap<>(2);
+
+    public static void put(com.sckw.excel.translate.enums.Source source,
+                           com.sckw.excel.translate.context.Source instance) {
+        SOURCES_INSTANCE.put(source, instance);
+    }
+
+    public static void remove(com.sckw.excel.translate.enums.Source source) {
+        SOURCES_INSTANCE.remove(source);
+    }
+
+    public static void clear() {
+        for (com.sckw.excel.translate.enums.Source source : SOURCES_INSTANCE.keySet()) {
+            SOURCES_INSTANCE.get(source).clear();
+        }
+    }
+
+    static Map<Integer, Object> get(com.sckw.excel.translate.enums.Source source) throws SourceInitializeException {
+        try {
+            return SOURCES_INSTANCE.get(source).get();
+        } catch (Exception e) {
+            log.error("failed to get data source, ex:{}", e.toString());
+            throw e;
+        }
+    }
+}

+ 20 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/Sources.java

@@ -0,0 +1,20 @@
+package com.sckw.excel.translate;
+
+/**
+ *
+ * 数据源常量
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 16:59:58
+ * @copyright
+ */
+public class Sources {
+
+    public static final String SOURCE_DICTIONARY = "source_dictionary";
+
+    public static final String SOURCE_ORGANIZATION = "source_organization";
+
+    public static final String SOURCE_ENUMERATE = "source_enumerate";
+}

+ 117 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/Translator.java

@@ -0,0 +1,117 @@
+package com.sckw.excel.translate;
+
+
+import com.sckw.core.common.enums.NumberConstant;
+import com.sckw.core.exception.SourceInitializeException;
+import com.sckw.core.exception.TranslateException;
+import com.sckw.excel.translate.annotation.Translate;
+import com.sckw.excel.translate.annotation.Translates;
+import com.sckw.excel.translate.enums.Source;
+import com.sckw.excel.translate.wrapper.AbstractTranslator;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.lang.Nullable;
+import org.springframework.util.Assert;
+
+import java.util.*;
+
+/**
+ *
+ * 处理翻译字段
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 15:17:54
+ * @copyright
+ */
+@Slf4j
+public class Translator extends AbstractTranslator {
+
+
+
+    /**
+     * 对某个参数值进行翻译 传入编码或者ID并指定数据源
+     * 如果传入的编码值没有匹配的数据会返回NULL
+     *
+     * @param code 参数编码值
+     * @param source 数据源{@see com.***.g3.common.translate.enums.Source}
+     * @return 翻译后的值
+     * @throws TranslateException 初始化数据源失败时抛出异常
+     */
+    @Nullable
+    public static Object translate(Integer code, Source source) {
+        try {
+            return SourceUtil.get(source).get(code);
+        } catch (Exception e) {
+            throw new TranslateException("translation failed. ex:" + e.toString(), e);
+        }
+    }
+
+    /**
+     * 对多个参数值进行翻译 传入编码或者ID的集合并指定数据源
+     * 如果传入的编码值没有匹配的数据会返回原始值
+     *
+     * @param codes  参数编码值 list
+     * @param source 数据源 {@see com.owinfo.mpw.common.translate.enums.Source}
+     * @return 翻译后的值
+     * @throws TranslateException 初始化数据源失败时抛出异常
+     */
+    @Nullable
+    public static List<Integer> translate(List<Integer> codes, Source source) {
+        try {
+            Map<Integer, Object> sources = SourceUtil.get(source);
+            List<Integer> result = new ArrayList<>(codes.size());
+            for (Integer code : codes) {
+                Object target = sources.get(code);
+                if (target == null) {
+                    log.warn("the target value of the translation is null, fieldValue -> {}", code);
+                    result.add(code);
+                } else {
+//                    result.add(target.toString());
+                    result.add((Integer) target);
+                }
+            }
+            return result;
+        } catch (Exception e) {
+            throw new TranslateException("translation failed. ex:" + e.toString(), e);
+        }
+    }
+
+    /**
+     * 对集合中所有的实体进行翻译
+     * 需要在实体中使用 {@link Translates} 或者 {@link Translate} 指定需要翻译的字段
+     * 指定后当前集合都会按照配置的字段列表进行翻译所有实体
+     *
+     * @param list 需要翻译的源实体 不能为空
+     * @throws TranslateException 初始化数据源失败时抛出异常
+     */
+    public static void translate(List list) {
+        try {
+            Assert.isTrue(list != null && list.size() > NumberConstant.ZERO, "the data source cannot be empty");
+            Translates translates = list.get(0).getClass().getAnnotation(Translates.class);
+            if (translates != null && translates.value().length > NumberConstant.ZERO) {
+                translate(Arrays.asList(translates.value()), list, getSources());
+                return;
+            }
+            Translate translate = list.get(0).getClass().getAnnotation(Translate.class);
+            if (translate != null) {
+                translate(Collections.singletonList(translate), list, getSources());
+                return;
+            }
+            throw new IllegalArgumentException("must specify @Translates or @Translate");
+        } catch (Exception e) {
+            if (e instanceof TranslateException) {
+                throw (TranslateException) e;
+            }
+            throw new TranslateException("translation failed. ex:" + e.toString(), e);
+        }
+    }
+
+    public static Map<Source, Map<Integer, Object>> getSources() throws SourceInitializeException {
+        Map<Source, Map<Integer, Object>> sources = new HashMap<>(2);
+        //sources.put(Source.DICTIONARY, SourceUtil.get(Source.DICTIONARY));
+//        sources.put(Source.ORGANIZATION, SourceUtil.get(Source.ORGANIZATION));
+        sources.put(Source.ENUMS, SourceUtil.get(Source.ENUMS));
+        return sources;
+    }
+}

+ 43 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/annotation/Translate.java

@@ -0,0 +1,43 @@
+package com.sckw.excel.translate.annotation;
+
+
+import java.lang.annotation.*;
+
+/**
+ *
+ * 对某个字段进行翻译
+ *
+ * 可以标注在类和方法上
+ * 1. 标注在类上:适用于对整个实体的指定字段进行翻译
+ * 2. 标注在方法上:适用于对方法的返回值中的data数据实体进行翻译
+ *
+ * 标注在类和方法上时,如果同时存在@Translates和@Translate,则@Translates会生效,@Translate不会生效
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 15:36:35
+ * @copyright
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Repeatable(Translates.class)
+@Documented
+public @interface Translate {
+    /**
+     * 需要翻译的字段
+     */
+    String field();
+    /**
+     * 指定数据源
+     */
+    com.sckw.excel.translate.enums.Source source()
+            default com.sckw.excel.translate.enums.Source.ENUMS;
+    /**
+     * 字段值为字符串
+     */
+    boolean isString() default true;
+    /**
+     * 字段值为数组
+     */
+    boolean isArray() default false;
+}

+ 21 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/annotation/Translates.java

@@ -0,0 +1,21 @@
+package com.sckw.excel.translate.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ *
+ * 组合注解
+ * 用于指定翻译多个字段
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 15:37:35
+ * @copyright
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Documented
+public @interface Translates {
+
+    Translate[] value();
+}

+ 74 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/context/Enums.java

@@ -0,0 +1,74 @@
+package com.sckw.excel.translate.context;
+
+import com.sckw.core.common.enums.NumberConstant;
+import com.sckw.core.exception.SourceInitializeException;
+import com.sckw.core.model.enums.LogisticsOrderEnum;
+import com.sckw.excel.translate.Sources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.Ordered;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * @author lfdc
+ * @version v1
+ * @create 2022-01-24 16:23:31
+ * @copyright
+ */
+@Component("enumsSource")
+public class Enums implements Source, Ordered {
+
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
+    public Enums() {
+        initial();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Map<Integer, Object> get() throws SourceInitializeException {
+        Object values = redisTemplate.opsForValue().get(Sources.SOURCE_ENUMERATE);
+        if (values == null) {
+            return flush();
+        }
+        return (Map<Integer, Object>) values;
+    }
+
+    /**
+     * 该方法获取枚举数据
+     * @return
+     * @throws SourceInitializeException
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    public Map<Integer, Object> flush() throws SourceInitializeException {
+        try {
+            Map<Integer, Object> source = new HashMap<>(NumberConstant.SIXTEEN);
+//            source.putAll(Stream.of(OrderCancelEnum.values()).collect(Collectors.toMap(OrderCancelEnum::getCode, OrderCancelEnum::getMsg)));
+//            source.putAll(Stream.of(WarehouseCheckEnum.values()).collect(Collectors.toMap(WarehouseCheckEnum::getCode, WarehouseCheckEnum::getMsg)));
+            source.putAll(Stream.of(LogisticsOrderEnum.values()).collect(Collectors.toMap(LogisticsOrderEnum::getCode, LogisticsOrderEnum::getDestination)));
+            redisTemplate.opsForValue().set(Sources.SOURCE_ENUMERATE, source, 1, TimeUnit.DAYS);
+            return source;
+        } catch (Exception e) {
+            throw new SourceInitializeException("failed to get enumerate cache data, ex:" + e.toString());
+        }
+    }
+
+    @Override
+    public void clear() {
+        redisTemplate.delete(Sources.SOURCE_ENUMERATE);
+    }
+
+    @Override
+    public int getOrder() {
+        return Ordered.LOWEST_PRECEDENCE;
+    }
+
+}

+ 87 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/context/Organization.java

@@ -0,0 +1,87 @@
+package com.sckw.excel.translate.context;
+
+import com.alibaba.fastjson.JSON;
+import com.sckw.core.common.enums.NumberConstant;
+import com.sckw.excel.translate.Sources;
+import com.sckw.core.exception.SourceInitializeException;
+import com.sckw.excel.translate.properties.TranslateProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.Ordered;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+import org.springframework.util.Assert;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ *
+ * 组织机构信息数据源
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 14:18:49
+ * @copyright
+ */
+@Component(value = "organizationSource")
+public class Organization implements Source, Ordered {
+
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Autowired
+    private TranslateProperties properties;
+
+    public Organization() {
+        initial();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Map<Integer, Object> get() throws SourceInitializeException {
+        Object values = redisTemplate.opsForValue().get(Sources.SOURCE_ORGANIZATION);
+        if (values == null) {
+            return flush();
+        }
+        return (Map<Integer, Object>) values;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Map<Integer, Object> flush() throws SourceInitializeException {
+        try {
+            String content = restTemplate.postForObject(properties.getOrganizationUrl(), null, String.class);
+            Map<String, Object> result = JSON.parseObject(content, Map.class);
+
+            Object status = result.get("status");
+            Assert.isTrue(status != null && (Integer) status == NumberConstant.TWO_HUNDRED, "The status code returned is failure");
+
+            Object data = result.get("data");
+            if (data != null) {
+                Map<Integer, Object> source = (Map<Integer, Object>) result.get("data");
+                if (!source.isEmpty()) {
+                    redisTemplate.opsForValue().set(Sources.SOURCE_ORGANIZATION, source, properties.getExpireTime(), TimeUnit.MINUTES);
+                    return source;
+                }
+            }
+            throw new SourceInitializeException("the resulting organization cache data is empty");
+        } catch (Exception e) {
+            throw new SourceInitializeException("failed to get organization cache data, ex:" + e.toString());
+        }
+    }
+
+    @Override
+    public void clear() {
+        redisTemplate.delete(Sources.SOURCE_ORGANIZATION);
+    }
+
+    @Override
+    public int getOrder() {
+        return Ordered.LOWEST_PRECEDENCE;
+    }
+}

+ 48 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/context/Source.java

@@ -0,0 +1,48 @@
+package com.sckw.excel.translate.context;
+
+
+import com.sckw.core.exception.SourceInitializeException;
+import com.sckw.excel.translate.SourceUtil;
+
+import java.util.Map;
+
+/**
+ *
+ * 翻译数据的数据源
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 14:15:00
+ * @copyright
+ */
+public interface Source {
+
+    /**
+     * 获取数据源
+     * @return key value格式的数据
+     * @throws SourceInitializeException 初始化数据源失败时抛出的异常
+     */
+    Map<Integer, Object> get() throws SourceInitializeException;
+
+    /**
+     * 刷新数据源
+     * @return 新的数据源
+     * @throws SourceInitializeException 初始化数据源失败时抛出的异常
+     */
+    Map<Integer, Object> flush() throws SourceInitializeException;
+
+    /**
+     * 清除数据源
+     */
+    void clear();
+
+    /**
+     * 初始化
+     */
+    default void initial() {
+        SourceUtil.put(com.sckw.excel.translate.enums.Source.valueOf(this.getClass()), this);
+    }
+
+
+}

+ 50 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/enums/Source.java

@@ -0,0 +1,50 @@
+package com.sckw.excel.translate.enums;
+
+/**
+ *
+ * 数据源枚举
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-12-01 11:18:37
+ * @copyright
+ */
+public enum Source {
+    /**
+     * 字典
+     */
+    DICTIONARY("context.Dictionary"),
+    /**
+     * 人员机构
+     */
+    ORGANIZATION("com.sckw.excel.translate.context.Organization"),
+    /**
+     * 枚举值
+     */
+    ENUMS("com.sckw.core.model.enums");
+
+    private String clazz;
+
+    Source(String clazz) {
+        this.clazz = clazz;
+    }
+
+    public String getClazz() {
+        return clazz;
+    }
+
+    public static <T extends com.sckw.excel.translate.context.Source> Source valueOf(Class<T> clazz) {
+        String clazzName = clazz.getName();
+        if (clazzName.equals(DICTIONARY.getClazz())) {
+            return DICTIONARY;
+        }
+        if (clazzName.equals(ORGANIZATION.getClazz())) {
+            return ORGANIZATION;
+        }
+        if (clazzName.equals(ENUMS.getClazz())) {
+            return ENUMS;
+        }
+        return null;
+    }
+}

+ 40 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/properties/TranslateProperties.java

@@ -0,0 +1,40 @@
+package com.sckw.excel.translate.properties;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
+import org.springframework.validation.annotation.Validated;
+
+
+/**
+ *
+ * 翻译的参数配置
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-30 17:22:34
+ * @copyright
+ */
+@Order(9)
+@Configuration
+@Getter
+@Setter
+@Validated
+@RefreshScope
+public class TranslateProperties {
+
+    /**
+     * 数据源的缓存时间 单位为分钟
+     */
+    @Value("${translate.cache:60}")
+    private long expireTime;
+
+    @Value("${translate.organizationUrl}")
+    @NotBlank(message = "translate.organizationUrl can't be null")
+    private String organizationUrl;
+}

+ 87 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/wrapper/AbstractTranslator.java

@@ -0,0 +1,87 @@
+package com.sckw.excel.translate.wrapper;
+
+
+import com.sckw.core.common.enums.NumberConstant;
+import com.sckw.core.exception.TranslateException;
+import com.sckw.excel.translate.annotation.Translate;
+import com.sckw.excel.translate.annotation.Translates;
+import com.sckw.excel.translate.enums.Source;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.Assert;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * 翻译器的抽象类
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2021-03-31 11:28:25
+ * @copyright
+ */
+@Slf4j
+public abstract class AbstractTranslator {
+
+
+    protected static void translate(List<Translate> translates, List list, Map<Source, Map<Integer, Object>> sources) {
+        for (Object obj : list) {
+            translate(translates, obj, sources);
+        }
+    }
+
+    protected static List<Translate> getTranslates(Method method) {
+        Translates translates = method.getAnnotation(Translates.class);
+        if (translates != null && translates.value().length > NumberConstant.ZERO) {
+            return Arrays.asList(translates.value());
+        }
+        return Collections.singletonList(method.getAnnotation(Translate.class));
+    }
+
+    @SuppressWarnings("unchecked")
+    protected static void translate(List<Translate> translates, Object obj, Map<Source, Map<Integer, Object>> sources) {
+        Class<?> clazz = obj.getClass();
+        for (Translate translate : translates) {
+            try {
+                Field field;
+                try {
+                    field = clazz.getDeclaredField(translate.field());
+                } catch (NoSuchFieldException e) {
+                    //try to get from the super class
+                    if (clazz.getSuperclass() != null) {
+                        field = clazz.getSuperclass().getDeclaredField(translate.field());
+                    } else {
+                        throw e;
+                    }
+                }
+
+                Assert.notNull(field, "the field specified by @Translate cannot be matched in the returned entity, field -> " + translate.field());
+                field.setAccessible(true);
+                if (translate.isArray()) {
+                    translate(translates, (List) field.get(obj), sources);
+                } else if (translate.isString()) {
+                    Map<Integer, Object> source = sources.get(translate.source());
+                    Object fieldVal = field.get(obj);
+                    if (fieldVal == null || StringUtils.isEmpty(fieldVal.toString())) {
+                        continue;
+                    }
+                    Object target = source.get(fieldVal);
+                    if (target != null) {
+                        field.set(obj, target);
+                    } else {
+                        log.warn("the target value of the translation is null, fieldValue -> {}", fieldVal);
+                    }
+                }
+            } catch (Exception e) {
+                throw new TranslateException("translation failed. Processing error, " + e.toString());
+            }
+        }
+    }
+}

+ 87 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/translate/wrapper/TranslateWrapper.java

@@ -0,0 +1,87 @@
+package com.sckw.excel.translate.wrapper;
+
+
+import com.sckw.core.web.response.result.Result;
+import com.sckw.excel.translate.Translator;
+import com.sckw.excel.translate.annotation.Translate;
+import com.sckw.excel.translate.enums.Source;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.core.Ordered;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * translate aop
+ *
+ *
+ * @author lfdc
+ * @version v1
+ * @create 2020-11-28 15:48:35
+ * @copyright
+ */
+@Component
+@Aspect
+@Slf4j
+public class TranslateWrapper implements Ordered {
+
+    public TranslateWrapper() {
+        log.info("The translator is loading complete. source -> {}", Arrays.toString(Source.values()));
+    }
+
+    @Pointcut("@annotation(com.sckw.excel.translate.annotation.Translates) || @annotation(com.sckw.excel.translate.annotation.Translate)")
+    public void annotationWrapper(){}
+
+    @Around(value = "annotationWrapper()")
+    @SuppressWarnings("unchecked")
+    public Object annotationHandler(ProceedingJoinPoint joinPoint) throws Throwable {
+
+        Object obj = joinPoint.proceed();
+        if(obj == null) {
+            log.warn("translate failed, method return value is null");
+            throw new IllegalArgumentException("method return value is null");
+        }
+
+        Result result = (Result) obj;
+        if (result.nonSuccess() || result.getData() == null || result.getData().getBody() == null) {
+            return obj;
+        }
+
+        Map<Source, Map<Integer, Object>> sources = Translator.getSources();
+
+        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
+        List<Translate> translates = Translator.getTranslates(method);
+
+        Object body = result.getData().getBody();
+        if(body instanceof List) {
+            Translator.translate(translates, (List) body, sources);
+        } else if(body instanceof Map) {
+            Map<String, Object> results = (Map<String, Object>) body;
+            results.values().forEach(value -> {
+                if(value instanceof List) {
+                    Translator.translate(translates, (List) value, sources);
+                } else {
+                    Translator.translate(translates, value, sources);
+                }
+            });
+        } else {
+            Translator.translate(translates, body, sources);
+        }
+
+        return obj;
+    }
+
+    @Override
+    public int getOrder() {
+        return Ordered.LOWEST_PRECEDENCE;
+    }
+}

+ 4 - 4
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/utils/ValidUtil.java

@@ -12,7 +12,7 @@ import java.util.List;
 import java.util.Set;
 
 /**
- * @author JiangPan
+ * @author
  * @version 1.0.0
  * @ClassName ValidUtil.java
  * @Description 参数校验工具类
@@ -36,7 +36,7 @@ public class ValidUtil {
      * @param object 待校验参数
      * @methodName: serviceValid
      * @return: com.alibaba.fastjson.JSONObject
-     * @Author: JiangPan
+     * @Author:
      * @date: 2021/10/20 14:51
      */
     public static HttpResult serviceValid(Object object) {
@@ -67,8 +67,8 @@ public class ValidUtil {
      * @param object        待校验参数
      * @param validateGroup 校验规则分组
      * @methodName: serviceValid
-     * @return: com.owinfo.config.result.Result
-     * @Author: JiangPan
+     * @return:
+     * @Author:
      * @date: 2021/12/22 10:47
      */
     public static HttpResult serviceValid(Object object, Class... validateGroup) {

+ 1 - 0
sckw-common/sckw-common-excel/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1 @@
+com.sckw.excel.translate.SourceUtil

+ 2 - 2
sckw-modules/sckw-example/src/main/java/com/sckw/example/model/vo/ProjectPageVo.java

@@ -20,8 +20,8 @@ public class ProjectPageVo {
      * 项目状态 ,index = 0
      */
     @ExcelProperty(value = "项目状态", converter = ExcelConverter.class)
-    @EasyExcel(type = ProjectStatusEnum.class, status = NumberConstant.ONE)
-    private Integer status;
+    @EasyExcel(type = ProjectStatusEnum.class, status = NumberConstant.TWO)
+    private String status;
 
     /**
      * 项目备注,index = 0

+ 2 - 2
sckw-modules/sckw-example/src/main/java/com/sckw/example/service/ExcelExportService.java

@@ -213,10 +213,10 @@ public class ExcelExportService {
 
     public List<ProjectPageVo> easyExcelDemo() {
         ProjectPageVo projectPageVo = new ProjectPageVo();
-        projectPageVo.setStatus(0);
+        projectPageVo.setStatus("0");
         projectPageVo.setRemark("0");
         ProjectPageVo projectPageVo1 = new ProjectPageVo();
-        projectPageVo1.setStatus(1);
+        projectPageVo1.setStatus("1");
         projectPageVo1.setRemark("0");
         List<ProjectPageVo> list = new ArrayList<>();
         list.add(projectPageVo);

+ 2 - 2
sckw-modules/sckw-file/src/main/java/com/sckw/file/controller/FileApiController.java

@@ -3,8 +3,8 @@ package com.sckw.file.controller;
 import com.sckw.core.model.file.FileInfo;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
-import com.sckw.core.web.response.Result;
-import com.sckw.core.web.response.Status;
+import com.sckw.core.web.response.result.Result;
+import com.sckw.core.web.response.result.Status;
 import com.sckw.file.api.dto.FileInfoDTO;
 import com.sckw.file.service.FileService;
 import com.sckw.file.service.dubbo.FileDubboApiServiceImpl;

+ 2 - 2
sckw-modules/sckw-file/src/main/java/com/sckw/file/service/FileService.java

@@ -13,8 +13,8 @@ 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.core.web.response.Result;
-import com.sckw.core.web.response.Status;
+import com.sckw.core.web.response.result.Result;
+import com.sckw.core.web.response.result.Status;
 import com.sckw.file.api.dto.FileInfoDTO;
 import com.sckw.file.config.FileListConfig;
 import com.sckw.file.dao.KwsFileInfoDao;

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

@@ -2,14 +2,9 @@ package com.sckw.fleet.model.vo;
 
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.sckw.core.model.base.BaseModel;
 import com.sckw.excel.annotation.ExcelContext;
-import com.sckw.fleet.model.KwfFleet;
 import lombok.Data;
 
-import java.util.Date;
-
 /**
  * @author zk
  * @desc 车队班组信息

+ 0 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckReportVo.java

@@ -4,7 +4,6 @@ import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.sckw.excel.annotation.ExcelContext;
 import lombok.Data;
-import java.util.Date;
 
 /**
  * @desc 车辆上报

+ 0 - 1
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/WaybillOrderListExport.java

@@ -1,7 +1,6 @@
 package com.sckw.report.service.param;
 
 import com.alibaba.excel.annotation.ExcelProperty;
-import com.sckw.core.model.page.PageRequest;
 import com.sckw.excel.annotation.ExcelContext;
 import lombok.Data;
 import lombok.experimental.Accessors;

+ 1 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/operationManagement/ManagementLogisticsOrderController.java

@@ -86,6 +86,7 @@ public class ManagementLogisticsOrderController {
         HttpServletResponse response = RequestHolder.getResponse();
         List<ManagementLogisticsOrderExcelVo> list = managementLogisticsOrderService.exportLogisticsOrder(query);
         if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
+//            Translator.translate(list);
             ExcelUtil.download(response, ManagementLogisticsOrderExcelVo.class, list);
             return null;
         }

+ 7 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java

@@ -204,7 +204,9 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
                                                          @Param("type") String type,
                                                          @Param("entId") Long entId,
                                                          @Param("contactsIds") List<Long> contactsIds,
-                                                         @Param("userIds") List<Long> userIds
+                                                         @Param("userIds") List<Long> userIds,
+                                                         @Param("idsList") List<Long> idsList
+
     );
 
 
@@ -214,11 +216,13 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      * @param entId
      * @return
      */
-    List<ManagementLogsiticsOrderVO> selectManagementLogisticsOrderList(@Param("query") ManagementLogisticsOrderQuery query,
+    List<ManagementLogisticsOrderVO> selectManagementLogisticsOrderList(@Param("query") ManagementLogisticsOrderQuery query,
                                                                         @Param("orderList") List<Integer> orderList,
                                                                         @Param("entId") Long entId,
                                                                         @Param("contactsIds") List<Long> contactsIds,
-                                                                        @Param("userIds") List<Long> userIds
+                                                                        @Param("userIds") List<Long> userIds,
+                                                                        @Param("idsList") List<Long> idsList
+
     );
 
     /**

+ 1 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/ManagementLogsiticsOrderVO.java → sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/ManagementLogisticsOrderVO.java

@@ -13,7 +13,7 @@ import java.time.LocalDate;
  * @date 2023-06-27 10:06:30
  */
 @Data
-public class ManagementLogsiticsOrderVO /*extends PageRequest*/ {
+public class ManagementLogisticsOrderVO /*extends PageRequest*/ {
     /**
      * 结算周期
      */

+ 8 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/ManagementLogisticsOrderExcelVo.java

@@ -17,6 +17,9 @@ import java.time.LocalDate;
  */
 @Data
 @ExcelContext(fileName = "托运订单列表", sheetName = "托运订单列表")
+//@Translates({
+//        @Translate(field = "status")
+//})
 public class ManagementLogisticsOrderExcelVo implements Serializable {
     /**
      * 结算周期
@@ -102,7 +105,7 @@ public class ManagementLogisticsOrderExcelVo implements Serializable {
     private String lOrderNo;
 
     /**
-     *  贸易订单编号
+     * 贸易订单编号
      */
     @JsonProperty("tOrderNo")
     @ExcelProperty(value = "贸易订单编号")
@@ -129,7 +132,7 @@ public class ManagementLogisticsOrderExcelVo implements Serializable {
     /**
      * 计划收货时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @ExcelProperty(value = "计划收货时间")
     private LocalDate receiveGoodsDateTime;
 
@@ -154,7 +157,7 @@ public class ManagementLogisticsOrderExcelVo implements Serializable {
     /**
      * 计划发货时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @ExcelProperty(value = "计划发货时间")
     private LocalDate shipmentsDateTime;
 
@@ -379,7 +382,8 @@ public class ManagementLogisticsOrderExcelVo implements Serializable {
 //    /**
 //     * 状态
 //     */
-//    @ExcelProperty(value = "状态")
+//    @ExcelProperty(value = "状态", converter = ExcelConverter.class)
+//    @EasyExcel(type = LogisticsOrderEnum.class, status = NumberConstant.TWO)
 //    private String status;
 //    /**
 //     * 卸货地点

+ 49 - 36
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java

@@ -1424,7 +1424,7 @@ public class AcceptCarriageOrderService {
             });
         }
         /**是否是一级订单,是->推送至贸易,否,数据推送至物流订单上级*/
-        if (logisticsOrder.getPid() == null && logisticsOrder.getType().equals("1") ) {
+        if (logisticsOrder.getPid() == null && logisticsOrder.getType().equals("1")) {
             //数据推送至贸易订单
             CompleteLogisticsOrderParam tradeOrder = new CompleteLogisticsOrderParam();
             //todo 2023-09-07 修改为传递页面传输值  不传递总量
@@ -2313,7 +2313,11 @@ public class AcceptCarriageOrderService {
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
 //        LoginUserHolder.getIsMain()
-        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList);
+        List<Long> idsList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getIds())) {
+            idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
+        }
+        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
         PageInfo<AcceptCarriageOrderVO> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(pageInfo, list);
@@ -2347,45 +2351,50 @@ public class AcceptCarriageOrderService {
             vo.setLoadAddress(vo.getLoadCityName() + vo.getLoadAddress());
             vo.setUnloadAddress(vo.getUnloadCityName() + vo.getUnloadAddress());
             if (vo.getTOrderId() != null) {
+//                try {
+//                    OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(vo.getTOrderId()));
+//                    if (orderDetailRes != null) {
+//                        List<UnitInfoDetailRes> unitInfo = orderDetailRes.getUnitInfo();
+//                        for (UnitInfoDetailRes detailRes : unitInfo) {
+//                            if (String.valueOf(NumberConstant.ONE).equals(detailRes.getUnitType())) {
+//                                vo.setShipmentsUnitEntId(String.valueOf(detailRes.getEntId()));
+//                                vo.setShipmentsUnit(detailRes.getFirmName());
+//                            } else {
+//                                vo.setReceiveGoodsUnitEntId(String.valueOf(detailRes.getEntId()));
+//                                vo.setReceiveGoodsUnit(detailRes.getFirmName());
+//                            }
+//                        }
+//                    }
+//                } catch (NumberFormatException e) {
+////                    throw new RuntimeException(e);
+//                    log.info("查询失败:{},信息:{}",vo.getTOrderId(),e.getMessage(),e);
+//                }
+            }
+            vo.setWaitDistributionAmount(vo.getCarryingCapacity().subtract(vo.getSubcontractAmount()).subtract(vo.getEntrustAmount()));
+            String tOrderId = vo.getTOrderId();
+            if (StringUtils.isNotBlank(tOrderId)) {
                 try {
-                    OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(vo.getTOrderId()));
-                    if (orderDetailRes != null) {
-                        List<UnitInfoDetailRes> unitInfo = orderDetailRes.getUnitInfo();
-                        for (UnitInfoDetailRes detailRes : unitInfo) {
-                            if (String.valueOf(NumberConstant.ONE).equals(detailRes.getUnitType())) {
-                                vo.setShipmentsUnitEntId(String.valueOf(detailRes.getEntId()));
-                                vo.setShipmentsUnit(detailRes.getFirmName());
-                            } else {
-                                vo.setReceiveGoodsUnitEntId(String.valueOf(detailRes.getEntId()));
-                                vo.setReceiveGoodsUnit(detailRes.getFirmName());
+                    OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
+                    if (orderDetailById != null) {
+                        List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
+                        if (CollectionUtils.isNotEmpty(unitInfo)) {
+                            for (UnitInfoDetailRes detailRes : unitInfo) {
+                                if ("1".equals(detailRes.getUnitType())) {
+                                    vo.setReceiveGoodsUnit(detailRes.getFirmName());
+                                    vo.setReceiveGoodsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                                }
+                                if ("2".equals(detailRes.getUnitType())) {
+                                    vo.setShipmentsUnit(detailRes.getFirmName());
+                                    vo.setShipmentsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                                }
                             }
                         }
                     }
-                } catch (NumberFormatException e) {
+                } catch (BusinessException e) {
 //                    throw new RuntimeException(e);
-                    log.info("查询失败:{},信息:{}",vo.getTOrderId(),e.getMessage(),e);
+                    log.info("查询失败:{},信息:{}", vo.getTOrderId(), e.getMessage(), e);
                 }
             }
-            vo.setWaitDistributionAmount(vo.getCarryingCapacity().subtract(vo.getSubcontractAmount()).subtract(vo.getEntrustAmount()));
-//            String tOrderId = vo.getTOrderId();
-//            if (StringUtils.isNotBlank(tOrderId)) {
-//                OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
-//                if (orderDetailById != null) {
-//                    List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
-//                    if (CollectionUtils.isNotEmpty(unitInfo)) {
-//                        for (UnitInfoDetailRes detailRes : unitInfo) {
-//                            if ("1".equals(detailRes.getUnitType())) {
-//                                vo.setReceiveGoodsUnit(detailRes.getFirmName());
-//                                vo.setReceiveGoodsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
-//                            }
-//                            if ("2".equals(detailRes.getUnitType())) {
-//                                vo.setShipmentsUnit(detailRes.getFirmName());
-//                                vo.setShipmentsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
-//                            }
-//                        }
-//                    }
-//                }
-//            }
 
         }
         return PageRes.build(pageInfo, list);
@@ -2511,6 +2520,10 @@ public class AcceptCarriageOrderService {
      * @return
      */
     public List<AcceptCarriageOrderExcelVo> exportAcceptCarriage(AcceptCarriageOrderQuery query, String type) {
+        List<Long> idsList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getIds())) {
+            idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
+        }
         Long entId = LoginUserHolder.getEntId();
 //        PageHelper.startPage(query.getPage(), query.getPageSize());
         List<Integer> orderList = new ArrayList<>();
@@ -2546,7 +2559,7 @@ public class AcceptCarriageOrderService {
         List<Long> longs = LoginUserHolder.getAuthUserIdList();
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
-        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList);
+        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
         /**计费方式*/
         Map<String, String> chargingDictData = getDictData(DictTypeEnum.CHARGING_TYPE.getType());
         /**结算周期*/
@@ -2726,7 +2739,7 @@ public class AcceptCarriageOrderService {
         } else if (lastWeek.getWaitingAmount().compareTo(new BigDecimal("0.00")) == 0) {
             chainRatio = new BigDecimal("100.00").subtract(chainRatio);
         } else {
-            chainRatio = (currentWeek.getWaitingAmount().subtract(lastWeek.getWaitingAmount())).divide(lastWeek.getWaitingAmount(),NumberConstant.SIX, BigDecimal.ROUND_HALF_UP)
+            chainRatio = (currentWeek.getWaitingAmount().subtract(lastWeek.getWaitingAmount())).divide(lastWeek.getWaitingAmount(), NumberConstant.SIX, BigDecimal.ROUND_HALF_UP)
                     .multiply(new BigDecimal("100.00")).setScale(NumberConstant.TWO, BigDecimal.ROUND_HALF_UP);
         }
         if (chainRatio.compareTo(new BigDecimal("0.00")) == -1) {

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

@@ -1648,7 +1648,11 @@ public class ConsignOrderService {
         List<Long> longs = LoginUserHolder.getAuthUserIdList();
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
-        List<AcceptCarriageOrderVO> list = kwtLogisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList);
+        List<Long> idsList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getIds())) {
+            idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
+        }
+        List<AcceptCarriageOrderVO> list = kwtLogisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
         PageInfo<AcceptCarriageOrderVO> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(pageInfo, list);

+ 31 - 31
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ManagementLogisticsOrderService.java

@@ -31,7 +31,7 @@ import com.sckw.transport.model.*;
 import com.sckw.transport.model.param.LogisticsOrderQuery;
 import com.sckw.transport.model.param.ManagementLogisticsOrderQuery;
 import com.sckw.transport.model.vo.CarWaybillVO;
-import com.sckw.transport.model.vo.ManagementLogsiticsOrderVO;
+import com.sckw.transport.model.vo.ManagementLogisticsOrderVO;
 import com.sckw.transport.model.vo.OrderDetailVO;
 import com.sckw.transport.model.vo.execlVo.ManagementLogisticsOrderExcelVo;
 import lombok.extern.slf4j.Slf4j;
@@ -98,6 +98,10 @@ public class ManagementLogisticsOrderService {
      * @return
      */
     public PageRes selectLogisticsOrder(ManagementLogisticsOrderQuery query) {
+        List<Long> idsList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getIds())) {
+            idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
+        }
         Long entId = LoginUserHolder.getEntId();
         PageHelper.startPage(query.getPage(), query.getPageSize());
         List<Integer> orderList = new ArrayList<>();
@@ -134,8 +138,8 @@ public class ManagementLogisticsOrderService {
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
 //        LoginUserHolder.getIsMain()
-        List<ManagementLogsiticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList);
-        PageInfo<ManagementLogsiticsOrderVO> pageInfo = new PageInfo<>(list);
+        List<ManagementLogisticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList, idsList);
+        PageInfo<ManagementLogisticsOrderVO> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(pageInfo, list);
         }
@@ -154,12 +158,12 @@ public class ManagementLogisticsOrderService {
 //        Map<String, String> taxRateTypeDictData = getDictData(DictTypeEnum.TAX_RATE_TYPE.getType());
         Map<Long, UserCacheResDto> longUserMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         if (CollectionUtils.isNotEmpty(list)) {
-            List<Long> collect = list.stream().map(ManagementLogsiticsOrderVO::getCreateBy).collect(Collectors.toList());
+            List<Long> collect = list.stream().map(ManagementLogisticsOrderVO::getCreateBy).collect(Collectors.toList());
             if (CollectionUtils.isNotEmpty(collect)) {
                 longUserMap = remoteSystemService.queryUserCacheMapByIds(collect);
             }
         }
-        for (ManagementLogsiticsOrderVO vo : list) {
+        for (ManagementLogisticsOrderVO vo : list) {
             vo.setAccountsCycleLabel(settlementDictData.get(vo.getAccountsCycle()));
             vo.setAppointor(longUserMap.get(vo.getCreateBy()) == null ? null : longUserMap.get(vo.getCreateBy()).getName());
             vo.setBillingModeLabel(chargingDictData.get(vo.getBillingMode()));
@@ -244,6 +248,10 @@ public class ManagementLogisticsOrderService {
     }
 
     public List<ManagementLogisticsOrderExcelVo> exportLogisticsOrder(ManagementLogisticsOrderQuery query) {
+        List<Long> idsList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getIds())) {
+            idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
+        }
         Long entId = LoginUserHolder.getEntId();
 //        PageHelper.startPage(query.getPage(), query.getPageSize());
         List<Integer> orderList = new ArrayList<>();
@@ -279,7 +287,7 @@ public class ManagementLogisticsOrderService {
         List<Long> longs = LoginUserHolder.getAuthUserIdList();
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
-        List<ManagementLogsiticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList);
+        List<ManagementLogisticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList, idsList);
         /**计费方式*/
         Map<String, String> chargingDictData = commonService.getDictData(DictTypeEnum.CHARGING_TYPE.getType());
         /**结算周期*/
@@ -292,15 +300,16 @@ public class ManagementLogisticsOrderService {
         Map<String, String> priceType = commonService.getDictData(DictTypeEnum.PRICE_TYPE.getType());
         Map<Long, UserCacheResDto> longUserMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         if (CollectionUtils.isNotEmpty(list)) {
-            List<Long> collect = list.stream().map(ManagementLogsiticsOrderVO::getCreateBy).collect(Collectors.toList());
+            List<Long> collect = list.stream().map(ManagementLogisticsOrderVO::getCreateBy).collect(Collectors.toList());
             if (CollectionUtils.isNotEmpty(collect)) {
                 longUserMap = remoteSystemService.queryUserCacheMapByIds(collect);
             }
         }
         List<ManagementLogisticsOrderExcelVo> exportList = new ArrayList<>();
-        for (ManagementLogsiticsOrderVO vo : list) {
+        for (ManagementLogisticsOrderVO vo : list) {
             ManagementLogisticsOrderExcelVo managementLogisticsOrderExcelVo = new ManagementLogisticsOrderExcelVo();
             BeanUtils.copyProperties(vo, managementLogisticsOrderExcelVo);
+//            managementLogisticsOrderExcelVo.setStatus(vo.getStatus().toString());
             managementLogisticsOrderExcelVo.setPriceLabel(vo.getPrice() == null ? null : vo.getPrice().toString() + priceType.get(vo.getPriceType()));
             managementLogisticsOrderExcelVo.setLossUnitLabel(vo.getLoss() == null ? null : vo.getLoss().toString() + taxRate.get(vo.getLossUnit()));
             managementLogisticsOrderExcelVo.setGoodsPriceLabel(vo.getGoodsPrice() == null ? null : vo.getGoodsPrice().toString() + priceType.get(vo.getGoodsPriceUnit()));
@@ -311,37 +320,28 @@ public class ManagementLogisticsOrderService {
             managementLogisticsOrderExcelVo.setStatusLabel(LogisticsOrderEnum.getName(vo.getStatus()));
             managementLogisticsOrderExcelVo.setLoadAddress(vo.getLoadCityName() + vo.getLoadAddress());
             managementLogisticsOrderExcelVo.setUnloadAddress(vo.getUnloadCityName() + vo.getUnloadAddress());
-            if (vo.getTOrderId() != null) {
-                OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(vo.getTOrderId()));
-                if (orderDetailRes != null) {
-                    List<UnitInfoDetailRes> unitInfo = orderDetailRes.getUnitInfo();
-                    for (UnitInfoDetailRes detailRes : unitInfo) {
-                        if (String.valueOf(NumberConstant.ONE).equals(detailRes.getUnitType())) {
-                            managementLogisticsOrderExcelVo.setShipmentsUnit(detailRes.getFirmName());
-                        } else {
-                            managementLogisticsOrderExcelVo.setReceiveGoodsUnit(detailRes.getFirmName());
-                        }
-                    }
-                }
-            }
             BigDecimal subtract = vo.getCarryingCapacity().subtract(vo.getSubcontractAmount()).subtract(vo.getEntrustAmount());
             DecimalFormat df = new DecimalFormat("0.00");
             managementLogisticsOrderExcelVo.setWaitDistributionAmount(subtract == null ? null : df.format(subtract));
             String tOrderId = vo.getTOrderId();
             if (StringUtils.isNotBlank(tOrderId)) {
-                OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
-                if (orderDetailById != null) {
-                    List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
-                    if (CollectionUtils.isNotEmpty(unitInfo)) {
-                        for (UnitInfoDetailRes detailRes : unitInfo) {
-                            if ("1".equals(detailRes.getUnitType())) {
-                                managementLogisticsOrderExcelVo.setReceiveGoodsUnit(detailRes.getFirmName());
-                            }
-                            if ("2".equals(detailRes.getUnitType())) {
-                                managementLogisticsOrderExcelVo.setShipmentsUnit(detailRes.getFirmName());
+                try {
+                    OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
+                    if (orderDetailById != null) {
+                        List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
+                        if (CollectionUtils.isNotEmpty(unitInfo)) {
+                            for (UnitInfoDetailRes detailRes : unitInfo) {
+                                if ("1".equals(detailRes.getUnitType())) {
+                                    managementLogisticsOrderExcelVo.setReceiveGoodsUnit(detailRes.getFirmName());
+                                }
+                                if ("2".equals(detailRes.getUnitType())) {
+                                    managementLogisticsOrderExcelVo.setShipmentsUnit(detailRes.getFirmName());
+                                }
                             }
                         }
                     }
+                } catch (Exception e) {
+                    log.info("获取收发货单位异常:torderId{},错误信息:{}", tOrderId, e.getMessage(), e);
                 }
             }
             managementLogisticsOrderExcelVo.setSubcontractAmount(Objects.isNull(vo.getSubcontractAmount()) ? null : df.format(vo.getSubcontractAmount()) + priceType.get(vo.getPriceType()));

+ 52 - 40
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -793,7 +793,7 @@
         a.amount AS carryingCapacity,
         a.goods_price AS goodsPrice,
         a.goods_price_unit AS goodsPriceUnit,
-        a.`status` AS `status`,
+        a.`status` AS status,
         a.settlement_cycle AS settlementCycle,
         a.price AS price,
         a.price_type AS priceType,
@@ -880,46 +880,46 @@
         <where>
             a.del_flag = 0
             <if test="type == 1">
-                and (d.top_ent_id = #{entId} or d.ent_id = #{entId})
-                <!--                AND (-->
-                <!--                a.ent_id = #{entId}-->
-                <!--                <if test="userIds != null and userIds.size()>0">-->
-                <!--                    AND a.create_by IN-->
-                <!--                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">-->
-                <!--                        #{item}-->
-                <!--                    </foreach>-->
-                <!--                </if>-->
-                <!--                )-->
-                <!--                OR (-->
-                <!--                d.top_ent_id = #{entId}-->
-                <!--                <if test="contactsIds != null and contactsIds.size()>0">-->
-                <!--                    AND d.contacts_id IN-->
-                <!--                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">-->
-                <!--                        #{item}-->
-                <!--                    </foreach>-->
-                <!--                </if>-->
-                <!--                 )-->
+<!--                and (d.top_ent_id = #{entId} or d.ent_id = #{entId})-->
+                                AND (
+                                a.ent_id = #{entId}
+                                <if test="userIds != null and userIds.size()>0">
+                                    AND a.create_by IN
+                                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                                        #{item}
+                                    </foreach>
+                                </if>
+                                )
+                                OR (
+                                d.top_ent_id = #{entId}
+                                <if test="contactsIds != null and contactsIds.size()>0">
+                                    AND d.contacts_id IN
+                                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">
+                                        #{item}
+                                    </foreach>
+                                </if>
+                                 )
             </if>
             <if test="type == 2">
-                and (e.top_ent_id = #{entId} or e.ent_id = #{entId})
-                <!--                AND (-->
-                <!--                a.ent_id = #{entId}-->
-                <!--                <if test="userIds != null and userIds.size()>0">-->
-                <!--                    AND a.create_by IN-->
-                <!--                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">-->
-                <!--                        #{item}-->
-                <!--                    </foreach>-->
-                <!--                </if>-->
-                <!--                )-->
-                <!--                OR (-->
-                <!--                d.top_ent_id = #{entId}-->
-                <!--                <if test="contactsIds != null and contactsIds.size()>0">-->
-                <!--                    AND d.contacts_id IN-->
-                <!--                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">-->
-                <!--                        #{item}-->
-                <!--                    </foreach>-->
-                <!--                </if>-->
-                <!--                )-->
+<!--                and (e.top_ent_id = #{entId} or e.ent_id = #{entId})-->
+                                AND (
+                                a.ent_id = #{entId}
+                                <if test="userIds != null and userIds.size()>0">
+                                    AND a.create_by IN
+                                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                                        #{item}
+                                    </foreach>
+                                </if>
+                                )
+                                OR (
+                                d.top_ent_id = #{entId}
+                                <if test="contactsIds != null and contactsIds.size()>0">
+                                    AND d.contacts_id IN
+                                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">
+                                        #{item}
+                                    </foreach>
+                                </if>
+                                )
             </if>
             <if test="query.keywords != null and query.keywords != ''">
                 and (
@@ -935,6 +935,12 @@
                     #{status}
                 </foreach>
             </if>
+            <if test="idsList != null and idsList.size()>0">
+                and a.id in
+                <foreach collection="idsList" close=")" open="(" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
             <if test="query.endBeginDateTime != null and query.endBeginDateTime != '' ">
                 and DATE( a.end_time) <![CDATA[ >= ]]> #{query.endBeginDateTime}
             </if>
@@ -968,7 +974,7 @@
     </select>
 
 
-    <select id="selectManagementLogisticsOrderList" resultType="com.sckw.transport.model.vo.ManagementLogsiticsOrderVO">
+    <select id="selectManagementLogisticsOrderList" resultType="com.sckw.transport.model.vo.ManagementLogisticsOrderVO">
         SELECT
         <include refid="Query_Column_List">
         </include>
@@ -1042,6 +1048,12 @@
                     #{status}
                 </foreach>
             </if>
+            <if test="idsList != null and idsList.size>0">
+                and a.id in 
+                <foreach collection="idsList" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
             <if test="query.endBeginDateTime != null and query.endBeginDateTime != '' ">
                 and DATE( a.end_time) <![CDATA[ >= ]]> #{query.endBeginDateTime}
             </if>