ソースを参照

修改IoTEdge、SSO相关接口

丁治程 1 週間 前
コミット
d9ded5834d

+ 8 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/controller/IoredgeInterfaceTestController.java

@@ -39,6 +39,12 @@ public class IoredgeInterfaceTestController extends JeecgController<IotedgeColle
         return restClientService.getAccessToken();
     }
 
+    @AutoLog(value = "IoTEdge-获取ElToken")
+    @ApiOperation(value="IoTEdge-获取ElToken", notes="IoTEdge-获取ElToken")
+    @PostMapping(value = "/testGetElAccessTokenSSO")
+    public String testGetAccessTokenSSO(){
+        return restClientService.getAccessTokenSSO();
+    }
 
     @AutoLog(value = "IoTEdge-根据组织ID获取设备信息")
     @ApiOperation(value="IoTEdge-根据组织ID获取设备信息", notes="IoTEdge-根据组织ID获取设备信息")
@@ -122,8 +128,8 @@ public class IoredgeInterfaceTestController extends JeecgController<IotedgeColle
     @AutoLog(value = "IoTEdge-获取所有的组织")
     @ApiOperation(value="IoTEdge-获取所有的组织", notes="IoTEdge-获取所有的组织")
     @PostMapping(value = "/testGetAllGroup")
-    public JSONObject testGetAllGroup(){
-        return restClientService.getAllGroup();
+    public JSONObject testGetAllGroup(String elToken){
+        return restClientService.getAllGroup(elToken);
     }
 
     @AutoLog(value = "SSO-新增SSO用户时获取clientId/clientSecret")

+ 2 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/controller/IotedgeCollectDataController.java

@@ -257,8 +257,8 @@ public class IotedgeCollectDataController extends JeecgController<IotedgeCollect
 	 @AutoLog(value = "IoTEdge-获取所有的组织")
 	 @ApiOperation(value="IoTEdge-获取所有的组织", notes="IoTEdge-获取所有的组织")
 	 @PostMapping(value = "/getAllGroup")
-	 public Map<String, Object> getAllGroup(){
-    	return iotedgeCollectDataService.getAllGroup();
+	 public Map<String, Object> getAllGroup(String elToken){
+    	return iotedgeCollectDataService.getAllGroup(elToken);
 	 }
 
 	 @AutoLog(value = "IoTEdge-SSO-判断用户是否存在")

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/service/IIotedgeCollectDataService.java

@@ -31,7 +31,7 @@ public interface IIotedgeCollectDataService extends IService<IotedgeCollectData>
 
     String updateGroup(InterlockBaseVo interlockBaseVo, HttpServletRequest request);
 
-    Map<String, Object> getAllGroup();
+    Map<String, Object> getAllGroup(String eiToken);
 
     String addIoTedgeUser(String userName,String ssoRole,String userId, String elToken);
 }

+ 106 - 41
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/service/RestClientService.java

@@ -9,6 +9,7 @@ import org.jeecg.modules.iotedgeConfig.service.IIotedgeConfigService;
 import org.jeecg.modules.iotedgeConfig.util.ConfigInfo;
 import org.jeecg.modules.util.MyResponseErrorHandler;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.*;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.stereotype.Service;
@@ -19,6 +20,7 @@ import java.io.File;
 import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Base64;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -38,6 +40,24 @@ public class RestClientService {
     @SuppressWarnings("all")
     private IIotedgeConfigService configService;
 
+    @Value("${iotedge.ip}")
+    private String iotIp;
+    @Value("${iotedge.port}")
+    private String iotPort;
+
+    @Value("${sso.ip}")
+    private String ssoIp;
+    @Value("${sso.port}")
+    private String ssoPort;
+    @Value("${sso.username}")
+    private String ssoUsername;
+    @Value("${sso.password}")
+    private String ssoPassword;
+
+    @Value("${notification.ip}")
+    private String notificationIp;
+    @Value("${notification.port}")
+    private String notificationPort;
 
     /**
      * author: dzc
@@ -46,13 +66,13 @@ public class RestClientService {
      * date: 2024/5/22
      */
     public String getAccessToken() {
-        //String url = "http://127.0.0.1:8082/v1/auth";
-        String url = configService.getConfigValue(ConfigInfo.GETTOKEN);
-        String username = configService.getConfigValue(ConfigInfo.USERNAME);
-        String password = configService.getConfigValue(ConfigInfo.PASSWORD);
+        String url = "http://"+iotIp+":"+iotPort+"/v1/auth";
+        //String url = configService.getConfigValue(ConfigInfo.GETTOKEN);
+        //String username = configService.getConfigValue(ConfigInfo.USERNAME);
+        //String password = configService.getConfigValue(ConfigInfo.PASSWORD);
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("username",username);
-        jsonObject.put("password",password);
+        jsonObject.put("username","admin");
+        jsonObject.put("password","admin");
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
@@ -62,6 +82,31 @@ public class RestClientService {
         return accessToken;
     }
 
+    public String getAccessTokenSSO() {
+        String url = "http://"+iotIp+":"+iotPort+"/v1/sso/auth";
+        //String url = configService.getConfigValue(ConfigInfo.GETTOKEN);
+        //String username = configService.getConfigValue(ConfigInfo.USERNAME);
+        //String password = configService.getConfigValue(ConfigInfo.PASSWORD);
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("username",ssoUsername);
+        jsonObject.put("password",ssoPassword);
+        HttpHeaders headers = new HttpHeaders();
+        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
+        headers.setContentType(type);
+        HttpEntity<String> httpEntity = new HttpEntity<String>(jsonObject.toString(), headers);
+        ResponseEntity<JSONObject> response = restTemplate.postForEntity(url, httpEntity, JSONObject.class);
+        HttpHeaders headers1 = response.getHeaders();
+        List<String> list = headers1.get(HttpHeaders.SET_COOKIE);
+        // 提取 EIToken 的值并赋给变量
+        String eitoken = list.stream()
+                .filter(s -> s.startsWith("EIToken="))
+                .map(s -> s.substring("EIToken=".length()).split(";")[0].trim())
+                .findFirst()
+                .orElse("Token not found");
+        return eitoken;
+    }
+
+
     /**
     *   author: dzc
     *   version: 1.0
@@ -71,8 +116,8 @@ public class RestClientService {
 
     public JSONObject getGroupDevicesInfo(String groupId,String elToken){
         //String url = "http://127.0.0.1:8082/v1/devices?deviceType=&groupID="+groupId+"&projectID=all&productID=all";
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_GETINFOBYGROUPID)+groupId+"&projectID=all&productID=all";
-        //String accessToken = getAccessToken();
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_GETINFOBYGROUPID)+groupId+"&projectID=all&productID=all";
+        String url = "http://"+iotIp+":"+iotPort+"/v1/devices?deviceType=&groupID="+groupId+"&projectID=all&productID=all";
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
@@ -90,8 +135,8 @@ public class RestClientService {
     */
     public JSONObject getAllDevicesInfo(String elToken){
         //String url = "http://127.0.0.1:8082/v1/devices?deviceType=&groupID="+groupId+"&projectID=all&productID=all";
-        String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFO);
-        //String accessToken = getAccessToken();
+        //String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFO);
+        String url = "http://"+iotIp+":"+iotPort+"/v1/devices?deviceType=&projectID=all&productID=all";
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
@@ -110,7 +155,8 @@ public class RestClientService {
     */
     public JSONObject getAllDevicesInfoById(String deviceId,String elToken){
         //String url = "http://127.0.0.1:8082/v1/devices/"+deviceId+"/deviceshadow";
-        String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFOBYID)+"/"+deviceId+"/deviceshadow";
+        //String url = configService.getConfigValue(ConfigInfo.GETALLDEVICESINFOBYID)+"/"+deviceId+"/deviceshadow";
+        String url = "http://"+iotIp+":"+iotPort+"/v1/devices/"+deviceId+"/deviceshadow";
         //String accessToken = getAccessToken();
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
@@ -129,13 +175,15 @@ public class RestClientService {
     *   date: 2024/5/29
     */
     public JSONObject getAllEmailGroupInfo(){
+        String token = getAccessTokenSSO();
         //String url = "http://127.0.0.1:3005/api/v1.5/Groups?count=1000&index=1&desc=false";
-        String url = configService.getConfigValue(ConfigInfo.GETGROUPINFO);
-        String accessToken = getAccessToken();
+        //String url = configService.getConfigValue(ConfigInfo.GETGROUPINFO);
+        String url = "http://"+notificationIp+":"+notificationPort+"/api/v1.5/Groups?count=1000&index=1&desc=false";
+        //String accessToken = getAccessToken();
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
-        headers.add("Authorization", "Bearer " + accessToken);
+        headers.add("Authorization", "Bearer " + token);
         HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
         ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET,httpEntity, JSONObject.class);
         return response.getBody();
@@ -159,12 +207,14 @@ public class RestClientService {
         ArrayList<JSONObject> list = new ArrayList<>();
         ArrayList<JSONObject> requestList = new ArrayList<>();
         //String url = "http://127.0.0.1:3005/api/v1.5/Groups/send";
-        String url = configService.getConfigValue(ConfigInfo.SENDEMAil);
-        String accessToken = getAccessToken();
+        //String url = configService.getConfigValue(ConfigInfo.SENDEMAil);
+        String url = "http://"+notificationIp+":"+notificationPort+"/api/v1.5/Groups/send";
+        //String accessToken = getAccessToken();
+        String token = getAccessTokenSSO();
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
-        headers.add("Authorization", "Bearer " + accessToken);
+        headers.add("Authorization", "Bearer " + token);
         // 文本内容参数
         JSONObject jsonObject1 = new JSONObject();
         jsonObject1.put("params","接口测试"); // Notification中模板中的参数 也可以没有,根据具体情况决定
@@ -209,7 +259,8 @@ public class RestClientService {
     */
     public JSONObject addGroup(String groupName,String elToken){
         //String url = "http://127.0.0.1:8082/v1/groups";
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_ADDGROUP);
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_ADDGROUP);
+        String url = "http://"+iotIp+":"+iotPort+"/v1/groups";
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("groupName",groupName);
         HttpHeaders headers = new HttpHeaders();
@@ -230,7 +281,8 @@ public class RestClientService {
     */
     public JSONObject deleteGroup(String groupId,String elToken){
         //String url = "http://127.0.0.1:8082/v1/groups"+"/"+groupId;
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_DELETEGROUP)+"/"+groupId;
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_DELETEGROUP)+"/"+groupId;
+        String url = "http://"+iotIp+":"+iotPort+"/v1/groups"+"/"+groupId;
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
@@ -250,12 +302,14 @@ public class RestClientService {
     */
     public String getSSOToken(){
         //String url = "http://127.0.0.1:8188/v4.0/auth/native";
-        String url = configService.getConfigValue(ConfigInfo.SSO_LOGIN_URL);
-        String username = configService.getConfigValue(ConfigInfo.SSO_SYS_USERNAME);
-        String password = configService.getConfigValue(ConfigInfo.SSO_SYS_PASSWORD);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_LOGIN_URL);
+        //String username = configService.getConfigValue(ConfigInfo.SSO_SYS_USERNAME);
+        //String password = configService.getConfigValue(ConfigInfo.SSO_SYS_PASSWORD);
+
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/auth/native";
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("username",username);
-        jsonObject.put("password",password);
+        jsonObject.put("username",ssoUsername);
+        jsonObject.put("password",ssoPassword);
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
@@ -275,7 +329,8 @@ public class RestClientService {
     public JSONObject getClientInfo(){
         String token = getSSOToken();
         //String url = "http://127.0.0.1:8188/v4.0/clients?page=1&maxResults=10&appName=iothub";
-        String url = configService.getConfigValue(ConfigInfo.SSO_GetClientInfo);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_GetClientInfo);
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/clients?page=1&maxResults=10&appName=iothub";
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
@@ -298,7 +353,8 @@ public class RestClientService {
         String clientId = (String) resources.get(0).get("clientId");
         String clientSecret = (String) resources.get(0).get("clientSecret");
         //String url = "http://127.0.0.1:8188/v4.0/oauth/token?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
-        String url = configService.getConfigValue(ConfigInfo.SSO_GetClientToken)+"?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
+        //String url = configService.getConfigValue(ConfigInfo.SSO_GetClientToken)+"?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/oauth/token?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         //headers.setContentType(type);
@@ -323,7 +379,8 @@ public class RestClientService {
             clientToken = getClientToken();
         }
         //String url = "http://127.0.0.1:8082/v1/org"+"/"+groupId;
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_UPDATEGROUP)+"/"+groupId;
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_UPDATEGROUP)+"/"+groupId;
+        String url = "http://"+iotIp+":"+iotPort+"/v1/org/"+groupId;
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("orgName",groupName);
         HttpHeaders headers = new HttpHeaders();
@@ -347,14 +404,14 @@ public class RestClientService {
     *   des: 获取所有的 Group
     *   date: 2024/8/5
     */
-    public JSONObject getAllGroup(){
+    public JSONObject getAllGroup(String elToken){
         //String url = "http://127.0.0.1:8082/v1/groups";
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_GETALLGROUP);
-        String accessToken = getAccessToken();
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_GETALLGROUP);
+        String url = "http://"+iotIp+":"+iotPort+"/v1/groups";
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
-        headers.add("Authorization", "Bearer " + accessToken);
+        headers.add("Authorization", "Bearer " + elToken);
         HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
         ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET,httpEntity, JSONObject.class);
         return response.getBody();
@@ -370,7 +427,8 @@ public class RestClientService {
         ArrayList<String> scopList = new ArrayList<>();
         scopList.add("Admin");
         String ssoToken = getSSOToken();
-        String url = configService.getConfigValue(ConfigInfo.SSO_CREATECLIENT);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_CREATECLIENT);
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/clients";
         JSONObject jsonObject = new JSONObject();
         //if (ObjectUtil.isNotNull(System.getenv("appName"))){
         //    jsonObject.put("appName",System.getenv("appName"));
@@ -405,7 +463,8 @@ public class RestClientService {
         String clientId = (String) clientInfo.get("clientId");
         String clientSecret = (String) clientInfo.get("clientSecret");
         //String url = "http://127.0.0.1:8188/v4.0/oauth/token?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
-        String url = configService.getConfigValue(ConfigInfo.SSO_GetClientToken)+"?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
+        //String url = configService.getConfigValue(ConfigInfo.SSO_GetClientToken)+"?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/oauth/token?grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret+"&duration=eternal";
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         //headers.setContentType(type);
@@ -442,7 +501,8 @@ public class RestClientService {
         }
 
 
-        String url = configService.getConfigValue(ConfigInfo.SSO_ADDUSER)+"/"+userName+"/scopes";
+        //String url = configService.getConfigValue(ConfigInfo.SSO_ADDUSER)+"/"+userName+"/scopes";
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/users/"+userName+"/scopes";
 
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("clientId",clientId);
@@ -485,7 +545,8 @@ public class RestClientService {
         }
 
 
-        String url = configService.getConfigValue(ConfigInfo.SSO_ADDUSER)+"/"+userName+"/scopes";
+        //String url = configService.getConfigValue(ConfigInfo.SSO_ADDUSER)+"/"+userName+"/scopes";
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/users/"+userName+"/scopes";
 
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("clientId",clientId);
@@ -521,7 +582,8 @@ public class RestClientService {
     */
     public JSONObject invitationSSOUserInIoTEdge(String userName,String elToken){
         //String url = "http://127.0.0.1:8082/v1/users/username"+"/"+userName;
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_ADDUSER)+"/"+userName;
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_ADDUSER)+"/"+userName;
+        String url = "http://"+iotIp+":"+iotPort+"/v1/users/username/"+userName;
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("groupId","");
         jsonObject.put("role","");
@@ -542,7 +604,8 @@ public class RestClientService {
     */
     public JSONObject setUserRole(String userId,String groupId,String rloe,String elToken){
         //String url = "http://127.0.0.1:8082/v1/users"+"/"+userId+"/rolebinding";
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_SETUSERROLE)+"/"+userId+"/rolebinding";
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_SETUSERROLE)+"/"+userId+"/rolebinding";
+        String url = "http://"+iotIp+":"+iotPort+"/v1/users/"+userId+"/rolebinding";
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("groupId",groupId);
         jsonObject.put("role",rloe);
@@ -563,7 +626,8 @@ public class RestClientService {
     */
     public JSONObject deleteUserRole(String userId,String groupId,String rloe,String elToken){
         //String url = "http://127.0.0.1:8082/v1/users"+"/"+userId+"/rolebinding";
-        String url = configService.getConfigValue(ConfigInfo.IOTEDGE_SETUSERROLE)+"/"+userId+"/rolebinding";
+        //String url = configService.getConfigValue(ConfigInfo.IOTEDGE_SETUSERROLE)+"/"+userId+"/rolebinding";
+        String url = "http://"+iotIp+":"+iotPort+"/v1/users/"+userId+"/rolebinding";
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("groupId",groupId);
         jsonObject.put("role",rloe);
@@ -585,7 +649,8 @@ public class RestClientService {
      *   date: 2024/8/29
      */
     public JSONObject ifUserInSSO(String userName){
-        String url = configService.getConfigValue(ConfigInfo.SSO_IFUSERINSSO)+"/"+userName;
+        //String url = configService.getConfigValue(ConfigInfo.SSO_IFUSERINSSO)+"/"+userName;
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/validators/users/"+userName;
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         //headers.setContentType(type);
@@ -606,7 +671,7 @@ public class RestClientService {
     */
     public JSONObject deleteSSOUser(String userName){
         String ssoToken = getSSOToken();
-        String url = "http://127.0.0.1:8188/v4.0/users"+"/"+userName;
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/users"+"/"+userName;
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);
@@ -624,7 +689,7 @@ public class RestClientService {
     *   date: 2024/8/7
     */
     public JSONObject deleteIoTEdgeUser(String userId,String elToken){
-        String url = "http://127.0.0.1:8082/v1/user"+"/"+userId;
+        String url = "http://"+iotIp+":"+iotPort+"/v1/user"+"/"+userId;
         HttpHeaders headers = new HttpHeaders();
         MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
         headers.setContentType(type);

+ 5 - 5
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/service/impl/IotedgeCollectDataServiceImpl.java

@@ -111,10 +111,10 @@ public class IotedgeCollectDataServiceImpl extends ServiceImpl<IotedgeCollectDat
                 iotedgeTag.setName(item.get("devicePropertyName").toString()); // 点位名称
                 if(ObjectUtil.isNotNull(item.get("reportValue"))){
                     iotedgeTag.setValue(item.get("reportValue").toString()); // 点位值
-                    iotedgeTag.setInfo(item.get("devicePropertyName").toString()+"&"+item.get("reportValue").toString()); // 点位名称 & 点位值
+                    //iotedgeTag.setInfo(item.get("devicePropertyName").toString()+"&"+item.get("reportValue").toString()); // 点位名称 & 点位值
                 }else {
                     iotedgeTag.setValue("0"); // 点位值
-                    iotedgeTag.setInfo(item.get("devicePropertyName").toString()+"&"+"0"); // 点位名称 & 点位值
+                    //iotedgeTag.setInfo(item.get("devicePropertyName").toString()+"&"+"0"); // 点位名称 & 点位值
                 }
 
                 if (serviceMap.containsKey(item.get("deviceServiceName").toString())){
@@ -185,7 +185,7 @@ public class IotedgeCollectDataServiceImpl extends ServiceImpl<IotedgeCollectDat
                     log.info("IoTedge中该组织已经存在,添加组织失败!请到IoTedge系统中进行处理");
                     // 应该去获取改组织的id 赋给新增的系统的iotedge_group_id,没有接口
                     // 目前的方法是去获取所有的组织,由于组织名称不相同,去获取当前组织的id
-                    Map<String, Object> allGroupMap = this.getAllGroup();
+                    Map<String, Object> allGroupMap = this.getAllGroup(eiToken);
                     ArrayList<String> groupNameList = new ArrayList<>();
                     for (String key : allGroupMap.keySet()) {
                         groupNameList.add(key);
@@ -322,10 +322,10 @@ public class IotedgeCollectDataServiceImpl extends ServiceImpl<IotedgeCollectDat
     }
 
     @Override
-    public Map<String, Object> getAllGroup() {
+    public Map<String, Object> getAllGroup(String eiToken) {
         HashMap<String, Object> groupMap = new HashMap<>();
 
-        JSONObject allGroup = restClientService.getAllGroup();
+        JSONObject allGroup = restClientService.getAllGroup(eiToken);
         ArrayList<Map<String,Object>> items = (ArrayList<Map<String, Object>>) allGroup.get("items");
 
         for (Map<String,Object> item : items) {

+ 0 - 4
jeecg-module-interlock/src/main/java/org/jeecg/modules/util/MyResponseErrorHandler.java

@@ -27,13 +27,9 @@ public class MyResponseErrorHandler implements ResponseErrorHandler {
 
     @Override
     public void handleError(ClientHttpResponse response) throws IOException {
-        System.out.println("SSOinfo:"+response.getBody());
         String responseBody = "";
         try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getBody()))) {
-            System.out.println("SSOinfo:"+reader);
-            System.out.println("SSOinfo:"+reader.lines());
             responseBody = reader.lines().collect(Collectors.joining("\n"));
-            System.out.println("SSOinfo:"+responseBody);
         }
         throw new RuntimeException(responseBody);
     }