提交 bc7d4f24 authored 作者: linzhenjie's avatar linzhenjie

Merge remote-tracking branch 'origin/master'

......@@ -15,6 +15,6 @@ public class ShDeviceSwitchTimingTask implements ITask {
@Override
public void run(String params) {
otherShDeviceTimingService.listTimingByTime1();
otherShDeviceTimingService.listTimingByTime();
}
}
......@@ -42,7 +42,7 @@ public interface OtherShDeviceDao extends BaseMapper<ShDeviceEntity> {
Map<String, Object> info(Integer id);
@Select("select id from sh_device where online_status = 2 and online_time is not null and now() > date_add(online_time,interval 2 minute)")
@Select("select id from sh_device where online_status = 2 and online_time is not null and now() > date_add(online_time,interval 1 minute)")
List<Map<String, Object>> timeout();
@Select("<script>" +
......
......@@ -13,7 +13,7 @@ public interface OtherShDeviceTimingDao extends BaseMapper<ShDeviceTimingEntity>
@Select("<script>" +
" select *"
+ " from sh_device_timing a where (a.repeats = 0 AND a.time = #{time1}) OR (a.repeats = 1 AND a.time = #{time2} AND FIND_IN_SET(${week},a.repeat_time))"
+ " from sh_device_timing a where a.`status` = 1 AND ((a.repeats = 0 AND a.time = #{time1}) OR (a.repeats = 1 AND a.time = #{time2} AND FIND_IN_SET(${week},a.repeat_time)))"
+ " </script>")
List<ShDeviceTimingEntity> listTimingByTime(Map<String, Object> params);
......
......@@ -18,7 +18,7 @@ public interface SecondaryKeywordsDao extends BaseMapper<ShSpeakerSecondaryKeywo
@Select("<script> " +
"SELECT a.id, a.keyword, a.cmd, a.create_time createTime, b.keyword parentKeyword FROM speaker_secondary_keywords a, speaker_first_keywords b WHERE a.parent_id = b.id " +
"SELECT a.id, a.keyword, a.cmd, a.create_time createTime, b.keyword parentKeyword FROM sh_speaker_secondary_keywords a, sh_speaker_first_keywords b WHERE a.parent_id = b.id " +
"ORDER BY a.id DESC"
+"</script>")
List<Map<String, Object>> list(Page<Map<String, Object>> page, Map<String, Object> params);
......
......@@ -77,7 +77,7 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
}
//发送到主页所有设备
if (mapList.size() > 0) {
jmsTemplate.convertAndSend(socketioTopic, JSON.toJSONString(new MapUtils().put("deviceId", "onlineStatus").put("list", JSON.toJSONString(mapList))));
jmsTemplate.convertAndSend(socketioTopic, JSON.toJSONString(new MapUtils().put("deviceId", "onlineStatus").put("list", mapList)));
}
//智能锁密码过期
this.baseMapper.updateDevicePassword();
......
......@@ -51,6 +51,15 @@ public class OtherShDeviceTimingServiceImpl extends ServiceImpl<OtherShDeviceTim
ProtocolContent protocol = new ProtocolContent();
String type = entity1.getNumbering().substring(1, 3);
switch (type) {
case "01": {
String action = entity.getAction() == 1 ? "01" : "00";
protocol.setReceiveId(entity1.getNumbering());
protocol.setContent(action);
protocol.setDeviceType(type);
protocol.setCmd("13");
mqProducer.sendT(JSON.toJSONString(protocol));
break;
}
case "02": {
String action = entity.getAction() == 1 ? "01" : entity.getAction() == 2 ? "00" : "02";
String actionTwo = entity.getActionTwo() == 1 ? "01" : entity.getActionTwo() == 2 ? "00" : "02";
......@@ -67,21 +76,15 @@ public class OtherShDeviceTimingServiceImpl extends ServiceImpl<OtherShDeviceTim
protocol.setDeviceType(type);
protocol.setCmd("18");
mqProducer.sendT(JSON.toJSONString(protocol));
redisUtils.set(entity1.getNumbering() + "action1", action, 60);
redisUtils.set(entity1.getNumbering() + "action2", actionTwo, 60);
// logger.info("action1 : {}", redisUtils.get(entity1.getNumbering() + "action"));
break;
}
case "03": {
String action = entity.getAction() == 1 ? "01" : "00";
protocol.setReceiveId(entity1.getNumbering());
protocol.setContent(action + "00000000000000");
protocol.setContent(action + "00000000000001");
protocol.setDeviceType(type);
protocol.setCmd("18");
mqProducer.sendT(JSON.toJSONString(protocol));
redisUtils.set(entity1.getNumbering() + "action", action);
logger.info("action : {}", redisUtils.get(entity1.getNumbering() + "action"));
logger.info("Numbering : {}", entity1.getNumbering());
break;
}
case "04": {
......@@ -160,6 +163,7 @@ public class OtherShDeviceTimingServiceImpl extends ServiceImpl<OtherShDeviceTim
Integer deviceId = (Integer) map.get("device_id");
Integer action = (Integer) map.get("action");
Integer actionTwo = (Integer) map.get("action_two");
//判断是符合关闭的时间还是打开的时间
Long flag = (Long) map.get("flag");
ShDeviceEntity entity1 = shDeviceService.getById(deviceId);
......@@ -172,14 +176,10 @@ public class OtherShDeviceTimingServiceImpl extends ServiceImpl<OtherShDeviceTim
String content = "";
if (action != 0 && actionTwo != 0) {
content = s + s + "000000000003";
// redisUtils.set(entity1.getNumbering() + "action1", flag == 1 ? 1 : 2, 60);
// redisUtils.set(entity1.getNumbering() + "action2", flag == 1 ? 3 : 4, 60);
}else if (action != 0) {
content = s + "00000000000001";
// redisUtils.set(entity1.getNumbering() + "action1", flag == 1 ? 1 : 2, 60);
}else if (actionTwo != 0) {
content = "00"+ s +"000000000002";
// redisUtils.set(entity1.getNumbering() + "action2", flag == 1 ? 3 : 4, 60);
}
protocol.setReceiveId(entity1.getNumbering());
protocol.setContent(content);
......
......@@ -136,7 +136,7 @@ public class MqConsumer {
map1.put("deviceId", String.valueOf(device.getId()));
map1.put("status", "2");
mapList.add(map1);
jmsTemplate.convertAndSend(socketioTopic, JSON.toJSONString(new MapUtils().put("deviceId", "onlineStatus").put("list", JSON.toJSONString(mapList))));
jmsTemplate.convertAndSend(socketioTopic, JSON.toJSONString(new MapUtils().put("deviceId", "onlineStatus").put("list", mapList)));
}
//更新设备状态为在线
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论