From bfe8e83a2b51b177e11b30106937841ef924fafc Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 18 Apr 2024 17:10:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=EF=BC=8C=E6=8A=98=E4=B8=AD=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/defect/service/impl/DefectCheckServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java index a62bc38..e101699 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java @@ -166,7 +166,15 @@ public class DefectCheckServiceImpl extends BaseServiceImpllambdaQuery().eq(OperPhenomenonEntity::getDefectCode, result) + .last("limit 1;") + ); + if (ObjectUtil.isNotEmpty(operPhenomenonEntity)){ + suffix= String.format(String.format("%03d", ticketList.size() + 10)); + result= stationR.getData().getSignage() + yearMonth + suffix; + } // 缺陷编码 : 按项目+年+月+序号 if (Func.isNotEmpty(result)) { entity.setDefectCode(result); From 1ea68de3ce9f59977a8feddb0e2c0ea41133d33d Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 18 Apr 2024 17:20:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E8=BF=91?= =?UTF-8?q?=E4=B8=89=E5=B9=B4=E5=8F=91=E7=94=B5=E9=87=8F=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/home/impl/RealTargetServiceImpl.java | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 28a5187..3238a94 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -35,6 +35,7 @@ import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.Result; +import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; @@ -53,6 +54,7 @@ import java.math.RoundingMode; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -112,7 +114,12 @@ public class RealTargetServiceImpl implements RealTargetService { private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; private final static String load_photovoltaic_real_key = "hzims:operation:photovoltaic:real:key"; private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; - + @Getter + private static final ThreadPoolExecutor fixedThreadExecutor; + static { + ThreadFactory threadFactory = Executors.defaultThreadFactory(); + fixedThreadExecutor = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingDeque(), threadFactory); + } @Override public void loadEmInfo(String param) { @@ -1211,6 +1218,9 @@ public class RealTargetServiceImpl implements RealTargetService { */ @Override public void loadPowerData(String param, List types, Integer serveType, int year) { + Long time=System.currentTimeMillis(); + System.out.println("近年发电量接口耗时测试开始======================="); + log.info("近年发电量接口耗时测试开始======================="); // 站点查询 List stationList = stationService.list(new LambdaQueryWrapper() {{ eq(StationEntity::getDataOrigin,"0"); @@ -1235,7 +1245,10 @@ public class RealTargetServiceImpl implements RealTargetService { String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; // 存储数据map :<站点id,<月份,发电量>> Map> powerMap = new HashMap<>(); + Long time2=System.currentTimeMillis(); + log.info("近年发电量接口,数据组装"+(time2-time)); stationList.forEach(station -> { + fixedThreadExecutor.execute(()->{ // 站点设备集合 List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); log.error("load_power_data station :" + station.getCode() + "==== device :" + stationDevices ); @@ -1244,8 +1257,11 @@ public class RealTargetServiceImpl implements RealTargetService { return; } powerMap.put(station.getId(),generateMap); + }); }); redisTemplate.opsForValue().set(recent_year_power_data, powerMap); + Long time3=System.currentTimeMillis(); + log.info("近年发电量数据接口,总耗时:"+(time3-time)); } /** @@ -1322,6 +1338,7 @@ public class RealTargetServiceImpl implements RealTargetService { */ private Map getGenerateYear(StationEntity station,List devices, String start, String end) { List datas = new ArrayList<>(); + long l = System.currentTimeMillis(); // 设备采集发电量 if(CollectionUtil.isNotEmpty(devices)){ devices.forEach(device->{ @@ -1342,11 +1359,17 @@ public class RealTargetServiceImpl implements RealTargetService { }).collect(Collectors.toList())); }); } + long l2 = System.currentTimeMillis(); + log.info("getGenerateYear接口,"+station.getName()+"-设备采集发电量数据耗时:"+(l2-l)); // 补充填报数据 datas.addAll(this.generateFill(station,start,end)); + long l3 = System.currentTimeMillis(); + log.info("getGenerateYear接口,"+station.getName()+":补充填报数据"+(l3-l2)); if(CollectionUtil.isEmpty(datas)){ return null; } + long l4 = System.currentTimeMillis(); + log.info("getGenerateYear接口,"+station.getName()+":接口总耗时"+(l4-l)); return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum)); } /** From 616221f9645ea81dac87e5b3a871e9c0ad09e837 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 18 Apr 2024 17:23:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?#=E5=BC=80=E5=81=9C=E6=9C=BA=E5=91=8A?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java index 0b67f4e..616374e 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java @@ -152,7 +152,7 @@ public class AlarmServiceImpl implements AlarmService { alarm.setIsShowAlert(1); alarm.setIsSmallBell(1); alarm.setIsMask(1); - alarm.setIsBroadcast(0); + alarm.setIsBroadcast(1); alarm.setIsPlatformMessage(1); alarm.setIsShortMessage(1); alarm.setIsWxMessage(1);