ソースを参照

综合展示户表信息获取

hym 3 年 前
コミット
9e53dfea6e

+ 59 - 0
sms_water/src/main/java/com/huaxu/controller/EquipmentStatisticsController.java

@@ -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;
+    }
+}

+ 19 - 0
sms_water/src/main/java/com/huaxu/dto/QueryDeviceMonitorDto.java

@@ -0,0 +1,19 @@
+package com.huaxu.dto;
+
+import lombok.Data;
+
+@Data
+public class QueryDeviceMonitorDto {
+    private Integer type;
+    private Integer province;
+    private Integer city;
+    private Integer region;
+    private Integer community;
+    private Integer buildingId;
+    private String keywords;
+    private String tenantId;
+    private Integer page;
+    private Integer size;
+    private String northEast;
+    private String southWest;
+}

+ 3 - 1
sms_water/src/main/resources/application-sit.properties

@@ -163,4 +163,6 @@ aysnc.queue-capacity=100000
 #线程名称前缀
 aysnc.thread-name-prefix=aysnc-thread-
 #指令下发调用接口地址
-send.setsetup.url=http://114.135.61.188:48322/center/command/send
+send.setsetup.url=http://114.135.61.188:48322/center/command/send
+get_map_info_url=http://114.135.61.188:58080/api/platform/getTheMapInformationOfTheDevice
+get_device_url=http://114.135.61.188:58080/api/platform/getDeviceListInformation

+ 1 - 1
sms_water/src/main/resources/application.properties

@@ -1,2 +1,2 @@
 #开发环境:dev  测试环境:sit  线上环境:prd
-spring.profiles.active=dev
+spring.profiles.active=sit