Explorar o código

Merge branch 'dev' into dev_spt

sptkw %!s(int64=2) %!d(string=hai) anos
pai
achega
6d8b6f5029
Modificáronse 100 ficheiros con 1394 adicións e 259 borrados
  1. 4 0
      sckw-auth/pom.xml
  2. 14 4
      sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java
  3. 0 25
      sckw-auth/src/main/java/com/sckw/auth/controller/ExceptionController.java
  4. 40 0
      sckw-auth/src/main/java/com/sckw/auth/model/vo/req/GetRegisterSmsReqVo.java
  5. 9 0
      sckw-auth/src/main/java/com/sckw/auth/service/IAuthService.java
  6. 14 4
      sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java
  7. 1 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/NumberConstant.java
  8. 3 3
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictEnum.java
  9. 17 11
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/ExceptionFilterConfig.java
  10. 6 2
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/LoginFilter.java
  11. 9 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CarWaybillEnum.java
  12. 9 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/LogisticsOrderEnum.java
  13. 18 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/RegularUtils.java
  14. 6 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java
  15. 2 2
      sckw-common/sckw-common-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  16. 2 2
      sckw-common/sckw-common-mongo/src/main/java/com/sckw/mongo/model/SckwTradeOrder.java
  17. 1 0
      sckw-modules-api/pom.xml
  18. 5 0
      sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/model/vo/RTruckVo.java
  19. 2 2
      sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/model/ContractSignCompletedParam.java
  20. 2 2
      sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/model/UpdateOrderAmountParam.java
  21. 2 2
      sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/model/UpdateOrderStatusParam.java
  22. 1 1
      sckw-modules-api/sckw-product-api/src/main/java/com/sckw/product/api/model/GoodsDetail.java
  23. 1 1
      sckw-modules-api/sckw-product-api/src/main/java/com/sckw/product/api/model/KwpGoods.java
  24. 9 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java
  25. 8 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteUserService.java
  26. 9 1
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportDubboService.java
  27. 86 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/vo/LogisticsOrderVO.java
  28. 6 0
      sckw-modules/sckw-contract/pom.xml
  29. 6 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/entity/KwcContractLogisticsGoods.java
  30. 6 1
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/LogisticsGoodsInfoReqVo.java
  31. 15 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/QueryListReqVo.java
  32. 6 5
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java
  33. 2 2
      sckw-modules/sckw-contract/src/main/resources/bootstrap-dev.yml
  34. 9 0
      sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml
  35. 12 4
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java
  36. 11 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java
  37. 2 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverCardMapper.java
  38. 13 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfFleetDriverMapper.java
  39. 11 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfFleetTruckMapper.java
  40. 4 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverCardDto.java
  41. 4 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverLicenseDto.java
  42. 4 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfDriverQualificationDto.java
  43. 6 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTransportLicenseDto.java
  44. 6 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckLicenseDto.java
  45. 6 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java
  46. 16 3
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  47. 15 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  48. 92 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverCardMapper.xml
  49. 1 1
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml
  50. 10 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetDriverMapper.xml
  51. 10 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetTruckMapper.xml
  52. 14 2
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmCooperateManageController.java
  53. 23 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/FindEntCooperateResVo.java
  54. 1 1
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java
  55. 62 4
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java
  56. 5 0
      sckw-modules/sckw-order/pom.xml
  57. 11 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/dubbo/TradeOrderInfoServiceImpl.java
  58. 2 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/GoodsInfo.java
  59. 3 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/GoodsInfoDetailRes.java
  60. 23 8
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java
  61. 1 1
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/KwpGoods.java
  62. 10 8
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/AddGoodsParam.java
  63. 1 2
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/UpdateGoodsParam.java
  64. 1 1
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/GoodsDetail.java
  65. 1 1
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/GoodsList.java
  66. 5 5
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java
  67. 37 0
      sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwTransportController.java
  68. 171 8
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java
  69. 1 2
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/TradeOrderStatementList.java
  70. 5 0
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/WaybillOrderQuery.java
  71. 1 1
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/CarWaybillVo.java
  72. 0 26
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/ExceptionController.java
  73. 24 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java
  74. 2 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsUserController.java
  75. 9 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntDeptDao.java
  76. 9 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java
  77. 2 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsRoleDao.java
  78. 9 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserDao.java
  79. 6 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java
  80. 33 12
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java
  81. 10 4
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java
  82. 39 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/pojo/FindEntDeptInfoPojo.java
  83. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EditRoleReqVo.java
  84. 2 4
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsDeptResVo.java
  85. 34 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/QueryCurrentOrganizationResVo.java
  86. 1 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/RoleResVo.java
  87. 28 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/CommonService.java
  88. 10 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsDeptService.java
  89. 85 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  90. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsMenuService.java
  91. 33 14
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsRoleService.java
  92. 15 14
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java
  93. 3 1
      sckw-modules/sckw-system/src/main/resources/mapper/KwsDeptDao.xml
  94. 10 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEntDeptDao.xml
  95. 13 5
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml
  96. 18 3
      sckw-modules/sckw-system/src/main/resources/mapper/KwsRoleDao.xml
  97. 24 20
      sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml
  98. 3 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsUserRoleDao.xml
  99. 5 0
      sckw-modules/sckw-transport/pom.xml
  100. 34 15
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/AcceptCarriageOrderController.java

+ 4 - 0
sckw-auth/pom.xml

@@ -47,6 +47,10 @@
             <groupId>com.sckw</groupId>
             <artifactId>sckw-system-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-message-api</artifactId>
+        </dependency>
 
     </dependencies>
     <build>

+ 14 - 4
sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java

@@ -1,9 +1,6 @@
 package com.sckw.auth.controller;
 
-import com.sckw.auth.model.vo.req.ForgetPasswordReqVo;
-import com.sckw.auth.model.vo.req.LoginReqVo;
-import com.sckw.auth.model.vo.req.RegisterReqVo;
-import com.sckw.auth.model.vo.req.UpdatePasswordReqVo;
+import com.sckw.auth.model.vo.req.*;
 import com.sckw.auth.service.IAuthService;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.web.constant.HttpStatus;
@@ -96,5 +93,18 @@ public class AuthController {
         return HttpResult.ok(HttpStatus.MSG_001);
     }
 
+    /**
+     * @desc: 获取验证码
+     * @param: reqVo 入参
+     * @author: czh
+     * @date 2023/7/23
+     * @return HttpResult
+     */
+    @PostMapping("getRegisterSms")
+    public HttpResult getRegisterSms(@Valid @RequestBody GetRegisterSmsReqVo reqVo,
+                                   @RequestHeader(name = "System-Type", required = true) int systemType) {
+        reqVo.setSystemType(systemType);
+        return HttpResult.ok(authService.getRegisterSms(reqVo));
+    }
 
 }

+ 0 - 25
sckw-auth/src/main/java/com/sckw/auth/controller/ExceptionController.java

@@ -1,25 +0,0 @@
-package com.sckw.auth.controller;
-
-import com.sckw.core.web.response.HttpResult;
-import jakarta.servlet.http.HttpServletRequest;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author czh
- * @desc TODO
- * @date 2023/6/14
- */
-@RestController
-@RequestMapping("/error")
-public class ExceptionController {
-
-    /**
-     * 重新抛出异常
-     */
-    @PostMapping("/throwError")
-    public HttpResult exception(HttpServletRequest request) {
-        return HttpResult.error(Integer.parseInt(request.getAttribute("code").toString()), request.getAttribute("message").toString());
-    }
-}

+ 40 - 0
sckw-auth/src/main/java/com/sckw/auth/model/vo/req/GetRegisterSmsReqVo.java

@@ -0,0 +1,40 @@
+package com.sckw.auth.model.vo.req;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+@Data
+public class GetRegisterSmsReqVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -6344151610477939870L;
+
+    /**
+     * 企业名称
+     */
+    @NotBlank(message = "企业名称不能为空")
+    private String entName;
+
+    /**
+     * 企业代表人
+     */
+    @NotBlank(message = "企业代表人不能为空")
+    private String name;
+
+    /**
+     * 手机号
+     */
+    @NotBlank(message = "联系电话不能为空")
+    private String phone;
+
+    /**
+     * 系统类型(1运营端、2企业开户)
+     */
+    private Integer systemType;
+
+
+
+}

+ 9 - 0
sckw-auth/src/main/java/com/sckw/auth/service/IAuthService.java

@@ -47,4 +47,13 @@ public interface IAuthService {
      * @date: 2023/7/3
      */
     void resetPassword(Long id);
+
+    /**
+     * @desc: 获取验证码
+     * @param: reqVo 入参
+     * @author: czh
+     * @date 2023/7/23
+     * @return String
+     */
+    String getRegisterSms(GetRegisterSmsReqVo reqVo);
 }

+ 14 - 4
sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java

@@ -2,10 +2,7 @@ package com.sckw.auth.service.impl;
 
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
-import com.sckw.auth.model.vo.req.ForgetPasswordReqVo;
-import com.sckw.auth.model.vo.req.LoginReqVo;
-import com.sckw.auth.model.vo.req.RegisterReqVo;
-import com.sckw.auth.model.vo.req.UpdatePasswordReqVo;
+import com.sckw.auth.model.vo.req.*;
 import com.sckw.auth.model.vo.res.DeptInfoResVo;
 import com.sckw.auth.model.vo.res.EntInfoResVo;
 import com.sckw.auth.model.vo.res.LoginResVo;
@@ -15,6 +12,7 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.model.EntCertificateInfo;
 import com.sckw.core.web.model.LoginEntInfo;
 import com.sckw.core.web.model.LoginUserInfo;
+import com.sckw.message.api.dubbo.SmsInfoService;
 import com.sckw.system.api.model.dto.req.ForgetPasswordReqDto;
 import com.sckw.system.api.model.dto.req.UpdatePasswordReqDto;
 import com.sckw.system.api.model.dto.req.UserLoginReqDto;
@@ -49,6 +47,9 @@ public class AuthServiceImpl implements IAuthService {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteUserService remoteUserService;
 
+    @DubboReference(version = "2.0.0", group = "design", check = false)
+    private SmsInfoService smsInfoService;
+
 
     @Override
     public LoginResVo login(LoginReqVo reqDto) throws SystemException {
@@ -194,6 +195,15 @@ public class AuthServiceImpl implements IAuthService {
         remoteUserService.resetPassword(id);
     }
 
+    @Override
+    public String getRegisterSms(GetRegisterSmsReqVo reqVo) {
+        String code = "";
+        remoteUserService.checkRegisterParam(reqVo.getEntName(), reqVo.getPhone(), reqVo.getSystemType());
+        String key = Global.USER_LOGIN_CAPTCHA + reqVo.getPhone() + Global.COLON + reqVo.getSystemType();
+        RedissonUtils.put(key, code, 30L);
+        return code;
+    }
+
 
     static class AsyncProcess implements Runnable {
 

+ 1 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/NumberConstant.java

@@ -18,6 +18,7 @@ public final class NumberConstant {
     public static final int EIGHT = 8;
     public static final int NINE = 9;
     public static final int TEN = 10;
+    public static final int ELEVEN = 11;
     public static final int TWELVE = 12;
     public static final int THREETEEN = 13;
     public static final int FOURTEEN = 14;

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

@@ -26,9 +26,9 @@ public enum DictEnum {
     UNIT_TYPE_2("unit_type","2", "箱"),
     UNIT_TYPE_3("unit_type","3", "件"),
     UNIT_TYPE_4("unit_type","4", "其他"),
-    TAX_RATE_0("tax_rate","13.00", "13%"),
-    TAX_RATE_1("tax_rate","11.00", "11%"),
-    TAX_RATE_2("tax_rate","10.00", "10%"),
+    TAX_RATE_0("tax_rate","13", "13%"),
+    TAX_RATE_1("tax_rate","11", "11%"),
+    TAX_RATE_2("tax_rate","10", "10%"),
     TRADE_TYPE_0("trade_type", "0", "预付款"),
     TRADE_TYPE_1("trade_type", "1", "货到付款"),
     TRADE_TYPE_2("trade_type", "2", "线下付款"),

+ 17 - 11
sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/ExceptionFilterConfig.java

@@ -2,31 +2,37 @@ package com.sckw.core.filter;
 
 import com.sckw.core.exception.SystemException;
 import jakarta.servlet.*;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
+import org.springframework.web.filter.OncePerRequestFilter;
+import org.springframework.web.servlet.HandlerExceptionResolver;
 
 import java.io.IOException;
 
 /**
  * @author czh
- * @desc TODO
+ * @desc 过滤器的异常抛出
  * @date 2023/6/14
  */
 @Component
 @Slf4j
-public class ExceptionFilterConfig implements Filter {
+public class ExceptionFilterConfig extends OncePerRequestFilter {
+
+    @Autowired
+    @Qualifier("handlerExceptionResolver")
+    private HandlerExceptionResolver resolver;
+
     @Override
-    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
         try {
-            filterChain.doFilter(servletRequest, servletResponse);
+            filterChain.doFilter(request, response);
         } catch (SystemException e) {
-            // 传递异常信息
-//            servletRequest.setAttribute("code", e.getCode());
-//            servletRequest.setAttribute("message", e.getMessage());
-//            // 指定处理该请求的处理器
-//            RequestDispatcher requestDispatcher = servletRequest.getRequestDispatcher("/error/throwError");
-//            requestDispatcher.forward(servletRequest, servletResponse);
-            log.error("请求异常:", e);
+            // 会交到 Springmvc的全局异常处理器那里
+            resolver.resolveException(request, response, null, e);
         }
     }
 }

+ 6 - 2
sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/LoginFilter.java

@@ -64,6 +64,7 @@ public class LoginFilter implements Filter {
      */
     @Override
     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException, SystemException{
+
         HttpServletRequest request = (HttpServletRequest) servletRequest;
         String requestUri = request.getRequestURI();
         /*1、不用token的接口直接放行*/
@@ -91,7 +92,7 @@ public class LoginFilter implements Filter {
         String systemType = request.getHeader(RequestConstant.SYSTEM_TYPE);
         String userInfo = RedissonUtils.getString(Global.getFullUserLoginKey(Integer.parseInt(systemType), Long.parseLong(key), clientType));
         if (StringUtils.isBlank(userInfo)) {
-            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ACCOUNT_NOT_EXISTS);
+            throw new SystemException(HttpStatus.UN_LOGIN_CODE, HttpStatus.UN_LOGIN_MESSAGE);
         }
 
         //将redis里的用户信息存入内存中,避免业务操作多次从redis获取值*/
@@ -113,7 +114,10 @@ public class LoginFilter implements Filter {
         }
 
         /*4、企业信息等校验*/
-        checkEntInfo(loginUserInfo);
+        //特殊处理,认证接口不校验资质
+        if (!"/kwsEnt/register".equals(requestUri)) {
+            checkEntInfo(loginUserInfo);
+        }
 
         RedissonUtils.putString(Global.getFullUserLoginKey(Integer.parseInt(systemType), Long.parseLong(key), clientType), JSON.toJSONString(loginUserInfo), Global.PC_TOKEN_EXPIRE);
         filterChain.doFilter(servletRequest, servletResponse);

+ 9 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CarWaybillEnum.java

@@ -52,4 +52,13 @@ public enum CarWaybillEnum {
         }
         return null;
     }
+
+    public static String getName(Integer code) {
+        for (CarWaybillEnum waybillEnum : CarWaybillEnum.values()) {
+            if (waybillEnum.getCode().equals(code)) {
+                return waybillEnum.getDestination();
+            }
+        }
+        return null;
+    }
 }

+ 9 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/LogisticsOrderEnum.java

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

+ 18 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/RegularUtils.java

@@ -47,6 +47,24 @@ public class RegularUtils {
      * 身份证
      */
     public static final String IDCARD = "(^\\d{18}$)|(^\\d{15}$)";
+    /**
+     * 车牌号
+     */
+//    public static final String TRUCK_NUMBER = "^[京津沪冀晋辽吉黑苏浙皖闽赣鲁豫鄂湘粤桂琼川黔云渝藏陕陇青宁新闽粤晋琼使领A_Z]{1}[A_Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$";
+//    public static final String TRUCK_NUMBER = "^[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新]{1}[A-Z]{1}[DF]{1}[0-9a-zA-Z]{5}$";
+    /**
+     * 车牌校验  五位数车牌
+     */
+    public static final String TRUCK_NUMBER_FIVE = "^[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新使]{1}[a-zA-Z]{1}[0-9a-zA-Z]{5}$";
+
+    /**
+     * 车牌校验  六位数车牌
+     */
+    public static final String TRUCK_NUMBER_SIX = "^[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新使]{1}[a-zA-Z]{1}[0-9a-zA-Z]{6}$";
+    /**
+     * 中文汉字
+     */
+    public static final String CHINESE = "^[\\u4e00-\\u9fa5]{2,4}$";
 
     /**
      * @description 校验

+ 6 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -118,6 +118,7 @@ public class HttpStatus {
     public static final int QUERY_FAIL_CODE = 60602;
     public static final String ACCOUNT_NOT_EXISTS = "用户信息不存在或已失效";
     public static final String ENT_NOT_EXISTS = "企业信息不存在或已失效";
+    public static final String DEPT_NOT_EXISTS = "机构信息不存在或已失效";
     public static final String ENTCERTIFICATES_NOT_EXISTS = "未查询到企业资质信息";
     public static final String ENTCERTIFICATES_INVAILD = "企业资质已失效";
     public static final String ROLE_NOT_EXISTS = "未查询到关联的角色";
@@ -156,5 +157,10 @@ public class HttpStatus {
     public static final String MSG_020 = "当前机构还存在员工数据,不能删除!";
     public static final String MSG_021 = "不能重复设置默认地址!";
     public static final String MSG_022 = "只能对草稿进行删除!";
+    public static final String MSG_023 = "解除成功!";
+    public static final String MSG_024 = "名称不能重复!";
+    public static final String MSG_025 = "禁止删除本人信息!";
+    public static final String MSG_026 = "资质认证审核中,请等待审核后再提交!";
+    public static final String MSG_027 = "一级机构不能删除!";
 
 }

+ 2 - 2
sckw-common/sckw-common-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -2,6 +2,6 @@ com.sckw.core.aspect.DaoAspect
 com.sckw.core.exception.GlobalSystemExceptionHandler
 com.sckw.core.web.config.CustomConfig
 com.sckw.core.filter.LoginFilter
-#com.sckw.core.filter.ExceptionFilterConfig
 com.sckw.core.config.MybatisPlusConfig
-com.sckw.core.config.JacksonConfig
+com.sckw.core.config.JacksonConfig
+com.sckw.core.filter.ExceptionFilterConfig

+ 2 - 2
sckw-common/sckw-common-mongo/src/main/java/com/sckw/mongo/model/SckwTradeOrder.java

@@ -149,9 +149,9 @@ public class SckwTradeOrder {
     private String goodsSpec;
 
     /**
-     * 商品发票税率(%)
+     * 商品发票税率
      */
-    private BigDecimal goodsTaxRate;
+    private String goodsTaxRate;
 
     /**
      * 商品所属项目名称

+ 1 - 0
sckw-modules-api/pom.xml

@@ -26,6 +26,7 @@
         <module>sckw-product-api</module>
         <module>sckw-order-api</module>
         <module>sckw-fleet-api</module>
+        <module>sckw-contract-api</module>
         <module>sckw-payment-api</module>
     </modules>
 

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

@@ -51,4 +51,9 @@ public class RTruckVo implements Serializable {
      * 车辆业务状态
      */
     private Integer businessStatus;
+
+    /**
+     * 车辆类型
+     */
+    private String truckType;
 }

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

@@ -26,12 +26,12 @@ public class ContractSignCompletedParam implements Serializable {
 
 
     /**
-     * 更新用户id
+     * 更新用户id 需传,订单状态变化记录需要
      */
     private Long updateBy;
 
     /**
-     * 更新者姓名
+     * 更新用户姓名 需传,订单状态变化记录需要
      */
     private String updateByName;
 }

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

@@ -37,12 +37,12 @@ public class UpdateOrderAmountParam implements Serializable {
     private BigDecimal actualAmount;
 
     /**
-     * 更新用户id
+     * 更新用户id 需传,订单状态变化记录需要
      */
     private Long updateBy;
 
     /**
-     * 更新者姓名
+     * 更新者姓名 需传,订单状态变化记录需要
      */
     private String updateByName;
 

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

@@ -30,12 +30,12 @@ public class UpdateOrderStatusParam implements Serializable {
     private Integer status;
 
     /**
-     * 更新用户id
+     * 更新用户id 需传,订单状态变化记录需要
      */
     private Long updateBy;
 
     /**
-     * 更新者姓名
+     * 更新者姓名 需传,订单状态变化记录需要
      */
     private String updateByName;
 

+ 1 - 1
sckw-modules-api/sckw-product-api/src/main/java/com/sckw/product/api/model/GoodsDetail.java

@@ -93,7 +93,7 @@ public class GoodsDetail implements Serializable {
     /**
      * 发票税率(%)
      */
-    private BigDecimal taxRate;
+    private String taxRate;
 
     /**
      * 发票税率label

+ 1 - 1
sckw-modules-api/sckw-product-api/src/main/java/com/sckw/product/api/model/KwpGoods.java

@@ -76,7 +76,7 @@ public class KwpGoods extends BaseModel implements Serializable {
     /**
      * 发票税率(%)
      */
-    private BigDecimal taxRate;
+    private String taxRate;
 
     /**
      * 交易方式(合同采购、直接采购、预付款、货到付款、到款发货)

+ 9 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java

@@ -84,6 +84,15 @@ public interface RemoteSystemService {
      */
     List<EntCacheResDto> queryEntCacheByIds(List<Long> entIds);
 
+    /**
+     * @param entIds 企业id
+     * @return Map
+     * @desc: 从缓存批量主体机构信息
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    Map<Long, List<EntCacheResDto>> queryEntDeptCacheByIds(List<Long> entIds);
+
     /**
      * @desc: 从缓存批量查企业信息
      * @author: yzc

+ 8 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteUserService.java

@@ -159,4 +159,12 @@ public interface RemoteUserService {
      */
     Map<Long, SysDictResDto> querySysDictByIds(List<Long> ids);
 
+    /**
+     * @desc: 校验注册的入参
+     * @param: entName 企业名  phone联系电话  systemType系统类型
+     * @author: czh
+     * @date 2023/7/23
+     */
+    void checkRegisterParam(String entName, String phone, Integer systemType);
+
 }

+ 9 - 1
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportDubboService.java

@@ -1,6 +1,7 @@
 package com.sckw.transport.api.dubbo;
 
 import com.sckw.transport.api.model.dto.vo.KwtLogisticsOrderVO;
+import com.sckw.transport.api.model.dto.vo.LogisticsOrderVO;
 
 import java.util.List;
 
@@ -15,9 +16,16 @@ import java.util.List;
 public interface TransportDubboService {
 
     /**
-     * 根据id 获取详情
+     * 根据id 获取主表详情
      * @param ids
      * @return
      */
     List<KwtLogisticsOrderVO> getAcceptCarriageOrderDetail(List<String> ids);
+
+    /**
+     * 根据id 对账页面需要的数据
+     * @param ids
+     * @return
+     */
+    List<LogisticsOrderVO> getAcceptCarriageOrderList(List<String> ids);
 }

+ 86 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/vo/LogisticsOrderVO.java

@@ -0,0 +1,86 @@
+package com.sckw.transport.api.model.dto.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author lfdc
+ * @description 对账页面需要数据vo
+ * @date 2023-07-21 17:07:15
+ */
+@Data
+public class LogisticsOrderVO {
+
+    /**
+     * 物流订单id
+     */
+    private String lOrderId;
+    /**
+     * 物流订单编号
+     */
+    private String lOrderNO;
+
+    /**
+     * 销售订单id
+     */
+    private String tOrderId;
+    /**
+     * 销售订单编号
+     */
+    private String tOrderNO;
+    /**
+     * 付款方式
+     */
+    private String payment;
+    /**
+     * 运输趟次
+     */
+    private Long count;
+    /**
+     * 计费方式
+     */
+    private String billingMode;
+    /**
+     * 合同
+     */
+    private String contract;
+    /**
+     * 合同编号
+     */
+    private String contractNo;
+    /**
+     * 合同名称
+     */
+    private String contractName;
+    /**
+     * 承运单位
+     */
+    private String carrierCompany;
+    /**
+     * 托运单位
+     */
+    private String consignCompany;
+    /**
+     * 商品名称
+     */
+    private String goodsName;
+    /**
+     * 计划量
+     */
+    private String amount;
+    /**
+     * 运价
+     */
+    private BigDecimal price;
+
+    /**
+     * 扣亏损值
+     */
+    private BigDecimal goodsPrice;
+    private BigDecimal loss;
+    private BigDecimal unloadAmount;
+    private BigDecimal loadAmount;
+
+
+}

+ 6 - 0
sckw-modules/sckw-contract/pom.xml

@@ -62,6 +62,12 @@
             <version>1.0.0</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-contract-api</artifactId>
+            <version>1.0.0</version>
+            <scope>compile</scope>
+        </dependency>
 
     </dependencies>
     <build>

+ 6 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/entity/KwcContractLogisticsGoods.java

@@ -30,6 +30,12 @@ public class KwcContractLogisticsGoods implements Serializable {
      */
     private Long goodsId;
 
+
+    /**
+     * 商品名
+     */
+    private String goodsName;
+
     /**
      * sku
      */

+ 6 - 1
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/LogisticsGoodsInfoReqVo.java

@@ -21,9 +21,14 @@ public class LogisticsGoodsInfoReqVo implements Serializable {
     /**
      * 商品id
      */
-    @NotNull(message = "商品不能为空")
+//    @NotNull(message = "商品不能为空")
     private Long goodsId;
 
+    /**
+     * 商品名
+     */
+    private String goodsName;
+
     /**
      * 运量
      */

+ 15 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/model/vo/req/QueryListReqVo.java

@@ -48,4 +48,19 @@ public class QueryListReqVo extends PageRequest implements Serializable {
      */
     private Integer entType;
 
+    /**
+     * 签约方式
+     */
+    private Integer signingWay;
+
+    /**
+     * 付款方式
+     */
+    private Integer charging;
+
+    /**
+     * 交易方式
+     */
+    private Integer trading;
+
 }

+ 6 - 5
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java

@@ -191,7 +191,7 @@ public class KwcContractLogisticsService {
         List<KwcContractLogisticsGoods> kwcContractLogisticsGoodsList = kwcContractLogisticsGoodsService.queryGoodsInfoByContractId(kwcContractLogistics.getId());
         if (CollectionUtils.isNotEmpty(kwcContractLogisticsGoodsList)) {
             List<Long> goodsIdList = kwcContractLogisticsGoodsList.stream().map(KwcContractLogisticsGoods::getGoodsId).toList();
-            Map<Long, KwpGoods> goodsMap = goodsInfoService.getGoodsByIds(goodsIdList);
+//            Map<Long, KwpGoods> goodsMap = goodsInfoService.getGoodsByIds(goodsIdList);
 
             String keys = "";
            for (KwcContractLogisticsGoods item :kwcContractLogisticsGoodsList){
@@ -214,10 +214,11 @@ public class KwcContractLogisticsService {
                 logisticsGoodsInfoResVo.setDeficitUnit(kwcContractLogisticsGoods.getDeficitUnit());
                 logisticsGoodsInfoResVo.setGoodsId(kwcContractLogisticsGoods.getGoodsId());
                 logisticsGoodsInfoResVo.setId(kwcContractLogisticsGoods.getId());
-                KwpGoods kwpGoods = goodsMap.get(kwcContractLogisticsGoods.getGoodsId());
-                if (Objects.nonNull(kwpGoods)) {
-                    logisticsGoodsInfoResVo.setGoodsName(kwpGoods.getName());
-                }
+                logisticsGoodsInfoResVo.setGoodsName(kwcContractLogisticsGoods.getGoodsName());
+//                KwpGoods kwpGoods = goodsMap.get(kwcContractLogisticsGoods.getGoodsId());
+//                if (Objects.nonNull(kwpGoods)) {
+//                    logisticsGoodsInfoResVo.setGoodsName(kwpGoods.getName());
+//                }
                 logisticsGoodsInfoResVo.setLoss(kwcContractLogisticsGoods.getLoss());
                 logisticsGoodsInfoResVo.setLossUnit(kwcContractLogisticsGoods.getLossUnit());
 

+ 2 - 2
sckw-modules/sckw-contract/src/main/resources/bootstrap-dev.yml

@@ -5,7 +5,7 @@ spring:
         # 服务注册地址
         server-addr: 10.10.10.230:8848
         # 命名空间
-        namespace: sckw_zk
+        namespace: sckw-service-platform-dev
         # 共享配置
         group: sckw-service-platform
       config:
@@ -14,7 +14,7 @@ spring:
         # 配置文件格式
         file-extension: yaml
         # 命名空间
-        namespace: sckw_zk
+        namespace: sckw-service-platform-dev
         # 共享配置
         group: sckw-service-platform
         #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组

+ 9 - 0
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml

@@ -85,5 +85,14 @@
                 #{item}
             </foreach>
         </if>
+        <if test="trading != null">
+            and a.trading = #{trading}
+        </if>
+        <if test="signingWay != null">
+            and a.signing_way = #{signingWay}
+        </if>
+        <if test="charging != null">
+            and a.charging = #{charging}
+        </if>
     </select>
 </mapper>

+ 12 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java

@@ -8,13 +8,11 @@ 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.StringUtils;
+import com.sckw.core.web.context.LoginUserHolder;
 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.*;
 import com.sckw.fleet.model.dto.*;
 import com.sckw.fleet.model.vo.KwfDriverVo;
 import com.sckw.fleet.service.KwfDriverService;
@@ -60,11 +58,16 @@ public class KwfDriverController {
         //司机从业资格证
         KwfDriverQualification qualificationJson = driverService.findQualificationByKey(driver.getId());
 
+        //车队班组
+        KwfFleet fleet = driverService.findByFleetDriver(id, LoginUserHolder.getEntId());
+
         //数据组装
         JSONObject driverJson = JSONObject.parseObject(JSON.toJSONString(driver));
         driverJson.put("driverCard", cardJson);
         driverJson.put("driverLicense", licenseJson);
         driverJson.put("driverQualification", qualificationJson);
+        driverJson.put("fleetId", fleet.getId());
+        driverJson.put("fleetName", fleet.getName());
         return HttpResult.ok(driverJson);
     }
 
@@ -105,11 +108,16 @@ public class KwfDriverController {
         //司机从业资格证
         KwfDriverQualification qualificationJson = driverService.findQualificationByKey(driver.getId());
 
+        //车队班组
+        KwfFleet fleet = driverService.findByFleetDriver(id, LoginUserHolder.getEntId());
+
         //数据组装
         JSONObject driverJson = JSONObject.parseObject(JSON.toJSONString(driver));
         driverJson.put("driverCard", cardJson);
         driverJson.put("driverLicense", licenseJson);
         driverJson.put("driverQualification", qualificationJson);
+        driverJson.put("fleetId", fleet.getId());
+        driverJson.put("fleetName", fleet.getName());
         return HttpResult.ok(driverJson);
     }
 

+ 11 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -8,6 +8,7 @@ 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.StringUtils;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
@@ -55,10 +56,15 @@ public class KwfTruckController {
         //车辆道路运输许可证
         KwfTransportLicense transportLicense = truckService.findTransportLicenseByKey(id);
 
+        //车队班组
+        KwfFleet fleet = truckService.findByFleetTruck(id, LoginUserHolder.getEntId());
+
         //数据组装
         JSONObject truckJson = JSONObject.parseObject(JSON.toJSONString(truck));
         truckJson.put("truckLicense", truckLicense);
         truckJson.put("transportLicense", transportLicense);
+        truckJson.put("fleetId", fleet.getId());
+        truckJson.put("fleetName", fleet.getName());
         return HttpResult.ok(truckJson);
     }
 
@@ -91,10 +97,15 @@ public class KwfTruckController {
         //车辆道路运输许可证
         KwfTransportLicense transportLicense = truckService.findTransportLicenseByKey(id);
 
+        //车队班组
+        KwfFleet fleet = truckService.findByFleetTruck(id, LoginUserHolder.getEntId());
+
         //数据组装
         JSONObject truckJson = JSONObject.parseObject(JSON.toJSONString(truck));
         truckJson.put("truckLicense", truckLicense);
         truckJson.put("transportLicense", transportLicense);
+        truckJson.put("fleetId", fleet.getId());
+        truckJson.put("fleetName", fleet.getName());
         return HttpResult.ok(truckJson);
     }
 

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

@@ -12,6 +12,8 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwfDriverCardMapper extends BaseMapper<KwfDriverCard> {
 
+    int insert1(KwfDriverCard params);
+
     /**
      * 查询
      * @param driverId 司机id

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

@@ -1,8 +1,12 @@
 package com.sckw.fleet.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sckw.fleet.model.KwfFleet;
 import com.sckw.fleet.model.KwfFleetDriver;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
 
 /**
  * @desc 车队-司机 Mapper 接口
@@ -18,4 +22,13 @@ public interface KwfFleetDriverMapper extends BaseMapper<KwfFleetDriver> {
      * @return
      */
     KwfFleetDriver findByTruckDriver(KwfFleetDriver params);
+
+    /**
+     * @param driverId 司机id
+     * @param entId 企业id
+     * @desc 查询车队班组
+     * @author zk
+     * @date 2023/7/20
+     **/
+    KwfFleet findByFleetDriver(@Param("driverId") Long driverId, @Param("entId") Long entId);
 }

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

@@ -1,9 +1,11 @@
 package com.sckw.fleet.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sckw.fleet.model.KwfFleet;
 import com.sckw.fleet.model.KwfFleetTruck;
 import com.sckw.fleet.model.KwfTruckEnt;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * @desc 车队-车辆 Mapper 接口
@@ -19,4 +21,13 @@ public interface KwfFleetTruckMapper extends BaseMapper<KwfFleetTruck> {
      * @return
      */
     KwfFleetTruck findByTruckFleet(KwfFleetTruck params);
+
+    /**
+     * @param truckId 车辆id
+     * @param entId 企业id
+     * @desc 查询车队班组
+     * @author zk
+     * @date 2023/7/20
+     **/
+    KwfFleet findByFleetTruck(@Param("truckId") Long truckId, @Param("entId") Long entId);
 }

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

@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.Pattern;
 import jakarta.validation.constraints.Size;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.util.Date;
 
 /**
@@ -33,7 +35,8 @@ public class KwfDriverCardDto {
     /**
      * 有效日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date expireTime;
 
     /**

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

@@ -3,6 +3,8 @@ package com.sckw.fleet.model.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.Size;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.util.Date;
 
 /**
@@ -37,7 +39,8 @@ public class KwfDriverLicenseDto {
     /**
      * 有效日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date expireTime;
 
     /**

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

@@ -3,6 +3,8 @@ package com.sckw.fleet.model.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.Size;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.util.Date;
 
 /**
@@ -37,7 +39,8 @@ public class KwfDriverQualificationDto {
     /**
      * 有效日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date expireTime;
 
     /**

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

@@ -3,6 +3,8 @@ package com.sckw.fleet.model.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.Size;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.util.Date;
 
 /**
@@ -44,13 +46,15 @@ public class KwfTransportLicenseDto {
     /**
      * 发证日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date grantTime;
 
     /**
      * 有效期至
      */
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date expireTime;
 
     /**

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

@@ -3,6 +3,8 @@ package com.sckw.fleet.model.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.Size;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.util.Date;
 
 /**
@@ -44,13 +46,15 @@ public class KwfTruckLicenseDto {
     /**
      * 注册日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date regTime;
 
     /**
      * 发证日期
      */
-    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date grantTime;
 
     /**

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

@@ -104,6 +104,12 @@ public class KwfDriverVo {
     @ExcelProperty(value = "企业名称", index = 12)
     private String firmName;
 
+    /**
+     * 车队班组
+     */
+    @ExcelIgnore
+    private String fleetId;
+
     /**
      * 车队班组
      */

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

@@ -20,6 +20,7 @@ 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.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -527,6 +528,18 @@ public class KwfDriverService {
         }
     }
 
+    /**
+     * @param driverId 司机id
+     * @param entId 企业id
+     * @desc 查询车队班组
+     * @author zk
+     * @date 2023/7/20
+     **/
+    public KwfFleet findByFleetDriver(Long driverId, Long entId) {
+        return fleetDriverDao.findByFleetDriver(driverId, entId);
+    }
+
+
     /**
      * @param params 参数
      * @desc: 修改密码
@@ -627,17 +640,17 @@ public class KwfDriverService {
     public void checkLicense(Long driverId) {
         //身份证
         KwfDriverCard card = this.findCarByKey(driverId);
-        if (card == null || StringUtils.isBlank(card)) {
+        if (card == null || (StringUtils.isBlank(card.getCertificateMain()) && StringUtils.isBlank(card.getCertificateRevolt()))) {
             return;
         }
         //司机驾驶证信息
         KwfDriverLicense license = this.findLicenseByKey(driverId);
-        if (license == null || StringUtils.isBlank(license.getDriverNo())) {
+        if (license == null || (StringUtils.isBlank(license.getCertificateMain()) && StringUtils.isBlank(license.getCertificateRevolt()))) {
             return;
         }
         //司机从业资格证
         KwfDriverQualification quali = this.findQualificationByKey(driverId);
-        if (quali == null || StringUtils.isBlank(quali.getQualiNo())) {
+        if (quali == null || (StringUtils.isBlank(quali.getCertificateMain()) && StringUtils.isBlank(quali.getCertificateRevolt()))) {
             return;
         }
         //更新数据

+ 15 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -19,6 +19,7 @@ import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -435,6 +436,16 @@ public class KwfTruckService {
         }
     }
 
+    /**
+     * @param truckId 车辆id
+     * @param entId 企业id
+     * @desc 查询车队班组
+     * @author zk
+     * @date 2023/7/20
+     **/
+    public KwfFleet findByFleetTruck(Long truckId, Long entId){
+        return fleetTruckDao.findByFleetTruck(truckId, entId);
+    }
 
     /**
      * @param params 参数
@@ -463,12 +474,14 @@ public class KwfTruckService {
     public void checkLicense(Long truckId) {
         //车辆行驶证信息
         KwfTruckLicense license = this.findTruckLicenseByKey(truckId);
-        if (license == null || StringUtils.isBlank(license.getDrivingNo())) {
+        if (license == null || (StringUtils.isBlank(license.getCertificateMain())
+                && StringUtils.isBlank(license.getCertificateRevolt()))) {
             return;
         }
         //车辆道路运输许可证
         KwfTransportLicense transportLicense = this.findTransportLicenseByKey(truckId);
-        if (transportLicense == null || StringUtils.isBlank(transportLicense.getRoadTranNo())) {
+        if (transportLicense == null || (StringUtils.isBlank(transportLicense.getCertificateMain())
+                && StringUtils.isBlank(transportLicense.getCertificateRevolt()))) {
             return;
         }
         //更新数据

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

@@ -2,6 +2,98 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.fleet.dao.KwfDriverCardMapper">
 
+    <insert id="insert1" parameterType="com.sckw.fleet.model.KwfDriverCard">
+        INSERT INTO kwf_driver_card
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="null != driverId and '' != driverId">
+                driver_id,
+            </if>
+            <if test="null != idcard and '' != idcard">
+                idcard,
+            </if>
+            <if test="null != expireTime and '' != expireTime">
+                expire_time,
+            </if>
+            <if test="null != address and '' != address">
+                address,
+            </if>
+            <if test="null != certificateMain and '' != certificateMain">
+                certificate_main,
+            </if>
+            <if test="null != certificateRevolt and '' != certificateRevolt">
+                certificate_revolt,
+            </if>
+            <if test="null != remark and '' != remark">
+                remark,
+            </if>
+            <if test="null != status and '' != status">
+                status,
+            </if>
+            <if test="null != createBy and '' != createBy">
+                create_by,
+            </if>
+            <if test="null != createTime and '' != createTime">
+                create_time,
+            </if>
+            <if test="null != updateBy and '' != updateBy">
+                update_by,
+            </if>
+            <if test="null != updateTime and '' != updateTime">
+                update_time,
+            </if>
+            <if test="null != delFlag and '' != delFlag">
+                del_flag
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="null != driverId and '' != driverId">
+                #{driverId},
+            </if>
+            <if test="null != idcard and '' != idcard">
+                #{idcard},
+            </if>
+            <if test="null != expireTime and '' != expireTime">
+                #{expireTime},
+            </if>
+            <if test="null != address and '' != address">
+                #{address},
+            </if>
+            <if test="null != certificateMain and '' != certificateMain">
+                #{certificateMain},
+            </if>
+            <if test="null != certificateRevolt and '' != certificateRevolt">
+                #{certificateRevolt},
+            </if>
+            <if test="null != remark and '' != remark">
+                #{remark},
+            </if>
+            <if test="null != status and '' != status">
+                #{status},
+            </if>
+            <if test="null != createBy and '' != createBy">
+                #{createBy},
+            </if>
+            <if test="null != createTime and '' != createTime">
+                #{createTime},
+            </if>
+            <if test="null != updateBy and '' != updateBy">
+                #{updateBy},
+            </if>
+            <if test="null != updateTime and '' != updateTime">
+                #{updateTime},
+            </if>
+            <if test="null != delFlag and '' != delFlag">
+                #{delFlag}
+            </if>
+        </trim>
+    </insert>
+
     <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverCard" parameterType="java.lang.Long" >
         SELECT
             id, driver_id driverId, idcard, expire_time expireTime, address, certificate_main certificateMain,

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

@@ -56,7 +56,7 @@
         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, dr.ent_id entId, dr.create_by createBy, dr.create_time createTime,
-        dr.update_time updateTime, dr.remark, tr.truck_no truckNo, fl.name fleetName
+        dr.update_time updateTime, dr.remark, tr.truck_no truckNo, fl.id fleetId, 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 and drc.del_flag = 0

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

@@ -10,4 +10,14 @@
         and driver_id = #{driverId, jdbcType=VARCHAR}
         and ent_id = #{entId, jdbcType=VARCHAR}
     </select>
+
+    <select id="findByFleetDriver" resultType="com.sckw.fleet.model.KwfFleet" >
+        SELECT
+        fleet_id id, fl.name
+        FROM kwf_fleet_driver fld
+        left join kwf_fleet fl on fl.id = fld.fleet_id
+        where fld.del_flag = 0
+        and driver_id = #{driverId, jdbcType=VARCHAR}
+        and fld.ent_id = #{entId, jdbcType=VARCHAR}
+    </select>
 </mapper>

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

@@ -10,4 +10,14 @@
         and truck_id = #{truckId, jdbcType=VARCHAR}
         and ent_id = #{entId, jdbcType=VARCHAR}
     </select>
+
+    <select id="findByFleetTruck" resultType="com.sckw.fleet.model.KwfFleet" >
+        SELECT
+        fleet_id id, fl.name
+        FROM kwf_fleet_truck flt
+        left join kwf_fleet fl on fl.id = flt.fleet_id
+        where flt.del_flag = 0
+        and truck_id = #{truckId, jdbcType=VARCHAR}
+        and flt.ent_id = #{entId, jdbcType=VARCHAR}
+    </select>
 </mapper>

+ 14 - 2
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmCooperateManageController.java

@@ -71,7 +71,7 @@ public class KwmCooperateManageController {
     @PostMapping("dissolve")
     public HttpResult dissolve(@Valid @RequestBody IdsReqVo reqVo) throws SystemException {
         kwmCooperateManageService.dissolve(reqVo.getIds());
-        return HttpResult.ok(HttpStatus.MSG_010);
+        return HttpResult.ok(HttpStatus.MSG_023);
     }
 
     /**
@@ -84,7 +84,7 @@ public class KwmCooperateManageController {
     @PostMapping("delete")
     public HttpResult delete(@Valid @RequestBody IdsReqVo reqVo) throws SystemException {
         kwmCooperateManageService.delete(reqVo.getIds());
-        return HttpResult.ok(HttpStatus.MSG_007);
+        return HttpResult.ok(HttpStatus.MSG_008);
     }
 
     /**
@@ -110,4 +110,16 @@ public class KwmCooperateManageController {
         return HttpResult.ok(kwmCooperateManageService.findListGroup(reqVo));
     }
 
+    /**
+     * @param reqVo 企业id
+     * @return HttpResult
+     * @desc: 查询企业的合作单位
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    @PostMapping("findEntCooperate")
+    public HttpResult findEntCooperate(@RequestBody IdsReqVo reqVo) throws SystemException {
+        return HttpResult.ok(kwmCooperateManageService.findEntCooperate(reqVo.getId()));
+    }
+
 }

+ 23 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/FindEntCooperateResVo.java

@@ -0,0 +1,23 @@
+package com.sckw.manage.model.vo.res;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc 合作企业
+ * @date 2023/7/22
+ */
+@Data
+public class FindEntCooperateResVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -3663266782855234702L;
+
+    private Long entId;
+
+    private String entName;
+
+}

+ 1 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -124,7 +124,7 @@ public class KwmAddressService {
      */
     public void bindDefault(BindDefaultReqVo reqVo) {
         KwmAddress kwmAddress = kwmAddressMapper.selectById(reqVo.getId());
-        if (Objects.isNull(kwmAddress) || kwmAddress.getDefaultType() == Global.YES) {
+        if (Objects.isNull(kwmAddress)) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ADDRESS_NOT_EXISTS);
         }
 

+ 62 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -3,6 +3,7 @@ package com.sckw.manage.service;
 import java.io.IOException;
 import java.util.Date;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
@@ -23,10 +24,10 @@ import com.sckw.manage.model.entity.KwmCooperate;
 import com.sckw.manage.model.vo.req.BindManagerReqVo;
 import com.sckw.manage.model.vo.req.CooperateManageQueryReqVo;
 import com.sckw.manage.model.vo.res.CooperateManageQueryResVo;
+import com.sckw.manage.model.vo.res.FindEntCooperateResVo;
 import com.sckw.manage.model.vo.res.FindListGroupResVo;
 import com.sckw.manage.model.vo.res.QueryDetailResVo;
 import com.sckw.system.api.RemoteSystemService;
-import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import lombok.extern.slf4j.Slf4j;
@@ -55,9 +56,6 @@ public class KwmCooperateManageService {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
-    @DubboReference(version = "2.0.0", group = "design", check = false)
-    private RemoteUserService remoteUserService;
-
 
     /**
      * @param reqVo 分页入参
@@ -183,6 +181,9 @@ public class KwmCooperateManageService {
         //todo 判断是否可以解除(若和所选企业有未完结的业务单据(销售订单/采购订单、托运订单/承运订单、对账单、结算单),不支持解除合作)
         //提示:您与所选企业存在未完结业务,当前无法删除!
         List<KwmCooperate> kwmCooperates = kwmCooperateMapper.selectBatchIds(Arrays.asList(ids.split(Global.COMMA)));
+        if (CollectionUtils.isEmpty(kwmCooperates)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.COOPERATE_NOT_EXISTS);
+        }
         Long userId = LoginUserHolder.getUserId();
         Date date = new Date();
         kwmCooperates.forEach(item -> {
@@ -273,4 +274,61 @@ public class KwmCooperateManageService {
         commonBusinessService.fillGroup(result, list);
         return result;
     }
+
+
+    /**
+     * @param id 企业id
+     * @return FindEntCooperateResVo
+     * @desc: 查询企业的合作单位
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    public List<FindEntCooperateResVo> findEntCooperate(Long id) {
+        LambdaQueryWrapper<KwmCooperate> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwmCooperate::getInviterEntId, id).or().
+                eq(KwmCooperate::getInviteeEntId, id).and(
+                        wp -> wp.eq(KwmCooperate::getDelFlag, Global.NO).
+                                eq(KwmCooperate::getStatus, CooperateStatusEnum.OK.getCode())
+                );
+        List<KwmCooperate> kwmCooperates = kwmCooperateMapper.selectList(wrapper);
+        if (CollectionUtils.isEmpty(kwmCooperates)) {
+            return Collections.emptyList();
+        }
+
+        //装对方企业的id
+        List<Long> targetEntIdList = new ArrayList<>();
+        kwmCooperates.forEach(item -> targetEntIdList.add(item.getInviterEntId().equals(id) ? item.getInviteeEntId() : item.getInviterEntId()));
+
+        List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByIds(targetEntIdList);
+        if (CollectionUtils.isEmpty(entCacheResDtos)) {
+            return Collections.emptyList();
+        }
+
+        //装对方企业信息
+        List<FindEntCooperateResVo> list = new ArrayList<>();
+        entCacheResDtos.forEach(item -> {
+            FindEntCooperateResVo findEntCooperateResVo = new FindEntCooperateResVo();
+            findEntCooperateResVo.setEntId(item.getId());
+            findEntCooperateResVo.setEntName(item.getFirmName());
+            list.add(findEntCooperateResVo);
+        });
+
+        //装对方企业的主体单位
+        Map<Long, List<EntCacheResDto>> longListMap = remoteSystemService.queryEntDeptCacheByIds(targetEntIdList);
+        List<Long> longs = list.stream().map(FindEntCooperateResVo::getEntId).toList();
+        longs.forEach(item -> {
+            List<EntCacheResDto> entCacheResDtos1 = longListMap.get(item);
+            if (CollectionUtils.isEmpty(entCacheResDtos1)) {
+                return;
+            }
+            entCacheResDtos1.forEach(x -> {
+                FindEntCooperateResVo findEntCooperateResVo = new FindEntCooperateResVo();
+                findEntCooperateResVo.setEntId(x.getId());
+                findEntCooperateResVo.setEntName(x.getFirmName());
+                list.add(findEntCooperateResVo);
+            });
+        });
+        return list;
+    }
+
 }

+ 5 - 0
sckw-modules/sckw-order/pom.xml

@@ -77,6 +77,11 @@
             <artifactId>sckw-product-api</artifactId>
             <version>1.0.0</version>
         </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-contract-api</artifactId>
+            <version>1.0.0</version>
+        </dependency>
 
     </dependencies>
 

+ 11 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/dubbo/TradeOrderInfoServiceImpl.java

@@ -3,8 +3,10 @@ package com.sckw.order.dubbo;
 import com.alibaba.fastjson2.JSON;
 import com.google.common.collect.Lists;
 import com.sckw.core.common.enums.enums.DictEnum;
+import com.sckw.core.exception.BusinessException;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.mongo.model.SckwTradeOrder;
 import com.sckw.order.api.dubbo.TradeOrderInfoService;
@@ -59,6 +61,9 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResult updateOrderStatus(UpdateOrderStatusParam param) {
+        if (Objects.isNull(param.getUpdateBy()) || StringUtils.isBlank(param.getUpdateByName())) {
+            return HttpResult.error("操作人信息不能为空!");
+        }
         KwoTradeOrder order = kwoTradeOrderService.getById(param.getTOrderId());
         if (Objects.isNull(order)) {
             return HttpResult.error("订单不存在!");
@@ -94,6 +99,9 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResult updateOrderAmount(UpdateOrderAmountParam param) {
+        if (Objects.isNull(param.getUpdateBy()) || StringUtils.isBlank(param.getUpdateByName())) {
+            return HttpResult.error("操作人信息不能为空!");
+        }
         Long id = param.getTOrderId();
         Long updateBy = param.getUpdateBy();
         String lockKey = String.format(RedisConstant.GOODS_UPDATE_AMOUNT_KEY, id);
@@ -143,6 +151,9 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void contractSignCompleted(ContractSignCompletedParam param) {
+        if (Objects.isNull(param.getUpdateBy()) || StringUtils.isBlank(param.getUpdateByName())) {
+            throw new BusinessException("操作人信息不能为空!");
+        }
         Long contractId = param.getContractId();
         Long updateBy = param.getUpdateBy();
         List<KwoTradeOrderContract> contracts = kwoTradeOrderContractService.getByContractId(contractId);

+ 2 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/GoodsInfo.java

@@ -47,8 +47,8 @@ public class GoodsInfo {
     /**
      * 商品发票税率(%)
      */
-    @NotNull(message = "商品发票税率不能为空")
-    private BigDecimal goodsTaxRate;
+    @NotBlank(message = "商品发票税率不能为空")
+    private String goodsTaxRate;
 
     /**
      * 商品尺寸大小

+ 3 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/GoodsInfoDetailRes.java

@@ -6,6 +6,7 @@ import lombok.Setter;
 import lombok.ToString;
 import lombok.experimental.Accessors;
 
+import java.io.Serial;
 import java.io.Serializable;
 
 /**
@@ -19,6 +20,8 @@ import java.io.Serializable;
 @Accessors(chain = true)
 public class GoodsInfoDetailRes extends GoodsInfo implements Serializable {
 
+    @Serial
+    private static final long serialVersionUID = 1427251412395875742L;
     /**
      * 商品类型label
      */

+ 23 - 8
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -3,6 +3,8 @@ package com.sckw.order.serivce;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.sckw.contract.api.RemoteContractService;
+import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
 import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
@@ -53,6 +55,9 @@ public class KwoTradeOrderService {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private GoodsInfoService goodsInfoService;
 
+    @DubboReference(version = "2.0.0", group = "design", check = false)
+    private RemoteContractService remoteContractService;
+
     private final KwoTradeOrderMapper kwoTradeOrderMapper;
     private final StreamBridge streamBridge;
     private final KwoTradeOrderAddressService kwoTradeOrderAddressService;
@@ -117,7 +122,9 @@ public class KwoTradeOrderService {
             Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
             unitInfos.forEach(e -> {
                 KwoTradeOrderUnit unit = BeanUtils.copyProperties(e, KwoTradeOrderUnit.class);
-                unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(entMap.get(e.getEntId()).getId());
+                //todo:目前获取顶级企业dubbo接口有bug,暂时取自身企业id
+//                unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(entMap.get(e.getEntId()).getId());
+                unit.setTOrderId(id).setTOrderNo(tOrderNo).setTopEntId(e.getEntId());
                 list.add(unit);
                 if (Objects.equals(e.getUnitType(), DictEnum.TORDER_UNIT_TYPE_1.getValue())) {
                     order.setSupplyEntId(e.getEntId()).setSupplyTopEntId(e.getEntId()).setSupplyFirmName(e.getFirmName())
@@ -314,7 +321,7 @@ public class KwoTradeOrderService {
                 GoodsInfoDetailRes goodsDetail = new GoodsInfoDetailRes();
                 goodsDetail.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), goods.getGoodsType()))
                         .setGoodsUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), goods.getUnit()))
-                        .setGoodsTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), String.valueOf(goods.getTaxRate())))
+                        .setGoodsTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), goods.getTaxRate()))
                         .setGoodsId(goods.getId()).setGoodsCode(goods.getCode()).setGoodsName(goods.getName())
                         .setGoodsType(goods.getGoodsType()).setGoodsTaxRate(goods.getTaxRate()).setGoodsSpec(goods.getSpec())
                         .setUnit(goods.getUnit()).setPriceRangeId(orderGoods.getPriceRangeId()).setUnitPrice(orderGoods.getUnitPrice())
@@ -347,7 +354,12 @@ public class KwoTradeOrderService {
         KwoTradeOrderContract contract = kwoTradeOrderContractService.getByOrderId(id);
         if (Objects.nonNull(contract)) {
             ContractInfo contractInfo = BeanUtils.copyProperties(contract, ContractInfo.class);
-            //todo:获取合同信息
+            Map<Long, ContractCommonInfoResDto> contractMap = remoteContractService.queryContractBaseInfo(List.of(contractInfo.getContractId()));
+            ContractCommonInfoResDto contractRes = contractMap.get(contractInfo.getContractId());
+            if (Objects.nonNull(contractRes)) {
+                contractInfo.setContractName(contractRes.getContactName());
+                contractInfo.setContractSigningWay(contractRes.getSigningWayName());
+            }
             detail.setContractInfo(contractInfo);
         }
         return detail;
@@ -430,6 +442,9 @@ public class KwoTradeOrderService {
         }
         ContractInfo contractInfo = param.getContractInfo();
         if (Objects.equals(source, DictEnum.TORDER_SOURCE_2.getValue())) {
+            if (StringUtils.isBlank(param.getDeliveryType())) {
+                throw new BusinessException("交付类型不能为空!");
+            }
             if (Objects.isNull(contractInfo)) {
                 throw new BusinessException("代客下单合同信息不能为空");
             }
@@ -465,8 +480,8 @@ public class KwoTradeOrderService {
         if (StringUtils.isBlank(goodsInfo.getGoodsType())) {
             throw new BusinessException("商品类型不能为空!");
         }
-        if (Objects.isNull(goodsInfo.getGoodsTaxRate()) || goodsInfo.getGoodsTaxRate().compareTo(BigDecimal.ZERO) < 0) {
-            throw new BusinessException("商品发票税率不能为空且不能为负数!");
+        if (StringUtils.isBlank(goodsInfo.getGoodsTaxRate())) {
+            throw new BusinessException("商品发票税率不能为空!");
         }
         if (StringUtils.isBlank(goodsInfo.getGoodsSpec())) {
             throw new BusinessException("商品尺寸大小不能为空!");
@@ -693,7 +708,7 @@ public class KwoTradeOrderService {
         KwoTradeOrderTrack track = new KwoTradeOrderTrack();
         track.setTOrderId(order.getId()).setTOrderNo(order.getTOrderNo()).setRemark(param.getRemark()).setStatus(order.getStatus());
         kwoTradeOrderTrackService.insert(track);
-        if (param.getActualAmount().compareTo(order.getActualAmount()) != 0) {
+        if (param.getActualAmount().compareTo(order.getAmount()) != 0) {
             KwoTradeOrderGoods goods = kwoTradeOrderGoodsService.getByOrderId(param.getId());
             if (Objects.isNull(goods)) {
                 throw new BusinessException("商品信息异常!");
@@ -707,8 +722,8 @@ public class KwoTradeOrderService {
         }
         //mongodb更新订单状态
         SckwTradeOrder updateParam = new SckwTradeOrder();
-        updateParam.setTOrderId(order.getId()).setStatus(order.getStatus()).setUpdateBy(LoginUserHolder.getUserId())
-                .setUpdateByName(LoginUserHolder.getUserName()).setUpdateTime(new Date());
+        updateParam.setTOrderId(order.getId()).setActualAmount(order.getActualAmount()).setStatus(order.getStatus())
+                .setUpdateBy(LoginUserHolder.getUserId()).setUpdateByName(LoginUserHolder.getUserName()).setUpdateTime(new Date());
         saveMongoDb(3, updateParam);
 
     }

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

@@ -71,7 +71,7 @@ public class KwpGoods extends BaseModel {
     /**
      * 发票税率(%)
      */
-    private BigDecimal taxRate;
+    private String taxRate;
 
     /**
      * 交易方式(合同采购、直接采购、预付款、货到付款、到款发货)

+ 10 - 8
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/AddGoodsParam.java

@@ -1,7 +1,10 @@
 package com.sckw.product.model.vo.req;
 
 import jakarta.validation.Valid;
-import jakarta.validation.constraints.*;
+import jakarta.validation.constraints.DecimalMin;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
@@ -30,7 +33,7 @@ public class AddGoodsParam {
     /**
      * 商品类型
      */
-    @NotNull(message = "商品类型不能为空")
+    @NotBlank(message = "商品类型不能为空")
     private String goodsType;
 
     /**
@@ -50,7 +53,7 @@ public class AddGoodsParam {
      * 库存数量
      */
     @NotNull(message = "库存数量不能为空")
-    @DecimalMin(value = "0.00",message = "库存数量最小为零")
+    @DecimalMin(value = "0.00", message = "库存数量最小为零")
     private BigDecimal amount;
 
     /**
@@ -62,20 +65,19 @@ public class AddGoodsParam {
     /**
      * 发票税率(%)
      */
-    @NotNull(message = "发票税率不能为空")
-    @DecimalMin(value = "0.00",message = "发票税率最小为零")
-    private BigDecimal taxRate;
+    @NotBlank(message = "发票税率不能为空")
+    private String taxRate;
 
     /**
      * 交易方式(合同采购、直接采购、预付款、货到付款、到款发货)
      */
-    @NotNull(message = "交易方式不能为空")
+    @NotBlank(message = "交易方式不能为空")
     private String trading;
 
     /**
      * 预付款最低限额(万元)
      */
-    @DecimalMin(value = "0.00",message = "预付款最低限额最小为零")
+    @DecimalMin(value = "0.00", message = "预付款最低限额最小为零")
     private BigDecimal advancePrice;
 
     /**

+ 1 - 2
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/UpdateGoodsParam.java

@@ -63,8 +63,7 @@ public class UpdateGoodsParam {
     /**
      * 发票税率(%)
      */
-    @DecimalMin(value = "0.00",message = "发票税率最小为零")
-    private BigDecimal taxRate;
+    private String taxRate;
 
     /**
      * 交易方式(合同采购、直接采购、预付款、货到付款、到款发货)

+ 1 - 1
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/GoodsDetail.java

@@ -89,7 +89,7 @@ public class GoodsDetail {
     /**
      * 发票税率(%)
      */
-    private BigDecimal taxRate;
+    private String taxRate;
 
     /**
      * 发票税率label

+ 1 - 1
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/GoodsList.java

@@ -68,7 +68,7 @@ public class GoodsList {
     /**
      * 发票税率(%)
      */
-    private BigDecimal taxRate;
+    private String taxRate;
 
     /**
      * 发票税率label

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

@@ -181,7 +181,7 @@ public class KwpGoodsService {
         detail.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), detail.getGoodsType()))
                 .setTradingLabel(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), detail.getTrading()))
                 .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), detail.getUnit()))
-                .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), String.valueOf(detail.getTaxRate())))
+                .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), detail.getTaxRate()))
                 .setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(detail.getStatus())));
         //商品图片信息
         List<KwpGoodsImage> goodsImages = kwpGoodsImageService.getByGoodsId(id);
@@ -305,8 +305,8 @@ public class KwpGoodsService {
         if (Objects.isNull(param.getAmount()) || param.getAmount().compareTo(BigDecimal.ZERO) < 0) {
             throw new BusinessException("库存数量不能为空且最小为零!");
         }
-        if (Objects.isNull(param.getTaxRate()) || param.getTaxRate().compareTo(BigDecimal.ZERO) < 0) {
-            throw new BusinessException("发票税率不能为空最小为零!");
+        if (StringUtils.isBlank(param.getTaxRate())) {
+            throw new BusinessException("发票税率不能为空!");
         }
         if (StringUtils.isBlank(param.getTrading())) {
             throw new BusinessException("交易方式不能为空!");
@@ -438,7 +438,7 @@ public class KwpGoodsService {
                     .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), goodsList.getGoodsType()))
                     .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), goodsList.getUnit()))
                     .setTradingLabel(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), goodsList.getTrading()))
-                    .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), String.valueOf(goodsList.getTaxRate())))
+                    .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), goodsList.getTaxRate()))
                     .setManageName(Objects.nonNull(manager) ? manager.getName() : null)
                     .setPhone(Objects.nonNull(manager) ? manager.getPhone() : null)
                     .setSupplyEnt(Objects.nonNull(entMap.get(e.getSupplyEntId())) ? entMap.get(e.getSupplyEntId()) : null)
@@ -683,7 +683,7 @@ public class KwpGoodsService {
                     .setPrice(CollectionUtils.isEmpty(priceRanges) ? null : priceRanges.get(0).getPrice())
                     .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()))
                     .setTradingLabel(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
-                    .setTradingLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), e.getUnit()))
+                    .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), e.getUnit()))
                     .setSupplyEnt(entMap.get(e.getSupplyEntId()));
             result.add(materials);
         });

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

@@ -114,6 +114,43 @@ public class KwTransportController {
         }
         return httpResult;
     }
+
+    /**
+     * 运单管理-运单列表 top 统计
+     *
+     * @param query
+     * @return {@link HttpResult }
+     * @author jc
+     * @date 2023/07/21
+     */
+    @RequestMapping(value = "/getWayBillStatistics", method = RequestMethod.POST)
+    public HttpResult wayBillStatistics(@Validated @RequestBody WaybillOrderQuery query) {
+        try {
+            return transportService.getWayBillStatistics(query);
+        } catch (Exception e) {
+            log.error("运单管理-运单列表top统计失败:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
+    /**
+     * 运单管理-运单列表 列表统计数据项
+     * 【还需要修改】
+     * @param query
+     * @return {@link HttpResult }
+     * @author jc
+     * @date 2023/07/21
+     */
+    @RequestMapping(value = "/wayBillTotalCount", method = RequestMethod.POST)
+    public HttpResult wayBillTotalCount(@Validated @RequestBody WaybillOrderQuery query) {
+        try {
+            return transportService.wayBillTotalCount(query);
+        } catch (Exception e) {
+            log.error("运单管理-运单列表top统计失败:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
     /**
      * 承运订单-获取分包托运列表
      *

+ 171 - 8
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java

@@ -328,9 +328,11 @@ public class KwTransportService {
 
     /**
      * 获取运单列表
+     *
      * @param query
-     * @return
-     * @throws ParseException
+     * @return {@link HttpResult }
+     * @author jc
+     * @date 2023/07/21
      */
     public HttpResult getWaybillOrders(WaybillOrderQuery query) throws ParseException {
         // 模糊匹配
@@ -339,6 +341,7 @@ public class KwTransportService {
         // 创建条件对象
         Criteria criteria = new Criteria();
         criteria.and("entId").is(LoginUserHolder.getEntId());
+        criteria.and("delFlag").is(NumberConstant.ZERO);
         // 装载时间
         if (StringUtils.isNotBlank(query.getStartLoadTime()) && StringUtils.isNotEmpty(query.getEndLoadTime())) {
             criteria.andOperator(Criteria.where("loadTime").gte(query.getStartLoadTime()), Criteria.where("loadTime")
@@ -354,7 +357,6 @@ public class KwTransportService {
             criteria.andOperator(Criteria.where("unloadTime").gte(query.getStartUnloadTime()), Criteria.where("unloadTime")
                     .lte(query.getEndUnloadTime()));
         }
-        criteria.and("delFlag").is(String.valueOf(NumberConstant.ZERO));
         // 多条件模糊查询
         Criteria c1 = new Criteria();
         Criteria c2 = new Criteria();
@@ -391,6 +393,164 @@ public class KwTransportService {
         return HttpResult.ok(build);
     }
 
+    /**
+     * 运单管理-运单列表 top 统计
+     *
+     * @param query 查询
+     * @return {@link HttpResult }
+     * @author jc
+     * @date 2023/07/21
+     */
+    public HttpResult getWayBillStatistics(WaybillOrderQuery query){
+        //模糊匹配
+        //根据条件查询所有并排序,且分页
+        //设置模糊查询匹配规则  忽略大小写
+        // 创建条件对象
+        Criteria criteria = new Criteria();
+        criteria.and("entId").is(LoginUserHolder.getEntId());
+        criteria.and("delFlag").is(NumberConstant.ZERO);
+
+        if (StringUtils.isNotBlank(query.getStatus())) {
+            criteria.and("status").is(query.getStatus());
+        }
+        // 装载时间
+        if (StringUtils.isNotBlank(query.getStartLoadTime()) && StringUtils.isNotEmpty(query.getEndLoadTime())) {
+            criteria.andOperator(Criteria.where("loadTime").gte(query.getStartLoadTime()), Criteria.where("loadTime")
+                    .lte(query.getEndLoadTime()));
+        }
+        // 派车时间
+        if (StringUtils.isNotBlank(query.getStartSendCarTime()) && StringUtils.isNotEmpty(query.getEndSendCarTime())) {
+            criteria.andOperator(Criteria.where("sendCarTime").gte(query.getStartSendCarTime()), Criteria.where("sendCarTime")
+                    .lte(query.getEndSendCarTime()));
+        }
+        // 卸货时间
+        if (StringUtils.isNotBlank(query.getStartUnloadTime()) && StringUtils.isNotEmpty(query.getEndUnloadTime())) {
+            criteria.andOperator(Criteria.where("unloadTime").gte(query.getStartUnloadTime()), Criteria.where("unloadTime")
+                    .lte(query.getEndUnloadTime()));
+        }
+        // 多条件模糊查询
+        Criteria c1 = new Criteria();
+        Criteria c2 = new Criteria();
+        Criteria c3 = new Criteria();
+        Criteria c4 = new Criteria();
+        Criteria c5 = new Criteria();
+        Criteria c6 = new Criteria();
+        if (StringUtils.isNotBlank(query.getKeywords())) {
+            Pattern pattern = Pattern.compile("^.*" + query.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
+            c1 = Criteria.where("wOrderNo").regex(pattern);
+            c2 = Criteria.where("truckNo").regex(pattern);
+            c3 = Criteria.where("driverName").regex(pattern);
+            c4 = Criteria.where("firmName").regex(pattern);
+            c5 = Criteria.where("loadAddress").regex(pattern);
+            c6 = Criteria.where("unloadAddress").regex(pattern);
+            criteria.orOperator(c1, c2, c3, c4, c5, c6);
+        }
+        Aggregation aggregation = Aggregation.newAggregation(
+                Aggregation.match(criteria),
+                Aggregation.group("status").count().as("total"),
+                Aggregation.project("total").and("value").previousOperation()
+        );
+        AggregationResults<TobleTop> outputTypeCount = mongoTemplate.aggregate(aggregation, SckwWaybillOrder.class, TobleTop.class);
+        List<TobleTop> results = outputTypeCount.getMappedResults();
+        // 填充默认值
+        List<TobleTop> list = new ArrayList<>();
+        for (CarWaybillEnum status:CarWaybillEnum.values()) {
+            TobleTop top = new TobleTop();
+            top.setName(status.getDestination());
+            top.setValue(String.valueOf(status.getCode()));
+            top.setTotal(0);
+            if(CollectionUtils.isNotEmpty(results)) {
+                for (TobleTop result:results) {
+                    if(StringUtils.isNotEmpty(result.getValue()) && String.valueOf(result.getValue()).equals(String.valueOf(status.getCode()))) {
+                        top.setTotal(result.getTotal());
+                        continue;
+                    }
+                }
+            }
+            list.add(top);
+        }
+        // 查询结果
+        return HttpResult.ok(list);
+    }
+
+    /**
+     * 运单管理-运单列表 列表统计数据项
+     *
+     * @param query 查询
+     * @return {@link HttpResult }
+     * @author jc
+     * @date 2023/07/21
+     */
+    public HttpResult wayBillTotalCount(WaybillOrderQuery query){
+        // 统计项字段
+        Criteria criteria = new Criteria();
+        criteria.and("entId").is(LoginUserHolder.getEntId());
+        criteria.and("delFlag").is(NumberConstant.ZERO);
+
+        if (StringUtils.isNotBlank(query.getStatus())) {
+            criteria.and("status").is(query.getStatus());
+        }
+        // 装载时间
+        if (StringUtils.isNotBlank(query.getStartLoadTime()) && StringUtils.isNotEmpty(query.getEndLoadTime())) {
+            criteria.andOperator(Criteria.where("loadTime").gte(query.getStartLoadTime()), Criteria.where("loadTime")
+                    .lte(query.getEndLoadTime()));
+        }
+        // 派车时间
+        if (StringUtils.isNotBlank(query.getStartSendCarTime()) && StringUtils.isNotEmpty(query.getEndSendCarTime())) {
+            criteria.andOperator(Criteria.where("sendCarTime").gte(query.getStartSendCarTime()), Criteria.where("sendCarTime")
+                    .lte(query.getEndSendCarTime()));
+        }
+        // 卸货时间
+        if (StringUtils.isNotBlank(query.getStartUnloadTime()) && StringUtils.isNotEmpty(query.getEndUnloadTime())) {
+            criteria.andOperator(Criteria.where("unloadTime").gte(query.getStartUnloadTime()), Criteria.where("unloadTime")
+                    .lte(query.getEndUnloadTime()));
+        }
+        // 多条件模糊查询
+        Criteria c1 = new Criteria();
+        Criteria c2 = new Criteria();
+        Criteria c3 = new Criteria();
+        Criteria c4 = new Criteria();
+        Criteria c5 = new Criteria();
+        Criteria c6 = new Criteria();
+        if (StringUtils.isNotBlank(query.getKeywords())) {
+            Pattern pattern = Pattern.compile("^.*" + query.getKeywords() + ".*$", Pattern.CASE_INSENSITIVE);
+            c1 = Criteria.where("wOrderNo").regex(pattern);
+            c2 = Criteria.where("truckNo").regex(pattern);
+            c3 = Criteria.where("driverName").regex(pattern);
+            c4 = Criteria.where("firmName").regex(pattern);
+            c5 = Criteria.where("loadAddress").regex(pattern);
+            c6 = Criteria.where("unloadAddress").regex(pattern);
+            criteria.orOperator(c1, c2, c3, c4, c5, c6);
+        }
+        Aggregation aggregation = Aggregation.newAggregation(
+                Aggregation.match(criteria),
+                Aggregation.group("status").count().as("total"),
+                Aggregation.project("total").and("value").previousOperation()
+        );
+        AggregationResults<TobleTop> outputTypeCount = mongoTemplate.aggregate(aggregation, SckwWaybillOrder.class, TobleTop.class);
+        List<TobleTop> results = outputTypeCount.getMappedResults();
+        // 填充默认值
+        List<TobleTop> list = new ArrayList<>();
+        for (CarWaybillEnum status:CarWaybillEnum.values()) {
+            TobleTop top = new TobleTop();
+            top.setName(status.getDestination());
+            top.setValue(String.valueOf(status.getCode()));
+            top.setTotal(0);
+            if(CollectionUtils.isNotEmpty(results)) {
+                for (TobleTop result:results) {
+                    if(StringUtils.isNotEmpty(result.getValue()) && String.valueOf(result.getValue()).equals(String.valueOf(status.getCode()))) {
+                        top.setTotal(result.getTotal());
+                        continue;
+                    }
+                }
+            }
+            list.add(top);
+        }
+
+        // 查询结果
+        return HttpResult.ok(list);
+    }
+
     /**
      * 处理运单查询结果
      * @param list
@@ -407,9 +567,12 @@ public class KwTransportService {
             vo.setDriverName(waybillOrder.getDriverName() == null ?
                     null : String.valueOf(waybillOrder.getDriverName()));
             vo.setType(String.valueOf(waybillOrder.getType()));
-            vo.setSendCarTime(String.valueOf(waybillOrder.getCreateTime()));
-            vo.setStartTime(String.valueOf(waybillOrder.getStartTime()));
-            vo.setEndTime(String.valueOf(waybillOrder.getEndTime()));
+            vo.setSendCarTime(waybillOrder.getCreateTime() == null ?
+                    null : DateUtil.getDateTime(waybillOrder.getCreateTime()));
+            vo.setStartTime(waybillOrder.getStartTime() == null ?
+                    null : DateUtil.getDateTime(waybillOrder.getStartTime()));
+            vo.setEndTime(waybillOrder.getEndTime() == null ?
+                    null : DateUtil.getDateTime(waybillOrder.getEndTime()));
             vo.setEntrustAmount(String.valueOf(waybillOrder.getEntrustAmount()));
             vo.setLoadingAddress(waybillOrder.getLoadDetailAddress());
             vo.setUnloadingAddress(waybillOrder.getUnloadDetailAddress());
@@ -418,9 +581,9 @@ public class KwTransportService {
             vo.setUnloadAmount(waybillOrder.getUnloadAmount() == null ?
                     null : String.valueOf(waybillOrder.getUnloadAmount()));
             vo.setLoadTime(waybillOrder.getLoadTime() == null ?
-                    null : String.valueOf(waybillOrder.getLoadTime()));
+                    null : DateUtil.getDateTime(waybillOrder.getLoadTime()));
             vo.setUnloadTime(waybillOrder.getUnloadTime() == null ?
-                    null :String.valueOf(waybillOrder.getUnloadTime()));
+                    null :DateUtil.getDateTime(waybillOrder.getUnloadTime()));
             returnList.add(vo);
         }
     }

+ 1 - 2
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/TradeOrderStatementList.java

@@ -9,7 +9,6 @@ import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
 
-import java.math.BigDecimal;
 import java.time.LocalDate;
 
 /**
@@ -55,7 +54,7 @@ public class TradeOrderStatementList extends PageRequest {
     /**
      * 商品税率
      */
-    private BigDecimal goodsTaxRate;
+    private String goodsTaxRate;
 
     /**
      * 商品名称

+ 5 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/WaybillOrderQuery.java

@@ -58,4 +58,9 @@ public class WaybillOrderQuery extends PageRequest implements Serializable {
      * 关键字搜索
      */
     private String keywords;
+
+    /**
+     * 运单状态
+     */
+    private String status;
 }

+ 1 - 1
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/CarWaybillVo.java

@@ -13,7 +13,7 @@ import java.io.Serializable;
  */
 @Data
 @Accessors(chain = true)
-public class CarWaybillVo extends PageResult implements Serializable {
+public class CarWaybillVo implements Serializable {
 
     /**
      * 物流订单id

+ 0 - 26
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/ExceptionController.java

@@ -1,26 +0,0 @@
-package com.sckw.system.controller;
-
-import com.sckw.core.web.response.HttpResult;
-import jakarta.servlet.http.HttpServletRequest;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author czh
- * @desc TODO
- * @date 2023/6/14
- */
-@RestController
-@RequestMapping("/error")
-public class ExceptionController {
-
-    /**
-     * 重新抛出异常
-     */
-    @PostMapping("/throwError")
-    public HttpResult exception(HttpServletRequest request) {
-        return HttpResult.error(Integer.parseInt(request.getAttribute("code").toString()), request.getAttribute("message").toString());
-    }
-}

+ 24 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java

@@ -226,4 +226,28 @@ public class KwsEnterpriseController {
         return HttpResult.ok(kwsEntService.findList(reqVo));
     }
 
+    /**
+     * @param  reqVo id
+     * @return  HttpResult
+     * @desc: 查询企业的信息+主体机构信息
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    @PostMapping("queryEntOrganization")
+    public HttpResult queryEntOrganization(@RequestBody IdReqVo reqVo) {
+        return HttpResult.ok(kwsEntService.queryCurrentOrganization(reqVo.getId()));
+    }
+
+    /**
+     * @param  reqVo id
+     * @return  HttpResult
+     * @desc: 查询其他入驻企
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    @PostMapping("queryOtherEnt")
+    public HttpResult queryOtherEnt(@RequestBody IdReqVo reqVo) {
+        return HttpResult.ok(kwsEntService.queryOtherEnt(reqVo.getId()));
+    }
+
 }

+ 2 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsUserController.java

@@ -6,6 +6,7 @@ import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.web.constant.HttpStatus;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.system.model.KwsUser;
 import com.sckw.system.model.vo.req.IdReqVo;
@@ -55,6 +56,7 @@ public class KwsUserController {
     public HttpResult findPage(@RequestBody HashMap params) throws SystemException {
         // 设置分页参数
         PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
+        params.put("entId", LoginUserHolder.getEntId());
         List<KwsUserResVo> list = kwsUserService.findPage(params);
         PageResult pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));
         return HttpResult.ok(pageResult);

+ 9 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntDeptDao.java

@@ -1,6 +1,7 @@
 package com.sckw.system.dao;
 
 import com.sckw.system.model.KwsEntDept;
+import com.sckw.system.model.pojo.FindEntDeptInfoPojo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -52,4 +53,12 @@ public interface KwsEntDeptDao {
      */
     List<KwsEntDept> selectByEntPid(Long entPid);
 
+    /**
+     * @param list 企业id
+     * @return KwsEntDept
+     * @desc: 查主体单位
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    List<KwsEntDept> selectByEntPidList(List<Long> list);
 }

+ 9 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java

@@ -123,4 +123,13 @@ public interface KwsEnterpriseDao {
      * @date: 2023/7/10
      */
     List<KwsEnterprise> queryEntByName(String entName);
+
+    /**
+     * @param entName 企业名
+     * @return KwsEnterprise
+     * @desc: 精确匹配企业名/联系人
+     * @author: czh
+     * @date: 2023/7/10
+     */
+    List<KwsEnterprise> checkEntRepeat(@Param(value = "entName") String entName, @Param(value = "phone") String phone);
 }

+ 2 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsRoleDao.java

@@ -1,6 +1,7 @@
 package com.sckw.system.dao;
 
 import com.sckw.system.model.KwsRole;
+import com.sckw.system.model.vo.res.RoleResVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -41,7 +42,7 @@ public interface KwsRoleDao {
      * @return
      * @throws Exception
      */
-    List<KwsRole> findPage(Map<String, Object> params);
+    List<RoleResVo> findPage(Map<String, Object> params);
 
     /**
      * @param  userId 用户id

+ 9 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserDao.java

@@ -74,4 +74,13 @@ public interface KwsUserDao {
      */
     List<KwsUser> selectByEntId(Long entId);
 
+    /**
+     * @param roleIdList 角色id集合
+     * @return KwsUser
+     * @desc: 根据角色查用户
+     * @author: czh
+     * @date: 2023/7/21
+     */
+    List<KwsUser> selectByRoleIds(List<Long> roleIdList);
+
 }

+ 6 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java

@@ -7,6 +7,7 @@ import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.KwsEntDeptDao;
 import com.sckw.system.model.*;
+import com.sckw.system.model.pojo.FindEntDeptInfoPojo;
 import com.sckw.system.model.vo.res.CertificateResVo;
 import com.sckw.system.model.vo.res.KwsDeptResVo;
 import com.sckw.system.service.KwsDeptService;
@@ -136,4 +137,9 @@ public class RemoteBaseService {
             entCacheResDto.setEntDeptIds(String.join(Global.COMMA, kwsEntDepts.stream().map(KwsEntDept::getEntId).map(String::valueOf).toList()));
         }
     }
+
+
+    public List<KwsEntDept> queryEntDeptCacheByIds(List<Long> entIds) {
+        return kwsEntDeptDao.selectByEntPidList(entIds);
+    }
 }

+ 33 - 12
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -11,10 +11,7 @@ import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.SysDictDao;
-import com.sckw.system.model.KwsEnterprise;
-import com.sckw.system.model.KwsUser;
-import com.sckw.system.model.SysArea;
-import com.sckw.system.model.SysDict;
+import com.sckw.system.model.*;
 import com.sckw.system.service.KwsUserService;
 import com.sckw.system.service.SysAreaService;
 import org.apache.dubbo.config.annotation.DubboService;
@@ -263,14 +260,6 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         for (Long entId : entIdList) {
             EntCacheResDto entCacheResDto = queryEntCacheById(entId);
             remoteBaseService.fillRelate(entCacheResDto);
-            //有主体单位
-            String entDeptIds = entCacheResDto.getEntDeptIds();
-            if (StringUtils.isNotBlank(entDeptIds)) {
-                List<Long> entDeptIdList = Arrays.stream(entDeptIds.split(Global.COMMA)).map(Long::parseLong).toList();
-                List<EntCacheResDto> child = queryEntCacheByIds(entDeptIdList);
-                entCacheResDto.setChild(child);
-                result.put(entId, entCacheResDto);
-            }
 
             //有父企业
             Long parentId = entCacheResDto.getParentId();
@@ -278,7 +267,21 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
                 EntCacheResDto parent = queryEntCacheById(parentId);
                 parent.setChild(Collections.singletonList(entCacheResDto));
                 result.put(entId, parent);
+                continue;
             }
+
+            //没有主体单位
+            String entDeptIds = entCacheResDto.getEntDeptIds();
+            if (StringUtils.isBlank(entDeptIds)) {
+                result.put(entId, entCacheResDto);
+                continue;
+            }
+
+            //有主体单位
+            List<Long> entDeptIdList = Arrays.stream(entDeptIds.split(Global.COMMA)).map(Long::parseLong).toList();
+            List<EntCacheResDto> child = queryEntCacheByIds(entDeptIdList);
+            entCacheResDto.setChild(child);
+            result.put(entId, entCacheResDto);
         }
         return result;
     }
@@ -298,6 +301,24 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         return list;
     }
 
+    @Override
+    public Map<Long, List<EntCacheResDto>> queryEntDeptCacheByIds(List<Long> entIds) {
+        List<KwsEntDept> kwsEntDepts = remoteBaseService.queryEntDeptCacheByIds(entIds);
+        if (CollectionUtils.isEmpty(kwsEntDepts)) {
+            return new HashMap<>(4);
+        }
+
+        Map<Long, List<KwsEntDept>> collect = kwsEntDepts.stream().collect(Collectors.groupingBy(KwsEntDept::getEntPid));
+        Map<Long, List<EntCacheResDto>> map = new HashMap<>();
+        for (Long key : collect.keySet()) {
+            List<KwsEntDept> kwsEntDepts1 = collect.get(key);
+            List<Long> entIdList = kwsEntDepts1.stream().map(KwsEntDept::getEntId).toList();
+            List<EntCacheResDto> entCacheResDtos = queryEntCacheByIds(entIdList);
+            map.put(key, entCacheResDtos);
+        }
+        return map;
+    }
+
     @Override
     public Map<Long, EntCacheResDto> queryEntCacheMapByIds(List<Long> entIds) {
         List<EntCacheResDto> entCacheResDtos = queryEntCacheByIds(entIds);

+ 10 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java

@@ -17,10 +17,7 @@ import com.sckw.system.model.*;
 import com.sckw.system.model.pojo.FindMenuTreePojo;
 import com.sckw.system.model.vo.req.ForgetPasswordReqVo;
 import com.sckw.system.model.vo.res.KwsMenuResVo;
-import com.sckw.system.service.KwsEnterpriseService;
-import com.sckw.system.service.KwsMenuService;
-import com.sckw.system.service.KwsRoleService;
-import com.sckw.system.service.KwsUserService;
+import com.sckw.system.service.*;
 import jakarta.annotation.Resource;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.springframework.stereotype.Service;
@@ -62,6 +59,9 @@ public class RemoteUserServiceImpl implements RemoteUserService {
     @Resource
     private SysDictDao sysDictDao;
 
+    @Resource
+    private CommonService commonService;
+
 
     @Override
     public KwsEnterpriseResDto queryEnterpriseById(Long id) {
@@ -158,6 +158,12 @@ public class RemoteUserServiceImpl implements RemoteUserService {
         return sysDictResDtos.stream().collect(Collectors.toMap(SysDictResDto::getId, item -> item, (oldValue, newValue) -> newValue));
     }
 
+    @Override
+    public void checkRegisterParam(String entName, String phone, Integer systemType) {
+        commonService.checkEntRepeat(entName, phone);
+        kwsUserService.checkAccountValid(phone, systemType);
+    }
+
     @Override
     public KwsUserResDto getUserByAccount(String username) {
         return remoteBaseService.getUserByAccount(username);

+ 39 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/pojo/FindEntDeptInfoPojo.java

@@ -0,0 +1,39 @@
+package com.sckw.system.model.pojo;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc 查企业机构信息
+ * @date 2023/7/22
+ */
+@Data
+public class FindEntDeptInfoPojo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 2877831316094705633L;
+
+    /**
+     * 主体单位id
+     */
+    private Long id;
+
+    /**
+     * 父企业id
+     */
+    private Long pid;
+
+    /**
+     * 主体单为名
+     */
+    private String entName;
+
+    /**
+     * 父企业名
+     */
+    private String pEntName;
+
+}

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EditRoleReqVo.java

@@ -25,7 +25,7 @@ public class EditRoleReqVo implements Serializable {
     private String name;
 
     /**
-     * 当前单位id,可以是机构也可以是企业,目前产品设计是企业
+     * 当前机构
      */
     @NotBlank(message = "当前组织机构不能为空")
     private Long currentUnitId;

+ 2 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsDeptResVo.java

@@ -42,8 +42,7 @@ public class KwsDeptResVo implements Serializable {
     /**
      * 创建人
      */
-    @JsonSerialize(using = LongToStringUtils.class)
-    private Long createBy;
+    private String createBy;
 
     /**
      * 创建时间
@@ -53,8 +52,7 @@ public class KwsDeptResVo implements Serializable {
     /**
      * 更新人
      */
-    @JsonSerialize(using = LongToStringUtils.class)
-    private Long updateBy;
+    private String updateBy;
 
 
     /**

+ 34 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/QueryCurrentOrganizationResVo.java

@@ -0,0 +1,34 @@
+package com.sckw.system.model.vo.res;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc 当前企业组织
+ * @date 2023/7/22
+ */
+@Data
+public class QueryCurrentOrganizationResVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -2663714495448672730L;
+
+    /**
+     * 企业id
+     */
+    private Long entId;
+
+    /**
+     * 企业名
+     */
+    private String entName;
+
+    /**
+     * 父id
+     */
+    private Long pId;
+
+}

+ 1 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/RoleResVo.java

@@ -49,8 +49,7 @@ public class RoleResVo implements Serializable {
     /**
      * 创建人
      */
-    @JsonSerialize(using = LongToStringUtils.class)
-    private Long createBy;
+    private String createBy;
 
     /**
      * 创建时间

+ 28 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/CommonService.java

@@ -1,11 +1,17 @@
 package com.sckw.system.service;
 
 import com.alibaba.fastjson.JSON;
+import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.model.EntCertificateInfo;
 import com.sckw.core.web.model.LoginEntInfo;
 import com.sckw.redis.utils.RedissonUtils;
+import com.sckw.system.dao.KwsEnterpriseDao;
+import com.sckw.system.model.KwsEnterprise;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -18,7 +24,15 @@ import java.util.List;
 @Service
 public class CommonService {
 
+    @Autowired
+    private KwsEnterpriseDao kwsEnterpriseDao;
 
+    /**
+     * @desc: 更新资质
+     * @param: entId 企业id entCertificateInfoList 资质信息
+     * @author: czh
+     * @date 2023/7/23
+     */
     public void updateEntCertificate(Long entId, List<EntCertificateInfo> entCertificateInfoList) {
         String string = RedissonUtils.getString(Global.REDIS_ENTERPRISE_PREFIX + entId);
         if (!StringUtils.isBlank(string)) {
@@ -27,4 +41,18 @@ public class CommonService {
             RedissonUtils.putString(Global.REDIS_ENTERPRISE_PREFIX + entId, JSON.toJSONString(loginEntInfo), Global.COMMON_EXPIRE);
         }
     }
+
+    /**
+     * @desc: 校验企业是否重复
+     * @param: entName 企业名  phone 联系电话
+     * @author: czh
+     * @date 2023/7/23
+     */
+    public void checkEntRepeat(String entName, String phone) {
+        List<KwsEnterprise> list = kwsEnterpriseDao.checkEntRepeat(entName, phone);
+        if (CollectionUtils.isNotEmpty(list)) {
+            throw new SystemException(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.ENT_EXISTS);
+        }
+    }
+
 }

+ 10 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsDeptService.java

@@ -18,6 +18,7 @@ import com.sckw.system.model.vo.res.KwsDeptResVo;
 import org.checkerframework.checker.units.qual.K;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -47,6 +48,7 @@ public class KwsDeptService {
      * @author: czh
      * @date: 2023/7/3
      */
+    @Transactional(rollbackFor = {})
     public void add(KwsDept params) {
         Long deptId = new IdWorker(1).nextId();
         if (Objects.nonNull(params.getParentId()) && params.getParentId().compareTo(0L) != 0) {
@@ -68,6 +70,10 @@ public class KwsDeptService {
         List<KwsDeptResVo> list = kwsDeptDao.findList(kwsDeptParam);
         int sort = 1;
         if (CollectionUtils.isNotEmpty(list)) {
+            List<String> deptNameList = list.stream().map(KwsDeptResVo::getName).toList();
+            if (deptNameList.contains(params.getName())) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_024);
+            }
             sort = list.get(0).getSort() + 1;
         }
         params.setId(deptId);
@@ -90,7 +96,7 @@ public class KwsDeptService {
     public void deleteByKey(String ids) throws SystemException {
         List<Long> list = Arrays.stream(ids.split(",")).map(Long::parseLong).toList();
         List<FindDeptUserPojo> findDeptUserPojoList = kwsDeptDao.findDeptUserByDeptIds(list);
-        if (!CollectionUtils.isEmpty(findDeptUserPojoList)) {
+        if (CollectionUtils.isNotEmpty(findDeptUserPojoList)) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.MSG_020);
         }
         deleteDept(kwsDeptDao.selectByKeys(list));
@@ -108,6 +114,9 @@ public class KwsDeptService {
         }
 
         for (KwsDept kwsDept : kwsDepts) {
+            if (kwsDept.getParentId().equals(0L)) {
+                throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_027);
+            }
             kwsDept.setDelFlag(Global.YES);
             if (kwsDeptDao.update(kwsDept) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);

+ 85 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -15,6 +15,7 @@ import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.model.EntCertificateInfo;
 import com.sckw.system.api.model.dto.req.RegisterReqDto;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.RegisterResDto;
 import com.sckw.system.dao.*;
 import com.sckw.system.dubbo.RemoteSystemServiceImpl;
@@ -25,7 +26,6 @@ import com.sckw.system.model.pojo.FindManagePojo;
 import com.sckw.system.model.pojo.FindPojoParam;
 import com.sckw.system.model.vo.req.*;
 import com.sckw.system.model.vo.res.*;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -303,6 +303,11 @@ public class KwsEnterpriseService {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
+        Integer approval = kwsEnterprise.getApproval();
+        if (approval.equals(ApprovalEnum.PROCESS.getCode()) || approval.equals(ApprovalEnum.REFRESH.getCode())) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_026);
+        }
+
         Long entId = kwsEnterprise.getId();
         Date date = new Date();
         Long userId = LoginUserHolder.getUserId();
@@ -325,7 +330,6 @@ public class KwsEnterpriseService {
         kwsEnterprise.setOrgCode("");
         kwsEnterprise.setRegTime(date);
         kwsEnterprise.setUpdateBy(LoginUserHolder.getUserId());
-        kwsEnterprise.setCreateBy(LoginUserHolder.getUserId());
         kwsEnterprise.setApproval(ApprovalEnum.PROCESS.getCode());
         if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
@@ -670,4 +674,83 @@ public class KwsEnterpriseService {
 
         return list;
     }
+
+
+    /**
+     * @param  entId id
+     * @return  QueryCurrentOrganization
+     * @desc: 查询企业的信息+主体机构信息
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    public List<QueryCurrentOrganizationResVo> queryCurrentOrganization(Long entId) {
+        EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(entId);
+        if (Objects.isNull(entCacheResDto)) {
+            return Collections.emptyList();
+        }
+
+        List<QueryCurrentOrganizationResVo> list = new ArrayList<>();
+        QueryCurrentOrganizationResVo queryCurrentOrganizationResVo = new QueryCurrentOrganizationResVo();
+        queryCurrentOrganizationResVo.setEntId(entCacheResDto.getId());
+        queryCurrentOrganizationResVo.setEntName(entCacheResDto.getFirmName());
+        list.add(queryCurrentOrganizationResVo);
+
+        List<KwsEntDept> kwsEntDepts = kwsEntDeptDao.selectByEntPid(entId);
+        if (CollectionUtils.isEmpty(kwsEntDepts)) {
+            return list;
+        }
+
+        List<Long> entIdList = kwsEntDepts.stream().map(KwsEntDept::getEntId).toList();
+        Map<Long, EntCacheResDto> entCacheResDtoMap = remoteSystemService.queryEntCacheMapByIds(entIdList);
+        for (KwsEntDept kwsEntDept : kwsEntDepts) {
+            EntCacheResDto entCacheResDto1 = entCacheResDtoMap.get(kwsEntDept.getEntId());
+            if (Objects.isNull(entCacheResDto1)) {
+                continue;
+            }
+            QueryCurrentOrganizationResVo queryCurrentOrganizationResVo1 = new QueryCurrentOrganizationResVo();
+            queryCurrentOrganizationResVo1.setEntId(entCacheResDto1.getId());
+            queryCurrentOrganizationResVo1.setEntName(entCacheResDto1.getFirmName());
+            queryCurrentOrganizationResVo1.setPId(kwsEntDept.getEntPid());
+            list.add(queryCurrentOrganizationResVo1);
+        }
+
+        return list;
+    }
+
+
+    /**
+     * @param  entId id
+     * @return  QueryCurrentOrganization
+     * @desc: 查询其他入驻企
+     * @author: czh
+     * @date: 2023/7/22
+     */
+    public List<QueryCurrentOrganizationResVo> queryOtherEnt(Long entId) {
+        List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectByKeys(null);
+        if (CollectionUtils.isEmpty(kwsEnterprises)) {
+            return Collections.emptyList();
+        }
+
+        //过滤除了当前企业的其他企业
+        kwsEnterprises = kwsEnterprises.stream().filter(item -> !item.getId().equals(entId)).toList();
+        if (CollectionUtils.isEmpty(kwsEnterprises)) {
+            return Collections.emptyList();
+        }
+
+        //过滤当前企业的主体机构
+        List<KwsEntDept> kwsEntDepts = kwsEntDeptDao.selectByEntPid(entId);
+        if (CollectionUtils.isNotEmpty(kwsEntDepts)) {
+            List<Long> entIdList = kwsEntDepts.stream().map(KwsEntDept::getEntId).toList();
+            kwsEnterprises = kwsEnterprises.stream().filter(item -> !entIdList.contains(item.getId())).toList();
+        }
+
+        List<QueryCurrentOrganizationResVo> list = new ArrayList<>();
+        for (KwsEnterprise kwsEnterprise : kwsEnterprises) {
+            QueryCurrentOrganizationResVo queryCurrentOrganizationResVo = new QueryCurrentOrganizationResVo();
+            queryCurrentOrganizationResVo.setEntId(kwsEnterprise.getId());
+            queryCurrentOrganizationResVo.setEntName(kwsEnterprise.getFirmName());
+            list.add(queryCurrentOrganizationResVo);
+        }
+        return list;
+    }
 }

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsMenuService.java

@@ -262,7 +262,7 @@ public class KwsMenuService {
     }
 
     private void extracted(Long userId, FindMenuTreePojo findMenuTreePojo) {
-        if (Objects.isNull(userId)) {
+        if (Objects.equals(LoginUserHolder.getIsMain(), Global.YES)) {
             return;
         }
         KwsUser kwsUser = kwsUserDao.selectByKey(userId);

+ 33 - 14
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsRoleService.java

@@ -2,14 +2,12 @@ package com.sckw.system.service;
 
 import java.util.Date;
 
-import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
-import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.StringUtils;
@@ -45,6 +43,9 @@ public class KwsRoleService {
     @Autowired
     KwsRoleDao kwsRoleDao;
 
+    @Autowired
+    KwsUserDao kwsUserDao;
+
     @Autowired
     KwsUserRoleDao kwsUserRoleDao;
 
@@ -86,7 +87,23 @@ public class KwsRoleService {
      */
     @Transactional(rollbackFor = Exception.class)
     public IdResVo add(EditRoleReqVo reqVo) {
+        Long currentUnitId = reqVo.getCurrentUnitId();
+        KwsDept kwsDept = kwsDeptDao.selectByKey(currentUnitId);
+        if (Objects.isNull(kwsDept)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.DEPT_NOT_EXISTS);
+        }
+
+        String parentIds = kwsDept.getParentIds();
+        String[] split = parentIds.split(Global.COMMA);
+        Long topDeptId = Long.parseLong(split[0]);
         IdResVo idResVo = new IdResVo();
+        List<KwsRole> kwsRoles = kwsRoleDao.selectBatchByUnitIds(Collections.singletonList(topDeptId));
+        if (CollectionUtils.isNotEmpty(kwsRoles)) {
+            List<String> nameList = kwsRoles.stream().map(KwsRole::getName).toList();
+            if (nameList.contains(reqVo.getName())) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_024);
+            }
+        }
 
         /*1、存角色信息*/
         KwsRole kwsRole = new KwsRole();
@@ -94,7 +111,7 @@ public class KwsRoleService {
         idResVo.setId(roleId);
         kwsRole.setId(roleId);
         kwsRole.setName(reqVo.getName());
-        kwsRole.setDeptId(reqVo.getCurrentUnitId());
+        kwsRole.setDeptId(topDeptId);
         kwsRole.setRemark(reqVo.getRemark());
         if (kwsRoleDao.insert(kwsRole) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
@@ -103,7 +120,7 @@ public class KwsRoleService {
         /*2、绑定菜单功能*/
         RoleBindMenuReqVo roleBindMenuReqVo = new RoleBindMenuReqVo();
         roleBindMenuReqVo.setRoleId(roleId);
-        roleBindMenuReqVo.setEntId(reqVo.getCurrentUnitId());
+        roleBindMenuReqVo.setEntId(kwsDept.getEntId());
         roleBindMenuReqVo.setMenuIds(reqVo.getMenuIds());
         kwsMenuService.roleBindMenu(roleBindMenuReqVo);
 
@@ -167,13 +184,16 @@ public class KwsRoleService {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
+        List<KwsUser> kwsUsers = kwsUserDao.selectByRoleIds(idList);
+        if (CollectionUtils.isNotEmpty(kwsUsers)) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_011);
+        }
         deleteRole(kwsRoles);
     }
 
     /**
      * @param kwsRoles 角色实体类集合
-     * @return
-     * @desc: TODO
+     * @desc: 删角色
      * @author: czh
      * @date: 2023/6/28
      */
@@ -207,7 +227,7 @@ public class KwsRoleService {
         //让涉及到的用户重新登录获取菜单权限
         for (KwsUserRole kwsUserRole : kwsUserRoleList) {
             Long userId = kwsUserRole.getUserId();
-            RedissonUtils.deleteBactch(Global.REDIS_USER_LOGIN_PREFIX + userId + "*");
+            RedissonUtils.deleteBactch(Global.REDIS_USER_LOGIN_PREFIX + userId + Global.ASTERISK1);
         }
     }
 
@@ -245,14 +265,13 @@ public class KwsRoleService {
      * @return List
      */
     public PageResult findPage(Map<String, Object> params) throws SystemException {
-        Page<Object> objects = PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
-        List<KwsRole> list = kwsRoleDao.findPage(params);
-
-        if (CollectionUtils.isEmpty(list)) {
-            return PageHelperUtil.getPageResult(new PageInfo<>(list));
+        PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
+        params.put("entId", LoginUserHolder.getEntId());
+        List<RoleResVo> roleResVos = kwsRoleDao.findPage(params);
+        if (CollectionUtils.isEmpty(roleResVos)) {
+            return PageHelperUtil.getPageResult(new PageInfo<>(roleResVos));
         }
 
-        List<RoleResVo> roleResVos = BeanUtils.copyToList(list, RoleResVo.class);
         List<Long> roleIdList = roleResVos.stream().map(RoleResVo::getId).toList();
         List<KwsAuthority> kwsAuthorities = kwsAuthorityDao.selectByRoleIds(roleIdList);
         if (CollectionUtils.isNotEmpty(kwsAuthorities)) {
@@ -275,7 +294,7 @@ public class KwsRoleService {
                 }
             });
         }
-        return PageHelperUtil.getPageResult(new PageInfo<>(roleResVos), list, PageResult.getPageSize(params));
+        return PageHelperUtil.getPageResult(new PageInfo<>(roleResVos), roleResVos, PageResult.getPageSize(params));
     }
 
     /**

+ 15 - 14
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

@@ -6,6 +6,7 @@ import com.sckw.core.model.enums.ApprovalEnum;
 import com.sckw.core.model.enums.SystemTypeEnum;
 import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.system.api.model.dto.req.RegisterReqDto;
 import com.sckw.system.api.model.dto.req.UpdatePasswordReqDto;
@@ -14,8 +15,6 @@ import com.sckw.system.dao.*;
 import com.sckw.system.dubbo.RemoteSystemServiceImpl;
 import com.sckw.system.model.*;
 import com.sckw.system.model.vo.req.*;
-import com.sckw.system.model.vo.req.FindListReqVo;
-import com.sckw.system.model.vo.res.FindEntListResVo;
 import com.sckw.system.model.vo.res.KwsUserResVo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -61,6 +60,9 @@ public class KwsUserService {
     @Autowired
     private RemoteSystemServiceImpl remoteSystemService;
 
+    @Autowired
+    private CommonService commonService;
+
     /**
      * @param reqVo 入参
      * @desc: 新增
@@ -105,13 +107,7 @@ public class KwsUserService {
      */
     @Transactional(rollbackFor = {})
     public RegisterResDto register(RegisterReqDto reqDto) throws SystemException {
-        FindListReqVo findListReqVo = new FindListReqVo();
-        findListReqVo.setEntName(reqDto.getEntName());
-        List<FindEntListResVo> list = kwsEnterpriseDao.findList(findListReqVo);
-        if (!CollectionUtils.isEmpty(list)) {
-            throw new SystemException(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.ENT_EXISTS);
-        }
-
+        commonService.checkEntRepeat(reqDto.getEntName(), reqDto.getPhone());
         /*1、数据校验*/
         checkAccountValid(reqDto.getPhone(), reqDto.getSystemType());
 
@@ -125,7 +121,10 @@ public class KwsUserService {
         kwsUser.setPhone(reqDto.getPhone());
         kwsUser.setIsMain(reqDto.getIsMain());
         kwsUser.setId(userId);
-
+        if (Objects.isNull(LoginUserHolder.getUserId()) || LoginUserHolder.getUserId().compareTo(1L) == 0) {
+            kwsUser.setCreateBy(userId);
+            kwsUser.setUpdateBy(userId);
+        }
         //填充密码、入库
         fillPassword(kwsUser);
         if (kwsUserDao.insert(kwsUser) <= 0) {
@@ -175,8 +174,8 @@ public class KwsUserService {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MENU_NOT_EXISTS);
             }
             editRoleReqVo.setName(Global.MANAGE_NAME);
-            editRoleReqVo.setCurrentUnitId(entId);
-            editRoleReqVo.setMenuIds(String.join(",", kwsMenus.stream().map(KwsMenu::getId).map(String::valueOf).toList()));
+            editRoleReqVo.setCurrentUnitId(kwsDept.getId());
+            editRoleReqVo.setMenuIds(String.join(Global.COMMA, kwsMenus.stream().map(KwsMenu::getId).map(String::valueOf).toList()));
             editRoleReqVo.setVisiblePersonal(false);
             kwsRoleService.add(editRoleReqVo);
         }
@@ -186,7 +185,6 @@ public class KwsUserService {
 
     /**
      * @param userId 用户id,deptId 机构id
-     * @return
      * @desc: 填充用户机构
      * @author: czh
      * @date: 2023/7/11
@@ -249,6 +247,9 @@ public class KwsUserService {
 
         String[] idArray = ids.split(",");
         for (String id : idArray) {
+            if (id.equals(String.valueOf(LoginUserHolder.getUserId()))) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_025);
+            }
             KwsUser kwsUser = kwsUserDao.selectByKey(Long.parseLong(id));
             if (null != kwsUser) {
                 kwsUser.setDelFlag(Global.YES);
@@ -479,7 +480,7 @@ public class KwsUserService {
      * @date: 2023/6/16
      */
     public void checkAccountValid(String account, Integer systemType) {
-        if (!Objects.isNull(getUserByAccount(account, systemType))) {
+        if (Objects.nonNull(getUserByAccount(account, systemType))) {
             throw new SystemException(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.ACCOUNT_EXISTS);
         }
     }

+ 3 - 1
sckw-modules/sckw-system/src/main/resources/mapper/KwsDeptDao.xml

@@ -191,10 +191,12 @@
   <select id="findList" resultType="com.sckw.system.model.vo.res.KwsDeptResVo" parameterType="com.sckw.system.model.KwsDept" >
     select
     sd.id, sd.system_type systemType, sd.ent_id entId, sd.name, sd.company, sd.parent_id parentId, sd.level, sd.sort, sd.remark,
-    sd.status, sd.create_by createBy, sd.create_time createTime, sd.update_by updateBy, sd.update_time updateTime,
+    sd.status, u1.name createBy, sd.create_time createTime, u2.name updateBy, sd.update_time updateTime,
     sd2.name parentName
     from kws_dept sd
     left join kws_dept sd2 on sd.parent_id = sd2.id and sd2.del_flag=0
+    left join kws_user u1 on sd.create_by = u1.id
+    left join kws_user u2 on sd.update_by = u2.id
     where sd.del_flag = 0
     <if test="systemType != null and systemType != ''">
       and sd.system_type = #{systemType, jdbcType=VARCHAR}

+ 10 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsEntDeptDao.xml

@@ -34,6 +34,16 @@
     select * from kws_ent_dep where del_flag = 0 and ent_pid = #{entPid}
   </select>
 
+  <select id="selectByEntPidList" resultType="com.sckw.system.model.KwsEntDept">
+    select *
+    from kws_ent_dep
+    where del_flag = 0
+      and ent_pid in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+        #{item}
+    </foreach>
+  </select>
+
   <insert id="insert" parameterType="com.sckw.system.model.KwsEntDept">
     insert into kws_ent_dep
     <trim prefix="(" suffix=")" suffixOverrides=",">

+ 13 - 5
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -181,11 +181,15 @@
     select
     <include refid="Base_Column_List" />
     from kws_enterprise
-    where id in
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
-          #{item}
-        </foreach>
-      and del_flag = 0
+    where del_flag = 0
+    <if test="list != null and list.size() > 0">
+      and id in
+      <foreach collection="list" item="item" open="(" close=")" separator=",">
+        #{item}
+      </foreach>
+    </if>
+
+
 
   </select>
 
@@ -251,6 +255,10 @@
     select * from kws_enterprise where firm_name like concat('%', #{entName}, '%') and del_flag = 0
   </select>
 
+  <select id="checkEntRepeat" resultType="com.sckw.system.model.KwsEnterprise">
+    select * from kws_enterprise where (firm_name = #{entName} or phone = #{phone}) and del_flag = 0 and approval in (1,3,4)
+  </select>
+
   <insert id="insert" parameterType="com.sckw.system.model.KwsEnterprise">
     insert into kws_enterprise
     <trim prefix="(" suffix=")" suffixOverrides=",">

+ 18 - 3
sckw-modules/sckw-system/src/main/resources/mapper/KwsRoleDao.xml

@@ -128,26 +128,41 @@
     where id = #{id,jdbcType=BIGINT}
   </update>
 
-  <select id="findPage" resultMap="BaseResultMap" parameterType="java.util.Map" >
+  <select id="findPage" resultType="com.sckw.system.model.vo.res.RoleResVo" parameterType="java.util.Map" >
     select
-    <include refid="Base_Column_List" />
+    sr.id,
+    sr.name,
+    sr.dept_id,
+    sr.remark,
+    sr.status,
+    su.name createBy,
+    sr.create_time,
+    sr.update_by,
+    sr.update_time,
+    sr.del_flag
     from kws_role sr
+    left join kws_user su on sr.create_by = su.id
+    left join kws_dept d on sr.dept_id = d.id
     where sr.del_flag = 0
+      and su.del_flag = 0
     <if test="name != null and name != ''">
       and sr.name like concat('%', #{name, jdbcType=VARCHAR}, '%')
     </if>
     <if test="deptId != null and deptId != ''">
       and sr.deptId = #{deptId, jdbcType=VARCHAR}
     </if>
+    <if test="entId != null and entId != ''">
+      and d.ent_id = #{entId, jdbcType=VARCHAR}
+    </if>
     <if test="startTime != null and startTime != ''">
       and sr.create_time >= #{startTime,jdbcType=DATE}
     </if>
     <if test="endTime != null and endTime != ''" >
       and sr.create_time &lt;= #{endTime,jdbcType=DATE}
     </if>
-
     ORDER BY sr.create_time desc
   </select>
+
   <select id="queryRoleByUserId" resultType="com.sckw.system.model.KwsRole">
     select b.*
       from kws_user_role a

+ 24 - 20
sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml

@@ -209,16 +209,22 @@
   </update>
 
   <select id="findPage" resultType="com.sckw.system.model.vo.res.KwsUserResVo" parameterType="java.util.Map" >
-    select
+    select distinct
     su.id, su.system_type systemType, su.account, su.password, su.name,
     su.phone, su.photo, su.email, su.is_main isMain, su.remark, su.status, su.salt,
-    c.id deptId,c.name deptName,e.id roleId, e.name roleName
+    c.id deptId,c.name deptName,e.id roleId, e.name roleName,
+    su.create_time,
+    su2.`name` createByName,
+    su.update_time
     from kws_user su
     left join kws_user_dept b on su.id = b.user_id
     left join kws_dept c on b.dept_id = c.id
     left join kws_user_role d on su.id = d.user_id
     left join kws_role e on e.id = d.role_id
+    left join kws_user su2 on su.create_by = su2.id
     where su.del_flag = 0
+      and b.del_flag = 0
+      and d.del_flag = 0
     <if test="systemType != null and systemType != ''">
       and su.system_type = #{system_type, jdbcType=VARCHAR}
     </if>
@@ -235,30 +241,16 @@
       and su.email = #{email, jdbcType=VARCHAR}
     </if>
     <if test="deptId != null and deptId != ''">
-      and su.id in (
-        select
-          sud.user_id
-        from kws_user_dept sud
-        left join kws_dept sd on sud.dept_id = sd.id
-        where sd.del_flag = 0 and sud.del_flag = 0
-        and sd.id = #{deptId, jdbcType=VARCHAR}
-      )
+      and c.id = #{deptId, jdbcType=VARCHAR}
     </if>
       <if test="roleId != null and roleId != ''">
-        and su.id in (
-            select kr.user_id from kws_user_role kr where kr.id = #{roleId} and kr.del_flag = 0
-        )
+        and e.id = #{roleId}
       </if>
       <if test="keywords != null and keywords != ''">
-        and (su.name like concat('%', #{keywords}, '%') or su.account like concat('%', #{keywords}, '%') or su.create_by in (select id from kws_user where name like concat('%', #{keywords}, '%')))
+        and (su.name like concat('%', #{keywords}, '%') or su.account like concat('%', #{keywords}, '%') or su2.name like concat('%', #{keywords}, '%'))
       </if>
     <if test="entId != null and entId != ''">
-      and su.id in (
-        select
-          user_id
-        from kws_user_dept
-        where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR}
-      )
+      and c.ent_id = #{entId}
     </if>
     <if test="startTime != null and startTime != ''">
       and su.create_time >= #{startTime}
@@ -320,4 +312,16 @@
        and c.del_flag = 0
   </select>
 
+  <select id="selectByRoleIds" resultType="com.sckw.system.model.KwsUser">
+    select distinct a.*
+      from kws_user a
+      left join kws_user_role b on a.id = b.user_id
+     where a.del_flag = 0
+       and b.del_flag = 0
+      and b.role_id in
+     <foreach collection="roleIdList" item="item" open="(" close=")" separator=",">
+       #{item}
+     </foreach>
+  </select>
+
 </mapper>

+ 3 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsUserRoleDao.xml

@@ -29,9 +29,11 @@
   <select id="findAllByUserId" resultType="com.sckw.system.model.KwsUserRole">
     select * from kws_user_role where user_id = #{userId} and del_flag = 0 and status = 0
   </select>
+
   <select id="findAllByRoleId" resultType="com.sckw.system.model.KwsUserRole">
     select * from kws_user_role where role_id = #{roleId} and del_flag = 0 and status = 0
   </select>
+
   <select id="findAllByRoleIds" resultType="com.sckw.system.model.KwsUserRole">
     select *
       from kws_user_role
@@ -175,4 +177,5 @@
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
+
 </mapper>

+ 5 - 0
sckw-modules/sckw-transport/pom.xml

@@ -96,6 +96,11 @@
             <artifactId>sckw-order-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-fleet-api</artifactId>
+        </dependency>
+
         <!-- validation -->
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 34 - 15
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/AcceptCarriageOrderController.java

@@ -7,6 +7,7 @@ import com.sckw.transport.model.dto.DocumentParamDTO;
 import com.sckw.transport.model.dto.OrderDTO;
 import com.sckw.transport.model.dto.OrderTakingDTO;
 import com.sckw.transport.model.dto.SubcontractConsignmentDTO;
+import com.sckw.transport.model.param.DriverParam;
 import com.sckw.transport.model.param.LogisticsOrderParam;
 import com.sckw.transport.service.AcceptCarriageOrderService;
 import com.sckw.transport.service.TransportCommonService;
@@ -18,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * @author lfdc
  * @description 承运订单controller
@@ -112,21 +115,6 @@ public class AcceptCarriageOrderController {
         }
     }
 
-//    /**
-//     * 承运订单-提交派车
-//     *
-//     * @param sendCarDTO 请求参数
-//     * @return
-//     */
-//    @RequestMapping(value = "/commitSendCar", method = RequestMethod.POST)
-//    public HttpResult commitSendCar(@Validated @RequestBody SendCarDTO sendCarDTO) {
-//        try {
-//            return acceptCarriageOrderService.commitSendCar(sendCarDTO);
-//        } catch (Exception e) {
-//            log.error("派车 error:{}", e.getMessage(), e);
-//            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
-//        }
-//    }
 
     /**
      * 承运订单-获取运单详情
@@ -164,4 +152,35 @@ public class AcceptCarriageOrderController {
             return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
         }
     }
+
+    /**
+     * 承运订单-设置停止接单-查询
+     *
+     * @return
+     */
+    @RequestMapping(value = "/stopDocumentDetail", method = RequestMethod.POST)
+    public HttpResult stopDocumentDetail(@Validated @RequestBody DriverParam driverParam) {
+        try {
+            return acceptCarriageOrderService.stopDocumentDetail(driverParam);
+        } catch (Exception e) {
+            log.error("承运订单-设置停止接单-查询 error:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
+    /**
+     * 承运订单-设置停止接单-提交
+     *
+     * @param ids 车辆运单id
+     * @return
+     */
+    @RequestMapping(value = "/stopDocumentCommit", method = RequestMethod.POST)
+    public HttpResult stopDocumentCommit(@NotBlank(message = "车辆运单id不能为空") @RequestBody List<String> ids,@NotBlank(message = "物流订单id不能为空") String lOrderId) {
+        try {
+            return acceptCarriageOrderService.stopDocumentCommit(ids,lOrderId);
+        } catch (Exception e) {
+            log.error("承运订单-设置停止接单-提交 error:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
 }

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio