|
@@ -200,6 +200,23 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 查看设备属性,不记录日志
|
|
|
+ * @param funcId
|
|
|
+ * @param sn
|
|
|
+ */
|
|
|
+ public void checkOptions(String funcId, String sn) {
|
|
|
+ String msgId = RandomUtil.randomNumbers(8);
|
|
|
+ String key = myConfig.getCommandPrefix() + sn;
|
|
|
+ String commandStr = RedisUtil.get(key);
|
|
|
+ List<RequestPackageDTO> commandList = JSONUtil.toList(commandStr, RequestPackageDTO.class);
|
|
|
+ RequestPackageDTO commandDTO = new RequestPackageDTO();
|
|
|
+ commandDTO.setFuncId(funcId)
|
|
|
+ .setMsgId(msgId);
|
|
|
+ commandList.add(commandDTO);
|
|
|
+ RedisUtil.set(myConfig.getCommandPrefix() + sn, JSONUtil.toJsonStr(commandList));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 设置心跳command=1,设备开始请求命令服务器接口
|
|
|
*
|
|
|
* @param sn sn码
|
|
@@ -270,6 +287,10 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
|
startHeartCommand(tbTerminal.getSn());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 远程开门
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
public void open(Long id) {
|
|
|
TbTerminal tbTerminal = this.getById(id);
|
|
|
if (StrUtil.equals(tbTerminal.getState(),TbTerminal.StateType.OFFLINE.getState())){
|
|
@@ -278,4 +299,20 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
|
setCommand(CommandType.ISSUED_NORMALOPEN_COMMAND.getFuncId(), null, tbTerminal);
|
|
|
startHeartCommand(tbTerminal.getSn());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步时间
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ public void asyncTime(Long id){
|
|
|
+ TbTerminal tbTerminal = this.getById(id);
|
|
|
+ if (StrUtil.equals(tbTerminal.getState(),TbTerminal.StateType.OFFLINE.getState())){
|
|
|
+ throw new BusinessException("设备已离线");
|
|
|
+ }
|
|
|
+ JSONObject params=new JSONObject();
|
|
|
+ params.set("time",System.currentTimeMillis()/1000);
|
|
|
+ setCommand(CommandType.SYNC_TIME_COMMAND.getFuncId(), params, tbTerminal);
|
|
|
+ startHeartCommand(tbTerminal.getSn());
|
|
|
+
|
|
|
+ }
|
|
|
}
|