| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.tools.WebSocketServer; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | |
| | | |
| | | @Autowired |
| | | private TemperingGlassInfoService temperingAgoService; |
| | | @Autowired |
| | | private DamageService damageService; |
| | | |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | |
| | | if (outGlass != null) { |
| | | jsonObject.append("overGlass", overGlass); |
| | | } |
| | | //当前钢化工程的拿走数据 |
| | | LambdaQueryWrapper<TemperingGlassInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.select(TemperingGlassInfo::getEngineerId) |
| | | .lt(TemperingGlassInfo::getState, Const.TEMPERING_END) |
| | | .groupBy(TemperingGlassInfo::getEngineerId); |
| | | |
| | | List<String> engineerIds = temperingAgoService.list(queryWrapper) |
| | | .stream() |
| | | .map(TemperingGlassInfo::getEngineerId) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<Damage> temperingTakeGlassInfos = damageService.list( |
| | | new LambdaQueryWrapper<Damage>() |
| | | .in(Damage::getEngineerId, engineerIds) |
| | | .eq(Damage::getType, Const.GLASS_STATE_TAKE) |
| | | .orderByAsc(Damage::getId) |
| | | ); |
| | | |
| | | |
| | | jsonObject.append("temperingTakeGlassInfos", temperingTakeGlassInfos); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("temperingGlass"); |
| | | if (sendwServer != null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingIsRun(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<TemperingGlassInfo>temperingTaskType=temperingAgoService.selectTaskType(); |
| | | jsonObject.append("temperingTaskType", temperingTaskType); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun"); |
| | | |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("temperingIsRun"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |