xucaiqin 2 kuukautta sitten
vanhempi
commit
10fae39dca
62 muutettua tiedostoa jossa 2721 lisäystä ja 2338 poistoa
  1. 5 1
      README.md
  2. 1 1
      pom.xml
  3. 0 2
      sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java
  4. 4 0
      sckw-auth/src/main/java/com/sckw/auth/model/vo/res/LoginResVo1.java
  5. 1 1
      sckw-auth/src/main/java/com/sckw/auth/service/IAuthService.java
  6. 33 33
      sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java
  7. 7 1
      sckw-common/sckw-common-core/pom.xml
  8. 0 75
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/ExcelUtils.java
  9. 6 16
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/RequestCheckFilter.java
  10. 56 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/handler/LongListTypeHandler.java
  11. 54 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/handler/StringListTypeHandler.java
  12. 238 83
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/constant/Global.java
  13. 6 4
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java
  14. 2 2
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/SystemTypeEnum.java
  15. 253 253
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java
  16. 91 31
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java
  17. 1 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/RequestConstant.java
  18. 56 13
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/context/LoginUserHolder.java
  19. 12 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/model/LoginUserInfo.java
  20. 3 1
      sckw-common/sckw-common-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  21. 4 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteUserService.java
  22. 3 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/KwsUserResDto.java
  23. 23 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/RoleInfoDto.java
  24. 2 2
      sckw-modules/pom.xml
  25. 2 2
      sckw-modules/sckw-file/src/main/resources/mapper/KwsFileInfoDao.xml
  26. 0 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpBizWalletController.java
  27. 35 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java
  28. 3 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsUserController.java
  29. 2 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEntCertificateDao.java
  30. 9 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java
  31. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsRoleDao.java
  32. 5 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserDao.java
  33. 9 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserRoleDao.java
  34. 12 12
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java
  35. 19 15
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java
  36. 41 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java
  37. 2 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEntType.java
  38. 10 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEnterprise.java
  39. 1 5
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsRole.java
  40. 4 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsUser.java
  41. 3 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/AddEntSettleReqVo.java
  42. 2 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/EditRoleReqVo.java
  43. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/FindMenuTreeReqVo.java
  44. 3 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/UserAddReqVo.java
  45. 27 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntBaseInfo.java
  46. 9 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntDetailResVo.java
  47. 1 13
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntFindPageResVo.java
  48. 25 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntInfo.java
  49. 6 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsUserResVo.java
  50. 5 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/RoleResVo.java
  51. 35 35
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/CommonService.java
  52. 150 238
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  53. 2 7
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsMenuService.java
  54. 33 60
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsRoleService.java
  55. 111 75
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java
  56. 3 1
      sckw-modules/sckw-system/src/main/resources/log4j2.xml
  57. 2 2
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEntCertificateDao.xml
  58. 880 879
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml
  59. 2 3
      sckw-modules/sckw-system/src/main/resources/mapper/KwsMenuDao.xml
  60. 83 84
      sckw-modules/sckw-system/src/main/resources/mapper/KwsRoleDao.xml
  61. 304 356
      sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml
  62. 18 3
      sckw-modules/sckw-system/src/main/resources/mapper/KwsUserRoleDao.xml

+ 5 - 1
README.md

@@ -161,4 +161,8 @@ java.base/java.lang.reflect=ALL-UNNAMED
 | price      | 价格               |
 | lat        | 维度               |
 | lng        | 经度               |
-| status     | 状态               |
+| status     | 状态               |
+
+
+# 测试数据
+17788889999 大米公司

+ 1 - 1
pom.xml

@@ -385,7 +385,7 @@
             <properties>
                 <profiles.active>dev</profiles.active>
                 <nacos.server>10.10.10.230:8848</nacos.server>
-                <nacos.namespace>sckw-ng-service-platform-dev</nacos.namespace>
+                <nacos.namespace>sckw-ng-service-platform</nacos.namespace>
             </properties>
         </profile>
         <!--测试环境-->

+ 0 - 2
sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java

@@ -33,7 +33,6 @@ public class AuthController {
     public HttpResult login(@Valid @RequestBody LoginReqVo reqVo, HttpServletRequest request) {
         int systemType = request.getIntHeader("System-Type");
         String clientType = request.getHeader("Client-Type");
-//        String accessSpecial = request.getHeader("Access-Special");
 
         reqVo.setSystemType(systemType);
         reqVo.setClientType(clientType);
@@ -44,7 +43,6 @@ public class AuthController {
         loginBase.setCaptcha(reqVo.getCaptcha());
         loginBase.setSystemType(systemType);
         loginBase.setClientType(clientType);
-//        loginBase.setAccessSpecial(accessSpecial);
         loginBase.setLoginMethod(LoginMethodEnum.ORDINARY.getValue());
         return authService.login(loginBase);
     }

+ 4 - 0
sckw-auth/src/main/java/com/sckw/auth/model/vo/res/LoginResVo1.java

@@ -3,8 +3,10 @@ package com.sckw.auth.model.vo.res;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.sckw.core.utils.LongToStringUtils;
 import com.sckw.system.api.model.dto.res.KwsRoleResDto;
+import com.sckw.system.api.model.dto.res.RoleInfoDto;
 import lombok.Data;
 
+import javax.management.relation.RoleInfo;
 import java.io.Serial;
 import java.io.Serializable;
 import java.util.Date;
@@ -126,4 +128,6 @@ public class LoginResVo1 implements Serializable {
      */
     private Long roleId;
 
+    private List<RoleInfoDto> roleList;
+
 }

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

@@ -26,7 +26,7 @@ public interface IAuthService {
      * @author: czh
      * @date: 2023/6/16
      */
-    void register(RegisterReqVo reqVo);
+//    void register(RegisterReqVo reqVo);
 
     /**
      * @param reqDto 忘记密码入参

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

@@ -1,5 +1,6 @@
 package com.sckw.auth.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
 import com.sckw.auth.model.vo.req.ForgetPasswordReqVo;
 import com.sckw.auth.model.vo.req.LoginBase;
@@ -83,20 +84,20 @@ public class AuthServiceImpl implements IAuthService {
         return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.GLOBAL_EXCEPTION_MESSAGE);
     }
 
-    @Override
-    @Transactional(rollbackFor = {})
-    public void register(RegisterReqVo reqVo) {
-        /*校验验证码*/
-        String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_REGISTER.getValue(), reqVo.getPhone());
-        String sms = RedissonUtils.getString(key);
-        if (!reqVo.getCaptcha().equals(sms)) {
-            throw new SystemException(HttpStatus.CODE_10301, HttpStatus.CAPTCHA_ERROR);
-        }
-        RegisterReqDto registerReqDto = new RegisterReqDto();
-        BeanUtils.copyProperties(reqVo, registerReqDto);
-        remoteUserService.register(registerReqDto);
-        RedissonUtils.delete(key);
-    }
+//    @Override
+//    @Transactional(rollbackFor = {})
+//    public void register(RegisterReqVo reqVo) {
+//        /*校验验证码*/
+//        String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_REGISTER.getValue(), reqVo.getPhone());
+//        String sms = RedissonUtils.getString(key);
+//        if (!reqVo.getCaptcha().equals(sms)) {
+//            throw new SystemException(HttpStatus.CODE_10301, HttpStatus.CAPTCHA_ERROR);
+//        }
+//        RegisterReqDto registerReqDto = new RegisterReqDto();
+//        BeanUtils.copyProperties(reqVo, registerReqDto);
+//        remoteUserService.register(registerReqDto);
+//        RedissonUtils.delete(key);
+//    }
 
     @Override
     public void forgetPassword(ForgetPasswordReqVo reqDto) {
@@ -197,12 +198,6 @@ public class AuthServiceImpl implements IAuthService {
             if (enterprise == null) {
                 return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号没有归属企业,请检查并重新输入!");
             }
-
-            //校验平台标识码(专场)
-//            HttpResult result = checkSpecial(loginBase, enterprise);
-//            if (result.getCode() != HttpStatus.SUCCESS_CODE) {
-//                return result;
-//            }
         }
         if (enterprise != null && enterprise.getStatus() == Global.YES) {
             return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "企业已冻结,如需帮助,请致电平台客服!");
@@ -219,6 +214,7 @@ public class AuthServiceImpl implements IAuthService {
         AsyncFactory.execute(new AsyncProcess(loginBase, user, null, enterprise, remoteUserService));
 
         /*数据组装**/
+
         LoginResVo1 loginRes = new LoginResVo1();
         loginRes.setId(user.getId());
         loginRes.setName(user.getName());
@@ -227,7 +223,6 @@ public class AuthServiceImpl implements IAuthService {
         loginRes.setPhoto(user.getPhoto());
         loginRes.setIsMain(user.getIsMain());
         loginRes.setStatus(user.getStatus());
-        loginRes.setRoleName(user.getRoleName());
         loginRes.setDeptName(user.getDeptName());
         loginRes.setClientId(user.getClientId());
         loginRes.setEntId(user.getEntId());
@@ -240,6 +235,8 @@ public class AuthServiceImpl implements IAuthService {
         loginRes.setToken(token);
         loginRes.setDeptId(user.getDeptId());
         loginRes.setRoleId(user.getRoleId());
+        loginRes.setRoleName(user.getRoleName());
+        loginRes.setRoleList(user.getRoleInfoDto());
         if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
             loginRes.setValid(true);
         } else {
@@ -297,7 +294,7 @@ public class AuthServiceImpl implements IAuthService {
     }
 
     /**
-     * @param loginBase 登录参数
+     * @param loginBase  登录参数
      * @param enterprise 企业信息
      * @return 返回校验结果
      * @desc 专场标识码校验
@@ -325,7 +322,7 @@ public class AuthServiceImpl implements IAuthService {
         boolean bool = false;
         SpecialResVo currentSpecialRes = null;
         SpecialResVo mainSpecialRes = null;
-        for (SpecialResVo specialResVo:specialResVos) {
+        for (SpecialResVo specialResVo : specialResVos) {
             bool = specialResVo.getCode().equals(accessSpecial) || bool;
             currentSpecialRes = specialResVo.getCode().equals(accessSpecial) ? specialResVo : currentSpecialRes;
             mainSpecialRes = specialResVo.getIsMain() == NumberConstant.ONE ? specialResVo : mainSpecialRes;
@@ -345,9 +342,9 @@ public class AuthServiceImpl implements IAuthService {
         }
 
         //校验企业非专场时,Hearder中标识码是否为主平台标识码
-        if (StringUtils.isBlank(special) ) {
+        if (StringUtils.isBlank(special)) {
             if (currentSpecialRes != null && currentSpecialRes.getIsMain() != NumberConstant.ONE) {
-                String msg = "请进入"+ mainSpecialRes.getName() +",平台网站为"+ mainSpecialRes.getWebsite() +",如有疑问请联系平台系统管理员确认!";
+                String msg = "请进入" + mainSpecialRes.getName() + ",平台网站为" + mainSpecialRes.getWebsite() + ",如有疑问请联系平台系统管理员确认!";
                 return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, msg);
             }
         } else {
@@ -421,16 +418,14 @@ public class AuthServiceImpl implements IAuthService {
         String account = loginBase.getAccount();
         String clientType = loginBase.getClientType();
         Integer systemType = loginBase.getSystemType();
-        String special = loginBase.getAccessSpecial();
         Long timestamp = System.currentTimeMillis();
         Map<String, Object> info = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         info.put("userId", userId);
         info.put("account", account);
         info.put("clientType", clientType);
         info.put("systemType", systemType);
-        info.put("special", special);
         //info.put("timestamp", timestamp);
-        String key = Global.getFullUserTokenKey(clientType, !systemType.equals(SystemTypeEnum.MANAGE.getCode()) ? special : null, userId);
+        String key = Global.getFullUserTokenKey(clientType, userId);
         String token = EncryUtil.encryV1(Global.PRI_KEY, JSON.toJSONString(info));
         int expireTime = ClientTypeEnum.expireTime(loginBase.getClientType());
         RedissonUtils.putString(key, token, expireTime);
@@ -449,7 +444,7 @@ public class AuthServiceImpl implements IAuthService {
         private final RemoteUserService remoteUserService;
 
         public AsyncProcess(LoginBase loginBase, KwsUserResDto user, RDriverDetailVo driver, EntCacheResDto enterprise,
-                             RemoteUserService remoteUserService) {
+                            RemoteUserService remoteUserService) {
             this.loginBase = loginBase;
             this.user = user;
             this.driver = driver;
@@ -505,7 +500,6 @@ public class AuthServiceImpl implements IAuthService {
             loginUserInfo.setEntId(enterprise != null ? enterprise.getId() : null);
             loginUserInfo.setEntName(enterprise != null ? enterprise.getFirmName() : null);
             loginUserInfo.setClientType(loginBase.getClientType());
-            int expireTime = ClientTypeEnum.expireTime(loginBase.getClientType());
             String key = Global.getFullUserLoginKey(loginUserInfo.getSystemType(), loginUserInfo.getId());
             RedissonUtils.putString(key, JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
         }
@@ -545,10 +539,9 @@ public class AuthServiceImpl implements IAuthService {
             }
             //客户经理  存储相关联企业id
             customerManager(loginUserInfo, user, loginBase);
-            int expireTime = ClientTypeEnum.expireTime(loginBase.getClientType());
+            saveEntList(loginUserInfo, user, loginBase);
             String key = Global.getFullUserLoginKey(loginUserInfo.getSystemType(), loginUserInfo.getId());
             RedissonUtils.putString(key, JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
-
             //存缓存请求地址
             saveMenusToCache(user);
         }
@@ -581,7 +574,7 @@ public class AuthServiceImpl implements IAuthService {
                     enterpriseIds = enterpriseIds.stream().distinct().collect(Collectors.toList());
                     String key = Global.getCustomerManagerUserLoginKey(loginUserInfo.getSystemType(), loginUserInfo.getId());
                     RSet<Object> set = RedissonUtils.getSet(key);
-                    if (CollectionUtils.isNotEmpty(set)){
+                    if (CollectionUtils.isNotEmpty(set)) {
                         RedissonUtils.delete(key);
                     }
                     RedissonUtils.putSet(key, enterpriseIds);
@@ -590,6 +583,13 @@ public class AuthServiceImpl implements IAuthService {
             }
         }
 
+        private void saveEntList(LoginUserInfo loginUserInfo, KwsUserResDto user, LoginBase loginBase) {
+            List<Long> childEntList = remoteUserService.findChildEntList(loginUserInfo.getEntId());
+            if (CollUtil.isNotEmpty(childEntList)) {
+                loginUserInfo.setChildEntList(childEntList);
+            }
+        }
+
         /**
          * @param loginResVo 登录返参
          * @desc: 存缓存请求地址

+ 7 - 1
sckw-common/sckw-common-core/pom.xml

@@ -188,5 +188,11 @@
             <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
 
         </dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+            <version>3.5.19</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
-</project>
+</project>

+ 0 - 75
sckw-common/sckw-common-core/src/main/java/com/sckw/core/ExcelUtils.java

@@ -1,75 +0,0 @@
-package com.sckw.core;
-
-
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.alibaba.excel.write.metadata.style.WriteCellStyle;
-import com.alibaba.excel.write.metadata.style.WriteFont;
-import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
-import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
-import jakarta.servlet.http.HttpServletResponse;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Author: donglang
- * Time: 2025-11-05
- * Des: 表格工具类
- * Version: 1.0
- */
-
-public class ExcelUtils {
-
-
-    /**
-     * 下载Excel模板
-     * @param fileName 文件名
-     * @param clazz 模板对应的实体类
-     * @param response HttpServletResponse对象
-     * @param <T> 实体类泛型
-     * @throws Exception 异常
-     */
-    public static <T> void exportTemplate(HttpServletResponse response, String fileName, Class<T> clazz, List<T> dataList) throws Exception {
-        // 设置响应内容类型
-        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
-        response.setCharacterEncoding("utf-8");
-
-        // 设置文件名
-        String name = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
-        response.setHeader("Content-Disposition", "attachment;filename=" + name + ".xlsx");
-        // 解决跨域问题
-        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
-
-
-        // 创建表头样式
-        WriteCellStyle headStyle  = new WriteCellStyle();
-        // 设置表头居中对齐
-        headStyle .setHorizontalAlignment(HorizontalAlignment.CENTER);
-
-        // 设置表头字体
-        WriteFont headFont  = new WriteFont();
-        headFont .setFontHeightInPoints((short) 12);
-        headFont .setBold(true);
-        headStyle .setWriteFont(headFont);
-
-        // 创建内容样式
-        WriteCellStyle contentStyle = new WriteCellStyle();
-        // 设置内容居中对齐
-        contentStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
-
-
-        // 初始化表格样式策略
-        HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headStyle, contentStyle);
-
-        // 使用EasyExcel导出
-        EasyExcel.write(response.getOutputStream(), clazz)
-                .excelType(ExcelTypeEnum.XLSX)
-                .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
-                .registerWriteHandler(horizontalCellStyleStrategy)
-                .sheet("模板")
-                .doWrite(new ArrayList<>()); // 写入空列表,只生成表头
-    }
-}

+ 6 - 16
sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/RequestCheckFilter.java

@@ -87,7 +87,7 @@ public class RequestCheckFilter implements Filter {
         String token = request.getHeader(RequestConstant.TOKEN);
         String clientType = request.getHeader(RequestConstant.CLIENT_TYPE);
         Integer systemType = request.getIntHeader(RequestConstant.SYSTEM_TYPE);
-        String accessSpecial = request.getHeader(RequestConstant.ACCESS_SPECIAL);
+//        String accessSpecial = request.getHeader(RequestConstant.ACCESS_SPECIAL);
         String requestUri = request.getRequestURI();
         /*1、非token校验接口放行*/
         if (EXCLUDEPATH.contains(requestUri)) {
@@ -97,7 +97,7 @@ public class RequestCheckFilter implements Filter {
 
         /*2、校验token**/
         /*2.1、校验token非空*/
-        HttpResult result = checkBlank(token, clientType, systemType, accessSpecial, requestUri);
+        HttpResult result = checkBlank(token, clientType, systemType, requestUri);
         if (result.getCode() != HttpStatus.SUCCESS_CODE) {
             ResponseUtil.writer(response, result);
             return;
@@ -112,7 +112,7 @@ public class RequestCheckFilter implements Filter {
 
         /*2.3、从redis获取用户登录token*/
         Long userId = StringUtils.isNotBlank(tokenMap.get("userId")) ? NumberUtils.parseLong(tokenMap.get("userId")) : null;
-        String key = Global.getFullUserTokenKey(clientType, accessSpecial, userId);
+        String key = Global.getFullUserTokenKey(clientType, userId);
         String redisUserToken = RedissonUtils.getString(key);
         if (StringUtils.isBlank(redisUserToken)) {
             ResponseUtil.writer(response, HttpResult.error(HttpStatus.TOKEN_INVALID_CODE, HttpStatus.TOKEN_INVALID_MESSAGE));
@@ -156,7 +156,7 @@ public class RequestCheckFilter implements Filter {
             }
             LoginUserHolder.set(loginUserInfo);
             LoginEntHolder.set(loginEntInfo);
-            RedissonUtils.putString(Global.getFullUserTokenKey(clientType, accessSpecial, userId), token, ClientTypeEnum.expireTime(clientType));
+            RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
             RedissonUtils.putString(Global.getFullUserLoginKey(systemType, loginUserInfo.getId()), JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
             RedissonUtils.putString(Global.getFullUserEntKey(loginEntInfo.getId()), JSON.toJSONString(loginEntInfo), Global.APP_TOKEN_EXPIRE);
             filterChain.doFilter(servletRequest, servletResponse);
@@ -203,7 +203,7 @@ public class RequestCheckFilter implements Filter {
         LoginEntHolder.set(loginEntInfo);
         RedissonUtils.putString(Global.getFullUserLoginKey(systemType, loginUserInfo.getId()), JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
         RedissonUtils.putString(Global.getFullUserEntKey(loginEntInfo.getId()), JSON.toJSONString(loginEntInfo), Global.APP_TOKEN_EXPIRE);
-        RedissonUtils.putString(Global.getFullUserTokenKey(clientType, accessSpecial, userId), token, ClientTypeEnum.expireTime(clientType));
+        RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
         filterChain.doFilter(servletRequest, servletResponse);
         LoginUserHolder.remove();
         LoginEntHolder.remove();
@@ -233,7 +233,7 @@ public class RequestCheckFilter implements Filter {
      * @author zk
      * @date 2023/12/14
      **/
-    private HttpResult checkBlank(String token, String clientType, Integer systemType, String accessSpecial, String requestUri) {
+    private HttpResult checkBlank(String token, String clientType, Integer systemType, String requestUri) {
         if (StringUtils.isBlank(token)) {
             return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.UN_LOGIN_MESSAGE);
         }
@@ -243,17 +243,7 @@ public class RequestCheckFilter implements Filter {
         if (StringUtils.isBlank(systemType)) {
             return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.INVALID_REQUEST);
         }
-        if (!IMPORT_PASS_PATH.contains(requestUri)) {
-            if (StringUtils.isBlank(accessSpecial) && !Objects.equals(systemType, SystemTypeEnum.MANAGE.getCode())) {
-                return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.INVALID_REQUEST);
-            }
-        }
-        accessSpecial = !Objects.equals(systemType, SystemTypeEnum.MANAGE.getCode()) ? accessSpecial : null;
         return HttpResult.ok();
     }
 
-    public static void main(String[] args) {
-        Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, "afc3fc350d5c17e52beba3bcd631eaca9f5f440509f72b182880a429b1b9b22b53154436ec72865566320514f3a6e39389c2ed412180c90b07f6ff66c12a5e139ed05793cf37d580ae9a2a166ddd79d6b7cd10e209d78c6eee9381d878df29f7");
-        System.out.println(tokenMap);
-    }
 }

+ 56 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/handler/LongListTypeHandler.java

@@ -0,0 +1,56 @@
+package com.sckw.core.handler;
+
+import cn.hutool.core.collection.CollectionUtil;
+import org.apache.ibatis.type.BaseTypeHandler;
+import org.apache.ibatis.type.JdbcType;
+import org.apache.ibatis.type.MappedJdbcTypes;
+import org.apache.ibatis.type.MappedTypes;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author xucaiqin
+ * @date 2025-11-09 14:57:43
+ */
+@MappedJdbcTypes(JdbcType.VARCHAR)
+@MappedTypes(List.class)
+public class LongListTypeHandler extends BaseTypeHandler<List<Long>> {
+    @Override
+    public void setNonNullParameter(PreparedStatement ps, int i, List<Long> parameter, JdbcType jdbcType)
+            throws SQLException {
+        ps.setString(i, parameter.stream().map(String::valueOf).collect(Collectors.joining(",")));
+    }
+
+    @Override
+    public List<Long> getNullableResult(ResultSet rs, String columnName) throws SQLException {
+        return parse(rs.getString(columnName));
+    }
+
+    @Override
+    public List<Long> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
+        return parse(rs.getString(columnIndex));
+    }
+
+    @Override
+    public List<Long> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
+        return parse(cs.getString(columnIndex));
+    }
+
+    private List<Long> parse(String val) {
+        if (val == null || val.isEmpty()) {
+            return new ArrayList<>();
+        }
+        return Arrays.stream(val.split(","))
+                .map(String::trim)
+                .map(Long::valueOf)
+                .collect(Collectors.toList());
+    }
+}

+ 54 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/handler/StringListTypeHandler.java

@@ -0,0 +1,54 @@
+package com.sckw.core.handler;
+
+import org.apache.ibatis.type.BaseTypeHandler;
+import org.apache.ibatis.type.JdbcType;
+import org.apache.ibatis.type.MappedJdbcTypes;
+import org.apache.ibatis.type.MappedTypes;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author xucaiqin
+ * @date 2025-11-09 14:57:43
+ */
+@MappedJdbcTypes(JdbcType.VARCHAR)
+@MappedTypes(List.class)
+public class StringListTypeHandler extends BaseTypeHandler<List<String>> {
+    @Override
+    public void setNonNullParameter(PreparedStatement ps, int i, List<String> parameter, JdbcType jdbcType)
+            throws SQLException {
+        ps.setString(i, parameter.stream().map(String::valueOf).collect(Collectors.joining(",")));
+    }
+
+    @Override
+    public List<String> getNullableResult(ResultSet rs, String columnName) throws SQLException {
+        return parse(rs.getString(columnName));
+    }
+
+    @Override
+    public List<String> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
+        return parse(rs.getString(columnIndex));
+    }
+
+    @Override
+    public List<String> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
+        return parse(cs.getString(columnIndex));
+    }
+
+    private List<String> parse(String val) {
+        if (val == null || val.isEmpty()) {
+            return new ArrayList<>();
+        }
+        return Arrays.stream(val.split(","))
+                .map(String::trim)
+                .map(String::valueOf)
+                .collect(Collectors.toList());
+    }
+}

+ 238 - 83
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/constant/Global.java

@@ -3,6 +3,8 @@ package com.sckw.core.model.constant;
 import com.sckw.core.common.enums.StringConstant;
 import com.sckw.core.utils.StringUtils;
 
+import java.util.Objects;
+
 /**
  * All rights Reserved, Designed By www.51wph.com
  *
@@ -17,10 +19,14 @@ import com.sckw.core.utils.StringUtils;
  */
 public class Global {
 
-    /**pc-background token有效期为2小时*/
+    /**
+     * pc-background token有效期为2小时
+     */
     public static final int PC_BACKGROUND_TOKEN_EXPIRE = 60 * 60 * 2;
 
-    /**app token有效期为30天*/
+    /**
+     * app token有效期为30天
+     */
     public static final int APP_TOKEN_EXPIRE = 30 * 24 * 60 * 60;
 
     /**pc token有效期为2小时*/
@@ -29,41 +35,59 @@ public class Global {
     /**通用有效期为2小时*/
     public static final int COMMON_EXPIRE = 2 * 60 * 60;
 
-    /**API调用token有效时间*/
+    /**
+     * API调用token有效时间
+     */
     public static final int API_EXPIRE = 120 * 60;
 
     /**保存全局属性值*/
 //    private static Map<String, String> map = Maps.newHashMap();
 
-    /**显示/隐藏*/
+    /**
+     * 显示/隐藏
+     */
     public static final int SHOW = 1;
     public static final int HIDE = 0;
     public static final int MINUS_ONE = -1;
-    /**正常/删除*/
+    /**
+     * 正常/删除
+     */
     public static final int DELETED = 1;
     public static final int UN_DELETED = 0;
-    /**是/否*/
+    /**
+     * 是/否
+     */
     public static final int YES = 1;
     public static final int NO = 0;
     public static final String BE = "是";
     public static final String NAY = "否";
 
-    /**对/错*/
+    /**
+     * 对/错
+     */
     public static final boolean TRUE = true;
     public static final boolean FALSE = false;
 
-    /**字符*/
+    /**
+     * 字符
+     */
     public static final String CODING_GBK = "GBK";
     public static final String CODING_UTF8 = "UTF-8";
 
-    /**消息强弱提醒 强提醒:Y,否则:N*/
+    /**
+     * 消息强弱提醒 强提醒:Y,否则:N
+     */
     public static final String Y = "Y";
     public static final String N = "N";
 
-    /**初始金额*/
+    /**
+     * 初始金额
+     */
     public static final Double AMOUNT = 0.0;
 
-    /**初始数值*/
+    /**
+     * 初始数值
+     */
     public static final int NUMERICAL_ZERO = 0;
     public static final int NUMERICAL_ONE = 1;
     public static final int NUMERICAL_TWO = 2;
@@ -73,245 +97,376 @@ public class Global {
     public static final int NUMERICAL_TWELVE = 12;
     public static final int NUMERICAL_SIXTEEN = 16;
 
-    /**pid等于0的*/
+    /**
+     * pid等于0的
+     */
     public static final String PID = "0";
 
-    /**or*/
+    /**
+     * or
+     */
     public static final String OR = "OR";
 
-    /**and*/
+    /**
+     * and
+     */
     public static final String AND = "AND";
 
-    /**ok*/
+    /**
+     * ok
+     */
     public static final String OK = "OK";
 
-    /**忘记密码获取验证码*/
+    /**
+     * 忘记密码获取验证码
+     */
     public static final String FORGET_SMS = "forget:";
 
-    /**忘记密码获取验证码*/
+    /**
+     * 忘记密码获取验证码
+     */
     public static final String REPEAT_SUBMIT = "repeatSubmit:";
 
-    /**用户登录验证码*/
+    /**
+     * 用户登录验证码
+     */
     public static final String USER_LOGIN_CAPTCHA = "userLoginCaptcha:";
 
-    /**redis用户信息前缀*/
+    /**
+     * redis用户信息前缀
+     */
     public static final String REDIS_USER_LOGIN_PREFIX = "userLoginInfo:";
     public static final String REDIS_USER_PREFIX = "userInfo:";
     public static final String REDIS_USER_TOKEN_PREFIX = "userToken:";
     //客户经理redisKey
     public static final String REDIS_CUSTOMER_MANAGER_USER_LOGIN_PREFIX = "customerManagerUserLoginInfo:";
 
-    /**redis企业信息前缀*/
+    /**
+     * redis企业信息前缀
+     */
     public static final String REDIS_ENTERPRISE_PREFIX = "enterpriseInfo:";
 
-    /**redis区域信息前缀*/
+    /**
+     * redis区域信息前缀
+     */
     public static final String REDIS_AREA_PREFIX = "areaInfo:";
 
-    /**redis区域信息前缀*/
+    /**
+     * redis区域信息前缀
+     */
     public static final String REDIS_GROUP_AREA_PREFIX = "areaInfo:group:";
 
-    /**redis用户菜单信息前缀*/
+    /**
+     * redis用户菜单信息前缀
+     */
     public static final String REDIS_SYS_MENU_PREFIX = "sysMenu:";
 
-    /**redis字典信息前缀*/
+    /**
+     * redis字典信息前缀
+     */
     public static final String REDIS_SYS_DICT_TYPE_PREFIX = "dictInfo:type:";
     public static final String REDIS_SYS_DICT_PREFIX = "dictInfo:dict:";
     public static final String REDIS_SYS_DICT_GROUP_PREFIX = "dictInfo:group:";
 
-    /**redis用户车辆gps信息*/
+    /**
+     * redis用户车辆gps信息
+     */
     public static final String REDIS_CACHE_GPS_CAR_PREFIX = "cacheGpsCar:";
 
-    /**redis运营活动奖品前缀*/
+    /**
+     * redis运营活动奖品前缀
+     */
     public static final String REDIS_ACTIVITY_PRIZE_PREFIX = "activityPrize:";
 
-    /**redis用户运营活动抽奖信息前缀*/
+    /**
+     * redis用户运营活动抽奖信息前缀
+     */
     public static final String ACTIVITY_JOIN = "activityJoin:";
 
-    /**redis用户运营活动信息前缀*/
+    /**
+     * redis用户运营活动信息前缀
+     */
     public static final String ACTIVITY = "activity:";
 
-    /**汇链用户专场编号*/
+    /**
+     * 汇链用户专场编号
+     */
     public static final String PHONE = "400-030-5677";
 
-    /**系统初始密码*/
+    /**
+     * 系统初始密码
+     */
     public static final String PASSWORD = "123456";
 
-    /**逗号-英文*/
+    /**
+     * 逗号-英文
+     */
     public static final String COMMA = ",";
 
-    /**逗号-中文*/
+    /**
+     * 逗号-中文
+     */
     public static final String COMMA1 = ",";
     /**
      * 右斜杠
      */
     public static final String RIGHT_SLASH = "/";
 
-    /**点*/
+    /**
+     * 点
+     */
     public static final String DOT = ".";
 
-    /**冒号*/
+    /**
+     * 冒号
+     */
     public static final String COLON = ":";
 
-    /**下划线拼接*/
+    /**
+     * 下划线拼接
+     */
     public static final char UNDERLINE = '_';
 
-    /**空字符串*/
+    /**
+     * 空字符串
+     */
     public static final String EMPTY_STRING = "";
 
-    /**等号**/
+    /**
+     * 等号
+     **/
     public static final String EQUAL_SIGN = "=";
 
-    /**美元符号**/
+    /**
+     * 美元符号
+     **/
     public static final String DOLLAR = "$";
 
-    /**+符号**/
+    /**
+     * +符号
+     **/
     public static final String PLUS = "+";
 
-    /**-符号*/
+    /**
+     * -符号
+     */
     public static final String MINUS_SIGN = "-";
 
-    /**#符号**/
+    /**
+     * #符号
+     **/
     public static final String POUND = "#";
 
-    /**下划线拼接*/
+    /**
+     * 下划线拼接
+     */
     public static final String BRACKET = "()";
     public static final String BRACKET_LEFT = "(";
     public static final String BRACKET_RIGHT = ")";
 
-    /**大括号*/
+    /**
+     * 大括号
+     */
     public static final String BIG_BRACKETS = "{}";
     public static final String BIG_BRACKETS_LEFT = "{";
     public static final String BIG_BRACKETS_RIGHT = "}";
 
-    /**星号拼接*/
+    /**
+     * 星号拼接
+     */
     public static final String ASTERISK1 = "*";
     public static final String ASTERISK2 = "**";
 
-    /**括号*/
+    /**
+     * 括号
+     */
     public static final String BRACKETS = "[]";
     public static final String BRACKETS_LEFT = "[";
     public static final String BRACKETS_RIGHT = "]";
 
-    /**排序*/
+    /**
+     * 排序
+     */
     public static final String ASC = "asc";
     public static final String DESC = "desc";
 
-    /**请求成功值*/
+    /**
+     * 请求成功值
+     */
     public static final int SUCCEED = 200;
 
-    /**短信请求返回参数名*/
+    /**
+     * 短信请求返回参数名
+     */
     public static final String SUCCESS = "success";
 
-    /**pageNum当前页数/pageSize每页显示条数*/
+    /**
+     * pageNum当前页数/pageSize每页显示条数
+     */
     public static final String PAGE_NUM = "pageNum";
     public static final String PAGE_SIZE = "pageSize";
 
-    /**可调用EncryUtil.generatorPriKey()方法生成*/
+    /**
+     * 可调用EncryUtil.generatorPriKey()方法生成
+     */
     public static final String PRI_KEY = "127f0400ff8a8b7a20d91dfc60a39725";
 
-    /**APP*/
+    /**
+     * APP
+     */
     public static final String APP = "APP";
 
-    /**API*/
+    /**
+     * API
+     */
     public static final String API = "API";
 
-    /**API初始版本号*/
+    /**
+     * API初始版本号
+     */
     public static final String API_VERSION = "1.0.0";
 
-    /**请求头token*/
+    /**
+     * 请求头token
+     */
     public static final String ACCESS_TOKEN = "Access-Token";
 
-    /**客户终端类型*/
+    /**
+     * 客户终端类型
+     */
     public static final String CLIENT_TYPE = "Client-Type";
 
-    /**系统类型*/
+    /**
+     * 系统类型
+     */
     public static final String SYSTEM_TYPE = "System-Type";
 
-    /**请求代理*/
+    /**
+     * 请求代理
+     */
     public static final String USER_AGENT = "user-agent";
 
-    /**请求格式*/
+    /**
+     * 请求格式
+     */
     public static final String CONTENT_TYPE_AJ = "application/json";
 
-    /**请求方法*/
+    /**
+     * 请求方法
+     */
     public static final String METHOD_POST = "POST";
     public static final String METHOD_GET = "GET";
 
-    /**错误图片*/
+    /**
+     * 错误图片
+     */
     public static final String WRONG_USER_HEAD = "data:,";
 
-    /**运输订单号前缀*/
+    /**
+     * 运输订单号前缀
+     */
     public static final String TRAN_NUM_PREFIX = "LTO";
 
-    /**委托单单号前缀*/
+    /**
+     * 委托单单号前缀
+     */
     public static final String ENTR_NUM_PREFIX = "LD";
 
-    /**车辆运单单号前缀*/
+    /**
+     * 车辆运单单号前缀
+     */
     public static final String TASK_NUM_PREFIX = "LTL";
 
-    /**装货地点*/
+    /**
+     * 装货地点
+     */
     public static final Integer ADDRESS_LOAD = 1;
 
-    /**卸货地点*/
+    /**
+     * 卸货地点
+     */
     public static final Integer ADDRESS_UNLOAD = 2;
 
-    /**时间周期-天/周/月/年*/
+    /**
+     * 时间周期-天/周/月/年
+     */
     public static final String CYCLE_DAY = "天";
     public static final String CYCLE_WEEK = "周";
     public static final String CYCLE_MONTH = "月";
     public static final String CYCLE_YEAR = "年";
 
-    /**重量单位*/
+    /**
+     * 重量单位
+     */
     public static final String UNIT_TON = "吨";
     public static final String UNIT_KG = "千克";
 
-    /**未读*/
+    /**
+     * 未读
+     */
     public static final Integer UN_READ = 0;
-    /**管理员角色名*/
+    /**
+     * 管理员角色名
+     */
     public static final String MANAGE_NAME = "系统管理员";
 
-    /**管理员机构名*/
+    /**
+     * 管理员机构名
+     */
     public static final String MANAGE_DEPT_NAME = "系统管理员部门";
 
-    /**已读*/
+    /**
+     * 已读
+     */
     public static final Integer READ = 1;
 
 
-    /**完整的用户登录信息key*/
+    /**
+     * 完整的用户登录信息key
+     */
     public static String getFullUserLoginKey(Integer systemType, Long userId, String clientType) {
         return REDIS_USER_LOGIN_PREFIX + systemType + COLON + userId + COLON + clientType;
     }
 
-    /**完整的用户登录信息key*/
+    /**
+     * 完整的用户登录信息key
+     */
     public static String getFullUserLoginKey(Integer systemType, Long userId) {
         return REDIS_USER_LOGIN_PREFIX + systemType + COLON + userId;
     }
 
-    /**完整的用户登录tokenkey*/
-    public static String getFullUserTokenKey(String clientType, String accessSpecial, Long userId) {
-        String builder = REDIS_USER_TOKEN_PREFIX +
-                (StringUtils.isNotNull(clientType) ? clientType + COLON: null) +
-                (StringUtils.isNotNull(accessSpecial) ? accessSpecial + COLON: null) +
-                (StringUtils.isNotNull(userId) ? userId : null);
+    /**
+     * 完整的用户登录tokenkey
+     */
+    public static String getFullUserTokenKey(String clientType, Long userId) {
+        String builder = REDIS_USER_TOKEN_PREFIX + (StringUtils.isNotNull(clientType) ? clientType + COLON : "") + (Objects.nonNull(userId) ? userId : "");
         return builder;
     }
 
-    /**完整的用户企业信息key*/
+    /**
+     * 完整的用户企业信息key
+     */
     public static String getFullUserEntKey(Long entId) {
         return REDIS_ENTERPRISE_PREFIX + entId;
     }
 
-    /**完整的用户菜单信息key*/
+    /**
+     * 完整的用户菜单信息key
+     */
     public static String getFullUserMenuKey(Integer systemType, Long userId) {
         return REDIS_SYS_MENU_PREFIX + systemType + COLON + userId;
     }
 
-    /**完整的忘记密码获取验证码key*/
+    /**
+     * 完整的忘记密码获取验证码key
+     */
     public static String getForgetKey(Integer systemType, String account) {
         return FORGET_SMS + systemType + COLON + account;
     }
 
-    /**完整的校验重复请求key*/
+    /**
+     * 完整的校验重复请求key
+     */
     public static String getRepeatSubmitKey(Long userId, String url) {
         return REPEAT_SUBMIT + userId + COLON + url;
     }

+ 6 - 4
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/EntTypeEnum.java

@@ -19,6 +19,8 @@ public enum EntTypeEnum {
     SUPPLIER(1, "供应商"),
     //采购商
     PURCHASER(2, "采购商"),
+    LOGISTIC(3, "物流属性"),
+
     //4PL物流  托运 承运
     LOGISTICS3(3, "4PL物流"),
     //3PL物流  承运
@@ -28,7 +30,7 @@ public enum EntTypeEnum {
 
     private final String name;
 
-    EntTypeEnum(int code, String name){
+    EntTypeEnum(int code, String name) {
         this.code = code;
         this.name = name;
     }
@@ -44,8 +46,8 @@ public enum EntTypeEnum {
 
     public static String getNames(String entTypes) {
         List entNames = new ArrayList();
-        EntTypeEnum [] entTypeEnums = EntTypeEnum.values();
-        for (EntTypeEnum entTypeEnum:entTypeEnums) {
+        EntTypeEnum[] entTypeEnums = EntTypeEnum.values();
+        for (EntTypeEnum entTypeEnum : entTypeEnums) {
             if (entTypes.contains(String.valueOf(entTypeEnum.getCode()))) {
                 entNames.add(entTypeEnum.getName());
             }
@@ -92,4 +94,4 @@ public enum EntTypeEnum {
     }
 
 
-}
+}

+ 2 - 2
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/SystemTypeEnum.java

@@ -10,9 +10,9 @@ import lombok.Getter;
 @Getter
 public enum SystemTypeEnum {
     //运营端
-    MANAGE(1, "运营端"),
+    MANAGE(1, "运营端"), //平台运营端
     //企业开户
-    COMPANY(2, "企业端"),
+    COMPANY(2, "企业端"),//管理端
     //司机
     DRIVER(3, "司机端");
 

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

@@ -108,263 +108,263 @@ public class PasswordUtils {
     }
 
     //SELECT CONCAT(id, ',', phone, ',', password, ';,') str from sckw_fleet.kwf_driver ;
-    public static void checkDriver(){
-        String str = "162528614993104896,13868885042,fa4d73f8a688b56bc1810a55d6ddfc32fc7b9a01fad3d9750b5b1521;,\n" +
-                "162528642843283456,18372742349,f9553b1bfa6d9a93a17980bc839541f55c58c52d0c28fb03c5975ac9;,\n" +
-                "162528661445021696,13682474577,f55d95489b74c0f1f0b695f37567e7497e701f223071808a19c9261c;,\n" +
-                "162528680059342848,13445521643,1687d32e8effd59b03ea7b5c443815c19ffd71f4a6cc5fd88ac35585;,\n" +
-                "162528705808175104,18900110011,abbdc7ffa788707ddb73cd71087ecf8bb6171a10a7f7d3d7ed66eff2;,\n" +
-                "162528792894509056,18726962456,e8d913a0d5a50e67d0c77da4c602cfefb830c1ca4dc00cc7feae7a9e;,\n" +
-                "162532384737071104,13723972320,47bdadd33eaf853fecc7e4bd75804b85ade5a203250ed4a5bc464c25;,\n" +
-                "162532402399285248,15791782346,bbecc4516cf0b5572354e4eaca9a615cf724ea9991163adc23319df7;,\n" +
-                "162532423651823616,17533106183,f64fbd7cf95d04e3f7dd9bf70c7d0fbf9c03188cf1022a83388ac464;,\n" +
-                "162532442350030848,16665388156,bb3faf4ace4b37d39939ccca1ed655714870798016788db084c04b0a;,\n" +
-                "162532462239420416,13322117405,94e3ab6d453aea3a4daaf01d18f899b8b7813ddf46419e8ee6004fa0;,\n" +
-                "162532478853058560,15884485779,cf87a95124d50cec64383da7bee1416c2bffff725f67f14937963618;,\n" +
-                "162532496150368256,13606526627,f4de5eecf7d05d0162f509d3398984c416516f1865314c0b4147bd7e;,\n" +
-                "162532512227135488,13152075814,b730ef2e6c132d52aaad78f08ec5f490a8c5c654f2c53ad69f739bc6;,\n" +
-                "162879320946118656,13778787324,0c53e079d76015688a80f5275cd84b0c869b2bbc5f31f3bf42e28b42;,\n" +
-                "162885056979800064,13556563372,2a334bd23460376ab205f72bea8db42939d8885ea6487e0655039303;,\n" +
-                "162894153947025408,16680445687,456a93edc6181221901578faf50e59af6f9322e6453ade1706c5287d;,\n" +
-                "162899666269114368,15884485773,b5dd5489ea9c62bde7c4b96f89dccc08613a6dcdd9a5041f6bad9d33;,\n" +
-                "162899741896609792,13447413233,d121c7e7be962f9e385dacfb89cb8a6d34b109e02313ecc0eb0be93a;,\n" +
-                "163454586206556160,18583328871,4c2d3b238396180e3c4ae5a353e8579ff860eb3feb2178b8c157d886;,\n" +
-                "163965635959721984,18583328873,c900ba7b6a0a5270d51a612d6b3b3d7c1182035a31e16db6fcd509b4;,\n" +
-                "166974007806005248,19500000099,5dcaf43a00b3ed7c1c51fd32bce313d60d06d561dca033aa75cdd06b;,\n" +
-                "166979180402053120,19500000069,b84a34ecab63b787809e1df9d87e4d2fc9363b79f1608203331a65c7;,\n" +
-                "166979180473356288,19500000070,a9a997a9f97d04da8bccd6f2fd63c2e46933c4f484e60e5ee0e53287;,\n" +
-                "166979180548853760,19500000071,4c1721423a226e2d339a8ca817a173e75ebfbf7feda3c5482bd2545a;,\n" +
-                "166979180620156928,19500000072,8c8ee4d0c16bb9cc2574b99b34295cd215fa19166270ac77036774ad;,\n" +
-                "166979180695654400,19500000073,89e971ddb05ddf753d0b4c8dc8f8ae467fdc48ba7616befb9eee43b3;,\n" +
-                "166979180762763264,19500000074,c8c035a374d62d7ec760db261fa7348519d111161cc5de923d90e54a;,\n" +
-                "166979180838260736,19500000075,381073889a0e6d16cbb958fe6db49d8b56f71b9ae79640776ec46aaa;,\n" +
-                "166979180896980992,19500000076,ce83efb5b22d3ebf999baf08077ad0e30597824baf70533e1149954a;,\n" +
-                "166979180989255680,19500000077,3020906e4e9c0a2fac6fc9b299326ef97e307d2e6df53a4dcd0330e7;,\n" +
-                "166979181056364544,19500000078,9a7d43c3c506d6be42b68ccaee512bcebfa6ad9bde5840bc84bc59db;,\n" +
-                "166979181110890496,19500000079,bc618cba847d2c023930c41707d0409470f81b78ae0236873462e3a8;,\n" +
-                "166979181169610752,19500000080,19dc91f8b87ee075b9df6eb589176e59dae7ceb6623770a85b54038e;,\n" +
-                "166979181236719616,19500000081,abd3d8506775b5fb0dd3e3595d9e31bf250fa23d82b7a6b289c7ba61;,\n" +
-                "166979181295439872,19500000082,e5fb3886bfa37342b4f3792e183c6cf5a276601ea2fe11fdee89af1a;,\n" +
-                "166979181404491776,19500000083,6dbc2a8c788d1e6bea6a8cfa2585eb4d907d92f153f3d94697b64109;,\n" +
-                "166979181475794944,19500000084,5029b1475afa8ce6d7c1a60b80475d9b5dee180c70de1c74029a7726;,\n" +
-                "166979181538709504,19500000085,215f5d15fd7951f0351e570150467ebf8ca89639491f61745c22cc7d;,\n" +
-                "166979181589041152,19500000086,9f4b4456afabb0f147361fb9631104ac1ab955396a59f2fab89f5015;,\n" +
-                "166979181643567104,19500000087,5c007ab468137c636097a72efa0dbb731db44bef5ff87425dc23d5d8;,\n" +
-                "166979181698093056,19500000088,94c9d496b91681870c36a6c69e0e595f7cd2caa7608f45342a0b1a4f;,\n" +
-                "166979181752619008,19500000089,3f37860a1435c494ebe9e2e9e3c8ae3ace669a36058cac2ef4c126f0;,\n" +
-                "166979181807144960,19500000090,7e507b6a549f8e7de9759b91cf13784d3f9192eedc57543194eb1bc6;,\n" +
-                "166979182029443072,19500000091,8012fc3b3310d763b2e431b2cb728842b189fa2694a36c39b34803ad;,\n" +
-                "166979182092357632,19500000092,57a41f35b66543f6b2744d7ab8bb4d6874dc786ad53830a3080b9c2d;,\n" +
-                "166979182184632320,19500000093,289285ea9961fa8262f2700885c26e9487b8ae3b89ba6ea72a63a130;,\n" +
-                "166979182243352576,19500000094,1f4226de4d2df148e9dd5a17bf67c433ce8d7f5cec43465bae96e9c2;,\n" +
-                "166979182293684224,19500000095,0490dc000e6dd21530bffcce3f2e02f4de6406e65eccb0b9157c4d8d;,\n" +
-                "166979182352404480,19500000096,97d7d20af5a9c6becc697a0d667b6275ca21cdfc3de6f290c513b160;,\n" +
-                "166979182406930432,19500000097,017ffd866343fb28f3e315b72b6e13d098a6168f2de22379f5993949;,\n" +
-                "166979182465650688,19500000098,51ad2c225b6940f98d62e0945f7479db3b464e0266d0877e0e21cfb7;,\n" +
-                "167213991624445952,19500000055,b47056210b158ca57b35907206bda7afaf1d4b6eb70922563feb3b34;,\n" +
-                "167213991754469376,19500000056,4cf5663948054ab50f0b4eb8d66e82c9b14777e06a48b4ac56f342ef;,\n" +
-                "167213991813189632,19500000057,6a364842ed98d03fc78ae61111794171791e7c2017de54d67c374297;,\n" +
-                "167213991909658624,19500000058,81c6cdefd625468af303339db329190ad46996fe0ff6686de6c86e7a;,\n" +
-                "167213991964184576,19500000059,21a0f70bf87e6a3c8d6e4e49b84d1a7819957207682933654056b72c;,\n" +
-                "167213992027099136,19500000060,88404bed55005f80e1a61d22969a2effe7955606fe7289d64b3ade5f;,\n" +
-                "167213992090013696,19500000061,c674846dcd0d3bacc69e488d8ba477af75a76f533932c0a3e95491b6;,\n" +
-                "167213992144539648,19500000062,66b84316146a56c56f8b5706a4601278f235490c8fc2e6fd1dc27cc7;,\n" +
-                "167213992207454208,19500000063,e28acaa45401be9162305d3b1e83fb372b8f0da139ffc054585c920c;,\n" +
-                "167213992274563072,19500000064,86a679de0ab614cc0afdc3d22688ff832f05c6fbc1057d4630d2b52c;,\n" +
-                "167213992329089024,19500000065,61bb806f0a125f0fc3e21ee73db9e53caa7dd51e3d63064eb1966e34;,\n" +
-                "167213992400392192,19500000066,07fc1f3f7354d9335d8c0937a4839c16a7a672ec11787131979bfc62;,\n" +
-                "167213992459112448,19500000067,b8e9a1aa729fa4ab9aa771d1a844b1e06cf023adec4185ab17f7b79e;,\n" +
-                "167213992551387136,19500000068,68b1afac745118d6a67bbea775acc5e1756856cd450897f9097706f1;,\n" +
-                "170549931663167488,17358629955,8364df818959f2c4a27607bced79945e09973a32121d96bd5c4710a9;,\n" +
-                "172375269049372672,18581845668,3f57140083d2558bdfcb8a319b52b3c86f992af5dde4b21007ea5733;,\n" +
-                "172442643224072192,19500000001,3e742de4560ce2ed6658119124f26b097a5c0d19b577b95c6aaca509;,\n" +
-                "172442643400232960,19500000002,3d6020290d2d8f05e34884e1cff29e99be8a299c4dc4af4008f7d39f;,\n" +
-                "172442643479924736,19500000003,077fe8b72511e26077e2c7bcc2bc9ad98e905dd10dfaf4b50c1d72fb;,\n" +
-                "173041758513401856,19988888888,7080f75c426af4a958092ea7d40fc3c8d4c7ddb4fa9d847153788368;,\n" +
-                "173043956366446592,15902849627,be354600d28ea42df3df93aeb6cb08a33674effe54f46e5394bf491c;,\n" +
-                "177401688267689984,15515950395,0bdbc09d1c08e53286dfe3d2dcd3c014341055d65744331d81a1e3b8;,\n" +
-                "184341399146074112,19600000090,aebcacc7e710a97fa381aaf8426de9826d6a0985f555ccf4669d4960;,\n" +
-                "184341699865088000,19600000091,af779edd56faf31dd9a92c24e82a834045a3126cc0b09b52d3409827;,\n" +
-                "184342227026186240,19600000092,bedd46ac733d0b64fe599541b463b16ac3cf68a79cfb6e04ee31e962;,\n" +
-                "185002976673271808,15515955555,d5ce819e1cf9988686cb8665368ead4a08841f0a90e40ecf9eb683d6;,\n" +
-                "185003553801113600,18283808586,50e1e1389468deb93322ea3c091878b2586dc486fe917cf9097ab3c4;,\n" +
-                "192321823566729216,16612341231,d13779d353a8c3db5656bb395a27303b4aefda8ec135a4f8265e0616;,\n" +
-                "192321823675781120,16612341232,eaf94160cb3ccdebe9bbe98df17751fbcf3d1e7f07d71a1b19b2626e;,\n" +
-                "192321823822581760,16612341233,739b5b9fa279879a5a5e17917960164cd2a573721fe7ffdb188852d1;,\n" +
-                "192321823906467840,16612341234,175b2cba6cd4d713a6ab08b1c32f8e76c87027a6812469689540da5c;,\n" +
-                "192321823981965312,16612341235,5d745fda9bf8d5f86863d658751ef8a7c86cbc8184733cbfa1e8dc4f;,\n" +
-                "192321824061657088,16612341236,b25748c67ab38eabf06c9d6f2c2c3f867ecac3c1a26cf4332d68d42a;,\n" +
-                "192321824149737472,16612341237,d142b7439d2e75e7d2c5b9aac2255b4de80bf71374b2181b7b50f9aa;,\n" +
-                "192321824246206464,16612341238,2f06cc01f3185ae6237d82f310c0d7952c67b2395660f7be3d9b1ac6;,\n" +
-                "192321824317509632,16612341239,2d8d693e43d2460fae648f361bfd66d0ee2735af3bced6b2b9b1bd5d;,\n" +
-                "192321824397201408,16612341240,95791a4a26edb107cb0f3f7801136e07f7075b8be8d0be2da88549eb";
-        String [] strArray = str.split(";,");
-
-        for (int i=0; i<strArray.length; i++) {
-            String str1 = strArray[i];
-            if (StringUtils.isBlank(str1.trim())) {
-                continue;
-            }
-            String [] strArray1 = str1.split(",");
-            String id = strArray1[0];
-            String account = strArray1[1];
-            String password = strArray1[2];
-            System.out.print("-- " + account + "==>");
-
-            String md5 = PasswordUtils.md5(account);
-            boolean bool = PasswordUtils.validatePassword(md5, password);
-
-            if (!bool) {
-                md5 = PasswordUtils.md5("123456");
-                bool = PasswordUtils.validatePassword(md5, password);
-                if (bool) {
-                    System.out.println(bool);
-                    String salt = PasswordUtils.generateSalt();
-                    md5 = PasswordUtils.md5("123456");
-                    password = PasswordUtils.entryptPassword(account + md5, salt);
-                    String sql = "UPDATE sckw_fleet.kwf_driver set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
-                    System.out.println(sql);
-                } else {
-                    System.out.println(bool);
-                    String salt = PasswordUtils.generateSalt();
-                    md5 = PasswordUtils.md5(account);
-                    password = PasswordUtils.entryptPassword(account + md5, salt);
-                    String sql = "UPDATE sckw_fleet.kwf_driver set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
-                    System.out.println(sql);
-                }
-            } else {
-                System.out.println(bool);
-                String salt = PasswordUtils.generateSalt();
-                md5 = PasswordUtils.md5(account);
-                password = PasswordUtils.entryptPassword(account + md5, salt);
-                String sql = "UPDATE sckw_fleet.kwf_driver set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
-                System.out.println(sql);
-            }
-        }
-    }
+//    public static void checkDriver(){
+//        String str = "162528614993104896,13868885042,fa4d73f8a688b56bc1810a55d6ddfc32fc7b9a01fad3d9750b5b1521;,\n" +
+//                "162528642843283456,18372742349,f9553b1bfa6d9a93a17980bc839541f55c58c52d0c28fb03c5975ac9;,\n" +
+//                "162528661445021696,13682474577,f55d95489b74c0f1f0b695f37567e7497e701f223071808a19c9261c;,\n" +
+//                "162528680059342848,13445521643,1687d32e8effd59b03ea7b5c443815c19ffd71f4a6cc5fd88ac35585;,\n" +
+//                "162528705808175104,18900110011,abbdc7ffa788707ddb73cd71087ecf8bb6171a10a7f7d3d7ed66eff2;,\n" +
+//                "162528792894509056,18726962456,e8d913a0d5a50e67d0c77da4c602cfefb830c1ca4dc00cc7feae7a9e;,\n" +
+//                "162532384737071104,13723972320,47bdadd33eaf853fecc7e4bd75804b85ade5a203250ed4a5bc464c25;,\n" +
+//                "162532402399285248,15791782346,bbecc4516cf0b5572354e4eaca9a615cf724ea9991163adc23319df7;,\n" +
+//                "162532423651823616,17533106183,f64fbd7cf95d04e3f7dd9bf70c7d0fbf9c03188cf1022a83388ac464;,\n" +
+//                "162532442350030848,16665388156,bb3faf4ace4b37d39939ccca1ed655714870798016788db084c04b0a;,\n" +
+//                "162532462239420416,13322117405,94e3ab6d453aea3a4daaf01d18f899b8b7813ddf46419e8ee6004fa0;,\n" +
+//                "162532478853058560,15884485779,cf87a95124d50cec64383da7bee1416c2bffff725f67f14937963618;,\n" +
+//                "162532496150368256,13606526627,f4de5eecf7d05d0162f509d3398984c416516f1865314c0b4147bd7e;,\n" +
+//                "162532512227135488,13152075814,b730ef2e6c132d52aaad78f08ec5f490a8c5c654f2c53ad69f739bc6;,\n" +
+//                "162879320946118656,13778787324,0c53e079d76015688a80f5275cd84b0c869b2bbc5f31f3bf42e28b42;,\n" +
+//                "162885056979800064,13556563372,2a334bd23460376ab205f72bea8db42939d8885ea6487e0655039303;,\n" +
+//                "162894153947025408,16680445687,456a93edc6181221901578faf50e59af6f9322e6453ade1706c5287d;,\n" +
+//                "162899666269114368,15884485773,b5dd5489ea9c62bde7c4b96f89dccc08613a6dcdd9a5041f6bad9d33;,\n" +
+//                "162899741896609792,13447413233,d121c7e7be962f9e385dacfb89cb8a6d34b109e02313ecc0eb0be93a;,\n" +
+//                "163454586206556160,18583328871,4c2d3b238396180e3c4ae5a353e8579ff860eb3feb2178b8c157d886;,\n" +
+//                "163965635959721984,18583328873,c900ba7b6a0a5270d51a612d6b3b3d7c1182035a31e16db6fcd509b4;,\n" +
+//                "166974007806005248,19500000099,5dcaf43a00b3ed7c1c51fd32bce313d60d06d561dca033aa75cdd06b;,\n" +
+//                "166979180402053120,19500000069,b84a34ecab63b787809e1df9d87e4d2fc9363b79f1608203331a65c7;,\n" +
+//                "166979180473356288,19500000070,a9a997a9f97d04da8bccd6f2fd63c2e46933c4f484e60e5ee0e53287;,\n" +
+//                "166979180548853760,19500000071,4c1721423a226e2d339a8ca817a173e75ebfbf7feda3c5482bd2545a;,\n" +
+//                "166979180620156928,19500000072,8c8ee4d0c16bb9cc2574b99b34295cd215fa19166270ac77036774ad;,\n" +
+//                "166979180695654400,19500000073,89e971ddb05ddf753d0b4c8dc8f8ae467fdc48ba7616befb9eee43b3;,\n" +
+//                "166979180762763264,19500000074,c8c035a374d62d7ec760db261fa7348519d111161cc5de923d90e54a;,\n" +
+//                "166979180838260736,19500000075,381073889a0e6d16cbb958fe6db49d8b56f71b9ae79640776ec46aaa;,\n" +
+//                "166979180896980992,19500000076,ce83efb5b22d3ebf999baf08077ad0e30597824baf70533e1149954a;,\n" +
+//                "166979180989255680,19500000077,3020906e4e9c0a2fac6fc9b299326ef97e307d2e6df53a4dcd0330e7;,\n" +
+//                "166979181056364544,19500000078,9a7d43c3c506d6be42b68ccaee512bcebfa6ad9bde5840bc84bc59db;,\n" +
+//                "166979181110890496,19500000079,bc618cba847d2c023930c41707d0409470f81b78ae0236873462e3a8;,\n" +
+//                "166979181169610752,19500000080,19dc91f8b87ee075b9df6eb589176e59dae7ceb6623770a85b54038e;,\n" +
+//                "166979181236719616,19500000081,abd3d8506775b5fb0dd3e3595d9e31bf250fa23d82b7a6b289c7ba61;,\n" +
+//                "166979181295439872,19500000082,e5fb3886bfa37342b4f3792e183c6cf5a276601ea2fe11fdee89af1a;,\n" +
+//                "166979181404491776,19500000083,6dbc2a8c788d1e6bea6a8cfa2585eb4d907d92f153f3d94697b64109;,\n" +
+//                "166979181475794944,19500000084,5029b1475afa8ce6d7c1a60b80475d9b5dee180c70de1c74029a7726;,\n" +
+//                "166979181538709504,19500000085,215f5d15fd7951f0351e570150467ebf8ca89639491f61745c22cc7d;,\n" +
+//                "166979181589041152,19500000086,9f4b4456afabb0f147361fb9631104ac1ab955396a59f2fab89f5015;,\n" +
+//                "166979181643567104,19500000087,5c007ab468137c636097a72efa0dbb731db44bef5ff87425dc23d5d8;,\n" +
+//                "166979181698093056,19500000088,94c9d496b91681870c36a6c69e0e595f7cd2caa7608f45342a0b1a4f;,\n" +
+//                "166979181752619008,19500000089,3f37860a1435c494ebe9e2e9e3c8ae3ace669a36058cac2ef4c126f0;,\n" +
+//                "166979181807144960,19500000090,7e507b6a549f8e7de9759b91cf13784d3f9192eedc57543194eb1bc6;,\n" +
+//                "166979182029443072,19500000091,8012fc3b3310d763b2e431b2cb728842b189fa2694a36c39b34803ad;,\n" +
+//                "166979182092357632,19500000092,57a41f35b66543f6b2744d7ab8bb4d6874dc786ad53830a3080b9c2d;,\n" +
+//                "166979182184632320,19500000093,289285ea9961fa8262f2700885c26e9487b8ae3b89ba6ea72a63a130;,\n" +
+//                "166979182243352576,19500000094,1f4226de4d2df148e9dd5a17bf67c433ce8d7f5cec43465bae96e9c2;,\n" +
+//                "166979182293684224,19500000095,0490dc000e6dd21530bffcce3f2e02f4de6406e65eccb0b9157c4d8d;,\n" +
+//                "166979182352404480,19500000096,97d7d20af5a9c6becc697a0d667b6275ca21cdfc3de6f290c513b160;,\n" +
+//                "166979182406930432,19500000097,017ffd866343fb28f3e315b72b6e13d098a6168f2de22379f5993949;,\n" +
+//                "166979182465650688,19500000098,51ad2c225b6940f98d62e0945f7479db3b464e0266d0877e0e21cfb7;,\n" +
+//                "167213991624445952,19500000055,b47056210b158ca57b35907206bda7afaf1d4b6eb70922563feb3b34;,\n" +
+//                "167213991754469376,19500000056,4cf5663948054ab50f0b4eb8d66e82c9b14777e06a48b4ac56f342ef;,\n" +
+//                "167213991813189632,19500000057,6a364842ed98d03fc78ae61111794171791e7c2017de54d67c374297;,\n" +
+//                "167213991909658624,19500000058,81c6cdefd625468af303339db329190ad46996fe0ff6686de6c86e7a;,\n" +
+//                "167213991964184576,19500000059,21a0f70bf87e6a3c8d6e4e49b84d1a7819957207682933654056b72c;,\n" +
+//                "167213992027099136,19500000060,88404bed55005f80e1a61d22969a2effe7955606fe7289d64b3ade5f;,\n" +
+//                "167213992090013696,19500000061,c674846dcd0d3bacc69e488d8ba477af75a76f533932c0a3e95491b6;,\n" +
+//                "167213992144539648,19500000062,66b84316146a56c56f8b5706a4601278f235490c8fc2e6fd1dc27cc7;,\n" +
+//                "167213992207454208,19500000063,e28acaa45401be9162305d3b1e83fb372b8f0da139ffc054585c920c;,\n" +
+//                "167213992274563072,19500000064,86a679de0ab614cc0afdc3d22688ff832f05c6fbc1057d4630d2b52c;,\n" +
+//                "167213992329089024,19500000065,61bb806f0a125f0fc3e21ee73db9e53caa7dd51e3d63064eb1966e34;,\n" +
+//                "167213992400392192,19500000066,07fc1f3f7354d9335d8c0937a4839c16a7a672ec11787131979bfc62;,\n" +
+//                "167213992459112448,19500000067,b8e9a1aa729fa4ab9aa771d1a844b1e06cf023adec4185ab17f7b79e;,\n" +
+//                "167213992551387136,19500000068,68b1afac745118d6a67bbea775acc5e1756856cd450897f9097706f1;,\n" +
+//                "170549931663167488,17358629955,8364df818959f2c4a27607bced79945e09973a32121d96bd5c4710a9;,\n" +
+//                "172375269049372672,18581845668,3f57140083d2558bdfcb8a319b52b3c86f992af5dde4b21007ea5733;,\n" +
+//                "172442643224072192,19500000001,3e742de4560ce2ed6658119124f26b097a5c0d19b577b95c6aaca509;,\n" +
+//                "172442643400232960,19500000002,3d6020290d2d8f05e34884e1cff29e99be8a299c4dc4af4008f7d39f;,\n" +
+//                "172442643479924736,19500000003,077fe8b72511e26077e2c7bcc2bc9ad98e905dd10dfaf4b50c1d72fb;,\n" +
+//                "173041758513401856,19988888888,7080f75c426af4a958092ea7d40fc3c8d4c7ddb4fa9d847153788368;,\n" +
+//                "173043956366446592,15902849627,be354600d28ea42df3df93aeb6cb08a33674effe54f46e5394bf491c;,\n" +
+//                "177401688267689984,15515950395,0bdbc09d1c08e53286dfe3d2dcd3c014341055d65744331d81a1e3b8;,\n" +
+//                "184341399146074112,19600000090,aebcacc7e710a97fa381aaf8426de9826d6a0985f555ccf4669d4960;,\n" +
+//                "184341699865088000,19600000091,af779edd56faf31dd9a92c24e82a834045a3126cc0b09b52d3409827;,\n" +
+//                "184342227026186240,19600000092,bedd46ac733d0b64fe599541b463b16ac3cf68a79cfb6e04ee31e962;,\n" +
+//                "185002976673271808,15515955555,d5ce819e1cf9988686cb8665368ead4a08841f0a90e40ecf9eb683d6;,\n" +
+//                "185003553801113600,18283808586,50e1e1389468deb93322ea3c091878b2586dc486fe917cf9097ab3c4;,\n" +
+//                "192321823566729216,16612341231,d13779d353a8c3db5656bb395a27303b4aefda8ec135a4f8265e0616;,\n" +
+//                "192321823675781120,16612341232,eaf94160cb3ccdebe9bbe98df17751fbcf3d1e7f07d71a1b19b2626e;,\n" +
+//                "192321823822581760,16612341233,739b5b9fa279879a5a5e17917960164cd2a573721fe7ffdb188852d1;,\n" +
+//                "192321823906467840,16612341234,175b2cba6cd4d713a6ab08b1c32f8e76c87027a6812469689540da5c;,\n" +
+//                "192321823981965312,16612341235,5d745fda9bf8d5f86863d658751ef8a7c86cbc8184733cbfa1e8dc4f;,\n" +
+//                "192321824061657088,16612341236,b25748c67ab38eabf06c9d6f2c2c3f867ecac3c1a26cf4332d68d42a;,\n" +
+//                "192321824149737472,16612341237,d142b7439d2e75e7d2c5b9aac2255b4de80bf71374b2181b7b50f9aa;,\n" +
+//                "192321824246206464,16612341238,2f06cc01f3185ae6237d82f310c0d7952c67b2395660f7be3d9b1ac6;,\n" +
+//                "192321824317509632,16612341239,2d8d693e43d2460fae648f361bfd66d0ee2735af3bced6b2b9b1bd5d;,\n" +
+//                "192321824397201408,16612341240,95791a4a26edb107cb0f3f7801136e07f7075b8be8d0be2da88549eb";
+//        String [] strArray = str.split(";,");
+//
+//        for (int i=0; i<strArray.length; i++) {
+//            String str1 = strArray[i];
+//            if (StringUtils.isBlank(str1.trim())) {
+//                continue;
+//            }
+//            String [] strArray1 = str1.split(",");
+//            String id = strArray1[0];
+//            String account = strArray1[1];
+//            String password = strArray1[2];
+//            System.out.print("-- " + account + "==>");
+//
+//            String md5 = PasswordUtils.md5(account);
+//            boolean bool = PasswordUtils.validatePassword(md5, password);
+//
+//            if (!bool) {
+//                md5 = PasswordUtils.md5("123456");
+//                bool = PasswordUtils.validatePassword(md5, password);
+//                if (bool) {
+//                    System.out.println(bool);
+//                    String salt = PasswordUtils.generateSalt();
+//                    md5 = PasswordUtils.md5("123456");
+//                    password = PasswordUtils.entryptPassword(account + md5, salt);
+//                    String sql = "UPDATE sckw_fleet.kwf_driver set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
+//                    System.out.println(sql);
+//                } else {
+//                    System.out.println(bool);
+//                    String salt = PasswordUtils.generateSalt();
+//                    md5 = PasswordUtils.md5(account);
+//                    password = PasswordUtils.entryptPassword(account + md5, salt);
+//                    String sql = "UPDATE sckw_fleet.kwf_driver set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
+//                    System.out.println(sql);
+//                }
+//            } else {
+//                System.out.println(bool);
+//                String salt = PasswordUtils.generateSalt();
+//                md5 = PasswordUtils.md5(account);
+//                password = PasswordUtils.entryptPassword(account + md5, salt);
+//                String sql = "UPDATE sckw_fleet.kwf_driver set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
+//                System.out.println(sql);
+//            }
+//        }
+//    }
 
     //SELECT CONCAT(id, ',', account, ',', password, ';,')  str from sckw_system.kws_user ;
-    public static void checkUser(){
-        String str = "156382319433748480,18000000000,be8d1ae3fac3067ee98068cce2895ad305febbe31a644fe42954de0c;,\n" +
-                "156383116720607232,admin,04323ed6811d048e0406ec39293394aabcf9b132a0cb1b87dc78279f;,\n" +
-                "162301006506364928,182838089858,cf2f6d38f0b8a150d90d9194b97875c004413880cf7aba8abf3b3dc7;,\n" +
-                "162604062133456896,13000000000,cf2f6d38f0b8a150d90d9194b97875c004413880cf7aba8abf3b3dc7;,\n" +
-                "163980531141185536,18283808586,debc2bab5eaf7b629049666051ad504bc60bea9eeab95932f64054a9;,\n" +
-                "163987895701475328,15902849627,ecc16d89238b2cd77637b41096e322a3f89c345ac10297a5fc7b61e3;,\n" +
-                "163994695842664448,18283808587,0a842bee1f75c4939d408eae02f575fad005cec391b7cc1eec6f5882;,\n" +
-                "163995870587523072,18283808581,1b7383f4d6e458fb610bcc7a80cc959ed13c83a30063401b82fa1245;,\n" +
-                "163995977299005440,18283808582,cebab3009b34e77708385c2af5595de5e739aadf435542d22d1b66ec;,\n" +
-                "163996113957818368,18827222222,3182b6bba4c90445e2d16a8901653866a707d9a1a2dc499f8af37546;,\n" +
-                "163996259454029824,18827766520,4b32a9a0b4dabe5b920a78d5115febf3b87d45ceebe5715d11b53dad;,\n" +
-                "163996369839722496,17722337872,c676f2924969a10ce4f059b1894bded8061a01d0252f3a789ce8b9ad;,\n" +
-                "163998264054517760,13911111111,65ffa259c8ba2660438f28a09851182b615dc16b7188006d67d2d661;,\n" +
-                "164072870236917760,18591918877,9ca66c47aad850e4b22b7df5acbe58a33b3a1be4fa70315e9eff8bf2;,\n" +
-                "164357889975128064,18283808584,1fd478d1d3f61d341c6cc1065b9e02833e314102be2528fbf292ed87;,\n" +
-                "164480042405990400,18283765365,ce181135763e284d6748012dbe53bcac767ea60d0306b0f04e1b3ffd;,\n" +
-                "164697036837359616,18583328873,cf2f6d38f0b8a150d90d9194b97875c004413880cf7aba8abf3b3dc7;,\n" +
-                "164697518171492352,333,9bb4f1afbdf520c28a8a9f9e4a568a4743ad62f319a17ed9437414b5;,\n" +
-                "169411694739591168,18725603264,5ea1c34a749cfd9c84b9aad577c5bae2cf12444a1f4b6c2bbac6cf67;,\n" +
-                "169832563756503040,18989898989,796c6a422bce78cced07918f759fe9ed5ee300ea3953e00fc71c24cc;,\n" +
-                "169832563794250001,17358629900,15896f181b1311a52fea135b46d95dceb14a9be0a9f70e5471fdbed8;,\n" +
-                "169832563794250002,18581845600,1b26b8eeba0c5dfc6ec66bea3d5a744e1f254db639114e290f328a36;,\n" +
-                "172804004273721344,17358629955,1b26b8eeba0c5dfc6ec66bea3d5a744e1f254db639114e290f328a36;,\n" +
-                "172804804509175808,18581845668,5c14b84bf8b4ff37289367942d176ae99353d4554cd68504d480099f;,\n" +
-                "172805173922500608,19940686355,f90c137bf2dafdbd0f44c737f3308dd3b6eccc9ca901f8561655235f;,\n" +
-                "174848836286550016,18728803519,ffe135b89706c8118e183f6e2724605be2e57eaef88a83fa161988b7;,\n" +
-                "174849409274613760,18728803520,5a70e23e8f39c898151c2f220c0b4b8cc5ec325754871e05cc97ad6f;,\n" +
-                "174921932133634048,18508243826,154e6e02db2c56eb30e012053ad6f1e3aa1c3124057f6fd1ff08c1b1;,\n" +
-                "175194057557938176,18583328875,c1048c9ae5cbb7c3479611eb279780ee2f4bf4e14e518fb416e04889;,\n" +
-                "177044507026526208,17780832879,2ce6f28d73a8741b4f9621bb533fc7a041341438afcf9240fa06e694;,\n" +
-                "177154391646670848,18728803521,fb776988fb19dd63086ae88f37de4a01fdce26038bbba073b33e5533;,\n" +
-                "177493080700620800,17358629911,ffcc7ac864f6d951318db5643078bacf95499c2c9f0b376e30d31134;,\n" +
-                "177493191988088832,17358629922,5ee3b6ee0049014f63ae1288b9f731c8ae05e674169245539ef9d8cf;,\n" +
-                "177493399400615936,17358629901,e8a9cdf5659204ce9b16cade7073764c0a3b2136bd1750b563132190;,\n" +
-                "177493603818409984,17358629933,d6bd668a876e4dcdc9eefb6059a4e9c2969d8ce54b3d42f5b9a49573;,\n" +
-                "177495184064385024,18581845611,53f2cb77f34992dc1785d662792df69d1f7e52e50450a87446b31445;,\n" +
-                "177495269858873344,18581845622,9e397e5e54145865a9a3c55d75ea4c5105847daf6937eb0b9d66ee9e;,\n" +
-                "177495384933797888,18581845633,bc425341f50b1f2b26f1f4092d212147022912e96c022c6b8e85e2b0;,\n" +
-                "177496454816862208,19940686311,31c8cc61c09d079e26ed7dbaf7b650a36addbacab8e094c7744b4f4f;,\n" +
-                "177496522529705984,19940686322,7ff53f4b835ca96d36a0683d7d3ea6e597d47e11005948b113962b22;,\n" +
-                "177496618457632768,19940686333,cf7fce7ad2d0912cc8b655c71b7984a4f679184ab6f0121b34b2cddf;,\n" +
-                "177755619585953792,18581845644,492a18b9c21963e38bd5c5be7aea349f9fbba6256bc5409e882ed165;,\n" +
-                "177756009534590976,19940686344,8f53c645f492e0856baf623bdd1d9ba94715397de929223e17f3b311;,\n" +
-                "177756500125552640,17358629944,b046904d8cff8812692a078307d233bf18a6ed12751dc6e540f1d17c;,\n" +
-                "179251265040027648,18900001111,17b95c44a4be220ec241ea66fac83941afbd438fe97b9aba4e587f19;,\n" +
-                "179251480232988672,18900002222,7a98d8432666fbae4f976be6aee0725d83fc85e9a4140400ac3fc08b;,\n" +
-                "179287301304619008,15770000850,457b71ac5eb35cd72f54f260dc2e720f435ad18e3fec50c5f308f16e;,\n" +
-                "179567500780900352,18215677925,1212403ea6c37724ce3deccf3a3e84c82cd5503cac054782329e0b38;,\n" +
-                "179908046275743744,17310362742,e68281cfa1b49d333e51e9773fb955e10908795987892282e004791e;,\n" +
-                "180714251143352320,5464,4e834fbf535588ab64752d3609e3606eae0387cbfdc1a011626f0af1;,\n" +
-                "180716172793090048,1534543545,2df806f9dad1fe9aa1afb3592ff309e3c6821fe9f593ffcc7c765d4f;,\n" +
-                "180717765986881536,34234,514134b6e51a189d5e02d1e439d6616aedbe5e73395970efe01fffc5;,\n" +
-                "180741718713307136,16500000000,61d1ece89fac8414762ab7faa173cf8707c7e7137cd22e93652ccb4a;,\n" +
-                "180742245102653440,16600000000,2e7a7e603c4883cc5bd859af38482d4fab1eec756a7653cad697becd;,\n" +
-                "182077378799865856,15515955555,5957560d39adc6269948ae1a2eda73c1a451164557a831e025fdc0d9;,\n" +
-                "182445986600194048,14000000000,475211e9bdb02f694c17a468ba33f395c87cdcda6ef343a2c7dc86a2;,\n" +
-                "182446432941248512,17000000000,ca0feeb8ca30dae8ab38d2ff07840f731777d6514c92cd5dfdc1902d;,\n" +
-                "184622287863943168,17358621111,f4e4bab7497534fdf1487ce2951fbaf0d8b9463f6ad7166275dc9a84;,\n" +
-                "184622549060030464,17358622222,424df61b9291ada971db0005c29be190602165aeb2c9295c107ce8b9;,\n" +
-                "187262271745953792,18777777777,27005458fed283da910fcbcfea4cc877454ab47164525074fc6792a1;,\n" +
-                "187263867661848576,18900000000,b41bc19f522840bcf88da64d8fc93d9938252856c95d174d24796796;,\n" +
-                "187266156040556544,18666666666,b83ca58b0f533a98bbb9a72857725aca1ceb8476ac6a6118fb5ea7cf;,\n" +
-                "187266875430801408,18555555555,256f34d839db85a12eb46c21135a9d0b9a058ba26e83099b3951275f;,\n" +
-                "187674506012135424,14777777777,dd4a6928d63b57f85a5dad13b5f6581ddaef2f47ce613f6d8cebed15;,\n" +
-                "187932221632417792,18922111111,915d03daa67403dace1077063afff2f99bc78f27cf1eff476267637d;,\n" +
-                "187933261320687616,18922111112,d10029a3a9f3176ee2ea6516add9f94e0273cd5e1e507eca5e9c8754;,\n" +
-                "191139325050621952,18912349988,b36e322666a0b260d5b5bbcba6622f30ce59653892044830f9988554;,\n" +
-                "191958030668009472,18922993333,bbf608392522d9c2faf7015c376e1a762ac7108ac9cb089d9ca4baf8;,\n" +
-                "191973351617466368,16666666666,94e66bf955c8ec094bf202350438ffffcc2c203141d9b98f4c47f671;,\n" +
-                "192247281867558912,16600060066,9aec2a414a09c87257ac8d0b5d53b6828c255a51a57a271c54266e56;,\n" +
-                "192337955283537920,17777777777,028515cdef747a5eea5a268c30906af1661e08a8807bf2f702b8ca66;,\n" +
-                "193055960644718592,14444444444,0fbacd064a22b0e35152991552a11cb793ded61438d713912667c5ec";
-        String [] strArray = str.split(";,");
-
-        for (int i=0; i<strArray.length; i++) {
-            String str1 = strArray[i];
-            if (StringUtils.isBlank(str1.trim())) {
-                continue;
-            }
-            String [] strArray1 = str1.split(",");
-            String id = strArray1[0];
-            String account = strArray1[1];
-            String password = strArray1[2];
-            System.out.print("-- " + account + "==>");
-
-            String md5 = PasswordUtils.md5(account);
-            boolean bool = PasswordUtils.validatePassword(md5, password);
-
-            if (!bool) {
-                md5 = PasswordUtils.md5("123456");
-                bool = PasswordUtils.validatePassword(md5, password);
-                if (bool) {
-                    System.out.println(bool);
-                    String salt = PasswordUtils.generateSalt();
-                    md5 = PasswordUtils.md5("123456");
-                    password = PasswordUtils.entryptPassword(account + md5, salt);
-                    String sql = "UPDATE sckw_system.kws_user set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
-                    System.out.println(sql);
-                } else {
-                    System.out.println(bool);
-                    String salt = PasswordUtils.generateSalt();
-                    md5 = PasswordUtils.md5(account);
-                    password = PasswordUtils.entryptPassword(account + md5, salt);
-                    String sql = "UPDATE sckw_system.kws_user set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
-                    System.out.println(sql);
-                }
-            } else {
-                System.out.println(bool);
-                String salt = PasswordUtils.generateSalt();
-                md5 = PasswordUtils.md5(account);
-                password = PasswordUtils.entryptPassword(account + md5, salt);
-                String sql = "UPDATE sckw_system.kws_user set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
-                System.out.println(sql);
-            }
-        }
-    }
+//    public static void checkUser(){
+//        String str = "156382319433748480,18000000000,be8d1ae3fac3067ee98068cce2895ad305febbe31a644fe42954de0c;,\n" +
+//                "156383116720607232,admin,04323ed6811d048e0406ec39293394aabcf9b132a0cb1b87dc78279f;,\n" +
+//                "162301006506364928,182838089858,cf2f6d38f0b8a150d90d9194b97875c004413880cf7aba8abf3b3dc7;,\n" +
+//                "162604062133456896,13000000000,cf2f6d38f0b8a150d90d9194b97875c004413880cf7aba8abf3b3dc7;,\n" +
+//                "163980531141185536,18283808586,debc2bab5eaf7b629049666051ad504bc60bea9eeab95932f64054a9;,\n" +
+//                "163987895701475328,15902849627,ecc16d89238b2cd77637b41096e322a3f89c345ac10297a5fc7b61e3;,\n" +
+//                "163994695842664448,18283808587,0a842bee1f75c4939d408eae02f575fad005cec391b7cc1eec6f5882;,\n" +
+//                "163995870587523072,18283808581,1b7383f4d6e458fb610bcc7a80cc959ed13c83a30063401b82fa1245;,\n" +
+//                "163995977299005440,18283808582,cebab3009b34e77708385c2af5595de5e739aadf435542d22d1b66ec;,\n" +
+//                "163996113957818368,18827222222,3182b6bba4c90445e2d16a8901653866a707d9a1a2dc499f8af37546;,\n" +
+//                "163996259454029824,18827766520,4b32a9a0b4dabe5b920a78d5115febf3b87d45ceebe5715d11b53dad;,\n" +
+//                "163996369839722496,17722337872,c676f2924969a10ce4f059b1894bded8061a01d0252f3a789ce8b9ad;,\n" +
+//                "163998264054517760,13911111111,65ffa259c8ba2660438f28a09851182b615dc16b7188006d67d2d661;,\n" +
+//                "164072870236917760,18591918877,9ca66c47aad850e4b22b7df5acbe58a33b3a1be4fa70315e9eff8bf2;,\n" +
+//                "164357889975128064,18283808584,1fd478d1d3f61d341c6cc1065b9e02833e314102be2528fbf292ed87;,\n" +
+//                "164480042405990400,18283765365,ce181135763e284d6748012dbe53bcac767ea60d0306b0f04e1b3ffd;,\n" +
+//                "164697036837359616,18583328873,cf2f6d38f0b8a150d90d9194b97875c004413880cf7aba8abf3b3dc7;,\n" +
+//                "164697518171492352,333,9bb4f1afbdf520c28a8a9f9e4a568a4743ad62f319a17ed9437414b5;,\n" +
+//                "169411694739591168,18725603264,5ea1c34a749cfd9c84b9aad577c5bae2cf12444a1f4b6c2bbac6cf67;,\n" +
+//                "169832563756503040,18989898989,796c6a422bce78cced07918f759fe9ed5ee300ea3953e00fc71c24cc;,\n" +
+//                "169832563794250001,17358629900,15896f181b1311a52fea135b46d95dceb14a9be0a9f70e5471fdbed8;,\n" +
+//                "169832563794250002,18581845600,1b26b8eeba0c5dfc6ec66bea3d5a744e1f254db639114e290f328a36;,\n" +
+//                "172804004273721344,17358629955,1b26b8eeba0c5dfc6ec66bea3d5a744e1f254db639114e290f328a36;,\n" +
+//                "172804804509175808,18581845668,5c14b84bf8b4ff37289367942d176ae99353d4554cd68504d480099f;,\n" +
+//                "172805173922500608,19940686355,f90c137bf2dafdbd0f44c737f3308dd3b6eccc9ca901f8561655235f;,\n" +
+//                "174848836286550016,18728803519,ffe135b89706c8118e183f6e2724605be2e57eaef88a83fa161988b7;,\n" +
+//                "174849409274613760,18728803520,5a70e23e8f39c898151c2f220c0b4b8cc5ec325754871e05cc97ad6f;,\n" +
+//                "174921932133634048,18508243826,154e6e02db2c56eb30e012053ad6f1e3aa1c3124057f6fd1ff08c1b1;,\n" +
+//                "175194057557938176,18583328875,c1048c9ae5cbb7c3479611eb279780ee2f4bf4e14e518fb416e04889;,\n" +
+//                "177044507026526208,17780832879,2ce6f28d73a8741b4f9621bb533fc7a041341438afcf9240fa06e694;,\n" +
+//                "177154391646670848,18728803521,fb776988fb19dd63086ae88f37de4a01fdce26038bbba073b33e5533;,\n" +
+//                "177493080700620800,17358629911,ffcc7ac864f6d951318db5643078bacf95499c2c9f0b376e30d31134;,\n" +
+//                "177493191988088832,17358629922,5ee3b6ee0049014f63ae1288b9f731c8ae05e674169245539ef9d8cf;,\n" +
+//                "177493399400615936,17358629901,e8a9cdf5659204ce9b16cade7073764c0a3b2136bd1750b563132190;,\n" +
+//                "177493603818409984,17358629933,d6bd668a876e4dcdc9eefb6059a4e9c2969d8ce54b3d42f5b9a49573;,\n" +
+//                "177495184064385024,18581845611,53f2cb77f34992dc1785d662792df69d1f7e52e50450a87446b31445;,\n" +
+//                "177495269858873344,18581845622,9e397e5e54145865a9a3c55d75ea4c5105847daf6937eb0b9d66ee9e;,\n" +
+//                "177495384933797888,18581845633,bc425341f50b1f2b26f1f4092d212147022912e96c022c6b8e85e2b0;,\n" +
+//                "177496454816862208,19940686311,31c8cc61c09d079e26ed7dbaf7b650a36addbacab8e094c7744b4f4f;,\n" +
+//                "177496522529705984,19940686322,7ff53f4b835ca96d36a0683d7d3ea6e597d47e11005948b113962b22;,\n" +
+//                "177496618457632768,19940686333,cf7fce7ad2d0912cc8b655c71b7984a4f679184ab6f0121b34b2cddf;,\n" +
+//                "177755619585953792,18581845644,492a18b9c21963e38bd5c5be7aea349f9fbba6256bc5409e882ed165;,\n" +
+//                "177756009534590976,19940686344,8f53c645f492e0856baf623bdd1d9ba94715397de929223e17f3b311;,\n" +
+//                "177756500125552640,17358629944,b046904d8cff8812692a078307d233bf18a6ed12751dc6e540f1d17c;,\n" +
+//                "179251265040027648,18900001111,17b95c44a4be220ec241ea66fac83941afbd438fe97b9aba4e587f19;,\n" +
+//                "179251480232988672,18900002222,7a98d8432666fbae4f976be6aee0725d83fc85e9a4140400ac3fc08b;,\n" +
+//                "179287301304619008,15770000850,457b71ac5eb35cd72f54f260dc2e720f435ad18e3fec50c5f308f16e;,\n" +
+//                "179567500780900352,18215677925,1212403ea6c37724ce3deccf3a3e84c82cd5503cac054782329e0b38;,\n" +
+//                "179908046275743744,17310362742,e68281cfa1b49d333e51e9773fb955e10908795987892282e004791e;,\n" +
+//                "180714251143352320,5464,4e834fbf535588ab64752d3609e3606eae0387cbfdc1a011626f0af1;,\n" +
+//                "180716172793090048,1534543545,2df806f9dad1fe9aa1afb3592ff309e3c6821fe9f593ffcc7c765d4f;,\n" +
+//                "180717765986881536,34234,514134b6e51a189d5e02d1e439d6616aedbe5e73395970efe01fffc5;,\n" +
+//                "180741718713307136,16500000000,61d1ece89fac8414762ab7faa173cf8707c7e7137cd22e93652ccb4a;,\n" +
+//                "180742245102653440,16600000000,2e7a7e603c4883cc5bd859af38482d4fab1eec756a7653cad697becd;,\n" +
+//                "182077378799865856,15515955555,5957560d39adc6269948ae1a2eda73c1a451164557a831e025fdc0d9;,\n" +
+//                "182445986600194048,14000000000,475211e9bdb02f694c17a468ba33f395c87cdcda6ef343a2c7dc86a2;,\n" +
+//                "182446432941248512,17000000000,ca0feeb8ca30dae8ab38d2ff07840f731777d6514c92cd5dfdc1902d;,\n" +
+//                "184622287863943168,17358621111,f4e4bab7497534fdf1487ce2951fbaf0d8b9463f6ad7166275dc9a84;,\n" +
+//                "184622549060030464,17358622222,424df61b9291ada971db0005c29be190602165aeb2c9295c107ce8b9;,\n" +
+//                "187262271745953792,18777777777,27005458fed283da910fcbcfea4cc877454ab47164525074fc6792a1;,\n" +
+//                "187263867661848576,18900000000,b41bc19f522840bcf88da64d8fc93d9938252856c95d174d24796796;,\n" +
+//                "187266156040556544,18666666666,b83ca58b0f533a98bbb9a72857725aca1ceb8476ac6a6118fb5ea7cf;,\n" +
+//                "187266875430801408,18555555555,256f34d839db85a12eb46c21135a9d0b9a058ba26e83099b3951275f;,\n" +
+//                "187674506012135424,14777777777,dd4a6928d63b57f85a5dad13b5f6581ddaef2f47ce613f6d8cebed15;,\n" +
+//                "187932221632417792,18922111111,915d03daa67403dace1077063afff2f99bc78f27cf1eff476267637d;,\n" +
+//                "187933261320687616,18922111112,d10029a3a9f3176ee2ea6516add9f94e0273cd5e1e507eca5e9c8754;,\n" +
+//                "191139325050621952,18912349988,b36e322666a0b260d5b5bbcba6622f30ce59653892044830f9988554;,\n" +
+//                "191958030668009472,18922993333,bbf608392522d9c2faf7015c376e1a762ac7108ac9cb089d9ca4baf8;,\n" +
+//                "191973351617466368,16666666666,94e66bf955c8ec094bf202350438ffffcc2c203141d9b98f4c47f671;,\n" +
+//                "192247281867558912,16600060066,9aec2a414a09c87257ac8d0b5d53b6828c255a51a57a271c54266e56;,\n" +
+//                "192337955283537920,17777777777,028515cdef747a5eea5a268c30906af1661e08a8807bf2f702b8ca66;,\n" +
+//                "193055960644718592,14444444444,0fbacd064a22b0e35152991552a11cb793ded61438d713912667c5ec";
+//        String [] strArray = str.split(";,");
+//
+//        for (int i=0; i<strArray.length; i++) {
+//            String str1 = strArray[i];
+//            if (StringUtils.isBlank(str1.trim())) {
+//                continue;
+//            }
+//            String [] strArray1 = str1.split(",");
+//            String id = strArray1[0];
+//            String account = strArray1[1];
+//            String password = strArray1[2];
+//            System.out.print("-- " + account + "==>");
+//
+//            String md5 = PasswordUtils.md5(account);
+//            boolean bool = PasswordUtils.validatePassword(md5, password);
+//
+//            if (!bool) {
+//                md5 = PasswordUtils.md5("123456");
+//                bool = PasswordUtils.validatePassword(md5, password);
+//                if (bool) {
+//                    System.out.println(bool);
+//                    String salt = PasswordUtils.generateSalt();
+//                    md5 = PasswordUtils.md5("123456");
+//                    password = PasswordUtils.entryptPassword(account + md5, salt);
+//                    String sql = "UPDATE sckw_system.kws_user set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
+//                    System.out.println(sql);
+//                } else {
+//                    System.out.println(bool);
+//                    String salt = PasswordUtils.generateSalt();
+//                    md5 = PasswordUtils.md5(account);
+//                    password = PasswordUtils.entryptPassword(account + md5, salt);
+//                    String sql = "UPDATE sckw_system.kws_user set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
+//                    System.out.println(sql);
+//                }
+//            } else {
+//                System.out.println(bool);
+//                String salt = PasswordUtils.generateSalt();
+//                md5 = PasswordUtils.md5(account);
+//                password = PasswordUtils.entryptPassword(account + md5, salt);
+//                String sql = "UPDATE sckw_system.kws_user set password = '"+password+"', salt = '"+salt+"' where id = "+id+";";
+//                System.out.println(sql);
+//            }
+//        }
+//    }
 
     public static void main(String[] args) throws Exception {
-        String account = "17358629955";
-        String password = "123456";
+        String account = "18482106067";
+        String password = "18482106067";
         String salt = generateSalt();
         System.out.println(salt);
 

+ 91 - 31
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -7,34 +7,54 @@ package com.sckw.core.web.constant;
  */
 public class HttpStatus {
 
-    /**成功状态码*/
+    /**
+     * 成功状态码
+     */
     public static final int SUCCESS_CODE = 60200;
 
-    /**成功提示信息*/
+    /**
+     * 成功提示信息
+     */
     public static final String SUCCESS_MESSAGE = "success";
 
-    /**未登录状态码*/
+    /**
+     * 未登录状态码
+     */
     public static final int UN_LOGIN_CODE = 60300;
-    /**未登录提示信息*/
+    /**
+     * 未登录提示信息
+     */
     public static final String UN_LOGIN_MESSAGE = "您尚未登录,请先登录!";
 
-    /**访问权限状态码*/
+    /**
+     * 访问权限状态码
+     */
     public static final int AUTHORITY_NO_CODE = 60403;
     public static final String ACCESS_FIAL = "暂无该功能权限!";
 
-    /**全局异常状态码*/
+    /**
+     * 全局异常状态码
+     */
     public static final int GLOBAL_EXCEPTION_CODE = 60500;
 
-    /**完结贸易订单失败异常码*/
+    /**
+     * 完结贸易订单失败异常码
+     */
     public static final int COMPLETE_TORDER_FAIL_CODE = 60666;
 
-    /** 商品上架失败异常码*/
+    /**
+     * 商品上架失败异常码
+     */
     public static final int GOODS_PUT_ON_SHELVES_FAIL_CODE = 60667;
 
-    /**全局异常提示信息*/
+    /**
+     * 全局异常提示信息
+     */
     public static final String GLOBAL_EXCEPTION_MESSAGE = "攻城狮正在拼命优化,请您稍候再试!";
 
-    /**参数缺失状态码*/
+    /**
+     * 参数缺失状态码
+     */
     public static final int PARAMETERS_MISSING_CODE = 60600;
     public static final String ID_MISSING = "id不能为空!";
     public static final String ACCOUNT_MISSING = "用户账号必填!";
@@ -47,21 +67,24 @@ public class HttpStatus {
     public static final String ADDRESS_EXISTS = "地点已存在,不可重复!";
     public static final String INVALID_REQUEST = "无效的接口请求!";
 
-    /**其他自定义状态码*/
+    /**
+     * 其他自定义状态码
+     */
     public static final int CODE_60603 = 60603;
     public static final String ENTCERTIFICATES_INVAILD = "您的企业资质已失效,暂没有权限访问,请尽快更新资质";
     public static final String ENTCERTIFICATES_NOT_REGISTER = "您未做企业资质认证,暂没有权限访问";
     public static final String ENTCERTIFICATES_NOT_PASS = "您的企业资质认证还在审核中,暂没有权限访问";
 
 
-
     public static final int CODE_60604 = 60604;
     public static final int CODE_60605 = 60605;
     public static final int CODE_60606 = 60606;
     public static final int CODE_60607 = 60607;
     public static final int CODE_60608 = 60608;
     public static final int CODE_60609 = 60609;
-    /**sentinel异常code定义*/
+    /**
+     * sentinel异常code定义
+     */
     public static final int CODE_60701 = 60701;
     public static final int CODE_60801 = 60801;
     public static final int CODE_60901 = 60901;
@@ -76,15 +99,23 @@ public class HttpStatus {
     public static final String AUTHORITY_EXCEPTION_ERROR_MESSAGE = "授权规则检测不同,请检查访问参数";
     public static final String OTHER_EXCEPTION_ERROR_MESSAGE = "非法访问,请稍后重试";
 
-    /**版本号和接口版本不对称状态码*/
+    /**
+     * 版本号和接口版本不对称状态码
+     */
     public static final int VERSION_NOT_NEWEST_CODE = 60700;
-    /**版本号和接口版本不对称提示信息*/
+    /**
+     * 版本号和接口版本不对称提示信息
+     */
     public static final String VERSION_NOT_NEWEST_MESSAGE = "当前版本较低,请更新升级后再试!";
 
 
-    /**参数格式不正确状态码*/
+    /**
+     * 参数格式不正确状态码
+     */
     public static final int PARAMETERS_PATTERN_ERROR_CODE = 60800;
-    /**参数格式不正确提示信息*/
+    /**
+     * 参数格式不正确提示信息
+     */
     public static final String PARAMETERS_PATTERN_ERROR_MESSAGE = "参数格式不正确";
     public static final String CONTACTS_ERROR = "联系人格式不正确";
     public static final String CONTACTS_PHONE_ERROR = "联系人手机号格式不正确";
@@ -93,30 +124,50 @@ public class HttpStatus {
     public static final String LEGAL_ID_CARD_ERROR = "法人身份证号格式不正确";
     public static final String ENT_CODE_ERROR = "营业执照编号格式不正确";
 
-    /**账号在别处登录状态码*/
+    /**
+     * 账号在别处登录状态码
+     */
     public static final int ACCOUNT_OTHER_LOGIN_CODE = 60900;
-    /**账号在别处登录提示信息*/
+    /**
+     * 账号在别处登录提示信息
+     */
     public static final String ACCOUNT_OTHER_LOGIN_MESSAGE = "您的账号已在其他设备登录,如非本人操作,请及时修改密码!";
 
 
-    /**token无效状态码*/
+    /**
+     * token无效状态码
+     */
     public static final int TOKEN_INVALID_CODE = 60901;
-    /**token无效提示信息*/
+    /**
+     * token无效提示信息
+     */
     public static final String TOKEN_INVALID_MESSAGE = "由于您一段时间未操作,为了您的账户安全,请重新登录!";
 
-    /**请求超过次数*/
+    /**
+     * 请求超过次数
+     */
     public static final int FREQUENCY_OUT = 60902;
-    /**请求超过次数提示信息*/
+    /**
+     * 请求超过次数提示信息
+     */
     public static final String FREQUENCY_OUT_MESSAGE = "您的操作过于频繁,请刷新浏览器或稍候重试!";
 
-    /**审核状态状态码*/
+    /**
+     * 审核状态状态码
+     */
     public static final int ACCOUNT_AUDIT_CODE = 60903;
-    /**审核状态状提示信息*/
+    /**
+     * 审核状态状提示信息
+     */
     public static final String ACCOUNT_AUDIT_MESSAGE = "您所属企业企业资质审批未通过,请核实确认!";
 
-    /**微信账号未绑定态码*/
+    /**
+     * 微信账号未绑定态码
+     */
     public static final int WECHAR_BIND_CODE = 60904;
-    /**微信账号未绑定提示信息*/
+    /**
+     * 微信账号未绑定提示信息
+     */
     public static final String WECHAR_BIND_MESSAGE = "您的微信还未绑定危品汇账号!";
 
     /**
@@ -125,13 +176,17 @@ public class HttpStatus {
      */
     public static final int CODE_10301 = 10301;
 
-    /**数据库的操作失败*/
+    /**
+     * 数据库的操作失败
+     */
     public static final int CRUD_FAIL_CODE = 60601;
     public static final String UPDATE_FAIL = "更新失败";
     public static final String INSERT_FAIL = "新增失败";
     public static final String DELETE_FAIL = "删除失败";
 
-    /**未查询到相关信息*/
+    /**
+     * 未查询到相关信息
+     */
     public static final int QUERY_FAIL_CODE = 60602;
     public static final String ACCOUNT_NOT_EXISTS = "用户信息不存在或已失效";
     public static final String ENT_NOT_EXISTS = "企业信息不存在或已失效";
@@ -149,7 +204,9 @@ public class HttpStatus {
     public static final String CONTRACT_NOT_EXISTS = "未查询到合同或已失效";
     public static final String BANNER_NOT_EXISTS = "未查询到banner数据或已失效";
 
-    /**自定义提示消息*/
+    /**
+     * 自定义提示消息
+     */
     public static final String PASSWD_ERROR = "密码不正确";
     public static final String PASSWD_REPEAT = "新密码与旧密码不能一样!";
     public static final String CAPTCHA_ERROR = "验证码输入错误";
@@ -194,5 +251,8 @@ public class HttpStatus {
     public static final String DICTTYPE_EXISTS = "字典类型已存在,不可重复!";
     public static final String DICT_EXISTS = "字典键值已存在,不可重复!";
     public static final String PL34 = "3PL和4PL不能同时注册!";
+    public static final String ENT_CODE = "统一社会信用代码已存在!";
+    public static final String ENT_FAILED = "新增子企业,父级企业不能为空!";
+
 
-}
+}

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/RequestConstant.java

@@ -14,6 +14,6 @@ public class RequestConstant {
     /**系统类型*/
     public static final String SYSTEM_TYPE = "System-Type";
     /**专场标识*/
-    public static final String ACCESS_SPECIAL = "Access-Special";
+//    public static final String ACCESS_SPECIAL = "Access-Special";
 
 }

+ 56 - 13
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/context/LoginUserHolder.java

@@ -1,13 +1,16 @@
 package com.sckw.core.web.context;
 
+import com.sckw.core.model.enums.SystemTypeEnum;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.model.LoginUserInfo;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 当前登录用户的临时保存容器
+ *
  * @Author zk
  * @date 2020/04/13 0021
  */
@@ -17,6 +20,7 @@ public class LoginUserHolder {
 
     /**
      * 赋值
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
@@ -26,6 +30,7 @@ public class LoginUserHolder {
 
     /**
      * 取值
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
@@ -35,6 +40,7 @@ public class LoginUserHolder {
 
     /**
      * 删除保存的用户
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
@@ -44,103 +50,127 @@ public class LoginUserHolder {
 
     /**
      * 用户id
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static Long getUserId(){
+    public static Long getUserId() {
         return LONGIN_USER_HOLDER.get() == null ? 1L : LONGIN_USER_HOLDER.get().getId();
     }
 
     /**
      * 用户所属系统
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static Integer getSystemType(){
+    public static Integer getSystemType() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getSystemType();
     }
 
+    /**
+     * 是否为平台运营端
+     *
+     * @return
+     */
+    public static Boolean isManager() {
+        return Objects.equals(getSystemType(), SystemTypeEnum.MANAGE.getCode());
+    }
+
     /**
      * 用户账号
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static String getAccount(){
+    public static String getAccount() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getAccount();
     }
 
     /**
      * 用户姓名
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static String getUserName(){
+    public static String getUserName() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getUserName();
     }
 
     /**
      * 用户电话
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static String getPhone(){
+    public static String getPhone() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getPhone();
     }
 
     /**
-     * 是否主账号(0是/1否)
+     * 是否主账号
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static Integer getIsMain(){
+    public static Integer getIsMain() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getIsMain();
     }
 
     /**
      * 用户账号状态(0正常/1锁定)
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static Integer getStatus(){
+    public static Integer getStatus() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getStatus();
     }
 
     /**
      * 用户所属企业
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static Long getEntId(){
+    public static Long getEntId() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getEntId();
     }
 
     /**
      * 用户所属企业
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static String getEntName(){
+    public static String getEntName() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getEntName();
     }
 
     /**
      * 用户登录终端
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static String getClientType(){
+    public static String getClientType() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getClientType();
     }
 
     /**
      * 用户机构
+     *
      * @author zhaokang
      * @Date 2020/04/13 0021
      */
-    public static String getDeptIds(){
+    public static String getDeptIds() {
         return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getDeptIds();
     }
 
+    public static Long getCurrentRoleId() {
+        return LONGIN_USER_HOLDER.get() == null ? null : LONGIN_USER_HOLDER.get().getUseRoleId();
+    }
+
     /**
      * 用户权限
      */
@@ -158,9 +188,10 @@ public class LoginUserHolder {
 
     /**
      * 运营端客户经理(用户)关联企业
+     *
      * @return 企业ID集合
      */
-    public static List<Long> getAuthEntIdList(){
+    public static List<Long> getAuthEntIdList() {
         if (LONGIN_USER_HOLDER.get() == null) {
             return new ArrayList<>();
         }
@@ -172,4 +203,16 @@ public class LoginUserHolder {
         return authUserIdList;
     }
 
+    public static List<Long> getChildEntList() {
+        if (LONGIN_USER_HOLDER.get() == null) {
+            return new ArrayList<>();
+        }
+        List<Long> childEntList = LONGIN_USER_HOLDER.get().getChildEntList();
+        if (CollectionUtils.isEmpty(childEntList)) {
+            return new ArrayList<>();
+        }
+
+        return childEntList;
+    }
+
 }

+ 12 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/model/LoginUserInfo.java

@@ -1,10 +1,12 @@
 package com.sckw.core.web.model;
 
 import lombok.Data;
+
 import java.util.List;
 
 /**
  * 登录中的用户信息
+ *
  * @Author zhaokang
  * @date 2020/04/13 0021
  */
@@ -41,7 +43,7 @@ public class LoginUserInfo {
     private int isMain;
 
     /**
-     *用户账号状态(0正常/1锁定)
+     * 用户账号状态(0正常/1锁定)
      */
     private Integer status;
 
@@ -49,6 +51,11 @@ public class LoginUserInfo {
      * 用户所属企业id
      */
     private Long entId;
+    /**
+     * 当前用户使用的角色id和角色关联的企业id
+     */
+    private Long useRoleId;
+    private Long useEntId;
 
     /**
      * 用户登录终端
@@ -74,6 +81,10 @@ public class LoginUserInfo {
      * 用户(客户经理)企业权限
      */
     private List<Long> authEntIdList;
+    /**
+     * 当前用户,所有的子企业,包含用户所在企业 新增的企业数据权限部分
+     */
+    private List<Long> childEntList;
 
     public LoginUserInfo() {
     }

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

@@ -8,4 +8,6 @@ com.sckw.core.config.MybatisPlusConfig
 com.sckw.core.config.JacksonConfig
 com.sckw.core.filter.ExceptionFilterConfig
 com.sckw.core.aspect.LogAspect
-com.sckw.core.utils.FileUtils
+com.sckw.core.utils.FileUtils
+com.sckw.core.handler.LongListTypeHandler
+com.sckw.core.handler.StringListTypeHandler

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

@@ -277,4 +277,8 @@ public interface RemoteUserService {
     List<Long> selectUserBySystemType(Integer systemType);
 
     List<Long> findAllEnterprise();
+    List<Long> findChildEntList(Long entId);
+
+    List<Long> findEntListByUserId(Long userId);
+
 }

+ 3 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/KwsUserResDto.java

@@ -4,9 +4,11 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.sckw.core.utils.LongToStringUtils;
 import lombok.Data;
 
+import javax.management.relation.RoleInfo;
 import java.io.Serial;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @desc: 用户返参
@@ -132,5 +134,6 @@ public class KwsUserResDto implements Serializable {
      */
     @JsonSerialize(using = LongToStringUtils.class)
     private Long roleId;
+    private List<RoleInfoDto> roleInfoDto;
 
 }

+ 23 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/RoleInfoDto.java

@@ -0,0 +1,23 @@
+package com.sckw.system.api.model.dto.res;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @author xucaiqin
+ * @date 2025-11-10 16:23:20
+ */
+@Getter
+@Setter
+public class RoleInfoDto implements Serializable {
+    private Long roleId;
+    private String roleName;
+    private Long entId;
+    private String entName;
+    /**
+     * 当前激活的角色
+     */
+    private Boolean activate;
+}

+ 2 - 2
sckw-modules/pom.xml

@@ -15,7 +15,7 @@
     <modules>
         <module>sckw-system</module>
         <module>sckw-message</module>
-        <module>sckw-example</module>
+<!--        <module>sckw-example</module>-->
         <module>sckw-file</module>
         <module>sckw-product</module>
         <module>sckw-order</module>
@@ -46,4 +46,4 @@
         <maven.compiler.target>17</maven.compiler.target>
     </properties>
 
-</project>
+</project>

+ 2 - 2
sckw-modules/sckw-file/src/main/resources/mapper/KwsFileInfoDao.xml

@@ -36,7 +36,7 @@
     </select>
 
     <insert id="insert" parameterType="com.sckw.file.model.kwfFileInfo">
-        insert into sckw_file.kwf_file_info
+        insert into kwf_file_info
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">
                 id,
@@ -133,4 +133,4 @@
         </trim>
     </insert>
 
-</mapper>
+</mapper>

+ 0 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpBizWalletController.java

@@ -1,7 +1,6 @@
 package com.sckw.payment.controller;
 
 
-import com.sckw.core.ExcelUtils;
 import com.sckw.core.web.response.BaseResult;
 import com.sckw.core.web.response.result.PageDataResult;
 import com.sckw.payment.repose.KwpBizWalletPageResponse;

+ 35 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsEnterpriseController.java

@@ -6,6 +6,8 @@ import com.sckw.core.web.response.BaseResult;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.system.model.KwsEnterprise;
 import com.sckw.system.model.vo.req.*;
+import com.sckw.system.model.vo.res.EntBaseInfo;
+import com.sckw.system.model.vo.res.EntInfo;
 import com.sckw.system.model.vo.res.EntInfoResp;
 import com.sckw.system.model.vo.res.KwsUserSystemTypeVo;
 import com.sckw.system.service.KwsEnterpriseService;
@@ -58,6 +60,8 @@ public class KwsEnterpriseController {
     }
 
     /**
+     * 运营端 分页查询
+     * 企业端 查询子公司
      * @param pageReqVo
      * @return HttpResult
      * @description 分页查询
@@ -139,6 +143,8 @@ public class KwsEnterpriseController {
     }
 
     /**
+     * 平台管理端,新增入住接口?
+     * 企业端 新增子公司
      * @param reqVo 新增企业入驻入参
      * @return HttpResult
      * @desc: 新增企业入驻
@@ -147,8 +153,6 @@ public class KwsEnterpriseController {
      */
     @PostMapping("/addEntSettle")
     public HttpResult addEntSettle(@Valid @RequestBody AddEntSettleReqVo reqVo, HttpServletRequest request) {
-        String accessSpecial = request.getHeader("Access-Special");
-        reqVo.setSpecial(accessSpecial);
         kwsEntService.addEntSettle(reqVo);
         return HttpResult.ok(HttpStatus.MSG_003);
     }
@@ -206,6 +210,7 @@ public class KwsEnterpriseController {
     }
 
     /**
+     * 平台运营端审核
      * @param {entId 企业id、status状态0正常1锁定、remark 审批意见}
      * @return HttpResult
      * @description 企业审批
@@ -325,6 +330,7 @@ public class KwsEnterpriseController {
     public HttpResult findAllEnterprise() {
         return kwsEntService.findAllEnterprise();
     }
+
     /**
      * @desc: 入驻认证/客户列表导出
      * @author: czh
@@ -343,4 +349,31 @@ public class KwsEnterpriseController {
         return BaseResult.success(kwsEntService.queryEntInfo(req));
     }
 
+    /**
+     * 查询企业信息
+     * @param entName
+     * @return
+     */
+    @GetMapping("/query")
+    public BaseResult<EntInfo> query(@RequestParam("entName") String entName) {
+        return BaseResult.success(kwsEntService.queryEnt(entName));
+    }
+
+    /**
+     * 查询企业及子企业数据
+     * @return
+     */
+    @GetMapping("/child")
+    public BaseResult<List<EntBaseInfo>> child() {
+        return BaseResult.success(kwsEntService.childEnt());
+    }
+    /**
+     * 查询企业及子企业数据
+     * @return
+     */
+    @GetMapping("/list")
+    public BaseResult<List<EntBaseInfo>> list() {
+        return BaseResult.success(kwsEntService.list());
+    }
+
 }

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

@@ -175,6 +175,8 @@ public class KwsUserController {
     }
 
     /**
+     * 企业端,企业用户注册和资质认证接口
+     *
      * @param reqVo 注册
      * @return HttpResult
      * @desc: 用户注册
@@ -184,8 +186,6 @@ public class KwsUserController {
     @PostMapping("/register")
     public HttpResult register(@Valid @RequestBody RegisterReqDto reqVo, HttpServletRequest request,
                                @RequestHeader(name = "System-Type", required = true) int systemType) {
-        String accessSpecial = request.getHeader("Access-Special");
-        reqVo.setSpecial(accessSpecial);
         reqVo.setSystemType(systemType);
         String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_REGISTER.getValue(), reqVo.getPhone());
         String sms = RedissonUtils.getString(key);
@@ -254,6 +254,7 @@ public class KwsUserController {
         kwsUserService.test(Collections.singletonList(1));
         return HttpResult.ok(HttpStatus.MSG_004);
     }
+
     /**
      * 查询供应方的销售信息
      */

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

@@ -68,4 +68,5 @@ public interface KwsEntCertificateDao {
     List<KwsEntCertificate> findByEntType(@Param(value = "entId") Long entId, @Param(value = "type") Integer type);
 
     List<KwsEntCertificate> findPrevious(@Param(value = "entId") Long entId, @Param(value = "type") Integer type);
-}
+
+}

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

@@ -8,6 +8,8 @@ import com.sckw.system.model.pojo.FindEntUserPojo;
 import com.sckw.system.model.pojo.FindManagePojo;
 import com.sckw.system.model.pojo.FindPojoParam;
 import com.sckw.system.model.vo.req.FindListReqVo;
+import com.sckw.system.model.vo.res.EntBaseInfo;
+import com.sckw.system.model.vo.res.EntInfo;
 import com.sckw.system.model.vo.res.FindEntListResVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -29,7 +31,7 @@ public interface KwsEnterpriseDao extends BaseMapper<KwsEnterprise> {
      * @param record
      * @return
      */
-    int insert(KwsEnterprise record);
+//    int insert(KwsEnterprise record);
 
     /**
      * 更新
@@ -150,7 +152,7 @@ public interface KwsEnterpriseDao extends BaseMapper<KwsEnterprise> {
      * @author: czh
      * @date: 2023/6/29
      */
-    FindManagePojo findManageInfoByEntIdBeforeApproval(Long entId);
+    List<Long> findManageInfoByEntIdBeforeApproval(Long entId);
 
     /**
      * @param params 参数
@@ -228,4 +230,8 @@ public interface KwsEnterpriseDao extends BaseMapper<KwsEnterprise> {
     List<KwsEnterprise> queryEnterpriseByEntIds(@Param("entIds") List<Long> entIds);
 
     KwsEnterprise findEnterpriseByName(@Param("enterpriseName") String enterpriseName);
-}
+
+    EntInfo query(@Param("entName") String entName);
+
+    List<EntBaseInfo> queryCte(Long entId);
+}

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

@@ -21,7 +21,7 @@ public interface KwsRoleDao extends BaseMapper<KwsRole> {
      * @param record
      * @return
      */
-    int insert(KwsRole record);
+//    int insert(KwsRole record);
 
     /**
      * 更新

+ 5 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserDao.java

@@ -24,14 +24,14 @@ public interface KwsUserDao extends BaseMapper<KwsUser> {
      * @param record
      * @return
      */
-    int insert(KwsUser record);
+//    int insert(KwsUser record);
 
     /**
      * 更新
      * @param record
      * @return
      */
-    int update(KwsUser record);
+//    int update(KwsUser record);
 
     /**
      * 详情查询
@@ -115,4 +115,7 @@ public interface KwsUserDao extends BaseMapper<KwsUser> {
     List<KwsUserSystemTypeVo> selectUserBySystemTypeAndMain(@Param("systemType") Integer systemType,@Param("isMain")Integer isMain);
 
     List<KwsUser> selectManager();
+
+    KwsUserResVo queryUser(Map<String, Object> params);
+
 }

+ 9 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsUserRoleDao.java

@@ -2,6 +2,7 @@ package com.sckw.system.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.system.model.KwsUserRole;
+import com.sckw.system.api.model.dto.res.RoleInfoDto;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -9,13 +10,15 @@ import java.util.List;
 
 /**
  * 用户角色关联信息
+ *
  * @author zk
  * @date 2023-05-31
  */
 @Mapper
-public interface  KwsUserRoleDao extends BaseMapper<KwsUserRole> {
+public interface KwsUserRoleDao extends BaseMapper<KwsUserRole> {
     /**
      * 新增
+     *
      * @param record
      * @return
      */
@@ -23,6 +26,7 @@ public interface  KwsUserRoleDao extends BaseMapper<KwsUserRole> {
 
     /**
      * 更新
+     *
      * @param record
      * @return
      */
@@ -30,6 +34,7 @@ public interface  KwsUserRoleDao extends BaseMapper<KwsUserRole> {
 
     /**
      * 详情查询
+     *
      * @param id
      * @return
      */
@@ -37,6 +42,7 @@ public interface  KwsUserRoleDao extends BaseMapper<KwsUserRole> {
 
     /**
      * 批量新增
+     *
      * @param list
      * @return
      */
@@ -79,4 +85,6 @@ public interface  KwsUserRoleDao extends BaseMapper<KwsUserRole> {
     List<KwsUserRole> findAllByRoleIds(List<Long> list);
 
     List<KwsUserRole> findAllByUserIds(@Param("userIds") List<Long> userIds);
+
+    List<RoleInfoDto> queryRoleList(@Param("userId") Long userId);
 }

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

@@ -42,8 +42,8 @@ public class RemoteBaseService {
     @Resource
     private KwsAuthorityDao kwsAuthorityDao;
 
-    @Resource
-    private KwsDeptService kwsDeptService;
+//    @Resource
+//    private KwsDeptService kwsDeptService;
 
     @Resource
     private KwsUserService kwsUserService;
@@ -128,16 +128,16 @@ public class RemoteBaseService {
         return BeanUtils.copyToList(kwsEntCheckTracks, EntCheckTrackResDto.class);
     }
 
-    public List<DeptInfoPojo> queryDeftInfoByEntId(long entId) {
-        KwsDept kwsDept = new KwsDept();
-        kwsDept.setEntId(entId);
-        kwsDept.setDelFlag(Global.NO);
-        List<KwsDeptResVo> list = kwsDeptService.findList(kwsDept);
-        if (CollectionUtils.isEmpty(list)) {
-            return Collections.emptyList();
-        }
-        return BeanUtils.copyToList(list, DeptInfoPojo.class);
-    }
+//    public List<DeptInfoPojo> queryDeftInfoByEntId(long entId) {
+//        KwsDept kwsDept = new KwsDept();
+//        kwsDept.setEntId(entId);
+//        kwsDept.setDelFlag(Global.NO);
+//        List<KwsDeptResVo> list = kwsDeptService.findList(kwsDept);
+//        if (CollectionUtils.isEmpty(list)) {
+//            return Collections.emptyList();
+//        }
+//        return BeanUtils.copyToList(list, DeptInfoPojo.class);
+//    }
 
     public List<KwsEnterprise> findEnts(Map<String, Object> params) {
         return kwsEnterpriseService.findEnts(params);

+ 19 - 15
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -364,7 +364,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
         EntCacheResDto entCacheResDto = new EntCacheResDto();
         BeanUtils.copyProperties(kwsEnterpriseResDto, entCacheResDto);
-        entCacheResDto.setDeptInfo(remoteBaseService.queryDeftInfoByEntId(entId));
+//        entCacheResDto.setDeptInfo(remoteBaseService.queryDeftInfoByEntId(entId));
         entCacheResDto.setCertificateInfo(remoteBaseService.queryCertificateByEntId(entId));
         KwsUser kwsUser = remoteBaseService.queryManageByEntId(entId);
         if (Objects.nonNull(kwsUser)) {
@@ -392,7 +392,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         if (StringUtils.isBlank(entName)) {
             return Collections.emptyList();
         }
-        List<KwsEnterprise> kwsEnterprises = remoteBaseService.findEnts(new HashMap<>(Global.NUMERICAL_SIXTEEN){{put("firmName", entName);}});
+        List<KwsEnterprise> kwsEnterprises = remoteBaseService.findEnts(new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
+            put("firmName", entName);
+        }});
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
             return Collections.emptyList();
         }
@@ -455,7 +457,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
     @Override
     public List<KwsEntDeptDto> queryEntDeptByPid(Long entPid) {
         List<KwsEntDeptDto> entDeptDtos = new ArrayList<>();
-        List<KwsEntDept> entDepts = remoteBaseService.queryEntDeptCacheByIds(new ArrayList<>(){{add(entPid);}});
+        List<KwsEntDept> entDepts = remoteBaseService.queryEntDeptCacheByIds(new ArrayList<>() {{
+            add(entPid);
+        }});
         if (CollectionUtils.isEmpty(entDepts)) {
             return entDeptDtos;
         }
@@ -792,18 +796,17 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         if (Objects.isNull(systemType) || StringUtils.isBlank(account)) {
             return null;
         }
-        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
             put("account", account);
             put("systemType", systemType);
         }};
-        List<KwsUserResVo> users = kwsUserService.findList(params);
-        if (CollectionUtils.isEmpty(users)) {
-            return null;
+        KwsUserResVo userResVo = kwsUserService.queryUserRole(params);
+        if (Objects.nonNull(userResVo)) {
+            KwsUserResDto userResDto = new KwsUserResDto();
+            BeanUtils.copyPropertiesValue(userResVo, userResDto);
+            return userResDto;
         }
-        KwsUserResVo userResVo = users.get(Global.NUMERICAL_ZERO);
-        KwsUserResDto userResDto = new KwsUserResDto();
-        BeanUtils.copyPropertiesValue(userResVo, userResDto);
-        return userResDto;
+        return null;
     }
 
     /**
@@ -824,7 +827,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      * @date 2023/12/16
      **/
     @Override
-    public List<Long> queryEntIdsByCode(String code, String type){
+    public List<Long> queryEntIdsByCode(String code, String type) {
         return remoteBaseService.findEntIdsByCode(code, type);
     }
 
@@ -852,12 +855,13 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     /**
      * 企业名称 精确查询企业
+     *
      * @param enterpriseName
      * @return
      */
     @Override
     public KwsEnterpriseResDto findEnterpriseByName(String enterpriseName) {
-        KwsEnterpriseResDto dto= remoteBaseService.findEnterpriseByName(enterpriseName);
+        KwsEnterpriseResDto dto = remoteBaseService.findEnterpriseByName(enterpriseName);
         return dto;
     }
 
@@ -871,12 +875,12 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public PageDataResult<KwsEnterpriseResDto> pageEnt(int pageNum, int pageSize, Long entId) {
-          return remoteBaseService.pageEnt( pageNum,  pageSize,  entId);
+        return remoteBaseService.pageEnt(pageNum, pageSize, entId);
     }
 
     @Override
     public KwsEnterpriseResDto queryEnterpriseByEntId(Long entId) {
-       return remoteBaseService.queryEnterpriseById(entId);
+        return remoteBaseService.queryEnterpriseById(entId);
     }
 
 }

+ 41 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java

@@ -1,5 +1,6 @@
 package com.sckw.system.dubbo;
 
+import cn.hutool.core.collection.CollUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
@@ -18,6 +19,7 @@ import com.sckw.system.model.pojo.FindEntUserPojo;
 import com.sckw.system.model.pojo.FindMenuTreePojo;
 import com.sckw.system.model.vo.req.FindListReqVo;
 import com.sckw.system.model.vo.req.ForgetPasswordReqVo;
+import com.sckw.system.model.vo.res.EntBaseInfo;
 import com.sckw.system.model.vo.res.KwsMenuResVo;
 import com.sckw.system.model.vo.res.KwsUserResVo;
 import com.sckw.system.model.vo.res.KwsUserSystemTypeVo;
@@ -154,7 +156,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
             return;
         }
         kwsEnterprise.setManager(userId);
-        if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
+        if (kwsEnterpriseDao.updateById(kwsEnterprise) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
         }
     }
@@ -395,7 +397,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
     public List<Long> selectUserBySystemType(Integer systemType) {
         List<Long> userIds = null;
         //List<KwsUserSystemTypeVo> userBySystemType = userDao.selectUserBySystemType(1);
-        List<KwsUserSystemTypeVo> userBySystemType = userDao.selectUserBySystemTypeAndMain(1,0);
+        List<KwsUserSystemTypeVo> userBySystemType = userDao.selectUserBySystemTypeAndMain(1, 0);
         if (!org.springframework.util.CollectionUtils.isEmpty(userBySystemType) && userBySystemType.size() > 0) {
             userIds = userBySystemType.stream().map(KwsUserSystemTypeVo::getId).distinct().collect(Collectors.toList());
         }
@@ -417,6 +419,43 @@ public class RemoteUserServiceImpl implements RemoteUserService {
         return entIds;
     }
 
+    @Override
+    public List<Long> findChildEntList(Long entId) {
+        List<EntBaseInfo> entBaseInfos = kwsEnterpriseDao.queryCte(entId);
+        if (CollUtil.isNotEmpty(entBaseInfos)) {
+            return entBaseInfos.stream().map(EntBaseInfo::getId).toList();
+        }
+        return new ArrayList<>();
+    }
+
+    @Override
+    public List<Long> findEntListByUserId(Long userId) {
+        List<Long> enterpriseIds = new ArrayList<>();
+        KwsUser kwsUser = userDao.selectByKey(userId);
+        if (Global.YES == kwsUser.getIsMain()) {
+            List<Long> enterpriseIdList = findAllEnterprise();
+            enterpriseIds.addAll(enterpriseIdList);
+        } else {
+            List<KwsUserRole> userRoles = userRoleDao.findAllByUserId(userId);
+            if (!org.springframework.util.CollectionUtils.isEmpty(userRoles) && userRoles.size() > 0) {
+                List<Long> roleIds = userRoles.stream().map(KwsUserRole::getRoleId).distinct().collect(Collectors.toList());
+//            enterpriseIds = kwsEnterpriseDao.findEnterpriseIdsByUserRoleId(userId);
+                List<Long> idsByUserRoleIds = kwsEnterpriseDao.findEnterpriseIdsByUserRoleIds(userId, roleIds);
+                if (idsByUserRoleIds.size() > 0) {
+                    enterpriseIds.addAll(idsByUserRoleIds);
+                }
+            }
+            List<Long> entIds = kwsEnterpriseDao.findEnterpriseIdsByUserIds(Collections.singletonList(userId));
+            if (entIds.size() > 0) {
+                enterpriseIds.addAll(entIds);
+            }
+        }
+        if (CollectionUtils.isNotEmpty(enterpriseIds) && enterpriseIds.size() > 0) {
+            enterpriseIds = enterpriseIds.stream().distinct().collect(Collectors.toList());
+        }
+        return enterpriseIds;
+    }
+
     /**
      * 根据用户名查用户信息
      *

+ 2 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEntType.java

@@ -17,8 +17,8 @@ public class KwsEntType extends BaseModel {
     private Long entId;
 
     /**
-     * 用户类型(1供应商,2采购商,34PL物流,43PL物流
+     * 类型(1供应商,2采购商,3物流属性
      */
     private Integer type;
 
-}
+}

+ 10 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEnterprise.java

@@ -2,16 +2,25 @@ package com.sckw.system.model;
 
 import com.sckw.core.model.base.BaseModel;
 import lombok.Data;
+
 import java.util.Date;
 
 /**
  * 企业信息
+ *
  * @author zk
  * @date 2023-06-02
  */
 @Data
 public class KwsEnterprise extends BaseModel {
-
+    /**
+     * 父级企业id
+     */
+    private Long pid;
+    /**
+     * 统一社会信用代码
+     */
+    private String creditCode;
     /**
      * 企业编号
      */

+ 1 - 5
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsRole.java

@@ -16,14 +16,10 @@ public class KwsRole extends BaseModel {
      */
     private String name;
 
-    /**
-     * 当前单位id,可以是机构也可以是企业,目前产品设计是企业
-     */
-    private Long deptId;
     /**
      * 企业id
      */
     @TableField("ent_id")
     private Long entId;
 
-}
+}

+ 4 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsUser.java

@@ -2,12 +2,14 @@ package com.sckw.system.model;
 
 import com.sckw.core.model.base.BaseModel;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 /**
  * 用户
  * @author zk
  * @date 2023-05-31
  */
+@EqualsAndHashCode(callSuper = true)
 @Data
 public class KwsUser extends BaseModel {
 
@@ -15,7 +17,7 @@ public class KwsUser extends BaseModel {
      * 系统类型(1运营端、2企业开户)
      */
     private Integer systemType;
-
+    private Long entId;
     /**
      * 账号
      */
@@ -61,4 +63,4 @@ public class KwsUser extends BaseModel {
      */
     private String salt;
 
-}
+}

+ 3 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/AddEntSettleReqVo.java

@@ -1,5 +1,6 @@
 package com.sckw.system.model.vo.req;
 
+import cn.hutool.core.collection.CollUtil;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
 import jakarta.validation.constraints.Size;
@@ -8,6 +9,7 @@ import lombok.Data;
 import java.io.Serial;
 import java.io.Serializable;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * @desc: 企业新增入驻入参
@@ -137,4 +139,5 @@ public class AddEntSettleReqVo implements Serializable {
      */
     private List<BusinessLicense> businessLicense;
 
+
 }

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

@@ -20,7 +20,8 @@ public class EditRoleReqVo implements Serializable {
     private static final long serialVersionUID = 1977281964220931297L;
 
     private Long id;
-
+    @NotNull(message = "企业id不能为空")
+    private Long entId;
     /**
      * 角色名称
      */

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

@@ -17,7 +17,7 @@ public class FindMenuTreeReqVo implements Serializable {
     private static final long serialVersionUID = -5817342886374780336L;
 
     /**
-     * 客户端类型
+     * 客户端类型 3-app端菜单,平台运营端需要查询
      */
     private String clientType;
 

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

@@ -23,6 +23,8 @@ public class UserAddReqVo implements Serializable {
      * 主键
      */
     private Long id;
+    @NotNull(message = "企业id不能为空")
+    private Long entId;
 
     /**
      * 系统类型(1运营端、2企业开户)
@@ -75,7 +77,7 @@ public class UserAddReqVo implements Serializable {
     /**
      * 机构id
      */
-    @NotNull(message = "机构不能为空")
+//    @NotNull(message = "机构不能为空")
     private Long deptId;
 
     /**

+ 27 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntBaseInfo.java

@@ -0,0 +1,27 @@
+package com.sckw.system.model.vo.res;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author xucaiqin
+ * @date 2025-11-06 10:18:59
+ */
+@Getter
+@Setter
+public class EntBaseInfo {
+    @Schema(description = "企业id")
+    private Long id;
+    /**
+     * 企业id
+     */
+    @Schema(description = "企业id")
+    private Long pid;
+
+    /**
+     * 企业名称
+     */
+    @Schema(description = "企业名称")
+    private String firmName;
+}

+ 9 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntDetailResVo.java

@@ -16,11 +16,19 @@ public class EntDetailResVo implements Serializable {
 
     @Serial
     private static final long serialVersionUID = -7056667255439191707L;
-
+    /**
+     * 父级企业id
+     */
+    private Long pid;
+    private String pEntName;
     /**
      * 企业编号
      */
     private String code;
+    /**
+     * 统一社会信用代码
+     */
+    private String creditCode;
 
     /**
      * 企业名称

+ 1 - 13
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntFindPageResVo.java

@@ -127,18 +127,6 @@ public class EntFindPageResVo implements Serializable {
      * 客户经理
      */
     private String managerName;
-    /**
-     * 专场id
-     */
-    private Long special;
-    /**
-     * 专场名称
-     */
-    private String specialName;
-    /**
-     * 是否是专场组
-     */
-    private boolean specialGroup;
 
     /**
      * 创建时间
@@ -163,5 +151,5 @@ public class EntFindPageResVo implements Serializable {
 
     private String ent3;
 
-    private String ent4;
+//    private String ent4;
 }

+ 25 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntInfo.java

@@ -0,0 +1,25 @@
+package com.sckw.system.model.vo.res;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author xucaiqin
+ * @date 2025-11-06 10:18:59
+ */
+@Getter
+@Setter
+public class EntInfo {
+    /**
+     * 企业id
+     */
+    @Schema(description = "企业id")
+    private String entId;
+
+    /**
+     * 企业名称
+     */
+    @Schema(description = "企业名称")
+    private String entName;
+}

+ 6 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/KwsUserResVo.java

@@ -2,11 +2,13 @@ package com.sckw.system.model.vo.res;
 
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.sckw.core.utils.LongToStringUtils;
+import com.sckw.system.api.model.dto.res.RoleInfoDto;
 import lombok.Data;
 
 import java.io.Serial;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author czh
@@ -85,6 +87,7 @@ public class KwsUserResVo implements Serializable {
      */
     @JsonSerialize(using = LongToStringUtils.class)
     private Long deptId;
+    private String entName;
 
     /**
      * 角色id
@@ -97,6 +100,8 @@ public class KwsUserResVo implements Serializable {
      */
     @JsonSerialize(using = LongToStringUtils.class)
     private Long entId;
+    private List<Long> roleIdList;
+    private List<String> roleNameList;
 
     /**
      * 机构名
@@ -127,5 +132,6 @@ public class KwsUserResVo implements Serializable {
      * 修改时间
      */
     private Date updateTime;
+    private List<RoleInfoDto> roleInfoDto;
 
 }

+ 5 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/RoleResVo.java

@@ -24,7 +24,9 @@ public class RoleResVo implements Serializable {
      * 角色名称
      */
     private String name;
-
+    private String entId;
+    private String entName;
+    private Integer count;
     /**
      * 当前单位id,可以是机构也可以是企业,目前产品设计是企业
      */
@@ -54,7 +56,7 @@ public class RoleResVo implements Serializable {
     /**
      * 创建时间
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createTime;
 
     /**
@@ -66,7 +68,7 @@ public class RoleResVo implements Serializable {
     /**
      * 更新时间
      */
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date updateTime;
 
     /**

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

@@ -102,41 +102,41 @@ public class CommonService {
     }
 
 
-    public void test() {
-        List<FindEntListResVo> list = kwsEnterpriseDao.findList(null);
-        KwsMenu kwsMenu = new KwsMenu();
-        kwsMenu.setClientType(2);
-        kwsMenu.setDelFlag(Global.NO);
-        List<KwsMenu> select = kwsMenuDao.select(kwsMenu);
-        for (FindEntListResVo findEntListResVo : list) {
-            Long id = findEntListResVo.getId();
-
-            List<KwsMenuRights> currrent =  kwsMenuRightsDao.selectEntMenus(id);
-            if (CollectionUtils.isNotEmpty(currrent)) {
-                continue;
-            }
-            Long userId = findEntListResVo.getUserId();
-            if (Objects.isNull(userId)) {
-                userId = 0L;
-            }
-            List<KwsMenuRights> kwsMenuRightsList = new ArrayList<>();
-            Date date = new Date();
-            for (KwsMenu kwsMenu1 : select) {
-                KwsMenuRights kwsMenuRights = new KwsMenuRights();
-                kwsMenuRights.setEntId(id);
-                kwsMenuRights.setMenuId(kwsMenu1.getId());
-                kwsMenuRights.setId(new IdWorker(1L).nextId());
-                kwsMenuRights.setStatus(0);
-                kwsMenuRights.setCreateBy(userId);
-                kwsMenuRights.setCreateTime(date);
-                kwsMenuRights.setUpdateBy(userId);
-                kwsMenuRights.setUpdateTime(date);
-                kwsMenuRights.setDelFlag(0);
-                kwsMenuRightsList.add(kwsMenuRights);
-            }
-            kwsMenuRightsDao.saveBatch(kwsMenuRightsList);
-        }
-    }
+//    public void test() {
+//        List<FindEntListResVo> list = kwsEnterpriseDao.findList(null);
+//        KwsMenu kwsMenu = new KwsMenu();
+//        kwsMenu.setClientType(2);
+//        kwsMenu.setDelFlag(Global.NO);
+//        List<KwsMenu> select = kwsMenuDao.select(kwsMenu);
+//        for (FindEntListResVo findEntListResVo : list) {
+//            Long id = findEntListResVo.getId();
+//
+//            List<KwsMenuRights> currrent =  kwsMenuRightsDao.selectEntMenus(id);
+//            if (CollectionUtils.isNotEmpty(currrent)) {
+//                continue;
+//            }
+//            Long userId = findEntListResVo.getUserId();
+//            if (Objects.isNull(userId)) {
+//                userId = 0L;
+//            }
+//            List<KwsMenuRights> kwsMenuRightsList = new ArrayList<>();
+//            Date date = new Date();
+//            for (KwsMenu kwsMenu1 : select) {
+//                KwsMenuRights kwsMenuRights = new KwsMenuRights();
+//                kwsMenuRights.setEntId(id);
+//                kwsMenuRights.setMenuId(kwsMenu1.getId());
+//                kwsMenuRights.setId(new IdWorker(1L).nextId());
+//                kwsMenuRights.setStatus(0);
+//                kwsMenuRights.setCreateBy(userId);
+//                kwsMenuRights.setCreateTime(date);
+//                kwsMenuRights.setUpdateBy(userId);
+//                kwsMenuRights.setUpdateTime(date);
+//                kwsMenuRights.setDelFlag(0);
+//                kwsMenuRightsList.add(kwsMenuRights);
+//            }
+//            kwsMenuRightsDao.saveBatch(kwsMenuRightsList);
+//        }
+//    }
 
 
     public void sendSystemMessage(List<UserInfo> userInfos, MessageEnum messageEnum, Map<String, Object> map, String msgUrl, String appMsgUrl) {

+ 150 - 238
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -1,6 +1,8 @@
 package com.sckw.system.service;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -168,7 +170,7 @@ public class KwsEnterpriseService {
             if (kwsEnterprise.getApproval().equals(ApprovalEnum.PROCESS.getCode())) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_033);
             }
-            if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
+            if (kwsEnterpriseDao.updateById(kwsEnterprise) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
             }
         }
@@ -201,7 +203,7 @@ public class KwsEnterpriseService {
         if (Objects.nonNull(sysArea)) {
             kwsEnterprise.setCityName(sysArea.getMergerName());
         }
-        if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
+        if (kwsEnterpriseDao.updateById(kwsEnterprise) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
@@ -243,16 +245,11 @@ public class KwsEnterpriseService {
      * @date: 2023/6/9
      */
     public PageResult findPage(EntFindPageReqVo reqVo) {
-        PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
         List<EntFindPageResVo> result = new ArrayList<>();
-//        List<FindEntListPojo> list = findPojo(reqVo);
-        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
-        if (authEntIdList.size() < 1) {
-            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
-            if (ids.size() < 1) {
-                return PageHelperUtil.getPageResult(new PageInfo<>(result));
-            }
-        }
+        List<Long> authEntIdList = Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? new ArrayList<>() : LoginUserHolder.getAuthEntIdList();
+
+
+        PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
         List<FindEntListPojo> list = findPojoManager(reqVo, authEntIdList);
         if (CollectionUtils.isEmpty(list)) {
             return PageHelperUtil.getPageResult(new PageInfo<>(result));
@@ -270,28 +267,7 @@ public class KwsEnterpriseService {
                 KwsUser kwsUser = userDao.selectByKey(entFindPageResVo.getManager());
                 entFindPageResVo.setManagerName(kwsUser == null ? null : kwsUser.getName());
             }
-            Long id = item.getId();
-            List<KwsEntSpecial> entSpecials = entSpecialDao.findList(new HashMap<>() {{
-                put("entId", id);
-            }});
-            if (CollectionUtils.isNotEmpty(entSpecials)) {
-                KwsEntSpecial kwsEntSpecial = entSpecials.get(0);
-                entFindPageResVo.setSpecial(kwsEntSpecial.getId().longValue());
-                Long specialId = kwsEntSpecial.getSpecialId();
-                KwsSpecial kwsSpecial = specialDao.selectOne(new LambdaQueryWrapper<KwsSpecial>()
-                        .eq(KwsSpecial::getId, specialId).eq(KwsSpecial::getDelFlag, NumberConstant.ZERO)
-                );
-                entFindPageResVo.setSpecialName(kwsSpecial == null ? null : kwsSpecial.getName());
-                entFindPageResVo.setSpecialGroup(false);
-            }
-            List<KwsSpecial> kwsSpecials = specialDao.selectList(new LambdaQueryWrapper<KwsSpecial>()
-                    .eq(KwsSpecial::getEntId, id).eq(KwsSpecial::getDelFlag, NumberConstant.ZERO)
-            );
-            if (kwsSpecials.size() > 0) {
-                KwsSpecial kwsSpecial = kwsSpecials.get(0);
-                entFindPageResVo.setSpecialName(kwsSpecial.getName());
-                entFindPageResVo.setSpecialGroup(true);
-            }
+
             result.add(entFindPageResVo);
         }
         return PageHelperUtil.getPageResult(new PageInfo<>(result), list, reqVo.getPageSize());
@@ -355,11 +331,10 @@ public class KwsEnterpriseService {
 
 
     /**
-     * 新增企业(注册)
+     * 新增企业(注册),修改企业信息
      */
     @Transactional(rollbackFor = Exception.class)
     public void register(EntRegisterReqVo reqVo) {
-        checkRegisterParam(reqVo);
 
         /*1、存企业信息表*/
         KwsEnterprise kwsEnterprise = kwsEnterpriseDao.selectByKey(reqVo.getEntId());
@@ -371,10 +346,18 @@ public class KwsEnterpriseService {
         if (approval.equals(ApprovalEnum.PROCESS.getCode()) || approval.equals(ApprovalEnum.REFRESH.getCode())) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_026);
         }
-
+        //校验统一社会信用代码
+        KwsEnterprise kwsEnterprise1 = kwsEnterpriseDao.selectOne(new LambdaQueryWrapper<KwsEnterprise>()
+                .eq(KwsEnterprise::getCreditCode, reqVo.getOrgCode())
+                .eq(KwsEnterprise::getStatus, 0)
+                .eq(KwsEnterprise::getDelFlag, Global.UN_DELETED));
+        if (Objects.nonNull(kwsEnterprise1) && !Objects.equals(kwsEnterprise1.getId(), reqVo.getEntId())) {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.ENT_CODE);
+        }
         Long entId = kwsEnterprise.getId();
         Date date = new Date();
         Long userId = LoginUserHolder.getUserId();
+        kwsEnterprise.setCreditCode(reqVo.getOrgCode());//统一社会信用代码
         kwsEnterprise.setCode(reqVo.getCode());
         kwsEnterprise.setLegalName(reqVo.getLegalName());
         kwsEnterprise.setLegalPhone(reqVo.getLegalPhone());
@@ -399,37 +382,22 @@ public class KwsEnterpriseService {
         kwsEnterprise.setUpdateBy(LoginUserHolder.getUserId());
 
         //客户经理
-        Integer systemType = LoginUserHolder.getSystemType();
-        if (Objects.equals(SystemTypeEnum.MANAGE.getCode(), systemType)) {
-            kwsEnterprise.setManager(LoginUserHolder.getUserId());
-        } else {
-            if (StringUtils.isNotBlank(reqVo.getSpecial())) {
-                List<KwsSpecial> specials = kwsSpecialService.findList(new HashMap<>(){{put("code", reqVo.getSpecial());}});
-                if (CollectionUtils.isNotEmpty(specials)) {
-                    KwsSpecial special = specials.get(NumberConstant.ZERO);
-                    kwsEnterprise.setManager(special.getManager());
-                    //专场平台注册自动加入专场
-                    if (special.getIsMain() == NumberConstant.ZERO) {
-                        KwsEntSpecial entSpecial = new KwsEntSpecial();
-                        entSpecial.setSpecialId(special.getId());
-                        entSpecial.setEntId(entId);
-                        kwsSpecialService.joinSpecial(entSpecial);
-                    }
-                }
-            } else {
-                //默认给一个客户经理(admin账号)-公共平台
-                List<KwsUserSystemTypeVo> userSystemTypeVos = userDao.selectUserBySystemType(SystemTypeEnum.MANAGE.getCode());
-                if (CollectionUtils.isNotEmpty(userSystemTypeVos)) {
-                    KwsUserSystemTypeVo kwsUserSystemTypeVo = userSystemTypeVos.get(0);
-                    kwsEnterprise.setManager(kwsUserSystemTypeVo.getId());
-                }
-            }
-        }
+//        Integer systemType = LoginUserHolder.getSystemType();
+//        if (Objects.equals(SystemTypeEnum.MANAGE.getCode(), systemType)) {
+//            kwsEnterprise.setManager(LoginUserHolder.getUserId());
+//        } else {
+//            //默认给一个客户经理(admin账号)-公共平台
+//            List<KwsUserSystemTypeVo> userSystemTypeVos = userDao.selectUserBySystemType(SystemTypeEnum.MANAGE.getCode());
+//            if (CollectionUtils.isNotEmpty(userSystemTypeVos)) {
+//                KwsUserSystemTypeVo kwsUserSystemTypeVo = userSystemTypeVos.get(0);
+//                kwsEnterprise.setManager(kwsUserSystemTypeVo.getId());
+//            }
+//        }
 
         //更新缓存
         List<Long> enterpriseIds = new ArrayList<>();
-        if (LoginUserHolder.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
-            if (LoginUserHolder.getIsMain().equals(Global.YES)) {
+        if (Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode())) {
+            if (Objects.equals(LoginUserHolder.getIsMain(), Global.YES)) {
                 //获取所有企业id
                 List<Long> enterpriseIdList = remoteUserService.findAllEnterprise();
                 if (Objects.nonNull(enterpriseIdList) && enterpriseIdList.size() > 0) {
@@ -464,7 +432,7 @@ public class KwsEnterpriseService {
 
         List<KwsEntCheckTrack> list = kwsEntCheckTrackDao.findList(entId);
         kwsEnterprise.setApproval(list.stream().anyMatch(item -> item.getStatus().equals(Global.NO)) ? ApprovalEnum.REFRESH.getCode() : ApprovalEnum.PROCESS.getCode());
-        if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
+        if (kwsEnterpriseDao.updateById(kwsEnterprise) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
@@ -474,27 +442,13 @@ public class KwsEnterpriseService {
         if (CollectionUtils.isNotEmpty(listByEntId)) {
             currentTypeList.addAll(listByEntId.stream().map(KwsEntType::getType).toList());
         }
-        List<Integer> typeList = Arrays.stream(reqVo.getEntTypes().split(Global.COMMA)).map(Integer::parseInt).toList();
-
-        if (typeList.contains(EntTypeEnum.LOGISTICS3.getCode()) && typeList.contains(EntTypeEnum.LOGISTICS4.getCode())) {
-            throw new SystemException(HttpStatus.CODE_10301, HttpStatus.PL34);
-        }
+        Integer type = Integer.parseInt(reqVo.getEntTypes());//只能单选
 
-        if (currentTypeList.contains(EntTypeEnum.LOGISTICS3.getCode()) && typeList.contains(EntTypeEnum.LOGISTICS4.getCode())) {
-            throw new SystemException(HttpStatus.CODE_10301, HttpStatus.PL34);
-        }
-
-        if (currentTypeList.contains(EntTypeEnum.LOGISTICS4.getCode()) && typeList.contains(EntTypeEnum.LOGISTICS3.getCode())) {
-            throw new SystemException(HttpStatus.CODE_10301, HttpStatus.PL34);
-        }
 
-        for (Integer item : typeList) {
-            if (currentTypeList.contains(item)) {
-                continue;
-            }
+        if (!currentTypeList.contains(type)) {
             KwsEntType kwsEntType = new KwsEntType();
             kwsEntType.setEntId(entId);
-            kwsEntType.setType(item);
+            kwsEntType.setType(type);
             kwsEntType.setId(new IdWorker(1).nextId());
             kwsEntType.setStatus(ApprovalEnum.PROCESS.getCode());
             kwsEntType.setCreateBy(userId);
@@ -535,40 +489,6 @@ public class KwsEnterpriseService {
             approvalReqVo.setRemark("");
             approval(approvalReqVo);
         }
-
-
-        //子公司不用新建机构、角色等,直接返回
-        Map<String, Object> map = CollectionUtils.createHashMap();
-        map.put("entName", kwsEnterprise.getFirmName());
-        map.put("createByName", kwsEnterprise.getContacts());
-        if (Objects.nonNull(reqVo.getEntPid())) {
-            KwsEntDept kwsEntDept = new KwsEntDept();
-            kwsEntDept.setEntId(entId);
-            kwsEntDept.setEntPid(reqVo.getEntPid());
-            kwsEntDept.setId(new IdWorker(1L).nextId());
-            if (kwsEntDeptDao.insert(kwsEntDept) <= 0) {
-                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
-            }
-
-            commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(userId).setEntId(reqVo.getEntPid())),
-                    MessageEnum.ENT_CERTIFICATE,
-                    map,
-                    entDeptUrl, "");
-        } else {
-            commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(userId).setEntId(entId)),
-                    MessageEnum.ENT_CERTIFICATE,
-                    map,
-                    entCertificateUrl, appEntCertificateUrl);
-        }
-    }
-
-    /**
-     * @param reqVo 注册入参
-     * @desc: 校验注册入参
-     * @author: czh
-     * @date: 2023/7/25
-     */
-    private void checkRegisterParam(EntRegisterReqVo reqVo) {
     }
 
 
@@ -631,41 +551,40 @@ public class KwsEnterpriseService {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
         }
 
-        KwsEntDept kwsEntDept = kwsEntDeptDao.selectByEntId(entId);
-        //主体机构不用走后面的流程
-        if (Objects.isNull(kwsEntDept)) {
-            /*第一次审批通过(非更新资质审批通过),构建机构角色等*/
-            if (ApprovalEnum.OK.getCode() == status) {
-                if (ApprovalEnum.PROCESS.getCode() == currentApproval) {
-                    /*审批通过,绑定角色*/
-                    FindManagePojo findManagePojo = kwsEnterpriseDao.findManageInfoByEntIdBeforeApproval(entId);
-                    if (Objects.isNull(findManagePojo)) {
-                        throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
-                    }
-                    KwsUser userByAccount = kwsUserService.getUserByAccount(kwsEnterprise.getPhone(), SystemTypeEnum.COMPANY.getCode());
-                    if (Objects.isNull(userByAccount)) {
-                        throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
-                    }
-                    kwsUserService.fillUserRole(String.valueOf(findManagePojo.getRoleId()), userByAccount.getId(), SystemTypeEnum.COMPANY.getCode());
+        /*第一次审批通过(非更新资质审批通过),构建机构角色等*/
+        if (ApprovalEnum.OK.getCode() == status) {
+            List<Long> roleList = kwsEnterpriseDao.findManageInfoByEntIdBeforeApproval(entId);
+            if (ApprovalEnum.PROCESS.getCode() == currentApproval) {
+                /*审批通过,绑定角色*/
+                if (CollUtil.isEmpty(roleList)) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
                 }
-
-                List<KwsMenuRights> kwsMenuRightsList = kwsMenuRightsDao.selectEntMenus(entId);
-                if (CollectionUtils.isNotEmpty(kwsMenuRightsList)) {
-                    kwsMenuRightsDao.deleteByIds(kwsMenuRightsList.stream().map(KwsMenuRights::getId).collect(Collectors.toList()));
+                KwsUser userByAccount = kwsUserService.queryUserInfo(kwsEnterprise.getPhone(), SystemTypeEnum.COMPANY.getCode());
+                if (Objects.isNull(userByAccount)) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
                 }
+                kwsUserService.fillUserRole(StrUtil.join(",", roleList), userByAccount.getId(), SystemTypeEnum.COMPANY.getCode());
+            }
+
+            List<KwsMenuRights> kwsMenuRightsList = kwsMenuRightsDao.selectEntMenus(entId);
+            if (CollectionUtils.isNotEmpty(kwsMenuRightsList)) {
+                kwsMenuRightsDao.deleteByIds(kwsMenuRightsList.stream().map(KwsMenuRights::getId).collect(Collectors.toList()));
+            }
 
-                List<KwsEntType> listByEntId = kwsEntTypeDao.findListByEntId(entId);
-                List<Integer> typeList = listByEntId.stream().map(KwsEntType::getType).toList();
-                List<KwsMenu> kwsMenus = kwsMenuDao.selectAll();
-                List<KwsMenuRights> kwsMenuRightsList2 = new ArrayList<>();
-                Date date = new Date();
-                for (Integer entType : typeList) {
-                    List<KwsMenu> collect = kwsMenus.stream().filter(item -> item.getUsingRoles().contains(String.valueOf(entType))).toList();
+            List<KwsEntType> listByEntId = kwsEntTypeDao.findListByEntId(entId);
+            List<Integer> typeList = listByEntId.stream().map(KwsEntType::getType).toList();
+            List<KwsMenu> kwsMenus = kwsMenuDao.selectAll();
+            List<KwsMenuRights> kwsMenuRightsList2 = new ArrayList<>();
+            Date date = new Date();
+            for (Integer entType : typeList) {
+                List<KwsMenu> collect = kwsMenus.stream().filter(item -> item.getUsingRoles().contains(String.valueOf(entType))).toList();
+                for (Long role : roleList) {
                     for (KwsMenu kwsMenu : collect) {
                         KwsMenuRights kwsMenuRights = new KwsMenuRights();
                         kwsMenuRights.setEntId(entId);
                         kwsMenuRights.setMenuId(kwsMenu.getId());
                         kwsMenuRights.setId(new IdWorker(1L).nextId());
+                        kwsMenuRights.setRoleId(role);
                         kwsMenuRights.setCreateBy(LoginUserHolder.getUserId());
                         kwsMenuRights.setUpdateBy(LoginUserHolder.getUserId());
                         kwsMenuRights.setCreateTime(date);
@@ -675,8 +594,8 @@ public class KwsEnterpriseService {
                         kwsMenuRightsList2.add(kwsMenuRights);
                     }
                 }
-                kwsMenuRightsDao.saveBatch(kwsMenuRightsList2);
             }
+            kwsMenuRightsDao.saveBatch(kwsMenuRightsList2);
         }
         commonService.updateEntCertificate(entId, BeanUtils.copyToList(kwsEntCertificates, EntCertificateInfo.class));
 
@@ -684,26 +603,26 @@ public class KwsEnterpriseService {
         map.put("entName", kwsEnterprise.getFirmName());
         map.put("createByName", LoginUserHolder.getUserName());
         MessageEnum messageEnum;
-        EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(entId);
+        EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(entId);
         if (Objects.isNull(entCacheResDto)) {
             return;
         }
 
         if (reqVo.getStatus().equals(ApprovalEnum.OK.getCode())) {
-            if (Objects.isNull(kwsEntDept)) {
+            if (Objects.equals(kwsEnterprise.getPid(), 0L)) {//母公司
                 messageEnum = MessageEnum.ENT_CERTIFICATE_PASS;
             } else {
                 messageEnum = MessageEnum.ENT_DEPT_CERTIFICATE_PASS;
             }
         } else {
-            if (Objects.isNull(kwsEntDept)) {
+            if (Objects.equals(kwsEnterprise.getPid(), 0L)) {
                 messageEnum = MessageEnum.ENT_CERTIFICATE_REFUSED;
             } else {
                 messageEnum = MessageEnum.ENT_DEPT_CERTIFICATE_REFUSED;
             }
         }
 
-        if (Objects.isNull(kwsEntDept)) {
+        if (Objects.equals(kwsEnterprise.getPid(), 0L)) {
             commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(entCacheResDto.getContactsId()).setEntId(entCacheResDto.getId())),
                     messageEnum,
                     map,
@@ -749,7 +668,7 @@ public class KwsEnterpriseService {
     public void freeze(FreezeReqVo reqVo) {
         KwsEnterprise kwsEnterprise = checkKwsEnterpriseById(reqVo.getId());
         kwsEnterprise.setStatus(reqVo.getStatus());
-        if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
+        if (kwsEnterpriseDao.updateById(kwsEnterprise) <= 0) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
     }
@@ -855,7 +774,7 @@ public class KwsEnterpriseService {
     public void addEntSettle(AddEntSettleReqVo reqVo) {
         checkAddEntSettleParam(reqVo);
         //运营端新增企业入驻,直接通过
-        if (Objects.isNull(reqVo.getEntPid())) {
+        if (LoginUserHolder.isManager()) {
             RegisterReqDto registerReqDto = new RegisterReqDto();
             registerReqDto.setEntName(reqVo.getFirmName());
             registerReqDto.setName(reqVo.getContacts());
@@ -868,39 +787,36 @@ public class KwsEnterpriseService {
             BeanUtils.copyProperties(reqVo, entRegisterReqVo);
             entRegisterReqVo.setEntId(register.getEntId());
             register(entRegisterReqVo);
-//            ApprovalReqVo approvalReqVo = new ApprovalReqVo();
-//            approvalReqVo.setEntId(register.getEntId());
-//            approvalReqVo.setStatus(ApprovalEnum.OK.getCode());
-//            approval(approvalReqVo);
-            return;
-        }
-
-        //主体机构
-        extracted(reqVo, new IdWorker(1L).nextId());
-    }
-
+        } else { //平台端,新增子公司
+            if (Objects.isNull(reqVo.getEntPid())) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.ENT_FAILED);
+            }
+            Long entId = new IdWorker(1L).nextId();
+            KwsEnterprise kwsEnterprise = new KwsEnterprise();
+            kwsEnterprise.setId(entId);
+            kwsEnterprise.setCode("");
+            kwsEnterprise.setPid(reqVo.getEntPid());
+            kwsEnterprise.setCreditCode(reqVo.getOrgCode());
+            kwsEnterprise.setOrgCode(reqVo.getOrgCode());
+            kwsEnterprise.setFirmName(reqVo.getFirmName());
+            kwsEnterprise.setApproval(ApprovalEnum.NO.getCode());
+            kwsEnterprise.setContacts(reqVo.getContacts());
+            kwsEnterprise.setPhone(reqVo.getPhone());
+            kwsEnterprise.setCreateBy(LoginUserHolder.getUserId());
+            kwsEnterprise.setUpdateBy(LoginUserHolder.getUserId());
+            kwsEnterprise.setCityCode(reqVo.getCityCode());
+            if (kwsEnterpriseDao.insert(kwsEnterprise) <= 0) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+            }
 
-    private void extracted(AddEntSettleReqVo reqVo, Long entId) {
-        KwsEnterprise kwsEnterprise = new KwsEnterprise();
-        kwsEnterprise.setId(entId);
-        kwsEnterprise.setCode("");
-        kwsEnterprise.setFirmName(reqVo.getFirmName());
-        kwsEnterprise.setApproval(ApprovalEnum.NO.getCode());
-        kwsEnterprise.setContacts(reqVo.getContacts());
-        kwsEnterprise.setPhone(reqVo.getPhone());
-        kwsEnterprise.setCreateBy(LoginUserHolder.getUserId());
-        kwsEnterprise.setUpdateBy(LoginUserHolder.getUserId());
-        kwsEnterprise.setCityCode(reqVo.getCityCode());
-        if (kwsEnterpriseDao.insert(kwsEnterprise) <= 0) {
-            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
+            EntRegisterReqVo entRegisterReqVo = new EntRegisterReqVo();
+            BeanUtils.copyProperties(reqVo, entRegisterReqVo);
+            entRegisterReqVo.setEntId(entId);
+            register(entRegisterReqVo);
         }
-
-        EntRegisterReqVo entRegisterReqVo = new EntRegisterReqVo();
-        BeanUtils.copyProperties(reqVo, entRegisterReqVo);
-        entRegisterReqVo.setEntId(entId);
-        register(entRegisterReqVo);
     }
 
+
     /**
      * @param reqVo 入参
      * @desc: 新增企业入驻入参校验
@@ -974,7 +890,7 @@ public class KwsEnterpriseService {
             KwsEnterprise kwsEnterprise = new KwsEnterprise();
             kwsEnterprise.setId(kwsEntCertificate.getEntId());
             kwsEnterprise.setApproval(ApprovalEnum.REFRESH.getCode());
-            kwsEnterpriseDao.update(kwsEnterprise);
+            kwsEnterpriseDao.updateById(kwsEnterprise);
         }
     }
 
@@ -998,22 +914,8 @@ public class KwsEnterpriseService {
      */
     public List<FindListGroupResVo> findListGroup(EntFindPageReqVo reqVo) {
         List<FindListGroupResVo> result = new ArrayList<>();
-        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
-        if (CollectionUtils.isEmpty(authEntIdList)) {
-            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
-            if (ids.size() < 1) {
-                List<Map<String, String>> defaultApprovalEnum = ApprovalEnum.getDefaultApprovalEnum();
-                for (Map<String, String> map : defaultApprovalEnum) {
-                    FindListGroupResVo vo = new FindListGroupResVo();
-                    vo.setApproval(Integer.parseInt(map.get("code")));
-                    vo.setApprovalName(map.get("name"));
-                    vo.setCount(NumberConstant.ZERO);
-                    result.add(vo);
-                }
-                return result;
-            }
-        }
-//        List<FindEntListPojo> list = findPojo(reqVo);
+        List<Long> authEntIdList = Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? new ArrayList<>() : LoginUserHolder.getAuthEntIdList();
+
         List<FindEntListPojo> list = findPojoManager(reqVo, authEntIdList);
         Map<Integer, List<FindEntListPojo>> collect = list.stream().collect(Collectors.groupingBy(FindEntListPojo::getApproval));
         FindListGroupResVo findListGroupResVo = new FindListGroupResVo();
@@ -1053,6 +955,11 @@ public class KwsEnterpriseService {
         }
         EntDetailResVo entDetailResVo = new EntDetailResVo();
         BeanUtils.copyProperties(kwsEnterprise, entDetailResVo);
+
+        KwsEnterprise kwsEnterprise1 = queryKwsEnterpriseById(kwsEnterprise.getPid());
+        if (Objects.nonNull(kwsEnterprise1)) {
+            entDetailResVo.setPEntName(kwsEnterprise1.getFirmName());
+        }
         FindManagePojo manageInfoByEntId = kwsEnterpriseDao.findManageInfoByEntId(kwsEnterprise.getId());
         if (Objects.nonNull(manageInfoByEntId)) {
             entDetailResVo.setContactsId(manageInfoByEntId.getUserId());
@@ -1146,24 +1053,25 @@ public class KwsEnterpriseService {
         queryCurrentOrganizationResVo.setPhone(entCacheResDto.getPhone());
         list.add(queryCurrentOrganizationResVo);
 
-        List<KwsEntDept> kwsEntDepts = kwsEntDeptDao.selectByEntPid(entId);
-        if (CollectionUtils.isNotEmpty(kwsEntDepts)) {
-            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.nonNull(entCacheResDto1)) {
-                    QueryCurrentOrganizationResVo queryCurrentOrganizationResVo1 = new QueryCurrentOrganizationResVo();
-                    queryCurrentOrganizationResVo1.setEntId(entCacheResDto1.getId());
-                    queryCurrentOrganizationResVo1.setEntName(entCacheResDto1.getFirmName());
-                    queryCurrentOrganizationResVo1.setPid(kwsEntDept.getEntPid());
-                    queryCurrentOrganizationResVo1.setContactsId(entCacheResDto1.getContactsId());
-                    queryCurrentOrganizationResVo1.setContacts(entCacheResDto1.getContacts());
-                    queryCurrentOrganizationResVo1.setPhone(entCacheResDto1.getPhone());
-                    list.add(queryCurrentOrganizationResVo1);
-                }
-            }
-        }
+        //todo-xcq 应该需要查询下级企业
+//        List<KwsEntDept> kwsEntDepts = kwsEntDeptDao.selectByEntPid(entId);
+//        if (CollectionUtils.isNotEmpty(kwsEntDepts)) {
+//            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.nonNull(entCacheResDto1)) {
+//                    QueryCurrentOrganizationResVo queryCurrentOrganizationResVo1 = new QueryCurrentOrganizationResVo();
+//                    queryCurrentOrganizationResVo1.setEntId(entCacheResDto1.getId());
+//                    queryCurrentOrganizationResVo1.setEntName(entCacheResDto1.getFirmName());
+//                    queryCurrentOrganizationResVo1.setPid(kwsEntDept.getEntPid());
+//                    queryCurrentOrganizationResVo1.setContactsId(entCacheResDto1.getContactsId());
+//                    queryCurrentOrganizationResVo1.setContacts(entCacheResDto1.getContacts());
+//                    queryCurrentOrganizationResVo1.setPhone(entCacheResDto1.getPhone());
+//                    list.add(queryCurrentOrganizationResVo1);
+//                }
+//            }
+//        }
 
         //填充企业属性
         List<Long> entIds = list.stream().map(QueryCurrentOrganizationResVo::getEntId).toList();
@@ -1381,9 +1289,6 @@ public class KwsEnterpriseService {
             entCacheResDto.setValid(entCheckTrackResDtoList.stream().anyMatch(item -> item.getStatus() == Global.NO));
         }
 
-        //专场
-        List<String> specialCode = kwsSpecialService.findSpecialByEntId(enterprise.getId());
-        entCacheResDto.setSpecial(CollectionUtils.isNotEmpty(specialCode) ? String.join(Global.COMMA, specialCode) : null);
         return entCacheResDto;
     }
 
@@ -1407,15 +1312,8 @@ public class KwsEnterpriseService {
      */
     public List<QueryCustomerResVo> queryCustomerGroup(EntFindPageReqVo reqVo) {
         List<QueryCustomerResVo> result = new ArrayList<>();
-//        List<FindEntListPojo> list = findPojo(reqVo);
-        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
-        if (CollectionUtils.isEmpty(authEntIdList)) {
-            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
-            if (ids.size() < 1) {
-                getDefaultReturn(result);
-                return result;
-            }
-        }
+        List<Long> authEntIdList = Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? new ArrayList<>() : LoginUserHolder.getAuthEntIdList();
+
         List<FindEntListPojo> list = findPojoManager(reqVo, authEntIdList);
         Map<Integer, List<FindEntListPojo>> collect = list.stream().collect(Collectors.groupingBy(FindEntListPojo::getStatus));
 
@@ -1466,7 +1364,8 @@ public class KwsEnterpriseService {
      * @date: 2023/9/21
      */
     public void exportEntSettle(EntFindPageReqVo reqVo, HttpServletResponse response) {
-        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        List<Long> authEntIdList = Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? new ArrayList<>() : LoginUserHolder.getAuthEntIdList();
+
         if (CollectionUtils.isEmpty(authEntIdList)) {
             List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
             if (ids.size() < 1) {
@@ -1495,12 +1394,12 @@ public class KwsEnterpriseService {
             if (item.getType().contains(String.valueOf(EntTypeEnum.PURCHASER.getCode()))) {
                 entFindPageResVo.setEnt2("是");
             }
-            if (item.getType().contains(String.valueOf(EntTypeEnum.LOGISTICS3.getCode()))) {
+            if (item.getType().contains(String.valueOf(EntTypeEnum.LOGISTIC.getCode()))) {
                 entFindPageResVo.setEnt3("是");
             }
-            if (item.getType().contains(String.valueOf(EntTypeEnum.LOGISTICS4.getCode()))) {
-                entFindPageResVo.setEnt4("是");
-            }
+//            if (item.getType().contains(String.valueOf(EntTypeEnum.LOGISTICS4.getCode()))) {
+//                entFindPageResVo.setEnt4("是");
+//            }
             if (entFindPageResVo.getManager() != null) {
                 KwsUser kwsUser = userDao.selectByKey(entFindPageResVo.getManager());
                 entFindPageResVo.setManagerName(kwsUser == null ? null : kwsUser.getName());
@@ -1528,7 +1427,7 @@ public class KwsEnterpriseService {
         enterpriseList.forEach(id -> {
             KwsEnterprise enterprise = kwsEnterpriseDao.selectByKey(id);
             enterprise.setManager(managerId);
-            kwsEnterpriseDao.update(enterprise);
+            kwsEnterpriseDao.updateById(enterprise);
         });
         //清除缓存  新增缓存
         String key = Global.getCustomerManagerUserLoginKey(SystemTypeEnum.MANAGE.getCode(), managerId);
@@ -1552,7 +1451,7 @@ public class KwsEnterpriseService {
     public EntInfoResp queryEntInfo(EntInfoReq req) {
         //如果是发起方是采购方,采购方只能是自己和下级,供应方可以选所有入住的供应企业
         // 如果发起方是供应方,则供应方是能自己和下级,采购方可以是所有入住企业
-        if (org.apache.commons.lang3.StringUtils.equals(req.getEntType(),req.getLoginEntType())){
+        if (org.apache.commons.lang3.StringUtils.equals(req.getEntType(), req.getLoginEntType())) {
             //登录客户的企业类型和查询的类型是一直的说明只能查询自己和自己的下级
             //发起方的公司信息
             return getEntInfoResp(req);
@@ -1565,13 +1464,13 @@ public class KwsEnterpriseService {
     @NotNull
     private EntInfoResp getInfoResp(EntInfoReq req) {
         List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByType(req.getEntType());
-        if (CollectionUtils.isEmpty(kwsEntTypes)){
+        if (CollectionUtils.isEmpty(kwsEntTypes)) {
             return new EntInfoResp();
         }
         Set<Long> entIds = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
         //根据企业id查询企业信息
         List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIds(entIds);
-        if (CollectionUtils.isEmpty(kwsEnterprises)){
+        if (CollectionUtils.isEmpty(kwsEnterprises)) {
             return new EntInfoResp();
         }
         //组装返回对象
@@ -1588,11 +1487,11 @@ public class KwsEnterpriseService {
 
     @NotNull
     private EntInfoResp getEntInfoResp(EntInfoReq req) {
-        if (org.apache.commons.lang3.StringUtils.isBlank(req.getEntId())){
+        if (org.apache.commons.lang3.StringUtils.isBlank(req.getEntId())) {
             throw new BusinessException("企业id不能为空");
         }
         List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIdAndName(req.getEntId(), req.getEntName());
-        if (CollectionUtils.isEmpty(kwsEnterprises)){
+        if (CollectionUtils.isEmpty(kwsEnterprises)) {
             return new EntInfoResp();
         }
         Set<Long> entIds = kwsEnterprises.stream()
@@ -1600,7 +1499,7 @@ public class KwsEnterpriseService {
                 .collect(Collectors.toSet());
         //根据类型进行过滤
         List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByEntIdsAndType(entIds, req.getEntType());
-        if (CollectionUtils.isEmpty(kwsEntTypes)){
+        if (CollectionUtils.isEmpty(kwsEntTypes)) {
             return new EntInfoResp();
         }
         Set<Long> entIdList = kwsEntTypes.stream()
@@ -1619,4 +1518,17 @@ public class KwsEnterpriseService {
         entInfoResp.setEntInfos(entInfos);
         return entInfoResp;
     }
+
+    public EntInfo queryEnt(String entName) {
+        return kwsEnterpriseDao.query(entName);
+    }
+
+    public List<EntBaseInfo> childEnt() {
+        return kwsEnterpriseDao.queryCte(LoginUserHolder.getEntId());
+    }
+
+    public List<EntBaseInfo> list() {
+        List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectList(new LambdaQueryWrapper<KwsEnterprise>().eq(KwsEnterprise::getApproval, 1).eq(KwsEnterprise::getStatus, 0));
+        return kwsEnterprises.stream().map(d -> BeanUtils.toBean(d, EntBaseInfo.class)).collect(Collectors.toList());
+    }
 }

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

@@ -341,13 +341,8 @@ public class KwsMenuService {
         if (Objects.isNull(kwsUser)) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ACCOUNT_NOT_EXISTS);
         }
-
-        List<KwsUserRole> allByUserId = kwsUserRoleDao.findAllByUserId(userId);
-        if (CollectionUtils.isEmpty(allByUserId)) {
-            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ROLE_NOT_EXISTS);
-        }
-
-        findMenuTreePojo.setRoleIds(allByUserId.stream().map(KwsUserRole::getRoleId).toList());
+        //改为单一角色切换形式,获取当前激活的角色。
+        findMenuTreePojo.setRoleIds(Collections.singletonList(LoginUserHolder.getCurrentRoleId()));
     }
 
     /**

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

@@ -2,6 +2,7 @@ package com.sckw.system.service;
 
 import java.util.Date;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -29,6 +30,7 @@ import com.sckw.system.model.report.KwsUserExcel;
 import com.sckw.system.model.vo.req.EditRoleReqVo;
 import com.sckw.system.model.vo.req.RoleBindMenuReqVo;
 import com.sckw.system.model.vo.req.UserBindRoleReqVo;
+import com.sckw.system.model.vo.res.EntBaseInfo;
 import com.sckw.system.model.vo.res.IdResVo;
 import com.sckw.system.model.vo.res.KwsMenuResVo;
 import com.sckw.system.model.vo.res.RoleResVo;
@@ -66,8 +68,8 @@ public class KwsRoleService {
     @Autowired
     KwsUserDeptDao kwsUserDeptDao;
 
-    @Autowired
-    KwsDeptDao kwsDeptDao;
+//    @Autowired
+//    KwsDeptDao kwsDeptDao;
 
     @Autowired
     KwsEnterpriseDao kwsEnterpriseDao;
@@ -107,31 +109,20 @@ 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);
-            }
-        }
+        //todo 暂时注释,管理端新增企业入驻时,生成的默认角色名是固定的
+//        KwsRole kwsRole1 = kwsRoleDao.selectOne(new LambdaQueryWrapper<KwsRole>().eq(KwsRole::getName, reqVo.getName()));
+//        if (Objects.nonNull(kwsRole1)) {
+//            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_024);
+//        }
 
         /*1、存角色信息*/
         KwsRole kwsRole = new KwsRole();
         long roleId = new IdWorker(1L).nextId();
+        IdResVo idResVo = new IdResVo();
         idResVo.setId(roleId);
         kwsRole.setId(roleId);
+        kwsRole.setEntId(reqVo.getEntId());
         kwsRole.setName(reqVo.getName());
-        kwsRole.setDeptId(topDeptId);
         kwsRole.setRemark(reqVo.getRemark());
         if (kwsRoleDao.insert(kwsRole) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
@@ -139,10 +130,11 @@ public class KwsRoleService {
 
         /*2、绑定菜单功能*/
         RoleBindMenuReqVo roleBindMenuReqVo = new RoleBindMenuReqVo();
-        if (Objects.isNull(reqVo.getIsManage()) || !reqVo.getIsManage()) {
-            roleBindMenuReqVo.setRoleId(roleId);
-        }
-        roleBindMenuReqVo.setEntId(kwsDept.getEntId());
+        roleBindMenuReqVo.setRoleId(roleId);
+//        if (Objects.isNull(reqVo.getIsManage()) || !reqVo.getIsManage()) {//企业管理员新增时,角色id不填写。
+//            roleBindMenuReqVo.setRoleId(roleId);
+//        }
+        roleBindMenuReqVo.setEntId(reqVo.getEntId());
         roleBindMenuReqVo.setMenuIds(reqVo.getMenuIds());
         kwsMenuService.roleBindMenu(roleBindMenuReqVo);
 
@@ -235,7 +227,7 @@ public class KwsRoleService {
         /*1、删角色*/
         for (KwsRole kwsRole : kwsRoles) {
             kwsRole.setDelFlag(Global.YES);
-            if (kwsRoleDao.update(kwsRole) <= 0) {
+            if (kwsRoleDao.updateById(kwsRole) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
             }
         }
@@ -249,7 +241,7 @@ public class KwsRoleService {
 
         for (KwsUserRole kwsUserRole : kwsUserRoleList) {
             kwsUserRole.setDelFlag(Global.YES);
-            if (kwsUserRoleDao.update(kwsUserRole) <= 0) {
+            if (kwsUserRoleDao.updateById(kwsUserRole) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
             }
         }
@@ -267,7 +259,7 @@ public class KwsRoleService {
     /**
      * 更新记录
      */
-    @Transactional(rollbackFor = {})
+    @Transactional(rollbackFor = Exception.class)
     public void update(EditRoleReqVo reqVo) {
         KwsRole kwsRole = kwsRoleDao.selectByKey(reqVo.getId());
         if (Objects.isNull(kwsRole)) {
@@ -294,11 +286,10 @@ public class KwsRoleService {
             }
         }
 
-        KwsDept kwsDept = kwsDeptDao.selectByKey(kwsRole.getDeptId());
-
+//        KwsDept kwsDept = kwsDeptDao.selectByKey(kwsRole.getDeptId());
         RoleBindMenuReqVo roleBindMenuReqVo = new RoleBindMenuReqVo();
         roleBindMenuReqVo.setRoleId(kwsRole.getId());
-        roleBindMenuReqVo.setEntId(kwsDept.getEntId());
+        roleBindMenuReqVo.setEntId(reqVo.getEntId());
         roleBindMenuReqVo.setMenuIds(reqVo.getMenuIds());
         kwsMenuService.roleBindMenu(roleBindMenuReqVo);
         //修改权限名称与备注信息
@@ -309,31 +300,10 @@ public class KwsRoleService {
         if (kwsRoleDao.update(kwsRoleTable) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
         }
-        if(StringUtils.isNotBlank(reqVo.getDeptIds())){
+        if (StringUtils.isNotBlank(reqVo.getDeptIds())) {
             saveAuthority(reqVo.getId(), reqVo.getDeptIds());
         }
 
-//        List<KwsUser> kwsUsers = kwsUserDao.selectByRoleIds(Collections.singletonList(reqVo.getId()));
-//
-//        //删除以前的角色
-//        deleteRole(Collections.singletonList(kwsRole));
-//
-//        //新增
-//        add(reqVo);
-//
-//        //重新绑定以前的员工
-//        if (CollectionUtils.isEmpty(kwsUsers)) {
-//            return;
-//        }
-
-//        for (KwsUser kwsUser : kwsUsers) {
-//            UserBindRoleReqVo userBindRoleReqVo = new UserBindRoleReqVo();
-//            userBindRoleReqVo.setUserId(kwsUser.getId());
-//            userBindRoleReqVo.setRoleIds(String.valueOf(reqVo.getId()));
-//            userBindRoleReqVo.setSystemType(LoginUserHolder.getSystemType());
-//            userBindRoleReqVo.setRemark("");
-//            userBindRole(userBindRoleReqVo);
-//        }
     }
 
     /**
@@ -348,14 +318,21 @@ public class KwsRoleService {
 
     /**
      * 分页查询
+     *
      * @param params 分页入参
      * @return List
      */
     public PageResult findPage(Map<String, Object> params) {
+        if (!LoginUserHolder.isManager()) {
+            if (Objects.equals(LoginUserHolder.getIsMain(), Global.YES)) {
+                params.put("idList", LoginUserHolder.getChildEntList());
+            } else {
+                params.put("entId", LoginUserHolder.getEntId());
+            }
+        } else {
+            params.put("idList", LoginUserHolder.getChildEntList());
+        }
         PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
-        FindManagePojo manageInfoByEntId = kwsEnterpriseDao.findManageInfoByEntId(LoginUserHolder.getEntId());
-        params.put("entId", LoginUserHolder.getEntId());
-        params.put("manageRoleId", manageInfoByEntId.getRoleId());
         List<RoleResVo> roleResVos = kwsRoleDao.findPage(params);
         if (CollectionUtils.isEmpty(roleResVos)) {
             return PageHelperUtil.getPageResult(new PageInfo<>(roleResVos));
@@ -413,9 +390,6 @@ public class KwsRoleService {
     public void userBindRole(UserBindRoleReqVo reqVo) {
         //特殊校验,之前说用户和角色是一对多,后来产品改成一对一
         String[] roleIdArr = reqVo.getRoleIds().split(Global.COMMA);
-        if (isBindManyRole.equals(Global.NO) && roleIdArr.length > 1) {
-            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_006);
-        }
 
         /*1、若有数据则先置为删除状态*/
         extracted(reqVo);
@@ -483,7 +457,6 @@ public class KwsRoleService {
     }
 
 
-
     public void export(HashMap params, HttpServletResponse response) {
         FindManagePojo manageInfoByEntId = kwsEnterpriseDao.findManageInfoByEntId(LoginUserHolder.getEntId());
         params.put("entId", LoginUserHolder.getEntId());
@@ -498,4 +471,4 @@ public class KwsRoleService {
         }
         ExcelUtil.downData(response, KwsRoleExcel.class, BeanUtils.copyToList(roleResVos, KwsRoleExcel.class));
     }
-}
+}

+ 111 - 75
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

@@ -1,11 +1,13 @@
 package com.sckw.system.service;
 
+import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
-import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.enums.ApprovalEnum;
+import com.sckw.core.model.enums.ClientTypeEnum;
 import com.sckw.core.model.enums.SystemTypeEnum;
 import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
@@ -22,6 +24,7 @@ import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.dao.*;
 import com.sckw.system.dubbo.RemoteSystemServiceImpl;
 import com.sckw.system.model.*;
+import com.sckw.system.api.model.dto.res.RoleInfoDto;
 import com.sckw.system.model.report.KwsUserExcel;
 import com.sckw.system.model.vo.req.*;
 import com.sckw.system.model.vo.res.KwsUserResVo;
@@ -35,7 +38,6 @@ import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -130,7 +132,7 @@ public class KwsUserService {
             fillUserRole(reqVo.getRoleIds(), userId, reqVo.getSystemType());
 
             /*5、用户机构关系*/
-            fillUserDept(kwsUser.getId(), reqVo.getDeptId());
+//            fillUserDept(kwsUser.getId(), reqVo.getDeptId());
         }
 
     }
@@ -155,6 +157,7 @@ public class KwsUserService {
         if (Objects.nonNull(LoginUserHolder.getUserId()) && LoginUserHolder.getUserId().compareTo(1L) != 0) {
             createBy = LoginUserHolder.getUserId();
         }
+        long entId = new IdWorker(1L).nextId();
 
         kwsUser.setSystemType(reqDto.getSystemType());
         kwsUser.setAccount(reqDto.getPhone());
@@ -163,6 +166,8 @@ public class KwsUserService {
         kwsUser.setPhone(reqDto.getPhone());
         kwsUser.setIsMain(reqDto.getIsMain());
         kwsUser.setId(userId);
+        kwsUser.setEntId(entId);
+
         kwsUser.setCreateBy(createBy);
         kwsUser.setUpdateBy(createBy);
         //填充密码、入库
@@ -179,7 +184,6 @@ public class KwsUserService {
         //目前注册接口只有企业管理员进来
         if (reqDto.getIsMain() == Global.YES && !reqDto.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
             KwsEnterprise kwsEnterprise = new KwsEnterprise();
-            long entId = new IdWorker(1L).nextId();
             kwsEnterprise.setId(entId);
             kwsEnterprise.setCode("");
             kwsEnterprise.setRegTime(new Date());
@@ -190,27 +194,11 @@ public class KwsUserService {
             kwsEnterprise.setCreateBy(createBy);
             kwsEnterprise.setUpdateBy(createBy);
 
-            //客户经理
-            if (StringUtils.isNotBlank(reqDto.getSpecial())) {
-                List<KwsSpecial> specials = kwsSpecialService.findList(new HashMap<>(){{put("code", reqDto.getSpecial());}});
-                if (CollectionUtils.isNotEmpty(specials)) {
-                    KwsSpecial special = specials.get(NumberConstant.ZERO);
-                    kwsEnterprise.setManager(special.getManager());
-                    //专场平台注册自动加入专场
-                    if (special.getIsMain() == NumberConstant.ZERO) {
-                        KwsEntSpecial entSpecial = new KwsEntSpecial();
-                        entSpecial.setSpecialId(special.getId());
-                        entSpecial.setEntId(entId);
-                        kwsSpecialService.joinSpecial(entSpecial);
-                    }
-                }
-            } else {
-                //默认给一个客户经理(admin账号)-公共平台
-                List<KwsUserSystemTypeVo> userSystemTypeVos = kwsUserDao.selectUserBySystemType(SystemTypeEnum.MANAGE.getCode());
-                if (CollectionUtils.isNotEmpty(userSystemTypeVos)) {
-                    KwsUserSystemTypeVo kwsUserSystemTypeVo = userSystemTypeVos.get(0);
-                    kwsEnterprise.setManager(kwsUserSystemTypeVo.getId());
-                }
+            //默认给一个客户经理(admin账号)-公共平台
+            List<KwsUserSystemTypeVo> userSystemTypeVos = kwsUserDao.selectUserBySystemType(SystemTypeEnum.MANAGE.getCode());
+            if (CollectionUtils.isNotEmpty(userSystemTypeVos)) {
+                KwsUserSystemTypeVo kwsUserSystemTypeVo = userSystemTypeVos.get(0);
+                kwsEnterprise.setManager(kwsUserSystemTypeVo.getId());
             }
 
             if (kwsEnterpriseDao.insert(kwsEnterprise) <= 0) {
@@ -219,28 +207,29 @@ public class KwsUserService {
 
             registerResDto.setEntId(entId);
             /*1、新增管理员机构*/
-            KwsDept kwsDept = new KwsDept();
-            Integer systemType = SystemTypeEnum.COMPANY.getCode();
-            kwsDept.setEntId(entId);
-            kwsDept.setName(reqDto.getEntName());
-            kwsDept.setSystemType(systemType);
-            kwsDept.setCompany(Global.NO);
-            kwsDept.setUpdateBy(createBy);
-            kwsDept.setCreateBy(createBy);
-            kwsDeptService.add(kwsDept);
-
-            /*3、绑定用户机构关系*/
-            fillUserDept(userId, kwsDept.getId());
+//            KwsDept kwsDept = new KwsDept();
+//            Integer systemType = SystemTypeEnum.COMPANY.getCode();
+//            kwsDept.setEntId(entId);
+//            kwsDept.setName(reqDto.getEntName());
+//            kwsDept.setSystemType(systemType);
+//            kwsDept.setCompany(Global.NO);
+//            kwsDept.setUpdateBy(createBy);
+//            kwsDept.setCreateBy(createBy);
+//            kwsDeptService.add(kwsDept);
+//
+//            /*3、绑定用户机构关系*/
+//            fillUserDept(userId, kwsDept.getId());
 
             /*2、新增管理员角色*/
             EditRoleReqVo editRoleReqVo = new EditRoleReqVo();
+            editRoleReqVo.setEntId(entId);
             List<KwsMenu> kwsMenus = kwsMenuService.selectAll();
             if (CollectionUtils.isEmpty(kwsMenus)) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MENU_NOT_EXISTS);
             }
             kwsMenus = kwsMenus.stream().filter(item -> item.getClientType().equals(Global.NUMERICAL_TWO)).collect(Collectors.toList());
             editRoleReqVo.setName(Global.MANAGE_NAME);
-            editRoleReqVo.setCurrentUnitId(kwsDept.getId());
+            editRoleReqVo.setCurrentUnitId(null);
             editRoleReqVo.setMenuIds(String.join(Global.COMMA, kwsMenus.stream().map(KwsMenu::getId).map(String::valueOf).toList()));
             editRoleReqVo.setVisiblePersonal(false);
             editRoleReqVo.setIsManage(true);
@@ -321,7 +310,7 @@ public class KwsUserService {
             KwsUser kwsUser = kwsUserDao.selectByKey(Long.parseLong(id));
             if (null != kwsUser) {
                 kwsUser.setDelFlag(Global.YES);
-                if (kwsUserDao.update(kwsUser) <= 0) {
+                if (kwsUserDao.updateById(kwsUser) <= 0) {
                     throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
                 }
             }
@@ -372,7 +361,7 @@ public class KwsUserService {
 
         kwsUser.setRemark(params.getRemark());
         kwsUser.setName(params.getName());
-        kwsUserDao.update(kwsUser);
+        kwsUserDao.updateById(kwsUser);
 
         /*填充用户角色*/
         fillUserRole(params.getRoleIds(), kwsUser.getId(), kwsUser.getSystemType());
@@ -413,8 +402,18 @@ public class KwsUserService {
      * 分页查询
      */
     public List<KwsUserResVo> findPage(Map<String, Object> params) {
-        params.put("entId", LoginUserHolder.getEntId());
-        params.put("isMain", Global.NO);
+        if (!LoginUserHolder.isManager()) {
+            params.put("systemType", SystemTypeEnum.COMPANY.getCode());
+            if (Objects.equals(LoginUserHolder.getIsMain(), Global.YES)) {
+                params.put("entList", LoginUserHolder.getChildEntList());
+            } else {
+                params.put("entId", LoginUserHolder.getEntId());
+            }
+        } else {
+            params.put("systemType", SystemTypeEnum.MANAGE.getCode());
+            params.put("entList", LoginUserHolder.getChildEntList());
+        }
+
         return kwsUserDao.findPage(params);
     }
 
@@ -425,6 +424,14 @@ public class KwsUserService {
         return kwsUserDao.findList(params);
     }
 
+    public KwsUser queryUserInfo(String username, int systemType) {
+        return kwsUserDao.selectOne(new LambdaQueryWrapper<KwsUser>()
+                .eq(KwsUser::getAccount, username)
+                .eq(KwsUser::getSystemType, systemType)
+                .eq(KwsUser::getIsMain, 1)
+        );
+    }
+
     /**
      * 根据用户名查用户信息
      */
@@ -475,9 +482,14 @@ public class KwsUserService {
         String password = PasswordUtils.entryptPassword(kwsUser.getAccount() + newPassword, salt);
         kwsUser.setPassword(password);
         kwsUser.setSalt(salt);
-        if (kwsUserDao.update(kwsUser) <= 0) {
+        if (kwsUserDao.updateById(kwsUser) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
+        //token重置
+        for (ClientTypeEnum value : ClientTypeEnum.values()) {
+            String fullUserTokenKey = Global.getFullUserTokenKey(value.getValue(), kwsUser.getId());
+            RedissonUtils.delete(fullUserTokenKey);
+        }
     }
 
     /**
@@ -591,7 +603,7 @@ public class KwsUserService {
         KwsUser kwsUser = new KwsUser();
         kwsUser.setId(id);
         kwsUser.setDelFlag(Global.YES);
-        if (kwsUserDao.update(kwsUser) <= 0) {
+        if (kwsUserDao.updateById(kwsUser) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
         }
     }
@@ -616,7 +628,7 @@ public class KwsUserService {
             }
 
             kwsUser.setStatus(Global.YES);
-            if (kwsUserDao.update(kwsUser) <= 0) {
+            if (kwsUserDao.updateById(kwsUser) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
             }
             RedissonUtils.remove(Global.getFullUserLoginKey(kwsUser.getSystemType(), kwsUser.getId()));
@@ -643,7 +655,7 @@ public class KwsUserService {
             }
 
             kwsUser.setStatus(Global.NO);
-            if (kwsUserDao.update(kwsUser) <= 0) {
+            if (kwsUserDao.updateById(kwsUser) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
             }
         }
@@ -717,39 +729,39 @@ public class KwsUserService {
     }
 
     public List<KwsUserSystemTypeVo> getManager() {
-        return kwsUserDao.selectUserBySystemTypeAndMain(SystemTypeEnum.MANAGE.getCode(),0);
+        return kwsUserDao.selectUserBySystemTypeAndMain(SystemTypeEnum.MANAGE.getCode(), 0);
     }
 
     public SalesResp getSales(SalesReq req) {
-        log.info("查询销售参数:{}", JSON.toJSONString( req));
+        log.info("查询销售参数:{}", JSON.toJSONString(req));
         //根据供应方的企业id查出供应方员工作为销售
-       List<KwsRole> roles = kwsRoleRepository.queryByEntId(req.getEntId());
-       if (CollectionUtils.isEmpty(roles)){
-           return new SalesResp();
-       }
-       //获取角色id
-       Set<Long> roleIds = roles.stream()
-               .map(KwsRole::getId)
-               .collect(Collectors.toSet());
-       if (org.apache.commons.collections4.CollectionUtils.isEmpty(roleIds)){
-           return new SalesResp();
-       }
+        List<KwsRole> roles = kwsRoleRepository.queryByEntId(req.getEntId());
+        if (CollectionUtils.isEmpty(roles)) {
+            return new SalesResp();
+        }
+        //获取角色id
+        Set<Long> roleIds = roles.stream()
+                .map(KwsRole::getId)
+                .collect(Collectors.toSet());
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(roleIds)) {
+            return new SalesResp();
+        }
         //获取角色用户管理数据
-       List<KwsUserRole> kwsUserRoles = kwsUserRoleRepository.queryByRoleIds(roleIds);
-       if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwsUserRoles)){
-           return new SalesResp();
-       }
-       //获取用户id
-       Set<Long> userIds = kwsUserRoles.stream()
-               .map(KwsUserRole::getUserId)
-               .collect(Collectors.toSet());
-       if (org.apache.commons.collections4.CollectionUtils.isEmpty(userIds)){
-           return new SalesResp();
-       }
-
-       //获取用户信息
-       List<KwsUser> kwsUsers = kwsUserRepository.queryByUserIds(userIds);
-       //组装返回数据
+        List<KwsUserRole> kwsUserRoles = kwsUserRoleRepository.queryByRoleIds(roleIds);
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwsUserRoles)) {
+            return new SalesResp();
+        }
+        //获取用户id
+        Set<Long> userIds = kwsUserRoles.stream()
+                .map(KwsUserRole::getUserId)
+                .collect(Collectors.toSet());
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(userIds)) {
+            return new SalesResp();
+        }
+
+        //获取用户信息
+        List<KwsUser> kwsUsers = kwsUserRepository.queryByUserIds(userIds);
+        //组装返回数据
         List<SalesResp.Sales> salesList = kwsUsers.stream()
                 .map(KwsUserService::getSales)
                 .collect(Collectors.toList());
@@ -765,4 +777,28 @@ public class KwsUserService {
         sales.setSalesPhone(u.getPhone());
         return sales;
     }
-}
+
+    /**
+     * 查询用户信息和角色信息
+     *
+     * @param params
+     * @return
+     */
+    public KwsUserResVo queryUserRole(Map<String, Object> params) {
+        KwsUserResVo kwsUserResVo = kwsUserDao.queryUser(params);
+        if (Objects.nonNull(kwsUserResVo)) {
+            List<RoleInfoDto> roleInfoVos = kwsUserRoleDao.queryRoleList(kwsUserResVo.getId());
+            if (CollUtil.isNotEmpty(roleInfoVos)) {
+                kwsUserResVo.setRoleInfoDto(roleInfoVos);
+                Optional<RoleInfoDto> first = roleInfoVos.stream().findFirst();
+                first.ifPresent(d -> {
+                    d.setActivate(true);
+                    kwsUserResVo.setRoleId(d.getRoleId());
+                    kwsUserResVo.setRoleName(d.getRoleName());
+                });
+            }
+        }
+        return kwsUserResVo;
+
+    }
+}

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

@@ -149,6 +149,8 @@
         <Logger name="org.springframework" level="info"/>
         <Logger name="com.alibaba" level="info"/>
         <Logger name="com.baomidou" level="info"/>
+        <logger name="io.seata.core.rpc.netty" level="OFF"/>
+        <logger name="io.seata" level="WARN"/>
     </loggers>
 
-</configuration>
+</configuration>

+ 2 - 2
sckw-modules/sckw-system/src/main/resources/mapper/KwsEntCertificateDao.xml

@@ -24,7 +24,7 @@
   </sql>
 
   <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from kws_ent_certificate
     where id = #{id,jdbcType=BIGINT}
@@ -219,4 +219,4 @@
     where id = #{id,jdbcType=BIGINT}
   </update>
 
-</mapper>
+</mapper>

+ 880 - 879
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -1,935 +1,936 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.system.dao.KwsEnterpriseDao">
-  <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsEnterprise">
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="firm_name" jdbcType="VARCHAR" property="firmName" />
-    <result column="code" jdbcType="VARCHAR" property="code" />
-    <result column="contacts" jdbcType="VARCHAR" property="contacts" />
-    <result column="phone" jdbcType="VARCHAR" property="phone" />
-    <result column="legal_name" jdbcType="VARCHAR" property="legalName" />
-    <result column="legal_phone" jdbcType="VARCHAR" property="legalPhone" />
-    <result column="head" jdbcType="VARCHAR" property="head" />
-    <result column="integral" jdbcType="INTEGER" property="integral" />
-    <result column="balance" jdbcType="DECIMAL" property="balance" />
-    <result column="experience" jdbcType="INTEGER" property="experience" />
-    <result column="member_level" jdbcType="INTEGER" property="memberLevel" />
-    <result column="reg_time" jdbcType="TIMESTAMP" property="regTime" />
-    <result column="reg_source" jdbcType="VARCHAR" property="regSource" />
-    <result column="org_code" jdbcType="VARCHAR" property="orgCode" />
-    <result column="city_code" jdbcType="INTEGER" property="cityCode" />
-    <result column="detail_address" jdbcType="VARCHAR" property="detailAddress" />
-    <result column="city_name" jdbcType="VARCHAR" property="cityName" />
-    <result column="lat" jdbcType="VARCHAR" property="lat" />
-    <result column="lng" jdbcType="VARCHAR" property="lng" />
-    <result column="approval" jdbcType="INTEGER" property="approval" />
-    <result column="approval_time" jdbcType="TIMESTAMP" property="approvalTime" />
-    <result column="manager" jdbcType="BIGINT" property="manager" />
-    <result column="remark" jdbcType="VARCHAR" property="remark" />
-    <result column="status" jdbcType="INTEGER" property="status" />
-    <result column="create_by" jdbcType="BIGINT" property="createBy" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
-    <result column="website" jdbcType="VARCHAR" property="website" />
-    <result column="business" jdbcType="VARCHAR" property="business" />
-  </resultMap>
+    <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsEnterprise">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="pid" jdbcType="BIGINT" property="pid"/>
+        <result column="firm_name" jdbcType="VARCHAR" property="firmName"/>
+        <result column="code" jdbcType="VARCHAR" property="code"/>
+        <result column="contacts" jdbcType="VARCHAR" property="contacts"/>
+        <result column="phone" jdbcType="VARCHAR" property="phone"/>
+        <result column="legal_name" jdbcType="VARCHAR" property="legalName"/>
+        <result column="legal_phone" jdbcType="VARCHAR" property="legalPhone"/>
+        <result column="head" jdbcType="VARCHAR" property="head"/>
+        <result column="integral" jdbcType="INTEGER" property="integral"/>
+        <result column="balance" jdbcType="DECIMAL" property="balance"/>
+        <result column="experience" jdbcType="INTEGER" property="experience"/>
+        <result column="member_level" jdbcType="INTEGER" property="memberLevel"/>
+        <result column="reg_time" jdbcType="TIMESTAMP" property="regTime"/>
+        <result column="reg_source" jdbcType="VARCHAR" property="regSource"/>
+        <result column="org_code" jdbcType="VARCHAR" property="orgCode"/>
+        <result column="city_code" jdbcType="INTEGER" property="cityCode"/>
+        <result column="detail_address" jdbcType="VARCHAR" property="detailAddress"/>
+        <result column="city_name" jdbcType="VARCHAR" property="cityName"/>
+        <result column="lat" jdbcType="VARCHAR" property="lat"/>
+        <result column="lng" jdbcType="VARCHAR" property="lng"/>
+        <result column="approval" jdbcType="INTEGER" property="approval"/>
+        <result column="approval_time" jdbcType="TIMESTAMP" property="approvalTime"/>
+        <result column="manager" jdbcType="BIGINT" property="manager"/>
+        <result column="remark" jdbcType="VARCHAR" property="remark"/>
+        <result column="status" jdbcType="INTEGER" property="status"/>
+        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
+        <result column="website" jdbcType="VARCHAR" property="website"/>
+        <result column="business" jdbcType="VARCHAR" property="business"/>
+    </resultMap>
 
-  <sql id="Base_Column_List">
-    id, firm_name, code, contacts, phone, legal_name, legal_phone, head, integral,
-    balance, experience, member_level, reg_time, reg_source, org_code, city_code, detail_address,
-    lat, lng, approval, approval_time, manager, remark, status, create_by, create_time,
-    update_by, update_time, del_flag,city_name, website, business
-  </sql>
+    <sql id="Base_Column_List">
+        id,
+        pid,
+        firm_name,
+        code,
+        contacts,
+        phone,
+        legal_name,
+        legal_phone,
+        head,
+        integral,
+        balance,
+        experience,
+        member_level,
+        reg_time,
+        reg_source,
+        org_code,
+        city_code,
+        detail_address,
+        lat,
+        lng,
+        approval,
+        approval_time,
+        manager,
+        remark,
+        status,
+        create_by,
+        create_time,
+        update_by,
+        update_time,
+        del_flag,
+        city_name,
+        website,
+        business
+    </sql>
 
-  <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select
-    <include refid="Base_Column_List" />
-    from kws_enterprise
-    where id = #{id,jdbcType=BIGINT}
-  </select>
+    <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_enterprise
+        where id = #{id,jdbcType=BIGINT}
+    </select>
 
 
-  <select id="findPojo" resultType="com.sckw.system.model.pojo.FindEntListPojo" parameterType="com.sckw.system.model.pojo.FindPojoParam">
-    select tab.*,
-           case when tab.id in (select ent_id from kws_ent_dep) then '子单位' else '主单位' end entDept,
-           case when tab.status = 0 then '正常' else '冻结' end statusName
-    from
-    (
-          select a.id,
-          min(a.firm_name) firm_name,
-          min(a.code) code,
-          min(a.contacts) contacts,
-          min(a.phone) phone,
-          min(a.legal_name) legal_name,
-          min(a.legal_phone) legal_phone,
-          min(a.head) head,
-          min(a.integral) integral,
-          min(a.balance) balance,
-          min(a.experience) experience,
-          min(a.member_level) member_level,
-          min(a.reg_time) reg_time,
-          min(a.reg_source) reg_source,
-          min(a.org_code) org_code,
-          min(a.city_code) city_code,
-          min(a.detail_address) detail_address,
-          min(a.lat) lat,
-          min(a.lng) lng,
-          min(a.approval) approval,
-          min(a.approval_time) approval_time,
-          min(a.manager) manager,
-          min(a.remark) remark,
-          min(a.status) status,
-          min(a.create_by) create_by,
-          min(a.create_time) create_time,
-          min(a.update_by) update_by,
-          min(a.update_time) update_time,
-          min(a.del_flag) del_flag,
-          ifnull(GROUP_CONCAT(distinct b.type), '') type,
-          min(k.system_type) system_type,
-          min(k.name) createByName,
-          min(ku.name) updateByName,
-          min(d.id) pid,
-          min(d.firm_name) pEntName
-    from kws_enterprise a
-    left join kws_user k on a.create_by = k.id
-    left join kws_user ku on a.update_by = ku.id
-    left join kws_ent_type b on a.id = b.ent_id and b.del_flag = 0
+    <select id="findPojo" resultType="com.sckw.system.model.pojo.FindEntListPojo"
+            parameterType="com.sckw.system.model.pojo.FindPojoParam">
+        select tab.*,
+               case when tab.status = 0 then '正常' else '冻结' end statusName
+        from
+        (
+        select a.id,
+               min(a.firm_name)                          firm_name,
+               min(a.code)                               code,
+               min(a.contacts)                           contacts,
+               min(a.phone)                              phone,
+               min(a.legal_name)                         legal_name,
+               min(a.legal_phone)                        legal_phone,
+               min(a.head)                               head,
+               min(a.integral)                           integral,
+               min(a.balance)                            balance,
+               min(a.experience)                         experience,
+               min(a.member_level)                       member_level,
+               min(a.reg_time)                           reg_time,
+               min(a.reg_source)                         reg_source,
+               min(a.org_code)                           org_code,
+               min(a.city_code)                          city_code,
+               min(a.detail_address)                     detail_address,
+               min(a.lat)                                lat,
+               min(a.lng)                                lng,
+               min(a.approval)                           approval,
+               min(a.approval_time)                      approval_time,
+               min(a.manager)                            manager,
+               min(a.remark)                             remark,
+               min(a.status)                             status,
+               min(a.create_by)                          create_by,
+               min(a.create_time)                        create_time,
+               min(a.update_by)                          update_by,
+               min(a.update_time)                        update_time,
+               min(a.del_flag)                           del_flag,
+               ifnull(GROUP_CONCAT(distinct b.type), '') type,
+               min(k.system_type)                        system_type,
+               min(k.name)                               createByName,
+               min(ku.name)                              updateByName,
+               min(d.id)                                 pid,
+               min(d.firm_name)                          pEntName
+        from kws_enterprise a
+            left join kws_user k on a.create_by = k.id
+            left join kws_user ku on a.update_by = ku.id
+            left join kws_ent_type b on a.id = b.ent_id and b.del_flag = 0
         <if test="dto.approval == null or (dto.approval != null and dto.approval != 2)">
             and b.status != 1
         </if>
-    left join kws_ent_dep c on a.id = c.ent_id
-    left join kws_enterprise d on c.ent_pid = d.id
-    where a.del_flag = 0
-      <if test="dto.typeList != null and dto.typeList.size() > 0">
-        and exists (select 1
-                      from kws_ent_type kt
-                     where a.id = kt.ent_id
-                       and kt.del_flag = 0
-                       and kt.type in
-                      <foreach collection="dto.typeList" item="item" open="(" close=")" separator=",">
-                          #{item}
-                      </foreach>
-                  )
-      </if>
-      <choose>
-        <when test="dto.approval != null and dto.approval == 3">
-          and a.approval in (3,4)
-        </when>
-        <when test="dto.approval != null and dto.approval != 3">
-          and a.approval = #{dto.approval}
-        </when>
-      </choose>
-      <if test="dto.customer != null and dto.customer == 1">
-        and a.approval in (1, 4)
-      </if>
-    <if test="dto.keywords != null">
-      and (a.contacts like concat('%', #{dto.keywords}, '%') or a.phone like concat('%', #{dto.keywords}, '%') or a.firm_name like concat('%', #{dto.keywords}, '%'))
-    </if>
-    <if test="dto.startTime != null">
-      and a.reg_time >= #{dto.startTime}
-    </if>
-    <if test="dto.endTime != null">
-      and a.reg_time &lt;= #{dto.endTime}
-    </if>
-    <if test="dto.approvalStartTime != null">
-      and a.approval_time >= #{dto.approvalStartTime}
-    </if>
-    <if test="dto.approvalEndTime != null">
-      and a.approval_time &lt; date_add(#{dto.approvalEndTime}, INTERVAL 1 DAY)
-    </if>
-    <if test="dto.status != null and dto.status != ''">
-      and a.status = #{dto.status}
-    </if>
-    <if test="dto.entryType != null and dto.entryType == 1">
-      and k.system_type = 2
-    </if>
-    <if test="dto.entryType != null and dto.entryType == 2">
-      and k.system_type = 1
-    </if>
-      <if test="dto.idList != null and dto.idList.size() > 0">
-        and a.id in
-        <foreach collection="dto.idList" item="item" separator="," open="(" close=")">
-          #{item}
-        </foreach>
-      </if>
-    <choose>
-      <when test="dto.entDept != null and dto.entDept == 0">
-        and not exists (
-            select 1
-              from kws_ent_dep dep
-              where a.id = dep.ent_id
-              <if test="dto.entId != null">
-                and dep.ent_pid = #{dto.entId}
-              </if>
+        left join kws_enterprise d on d.id = d.pid
+        where a.del_flag = 0
+        <if test="dto.typeList != null and dto.typeList.size() > 0">
+            and exists (select 1
+                        from kws_ent_type kt
+            where a.id = kt.ent_id
+              and kt.del_flag = 0
+              and kt.type in
+            <foreach collection="dto.typeList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
             )
-      </when>
-     <when test="dto.entDept != null and dto.entDept == 1">
-       and exists (
-           select 1 from kws_ent_dep dep
-            where a.id = dep.ent_id
-       <if test="dto.entId != null">
-         and dep.ent_pid = #{dto.entId}
-       </if>)
-     </when>
-    </choose>
-    group by a.id
-    ) tab
-     where tab.id is not null
-    order by tab.update_time desc
-  </select>
+        </if>
+        <choose>
+            <when test="dto.approval != null and dto.approval == 3">
+                and a.approval in (3, 4)
+            </when>
+            <when test="dto.approval != null and dto.approval != 3">
+                and a.approval = #{dto.approval}
+            </when>
+        </choose>
+        <if test="dto.customer != null and dto.customer == 1">
+            and a.approval in (1, 4)
+        </if>
+        <if test="dto.keywords != null">
+            and (a.contacts like concat('%', #{dto.keywords}, '%') or a.phone like concat('%', #{dto.keywords}, '%') or
+                 a.firm_name like concat('%', #{dto.keywords}, '%'))
+        </if>
+        <if test="dto.startTime != null">
+            and a.reg_time >= #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null">
+            and a.reg_time &lt;= #{dto.endTime}
+        </if>
+        <if test="dto.approvalStartTime != null">
+            and a.approval_time >= #{dto.approvalStartTime}
+        </if>
+        <if test="dto.approvalEndTime != null">
+            and a.approval_time &lt; date_add(#{dto.approvalEndTime}, INTERVAL 1 DAY)
+        </if>
+        <if test="dto.status != null and dto.status != ''">
+            and a.status = #{dto.status}
+        </if>
+        <if test="dto.entryType != null and dto.entryType == 1">
+            and k.system_type = 2
+        </if>
+        <if test="dto.entryType != null and dto.entryType == 2">
+            and k.system_type = 1
+        </if>
+        <if test="dto.idList != null and dto.idList.size() > 0">
+            and a.id in
+            <foreach collection="dto.idList" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        group by a.id
+        ) tab
+        where tab.id is not null
+        order by tab.update_time desc
+    </select>
 
-  <select id="findList" resultType="com.sckw.system.model.vo.res.FindEntListResVo" parameterType="com.sckw.system.model.vo.req.FindListReqVo">
-    select a.*,
-           d.id userId,
-           d.account,
-           d.name
-      from kws_enterprise a
-    left join kws_dept b on a.id = b.ent_id and b.del_flag = 0
-    left join kws_user_dept c on b.id = c.dept_id
-    left join kws_user d on c.user_id = d.id and d.del_flag = 0 and d.status = 0
-    where a.del_flag = 0
-    <if test="approval != null">
-      and a.approval = #{approval}
-    </if>
-      <if test="entName != null and entName != ''">
-        and a.firm_name like concat('%', #{entName}, '%')
-      </if>
-    <if test="entType != null">
-      and exists (select 1 from kws_ent_type e where a.id = e.ent_id and e.type = #{entType})
-    </if>
-    order by a.create_time
-  </select>
+    <select id="findList" resultType="com.sckw.system.model.vo.res.FindEntListResVo"
+            parameterType="com.sckw.system.model.vo.req.FindListReqVo">
+        select a.*,
+               d.id userId,
+               d.account,
+               d.name
+        from kws_enterprise a
+                 left join kws_user d on a.phone = d.phone and d.del_flag = 0 and d.status = 0
+        where a.del_flag = 0
+        <if test="approval != null">
+            and a.approval = #{approval}
+        </if>
+        <if test="entName != null and entName != ''">
+            and a.firm_name like concat('%', #{entName}, '%')
+        </if>
+        <if test="entType != null">
+            and exists (select 1 from kws_ent_type e where a.id = e.ent_id and e.type = #{entType})
+        </if>
+        order by a.create_time
+    </select>
 
     <select id="findByUserId" resultType="com.sckw.system.model.KwsEnterprise">
-      select distinct a.*
+        select distinct a.*
         from kws_enterprise a
-       inner join kws_dept b on a.id = b.ent_id
-       inner join kws_user_dept c on b.id = c.dept_id
-       inner join kws_user d on c.user_id = d.id
-       where d.id = #{id}
-         and a.del_flag = 0
-         and b.del_flag = 0
-         and c.del_flag = 0
-         and d.del_flag = 0
-         and a.status = 0
-         and b.status = 0
-         and c.status = 0
-         and d.status = 0
+                 inner join kws_user d on a.id = d.ent_id
+        where d.id = #{id}
+          and a.del_flag = 0
+          and d.del_flag = 0
+          and a.status = 0
+          and d.status = 0
     </select>
 
-  <select id="selectByKeys" resultType="com.sckw.system.model.KwsEnterprise">
-    select a.*
-    from kws_enterprise a
-    where del_flag = 0
-      and exists( select 1 from kws_ent_check_track b where a.id = b.ent_id and b.status = 0)
-    <if test="list != null and list.size() > 0">
-      and id in
-      <foreach collection="list" item="item" open="(" close=")" separator=",">
-        #{item}
-      </foreach>
-    </if>
-  </select>
+    <select id="selectByKeys" resultType="com.sckw.system.model.KwsEnterprise">
+        select a.*
+        from kws_enterprise a
+        where del_flag = 0
+          and exists(select 1 from kws_ent_check_track b where a.id = b.ent_id and b.status = 0)
+        <if test="list != null and list.size() > 0">
+            and id in
+            <foreach collection="list" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+    </select>
 
-  <select id="findUserByEntIds" resultType="com.sckw.system.model.pojo.FindEntUserPojo">
-    select distinct a.id entId,
-           a.firm_name entName,
-           d.id userId,
-           d.name,
-           d.account,
-           d.phone,
-           f.name roleName
-      from kws_enterprise a
-      left join kws_dept b on a.id = b.ent_id
-      left join kws_user_dept c on b.id = c.dept_id
-      left join kws_user d on c.user_id = d.id
-      left join kws_user_role e on d.id = e.user_id
-      left join kws_role f on e.role_id = f.id
-     where a.del_flag = 0
-       and b.del_flag = 0
-       and c.del_flag = 0
-       and d.del_flag = 0
-       and f.del_flag = 0
-       and a.id in
+    <select id="findUserByEntIds" resultType="com.sckw.system.model.pojo.FindEntUserPojo">
+        select distinct a.id        entId,
+                        a.firm_name entName,
+                        d.id        userId,
+                        d.name,
+                        d.account,
+                        d.phone,
+                        f.name      roleName
+        from kws_enterprise a
+                 left join kws_user d on d.ent_id = a.id
+                 left join kws_user_role e on d.id = e.user_id
+                 left join kws_role f on e.role_id = f.id
+        where a.del_flag = 0
+          and d.del_flag = 0
+          and f.del_flag = 0
+          and a.id in
         <foreach collection="list" separator="," open="(" close=")" item="item">
-          #{item}
+            #{item}
         </foreach>
-  </select>
+    </select>
 
-  <select id="findManageInfoByEntId" resultType="com.sckw.system.model.pojo.FindManagePojo">
-    select distinct d.id userId,
-           b.id deptId,
-           f.id roleId,
-           a.id entId
-      from kws_enterprise a
-      left join kws_dept b on a.id = b.ent_id
-      left join kws_user_dept c on b.id = c.dept_id
-      left join kws_user d on c.user_id = d.id
-      left join kws_user_role e on d.id = e.user_id
-      left join kws_role f on e.role_id = f.id
-     where a.del_flag = 0
-       and b.del_flag = 0
-       and c.del_flag = 0
-       and d.del_flag = 0
-       and e.del_flag = 0
-       and f.del_flag = 0
-       and d.is_main = 1
-       and a.id = #{entId}
-  </select>
+    <select id="findManageInfoByEntId" resultType="com.sckw.system.model.pojo.FindManagePojo">
+        select distinct d.id userId,
+                        f.id roleId,
+                        a.id entId
+        from kws_enterprise a
+                 left join kws_user d on a.id = d.ent_id
+                 left join kws_user_role e on d.id = e.user_id
+                 left join kws_role f on e.role_id = f.id
+        where a.del_flag = 0
+          and d.del_flag = 0
+          and e.del_flag = 0
+          and f.del_flag = 0
+          and d.is_main = 1
+          and a.id = #{entId}
+    </select>
 
-  <select id="findManageInfoByEntIdBeforeApproval" resultType="com.sckw.system.model.pojo.FindManagePojo">
-    select distinct d.id userId,
-                    f.id roleId
-    from kws_enterprise a
-           left join kws_dept b on a.id = b.ent_id
-           LEFT JOIN kws_user d ON a.phone = d.account
-           left join kws_role f on b.id = f.dept_id
-    where a.del_flag = 0
-      and b.del_flag = 0
-      and d.del_flag = 0
-      and f.del_flag = 0
-      and d.is_main = 1
-      and d.system_type = 2
-      and a.id = #{entId}
-  </select>
+    <select id="findManageInfoByEntIdBeforeApproval" resultType="java.lang.Long">
+        select distinct
+                        f.role_id roleId
+        from kws_enterprise a
+                 LEFT JOIN kws_user d ON a.phone = d.account and d.del_flag = 0
+                 left join kws_user_role f on f.user_id = d.id and f.del_flag = 0
+        where a.del_flag = 0
+          and d.is_main = 1
+          and d.system_type = 2
+          and a.id = #{entId}
+    </select>
 
-  <select id="findEnts" resultType="com.sckw.system.model.KwsEnterprise" parameterType="java.util.Map" >
-    select * from kws_enterprise ke
-    where ke.del_flag = 0
-    <if test="firmName != null and firmName != ''">
-      and ke.firm_name like concat('%', #{firmName}, '%')
-    </if>
-    <if test="entName != null and entName != ''">
-      and ke.firm_name = #{entName}
-    </if>
-    <choose>
-      <when test="entTypes != null and entTypes != '' and entTypes.size() > 0">
-        and exists (select 1 from kws_ent_type ket where ket.del_flag = 0 and ke.id = ket.ent_id and ket.type in
-        <foreach collection="entTypes" item="type" open="(" close=")" separator=",">
-          #{type,jdbcType=BIGINT}
-        </foreach>
-        )
-      </when>
-    </choose>
-  </select>
+    <select id="findEnts" resultType="com.sckw.system.model.KwsEnterprise" parameterType="java.util.Map">
+        select *
+        from kws_enterprise ke
+        where ke.del_flag = 0
+        <if test="firmName != null and firmName != ''">
+            and ke.firm_name like concat('%', #{firmName}, '%')
+        </if>
+        <if test="entName != null and entName != ''">
+            and ke.firm_name = #{entName}
+        </if>
+        <choose>
+            <when test="entTypes != null and entTypes != '' and entTypes.size() > 0">
+                and exists (select 1
+                            from kws_ent_type ket where ket.del_flag = 0
+                                                    and ke.id = ket.ent_id
+                                                    and ket.type in
+                <foreach collection="entTypes" item="type" open="(" close=")" separator=",">
+                    #{type,jdbcType=BIGINT}
+                </foreach>
+                )
+            </when>
+        </choose>
+    </select>
 
-  <select id="checkEntRepeat" resultType="com.sckw.system.model.KwsEnterprise">
-    select * from kws_enterprise where  (
-          firm_name = #{entName}
+    <select id="checkEntRepeat" resultType="com.sckw.system.model.KwsEnterprise">
+        select *
+        from kws_enterprise where  (
+                firm_name = #{entName}
         <if test="phone != null and phone != ''">
-          or phone = #{phone}
+            or phone = #{phone}
         </if>
-         )
-        and del_flag = 0 and approval in (1,3,4)
-  </select>
+        )
+          and del_flag = 0
+          and approval in (1, 3, 4)
+    </select>
 
-  <select id="selectAllByKeys" resultType="com.sckw.system.model.KwsEnterprise">
-    select
-    <include refid="Base_Column_List" />
-    from kws_enterprise
-    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>
+    <select id="selectAllByKeys" resultType="com.sckw.system.model.KwsEnterprise">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_enterprise
+        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>
 
     <select id="queryEntInfoByCityCodeAndEntTypesWithPage" resultType="com.sckw.system.model.KwsEnterprise">
-      SELECT a.*
+        SELECT a.*
         FROM kws_enterprise a
-        LEFT JOIN sys_area b ON a.city_code = b.CODE
-      where 1 = 1
+                 LEFT JOIN sys_area b ON a.city_code = b.CODE
+        where 1 = 1
         <if test="cityCode != null">
-          and (b.code = #{cityCode} or b.province_code = #{cityCode} or b.pcode = #{cityCode})
+            and (b.code = #{cityCode} or b.province_code = #{cityCode} or b.pcode = #{cityCode})
         </if>
         <if test="entIdList != null and entIdList.size() > 0">
-          and a.id in
-          <foreach collection="entIdList" item="item" open="(" close=")" separator=",">
-            #{item}
-          </foreach>
+            and a.id in
+            <foreach collection="entIdList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
         <if test="entName != null and entName != ''">
-          and a.firm_name like concat('%', #{entName}, '%')
+            and a.firm_name like concat('%', #{entName}, '%')
         </if>
         and exists (select 1
-                      from kws_ent_type k
-                     where a.id = k.ent_id
-                       and k.status = 0
-                       and k.del_flag = 0
-                       and k.type in
-                        <foreach collection="entTypeList" open="(" close=")" separator="," item="item">
-                            #{item}
-                         </foreach>
-                    )
-        and exists (
-                    select 1
+                    from kws_ent_type k
+        where a.id = k.ent_id
+          and k.status = 0
+          and k.del_flag = 0
+          and k.type in
+        <foreach collection="entTypeList" open="(" close=")" separator="," item="item">
+            #{item}
+        </foreach>
+        )
+          and exists (select 1
                       from kws_ent_check_track e
-                     where a.id = e.ent_id
-                       and a.status = 0
-                )
+                      where a.id = e.ent_id
+                        and a.status = 0)
     </select>
 
-  <select id="findManageInfoByEntIds" resultType="com.sckw.system.model.pojo.FindManagePojo">
-    select distinct d.id userId,
-                    b.id deptId,
-                    f.id roleId,
-                    a.id entId
-      from kws_enterprise a
-             left join kws_dept b on a.id = b.ent_id
-             left join kws_user_dept c on b.id = c.dept_id
-             left join kws_user d on c.user_id = d.id
-             left join kws_user_role e on d.id = e.user_id
-             left join kws_role f on e.role_id = f.id
-      where a.del_flag = 0
-        and b.del_flag = 0
-        and c.del_flag = 0
-        and d.del_flag = 0
-        and e.del_flag = 0
-        and f.del_flag = 0
-        and d.is_main = 1
-        and d.system_type = 2
-        and a.id in
-      <foreach collection="list" separator="," open="(" close=")" item="item">
-        #{item}
-      </foreach>
-  </select>
+    <select id="findManageInfoByEntIds" resultType="com.sckw.system.model.pojo.FindManagePojo">
+        select distinct d.id userId,
+                        f.id roleId,
+                        a.id entId
+        from kws_enterprise a
+                 left join kws_user d on a.id = d.ent_id
+                 left join kws_user_role e on d.id = e.user_id
+                 left join kws_role f on e.role_id = f.id
+        where a.del_flag = 0
+          and d.del_flag = 0
+          and e.del_flag = 0
+          and f.del_flag = 0
+          and d.is_main = 1
+          and d.system_type = 2
+          and a.id in
+        <foreach collection="list" separator="," open="(" close=")" item="item">
+            #{item}
+        </foreach>
+    </select>
 
-  <insert id="insert" parameterType="com.sckw.system.model.KwsEnterprise">
-    insert into kws_enterprise
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="firmName != null">
-        firm_name,
-      </if>
-      <if test="code != null">
-        code,
-      </if>
-      <if test="contacts != null">
-        contacts,
-      </if>
-      <if test="phone != null">
-        phone,
-      </if>
-      <if test="legalName != null">
-        legal_name,
-      </if>
-      <if test="legalPhone != null">
-        legal_phone,
-      </if>
-      <if test="head != null">
-        head,
-      </if>
-      <if test="integral != null">
-        integral,
-      </if>
-      <if test="balance != null">
-        balance,
-      </if>
-      <if test="experience != null">
-        experience,
-      </if>
-      <if test="memberLevel != null">
-        member_level,
-      </if>
-      <if test="regTime != null">
-        reg_time,
-      </if>
-      <if test="regSource != null">
-        reg_source,
-      </if>
-      <if test="orgCode != null">
-        org_code,
-      </if>
-      <if test="cityCode != null">
-        city_code,
-      </if>
-      <if test="detailAddress != null">
-        detail_address,
-      </if>
-      <if test="lat != null">
-        lat,
-      </if>
-      <if test="lng != null">
-        lng,
-      </if>
-      <if test="approval != null">
-        approval,
-      </if>
-      <if test="approvalTime != null">
-        approval_time,
-      </if>
-      <if test="manager != null">
-        manager,
-      </if>
-      <if test="remark != null">
-        remark,
-      </if>
-      <if test="status != null">
-        status,
-      </if>
-      <if test="createBy != null">
-        create_by,
-      </if>
-      <if test="createTime != null">
-        create_time,
-      </if>
-      <if test="updateBy != null">
-        update_by,
-      </if>
-      <if test="updateTime != null">
-        update_time,
-      </if>
-      <if test="delFlag != null">
-        del_flag,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="firmName != null">
-        #{firmName,jdbcType=VARCHAR},
-      </if>
-      <if test="code != null">
-        #{code,jdbcType=VARCHAR},
-      </if>
-      <if test="contacts != null">
-        #{contacts,jdbcType=VARCHAR},
-      </if>
-      <if test="phone != null">
-        #{phone,jdbcType=VARCHAR},
-      </if>
-      <if test="legalName != null">
-        #{legalName,jdbcType=VARCHAR},
-      </if>
-      <if test="legalPhone != null">
-        #{legalPhone,jdbcType=VARCHAR},
-      </if>
-      <if test="head != null">
-        #{head,jdbcType=VARCHAR},
-      </if>
-      <if test="integral != null">
-        #{integral,jdbcType=INTEGER},
-      </if>
-      <if test="balance != null">
-        #{balance,jdbcType=DECIMAL},
-      </if>
-      <if test="experience != null">
-        #{experience,jdbcType=INTEGER},
-      </if>
-      <if test="memberLevel != null">
-        #{memberLevel,jdbcType=INTEGER},
-      </if>
-      <if test="regTime != null">
-        #{regTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="regSource != null">
-        #{regSource,jdbcType=VARCHAR},
-      </if>
-      <if test="orgCode != null">
-        #{orgCode,jdbcType=VARCHAR},
-      </if>
-      <if test="cityCode != null">
-        #{cityCode,jdbcType=INTEGER},
-      </if>
-      <if test="detailAddress != null">
-        #{detailAddress,jdbcType=VARCHAR},
-      </if>
-      <if test="lat != null">
-        #{lat,jdbcType=VARCHAR},
-      </if>
-      <if test="lng != null">
-        #{lng,jdbcType=VARCHAR},
-      </if>
-      <if test="approval != null">
-        #{approval,jdbcType=INTEGER},
-      </if>
-      <if test="approvalTime != null">
-        #{approvalTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="manager != null">
-        #{manager,jdbcType=BIGINT},
-      </if>
-      <if test="remark != null">
-        #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        #{status,jdbcType=INTEGER},
-      </if>
-      <if test="createBy != null">
-        #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        #{delFlag,jdbcType=INTEGER},
-      </if>
-    </trim>
-  </insert>
+<!--    <insert id="insert" parameterType="com.sckw.system.model.KwsEnterprise">-->
+<!--        insert into kws_enterprise-->
+<!--        <trim prefix="(" suffix=")" suffixOverrides=",">-->
+<!--            <if test="id != null">-->
+<!--                id,-->
+<!--            </if>-->
+<!--            <if test="firmName != null">-->
+<!--                firm_name,-->
+<!--            </if>-->
+<!--            <if test="code != null">-->
+<!--                code,-->
+<!--            </if>-->
+<!--            <if test="contacts != null">-->
+<!--                contacts,-->
+<!--            </if>-->
+<!--            <if test="phone != null">-->
+<!--                phone,-->
+<!--            </if>-->
+<!--            <if test="legalName != null">-->
+<!--                legal_name,-->
+<!--            </if>-->
+<!--            <if test="legalPhone != null">-->
+<!--                legal_phone,-->
+<!--            </if>-->
+<!--            <if test="head != null">-->
+<!--                head,-->
+<!--            </if>-->
+<!--            <if test="integral != null">-->
+<!--                integral,-->
+<!--            </if>-->
+<!--            <if test="balance != null">-->
+<!--                balance,-->
+<!--            </if>-->
+<!--            <if test="experience != null">-->
+<!--                experience,-->
+<!--            </if>-->
+<!--            <if test="memberLevel != null">-->
+<!--                member_level,-->
+<!--            </if>-->
+<!--            <if test="regTime != null">-->
+<!--                reg_time,-->
+<!--            </if>-->
+<!--            <if test="regSource != null">-->
+<!--                reg_source,-->
+<!--            </if>-->
+<!--            <if test="orgCode != null">-->
+<!--                org_code,-->
+<!--            </if>-->
+<!--            <if test="cityCode != null">-->
+<!--                city_code,-->
+<!--            </if>-->
+<!--            <if test="detailAddress != null">-->
+<!--                detail_address,-->
+<!--            </if>-->
+<!--            <if test="lat != null">-->
+<!--                lat,-->
+<!--            </if>-->
+<!--            <if test="lng != null">-->
+<!--                lng,-->
+<!--            </if>-->
+<!--            <if test="approval != null">-->
+<!--                approval,-->
+<!--            </if>-->
+<!--            <if test="approvalTime != null">-->
+<!--                approval_time,-->
+<!--            </if>-->
+<!--            <if test="manager != null">-->
+<!--                manager,-->
+<!--            </if>-->
+<!--            <if test="remark != null">-->
+<!--                remark,-->
+<!--            </if>-->
+<!--            <if test="status != null">-->
+<!--                status,-->
+<!--            </if>-->
+<!--            <if test="createBy != null">-->
+<!--                create_by,-->
+<!--            </if>-->
+<!--            <if test="createTime != null">-->
+<!--                create_time,-->
+<!--            </if>-->
+<!--            <if test="updateBy != null">-->
+<!--                update_by,-->
+<!--            </if>-->
+<!--            <if test="updateTime != null">-->
+<!--                update_time,-->
+<!--            </if>-->
+<!--            <if test="delFlag != null">-->
+<!--                del_flag,-->
+<!--            </if>-->
+<!--        </trim>-->
+<!--        <trim prefix="values (" suffix=")" suffixOverrides=",">-->
+<!--            <if test="id != null">-->
+<!--                #{id,jdbcType=BIGINT},-->
+<!--            </if>-->
+<!--            <if test="firmName != null">-->
+<!--                #{firmName,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="code != null">-->
+<!--                #{code,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="contacts != null">-->
+<!--                #{contacts,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="phone != null">-->
+<!--                #{phone,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="legalName != null">-->
+<!--                #{legalName,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="legalPhone != null">-->
+<!--                #{legalPhone,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="head != null">-->
+<!--                #{head,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="integral != null">-->
+<!--                #{integral,jdbcType=INTEGER},-->
+<!--            </if>-->
+<!--            <if test="balance != null">-->
+<!--                #{balance,jdbcType=DECIMAL},-->
+<!--            </if>-->
+<!--            <if test="experience != null">-->
+<!--                #{experience,jdbcType=INTEGER},-->
+<!--            </if>-->
+<!--            <if test="memberLevel != null">-->
+<!--                #{memberLevel,jdbcType=INTEGER},-->
+<!--            </if>-->
+<!--            <if test="regTime != null">-->
+<!--                #{regTime,jdbcType=TIMESTAMP},-->
+<!--            </if>-->
+<!--            <if test="regSource != null">-->
+<!--                #{regSource,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="orgCode != null">-->
+<!--                #{orgCode,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="cityCode != null">-->
+<!--                #{cityCode,jdbcType=INTEGER},-->
+<!--            </if>-->
+<!--            <if test="detailAddress != null">-->
+<!--                #{detailAddress,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="lat != null">-->
+<!--                #{lat,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="lng != null">-->
+<!--                #{lng,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="approval != null">-->
+<!--                #{approval,jdbcType=INTEGER},-->
+<!--            </if>-->
+<!--            <if test="approvalTime != null">-->
+<!--                #{approvalTime,jdbcType=TIMESTAMP},-->
+<!--            </if>-->
+<!--            <if test="manager != null">-->
+<!--                #{manager,jdbcType=BIGINT},-->
+<!--            </if>-->
+<!--            <if test="remark != null">-->
+<!--                #{remark,jdbcType=VARCHAR},-->
+<!--            </if>-->
+<!--            <if test="status != null">-->
+<!--                #{status,jdbcType=INTEGER},-->
+<!--            </if>-->
+<!--            <if test="createBy != null">-->
+<!--                #{createBy,jdbcType=BIGINT},-->
+<!--            </if>-->
+<!--            <if test="createTime != null">-->
+<!--                #{createTime,jdbcType=TIMESTAMP},-->
+<!--            </if>-->
+<!--            <if test="updateBy != null">-->
+<!--                #{updateBy,jdbcType=BIGINT},-->
+<!--            </if>-->
+<!--            <if test="updateTime != null">-->
+<!--                #{updateTime,jdbcType=TIMESTAMP},-->
+<!--            </if>-->
+<!--            <if test="delFlag != null">-->
+<!--                #{delFlag,jdbcType=INTEGER},-->
+<!--            </if>-->
+<!--        </trim>-->
+<!--    </insert>-->
 
-  <update id="update" parameterType="com.sckw.system.model.KwsEnterprise">
-    update kws_enterprise
-    <set>
-      <if test="firmName != null">
-        firm_name = #{firmName,jdbcType=VARCHAR},
-      </if>
-      <if test="code != null">
-        code = #{code,jdbcType=VARCHAR},
-      </if>
-      <if test="contacts != null">
-        contacts = #{contacts,jdbcType=VARCHAR},
-      </if>
-      <if test="phone != null">
-        phone = #{phone,jdbcType=VARCHAR},
-      </if>
-      <if test="legalName != null">
-        legal_name = #{legalName,jdbcType=VARCHAR},
-      </if>
-      <if test="legalPhone != null">
-        legal_phone = #{legalPhone,jdbcType=VARCHAR},
-      </if>
-      <if test="head != null">
-        head = #{head,jdbcType=VARCHAR},
-      </if>
-      <if test="integral != null">
-        integral = #{integral,jdbcType=INTEGER},
-      </if>
-      <if test="balance != null">
-        balance = #{balance,jdbcType=DECIMAL},
-      </if>
-      <if test="experience != null">
-        experience = #{experience,jdbcType=INTEGER},
-      </if>
-      <if test="memberLevel != null">
-        member_level = #{memberLevel,jdbcType=INTEGER},
-      </if>
-      <if test="regTime != null">
-        reg_time = #{regTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="regSource != null">
-        reg_source = #{regSource,jdbcType=VARCHAR},
-      </if>
-      <if test="orgCode != null">
-        org_code = #{orgCode,jdbcType=VARCHAR},
-      </if>
-      <if test="cityCode != null">
-        city_code = #{cityCode,jdbcType=INTEGER},
-      </if>
-      <if test="cityName != null">
-        city_name = #{cityName,jdbcType=VARCHAR},
-      </if>
-      <if test="detailAddress != null">
-        detail_address = #{detailAddress,jdbcType=VARCHAR},
-      </if>
-      <if test="lat != null">
-        lat = #{lat,jdbcType=VARCHAR},
-      </if>
-      <if test="lng != null">
-        lng = #{lng,jdbcType=VARCHAR},
-      </if>
-      <if test="approval != null">
-        approval = #{approval,jdbcType=INTEGER},
-      </if>
-      <if test="approvalTime != null">
-        approval_time = #{approvalTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="manager != null">
-        manager = #{manager,jdbcType=BIGINT},
-      </if>
-      <if test="remark != null">
-        remark = #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        status = #{status,jdbcType=INTEGER},
-      </if>
-      <if test="createBy != null">
-        create_by = #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        update_by = #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        update_time = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        del_flag = #{delFlag,jdbcType=INTEGER},
-      </if>
-      <if test="website != null">
-        website = #{website,jdbcType=VARCHAR},
-      </if>
-      <if test="business != null">
-        business = #{business,jdbcType=VARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
+    <update id="update" parameterType="com.sckw.system.model.KwsEnterprise">
+        update kws_enterprise
+        <set>
+            <if test="firmName != null">
+                firm_name = #{firmName,jdbcType=VARCHAR},
+            </if>
+            <if test="code != null">
+                code = #{code,jdbcType=VARCHAR},
+            </if>
+            <if test="contacts != null">
+                contacts = #{contacts,jdbcType=VARCHAR},
+            </if>
+            <if test="phone != null">
+                phone = #{phone,jdbcType=VARCHAR},
+            </if>
+            <if test="legalName != null">
+                legal_name = #{legalName,jdbcType=VARCHAR},
+            </if>
+            <if test="legalPhone != null">
+                legal_phone = #{legalPhone,jdbcType=VARCHAR},
+            </if>
+            <if test="head != null">
+                head = #{head,jdbcType=VARCHAR},
+            </if>
+            <if test="integral != null">
+                integral = #{integral,jdbcType=INTEGER},
+            </if>
+            <if test="balance != null">
+                balance = #{balance,jdbcType=DECIMAL},
+            </if>
+            <if test="experience != null">
+                experience = #{experience,jdbcType=INTEGER},
+            </if>
+            <if test="memberLevel != null">
+                member_level = #{memberLevel,jdbcType=INTEGER},
+            </if>
+            <if test="regTime != null">
+                reg_time = #{regTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="regSource != null">
+                reg_source = #{regSource,jdbcType=VARCHAR},
+            </if>
+            <if test="orgCode != null">
+                org_code = #{orgCode,jdbcType=VARCHAR},
+            </if>
+            <if test="cityCode != null">
+                city_code = #{cityCode,jdbcType=INTEGER},
+            </if>
+            <if test="cityName != null">
+                city_name = #{cityName,jdbcType=VARCHAR},
+            </if>
+            <if test="detailAddress != null">
+                detail_address = #{detailAddress,jdbcType=VARCHAR},
+            </if>
+            <if test="lat != null">
+                lat = #{lat,jdbcType=VARCHAR},
+            </if>
+            <if test="lng != null">
+                lng = #{lng,jdbcType=VARCHAR},
+            </if>
+            <if test="approval != null">
+                approval = #{approval,jdbcType=INTEGER},
+            </if>
+            <if test="approvalTime != null">
+                approval_time = #{approvalTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="manager != null">
+                manager = #{manager,jdbcType=BIGINT},
+            </if>
+            <if test="remark != null">
+                remark = #{remark,jdbcType=VARCHAR},
+            </if>
+            <if test="status != null">
+                status = #{status,jdbcType=INTEGER},
+            </if>
+            <if test="createBy != null">
+                create_by = #{createBy,jdbcType=BIGINT},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateBy != null">
+                update_by = #{updateBy,jdbcType=BIGINT},
+            </if>
+            <if test="updateTime != null">
+                update_time = #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="delFlag != null">
+                del_flag = #{delFlag,jdbcType=INTEGER},
+            </if>
+            <if test="website != null">
+                website = #{website,jdbcType=VARCHAR},
+            </if>
+            <if test="business != null">
+                business = #{business,jdbcType=VARCHAR},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
 
-  <update id="approval">
-    update kws_enterprise
-       set approval = #{approval},
-           approval_time = now(),
-           remark = #{remark}
-     where id = #{id,jdbcType=BIGINT}
-       and del_flag = 0
-  </update>
+    <update id="approval">
+        update kws_enterprise
+        set approval      = #{approval},
+            approval_time = now(),
+            remark        = #{remark}
+        where id = #{id,jdbcType=BIGINT}
+          and del_flag = 0
+    </update>
 
-  <select id="findEnterpriseIdsByUserRoleId" resultType="java.lang.Long">
-      SELECT id
-      from kws_enterprise
-      where del_flag = 0 and status = 0
-      <if test="userId != null">
-          and (manager = #{userId} or manager in (SELECT user_id
-          from kws_user_dept
-          where dept_id in (SELECT dept_id from kws_authority where role_id = #{roleId})))
-      </if>
-  </select>
+    <select id="findEnterpriseIdsByUserRoleId" resultType="java.lang.Long">
+        SELECT id
+        from kws_enterprise
+        where del_flag = 0
+          and status = 0
+        <if test="userId != null">
+            and (manager = #{userId} or manager in (SELECT user_id
+                                                    from kws_user_dept
+                                                    where dept_id in (SELECT dept_id from kws_authority where role_id = #{roleId})))
+        </if>
+    </select>
 
-  <select id="findEnterpriseIdsByUserRoleIds" resultType="java.lang.Long">
-      SELECT id
-      from kws_enterprise
-      <where>
-          del_flag = 0
-            and status = 0
-          <if test="userId != null">
-              and            (manager = #{userId} or manager in (SELECT user_id
-                                                                 from kws_user_dept
-              where dept_id in (SELECT dept_id
-                                from kws_authority
-              <where>
-                  status = 0
-                    and del_flag = 0
-                  <if test="roleIds != null and roleIds.size() != 0">
-                      and role_id in
-                      <foreach collection="roleIds" item="item" separator="," open="(" close=")">
-                          #{item}
-                      </foreach>
-                  </if>
-              </where>
-              )
-              )
-                  )
-          </if>
-      </where>
-  </select>
+    <select id="findEnterpriseIdsByUserRoleIds" resultType="java.lang.Long">
+        SELECT id
+        from kws_enterprise
+        <where>
+            del_flag = 0
+              and status = 0
+            <if test="userId != null">
+                and            (manager = #{userId} or manager in (SELECT user_id
+                                                                   from kws_user_dept
+                where dept_id in (SELECT dept_id
+                                  from kws_authority
+                <where>
+                    status = 0
+                      and del_flag = 0
+                    <if test="roleIds != null and roleIds.size() != 0">
+                        and role_id in
+                        <foreach collection="roleIds" item="item" separator="," open="(" close=")">
+                            #{item}
+                        </foreach>
+                    </if>
+                </where>
+                )
+                )
+                    )
+            </if>
+        </where>
+    </select>
 
-  <select id="findPojoAndManager" resultType="com.sckw.system.model.pojo.FindEntListPojo">
-      select tab.*,
-      case when tab.id in (select ent_id from kws_ent_dep) then '子单位' else '主单位' end entDept,
-      case when tab.status = 0 then '正常' else '冻结' end statusName
-      from
-      (
-      select a.id,
-      min(a.firm_name) firm_name,
-      min(a.code) code,
-      min(a.contacts) contacts,
-      min(a.phone) phone,
-      min(a.legal_name) legal_name,
-      min(a.legal_phone) legal_phone,
-      min(a.head) head,
-      min(a.integral) integral,
-      min(a.balance) balance,
-      min(a.experience) experience,
-      min(a.member_level) member_level,
-      min(a.reg_time) reg_time,
-      min(a.reg_source) reg_source,
-      min(a.org_code) org_code,
-      min(a.city_code) city_code,
-      min(a.detail_address) detail_address,
-      min(a.lat) lat,
-      min(a.lng) lng,
-      min(a.approval) approval,
-      min(a.approval_time) approval_time,
-      min(a.manager) manager,
-      min(a.remark) remark,
-      min(a.status) status,
-      min(a.create_by) create_by,
-      min(a.create_time) create_time,
-      min(a.update_by) update_by,
-      min(a.update_time) update_time,
-      min(a.del_flag) del_flag,
-      ifnull(GROUP_CONCAT(distinct b.type), '') type,
-      min(k.system_type) system_type,
-      min(k.name) createByName,
-      min(ku.name) updateByName,
-      min(d.id) pid,
-      min(d.firm_name) pEntName
-      from kws_enterprise a
-      left join kws_user k on a.create_by = k.id
-      left join kws_user ku on a.update_by = ku.id
-      left join kws_ent_type b on a.id = b.ent_id and b.del_flag = 0
-      <if test="dto.approval == null or (dto.approval != null and dto.approval != 2)">
-          and b.status != 1
-      </if>
-      left join kws_ent_dep c on a.id = c.ent_id
-      left join kws_enterprise d on c.ent_pid = d.id
-      where a.del_flag = 0
-      <if test="authEntIdList != null and authEntIdList.size() != 0">
-          and a.id in
-          <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
-              #{item}
-          </foreach>
-      </if>
-      <if test="dto.typeList != null and dto.typeList.size() > 0">
-          and exists (select 1
-          from kws_ent_type kt
-          where a.id = kt.ent_id
-          and kt.del_flag = 0
-          and kt.type in
-          <foreach collection="dto.typeList" item="item" open="(" close=")" separator=",">
-              #{item}
-          </foreach>
-          )
-      </if>
-      <choose>
-          <when test="dto.approval != null and dto.approval == 3">
-              and a.approval in (3,4)
-          </when>
-          <when test="dto.approval != null and dto.approval != 3">
-              and a.approval = #{dto.approval}
-          </when>
-      </choose>
-      <if test="dto.customer != null and dto.customer == 1">
-          and a.approval in (1, 4)
-      </if>
-      <if test="dto.keywords != null">
-          and (a.contacts like concat('%', #{dto.keywords}, '%') or a.phone like concat('%', #{dto.keywords}, '%') or a.firm_name like concat('%', #{dto.keywords}, '%'))
-      </if>
-      <if test="dto.startTime != null">
-          and a.reg_time >= #{dto.startTime}
-      </if>
-      <if test="dto.endTime != null">
-          and a.reg_time &lt;= #{dto.endTime}
-      </if>
-      <if test="dto.approvalStartTime != null">
-          and a.approval_time >= #{dto.approvalStartTime}
-      </if>
-      <if test="dto.approvalEndTime != null">
-          and a.approval_time &lt; date_add(#{dto.approvalEndTime}, INTERVAL 1 DAY)
-      </if>
-      <if test="dto.status != null and dto.status != ''">
-          and a.status = #{dto.status}
-      </if>
-      <if test="dto.entryType != null and dto.entryType == 1">
-          and k.system_type = 2
-      </if>
-      <if test="dto.entryType != null and dto.entryType == 2">
-          and k.system_type = 1
-      </if>
-      <if test="dto.idList != null and dto.idList.size() > 0">
-          and a.id in
-          <foreach collection="dto.idList" item="item" separator="," open="(" close=")">
-              #{item}
-          </foreach>
-      </if>
-      <choose>
-          <when test="dto.entDept != null and dto.entDept == 0">
-              and not exists (
-              select 1
-              from kws_ent_dep dep
-              where a.id = dep.ent_id
-              <if test="dto.entId != null">
-                  and dep.ent_pid = #{dto.entId}
-              </if>
-              )
-          </when>
-          <when test="dto.entDept != null and dto.entDept == 1">
-              and exists (
-              select 1 from kws_ent_dep dep
-              where a.id = dep.ent_id
-              <if test="dto.entId != null">
-                  and dep.ent_pid = #{dto.entId}
-              </if>)
-          </when>
-      </choose>
-      group by a.id
-      ) tab
-      where tab.id is not null
-      order by tab.update_time desc
+    <select id="findPojoAndManager" resultType="com.sckw.system.model.pojo.FindEntListPojo">
+        select tab.*,
+               case when tab.status = 0 then '正常' else '冻结' end statusName
+        from
+        (
+        select a.id,
+               min(a.firm_name)                          firm_name,
+               min(a.code)                               code,
+               min(a.contacts)                           contacts,
+               min(a.phone)                              phone,
+               min(a.legal_name)                         legal_name,
+               min(a.legal_phone)                        legal_phone,
+               min(a.head)                               head,
+               min(a.integral)                           integral,
+               min(a.balance)                            balance,
+               min(a.experience)                         experience,
+               min(a.member_level)                       member_level,
+               min(a.reg_time)                           reg_time,
+               min(a.reg_source)                         reg_source,
+               min(a.org_code)                           org_code,
+               min(a.city_code)                          city_code,
+               min(a.detail_address)                     detail_address,
+               min(a.lat)                                lat,
+               min(a.lng)                                lng,
+               min(a.approval)                           approval,
+               min(a.approval_time)                      approval_time,
+               min(a.manager)                            manager,
+               min(a.remark)                             remark,
+               min(a.status)                             status,
+               min(a.create_by)                          create_by,
+               min(a.create_time)                        create_time,
+               min(a.update_by)                          update_by,
+               min(a.update_time)                        update_time,
+               min(a.del_flag)                           del_flag,
+               ifnull(GROUP_CONCAT(distinct b.type), '') type,
+               min(k.system_type)                        system_type,
+               min(k.name)                               createByName,
+               min(ku.name)                              updateByName,
+               min(d.id)                                 pid,
+               min(d.firm_name)                          pEntName
+        from kws_enterprise a
+            left join kws_user k on a.create_by = k.id and k.del_flag = 0
+            left join kws_user ku on a.update_by = ku.id and ku.del_flag = 0
+            left join kws_ent_type b on a.id = b.ent_id and b.del_flag = 0
+        <if test="dto.approval == null or (dto.approval != null and dto.approval != 2)">
+            and b.status != 1
+        </if>
+        left join kws_enterprise d on a.id = d.pid
+        where a.del_flag = 0
+        <!--        <if test="authEntIdList != null and authEntIdList.size() != 0">-->
+        <!--            and a.id in-->
+        <!--            <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">-->
+        <!--                #{item}-->
+        <!--            </foreach>-->
+        <!--        </if>-->
+        <if test="dto.typeList != null and dto.typeList.size() > 0">
+            and exists (select 1
+                        from kws_ent_type kt
+            where a.id = kt.ent_id
+              and kt.del_flag = 0
+              and kt.type in
+            <foreach collection="dto.typeList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+            )
+        </if>
+        <choose>
+            <when test="dto.approval != null and dto.approval == 3">
+                and a.approval in (3, 4)
+            </when>
+            <when test="dto.approval != null and dto.approval != 3">
+                and a.approval = #{dto.approval}
+            </when>
+        </choose>
+        <if test="dto.customer != null and dto.customer == 1">
+            and a.approval in (1, 4)
+        </if>
+        <if test="dto.keywords != null">
+            and (a.contacts like concat('%', #{dto.keywords}, '%') or a.phone like concat('%', #{dto.keywords}, '%') or
+                 a.firm_name like concat('%', #{dto.keywords}, '%')
+                or d.firm_name like concat('%', #{dto.keywords}, '%') or
+                 d.contacts like concat('%', #{dto.keywords}, '%') or d.phone like concat('%', #{dto.keywords}, '%'))
+        </if>
+        <if test="dto.startTime != null">
+            and a.reg_time >= #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null">
+            and a.reg_time &lt;= #{dto.endTime}
+        </if>
+        <if test="dto.approvalStartTime != null">
+            and a.approval_time >= #{dto.approvalStartTime}
+        </if>
+        <if test="dto.approvalEndTime != null">
+            and a.approval_time &lt; date_add(#{dto.approvalEndTime}, INTERVAL 1 DAY)
+        </if>
+        <if test="dto.status != null and dto.status != ''">
+            and a.status = #{dto.status}
+        </if>
+        <if test="dto.entryType != null and dto.entryType == 1">
+            and k.system_type = 2
+        </if>
+        <if test="dto.entryType != null and dto.entryType == 2">
+            and k.system_type = 1
+        </if>
+        <!--    查询子公司-->
+        <if test="dto.entId != null">
+            and a.pid = #{dto.entId}
+        </if>
+        <if test="dto.idList != null and dto.idList.size() > 0">
+            and a.id in
+            <foreach collection="dto.idList" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        group by a.id
+        ) tab
+        order by tab.update_time desc
     </select>
 
-  <select id="findEnterpriseIdsByUserIdAndUserRoleIds" resultType="java.lang.Long">
-      SELECT id
-      from kws_enterprise
-      <where>
-          del_flag = 0
-          and status = 0
-          <if test="userIds != null and userIds.size() != 0">
-              and            ( (manager in
-              <foreach collection="userIds" item="item" separator="," open="(" close=")">
-                  #{item}
-              </foreach>
-              ) or manager in (SELECT user_id
-              from kws_user_dept
-              where dept_id in (SELECT dept_id
-              from kws_authority
-              <where>
-                  status = 0
-                  and del_flag = 0
-                  <if test="roleIds != null and roleIds.size() != 0">
-                      and role_id in
-                      <foreach collection="roleIds" item="item" separator="," open="(" close=")">
-                          #{item}
-                      </foreach>
-                  </if>
-              </where>
-              )
-              )
-              )
-          </if>
-      </where>
+    <select id="findEnterpriseIdsByUserIdAndUserRoleIds" resultType="java.lang.Long">
+        SELECT id
+        from kws_enterprise
+        <where>
+            del_flag = 0
+              and status = 0
+            <if test="userIds != null and userIds.size() != 0">
+                and            ( (manager in
+                <foreach collection="userIds" item="item" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+                ) or manager in (SELECT user_id
+                                 from kws_user_dept
+                where dept_id in (SELECT dept_id
+                                  from kws_authority
+                <where>
+                    status = 0
+                      and del_flag = 0
+                    <if test="roleIds != null and roleIds.size() != 0">
+                        and role_id in
+                        <foreach collection="roleIds" item="item" separator="," open="(" close=")">
+                            #{item}
+                        </foreach>
+                    </if>
+                </where>
+                )
+                )
+                    )
+            </if>
+        </where>
     </select>
 
-  <select id="findEnterpriseIdsByUserIds" resultType="java.lang.Long">
-      SELECT id
-      from kws_enterprise
-      where status = 0
-        and del_flag = 0
-      <if test="userIds != null and userIds.size() != 0">
-          and manager in
-          <foreach collection="userIds" separator="," close=")" open="(" item="item">
-      #{item}
-          </foreach>
-      </if>
-  </select>
+    <select id="findEnterpriseIdsByUserIds" resultType="java.lang.Long">
+        SELECT id
+        from kws_enterprise
+        where status = 0
+          and del_flag = 0
+        <if test="userIds != null and userIds.size() != 0">
+            and manager in
+            <foreach collection="userIds" separator="," close=")" open="(" item="item">
+                #{item}
+            </foreach>
+        </if>
+    </select>
 
-  <select id="findAllEnterprise" resultMap="BaseResultMap">
-      select
-      <include refid="Base_Column_List" />
-      from kws_enterprise where status = 0
-      and del_flag = 0
+    <select id="findAllEnterprise" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_enterprise
+        where status = 0
+          and del_flag = 0
     </select>
 
-  <select id="queryEnterpriseByEntIds" resultMap="BaseResultMap">
-      select
-      <include refid="Base_Column_List" />
-      from kws_enterprise where status = 0
-      and del_flag = 0
-      <if test="entIds != null and entIds.size() != 0">
-          and id in
-          <foreach collection="entIds" separator="," close=")" open="(" item="item">
-              #{item}
-          </foreach>
-      </if>
+    <select id="queryEnterpriseByEntIds" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_enterprise where status = 0
+                              and del_flag = 0
+        <if test="entIds != null and entIds.size() != 0">
+            and id in
+            <foreach collection="entIds" separator="," close=")" open="(" item="item">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="findEnterpriseByName" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_enterprise
+        where firm_name = #{enterpriseName}
+    </select>
+
+    <select id="query" resultType="com.sckw.system.model.vo.res.EntInfo">
+        select id, firm_name as entName
+        from kws_enterprise
+        where del_flag = 0
+          and pid = 0
+          and firm_name = #{entName}
+          and status = 0
+          and approval = 1
     </select>
 
-  <select id="findEnterpriseByName" resultMap="BaseResultMap">
-      select
-      <include refid="Base_Column_List" />
-      from kws_enterprise where firm_name =#{enterpriseName}
+    <select id="queryCte" resultType="com.sckw.system.model.vo.res.EntBaseInfo">
+        with RECURSIVE ent_tree as
+                           (select id, pid, firm_name
+                            from kws_enterprise
+                            where del_flag = 0
+                              and id = #{entId}
+                            union all
+                            select ke.id, ke.pid, ke.firm_name
+                            from kws_enterprise ke
+                                     inner join ent_tree et on et.id = ke.pid
+                            where ke.del_flag = 0)
+        select *
+        from ent_tree;
     </select>
-</mapper>
+</mapper>

+ 2 - 3
sckw-modules/sckw-system/src/main/resources/mapper/KwsMenuDao.xml

@@ -285,9 +285,8 @@
           using_roles like concat('%', #{item}, '%')
         </foreach>
       </if>
-    <if test="entId != null and clientType != 3">
+    <if test="entId != null">
       and smr.ent_id = #{entId}
-      and smr.role_id is null
     </if>
     <if test="roleIds != null and roleIds.size() > 0 and clientType != 3">
       and smr.role_id in
@@ -388,4 +387,4 @@
       and name like concat('%', #{name,jdbcType=VARCHAR}, '%')
     </if>
   </select>
-</mapper>
+</mapper>

+ 83 - 84
sckw-modules/sckw-system/src/main/resources/mapper/KwsRoleDao.xml

@@ -4,7 +4,7 @@
   <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsRole">
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="dept_id" jdbcType="BIGINT" property="deptId" />
+    <result column="ent_id" jdbcType="BIGINT" property="entId" />
     <result column="remark" jdbcType="VARCHAR" property="remark" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="create_by" jdbcType="BIGINT" property="createBy" />
@@ -15,12 +15,12 @@
   </resultMap>
 
   <sql id="Base_Column_List">
-    id, name, dept_id, remark, status, create_by, create_time, update_by, update_time,
+    id, name, ent_id, remark, status, create_by, create_time, update_by, update_time,
     del_flag
   </sql>
 
   <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from kws_role
     where id = #{id,jdbcType=BIGINT}
@@ -35,8 +35,8 @@
       <if test="name != null">
         name,
       </if>
-      <if test="deptId != null">
-        dept_id,
+        <if test="entId != null">
+            ent_id,
       </if>
       <if test="remark != null">
         remark,
@@ -67,8 +67,8 @@
       <if test="name != null">
         #{name,jdbcType=VARCHAR},
       </if>
-      <if test="deptId != null">
-        #{deptId,jdbcType=BIGINT},
+      <if test="entId != null">
+         #{entId,jdbcType=VARCHAR},
       </if>
       <if test="remark != null">
         #{remark,jdbcType=VARCHAR},
@@ -95,79 +95,82 @@
   </insert>
 
   <update id="update" parameterType="com.sckw.system.model.KwsRole">
-    update kws_role
-    <set>
-      <if test="name != null">
-        name = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="deptId != null">
-        dept_id = #{deptId,jdbcType=BIGINT},
-      </if>
-      <if test="remark != null">
-        remark = #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        status = #{status,jdbcType=INTEGER},
-      </if>
-      <if test="createBy != null">
-        create_by = #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        update_by = #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        update_time = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        del_flag = #{delFlag,jdbcType=INTEGER},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
+      update kws_role
+      <set>
+          <if test="name != null">
+              name = #{name,jdbcType=VARCHAR},
+          </if>
+          <if test="entId != null">
+              ent_id = #{entId,jdbcType=VARCHAR},
+          </if>
+          <if test="remark != null">
+              remark = #{remark,jdbcType=VARCHAR},
+          </if>
+          <if test="status != null">
+              status = #{status,jdbcType=INTEGER},
+          </if>
+          <if test="createBy != null">
+              create_by = #{createBy,jdbcType=BIGINT},
+          </if>
+          <if test="createTime != null">
+              create_time = #{createTime,jdbcType=TIMESTAMP},
+          </if>
+          <if test="updateBy != null">
+              update_by = #{updateBy,jdbcType=BIGINT},
+          </if>
+          <if test="updateTime != null">
+              update_time = #{updateTime,jdbcType=TIMESTAMP},
+          </if>
+          <if test="delFlag != null">
+              del_flag = #{delFlag,jdbcType=INTEGER},
+          </if>
+      </set>
+      where id = #{id,jdbcType=BIGINT}
   </update>
 
   <select id="findPage" resultType="com.sckw.system.model.vo.res.RoleResVo" parameterType="java.util.Map" >
-    select
-    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
-      and sr.id != #{manageRoleId}
-    <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; date_add(#{endTime}, INTERVAL 1 DAY)
-    </if>
-    <if test="idList != null and idList.size() > 0">
-        and sr.id in
-      <foreach collection="idList" item="item" open="(" close=")" separator=",">
-        #{item}
-      </foreach>
-    </if>
-    ORDER BY sr.create_time desc
+      select sr.id,
+             sr.name,
+             k.id                           entId,
+             k.firm_name                 as entName,
+             (select count(1)
+              from kws_user ku
+                       inner join kws_user_role kur
+                                  on ku.id = kur.user_id and kur.del_flag = 0
+              where ku.del_flag = 0
+                and kur.role_id = sr.id) as count,
+             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 and su.del_flag = 0
+               left join kws_enterprise k on k.id = sr.ent_id and k.del_flag = 0
+      where sr.del_flag = 0
+      <if test="name != null and name != ''">
+          and (sr.name like concat('%', #{name, jdbcType=VARCHAR}, '%') or
+               su.name like concat('%', #{name, jdbcType=VARCHAR}, '%')
+              or k.firm_name like concat('%', #{name, jdbcType=VARCHAR}, '%'))
+      </if>
+      <if test="entId != null and entId != ''">
+          and sr.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; date_add(#{endTime}, INTERVAL 1 DAY)
+      </if>
+      <if test="idList != null and idList.size() > 0">
+          and sr.ent_id in
+          <foreach collection="idList" item="item" open="(" close=")" separator=",">
+              #{item}
+          </foreach>
+      </if>
+      ORDER BY sr.create_time desc
   </select>
 
   <select id="queryRoleByUserId" resultType="com.sckw.system.model.KwsRole">
@@ -190,13 +193,9 @@
   </select>
 
     <select id="selectBatchByUnitIds" resultType="com.sckw.system.model.KwsRole">
-      select a.*
+        select a.*
         from kws_role a
-       where a.dept_id in
-      <foreach collection="list" item="item" open="(" close=")" separator=",">
-        #{item}
-      </foreach>
-      and a.del_flag = 0
+        where a.del_flag = 0
     </select>
 
-</mapper>
+</mapper>

+ 304 - 356
sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml

@@ -1,396 +1,344 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.system.dao.KwsUserDao">
-  <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsUser">
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="system_type" jdbcType="INTEGER" property="systemType" />
-    <result column="account" jdbcType="VARCHAR" property="account" />
-    <result column="password" jdbcType="VARCHAR" property="password" />
-    <result column="salt" jdbcType="VARCHAR" property="salt" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="phone" jdbcType="VARCHAR" property="phone" />
-    <result column="photo" jdbcType="VARCHAR" property="photo" />
-    <result column="email" jdbcType="VARCHAR" property="email" />
-    <result column="client_id" jdbcType="VARCHAR" property="clientId" />
-    <result column="is_main" jdbcType="INTEGER" property="isMain" />
-    <result column="remark" jdbcType="VARCHAR" property="remark" />
-    <result column="status" jdbcType="INTEGER" property="status" />
-    <result column="create_by" jdbcType="BIGINT" property="createBy" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
-  </resultMap>
-
-  <sql id="Base_Column_List">
-    id, system_type, account, password, name, phone, photo, email, client_id, is_main,
-    remark, status, create_by, create_time, update_by, update_time, del_flag, salt
-  </sql>
-
-  <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from kws_user
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-
-  <select id="selectByKeys"  resultMap="BaseResultMap">
-    select
-    <include refid="Base_Column_List" />
-    from kws_user
-    where del_flag = 0
-      and id in
-    <foreach collection="list" item="item" open="(" close=")" separator=",">
-      #{item}
-    </foreach>
-  </select>
-
-
-  <insert id="insert" parameterType="com.sckw.system.model.KwsUser">
-    insert into kws_user
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
+    <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsUser">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="ent_id" jdbcType="BIGINT" property="entId"/>
+        <result column="system_type" jdbcType="INTEGER" property="systemType"/>
+        <result column="account" jdbcType="VARCHAR" property="account"/>
+        <result column="password" jdbcType="VARCHAR" property="password"/>
+        <result column="salt" jdbcType="VARCHAR" property="salt"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="phone" jdbcType="VARCHAR" property="phone"/>
+        <result column="photo" jdbcType="VARCHAR" property="photo"/>
+        <result column="email" jdbcType="VARCHAR" property="email"/>
+        <result column="client_id" jdbcType="VARCHAR" property="clientId"/>
+        <result column="is_main" jdbcType="INTEGER" property="isMain"/>
+        <result column="remark" jdbcType="VARCHAR" property="remark"/>
+        <result column="status" jdbcType="INTEGER" property="status"/>
+        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
+    </resultMap>
+    <resultMap id="EnterpriseVOMap" type="com.sckw.system.model.vo.res.KwsUserResVo">
+        <result column="id" property="id"/>
+        <result column="remark" property="remark"/>
+        <result column="system_type" property="systemType"/>
+        <result column="account" property="account"/>
+        <result column="name" property="name"/>
+        <result column="phone" property="phone"/>
+        <result column="photo" property="photo"/>
+        <result column="email" property="email"/>
+        <result column="ent_id" property="entId"/>
+        <result column="entName" property="entName"/>
+        <result column="status" property="status"/>
+        <result column="createByName" property="createByName"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="roleIdList" property="roleIdList" typeHandler="com.sckw.core.handler.LongListTypeHandler"/>
+        <result column="roleNameList" property="roleNameList"
+                typeHandler="com.sckw.core.handler.StringListTypeHandler"/>
+    </resultMap>
+    <sql id="Base_Column_List">
         id,
-      </if>
-      <if test="systemType != null">
+        ent_id,
         system_type,
-      </if>
-      <if test="account != null">
         account,
-      </if>
-      <if test="password != null">
         password,
-      </if>
-      <if test="name != null">
         name,
-      </if>
-      <if test="phone != null">
         phone,
-      </if>
-      <if test="photo != null">
         photo,
-      </if>
-      <if test="email != null">
         email,
-      </if>
-      <if test="clientId != null">
         client_id,
-      </if>
-      <if test="isMain != null">
         is_main,
-      </if>
-      <if test="remark != null">
         remark,
-      </if>
-      <if test="status != null">
         status,
-      </if>
-      <if test="createBy != null">
         create_by,
-      </if>
-      <if test="createTime != null">
         create_time,
-      </if>
-      <if test="updateBy != null">
         update_by,
-      </if>
-      <if test="updateTime != null">
         update_time,
-      </if>
-      <if test="delFlag != null">
         del_flag,
-      </if>
-      <if test="salt != null">
-        salt,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="systemType != null">
-        #{systemType,jdbcType=INTEGER},
-      </if>
-      <if test="account != null">
-        #{account,jdbcType=VARCHAR},
-      </if>
-      <if test="password != null">
-        #{password,jdbcType=VARCHAR},
-      </if>
-      <if test="name != null">
-        #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="phone != null">
-        #{phone,jdbcType=VARCHAR},
-      </if>
-      <if test="photo != null">
-        #{photo,jdbcType=VARCHAR},
-      </if>
-      <if test="email != null">
-        #{email,jdbcType=VARCHAR},
-      </if>
-      <if test="clientId != null">
-        #{clientId,jdbcType=VARCHAR},
-      </if>
-      <if test="isMain != null">
-        #{isMain,jdbcType=INTEGER},
-      </if>
-      <if test="remark != null">
-        #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        #{status,jdbcType=INTEGER},
-      </if>
-      <if test="createBy != null">
-        #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        #{delFlag,jdbcType=INTEGER},
-      </if>
-      <if test="salt != null">
-        #{salt,jdbcType=VARCHAR},
-      </if>
-    </trim>
-  </insert>
-
-  <update id="update" parameterType="com.sckw.system.model.KwsUser">
-    update kws_user
-    <set>
-      <if test="systemType != null">
-        system_type = #{systemType,jdbcType=INTEGER},
-      </if>
-      <if test="account != null">
-        account = #{account,jdbcType=VARCHAR},
-      </if>
-      <if test="password != null">
-        password = #{password,jdbcType=VARCHAR},
-      </if>
-      <if test="name != null">
-        name = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="phone != null">
-        phone = #{phone,jdbcType=VARCHAR},
-      </if>
-      <if test="photo != null">
-        photo = #{photo,jdbcType=VARCHAR},
-      </if>
-      <if test="email != null">
-        email = #{email,jdbcType=VARCHAR},
-      </if>
-      <if test="clientId != null">
-        client_id = #{clientId,jdbcType=VARCHAR},
-      </if>
-      <if test="isMain != null">
-        is_main = #{isMain,jdbcType=INTEGER},
-      </if>
-      <if test="remark != null">
-        remark = #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        status = #{status,jdbcType=INTEGER},
-      </if>
-      <if test="createBy != null">
-        create_by = #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        update_by = #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        update_time = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        del_flag = #{delFlag,jdbcType=INTEGER},
-      </if>
-      <if test="salt != null">
-        salt = #{salt,jdbcType=VARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
+        salt
+    </sql>
 
-  <select id="findPage" resultType="com.sckw.system.model.vo.res.KwsUserResVo" parameterType="java.util.Map" >
-    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,
-    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 = #{systemType, jdbcType=VARCHAR}
-    </if>
-    <if test="idList != null and idList.size() > 0">
-      and su.id in
-      <foreach collection="idList" item="item" open="(" close=")" separator=",">
-        #{item}
-      </foreach>
-    </if>
-    <if test="account != null and account != ''">
-      and su.account = #{account, jdbcType=VARCHAR}
-    </if>
-    <if test="name != null and name != ''">
-      and su.name = #{name, jdbcType=VARCHAR}
-    </if>
-    <if test="phone != null and phone != ''">
-      and su.phone = #{phone, jdbcType=VARCHAR}
-    </if>
-    <if test="email != null and email != ''">
-      and su.email = #{email, jdbcType=VARCHAR}
-    </if>
-    <if test="isMain != null">
-      and su.is_main = #{isMain}
-    </if>
-    <if test="deptId != null and deptId != ''">
-      and c.id = #{deptId, jdbcType=VARCHAR}
-    </if>
-      <if test="roleId != null and roleId != ''">
-        and e.id = #{roleId}
-      </if>
-      <if test="keywords != null and 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 c.ent_id = #{entId}
-    </if>
-    <if test="startTime != null and startTime != ''">
-      and su.create_time >= #{startTime}
-    </if>
-    <if test="endTime != null and endTime != ''">
-      and su.create_time &lt; date_add(#{endTime}, INTERVAL 1 DAY)
-    </if>
-    ORDER BY su.create_time desc
-  </select>
+    <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_user
+        where id = #{id,jdbcType=BIGINT}
+    </select>
 
-  <select id="findList" resultType="com.sckw.system.model.vo.res.KwsUserResVo" parameterType="com.sckw.system.model.KwsUser" >
-    select
-      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, c.ent_id entId, e.id roleId, e.name roleName,
-      u1.name createByName, su.create_time createTime, su.update_time updateTime
-    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 u1 on su.create_by = u1.id
-    where su.del_flag = 0
-    <if test="systemType != null and systemType != ''">
-      and su.system_type = #{systemType, jdbcType=INTEGER}
-    </if>
-    <if test="account != null and account != ''">
-      and su.account = #{account, jdbcType=VARCHAR}
-    </if>
-    <if test="name != null and name != ''">
-      and su.name = #{name, jdbcType=VARCHAR}
-    </if>
-    <if test="userName != null and userName != ''">
-      and su.name like concat('%', #{userName}, '%')
-    </if>
-    <if test="phone != null and phone != ''">
-      and su.phone = #{phone, jdbcType=VARCHAR}
-    </if>
-    <choose>
-      <when test="entIds != null and entIds != '' and entIds.size() > 0">
-        and c.ent_id in
-        <foreach collection="entIds" item="id" open="(" close=")" separator=",">
-          #{id,jdbcType=BIGINT}
+    <select id="selectByKeys" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_user
+        where del_flag = 0
+          and id in
+        <foreach collection="list" item="item" open="(" close=")" separator=",">
+            #{item}
         </foreach>
-      </when>
-    </choose>
-    ORDER BY su.create_time desc
-  </select>
+    </select>
+
+
+    <select id="findPage" resultMap="EnterpriseVOMap" parameterType="java.util.Map">
+        select su.id,
+               su.ent_id,
+               ke.firm_name         entName,
+               su.system_type,
+               su.account,
+               su.password,
+               su.name,
+               su.phone,
+               su.photo,
+               su.email,
+               su.is_main           isMain,
+               su.remark,
+               su.status,
+               group_concat(e.id)   roleIdList,
+               group_concat(e.name) roleNameList,
+               su.create_time,
+               su2.`name`           createByName,
+               su.update_time
+        from kws_user su
+                 left join kws_user_role d on su.id = d.user_id and d.del_flag = 0
+                 left join kws_role e on e.id = d.role_id and e.del_flag = 0
+                 left join kws_user su2 on su.create_by = su2.id and su2.del_flag = 0
+                 left join kws_enterprise ke on ke.id = su.ent_id and ke.del_flag = 0
+        where su.del_flag = 0
+        <if test="systemType != null and systemType != ''">
+            and su.system_type = #{systemType, jdbcType=VARCHAR}
+        </if>
+        <if test="idList != null and idList.size() > 0">
+            and su.id in
+            <foreach collection="idList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="entList != null and entList.size() > 0">
+            and su.ent_id in
+            <foreach collection="entList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="account != null and account != ''">
+            and su.account = #{account, jdbcType=VARCHAR}
+        </if>
+        <if test="name != null and name != ''">
+            and su.name = #{name, jdbcType=VARCHAR}
+        </if>
+        <if test="phone != null and phone != ''">
+            and su.phone = #{phone, jdbcType=VARCHAR}
+        </if>
+        <if test="email != null and email != ''">
+            and su.email = #{email, jdbcType=VARCHAR}
+        </if>
+        <if test="isMain != null">
+            and su.is_main = #{isMain}
+        </if>
+        <if test="roleId != null and roleId != ''">
+            and e.id = #{roleId}
+        </if>
+        <if test="keywords != null and 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.ent_id = #{entId}
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and su.create_time >= #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and su.create_time &lt; date_add(#{endTime}, INTERVAL 1 DAY)
+        </if>
+        group by su.id,
+                 su.ent_id,
+                 ke.firm_name,
+                 su.system_type,
+                 su.account,
+                 su.password,
+                 su.name,
+                 su.phone,
+                 su.photo,
+                 su.email,
+                 su.is_main,
+                 su.remark,
+                 su.status, su.create_time,
+                 su2.`name`,
+                 su.update_time
+        ORDER BY su.create_time desc
+    </select>
 
-  <select id="queryUserDeptByUserId" resultType="com.sckw.system.model.KwsUserDept">
-    select a.* from kws_user_dept a where a.user_id = #{userId} and a.del_flag = 0
-  </select>
+    <select id="findList"
+            parameterType="com.sckw.system.model.KwsUser" resultType="com.sckw.system.model.vo.res.KwsUserResVo">
+        select 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,
+               su.ent_id      entId,
+               u1.name        createByName,
+               su.create_time createTime,
+               su.update_time updateTime
+        from kws_user su
+                 left join kws_user u1 on su.create_by = u1.id
+        where su.del_flag = 0
+        <if test="systemType != null and systemType != ''">
+            and su.system_type = #{systemType, jdbcType=INTEGER}
+        </if>
+        <if test="isMain != null ">
+            and su.is_main = #{isMain}
+        </if>
+        <if test="account != null and account != ''">
+            and su.account = #{account, jdbcType=VARCHAR}
+        </if>
+        <if test="name != null and name != ''">
+            and su.name = #{name, jdbcType=VARCHAR}
+        </if>
+        <if test="userName != null and userName != ''">
+            and su.name like concat('%', #{userName}, '%')
+        </if>
+        <if test="phone != null and phone != ''">
+            and su.phone = #{phone, jdbcType=VARCHAR}
+        </if>
+        <choose>
+            <when test="entIds != null and entIds != '' and entIds.size() > 0">
+                and su.ent_id in
+                <foreach collection="entIds" item="id" open="(" close=")" separator=",">
+                    #{id,jdbcType=BIGINT}
+                </foreach>
+            </when>
+        </choose>
+        ORDER BY su.create_time desc
+    </select>
 
-  <select id="queryDeptByIds" resultType="com.sckw.system.model.KwsDept">
-    select a.*
-      from kws_dept a
-     where a.id in
-     <foreach collection="list" item="item" open="(" close=")" separator=",">
-        #{item}
-     </foreach>
-  </select>
-  <select id="selectByEntId" resultType="com.sckw.system.model.KwsUser">
-    select distinct c.*
-      from kws_dept a
-      left join kws_user_dept b on a.id = b.dept_id
-      left join kws_user c on b.user_id = c.id
-     where a.ent_id = #{entId}
-       and a.del_flag = 0
-       and b.del_flag = 0
-       and c.del_flag = 0
-  </select>
+    <select id="queryUserDeptByUserId" resultType="com.sckw.system.model.KwsUserDept">
+        select a.*
+        from kws_user_dept a
+        where a.user_id = #{userId}
+          and a.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>
+    <select id="queryDeptByIds" resultType="com.sckw.system.model.KwsDept">
+        select a.*
+        from kws_dept a
+        where a.id in
+        <foreach collection="list" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+    <select id="selectByEntId" resultType="com.sckw.system.model.KwsUser">
+        select distinct c.*
+        from kws_dept a
+                 left join kws_user_dept b on a.id = b.dept_id
+                 left join kws_user c on b.user_id = c.id
+        where a.ent_id = #{entId}
+          and a.del_flag = 0
+          and b.del_flag = 0
+          and c.del_flag = 0
+    </select>
 
-  <select id="getUserByName" resultType="com.sckw.system.model.KwsUser">
-    select a.*
-      from kws_user a
-     where a.del_flag = 0
-       and a.name like concat('%', #{name}, '%')
-  </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>
+
+    <select id="getUserByName" resultType="com.sckw.system.model.KwsUser">
+        select a.*
+        from kws_user a
+        where a.del_flag = 0
+          and a.name like concat('%', #{name}, '%')
+    </select>
 
     <select id="selectByDeptIds" resultType="com.sckw.system.model.KwsUser">
-      select a.*
-       from kws_user a
-       left join kws_user_dept b on a.id = b.user_id
-       left join kws_dept c on b.dept_id = c.id
-      where a.del_flag = 0
-        and c.del_flag = 0
-        and c.id in
+        select a.*
+        from kws_user a
+                 left join kws_user_dept b on a.id = b.user_id
+                 left join kws_dept c on b.dept_id = c.id
+        where a.del_flag = 0
+          and c.del_flag = 0
+          and c.id in
         <foreach collection="list" open="(" close=")" separator="," item="item">
-          #{item}
+            #{item}
         </foreach>
     </select>
 
-  <select id="selectUserBySystemType" resultType="com.sckw.system.model.vo.res.KwsUserSystemTypeVo">
-      select u.id AS id,u.system_type AS systemType,u.account AS account,u.name AS name, u.phone AS phone,u.is_main as isMain
-      from kws_user AS u
-      where u.del_flag = 0 and u.status = 0 and u.system_type = #{systemType}
+    <select id="selectUserBySystemType" resultType="com.sckw.system.model.vo.res.KwsUserSystemTypeVo">
+        select u.id          AS id,
+               u.system_type AS systemType,
+               u.account     AS account,
+               u.name        AS name,
+               u.phone       AS phone,
+               u.is_main     as isMain
+        from kws_user AS u
+        where u.del_flag = 0
+          and u.status = 0
+          and u.system_type = #{systemType}
     </select>
 
     <select id="selectUserBySystemTypeAndMain" resultType="com.sckw.system.model.vo.res.KwsUserSystemTypeVo">
-      select u.id AS id,u.system_type AS systemType,u.account AS account,u.name AS name, u.phone AS phone,u.is_main as isMain
-      from kws_user AS u
-      where u.del_flag = 0 and u.status = 0 and u.system_type = #{systemType} and u.is_main=#{isMain}
+        select u.id          AS id,
+               u.system_type AS systemType,
+               u.account     AS account,
+               u.name        AS name,
+               u.phone       AS phone,
+               u.is_main     as isMain
+        from kws_user AS u
+        where u.del_flag = 0
+          and u.status = 0
+          and u.system_type = #{systemType}
+          and u.is_main = #{isMain}
     </select>
 
     <select id="selectManager" resultMap="BaseResultMap">
-      select a.*
-      from kws_user a
-      where a.del_flag = 0 and a.status = 0 and a.is_main = 0
+        select a.*
+        from kws_user a
+        where a.del_flag = 0
+          and a.status = 0
+          and a.is_main = 0
+    </select>
+
+    <select id="queryUser" resultType="com.sckw.system.model.vo.res.KwsUserResVo">
+        select su.id,
+               su.system_type,
+               su.account,
+               su.password,
+               su.name,
+               su.phone,
+               su.photo,
+               su.email,
+               su.is_main,
+               su.remark,
+               su.status,
+               su.salt,
+               su.ent_id,
+               u1.name createByName,
+               su.create_time,
+               su.update_time
+        from kws_user su
+                 left join kws_user u1 on su.create_by = u1.id
+        where su.del_flag = 0
+        <if test="systemType != null and systemType != ''">
+            and su.system_type = #{systemType, jdbcType=INTEGER}
+        </if>
+        <if test="account != null and account != ''">
+            and su.account = #{account, jdbcType=VARCHAR}
+        </if>
     </select>
-</mapper>
+</mapper>

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

@@ -15,12 +15,12 @@
   </resultMap>
 
   <sql id="Base_Column_List">
-    id, user_id, role_id, remark, status, create_by, create_time, update_by, update_time, 
+    id, user_id, role_id, remark, status, create_by, create_time, update_by, update_time,
     del_flag
   </sql>
 
   <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from kws_user_role
     where id = #{id,jdbcType=BIGINT}
@@ -201,4 +201,19 @@
           </foreach>
       </if>
   </select>
-</mapper>
+
+  <select id="queryRoleList" resultType="com.sckw.system.api.model.dto.res.RoleInfoDto">
+      select kur.role_id,
+             kr.name      roleName,
+             kr.ent_id,
+             ke.firm_name entName
+      from kws_user_role kur
+               left join kws_role kr on kur.role_id = kr.id and kr.del_flag = 0
+               left join kws_enterprise ke on ke.id = kr.ent_id and ke.del_flag = 0
+      <where>
+          kur.del_flag = 0
+            and kur.user_id = #{userId}
+      </where>
+      order by kr.create_time
+  </select>
+</mapper>