mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 20:49:00 +08:00
🐛 Fixing a bug. close #4520 打开积木报表报错:全局异常信息 ex=JmReportTokenServices实现类getUsername方法返回值不允许为空
This commit is contained in:
1 parent
3d0fde8e1b
commit
756617ae64
2 files changed
+11
-2
No files matched your search
+2
@@ -18,6 +18,7 @@
|
||||
package com.pig4cloud.pigx.admin.api.feign;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.ServiceNameConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
@@ -63,6 +64,7 @@ public interface RemoteTokenService {
|
||||
*/
|
||||
@GetMapping("/token/query-token")
|
||||
R<Map<String, Object>> queryToken(@RequestParam("token") String token,
|
||||
@RequestParam(CommonConstants.TENANT_ID) String tenantId,
|
||||
@RequestHeader(SecurityConstants.FROM) String from);
|
||||
|
||||
}
|
||||
+9
-2
@@ -1,5 +1,7 @@
|
||||
package com.pig4cloud.pigx.bi.config;
|
||||
|
||||
import cn.hutool.core.util.CharUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.admin.api.feign.RemoteTokenService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
@@ -10,6 +12,7 @@ import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -26,8 +29,10 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
|
||||
|
||||
@Override
|
||||
public String getUsername(String token) {
|
||||
// 分割出 PIGX 的租户信息
|
||||
List<String> splitList = StrUtil.split(token, CharUtil.UNDERLINE);
|
||||
// @formatter:off
|
||||
return RetOps.of(tokenService.queryToken(token, SecurityConstants.FROM_IN))
|
||||
return RetOps.of(tokenService.queryToken(splitList.get(1), splitList.get(0) ,SecurityConstants.FROM_IN))
|
||||
.getDataIf(RetOps.CODE_SUCCESS)
|
||||
.map(o -> (String)o.get("username"))
|
||||
.orElse(null);
|
||||
@@ -46,7 +51,9 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
|
||||
|
||||
@Override
|
||||
public Boolean verifyToken(String token) {
|
||||
R<Map<String, Object>> result = tokenService.queryToken(token, SecurityConstants.FROM_IN);
|
||||
// 分割出 PIGX 的租户信息
|
||||
List<String> splitList = StrUtil.split(token, CharUtil.UNDERLINE);
|
||||
R<Map<String, Object>> result = tokenService.queryToken(splitList.get(1), splitList.get(0) , SecurityConstants.FROM_IN);
|
||||
if (CommonConstants.SUCCESS.equals(result.getCode())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user