| 
					
				 | 
			
			
				@@ -0,0 +1,59 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.huaxu.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.huaxu.dto.QueryDeviceMonitorDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.huaxu.entity.DeviceParmEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.huaxu.model.AjaxMessage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.huaxu.model.ResultStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.huaxu.util.UserUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.http.HttpHeaders; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.http.MediaType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.http.ResponseEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.GetMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.client.RestTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RequestMapping("/equipmentStatistics") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class EquipmentStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    RestTemplate restTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Value("${get_map_info_url}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String getMapInfoUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Value("${get_device_url}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String getDeviceUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/getTheMapInformationOfTheDevice") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   private AjaxMessage getTheMapInformationOfTheDevice(QueryDeviceMonitorDto queryDeviceMonitorDto){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        queryDeviceMonitorDto.setTenantId(UserUtil.getCurrentUser().getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return new AjaxMessage<>(ResultStatus.OK, JSON.parse(sendApiReQuest(getMapInfoUrl,JSON.toJSONString(queryDeviceMonitorDto)))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/getDeviceListInformation") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private AjaxMessage getDeviceListInformation(QueryDeviceMonitorDto queryDeviceMonitorDto){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        queryDeviceMonitorDto.setTenantId(UserUtil.getCurrentUser().getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String result=sendApiReQuest(getDeviceUrl,JSON.toJSONString(queryDeviceMonitorDto)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        JSONObject info = JSON.parseObject(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(info.getInteger("total")==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.put("list",new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return new AjaxMessage<>(ResultStatus.OK, info); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private  String sendApiReQuest(String path , String args){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        HttpHeaders headers = new HttpHeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        headers.setContentType(MediaType.APPLICATION_JSON); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<>(args, headers); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity(path, formEntity, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        JSONObject info = JSON.parseObject(stringResponseEntity.getBody()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String result=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(info.getInteger("status")==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            result=info.getString("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |