Forráskód Böngészése

修复企业审核通过之后,企业端需要二次登录的问题

xucaiqin 1 hónapja
szülő
commit
291092ceb4

+ 14 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -2,9 +2,10 @@ package com.sckw.system.service;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
-import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
-import com.alibaba.fastjson.JSON;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.PageHelper;
@@ -21,6 +22,7 @@ import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.model.EntCertificateInfo;
+import com.sckw.core.web.model.LoginEntInfo;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.redis.utils.RedissonUtils;
@@ -535,6 +537,14 @@ public class KwsEnterpriseService {
         Integer currentApproval = kwsEnterprise.getApproval();
         kwsEnterprise.setApproval(reqVo.getStatus());
         kwsEnterprise.setRemark(reqVo.getRemark());
+        if (Objects.equals(reqVo.getStatus(), ApprovalEnum.OK.getCode())) {
+            String loginEntStr = RedissonUtils.getString(Global.getFullUserEntKey(entId));
+            LoginEntInfo loginEntInfo = StringUtils.isNotBlank(loginEntStr) ? JSON.parseObject(loginEntStr, LoginEntInfo.class) : null;
+            if (Objects.nonNull(loginEntInfo)) {
+                loginEntInfo.setStatus(reqVo.getStatus());
+                RedissonUtils.putString(Global.getFullUserEntKey(entId), JSONObject.toJSONString(loginEntInfo), Global.PC_TOKEN_EXPIRE);
+            }
+        }
         if (kwsEnterpriseDao.approval(kwsEnterprise) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
@@ -1448,10 +1458,10 @@ public class KwsEnterpriseService {
             throw new BusinessException("企业id不能为空");
         }
         KwsEntType kwsEntType = kwsEntTypeRepository.queryByEntId(req.getEntId());
-        if (Objects.nonNull(kwsEntType)){
+        if (Objects.nonNull(kwsEntType)) {
             req.setLoginEntType(String.valueOf(kwsEntType.getType()));
         }
-        if (req.getEntType().contains(req.getLoginEntType())){
+        if (req.getEntType().contains(req.getLoginEntType())) {
             //登录客户的企业类型和查询的类型是一直的说明只能查询自己和自己的下级
             //发起方的公司信息
             return getEntInfoResp(req);