feat: 外部对接的token增加一个标识存到redis中

This commit is contained in:
2024-07-25 18:19:23 +08:00
parent 002e57c204
commit a31227e7a7
@@ -20,8 +20,10 @@ import com.jero.common.util.MD5Util;
import com.jero.common.util.RedisUtil;
import com.jero.common.util.TokenUtils;
import com.jero.modules.bindPart.entity.BindPartStandardVO;
import com.jero.modules.bindPart.entity.LawsBindPart;
import com.jero.modules.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.bindPart.service.ILawsBindPartDocService;
import com.jero.modules.bindPart.service.ILawsBindPartService;
import com.jero.modules.docking.srms.dto.ByTokenRequests;
import com.jero.modules.docking.srms.dto.ProductDesign;
import com.jero.modules.docking.srms.entity.LawsPartStandard;
@@ -31,8 +33,6 @@ import com.jero.modules.docking.srms.service.ILawsPartStandardService;
import com.jero.modules.docking.srms.service.ILawsSysApiInfoService;
import com.jero.modules.docking.srms.service.SrmsApiService;
import com.jero.modules.docking.srms.vo.*;
import com.jero.modules.bindPart.entity.LawsBindPart;
import com.jero.modules.bindPart.service.ILawsBindPartService;
import com.jero.modules.laws.documenttool.entity.LawsDocumentSplit;
import com.jero.modules.laws.documenttool.mapper.LawsDocumentSplitMapper;
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
@@ -49,14 +49,12 @@ import com.jero.modules.split.entity.SarFileSplitMenuEO;
import com.jero.modules.split.page.SarFileSplitMenuEOPage;
import com.jero.modules.split.service.ISarFileSplitInfoService;
import com.jero.modules.split.service.ISarFileSplitMenuEOService;
import com.jero.modules.sys.utils.UserUtils;
import com.jero.modules.system.service.ILoginService;
import com.jero.modules.tag.enums.TableNameEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
@@ -185,9 +183,14 @@ public class SrmsApiServiceImpl implements SrmsApiService {
re = loginService.srmsByToken(ettonSysUser);
String token = re.getResult().get("token").toString();
String tokenKey = byTokenRequests.getUsername() + token;
String viewKey = token + "-X";
redisUtil.set(tokenKey, token, 3600);
redisUtil.set(viewKey, token, 3600);
} else {
re = loginService.srmsByToken(byTokenRequests.getUsername());
String token = re.getResult().get("token").toString();
String viewKey = token + "-X";
redisUtil.set(viewKey, token, 3600);
}
return re;
} catch (Exception e) {