提交 c3a41750 作者: 925993793@qq.com

Merge remote-tracking branch 'origin/test' into test

package com.zzsn.event.controller.yjzx; package com.zzsn.event.controller.yjzx;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.service.EsStatisticsService; import com.zzsn.event.service.EsStatisticsService;
import com.zzsn.event.service.IEventService; import com.zzsn.event.service.IEventService;
...@@ -8,12 +11,15 @@ import com.zzsn.event.util.user.UserVo; ...@@ -8,12 +11,15 @@ import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.EventExcelVO; import com.zzsn.event.vo.EventExcelVO;
import com.zzsn.event.vo.EventRegionVO; import com.zzsn.event.vo.EventRegionVO;
import com.zzsn.event.vo.EventTopVO; import com.zzsn.event.vo.EventTopVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
...@@ -29,6 +35,7 @@ import java.util.stream.Collectors; ...@@ -29,6 +35,7 @@ import java.util.stream.Collectors;
* @author lkg * @author lkg
* @date 2024/4/8 * @date 2024/4/8
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/home") @RequestMapping("/home")
public class EventHomeController { public class EventHomeController {
...@@ -38,6 +45,9 @@ public class EventHomeController { ...@@ -38,6 +45,9 @@ public class EventHomeController {
@Autowired @Autowired
private IEventService eventService; private IEventService eventService;
@Value(("${yjzx.url.checkToken:http://106.38.99.147:20592/user/urUser/getUserByToken?token=}"))
private String checkToken;
/** /**
* 事件数据统计-首页 * 事件数据统计-首页
...@@ -116,4 +126,23 @@ public class EventHomeController { ...@@ -116,4 +126,23 @@ public class EventHomeController {
} }
return Result.OK(dataList); return Result.OK(dataList);
} }
/**
* 权限校验
* @param token 研究中心token
* @author yanxin
* @date 2025/2/20
*/
@GetMapping("/checkAuth")
public Result<?> checkAuth(@RequestParam String token,@RequestParam String key) {
try{
String res = HttpUtil.get(checkToken + token);
JSONObject data = JSONObject.parseObject(res).getJSONObject("data");
JSONArray powerCodeSet = data.getJSONArray("powerCodeSet");
return Result.OK(powerCodeSet.contains(key));
}catch (Exception e){
log.error("研究中心用户权限校验异常,e:{}",e.getMessage(),e);
}
return Result.OK(false);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论