| | |
| | | import com.mes.rawglasstask.service.RawGlassStorageTaskService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutorService; |
| | | |
| | | /** |
| | | * @author wangfei |
| | |
| | | @Resource |
| | | private OrdersService ordersService; |
| | | |
| | | @Scheduled(fixedDelay = 2000) |
| | | @Autowired |
| | | @Qualifier("webSocketSenderPool") |
| | | private ExecutorService webSocketSenderPool; |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void sendRawGlassMessage() { |
| | | log.info("发送任务信息和架子信息"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | List<RawGlassStorageTask> tasks = rawGlassStorageTaskService.listRawGlassTask(); |
| | | jsonObject.append("rawStationDetailsList", rawStationDetailsList); |
| | | jsonObject.append("tasks", tasks); |
| | | String message = String.valueOf(jsonObject); |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("rawGlass"); |
| | | if (CollectionUtil.isNotEmpty(sendwServer)) { |
| | | sendwServer.stream().forEach(e -> { |
| | | e.sendMessage(String.valueOf(jsonObject)); |
| | | }); |
| | | sendwServer.forEach(ws -> webSocketSenderPool.submit(() -> ws.sendMessage(message))); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 2000) |
| | | public void largenScreen() { |
| | | log.info("发送任务信息和架子信息"); |
| | | JSONObject jsonObject = new JSONObject(); |