| | |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.tools.WebSocketServer; |
| | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void largenScreen() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //大屏钢化信息 |
| | | Integer putGlass = temperingAgoService.count( |
| | | new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW) |
| | | ); |
| | | jsonObject.append("temperingTaskType", putGlass); |
| | | //大屏钢化信息 |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingAgoService.list( |
| | | new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .select(TemperingGlassInfo::getEngineerId, TemperingGlassInfo::getTemperingLayoutId) // 选择要去重的字段 |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_START) |
| | | .groupBy(TemperingGlassInfo::getEngineerId, TemperingGlassInfo::getTemperingLayoutId) // 按 engineerId 和 temperingLayoutId 分组 |
| | | ); |
| | | jsonObject.append("temperingGlassInfoList", temperingGlassInfoList.size()); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("largenScreen"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("largenScreen is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |