作者 钟来

plc004支持定时功能

@@ -144,6 +144,15 @@ public class DeviceController { @@ -144,6 +144,15 @@ public class DeviceController {
144 Map<String,Object> map = new HashMap<>(); 144 Map<String,Object> map = new HashMap<>();
145 map.put(skey,Integer.parseInt(data.get("shi")+""+data.get("feng"))); 145 map.put(skey,Integer.parseInt(data.get("shi")+""+data.get("feng")));
146 map.put(ekey,Integer.parseInt(data.get("shi1")+""+data.get("feng1"))); 146 map.put(ekey,Integer.parseInt(data.get("shi1")+""+data.get("feng1")));
  147 + if("PW1".equals(pw))
  148 + {
  149 + if((int)map.get("PW1_TS1")==1 && (int)map.get("PW1_TE1")==2)
  150 + {
  151 + map.put("PW_AUTO",0);
  152 + }else{
  153 + map.put("PW_AUTO",1);
  154 + }
  155 + }
147 OrderDtu orderDtu = deviceService.getOrderDtu(deviceControlMessage.getDeviceId()); 156 OrderDtu orderDtu = deviceService.getOrderDtu(deviceControlMessage.getDeviceId());
148 Topic topic = new Topic("2",orderDtu.getDeviceType(),deviceControlMessage.getDeviceId(),"PUT",null); 157 Topic topic = new Topic("2",orderDtu.getDeviceType(),deviceControlMessage.getDeviceId(),"PUT",null);
149 mqttMessage.setPayload(JSON.toJSONString(map).trim().getBytes()); 158 mqttMessage.setPayload(JSON.toJSONString(map).trim().getBytes());
@@ -33,6 +33,7 @@ public class PLCDataPersistenceService { @@ -33,6 +33,7 @@ public class PLCDataPersistenceService {
33 for (DeviceInfo deviceInfo:list) 33 for (DeviceInfo deviceInfo:list)
34 { 34 {
35 baseDao.update(deviceInfo); 35 baseDao.update(deviceInfo);
  36 + log.info("{}设备数据更新{}",topic.getClientid(),list);
36 } 37 }
37 } 38 }
38 } 39 }
@@ -80,7 +80,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { @@ -80,7 +80,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> {
80 log.info("点位对应的设备id{}",deviceInfoId); 80 log.info("点位对应的设备id{}",deviceInfoId);
81 if(deviceInfoId.equals(topic.getClientid())) 81 if(deviceInfoId.equals(topic.getClientid()))
82 { 82 {
83 - if(null != list ) 83 + if(null != list && "SYS_AUTO".equals(key))
84 { 84 {
85 for (DeviceInfo deviceInfo:list) 85 for (DeviceInfo deviceInfo:list)
86 { 86 {
@@ -134,6 +134,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { @@ -134,6 +134,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> {
134 deviceInfo.setDataUpdateTime(DateUtils.getNowTimeMilly()); 134 deviceInfo.setDataUpdateTime(DateUtils.getNowTimeMilly());
135 deviceInfo.setDeviceServiceIp(SysParameter.service_ip); 135 deviceInfo.setDeviceServiceIp(SysParameter.service_ip);
136 deviceInfo.setOnline("01"); 136 deviceInfo.setOnline("01");
  137 + log.info("设备信息{}",deviceInfo);
137 } 138 }
138 } 139 }
139 private void analysisTime( JSONObject jsonObject,Map<String, DeviceDataConfig> deviceDataConfigMap,Topic topic,List<DeviceInfo> deviceInfoList) 140 private void analysisTime( JSONObject jsonObject,Map<String, DeviceDataConfig> deviceDataConfigMap,Topic topic,List<DeviceInfo> deviceInfoList)