Prechádzať zdrojové kódy

[task-2813]深圳三院-温控对接

szjbdgzl 1 rok pred
rodič
commit
e7e4d8dfe7

+ 14 - 0
exchange/pom.xml

@@ -40,6 +40,20 @@
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <!-- Apache HttpClient -->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.13</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2 -->
+        <dependency>
+            <groupId>com.alibaba.fastjson2</groupId>
+            <artifactId>fastjson2</artifactId>
+            <version>2.0.52</version>
+        </dependency>
+
     </dependencies>
     <dependencyManagement>
         <dependencies>

+ 3 - 3
exchange/src/main/java/com/jyxt/thridparty/exchange/ScheduledTasks.java

@@ -22,8 +22,8 @@ public class ScheduledTasks {
 
 //    @Scheduled(fixedRate = 5000)
     public void exportBinxingData() {
-        log.info("The time is now {}", dateFormat.format(new Date()));
-        List<VendorBinxiang> binxiang = vendorBinxiangRepository.query();
-        log.info(binxiang.get(0).getWendu());
+//        log.info("The time is now {}", dateFormat.format(new Date()));
+//        List<VendorBinxiang> binxiang = vendorBinxiangRepository.query();
+//        log.info(binxiang.get(0).getWendu());
     }
 }

+ 49 - 0
exchange/src/main/java/com/jyxt/thridparty/exchange/bx/VendorBinxiang.java

@@ -3,6 +3,7 @@ package com.jyxt.thridparty.exchange.bx;
 public class VendorBinxiang {
     private String id;
     private String wendu;
+    private String shidu;
     //采集时间
     private String caiJiTime;
     //冰箱ID
@@ -22,6 +23,54 @@ public class VendorBinxiang {
     //实验组ID
     private String shiyanzhuId;
 
+    private String shiduUp;
+
+    private String shiduDown;
+
+    private String type;
+
+    private String area;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+
+    public String getShiduUp() {
+        return shiduUp;
+    }
+
+    public void setShiduUp(String shiduUp) {
+        this.shiduUp = shiduUp;
+    }
+
+    public String getShiduDown() {
+        return shiduDown;
+    }
+
+    public void setShiduDown(String shiduDown) {
+        this.shiduDown = shiduDown;
+    }
+
+    public String getShidu() {
+        return shidu;
+    }
+
+    public void setShidu(String shidu) {
+        this.shidu = shidu;
+    }
+
     public String getWendu() {
         return wendu;
     }

+ 243 - 0
exchange/src/main/java/com/jyxt/thridparty/exchange/bx/entity/EquipRelation.java

@@ -0,0 +1,243 @@
+package com.jyxt.thridparty.exchange.bx.entity;
+
+import java.util.Date;
+import java.io.Serializable;
+
+/**
+ * 采集器名称关联设备配置(EquipRelation)实体类
+ *
+ * @author makejava
+ * @since 2024-11-07 14:11:12
+ */
+public class EquipRelation implements Serializable {
+    private static final long serialVersionUID = -10773553712155660L;
+/**
+     * 主键
+     */
+    private String id;
+/**
+     * 创建时间
+     */
+    private Date createTime;
+/**
+     * 创建人
+     */
+    private String createBy;
+/**
+     * 冰箱设备编号
+     */
+    private String bxBianHao;
+/**
+     * 原设备编号
+     */
+    private String sheBeiBianHao;
+/**
+     * 部门ID
+     */
+    private String deptId;
+/**
+     * 部门名称
+     */
+    private String deptName;
+/**
+     * 组织名称
+     */
+    private String groupName;
+/**
+     * 设备号
+     */
+    private String deviceNo;
+/**
+     * 设备名称
+     */
+    private String deviceName;
+/**
+     * 测点号
+     */
+    private String serialNo;
+/**
+     * 测点名称
+     */
+    private String serialName;
+/**
+     * 资产类型
+     */
+    private String assetType;
+/**
+     * 报警类型
+     */
+    private String alarmType;
+/**
+     * 温湿度下限
+     */
+    private String low;
+/**
+     * 温湿度上限
+     */
+    private String high;
+/**
+     * 是否启用
+     */
+    private String enable;
+/**
+     * 设备类型
+     */
+    private String deviceType;
+/**
+     * 区域
+     */
+    private String area;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    public String getBxBianHao() {
+        return bxBianHao;
+    }
+
+    public void setBxBianHao(String bxBianHao) {
+        this.bxBianHao = bxBianHao;
+    }
+
+    public String getSheBeiBianHao() {
+        return sheBeiBianHao;
+    }
+
+    public void setSheBeiBianHao(String sheBeiBianHao) {
+        this.sheBeiBianHao = sheBeiBianHao;
+    }
+
+    public String getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(String deptId) {
+        this.deptId = deptId;
+    }
+
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public String getDeviceNo() {
+        return deviceNo;
+    }
+
+    public void setDeviceNo(String deviceNo) {
+        this.deviceNo = deviceNo;
+    }
+
+    public String getDeviceName() {
+        return deviceName;
+    }
+
+    public void setDeviceName(String deviceName) {
+        this.deviceName = deviceName;
+    }
+
+    public String getSerialNo() {
+        return serialNo;
+    }
+
+    public void setSerialNo(String serialNo) {
+        this.serialNo = serialNo;
+    }
+
+    public String getSerialName() {
+        return serialName;
+    }
+
+    public void setSerialName(String serialName) {
+        this.serialName = serialName;
+    }
+
+    public String getAssetType() {
+        return assetType;
+    }
+
+    public void setAssetType(String assetType) {
+        this.assetType = assetType;
+    }
+
+    public String getAlarmType() {
+        return alarmType;
+    }
+
+    public void setAlarmType(String alarmType) {
+        this.alarmType = alarmType;
+    }
+
+    public String getLow() {
+        return low;
+    }
+
+    public void setLow(String low) {
+        this.low = low;
+    }
+
+    public String getHigh() {
+        return high;
+    }
+
+    public void setHigh(String high) {
+        this.high = high;
+    }
+
+    public String getEnable() {
+        return enable;
+    }
+
+    public void setEnable(String enable) {
+        this.enable = enable;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+}
+

+ 221 - 28
exchange/src/main/java/com/jyxt/thridparty/exchange/bx/repository/VendorBinxiangRepository.java

@@ -1,50 +1,243 @@
 package com.jyxt.thridparty.exchange.bx.repository;
 
-import com.jyxt.thridparty.exchange.ExchangeApplication;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
 import com.jyxt.thridparty.exchange.bx.VendorBinxiang;
+import com.jyxt.thridparty.exchange.bx.entity.EquipRelation;
+import com.jyxt.thridparty.exchange.bx.utils.HttpClientUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.stereotype.Repository;
 
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
 @Repository
 public class VendorBinxiangRepository {
     private static final Logger log = LoggerFactory.getLogger(VendorBinxiangRepository.class);
     @Autowired
     private JdbcTemplate jdbcTemplate;
 
-    @Value("${fetch.sql}")
-    private String sql;
-
-    public List<VendorBinxiang> query() {
-        log.info(sql);
-        return jdbcTemplate.query(
-                sql,new RowMapper<VendorBinxiang>(){
-
-                    @Override
-                    public VendorBinxiang mapRow(ResultSet rs, int rowNum) throws SQLException {
-                        VendorBinxiang bx = new VendorBinxiang();
-                        bx.setId(rs.getString("id"));
-                        bx.setWendu(rs.getString("温度"));
-                        bx.setBinXiangId(rs.getString("冰箱ID"));
-                        bx.setBinxiangName(rs.getString("冰箱名称"));
-                        bx.setCaiJiId(rs.getString("采集器ID"));
-                        bx.setCaiJiName(rs.getString("采集器名称"));
-                        bx.setCaiJiTime(rs.getString("采集时间"));
-                        bx.setWenduUp(rs.getString("温度上限"));
-                        bx.setWenduDown(rs.getString("温度下限"));
-                        bx.setShiyanzhuName(rs.getString("实验组"));
-                        bx.setShiyanzhuId(rs.getString("实验组ID"));
-                        return bx;
+    @Value("${equip.appKey}")
+    private String equipAppKey;
+
+    @Value("${equip.appSecret}")
+    private String equipAppSecret;
+
+    @Value("${humiture.uri}")
+    private String humitureUri;
+
+    @Value("${humiture.latest}")
+    private String humitureLatest;
+
+    @Value("${humiture.history}")
+    private String humitureHistory;
+
+    @Value("${humiture.appKey}")
+    private String humitureAppKey;
+
+    @Value("${humiture.appSecret}")
+    private String humitureAppSecret;
+
+    public List<VendorBinxiang> query(){
+        String second = String.valueOf(Instant.now().getEpochSecond());
+        Map<String, String> headers = new HashMap<>();
+        headers.put("appKey",humitureAppKey);
+        headers.put("time",second);
+        Map<String, String> params = new HashMap<>();
+        LocalDateTime now = LocalDateTime.now();
+        long endTime = LocalDateTime.of(now.getYear(), now.getMonthValue(), now.getDayOfMonth(), now.getHour(), now.getMinute()).
+                atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
+        long startTime = LocalDateTime.of(now.getYear(), now.getMonthValue(), now.getDayOfMonth(), 0, 0).
+                atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
+        params.put("start",String.valueOf(startTime));
+        params.put("end",String.valueOf(endTime));
+        String sql = "SELECT device_no_,device_name_ from equip_relation WHERE enable_='是' GROUP BY device_no_";
+        RowMapper<EquipRelation> infoRowMapper = new BeanPropertyRowMapper<>(EquipRelation.class);
+        List<EquipRelation> list = jdbcTemplate.query(sql, infoRowMapper);
+        Set<VendorBinxiang> bxSet = new LinkedHashSet<>();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        for(EquipRelation twksbpzb : list){
+            params.put("devices",twksbpzb.getDeviceNo());
+            String paramStr = "devices_"+twksbpzb.getDeviceNo()+"_start"+startTime+"_end"+endTime;
+            String origin = humitureAppKey+"_"+paramStr+"_"+second+"_"+humitureAppSecret;
+            String sign = encryptMD5(origin);
+            headers.put("sign",sign);
+            String result = HttpClientUtil.doPost(humitureUri+humitureHistory,headers,params);
+            JSONObject reposn = JSONObject.parseObject(result);
+            if (reposn.get("status").equals("0000")){
+                JSONArray data = reposn.getJSONArray("data");
+                if(!data.isEmpty()){
+                    JSONObject jsonObject = data.getJSONObject(0);
+                    JSONArray channels = jsonObject.getJSONArray("channels");
+                    if(!data.isEmpty()){
+                        for(Object object : channels){
+                            // 测点类型:dataitem 0-温湿度  17-经纬度 18-温湿度 19-单温
+                            JSONObject channel = (JSONObject) object;
+                            String type = channel.getString("dataitem");
+                            if (type.equals("0") || type.equals("18")){
+                                JSONArray values = channel.getJSONArray("values");
+                                for(Object value : values){
+                                    JSONObject item = (JSONObject) value;
+                                    VendorBinxiang bx = new VendorBinxiang();
+                                    long time = Long.parseLong(item.getString("time"));
+                                    String date = LocalDateTime.ofInstant(Instant.ofEpochSecond(time), ZoneId.systemDefault()).format(formatter);
+                                    bx.setId(twksbpzb.getDeviceNo()+"-"+time+"-"+type);
+                                    bx.setWendu(item.getString("temp"));
+                                    bx.setShidu(item.getString("hum"));
+                                    bx.setBinXiangId(twksbpzb.getDeviceNo());
+                                    bx.setBinxiangName(twksbpzb.getDeviceName());
+                                    bx.setCaiJiId(channel.getString("serial"));
+                                    bx.setCaiJiName(twksbpzb.getDeviceName());
+                                    bx.setCaiJiTime(date);
+                                    EquipRelation wenDu = getWsdRange(twksbpzb.getDeviceNo(),"温度");
+                                    bx.setWenduUp(wenDu.getHigh());
+                                    bx.setWenduDown(wenDu.getLow());
+                                    EquipRelation shiDu = getWsdRange(twksbpzb.getDeviceNo(),"湿度");
+                                    bx.setShiduUp(shiDu.getHigh());
+                                    bx.setShiduDown(shiDu.getLow());
+                                    bx.setShiyanzhuName(shiDu.getDeptName());
+                                    bx.setShiyanzhuId(shiDu.getDeptId());
+                                    bx.setType(shiDu.getDeviceType());
+                                    bx.setArea(shiDu.getArea());
+                                    bxSet.add(bx);
+                                }
+                            }
+                            if (channel.get("dataitem").equals("19")){
+                                JSONArray values = channel.getJSONArray("values");
+                                for(Object value : values){
+                                    JSONObject item = (JSONObject) value;
+                                    VendorBinxiang bx = new VendorBinxiang();
+                                    long time = Long.parseLong(item.getString("time"));
+                                    String date = LocalDateTime.ofInstant(Instant.ofEpochSecond(time), ZoneId.systemDefault()).format(formatter);
+                                    bx.setId(twksbpzb.getDeviceNo()+"-"+time+"-"+type);
+                                    bx.setWendu(item.getString("temp"));
+                                    bx.setBinXiangId(twksbpzb.getDeviceNo());
+                                    bx.setBinxiangName(twksbpzb.getDeviceName());
+                                    bx.setCaiJiId(channel.getString("serial"));
+                                    bx.setCaiJiName(twksbpzb.getDeviceName());
+                                    bx.setCaiJiTime(date);
+                                    EquipRelation wenDu = getWsdRange(twksbpzb.getDeviceNo(),"温度");
+                                    bx.setWenduUp(wenDu.getHigh());
+                                    bx.setWenduDown(wenDu.getLow());
+                                    bx.setShiyanzhuName(wenDu.getDeptName());
+                                    bx.setShiyanzhuId(wenDu.getDeptId());
+                                    bx.setType(wenDu.getDeviceType());
+                                    bx.setArea(wenDu.getArea());
+                                    bxSet.add(bx);
+                                }
+                            }
+                        }
                     }
                 }
-        );
+            }
+        }
+        return new ArrayList<>(bxSet);
+    }
+
+    public EquipRelation getWsdRange(String deviceNo,String type){
+        String sql = "SELECT * FROM equip_relation WHERE enable_='是' and device_no_ = ? and alarm_type_=? ";
+        final EquipRelation equipRelation = jdbcTemplate.queryForObject(sql, new Object[]{deviceNo,type}, (rs, rowNum) -> {
+            EquipRelation er = new EquipRelation();
+            er.setLow(rs.getString("low_"));
+            er.setHigh(rs.getString("high_"));
+            er.setDeviceType(rs.getString("device_type_"));
+            er.setArea(rs.getString("area_"));
+            er.setDeptId(rs.getString("dept_id_"));
+            er.setDeptName(rs.getString("dept_name_"));
+            return er;
+        });
+        return equipRelation;
+    }
+
+    public void getEquipList(){
+        String second = String.valueOf(Instant.now().getEpochSecond());
+        String origin = equipAppKey+"_"+second+"_"+equipAppSecret;
+        log.warn(origin);
+        String sign = encryptMD5(origin);
+        Map<String, String> headers = new HashMap<>();
+        headers.put("appKey",equipAppKey);
+        headers.put("time",second);
+        headers.put("sign",sign);
+        log.warn("heads{}",headers);
+        String url = "";
+        log.warn(url);
+        String result = HttpClientUtil.doGet(url,headers,null);
+        log.warn(result);
+    }
+
+    public void getLatest(){
+        String second = String.valueOf(Instant.now().getEpochSecond());
+        Map<String, String> headers = new HashMap<>();
+        headers.put("appKey",humitureAppKey);
+        headers.put("time",second);
+        Map<String, String> params = new HashMap<>();
+        params.put("devices","66111897,66120895");
+        params.put("force","1");
+        String paramStr = "devices_66111897,66120895_force_1";
+        String origin = humitureAppKey+"_"+paramStr+"_"+second+"_"+humitureAppSecret;
+        log.warn(origin);
+        String sign = encryptMD5(origin);
+        log.warn(sign);
+        headers.put("sign",sign);
+        String result = HttpClientUtil.doPost(humitureUri+humitureLatest,headers,params);
+        log.warn(result);
+    }
+
+    public static String encryptMD5(String input) {
+        try {
+            // 创建MD5加密对象
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            // 执行加密操作
+            byte[] messageDigest = md.digest(input.getBytes());
+            // 将字节数组转换为16进制字符串
+            StringBuilder hexString = new StringBuilder();
+            for (byte b : messageDigest) {
+                String hex = Integer.toHexString(0xff & b);
+                if (hex.length() == 1) {
+                    hexString.append('0');
+                }
+                hexString.append(hex);
+            }
+            return hexString.toString().toUpperCase();
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException(e);
+        }
     }
 
+//    public List<VendorBinxiang> query() {
+//        log.info("sql");
+//        return jdbcTemplate.query(
+//                "sqlsssss",new RowMapper<VendorBinxiang>(){
+//
+//                    @Override
+//                    public VendorBinxiang mapRow(ResultSet rs, int rowNum) throws SQLException {
+//                        VendorBinxiang bx = new VendorBinxiang();
+//                        bx.setId(rs.getString("id"));
+//                        bx.setWendu(rs.getString("温度"));
+//                        bx.setBinXiangId(rs.getString("冰箱ID"));
+//                        bx.setBinxiangName(rs.getString("冰箱名称"));
+//                        bx.setCaiJiId(rs.getString("采集器ID"));
+//                        bx.setCaiJiName(rs.getString("采集器名称"));
+//                        bx.setCaiJiTime(rs.getString("采集时间"));
+//                        bx.setWenduUp(rs.getString("温度上限"));
+//                        bx.setWenduDown(rs.getString("温度下限"));
+//                        bx.setShiyanzhuName(rs.getString("实验组"));
+//                        bx.setShiyanzhuId(rs.getString("实验组ID"));
+//                        return bx;
+//                    }
+//                }
+//        );
+//    }
+
 }

+ 120 - 0
exchange/src/main/java/com/jyxt/thridparty/exchange/bx/utils/HttpClientUtil.java

@@ -0,0 +1,120 @@
+package com.jyxt.thridparty.exchange.bx.utils;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ 1. 跨域请求工具类
+ */
+public class HttpClientUtil {
+
+    public static String doGet(String url, Map<String, String> headers, Map<String, String> params) {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        String resultString = "";
+        try {
+            URIBuilder builder = new URIBuilder(url);
+            if (params != null) {
+                for (String key : params.keySet()) {
+                    builder.addParameter(key, params.get(key));
+                }
+            }
+            URI uri = builder.build();
+            HttpGet httpGet = new HttpGet(uri);
+            if (headers != null) {
+                for (String key : headers.keySet()) {
+                    httpGet.setHeader(key, headers.get(key));
+                }
+            }
+            HttpResponse response = httpclient.execute(httpGet);
+            if (response.getStatusLine().getStatusCode() == 200) {
+                resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                httpclient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return resultString;
+    }
+
+    public static String doPost(String url, Map<String, String> headers, Map<String, String> param) {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            HttpPost httpPost = new HttpPost(url);
+            if (param != null) {
+                List<NameValuePair> paramList = new ArrayList<>();
+                for (String key : param.keySet()) {
+                    paramList.add(new BasicNameValuePair(key, param.get(key)));
+                }
+                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
+                httpPost.setEntity(entity);
+            }
+            if (headers != null) {
+                for (String key : headers.keySet()) {
+                    httpPost.setHeader(key, headers.get(key));
+                }
+            }
+            response = httpClient.execute(httpPost);
+            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return resultString;
+    }
+
+    public static String doPostJson(String url, String json) {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpPost httpPost = new HttpPost(url);
+            // 创建请求内容
+            StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
+            httpPost.setEntity(entity);
+            // 执行http请求
+            response = httpClient.execute(httpPost);
+            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return resultString;
+    }
+}
+

+ 18 - 2
exchange/src/main/resources/application.properties

@@ -1,4 +1,4 @@
-spring.datasource.jdbc-url = jdbc:mysql://dev1.local:3306/zdqy_view?characterEncoding=utf8&useSSL=false
+spring.datasource.jdbc-url = jdbc:mysql://demo2.local:3306/zdqy_view?characterEncoding=utf8&useSSL=false
 spring.datasource.username = root
 spring.datasource.password = test001
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
@@ -6,4 +6,20 @@ spring.second-datasource.jdbc-url = jdbc:mysql://dev1.local:3306/klims-ibps3?cha
 spring.second-datasource.username = root
 spring.second-datasource.password = test001
 spring.second-datasource.driver-class-name = com.mysql.cj.jdbc.Driver
-fetch.sql=select * from v_get_ref_temperature  where date(\u91c7\u96c6\u65f6\u95f4)=curdate()
+# \u8BBE\u5907\u6570\u636E
+equip.uri=http://api-jk.ztmscloud.com/v1
+# \u8BBE\u5907\u6E05\u5355
+equip.channels=/channels
+# \u62A5\u8B66\u6570\u636E
+equip.alarmhistory=/alarmhistory
+equip.appKey=T8GF56A
+equip.appSecret=9018860D77DD6863068ACA21B19900BD
+
+# \u6E29\u6E7F\u5EA6\u6570\u636E
+humiture.uri=https://dataapi.jkyun.ztmscloud.com/v1
+# \u6700\u65B0\u6570\u636E
+humiture.latest=/device/latest
+# \u5386\u53F2\u6570\u636E
+humiture.history=/device/history
+humiture.appKey=JBXEVMVCK
+humiture.appSecret=8dN3ZaoPO05OZevtadsm