| | |
| | | import com.zy.common.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Value("${led.id}") |
| | | private String ledId; |
| | | |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | private void send() { |
| | |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | private void ErrorSend(){ |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("to","1002"); |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", 1002)); |
| | | map.put("to",ledId); |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", ledId)); |
| | | if (basDevp == null ){ |
| | | return; |
| | | } |
| | |
| | | return; |
| | | } |
| | | map.put("message",Cools.add("type", "error").add("errMsg",basDevp.getDecDesc())); |
| | | webSocketServer.onMessage(JSONObject.toJSONString(map),null,"1002"); |
| | | webSocketServer.onMessage(JSONObject.toJSONString(map),null,ledId); |
| | | redisUtil.set(key,basDevp.getDecDesc(),15); |
| | | } |
| | | |
| | |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | private void TaskSend(){ |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("to","1002"); |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", 1002)); |
| | | map.put("to",ledId); |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", ledId)); |
| | | if (basDevp == null ){ |
| | | return; |
| | | } |
| | |
| | | } |
| | | } |
| | | map.put("message",Cools.add("type", "task").add("taskList",commandList)); |
| | | webSocketServer.onMessage(JSONObject.toJSONString(map),null,"1002"); |
| | | webSocketServer.onMessage(JSONObject.toJSONString(map),null,ledId); |
| | | redisUtil.set(key,basDevp.getWrkNo(),15); |
| | | } |
| | | |