|
@@ -1,5 +1,9 @@
|
|
|
package com.ruoyi.common.utils.bpm;
|
|
|
+
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.ruoyi.common.config.bpm.BpmProperties;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
/**
|
|
@@ -7,19 +11,24 @@ import org.springframework.web.client.RestTemplate;
|
|
|
* @date 2023-11-02 15:29
|
|
|
* @Description:
|
|
|
*/
|
|
|
+@Component
|
|
|
public class BpmUtils {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BpmProperties bpmProperties;
|
|
|
+
|
|
|
/**
|
|
|
* 根据用户查询角色key
|
|
|
+ *
|
|
|
* @param userId
|
|
|
* @return
|
|
|
*/
|
|
|
- public static String[] getRoleKeyByUserId(String ip,Long userId){
|
|
|
+ public String[] getRoleKeyByUserId(Long userId) {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
- String ret = restTemplate.getForObject(ip+userId,String.class);
|
|
|
+ String ret = restTemplate.getForObject(bpmProperties.mainRolesKeyIp + userId, String.class);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(ret);
|
|
|
String s = (String) jsonObject.get("rolesKey");
|
|
|
String[] strings = JSONObject.parseObject(s, String[].class);
|
|
|
- return strings;
|
|
|
+ return strings;
|
|
|
}
|
|
|
}
|