81 lines
3.2 KiB
Java
81 lines
3.2 KiB
Java
package com.saye.hrs.controller;
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.json.JSONArray;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.saye.hrs.model.StatusDefine;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author Mr.zs
|
|
* @date 2025/2/8
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/countAutho")
|
|
public class CountAuthoController {
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(CountAuthoController.class);
|
|
|
|
// 获取有权限的人员清单
|
|
@RequestMapping("/getAuther")
|
|
public Object getAutho() {
|
|
|
|
HashMap<String, String> headers = new HashMap<>();// 存放请求头,可以存放多个请求头
|
|
HashMap<String, Object> resMap = new HashMap<>();
|
|
headers.put("Content-Type", "application/json");
|
|
String url = StatusDefine.IP_PORT + "/api/getAutho";
|
|
String body = HttpUtil.createGet(url).addHeaders(headers).execute().body();
|
|
logger.info("获取有权限人员清单111" + body);
|
|
JSONObject entries = JSONUtil.parseObj(body);
|
|
Object data = entries.get("data");
|
|
JSONArray objects = JSONUtil.parseArray(data);
|
|
List<String> list = JSONUtil.toList(objects, String.class);
|
|
resMap.put("data", list);
|
|
return resMap;
|
|
}
|
|
|
|
@RequestMapping("/getPerm")
|
|
public Object getPerm(String openid) {
|
|
|
|
HashMap<String, String> headers = new HashMap<>();// 存放请求头,可以存放多个请求头
|
|
HashMap<String, Object> resMap = new HashMap<>();
|
|
HashMap<String, Object> reqMap = new HashMap<>();
|
|
headers.put("Content-Type", "application/json");
|
|
String url = StatusDefine.IP_PORT + "/api/getAuthoList";
|
|
reqMap.put("openid", openid);
|
|
String body = HttpUtil.createGet(url).addHeaders(headers).form(reqMap).execute().body();
|
|
logger.info("获取有权限人员清单111" + body);
|
|
JSONObject entries = JSONUtil.parseObj(body);
|
|
Object data = entries.get("data");
|
|
JSONArray objects = JSONUtil.parseArray(data);
|
|
List<String> list = JSONUtil.toList(objects, String.class);
|
|
resMap.put("data", list);
|
|
return resMap;
|
|
}
|
|
@RequestMapping("/getDeptPerm")
|
|
public Object getDeptPerm(String openid) {
|
|
|
|
HashMap<String, String> headers = new HashMap<>();// 存放请求头,可以存放多个请求头
|
|
HashMap<String, Object> resMap = new HashMap<>();
|
|
HashMap<String, Object> reqMap = new HashMap<>();
|
|
headers.put("Content-Type", "application/json");
|
|
String url = StatusDefine.IP_PORT + "/api/getDeptAuthList";
|
|
reqMap.put("openid", openid);
|
|
String body = HttpUtil.createGet(url).addHeaders(headers).form(reqMap).execute().body();
|
|
logger.info("获取有权限人员清单111" + body);
|
|
JSONObject entries = JSONUtil.parseObj(body);
|
|
Object data = entries.get("data");
|
|
// JSONArray objects = JSONUtil.parseArray(data);
|
|
// List<String> list = JSONUtil.toList(objects, String.class);
|
|
resMap.put("data", data);
|
|
return resMap;
|
|
}
|
|
}
|