czh 2 年之前
父節點
當前提交
7c9bb41075

+ 14 - 13
sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/RequestCheckFilter.java

@@ -112,22 +112,12 @@ public class RequestCheckFilter implements Filter {
         String key = Global.getFullUserLoginKey(NumberUtils.parseInt(systemType), userId);
         String userInfoStr = RedissonUtils.getString(key);
         LoginUserInfo loginUserInfo = StringUtils.isNotBlank(userInfoStr) ? JSON.parseObject(userInfoStr, LoginUserInfo.class) : null;
-        if (StringUtils.isBlank(userInfoStr) || loginUserInfo == null) {
+        if (Objects.isNull(loginUserInfo)) {
             ResponseUtil.writer(response, HttpResult.error(HttpStatus.TOKEN_INVALID_CODE, HttpStatus.TOKEN_INVALID_MESSAGE));
             return;
         }
 
 
-        if (loginUserInfo.getIsMain() == Global.YES && Integer.parseInt(systemType) == SystemTypeEnum.MANAGE.getCode()) {
-            LoginUserHolder.set(loginUserInfo);
-            RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
-            RedissonUtils.putString(Global.getFullUserLoginKey(NumberUtils.parseInt(systemType), loginUserInfo.getId()), JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
-            RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
-            filterChain.doFilter(servletRequest, servletResponse);
-            LoginUserHolder.remove();
-            return;
-        }
-
         //校验用户账号是否冻结
         if (loginUserInfo.getStatus() == Global.YES) {
             ResponseUtil.writer(response, HttpResult.error(HttpStatus.TOKEN_INVALID_CODE, "您的账号已被冻结,请联系系统管理员!"));
@@ -137,6 +127,18 @@ public class RequestCheckFilter implements Filter {
         /*4、登录中的企业信息*/
         String loginEntStr = RedissonUtils.getString(Global.getFullUserEntKey(loginUserInfo.getEntId()));
         LoginEntInfo loginEntInfo = StringUtils.isNotBlank(loginEntStr) ? JSON.parseObject(loginEntStr, LoginEntInfo.class) : null;
+
+        if (loginUserInfo.getIsMain() == Global.YES && SystemTypeEnum.MANAGE.getCode().equals(Integer.parseInt(systemType))) {
+            LoginUserHolder.set(loginUserInfo);
+            LoginEntHolder.set(loginEntInfo);
+            RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
+            RedissonUtils.putString(Global.getFullUserLoginKey(NumberUtils.parseInt(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);
+            LoginUserHolder.remove();
+            return;
+        }
+
         if ((StringUtils.isBlank(loginEntStr) || loginEntInfo == null) && NumberUtils.parseInt(systemType) != SystemTypeEnum.MANAGE.getCode()) {
             ResponseUtil.writer(response, HttpResult.error(HttpStatus.TOKEN_INVALID_CODE, HttpStatus.UN_LOGIN_MESSAGE));
             return;
@@ -175,7 +177,6 @@ public class RequestCheckFilter implements Filter {
 
         LoginUserHolder.set(loginUserInfo);
         LoginEntHolder.set(loginEntInfo);
-        RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
         RedissonUtils.putString(Global.getFullUserLoginKey(NumberUtils.parseInt(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, userId), token, ClientTypeEnum.expireTime(clientType));
@@ -197,7 +198,7 @@ public class RequestCheckFilter implements Filter {
     }
 
     public static void main(String[] args) {
-        Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, "dade5058e78847ca5672263c5b821fc09d06083611ab0f6d076af88f082f05384838b3714729e48088c6fc1d1c09763e85e35675a20ac9df50e443b92e1c18e06f9951c7d6a2905a79b889f8617ab143fc97350b5c68f0512f7c18dbf2e49eaf");
+        Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, "dade5058e78847ca5672263c5b821fc09d06083611ab0f6d076af88f082f0538569486c2369c2aae99f2a8fc7a7de07b57aa7ffadb3c958ef83cb50a10819703d3cb745c501326d65d50ed5aba830326eb64a75b0479f896763a9810e847f430");
         System.out.println(tokenMap);
     }
 }

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

@@ -193,5 +193,6 @@ public class HttpStatus {
     public static final String ACCOUNT_EXISTS = "用户账号已存在!";
     public static final String DICTTYPE_EXISTS = "字典类型已存在,不可重复!";
     public static final String DICT_EXISTS = "字典键值已存在,不可重复!";
+    public static final String PL34 = "3PL和4PL不能同时注册!";
 
 }

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

@@ -33,8 +33,9 @@ public class KwsEnterpriseController {
      * @date 2023/06/02
      **/
     @GetMapping("/detail")
-    public HttpResult detail(@RequestParam Long id) {
-        return HttpResult.ok(kwsEntService.detail(id));
+    public HttpResult detail(@RequestParam Long id,
+                             @RequestParam (value = "isAll", required = false)Boolean isAll) {
+        return HttpResult.ok(kwsEntService.detail(id, isAll));
     }
 
     /**

+ 28 - 6
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -336,14 +336,22 @@ public class KwsEnterpriseService {
         if (CollectionUtils.isNotEmpty(listByEntId)) {
             currentTypeList.addAll(listByEntId.stream().map(KwsEntType::getType).toList());
         }
-        List<String> typeList = Arrays.stream(reqVo.getEntTypes().split(",")).toList();
-        for (String item : typeList) {
-            if (currentTypeList.contains(Integer.parseInt(item))) {
+        List<Integer> typeList = Arrays.stream(reqVo.getEntTypes().split(Global.COMMA)).map(Integer::parseInt).toList();
+        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;
             }
             KwsEntType kwsEntType = new KwsEntType();
             kwsEntType.setEntId(entId);
-            kwsEntType.setType(Integer.parseInt(item));
+            kwsEntType.setType(item);
             kwsEntType.setId(new IdWorker(1).nextId());
             kwsEntType.setStatus(ApprovalEnum.PROCESS.getCode());
             kwsEntType.setCreateBy(userId);
@@ -880,7 +888,7 @@ public class KwsEnterpriseService {
      * @author: czh
      * @date: 2023/7/26
      */
-    public EntDetailResVo detail(Long id) {
+    public EntDetailResVo detail(Long id, Boolean isAll) {
         KwsEnterprise kwsEnterprise = selectByKey(id);
         if (Objects.isNull(kwsEnterprise)) {
             throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
@@ -891,11 +899,25 @@ public class KwsEnterpriseService {
         if (Objects.nonNull(manageInfoByEntId)) {
             entDetailResVo.setContactsId(manageInfoByEntId.getUserId());
         }
+
         List<KwsEntType> listByEntIds = kwsEntTypeDao.findListByEntIds(Collections.singletonList(kwsEnterprise.getId()));
+        List<Integer> types = new ArrayList<>();
         if (CollectionUtils.isNotEmpty(listByEntIds)) {
-            entDetailResVo.setEntTypes(String.join(Global.COMMA, listByEntIds.stream().map(KwsEntType::getType).map(String::valueOf).distinct().toList()));
+            types.addAll(listByEntIds.stream().map(KwsEntType::getType).toList());
         }
 
+        if (Objects.nonNull(isAll) && isAll) {
+            List<KwsEntType> approvalByEntId = kwsEntTypeDao.findApprovalByEntId(kwsEnterprise.getId());
+            if (CollectionUtils.isNotEmpty(approvalByEntId)) {
+                types.addAll(approvalByEntId.stream().map(KwsEntType::getType).toList());
+            }
+        }
+
+        if (CollectionUtils.isNotEmpty(types)) {
+            entDetailResVo.setEntTypes(String.join(Global.COMMA, types.stream().map(String::valueOf).distinct().toList()));
+        }
+
+
         List<KwsEntCheckTrack> list = kwsEntCheckTrackDao.findList(id);
         if (CollectionUtils.isNotEmpty(list)) {
             entDetailResVo.setValid(list.stream().anyMatch(item -> item.getStatus().equals(Global.NO)));

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

@@ -617,7 +617,6 @@ public class KwsUserService {
 
     public List<AreaTreeFrontResDto> test(List<Integer> list) {
         Integer integer = transportStatisticsService.statisticsLogistics(123L);
-
         List<Long> longs = LoginUserHolder.getAuthUserIdList();
 
         return null;