From a96fce38bebae133c8b9d956c49bdbf87ba09231 Mon Sep 17 00:00:00 2001 From: chendaofei <857448963@qq.com> Date: Tue, 3 Mar 2026 13:43:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BA=8B=E4=BB=B6bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EventGateController.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/event_smart/src/main/java/com/njcn/product/event/transientes/controller/EventGateController.java b/event_smart/src/main/java/com/njcn/product/event/transientes/controller/EventGateController.java index 2d0cdc7..3f0a93b 100644 --- a/event_smart/src/main/java/com/njcn/product/event/transientes/controller/EventGateController.java +++ b/event_smart/src/main/java/com/njcn/product/event/transientes/controller/EventGateController.java @@ -187,8 +187,12 @@ public class EventGateController extends BaseController { try { //下面一行代码正式环境需要放开 jsonObject = test(); + List deptsList = (List) redisUtil.getObjectByKey(REDIS_DEPT_INDEX + StrUtil.DASHED + "AllDept"); + List deptIds = deptsList.stream().map(PqsDepts::getDeptsIndex).distinct().collect(Collectors.toList()); + jsonObject.putOpt("dept", String.join(StrUtil.COMMA,deptIds)); if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) && Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()) { + log.info("122345678788999999----------测试发送数据成功: {}",jsonObject); webSocketServer.sendMessageToAll(jsonObject.toString()); //开始发送短信 @@ -232,8 +236,19 @@ public class EventGateController extends BaseController { //以下部分为测试数据后续删除 List pqLineList = pqLineMapper.selectList(new LambdaQueryWrapper<>()); List lineList = pqLineList.stream().map(PqLine::getLineIndex).collect(Collectors.toList()); - List baseInfoDTOList = pqLineMapper.getBaseLineInfo(lineList); - Map map = baseInfoDTOList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity())); + + List ledgerBaseInfoDTOS = new ArrayList<>(); + if(lineList.size()>1000){ + List> listIds = CollUtil.split(lineList,1000); + for(List itemIds : listIds){ + List temp =pqLineMapper.getBaseLineInfo(itemIds); + ledgerBaseInfoDTOS.addAll(temp); + } + }else { + List temp =pqLineMapper.getBaseLineInfo(lineList); + ledgerBaseInfoDTOS.addAll(temp); + } + Map map = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity())); Random random = new Random(); Integer lineId = lineList.get(random.nextInt(lineList.size())); @@ -355,15 +370,12 @@ public class EventGateController extends BaseController { if (CollUtil.isNotEmpty(poList)) { StringBuilder stringBuilder = new StringBuilder(jsonObject.get("timeid").toString()); + String busName = jsonObject.containsKey("busname")? "_"+jsonObject.get("busname").toString():""; BigDecimal bigDecimal = new BigDecimal(jsonObject.get("eventvalue").toString()).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP); - stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(",").append(jsonObject.get("bdname").toString()).append("_").append(jsonObject.get("busname").toString()).append("_").append(jsonObject.get("pointname").toString()) + stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(",").append(jsonObject.get("bdname").toString()).append(busName).append("_").append(jsonObject.get("pointname").toString()) .append("发生电压暂降事件,事件残余电压").append(bigDecimal).append("%,持续时间:").append(jsonObject.get("persisttime").toString()).append("S;影响用户:"); stringBuilder.append(objStr); - //TODO 临时处理,后面需要用上 - - - String message; if (stringBuilder.length() > 500) { message = stringBuilder.substring(0, 490).concat(";详情请登录电压暂降监测平台查看。");