523096025 il y a 2 ans
Parent
commit
4d0e3973b3

+ 23 - 18
huimv-admin/src/main/java/com/huimv/admin/service/impl/EnvDeviceServiceImpl.java

@@ -350,30 +350,35 @@ public class EnvDeviceServiceImpl extends ServiceImpl<EnvDeviceMapper, EnvDevice
         if (count>0){
             return new Result(10001,"绑定失败,该栋舍已有设备",false);
         }
+        this.updateById(envDevice);
         return new Result(10000,"绑定成功",true);
     }
     //添加新的设备
     private void syncConfig(String shackId,HttpEntity httpEntity,String farmId) {
-        ResponseEntity<String> exchangePeizhi = restTemplate.exchange("https://yzwlw.loongk.com/mobile/loadShackConfig/"+shackId, HttpMethod.GET, httpEntity, String.class);
-        String peizhibody = exchangePeizhi.getBody();
-        ShackConfigDto shackConfigDto = JSONUtil.toBean(peizhibody, ShackConfigDto.class);
-        ShackConfigData data = shackConfigDto.getData();
-        List<ShackConfigDataSensors> sensors = data.getSensors();
-        if (ObjectUtil.isNotEmpty(sensors)){
-            EnvDevice envDevice =new EnvDevice();
-            envDevice.setFarmId(Integer.parseInt(farmId));
-            envDevice.setDeviceBrand("增鑫");
-            envDevice.setDeviceCode(data.getId());
-            envDevice.setDeviceName(data.getName());
-            for (ShackConfigDataSensors sensor : sensors) {
-                if ("TEMPERATURE".equals(sensor.getType())){
-                    envDevice.setOhter1(sensor.getId());
-                }
-                if ("HUMIDITY".equals(sensor.getType())){
-                    envDevice.setOhter2(sensor.getId());
+        try {
+            ResponseEntity<String> exchangePeizhi = restTemplate.exchange("https://yzwlw.loongk.com/mobile/loadShackConfig/"+shackId, HttpMethod.GET, httpEntity, String.class);
+            String peizhibody = exchangePeizhi.getBody();
+            ShackConfigDto shackConfigDto = JSONUtil.toBean(peizhibody, ShackConfigDto.class);
+            ShackConfigData data = shackConfigDto.getData();
+            List<ShackConfigDataSensors> sensors = data.getSensors();
+            if (ObjectUtil.isNotEmpty(sensors)){
+                EnvDevice envDevice =new EnvDevice();
+                envDevice.setFarmId(Integer.parseInt(farmId));
+                envDevice.setDeviceBrand("增鑫");
+                envDevice.setDeviceCode(data.getId());
+                envDevice.setDeviceName(data.getName());
+                for (ShackConfigDataSensors sensor : sensors) {
+                    if ("TEMPERATURE".equals(sensor.getType())){
+                        envDevice.setOhter1(sensor.getId());
+                    }
+                    if ("HUMIDITY".equals(sensor.getType())){
+                        envDevice.setOhter2(sensor.getId());
+                    }
                 }
+                envDeviceMapper.insert(envDevice);
             }
-            envDeviceMapper.insert(envDevice);
+        }catch (Exception e){
+            System.out.println("设备同步异常:" + e +"  deviceId"+shackId);
         }
 
     }

+ 0 - 175
huimv-admin/src/main/java/com/huimv/admin/timer/CarmeraTimer.java

@@ -41,23 +41,10 @@ public class CarmeraTimer {
     private static final String OPENAPI_IP_PORT_HTTPS = "https://61.153.248.106:4430";
     private static final String ITF_ADDRESS_GET_CAMERAS = "/openapi/service/vss/res/getCameras";
     private static final String OP_USER_UUID = "5b2eb534696b11e89c2e438f92627767";
-    @Autowired
-    private RestTemplate restTemplate;
 
     @Autowired
     private ICameraBaseService cameraBaseService;
 
-    @Autowired
-    private IEnvDeviceService envDeviceService;
-
-    @Autowired
-    private IEnvDataService envDataService;
-    @Autowired
-    private IEnvWarningThresholdService envWarningThresholdService;
-
-    @Autowired
-    private IEnvWarningInfoService envWarningInfoService;
-
     //更新摄像头状态
     @Scheduled(cron = "0 0/10 * * * ? ")
     private void updateCameraOnlin() throws Exception {
@@ -96,168 +83,6 @@ public class CarmeraTimer {
     }
 
 
-    //环控数据
-    String username = "江西增鑫";
-    String password = "888888";
-    String passwordMD5 = "21218cca77804d2ba1922c33e0151105";
-    String baseurl ="https://yzwlw.loongk.com/";
-
-    @Scheduled(cron = "0 0/11 * * * ? ")
-    @Transactional
-    private void getHuanKong() throws Exception {
-        //目前是这家
-        Integer farmId = 21;
-        String encode = loginOnly();
-        System.out.println("encode"+encode);
-        //获取阈值
-        EnvWarningThreshold envWarningThreshold = envWarningThresholdService.getOne(new QueryWrapper<EnvWarningThreshold>().eq("farm_id", farmId));
-        HttpHeaders headers = new HttpHeaders();
-        headers.add("Authorization",encode);
-        HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
-        //TODO 只有一家,先拿全部
-        List<EnvDevice> list = envDeviceService.list();
-        for (EnvDevice envDevice : list) {
-            if (ObjectUtil.isNotEmpty(envDevice) && StringUtils.isNotBlank(envDevice.getDeviceCode())){
-                System.out.println(envDevice.getDeviceCode());
-                String shishiBody = "";
-                try {
-                    ResponseEntity<String> exchange = restTemplate.exchange("https://yzwlw.loongk.com/mobile/loadShackDatas/" + envDevice.getDeviceCode(), HttpMethod.GET, requestEntity, String.class);
-                     shishiBody =   exchange.getBody();
-                }catch (Exception e){
-                    System.out.println(e);
-                }
-
-                if (StringUtils.isBlank(shishiBody)){
-                    System.out.println(new Date() +"实时数据"+ shishiBody);
-                    return;
-                }
-                ShackDatasDto shackDatasDto = JSONUtil.toBean(shishiBody, ShackDatasDto.class);
-                String onLine = shackDatasDto.getData().getOnLine();
-                if ("N".equals(onLine)){
-                    envDevice.setDeviceStatus(0);
-                }else {
-                    envDevice.setDeviceStatus(1);
-                }
-                envDeviceService.updateById(envDevice);
-                List<ShackDatasSensor> sensorDatas = shackDatasDto.getData().getSensorDatas();
-                EnvData envData = new EnvData();
-                for (ShackDatasSensor sensorData : sensorDatas) {
-                    if (sensorData.getId().equals(envDevice.getOhter1())){
-                        String val = sensorData.getVal();
-                        //TODO 预警
-                        saveTemWarning(val,envWarningThreshold,envDevice,farmId);
-                        envData.setEnvTemp(val);
-                    }
-                    if (sensorData.getId().equals(envDevice.getOhter2())){
-                        String val = sensorData.getVal();
-                        //TODO 预警
-                        saveHumWarning(val,envWarningThreshold,envDevice,farmId);
-                        envData.setEnvHum(val);
-                    }
-                }
-                envData.setCreateTime(new Date());
-                envData.setDeviceId(envDevice.getDeviceCode());
-                envData.setFarmId(farmId);
-                envData.setUnitId(envDevice.getUnitId());
-                envDataService.save(envData);
-            }
-        }
-    }
-
-    private void saveHumWarning(String val, EnvWarningThreshold envWarningThreshold, EnvDevice envDevice, Integer farmId) {
-        if (StringUtils.isNotBlank(val)){
-            String maxHum ;
-            String minHum ;
-            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMaxHum())){
-                maxHum ="90";
-            }else {
-                maxHum = envWarningThreshold.getMaxHum();
-            }
-            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMinHum())){
-                minHum ="0";
-            }else {
-                minHum =envWarningThreshold.getMinHum();
-            }
-            if (Double.parseDouble(maxHum) < Double.parseDouble(val)){
-                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
-                envWarningInfo.setBuildLocation(envDevice.getUnitName());
-                envWarningInfo.setDate(new Date());
-                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
-                envWarningInfo.setFarmId(farmId);
-                envWarningInfo.setUnitId(envDevice.getUnitId());
-                envWarningInfo.setUnitName(envDevice.getUnitName());
-                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
-                envWarningInfo.setWarningContent("当前湿度为"+val+"%超过阈值,请及时检查");
-                envWarningInfo.setWarningType(2);
-                envWarningInfoService.save(envWarningInfo);
-            }
-            if (Double.parseDouble(minHum) >Double.parseDouble(val)){
-                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
-                envWarningInfo.setBuildLocation(envDevice.getUnitName());
-                envWarningInfo.setDate(new Date());
-                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
-                envWarningInfo.setFarmId(farmId);
-                envWarningInfo.setUnitId(envDevice.getUnitId());
-                envWarningInfo.setUnitName(envDevice.getUnitName());
-                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
-                envWarningInfo.setWarningContent("当前湿度为"+val+"%低于阈值,请及时检查");
-                envWarningInfo.setWarningType(2);
-                envWarningInfoService.save(envWarningInfo);
-            }
-        }
-    }
-
-    private void saveTemWarning(String val, EnvWarningThreshold envWarningThreshold,EnvDevice envDevice,Integer farmId) {
-        if (StringUtils.isNotBlank(val)){
-            String maxTem ;
-            String minTem ;
-            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMaxTem())){
-                maxTem ="40";
-            }else {
-                maxTem = envWarningThreshold.getMaxTem();
-            }
-            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMinTem())){
-                minTem ="0";
-            }else {
-                minTem =envWarningThreshold.getMinTem();
-            }
-            System.out.println("maxTem:"+Double.parseDouble(maxTem)+"  minTem:"+Double.parseDouble(minTem)+"   val:"+Double.parseDouble(val));
-            if (Double.parseDouble(maxTem) < Double.parseDouble(val)){
-                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
-                envWarningInfo.setBuildLocation(envDevice.getUnitName());
-                envWarningInfo.setDate(new Date());
-                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
-                envWarningInfo.setFarmId(farmId);
-                envWarningInfo.setUnitId(envDevice.getUnitId());
-                envWarningInfo.setUnitName(envDevice.getUnitName());
-                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
-                envWarningInfo.setWarningContent("当前温度为"+val+"°超过阈值,请及时检查");
-                envWarningInfo.setWarningType(1);
-                envWarningInfoService.save(envWarningInfo);
-            }
-            if (Double.parseDouble(minTem)>Double.parseDouble(val)){
-                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
-                envWarningInfo.setBuildLocation(envDevice.getUnitName());
-                envWarningInfo.setDate(new Date());
-                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
-                envWarningInfo.setFarmId(farmId);
-                envWarningInfo.setUnitId(envDevice.getUnitId());
-                envWarningInfo.setUnitName(envDevice.getUnitName());
-                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
-                envWarningInfo.setWarningContent("当前温度为"+val+"°低于阈值,请及时检查");
-                envWarningInfo.setWarningType(1);
-                envWarningInfoService.save(envWarningInfo);
-            }
-        }
-    }
-
-    private String loginOnly() throws Exception {
-        Map<String, Object> map = new HashMap<String, Object>();
-        String s = HttpClientSSLUtils.doPost(baseurl + "/mobile/login?username=" + username + "&password=" + passwordMD5,JSON.toJSONString(map));
-        LoginOnlyDto loginDto = JSONUtil.toBean(s, LoginOnlyDto.class);
-        LonginOnlyDtoToken token = loginDto.getData().getToken();
-        return Base64.encode(token.getUserId() + "_" + token.getToken());
-    }
 
     public static void main(String[] args) throws Exception {
         Map<String, Object> map = new HashMap<String, Object>();

+ 218 - 0
huimv-admin/src/main/java/com/huimv/admin/timer/EnvTimer.java

@@ -0,0 +1,218 @@
+package com.huimv.admin.timer;
+
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.huimv.admin.common.utils.HttpClientSSLUtils;
+import com.huimv.admin.entity.EnvData;
+import com.huimv.admin.entity.EnvDevice;
+import com.huimv.admin.entity.EnvWarningInfo;
+import com.huimv.admin.entity.EnvWarningThreshold;
+import com.huimv.admin.entity.zengxindto.LoginOnlyDto;
+import com.huimv.admin.entity.zengxindto.LonginOnlyDtoToken;
+import com.huimv.admin.entity.zengxindto.ShackDatasDto;
+import com.huimv.admin.entity.zengxindto.ShackDatasSensor;
+import com.huimv.admin.service.IEnvDataService;
+import com.huimv.admin.service.IEnvDeviceService;
+import com.huimv.admin.service.IEnvWarningInfoService;
+import com.huimv.admin.service.IEnvWarningThresholdService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+@EnableScheduling
+public class EnvTimer {
+
+    @Autowired
+    private RestTemplate restTemplate;
+    @Autowired
+    private IEnvDeviceService envDeviceService;
+
+    @Autowired
+    private IEnvDataService envDataService;
+    @Autowired
+    private IEnvWarningThresholdService envWarningThresholdService;
+
+    @Autowired
+    private IEnvWarningInfoService envWarningInfoService;
+    //环控数据
+    String username = "江西增鑫";
+    String password = "888888";
+    String passwordMD5 = "21218cca77804d2ba1922c33e0151105";
+    String baseurl ="https://yzwlw.loongk.com/";
+
+    @Scheduled(cron = "0 0/11 * * * ? ")
+    @Transactional
+    private void getHuanKong() throws Exception {
+        //目前是这家
+        Integer farmId = 21;
+        String encode = loginOnly();
+        System.out.println("encode"+encode);
+        //获取阈值
+        EnvWarningThreshold envWarningThreshold = envWarningThresholdService.getOne(new QueryWrapper<EnvWarningThreshold>().eq("farm_id", farmId));
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Authorization",encode);
+        HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
+        //TODO 只有一家,先拿全部
+        List<EnvDevice> list = envDeviceService.list();
+        for (EnvDevice envDevice : list) {
+            if (ObjectUtil.isNotEmpty(envDevice) && StringUtils.isNotBlank(envDevice.getDeviceCode())){
+                System.out.println(envDevice.getDeviceCode());
+                String shishiBody = "";
+                try {
+                    ResponseEntity<String> exchange = restTemplate.exchange("https://yzwlw.loongk.com/mobile/loadShackDatas/" + envDevice.getDeviceCode(), HttpMethod.GET, requestEntity, String.class);
+                    shishiBody =   exchange.getBody();
+                }catch (Exception e){
+                    System.out.println(e);
+                }
+
+                if (StringUtils.isBlank(shishiBody)){
+                    System.out.println(new Date() +"实时数据"+ shishiBody);
+                    return;
+                }
+                ShackDatasDto shackDatasDto = JSONUtil.toBean(shishiBody, ShackDatasDto.class);
+                String onLine = shackDatasDto.getData().getOnLine();
+                if ("N".equals(onLine)){
+                    envDevice.setDeviceStatus(0);
+                }else {
+                    envDevice.setDeviceStatus(1);
+                }
+                envDeviceService.updateById(envDevice);
+                List<ShackDatasSensor> sensorDatas = shackDatasDto.getData().getSensorDatas();
+                EnvData envData = new EnvData();
+                for (ShackDatasSensor sensorData : sensorDatas) {
+                    if (sensorData.getId().equals(envDevice.getOhter1())){
+                        String val = sensorData.getVal();
+                        //TODO 预警
+                        saveTemWarning(val,envWarningThreshold,envDevice,farmId);
+                        envData.setEnvTemp(val);
+                    }
+                    if (sensorData.getId().equals(envDevice.getOhter2())){
+                        String val = sensorData.getVal();
+                        //TODO 预警
+                        saveHumWarning(val,envWarningThreshold,envDevice,farmId);
+                        envData.setEnvHum(val);
+                    }
+                }
+                envData.setCreateTime(new Date());
+                envData.setDeviceId(envDevice.getDeviceCode());
+                envData.setFarmId(farmId);
+                envData.setUnitId(envDevice.getUnitId());
+                envDataService.save(envData);
+            }
+        }
+    }
+
+    private void saveHumWarning(String val, EnvWarningThreshold envWarningThreshold, EnvDevice envDevice, Integer farmId) {
+        if (StringUtils.isNotBlank(val)){
+            String maxHum ;
+            String minHum ;
+            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMaxHum())){
+                maxHum ="90";
+            }else {
+                maxHum = envWarningThreshold.getMaxHum();
+            }
+            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMinHum())){
+                minHum ="0";
+            }else {
+                minHum =envWarningThreshold.getMinHum();
+            }
+            if (Double.parseDouble(maxHum) < Double.parseDouble(val)){
+                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
+                envWarningInfo.setBuildLocation(envDevice.getUnitName());
+                envWarningInfo.setDate(new Date());
+                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
+                envWarningInfo.setFarmId(farmId);
+                envWarningInfo.setUnitId(envDevice.getUnitId());
+                envWarningInfo.setUnitName(envDevice.getUnitName());
+                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
+                envWarningInfo.setWarningContent("当前湿度为"+val+"%超过阈值,请及时检查");
+                envWarningInfo.setWarningType(2);
+                envWarningInfoService.save(envWarningInfo);
+            }
+            if (Double.parseDouble(minHum) >Double.parseDouble(val)){
+                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
+                envWarningInfo.setBuildLocation(envDevice.getUnitName());
+                envWarningInfo.setDate(new Date());
+                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
+                envWarningInfo.setFarmId(farmId);
+                envWarningInfo.setUnitId(envDevice.getUnitId());
+                envWarningInfo.setUnitName(envDevice.getUnitName());
+                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
+                envWarningInfo.setWarningContent("当前湿度为"+val+"%低于阈值,请及时检查");
+                envWarningInfo.setWarningType(2);
+                envWarningInfoService.save(envWarningInfo);
+            }
+        }
+    }
+
+    private void saveTemWarning(String val, EnvWarningThreshold envWarningThreshold,EnvDevice envDevice,Integer farmId) {
+        if (StringUtils.isNotBlank(val)){
+            String maxTem ;
+            String minTem ;
+            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMaxTem())){
+                maxTem ="40";
+            }else {
+                maxTem = envWarningThreshold.getMaxTem();
+            }
+            if (ObjectUtil.isEmpty(envWarningThreshold) || StringUtils.isBlank(envWarningThreshold.getMinTem())){
+                minTem ="0";
+            }else {
+                minTem =envWarningThreshold.getMinTem();
+            }
+            System.out.println("maxTem:"+Double.parseDouble(maxTem)+"  minTem:"+Double.parseDouble(minTem)+"   val:"+Double.parseDouble(val));
+            if (Double.parseDouble(maxTem) < Double.parseDouble(val)){
+                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
+                envWarningInfo.setBuildLocation(envDevice.getUnitName());
+                envWarningInfo.setDate(new Date());
+                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
+                envWarningInfo.setFarmId(farmId);
+                envWarningInfo.setUnitId(envDevice.getUnitId());
+                envWarningInfo.setUnitName(envDevice.getUnitName());
+                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
+                envWarningInfo.setWarningContent("当前温度为"+val+"°超过阈值,请及时检查");
+                envWarningInfo.setWarningType(1);
+                envWarningInfoService.save(envWarningInfo);
+            }
+            if (Double.parseDouble(minTem)>Double.parseDouble(val)){
+                EnvWarningInfo envWarningInfo = new EnvWarningInfo();
+                envWarningInfo.setBuildLocation(envDevice.getUnitName());
+                envWarningInfo.setDate(new Date());
+                envWarningInfo.setDeviceId(envDevice.getDeviceCode());
+                envWarningInfo.setFarmId(farmId);
+                envWarningInfo.setUnitId(envDevice.getUnitId());
+                envWarningInfo.setUnitName(envDevice.getUnitName());
+                envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
+                envWarningInfo.setWarningContent("当前温度为"+val+"°低于阈值,请及时检查");
+                envWarningInfo.setWarningType(1);
+                envWarningInfoService.save(envWarningInfo);
+            }
+        }
+    }
+
+    private String loginOnly() throws Exception {
+        Map<String, Object> map = new HashMap<String, Object>();
+        String s = HttpClientSSLUtils.doPost(baseurl + "/mobile/login?username=" + username + "&password=" + passwordMD5, JSON.toJSONString(map));
+        LoginOnlyDto loginDto = JSONUtil.toBean(s, LoginOnlyDto.class);
+        LonginOnlyDtoToken token = loginDto.getData().getToken();
+        return Base64.encode(token.getUserId() + "_" + token.getToken());
+    }
+
+}

+ 65 - 0
huimv-admin/src/main/java/com/huimv/admin/timer/ShenChanTimer.java

@@ -0,0 +1,65 @@
+package com.huimv.admin.timer;
+
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.huimv.admin.common.utils.HttpClientSSLUtils;
+import com.huimv.admin.entity.EnvData;
+import com.huimv.admin.entity.EnvDevice;
+import com.huimv.admin.entity.EnvWarningInfo;
+import com.huimv.admin.entity.EnvWarningThreshold;
+import com.huimv.admin.entity.zengxindto.LoginOnlyDto;
+import com.huimv.admin.entity.zengxindto.LonginOnlyDtoToken;
+import com.huimv.admin.entity.zengxindto.ShackDatasDto;
+import com.huimv.admin.entity.zengxindto.ShackDatasSensor;
+import com.huimv.admin.service.IEnvDataService;
+import com.huimv.admin.service.IEnvDeviceService;
+import com.huimv.admin.service.IEnvWarningInfoService;
+import com.huimv.admin.service.IEnvWarningThresholdService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+@EnableScheduling
+public class ShenChanTimer {
+
+    @Autowired
+    private RestTemplate restTemplate;
+    //环控数据
+    String username = "test";
+    String password = "123456";
+    String passwordMD5 = "e10adc3949ba59abbe56e057f20f883e";
+    private static final String BASE_URL ="test.htpig.cn";
+
+
+    @Scheduled(cron = "0 0/11 * * * ? ")
+    private void getShenChan() throws Exception {
+
+    }
+
+    private String loginOnly() throws Exception {
+        Map<String, Object> map = new HashMap<String, Object>();
+        String s = HttpClientSSLUtils.doPost(BASE_URL + "/mobile/login?username=" + username + "&password=" + passwordMD5, JSON.toJSONString(map));
+        LoginOnlyDto loginDto = JSONUtil.toBean(s, LoginOnlyDto.class);
+        LonginOnlyDtoToken token = loginDto.getData().getToken();
+        return Base64.encode(token.getUserId() + "_" + token.getToken());
+    }
+
+}