From a4597462d3116eda1f6b3a5435c607772ba7122f Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Thu, 10 Aug 2023 11:41:09 +0800 Subject: [PATCH 1/8] =?UTF-8?q?#=20=E7=AB=99=E7=82=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BDbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/station/service/impl/StationServiceImpl.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index e660d69..2f778c7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -153,10 +153,9 @@ public class StationServiceImpl extends BaseServiceImpl { + if(dataDelete.isSuccess()) { logger.error("hzims-operational:station:removeStation", stationEntity.getCode() + "删除失败,报错信息为:" + dataDelete.getMsg()); - throw new ServiceException("数据平台删除项目失败!"); - }); + } // 删除所属机构 R deptResult = sysClient.getDept(stationEntity.getRefDept()); if (deptResult.isSuccess() && ObjectUtil.isNotEmpty(deptResult.getData())) { @@ -165,8 +164,6 @@ public class StationServiceImpl extends BaseServiceImpl { // 删除站点下集中监控属性配置 From 10ebcb0c37349eb0e04e10a79a9bb99e1cc1814f Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Thu, 10 Aug 2023 16:48:36 +0800 Subject: [PATCH 2/8] =?UTF-8?q?#=20=E5=BE=AE=E4=BF=A1=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81service=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java index ddd2be3..337983d 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java @@ -42,7 +42,7 @@ import java.util.concurrent.atomic.AtomicReference; /** * @author hx */ -@Service("pushMessageService") +@Service("wxMessageService") @Slf4j @AllArgsConstructor public class WxMessageServiceImpl implements IMessageService { From 079cd1e50496f69668e42febfd1fd309385621a2 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 10 Aug 2023 17:03:11 +0800 Subject: [PATCH 3/8] =?UTF-8?q?#=E9=A3=8E=E7=94=B5=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=8F=91=E7=94=B5=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../access/feign/AccessTaskClientFallback.java | 1 - .../hzims/operational/fill/entity/WindEntity.java | 3 -- .../data/controller/HzimsDataController.java | 20 +++++++++-- .../fill/service/impl/WindServiceImpl.java | 12 +++++++ .../main/service/impl/HomeServiceImpl.java | 9 +++-- .../main/service/impl/WindHomeServiceImpl.java | 41 +++++++++++++++------- 6 files changed, 64 insertions(+), 22 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskClientFallback.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskClientFallback.java index 7b6a658..c404380 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskClientFallback.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskClientFallback.java @@ -2,7 +2,6 @@ package com.hnac.hzims.operational.access.feign; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; -import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; import org.springframework.stereotype.Component; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java index b7fb278..30ff5b8 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java @@ -29,9 +29,6 @@ public class WindEntity extends TenantEntity implements Serializable { @ApiModelProperty("填报日期") private String fillDate; - @ApiModelProperty("计划发电量") - private Double plan; - @ApiModelProperty("发电量") private Double power; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java index 011256e..25b89c9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java @@ -5,11 +5,12 @@ import com.hnac.hzims.operational.data.service.HzimsDataService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; /** @@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; @AllArgsConstructor @RequestMapping("/hzims_data") @Api(value = "hzims_data", tags = "hzims数据获取") +@Slf4j public class HzimsDataController { private final HzimsDataService service; @@ -44,4 +46,16 @@ public class HzimsDataController { public R saveStation() { return R.data(service.saveStation()); } + + /** + * 测试动作模板回调接口 + */ + @ApiLog + @PostMapping("/test") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "测试动作模板回调接口", notes = "map接收参数") + public R test(@RequestBody Map params) { + log.error("动作模板回调接口参数: {}",params.toString()); + return R.data(params); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java index 88847d9..5dc4cb9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java @@ -17,6 +17,8 @@ import com.hnac.hzims.operational.fill.wrapper.GenerateWrapper; import com.hnac.hzims.operational.fill.wrapper.WindWrapper; import com.hnac.hzims.operational.main.vo.GenerationPowerVo; import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.service.IStationService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; @@ -45,6 +47,8 @@ import java.util.stream.Collectors; @AllArgsConstructor public class WindServiceImpl extends BaseServiceImpl implements WindService { + private final IStationService stationService; + /** * 分页查询风电填报数据 * @param filter @@ -77,6 +81,14 @@ public class WindServiceImpl extends BaseServiceImpl imp */ @Override public boolean saveUpdate(WindEntity entity) { + // 查询站点所属机构 + StationEntity station = stationService.getOne(new LambdaQueryWrapper(){{ + eq(StationEntity::getCode, entity.getStationCode()); + }}); + if(ObjectUtil.isEmpty(station)){ + throw new ServiceException("风电站点不存在!"); + } + entity.setCreateDept(station.getRefDept()); // 查询是否存在历史记录 WindEntity query = this.getOne(new LambdaQueryWrapper(){{ eq(WindEntity::getStationCode, entity.getStationCode()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java index 800a021..717f72e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java @@ -79,6 +79,8 @@ public class HomeServiceImpl implements HomeService { private final ITicketInfoAllClient ticketClient; + private final IPlanGenertionClient planClient; + private final RedisTemplate redisTemplate; private final static String charge = "hzims:operation:key:charge"; @@ -139,7 +141,7 @@ public class HomeServiceImpl implements HomeService { @Override public List count(boolean make) { // 查询全部站点 - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); if(make){ wrapper.ne(StationEntity::getStatus,2); } @@ -244,13 +246,16 @@ public class HomeServiceImpl implements HomeService { if(CollectionUtil.isEmpty(stations)){ return target; } + // 计划发电量 + List plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null, DateUtil.format(new Date(),"yyyy")); + // 填报信息 List winds = windService.list(Wrappers.lambdaQuery() .in(WindEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) .likeRight(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy"))); if(CollectionUtil.isEmpty(winds)){ return target; } - double plan = winds.stream().mapToDouble(WindEntity::getPlan).sum(); + double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); double power = winds.stream().mapToDouble(WindEntity::getPower).sum(); List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference>() {}); // 装机容量 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java index 00f2f62..63ecf54 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java @@ -5,6 +5,8 @@ import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.hnac.hzims.equipment.entity.PlanGenerationEntity; +import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; @@ -92,6 +94,7 @@ public class WindHomeServiceImpl implements WindHomeService { private final ITicketInfoClient ticketInfoClient; + private final IPlanGenertionClient planClient; private final IInspectTaskReportClient inspectTaskReportClient; @@ -130,7 +133,8 @@ public class WindHomeServiceImpl implements WindHomeService { // 年发电量 score.setGenerateYear(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(WindEntity::getPower).sum()); // 年计划发电量 - score.setPlanYear(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(WindEntity::getPlan).sum()); + List yearPlans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,DateUtil.format(new Date(),"yyyy")); + score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); // 年发电完成率 if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){ score.setCompleteRate(BigDecimal.valueOf(score.getGenerateYear() / score.getPlanYear() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); @@ -138,7 +142,7 @@ public class WindHomeServiceImpl implements WindHomeService { // 月发电量 score.setGenerateMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getPower).sum()); // 月计划发电量 - score.setPlanMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getPlan).sum()); + score.setPlanMon(yearPlans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); // 月发电量完成率 if(Math.abs(score.getGenerateMon()) > 0 && Math.abs(score.getPlanMon()) > 0){ score.setCompleteMonRate(BigDecimal.valueOf(score.getGenerateMon() / score.getPlanMon() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); @@ -191,12 +195,13 @@ public class WindHomeServiceImpl implements WindHomeService { */ private List currentGenerateCurve(List winds) { List mons = this.mons(0,12,false); + List plans = planClient.getPlanGenerationByParam(winds.stream().map(WindEntity::getStationCode).distinct().collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); return mons.stream().map(mon->{ PowerMonthVo power = new PowerMonthVo(); LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); power.setYear(localDate.getYear()); power.setStrMonth(localDate.getMonthValue() > 9 ? String.valueOf(localDate.getMonthValue()) : "0" + localDate.getMonthValue()); - power.setPlanPower((float) winds.stream().filter(o->o.getFillDate().contains(localDate.getYear() + "-" + power.getStrMonth())).mapToDouble(WindEntity::getPlan).sum()); + power.setPlanPower((float) plans.stream().filter(o->o.getDateTime().contains(power.getYear() + power.getStrMonth())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); power.setPower((float) winds.stream().filter(o->o.getFillDate().contains(localDate.getYear() + "-" + power.getStrMonth())).mapToDouble(WindEntity::getPower).sum()); return power; }).collect(Collectors.toList()); @@ -257,8 +262,10 @@ public class WindHomeServiceImpl implements WindHomeService { if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(winds.stream().mapToDouble(WindEntity::getPower).sum()) > 0){ subordinate.setGenerationRate(BigDecimal.valueOf(subordinate.getGeneration() / winds.stream().mapToDouble(WindEntity::getPower).sum() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); } + // 计划发电量查询 + List plans = planClient.getPlanGenerationByParam(entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); + double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); // 发电完成率 - double plan = piece.stream().mapToDouble(WindEntity::getPlan).sum(); if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(plan) > 0){ subordinate.setGenerationComplete(BigDecimal.valueOf(subordinate.getGeneration() / plan * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); } @@ -311,9 +318,9 @@ public class WindHomeServiceImpl implements WindHomeService { } // 装机容量 kpi.setCapacity(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum()); - // 计划发电量 - kpi.setPlan(winds.stream().mapToDouble(WindEntity::getPlan).sum()); + List plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); + kpi.setPlan(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); // 实际发电量 kpi.setGenerate(winds.stream().mapToDouble(WindEntity::getPower).sum()); // 发电量完成率 @@ -366,12 +373,14 @@ public class WindHomeServiceImpl implements WindHomeService { in(WindEntity::getStationCode,codes) .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy")); }}); + // 计划发电量 + List plans = planClient.getPlanGenerationByParam(codes, null,DateUtil.format(new Date(),"yyyy")); return areas.entrySet().stream().map(entry -> { WindAreaVo area = new WindAreaVo(); area.setDeptId(entry.getKey().getId()); area.setDeptName(entry.getKey().getDeptName()); List stationCodes = entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()); - area.setPlan(winds.stream().filter(o-> stationCodes.contains(o.getStationCode())).mapToDouble(WindEntity::getPlan).sum()); + area.setPlan(plans.stream().filter(o-> stationCodes.contains(o.getStationId())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); area.setGenerate(winds.stream().filter(o-> stationCodes.contains(o.getStationCode())).mapToDouble(WindEntity::getPower).sum()); if(Math.abs(area.getPlan()) > 0 && Math.abs(area.getGenerate()) > 0){ area.setGenerateComplete(BigDecimal.valueOf(area.getGenerate() / area.getPlan() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); @@ -500,14 +509,17 @@ public class WindHomeServiceImpl implements WindHomeService { areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getFaultHours).average().orElse(0.0)); } + // 填报发电量 List windMons = windService.list(new LambdaQueryWrapper() {{ in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy-MM")); }}); + // 计划发电量 + List plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy-MM")); if(CollectionUtil.isNotEmpty(windMons)){ areaDuty.setGenerateMon(windMons.stream().mapToDouble(WindEntity::getPower).sum()); // 月计划发电量 - areaDuty.setPlanMon(windMons.stream().mapToDouble(WindEntity::getPlan).sum()); + areaDuty.setPlanMon(plans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); // 月发电量完成率 if(Math.abs(areaDuty.getGenerateMon()) > 0 && Math.abs(areaDuty.getPlanMon()) > 0){ areaDuty.setCompleteMonRate(BigDecimal.valueOf(areaDuty.getGenerateMon() / areaDuty.getPlanMon() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); @@ -521,7 +533,7 @@ public class WindHomeServiceImpl implements WindHomeService { if(CollectionUtil.isEmpty(windYears)){ return; } - areaDuty.setPlan(windYears.stream().mapToDouble(WindEntity::getPlan).sum()); + areaDuty.setPlan(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); areaDuty.setGenerate(windYears.stream().mapToDouble(WindEntity::getPower).sum()); // 发电量完成率 if(Math.abs(areaDuty.getPlan()) > 0 && Math.abs(areaDuty.getGenerate()) > 0){ @@ -806,13 +818,15 @@ public class WindHomeServiceImpl implements WindHomeService { in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy")); }}); + // 计划发电量 + List plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); // 设备 List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference>() {}); subordinate.setStations(stations.stream().map(station -> { WindStationGenerateVo generate = new WindStationGenerateVo(); generate.setDeptId(station.getRefDept()); generate.setDeptName(station.getName()); - generate.setPlan(winds.stream().filter(o-> o.getStationCode().equals(station.getCode())).mapToDouble(WindEntity::getPlan).sum()); + generate.setPlan(plans.stream().filter(o-> o.getStationId().equals(station.getCode())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); generate.setGenerate(winds.stream().filter(o-> o.getStationCode().equals(station.getCode())).mapToDouble(WindEntity::getPower).sum()); // 发电量完成率 if(Math.abs(generate.getPlan()) > 0 && Math.abs(generate.getGenerate()) > 0){ @@ -918,11 +932,13 @@ public class WindHomeServiceImpl implements WindHomeService { List all = windService.list(Wrappers.lambdaQuery() .eq(WindEntity::getStationCode,station.getCode()) ); + // 计划发电量 + List plans = planClient.getPlanGenerationByParam(Collections.singletonList(station.getCode()), null,DateUtil.format(new Date(),"yyyy")); if(CollectionUtil.isNotEmpty(all)){ // 年计划发电量 - wind.setPlanYear(all.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(WindEntity::getPlan).sum()); + wind.setPlanYear(plans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); // 月计划发电量 - wind.setPlanMon(all.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getPlan).sum()); + wind.setPlanMon(plans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); // 总发电量 wind.setGeneration(all.stream().mapToDouble(WindEntity::getPower).sum()); // 日上网电量 @@ -965,7 +981,6 @@ public class WindHomeServiceImpl implements WindHomeService { WindGenerationVo generation = new WindGenerationVo(); generation.setYear(localDate.getYear()); generation.setMon(localDate.getMonthValue() > 9 ? String.valueOf(localDate.getMonthValue()) : "0" + localDate.getMonthValue()); - generation.setPlan(winds.stream().filter(o->o.getFillDate().contains(generation.getYear() + "-" + generation.getMon())).mapToDouble(WindEntity::getPlan).sum()); generation.setGeneration(winds.stream().filter(o->o.getFillDate().contains(generation.getYear() + "-" + generation.getMon())).mapToDouble(WindEntity::getPower).sum()); return generation; }).collect(Collectors.toList()); From 8055c39fdbc304d1bb2fcf3aaec999d4e2ae05a4 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Fri, 11 Aug 2023 16:36:00 +0800 Subject: [PATCH 4/8] =?UTF-8?q?#=20=E5=B7=A1=E6=A3=80=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=86=85=E5=AE=B9=E4=BF=AE=E6=94=B9=20#=20AP?= =?UTF-8?q?P=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81=E8=A7=84=E5=88=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20#=20=E5=B7=A1=E6=A3=80=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=90=8D=E7=A7=B0=E6=90=9C=E7=B4=A2=E6=A8=A1?= =?UTF-8?q?=E7=B3=8A=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/message/dto/PlanMsgRecordDto.java | 6 +- .../hzims/message/dto/SmsImmediatelyPushDTO.java | 2 + .../equipment/controller/EmInfoController.java | 1 + .../equipment/src/main/resources/db/1.0.1.sql | 1 + hzims-service/inspect/pom.xml | 7 +- .../hnac/hzinfo/inspect/config/RedisKeyConfig.java | 22 ++++ .../hzinfo/inspect/config/ThreadPoolConfig.java | 30 +++++ .../obj/services/IContentDefinitionService.java | 11 +- .../obj/web/ContentDefinitionController.java | 15 ++- .../inspect/task/aspect/TaskGenerateAspect.java | 45 ++++---- .../hzinfo/inspect/task/schedule/TaskSchedule.java | 123 +++++++++++++++++++++ .../inspect/task/schedule/XxlJobConstants.java | 11 ++ .../impl/TaskObjectProjectContentServiceImpl.java | 60 +++++++--- .../task/service/impl/TaskObjectServiceImpl.java | 14 ++- .../inspect/task/service/impl/TaskServiceImpl.java | 2 +- .../task/vo/TaskObjectProjectContentVO.java | 10 +- .../inspect/src/main/resources/application-dev.yml | 3 + .../src/main/resources/application-prod.yml | 3 + .../hnac/hzims/message/fegin/MessageClient.java | 17 +++ .../message/schedule/MessagePushSchedule.java | 2 +- .../message/service/IMessagePushRecordService.java | 5 + .../service/impl/MessagePushRecordServiceImpl.java | 4 +- 22 files changed, 327 insertions(+), 67 deletions(-) create mode 100644 hzims-service/equipment/src/main/resources/db/1.0.1.sql create mode 100644 hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/RedisKeyConfig.java create mode 100644 hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/ThreadPoolConfig.java create mode 100644 hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java create mode 100644 hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/XxlJobConstants.java diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java index d2e233d..43ff3af 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java @@ -5,8 +5,8 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import lombok.*; +import lombok.experimental.Accessors; import org.springblade.core.tool.utils.DateUtil; import org.springframework.format.annotation.DateTimeFormat; @@ -24,6 +24,7 @@ import java.time.LocalDateTime; @Data @ApiModel("计划推送消息请求对象") @EqualsAndHashCode +@Accessors(chain = true) public class PlanMsgRecordDto implements Serializable { @ApiModelProperty("机构ID") @@ -33,7 +34,6 @@ public class PlanMsgRecordDto implements Serializable { @ApiModelProperty("消息模板Id") @JsonSerialize(nullsUsing = NullSerializer.class) - @NotNull private Long templateId; @ApiModelProperty("业务任务Id") diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsImmediatelyPushDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsImmediatelyPushDTO.java index 49e9c6d..d37aad0 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsImmediatelyPushDTO.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsImmediatelyPushDTO.java @@ -2,6 +2,7 @@ package com.hnac.hzims.message.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.support.QueryField; @@ -21,6 +22,7 @@ import java.util.Map; @Data @EqualsAndHashCode @ApiModel("短信即时推送请求内容") +@Builder public class SmsImmediatelyPushDTO implements Serializable { @ApiModelProperty(value = "机构ID",required = true) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java index 082039e..f0c1a71 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java @@ -93,6 +93,7 @@ public class EmInfoController extends BladeController { public R> list(@ApiIgnore @RequestParam Map em_info, Query query) { QueryWrapper queryWrapper = Condition.getQueryWrapper(em_info, EmInfoEntity.class); queryWrapper.lambda().eq(EmInfoEntity::getGpid, 0); + queryWrapper.orderByDesc("create_time"); IPage pages = em_infoService.page(Condition.getPage(query), queryWrapper); // 获取站点列表 - 填充站点编码、站点类型、站点名称 R> stationListR = stationClient.list(new StationEntity()); diff --git a/hzims-service/equipment/src/main/resources/db/1.0.1.sql b/hzims-service/equipment/src/main/resources/db/1.0.1.sql new file mode 100644 index 0000000..5c7b661 --- /dev/null +++ b/hzims-service/equipment/src/main/resources/db/1.0.1.sql @@ -0,0 +1 @@ +alter table hzims_em_param add COLUMN NAME VARCHAR(100) comment '参数名称'; \ No newline at end of file diff --git a/hzims-service/inspect/pom.xml b/hzims-service/inspect/pom.xml index f3610b8..d3f2e45 100644 --- a/hzims-service/inspect/pom.xml +++ b/hzims-service/inspect/pom.xml @@ -70,7 +70,7 @@ org.springblade blade-user-api - ${bladex.project.version} + 5.0.1.RELEASE org.springblade @@ -235,10 +235,7 @@ ${docker.username} ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.build.finalName} - ${project.version} - true - +dd target/${project.build.finalName}.jar false diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/RedisKeyConfig.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/RedisKeyConfig.java new file mode 100644 index 0000000..a6f0a4d --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/RedisKeyConfig.java @@ -0,0 +1,22 @@ +package com.hnac.hzinfo.inspect.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @ClassName RedisKeyConfig + * @description: 巡检模块redis-key配置 + * @author: hx + * @create: 2023-08-02 09:23 + * @Version 4.0 + **/ +@Component +@ConfigurationProperties("hzims.redis.key") +@Data +public class RedisKeyConfig { + + /**巡检任务结束提醒**/ + private String taskEndRemind; + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/ThreadPoolConfig.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/ThreadPoolConfig.java new file mode 100644 index 0000000..690775d --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/ThreadPoolConfig.java @@ -0,0 +1,30 @@ +package com.hnac.hzinfo.inspect.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * @ClassName ThreadPoolConfig + * @description: + * @author: hx + * @create: 2023-08-02 09:42 + * @Version 4.0 + **/ +@Configuration +public class ThreadPoolConfig { + + /** + * 巡检任务推送消息管理线程池 + * @return + */ + @Bean + public ExecutorService taskPushMsgExecutor() { + return new ThreadPoolExecutor(1, 6, 5L, TimeUnit.SECONDS,new LinkedBlockingQueue()); + } + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java index 5d6a014..0d6eaf0 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java @@ -2,11 +2,11 @@ package com.hnac.hzinfo.inspect.obj.services; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.hzims.common.utils.Condition; import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; import org.springblade.core.mp.base.BaseService; -import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; @@ -22,12 +22,11 @@ public interface IContentDefinitionService extends BaseService list(ContentDefinitionDTO request); default LambdaQueryWrapper getQueryWrapper(ContentDefinitionEntity entity) { - QueryWrapper queryWrapper = Condition.getQueryWrapper(entity); - LambdaQueryWrapper lambda = queryWrapper.lambda() - .eq(Func.isNotEmpty(entity.getCreateDept()), ContentDefinitionEntity::getCreateDept, entity.getCreateDept()) + LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(entity,ContentDefinitionEntity.class); + queryWrapper.eq(Func.isNotEmpty(entity.getCreateDept()), ContentDefinitionEntity::getCreateDept, entity.getCreateDept()) .eq(Func.isNotEmpty(entity.getCreateUser()), ContentDefinitionEntity::getCreateUser, entity.getCreateUser()) - .eq(Func.isNotEmpty(entity.getStatus()), ContentDefinitionEntity::getStatus, entity.getStatus()); - return lambda; + .eq(Func.isNotEmpty(entity.getStatus()), ContentDefinitionEntity::getStatus, entity.getStatus()).orderByDesc(ContentDefinitionEntity::getCreateTime); + return queryWrapper; } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java index 0aa954b..589ddc0 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java @@ -7,6 +7,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService; +import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper; import io.swagger.annotations.Api; @@ -56,10 +57,13 @@ public class ContentDefinitionController extends BladeController { return R.data(ContentDefinitionWrapper.build().listVO(contentDefinitionService.list(lambda))); } - @GetMapping("/save") + @PostMapping("/save") @ApiOperation("保存巡检内容定义") @ApiOperationSupport(order = 3) public R save(@RequestBody @Valid ContentDefinitionDTO content) { + if(content.getId()==null && Func.isBlank(content.getCode())){ + content.setCode(CodeUtils.randomCode()); + } return R.status(contentDefinitionService.save(BeanUtil.copy(content,ContentDefinitionEntity.class))); } @@ -76,4 +80,13 @@ public class ContentDefinitionController extends BladeController { public R removeByIds(@RequestParam String ids) { return R.status(contentDefinitionService.removeByIds(Func.toLongList(",",ids))); } + + @GetMapping("/detail") + @ApiOperation("查看详情") + @ApiOperationSupport(order = 6) + public R detail(@RequestParam Long id) { + ContentDefinitionEntity definition = contentDefinitionService.getById(id); + return R.data(ContentDefinitionWrapper.build().entityVO(definition)); + } + } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java index 82685fd..29e00ea 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.message.dto.PlanMsgRecordDto; import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzinfo.inspect.config.RedisKeyConfig; import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; @@ -19,15 +20,20 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; +import java.time.LocalDateTime; +import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; /** * @ClassName TaskGenerateAspect @@ -45,6 +51,8 @@ public class TaskGenerateAspect { private final IMessageClient messageClient; private final ITaskService taskService; private final ITaskUserService taskUserService; + private final RedisTemplate redisTemplate; + private final RedisKeyConfig redisKeyConfig; /** * 巡检任务开始前发送短信信息阿里云模板 @@ -95,36 +103,25 @@ public class TaskGenerateAspect { */ private void pushMessageByTask(TaskEntity taskEntity) { log.info("======================进入消息推送======================"); - PlanMsgRecordDto recordDto = new PlanMsgRecordDto(); - recordDto.setDeptId(taskEntity.getCreateDept()); - recordDto.setTemplateId(taskEntity.getMessageTemplateId()); - recordDto.setTaskId(taskEntity.getId()); - if(Func.isEmpty(AuthUtil.getUserId())) { - recordDto.setTenantId(taskEntity.getTenantId()); - } // 获取巡检任务的消息推送人 LambdaQueryWrapper eq = Wrappers.lambdaQuery().eq(TaskUserEntity::getTaskId, taskEntity.getId()); List taskUserList = taskUserService.list(eq); if(CollectionUtil.isNotEmpty(taskUserList)) { - DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); taskUserList.stream().map(TaskUserEntity::getUserId).filter(Func::isNotEmpty).forEach(userId -> { - recordDto.setReceiver(userId); - recordDto.setCreateUser(userId); - Map smsMap = new HashMap<>(2); - // 消息开始前提醒 - recordDto.setResourceCode(taskBeginTemplateCodeV2); - smsMap.put("one",taskEntity.getPlanName()); - smsMap.put("two",df.format(taskEntity.getPlanStartTime())); - recordDto.setPlanTime(taskEntity.getPlanStartTime()); - recordDto.setSmsParam(JSON.toJSONString(smsMap)); - recordDto.setContent("任务“"+ taskEntity.getPlanName() + "”的计划执行时间是:" + df.format(taskEntity.getPlanStartTime())+ " —— " + df.format(taskEntity.getPlanEndTime())); - log.info("巡检任务开始,推送对象:{}",JSON.toJSONString(recordDto)); - messageClient.planSendMessage(recordDto); - // 消息结束前提醒 - smsMap.put("two",df.format(taskEntity.getPlanEndTime())); - recordDto.setPlanTime(taskEntity.getPlanEndTime()); - recordDto.setSmsParam(JSON.toJSONString(smsMap)); + PlanMsgRecordDto recordDto = new PlanMsgRecordDto() + .setDeptId(taskEntity.getCreateDept()) + .setTemplateId(taskEntity.getMessageTemplateId()) + .setTaskId(taskEntity.getId()) + .setTenantId(Optional.ofNullable(AuthUtil.getTenantId()).orElse(taskEntity.getTenantId())) + .setReceiver(userId) + .setCreateUser(userId) + .setResourceCode(taskBeginTemplateCodeV2) + .setPlanTime(taskEntity.getPlanStartTime()) + .setContent("您在"+ DateUtil.format(taskEntity.getPlanStartTime(),DateUtil.PATTERN_DATETIME) +"时间有一条巡检任务——【"+taskEntity.getPlanName()+"】待执行,请及时处理!"); + // 任务开始提醒 - 集中提送 messageClient.planSendMessage(recordDto); + // 任务结束提醒 - 提醒存入redis 定时任务调用即时推送完成消息推送 + redisTemplate.opsForZSet().add(redisKeyConfig.getTaskEndRemind(),taskEntity,taskEntity.getEndRemindTime().toEpochSecond(ZoneOffset.of("+8"))); }); } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java new file mode 100644 index 0000000..f9dcd76 --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java @@ -0,0 +1,123 @@ +package com.hnac.hzinfo.inspect.task.schedule; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hnac.hzims.message.MessageConstants; +import com.hnac.hzims.message.dto.BusinessMessageDTO; +import com.hnac.hzims.message.dto.SmsImmediatelyPushDTO; +import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzinfo.inspect.config.RedisKeyConfig; +import com.hnac.hzinfo.inspect.task.TaskContants; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; +import com.hnac.hzinfo.inspect.task.service.ITaskService; +import com.hnac.hzinfo.inspect.task.service.ITaskUserService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cglib.core.Local; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneOffset; +import java.util.*; +import java.util.stream.Collectors; + +import static com.hnac.hzinfo.inspect.task.schedule.XxlJobConstants.*; + +/** + * @ClassName TaskSchedule + * @description: 巡检任务定时任务 + * @author: hx + * @create: 2023-08-10 14:21 + * @Version 4.0 + **/ +@Component +@RequiredArgsConstructor +@Slf4j +public class TaskSchedule { + + private final RedisTemplate redisTemplate; + private final ITaskService taskService; + private final ITaskUserService taskUserService; + private final RedisKeyConfig redisKeyConfig; + private final IMessageClient messageClient; + + @Value("${hzims.inspect.task.templateCode.taskEnd}") + private String taskEndTemplateCode; + + @XxlJob(TASK_END_REMIND) + public ReturnT sendTaskEndMessage(String params) { + Set remindTasks = redisTemplate.opsForZSet().rangeByScore(redisKeyConfig.getTaskEndRemind(), + LocalDateTime.of(LocalDate.now(), LocalTime.MIN).toEpochSecond(ZoneOffset.of("+8")), + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); + if(CollectionUtil.isEmpty(remindTasks)) { + return new ReturnT(ReturnT.SUCCESS_CODE,"当前无待发送消息的任务"); + } + // 获取redis待推送巡检任务中状态为进行中的任务 + List idList = remindTasks.stream().map(TaskEntity::getId).collect(Collectors.toList()); + List taskList = taskService.list( + Wrappers.lambdaQuery() + .in(TaskEntity::getId, idList) + .in(TaskEntity::getStatus, Lists.newArrayList(TaskContants.TaskStatusEnum.UNDERWAY_STATUS.getStatus(),TaskContants.TaskStatusEnum.INIT_STATUS.getStatus())) + ); + Map> taskUserMap = taskUserService.list(Wrappers.lambdaQuery().in(TaskUserEntity::getTaskId,idList)).stream().collect(Collectors.groupingBy(TaskUserEntity::getTaskId)); + taskList.stream().filter(task -> taskUserMap.containsKey(task.getId())).flatMap(task -> + taskUserMap.get(task.getId()).stream().filter(taskUser -> Func.isNotEmpty(taskUser.getUserId())).map(taskUser -> { + task.setUserId(taskUser.getUserId()); + return task; + }) + ).forEach(this::sendTaskEndMessage); + + redisTemplate.opsForZSet().remove(redisKeyConfig.getTaskEndRemind(),remindTasks.toArray(new TaskEntity[remindTasks.size()])); + return ReturnT.SUCCESS; + } + + /** + * 推送消息 + * @param taskEntity 巡检任务 + */ + private void sendTaskEndMessage(TaskEntity taskEntity) { + // 短信推送 + SmsImmediatelyPushDTO smsPush = SmsImmediatelyPushDTO.builder() + .deptId(taskEntity.getCreateDept()) + .taskId(taskEntity.getId()) + .businessKey("巡检任务结束提醒") + .businessClassify(MessageConstants.BusinessClassifyEnum.INSPECT.getKey()) + .content("您有一条未执行的任务【"+taskEntity.getPlanName()+"】将于"+ DateUtil.format(taskEntity.getPlanEndTime(),DateUtil.PATTERN_DATETIME)+"截止,请及时处理!") + .subject("巡检任务结束提醒") + .pusher(taskEntity.getUserId().toString()) + .createUser(taskEntity.getCreateUser()) + .tenantId(taskEntity.getTenantId()) + .resourceCode(taskEndTemplateCode) + .params(new HashMap(){{ + put("one",taskEntity.getPlanName()); + put("two",DateUtil.format(taskEntity.getPlanEndTime(),DateUtil.PATTERN_DATETIME)); + }}) + .build(); + messageClient.sendSmsImmediatelyMsg(smsPush); + // app推送 + BusinessMessageDTO appMessage = new BusinessMessageDTO(); + appMessage.setDeptId(taskEntity.getCreateDept()); + appMessage.setBusinessKey("巡检任务结束提醒"); + appMessage.setBusinessClassify(MessageConstants.BusinessClassifyEnum.INSPECT.getKey()); + appMessage.setContent("您有一条未执行的任务【"+taskEntity.getPlanName()+"】将于"+ DateUtil.format(taskEntity.getPlanEndTime(),DateUtil.PATTERN_DATETIME)+"截止,请及时处理!"); + appMessage.setTaskId(taskEntity.getId()); + appMessage.setSubject("巡检任务结束提醒"); + appMessage.setUserIds(taskEntity.getUserId().toString()); + appMessage.setCreateUser(taskEntity.getCreateUser()); + appMessage.setTenantId(taskEntity.getTenantId()); + messageClient.sendAppAndWsMsgByUsers(appMessage); + taskService.update(Wrappers.lambdaUpdate().set(TaskEntity::getEndRemindFlag,true).eq(TaskEntity::getId,taskEntity.getId())); + } +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/XxlJobConstants.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/XxlJobConstants.java new file mode 100644 index 0000000..1a2d194 --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/XxlJobConstants.java @@ -0,0 +1,11 @@ +package com.hnac.hzinfo.inspect.task.schedule; + +/** + * XxlJob常量池 + */ +public interface XxlJobConstants { + + /**巡检任务结束提醒**/ + String TASK_END_REMIND = "taskEndRemind"; + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectProjectContentServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectProjectContentServiceImpl.java index 3588451..0beb398 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectProjectContentServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectProjectContentServiceImpl.java @@ -5,6 +5,9 @@ import com.alibaba.fastjson.JSONObject; import com.google.common.collect.Lists; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; +import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; +import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; import com.hnac.hzinfo.inspect.obj.services.ContentService; import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectContentVO; @@ -16,6 +19,7 @@ import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; import com.hnac.hzinfo.inspect.task.mapper.TaskObjectProjectContentMapper; import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectContentService; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; @@ -38,6 +42,7 @@ import java.util.Optional; public class TaskObjectProjectContentServiceImpl extends BaseServiceImpl implements ITaskObjectProjectContentService { private final ContentService contentService; + private final IAnalyseDataSearchClient analyseDataSearchClient; private final IStationClient stationClient; private final RedisClient redisClient; @@ -50,25 +55,46 @@ public class TaskObjectProjectContentServiceImpl extends BaseServiceImpl stationR = stationClient.getOne(station); - if(stationR.isSuccess() && ObjectUtil.isNotEmpty(stationR.getData())) { - // 获取任务巡检内容实时数据 - List realDate = redisClient.getBatchRealDataByRealId(stationR.getData().getCode(), Lists.newArrayList(content.getFacDeviceId())); - log.info("station:{},facDeviceId:{},实时数据:{}",stationR.getData().getCode(),content.getFacDeviceId(), JSON.toJSONString(realDate)); - JSONObject realDataObject = Optional.ofNullable(realDate).map(list -> list.get(0)).filter(StringUtil::isNotBlank).map(JSONObject::parseObject).orElse(null); - // q值为0时为有效值 - if(ObjectUtil.isNotEmpty(realDataObject) && realDataObject.getIntValue("q") == 0) { - contentVO.setRealData(realDataObject.getDoubleValue("v")); - contentVO.setGatherTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(realDataObject.getLongValue("ts")), ZoneId.systemDefault())); - contentVO.setAttrSignage(content.getAttrSignage()); - contentVO.setAttrName(content.getAttrName()); - } + // 若内容中不存在模型的属性标识 则不获取实时数据 + if(Func.isNotEmpty(content.getAttrSignage()) && Func.isNotEmpty(contentVO.getEmCode())) { + RealDataSearchPO po = new RealDataSearchPO(); + po.setAnalyzeCode(contentVO.getEmCode()); + po.setSignages(Lists.newArrayList(content.getAttrSignage())); + R> realDataByAnalyzeCode = analyseDataSearchClient.getRealDataByAnalyzeCode(po); + if(realDataByAnalyzeCode.isSuccess() && CollectionUtil.isNotEmpty(realDataByAnalyzeCode.getData()) && realDataByAnalyzeCode.getData().get(0).getQ() == 0) { + FieldsData realData = realDataByAnalyzeCode.getData().get(0); + contentVO.setRealData(realData.getValue()); + contentVO.setAttrName(content.getAttrName()); + contentVO.setAttrSignage(content.getAttrSignage()); + contentVO.setGatherTime(realData.getTime()); } } } } + +// @Override +// public void fillRealData(TaskObjectProjectContentVO contentVO) { +// if(Func.isNotEmpty(contentVO.getContentId())) { +// ContentEntity content = contentService.getById(contentVO.getContentId()); +// if(ObjectUtil.isNotEmpty(content) && Func.isNotEmpty(content.getFacDeviceId())) { +// // 获取该项内容站点信息 +// StationEntity station = new StationEntity(); +// station.setRefDept(content.getCreateDept()); +// R stationR = stationClient.getOne(station); +// if(stationR.isSuccess() && ObjectUtil.isNotEmpty(stationR.getData())) { +// // 获取任务巡检内容实时数据 +// List realDate = redisClient.getBatchRealDataByRealId(stationR.getData().getCode(), Lists.newArrayList(content.getFacDeviceId())); +// log.info("station:{},facDeviceId:{},实时数据:{}",stationR.getData().getCode(),content.getFacDeviceId(), JSON.toJSONString(realDate)); +// JSONObject realDataObject = Optional.ofNullable(realDate).map(list -> list.get(0)).filter(StringUtil::isNotBlank).map(JSONObject::parseObject).orElse(null); +// // q值为0时为有效值 +// if(ObjectUtil.isNotEmpty(realDataObject) && realDataObject.getIntValue("q") == 0) { +// contentVO.setRealData(realDataObject.getDoubleValue("v")); +// contentVO.setGatherTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(realDataObject.getLongValue("ts")), ZoneId.systemDefault())); +// contentVO.setAttrSignage(content.getAttrSignage()); +// contentVO.setAttrName(content.getAttrName()); +// } +// } +// } +// } +// } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectServiceImpl.java index 4f988b5..d421097 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectServiceImpl.java @@ -1,5 +1,7 @@ package com.hnac.hzinfo.inspect.task.service.impl; +import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import com.hnac.hzinfo.inspect.obj.services.ProjectService; import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; import com.hnac.hzinfo.inspect.task.mapper.TaskObjectMapper; import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectContentService; @@ -25,6 +27,7 @@ import java.util.List; public class TaskObjectServiceImpl extends BaseServiceImpl implements ITaskObjectService { private final ITaskObjectProjectContentService taskContentService; + private final ProjectService projectService; @Override public List getTaskObjectList(TaskObjectEntity taskObjectEntity) { @@ -38,9 +41,14 @@ public class TaskObjectServiceImpl extends BaseServiceImpl CollectionUtil.isNotEmpty(taskObjectVO.getProjects())) .flatMap(taskObjectVO -> taskObjectVO.getProjects().stream()) - .filter(project -> CollectionUtil.isNotEmpty(project.getContents())) - .flatMap(project -> project.getContents().stream()) - .forEach(contentVO -> taskContentService.fillRealData(contentVO)); + .filter(taskObjectVO -> Func.isNotEmpty(taskObjectVO.getProjectId()) && CollectionUtil.isNotEmpty(taskObjectVO.getContents())) + .flatMap(project -> { + ProjectEntity projectEntity = projectService.getById(project.getProjectId()); + if(Func.isEmpty(projectEntity) && Func.isNotEmpty(projectEntity.getEmCode())) { + return null; + } + return project.getContents().stream().peek(contentVO -> contentVO.setEmCode(projectEntity.getEmCode())); + }).filter(Func::isNotEmpty).forEach(contentVO -> taskContentService.fillRealData(contentVO)); } return taskObjectVOList; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index 2171751..3f7e0df 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java @@ -571,7 +571,7 @@ public class TaskServiceImpl extends BaseServiceImpl imp @Override public List getListPageAuth(IPage page, TaskListQuery task) { List re = this.baseMapper.getListPageAuth(page, task); - setVoInfo(re); + setVoInfo(re); return re; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskObjectProjectContentVO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskObjectProjectContentVO.java index 76c4f40..3f129b5 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskObjectProjectContentVO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskObjectProjectContentVO.java @@ -121,16 +121,18 @@ public class TaskObjectProjectContentVO implements Serializable { private String dictType; @ApiModelProperty(value = "实时数据") - private Double realData; + private String realData; @ApiModelProperty(value = "实时数据采集时间") - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - private LocalDateTime gatherTime; + private String gatherTime; @ApiModelProperty(value = "绑定物模型属性标识") private String attrSignage; @ApiModelProperty(value = "绑定物模型属性名称") private String attrName; + + @ApiModelProperty(value = "设备编号") + private String emCode; + } diff --git a/hzims-service/inspect/src/main/resources/application-dev.yml b/hzims-service/inspect/src/main/resources/application-dev.yml index 5c286b2..80c761c 100644 --- a/hzims-service/inspect/src/main/resources/application-dev.yml +++ b/hzims-service/inspect/src/main/resources/application-dev.yml @@ -50,6 +50,9 @@ hzinfo: hzims: + redis: + key: + taskEndRemind: 200000:hzims:inspect:task:end:remind tasks: flag: 1 inspect: diff --git a/hzims-service/inspect/src/main/resources/application-prod.yml b/hzims-service/inspect/src/main/resources/application-prod.yml index 5fa2201..dc9c50c 100644 --- a/hzims-service/inspect/src/main/resources/application-prod.yml +++ b/hzims-service/inspect/src/main/resources/application-prod.yml @@ -25,6 +25,9 @@ oss: secret-key: fjcR2RoQxZ4eTmOaB54rkITZjn/YVJhJZlckHxy/ hzims: + redis: + key: + taskEndRemind: hzims:inspect:task:end:remind tasks: flag: 1 inspect: diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java index 45bd14b..cec9f41 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java @@ -22,6 +22,8 @@ import org.springblade.core.log.exception.ServiceException; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; +import org.springblade.system.entity.Dept; +import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springframework.util.Assert; @@ -46,6 +48,7 @@ public class MessageClient extends BladeController implements IMessageClient{ private final IMessagePushRecordService recordService; private final IMessageTemplateService messageTemplateService; + private final ISysClient sysClient; @Override @PostMapping(SEND_SMS_MESSAGE) @@ -61,6 +64,7 @@ public class MessageClient extends BladeController implements IMessageClient{ // 可能存在多种推送类型 request.getTypes().forEach(type -> { MessagePushRecordEntity entity = BeanUtil.copy(request,MessagePushRecordEntity.class); + entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); entity.setType(type); if(Func.isEmpty(AuthUtil.getUserId())) { entity.setCreateUser(request.getCreateUser()); @@ -83,6 +87,7 @@ public class MessageClient extends BladeController implements IMessageClient{ // 微信消息推送记录保存 List messages = Func.toLongList(request.getUserIds()).stream().map(userId -> { MessagePushRecordEntity entity = BeanUtil.copy(request, MessagePushRecordEntity.class); + entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); entity.setMessageId(IdWorker.getId()); entity.setPusher(userId.toString()); entity.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); @@ -111,6 +116,7 @@ public class MessageClient extends BladeController implements IMessageClient{ if(Func.isNotEmpty(template.getType())) { Func.toStrList(",",template.getType()).forEach(type -> { MessagePushRecordEntity entity = BeanUtil.copy(template,MessagePushRecordEntity.class); + entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); entity.setId(null); entity.setType(type); entity.setTaskId(request.getTaskId()); @@ -146,6 +152,7 @@ public class MessageClient extends BladeController implements IMessageClient{ long messageId = IdWorker.getId(); return Lists.newArrayList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH).stream().map(messageType -> { MessagePushRecordEntity record = BeanUtil.copy(request, MessagePushRecordEntity.class); + record.setDeptName(Func.isNotEmpty(record.getDeptName()) ? record.getDeptName() : this.getDeptNameById(record.getDeptId())); record.setMessageId(messageId); record.setPusher(userId.toString()); record.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); @@ -180,6 +187,7 @@ public class MessageClient extends BladeController implements IMessageClient{ String pusherName = Optional.ofNullable(smsImmediatelyPushDTO.getPusher()).map(Func::toLong).map(UserCache::getUser).map(User::getName).orElse(null); record.setPusherName(pusherName); record.setPushType(MessageConstants.IMMEDIATELY); + record.setDeptName(Func.isNotEmpty(record.getDeptName()) ? record.getDeptName() : this.getDeptNameById(record.getDeptId())); record.setPlanTime(LocalDateTime.now()); record.setType(MessageConstants.SMS_PUSH); record.setCreateDept(record.getDeptId()); @@ -189,4 +197,13 @@ public class MessageClient extends BladeController implements IMessageClient{ return R.data(recordService.sendSmsImmediatelyMsg(record)); } + /** + * 根据机构ID获取机构名称 + * @param deptId 机构ID + * @return 机构名称 + */ + private String getDeptNameById(Long deptId) { + return Optional.ofNullable(sysClient.getDeptName(deptId)).filter(r -> r.isSuccess()).map(R::getData).orElse(null); + } + } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java index a73c13b..f1024a3 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java @@ -111,7 +111,7 @@ public class MessagePushSchedule { } }); } - // redisTemplate.opsForList().remove(appPushKey,0,records); + records.forEach(record -> redisTemplate.opsForList().remove(appPushKey,0,record)); } }); return ReturnT.SUCCESS; diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java index 845a8fc..b6b82a3 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java @@ -128,5 +128,10 @@ public interface IMessagePushRecordService extends BaseService getPersonalUnreadMessage() { QueryWrapper query = Wrappers.query(); query.select("business_classify businessClassify,count(0) todoNum"); - query.eq("account", AuthUtil.getUserId()); + query.eq("pusher", AuthUtil.getUserId()); query.in("status", Lists.newArrayList(MessageConstants.PUSH_SUCCESS)); query.groupBy("business_classify"); List> list = noAurhScopeMapper.selectMaps(query); @@ -380,7 +380,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl getPersonalAppUnreadMessage() { QueryWrapper query = Wrappers.query(); query.select("business_classify businessClassify,count(0) todoNum"); - query.eq("account", AuthUtil.getUserId()); + query.eq("pusher", AuthUtil.getUserId()); query.eq("type", MessageConstants.APP_PUSH); query.in("status", Lists.newArrayList(MessageConstants.PUSH_SUCCESS)); query.groupBy("business_classify"); From af77249d0675d5d3614a77b5e07713a18f792aba Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Sat, 12 Aug 2023 11:47:01 +0800 Subject: [PATCH 5/8] =?UTF-8?q?#=E9=A3=8E=E7=94=B5=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=8F=91=E7=94=B5=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/vo/WindSubordinateVo.java | 6 ++++++ .../serviceimpl/MachineryTicketProcessServiceImpl.java | 2 +- .../main/service/impl/WindHomeServiceImpl.java | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java index 68de51f..8bc3ef8 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java @@ -27,6 +27,7 @@ public class WindSubordinateVo { @ApiModelProperty(value = "地市名称") private String areaName; + @ApiModelProperty(value = "经度(东经)") @JsonSerialize(nullsUsing = NullSerializer.class) @@ -43,17 +44,22 @@ public class WindSubordinateVo { private List weather; @ApiModelProperty(value = "发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generation; @ApiModelProperty(value = "集团/区域发电占比") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generationRate; @ApiModelProperty(value = "发电完成率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generationComplete; @ApiModelProperty(value = "风机利用率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double fanUse; @ApiModelProperty(value = "厂用电率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double factoryUse; } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java index 48d0154..7748d4f 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java @@ -45,7 +45,7 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService { @Override public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { log.info("是否执行水力机械工作票流程环节操作~~~~,流程ticket: {}", flowQueue); - String dictValue = processDictService.selectDictValueByKey(MACHINERY_TICKET_KEY); + String dictValue = processDictService.selectDictValueByKey(flowQueue.getProcessDefinitionKey()); if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { log.info("已执行水力机械工作票流程环节操作~~~~"); return true; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java index 63ecf54..260894d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java @@ -201,7 +201,7 @@ public class WindHomeServiceImpl implements WindHomeService { LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); power.setYear(localDate.getYear()); power.setStrMonth(localDate.getMonthValue() > 9 ? String.valueOf(localDate.getMonthValue()) : "0" + localDate.getMonthValue()); - power.setPlanPower((float) plans.stream().filter(o->o.getDateTime().contains(power.getYear() + power.getStrMonth())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); + power.setPlanPower((float) plans.stream().filter(o->o.getDateTime().contains(power.getYear() + "-" + power.getStrMonth())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); power.setPower((float) winds.stream().filter(o->o.getFillDate().contains(localDate.getYear() + "-" + power.getStrMonth())).mapToDouble(WindEntity::getPower).sum()); return power; }).collect(Collectors.toList()); @@ -261,6 +261,8 @@ public class WindHomeServiceImpl implements WindHomeService { // 集团发电占比 if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(winds.stream().mapToDouble(WindEntity::getPower).sum()) > 0){ subordinate.setGenerationRate(BigDecimal.valueOf(subordinate.getGeneration() / winds.stream().mapToDouble(WindEntity::getPower).sum() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setGenerationRate(0.0); } // 计划发电量查询 List plans = planClient.getPlanGenerationByParam(entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); @@ -268,18 +270,24 @@ public class WindHomeServiceImpl implements WindHomeService { // 发电完成率 if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(plan) > 0){ subordinate.setGenerationComplete(BigDecimal.valueOf(subordinate.getGeneration() / plan * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setGenerationComplete(0.0); } // 风机利用率 : (总时间 - 故障时间) / 总时间 double fault = piece.stream().mapToDouble(WindEntity::getFaultHours).sum(); double use = piece.stream().mapToDouble(WindEntity::getAvailable).sum(); if(Math.abs(fault) > 0 ){ subordinate.setFanUse(BigDecimal.valueOf(use / (use + fault) * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setFanUse(0.0); } // 厂用电率 : (发电量-上网电量+下网电量)/发电量 double surf = piece.stream().mapToDouble(WindEntity::getSurfPower).sum(); double below = piece.stream().mapToDouble(WindEntity::getBelowPower).sum(); if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(surf + below) > 0){ subordinate.setFactoryUse(BigDecimal.valueOf((subordinate.getGeneration() - surf + below) / subordinate.getGeneration() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setFactoryUse(0.0); } } return subordinate; @@ -504,7 +512,7 @@ public class WindHomeServiceImpl implements WindHomeService { areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getSpeed).average().orElse(0.0)); areaDuty.setSurfPower(winds.stream().mapToDouble(WindEntity::getSurfPower).sum()); areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum()); - areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0)); + areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).sum()); areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum()); areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getFaultHours).average().orElse(0.0)); @@ -524,7 +532,7 @@ public class WindHomeServiceImpl implements WindHomeService { if(Math.abs(areaDuty.getGenerateMon()) > 0 && Math.abs(areaDuty.getPlanMon()) > 0){ areaDuty.setCompleteMonRate(BigDecimal.valueOf(areaDuty.getGenerateMon() / areaDuty.getPlanMon() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); } - areaDuty.setAvailable(windMons.stream().mapToDouble(WindEntity::getAvailable).average().getAsDouble()); + areaDuty.setAvailableMon(windMons.stream().mapToDouble(WindEntity::getAvailable).sum()); } List windYears = windService.list(new LambdaQueryWrapper() {{ in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) @@ -976,11 +984,14 @@ public class WindHomeServiceImpl implements WindHomeService { return new ArrayList<>(); } List monList = this.mons(1,12,false); + // 计划发电量查询 + List plans = planClient.getPlanGenerationByParam(Collections.singletonList(station.getCode()), null,DateUtil.format(new Date(),"yyyy")); return monList.stream().map(mon->{ LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); WindGenerationVo generation = new WindGenerationVo(); generation.setYear(localDate.getYear()); generation.setMon(localDate.getMonthValue() > 9 ? String.valueOf(localDate.getMonthValue()) : "0" + localDate.getMonthValue()); + generation.setPlan(plans.stream().filter(o->o.getDateTime().contains(generation.getYear() + "-" + generation.getMon())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); generation.setGeneration(winds.stream().filter(o->o.getFillDate().contains(generation.getYear() + "-" + generation.getMon())).mapToDouble(WindEntity::getPower).sum()); return generation; }).collect(Collectors.toList()); From 2538c0df1586bf41a5d0b30abcf34629745f2b81 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Mon, 14 Aug 2023 14:29:18 +0800 Subject: [PATCH 6/8] =?UTF-8?q?#=20=E5=B7=A1=E6=A3=80=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=88=A0=E9=99=A4=E6=97=B6=E5=81=9A=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=AE=9A=E4=B9=89=E7=BB=91=E5=AE=9A=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=97=B6=E6=97=A0=E6=B3=95=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E9=99=90=E5=88=B6=20#=20=E8=AE=BE=E5=A4=87=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=88=97=E8=A1=A8bug=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/feign/IEmTreeInspectClient.java | 23 ++++++++++++++++ .../controller/EmDefinitionController.java | 4 +-- .../hzims/equipment/feign/EmTreeInspectClient.java | 31 ++++++++++++++++++++++ .../equipment/mapper/EmTreeInspectMapper.java | 6 +++++ .../hzims/equipment/mapper/EmTreeInspectMapper.xml | 12 ++++++++- .../equipment/service/IEmTreeInspectService.java | 9 +++++++ .../service/impl/EmTreeInspectServiceImpl.java | 8 ++++++ .../obj/services/IContentDefinitionService.java | 4 +++ .../impl/ContentDefinitionServiceImpl.java | 21 +++++++++++++++ .../obj/web/ContentDefinitionController.java | 2 +- 10 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmTreeInspectClient.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmTreeInspectClient.java diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmTreeInspectClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmTreeInspectClient.java new file mode 100644 index 0000000..ab3b3a5 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmTreeInspectClient.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.equipment.feign; + +import com.hnac.hzims.EquipmentConstants; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +import java.util.List; + +@FeignClient(value = EquipmentConstants.APP_NAME) +public interface IEmTreeInspectClient { + + String API_PREFIX = "/feign/em/tree/inspect"; + String GET_EM_TREE_CONTENT_ID = API_PREFIX + "/getEmTreeContentId"; + + /** + * 获取设备信息中已绑定的巡检内容定义ID + * @return 巡检内容定义ID + */ + @GetMapping(GET_EM_TREE_CONTENT_ID) + R> getEmTreeContentId(); + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java index 8f8c530..3b0cdc6 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java @@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; +import java.util.Optional; /** * 设备定义控制层 @@ -75,8 +76,7 @@ public class EmDefinitionController extends BladeController { wrapper.orderByDesc(EmDefinitionEntity::getCreateTime); IPage pages = emDefinitionService.page(Condition.getPage(query), wrapper); for (EmDefinitionEntity definition : pages.getRecords()) { - User createUser = UserCache.getUser(definition.getCreateUser()); - definition.setCreateUserName(createUser.getName()); + definition.setCreateUserName(Optional.ofNullable(UserCache.getUser(definition.getCreateUser())).map(User::getName).orElse(String.valueOf(definition.getCreateUser()))); } return R.data(pages); diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmTreeInspectClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmTreeInspectClient.java new file mode 100644 index 0000000..ced82d5 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmTreeInspectClient.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.equipment.feign; + +import com.hnac.hzims.equipment.service.IEmTreeInspectService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @ClassName EmTreeInspectClient + * @description: 设备树与巡检内容定义关联关系client + * @author: hx + * @create: 2023-08-11 17:31 + * @Version 4.0 + **/ +@RestController +@AllArgsConstructor +@Slf4j +public class EmTreeInspectClient implements IEmTreeInspectClient { + + private final IEmTreeInspectService emTreeInspectService; + + @Override + @GetMapping(GET_EM_TREE_CONTENT_ID) + public R> getEmTreeContentId() { + return R.data(emTreeInspectService.selectEmTreeContentId()); + } +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.java index 3e3b868..4f1e3b4 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.java @@ -4,5 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.equipment.entity.EmTreeInspectEntity; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; +import java.util.List; +import java.util.Map; + public interface EmTreeInspectMapper extends BaseMapper { + + List selectEmTreeContentId(); + } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.xml b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.xml index d1eab9f..73f1600 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.xml +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmTreeInspectMapper.xml @@ -1,5 +1,15 @@ - + \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeInspectService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeInspectService.java index 9b10228..a5c4975 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeInspectService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmTreeInspectService.java @@ -3,5 +3,14 @@ package com.hnac.hzims.equipment.service; import com.hnac.hzims.equipment.entity.EmTreeInspectEntity; import org.springblade.core.mp.base.BaseService; +import java.util.List; + public interface IEmTreeInspectService extends BaseService { + + /** + * 获取 + * @return 巡检内容定义ID列表 + */ + List selectEmTreeContentId(); + } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeInspectServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeInspectServiceImpl.java index 6ce7b74..ebcd9c3 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeInspectServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmTreeInspectServiceImpl.java @@ -7,6 +7,8 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.stereotype.Service; +import java.util.List; + /** * @author tanghaihao * @date 2023年06月15日 9:08 @@ -14,4 +16,10 @@ import org.springframework.stereotype.Service; @Service @Slf4j public class EmTreeInspectServiceImpl extends BaseServiceImpl implements IEmTreeInspectService { + + @Override + public List selectEmTreeContentId() { + return this.baseMapper.selectEmTreeContentId(); + } + } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java index 0d6eaf0..2393be5 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java @@ -6,14 +6,18 @@ import com.hnac.hzims.common.utils.Condition; import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; +import net.bytebuddy.matcher.BooleanMatcher; import org.springblade.core.mp.base.BaseService; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; public interface IContentDefinitionService extends BaseService { + Boolean removeByIds(String ids); + /** * 根据筛选条件获取列表 * @param request 筛选条件 diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java index 58bc5f4..2a66c37 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.hzims.equipment.feign.IEmTreeInspectClient; import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; import com.hnac.hzinfo.inspect.obj.mapper.ContentDefinitionMapper; @@ -12,16 +13,21 @@ import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Condition; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; +import org.springframework.util.Assert; +import java.util.Arrays; import java.util.List; +import java.util.Optional; /** * @ClassName ContentDefinitionServiceImpl @@ -37,6 +43,21 @@ import java.util.List; public class ContentDefinitionServiceImpl extends BaseServiceImpl implements IContentDefinitionService { + private final IEmTreeInspectClient emTreeInspectClient; + + @Override + public Boolean removeByIds(String ids) { + R> contentIdR = emTreeInspectClient.getEmTreeContentId(); + Assert.isTrue(contentIdR.isSuccess(),() -> { + throw new ServiceException("查询设备定义绑定内容失败"); + }); + Optional optional = Func.toLongList(",",ids).stream().filter(id -> contentIdR.getData().contains(id)).findFirst(); + if(optional.isPresent()) { + throw new ServiceException("删除失败,【"+this.getById(optional.get()).getName()+"】内容定义已与设备定义绑定"); + } + return this.removeByIds(Func.toLongList(",",ids)); + } + @Override public List list(ContentDefinitionDTO request) { QueryWrapper queryWrapper = Condition.getQueryWrapper(BeanUtil.copy(request, ContentDefinitionEntity.class)); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java index 589ddc0..a29e06c 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java @@ -78,7 +78,7 @@ public class ContentDefinitionController extends BladeController { @ApiOperation("根据ID删除") @ApiOperationSupport(order = 5) public R removeByIds(@RequestParam String ids) { - return R.status(contentDefinitionService.removeByIds(Func.toLongList(",",ids))); + return R.status(contentDefinitionService.removeByIds(ids)); } @GetMapping("/detail") From 61cbd2adcf24fcc1f593ab3443a29a712932d587 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 14 Aug 2023 14:38:54 +0800 Subject: [PATCH 7/8] =?UTF-8?q?#=E9=BB=94=E4=B8=9C=E5=8D=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/ecology/controller/EcologyController.java | 6 +++--- .../operational/ecology/service/EcologyFlowStationService.java | 2 +- .../ecology/service/impl/EcologyFlowStationServiceImpl.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java index 597e154..8fcf2aa 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java @@ -54,8 +54,8 @@ public class EcologyController extends BladeController { @PostMapping("/station_top") @ApiOperationSupport(order = 1) @ApiOperation(value = "站点数据及达标率排行", notes = "站点数据及达标率排行") - public R station_top(@RequestParam Long deptId) { - return R.data(stationService.station_top(deptId)); + public R station_top() { + return R.data(stationService.station_top()); } /** @@ -65,7 +65,7 @@ public class EcologyController extends BladeController { @PostMapping("/trend_chart") @ApiOperationSupport(order = 1) @ApiOperation(value = "指标趋势图", notes = "指标趋势图") - public R trend_chart(@RequestParam Long deptId,@RequestParam String type) { + public R trend_chart(@RequestParam String type) { return R.data(stationService.trend_chart(type)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java index 1d3d990..ba6ba2a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java @@ -14,7 +14,7 @@ import java.util.List; */ public interface EcologyFlowStationService extends BaseService { - EcologFlowStationVo station_top(Long deptId); + EcologFlowStationVo station_top(); Boolean generate(Long mon,String year); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java index d296266..30f9969 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java @@ -96,7 +96,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl stations = this.list(); if(CollectionUtil.isEmpty(stations)){ return new EcologFlowStationVo(); From fec50a92029593e89cea21e8b8edfd8d4f479c23 Mon Sep 17 00:00:00 2001 From: tanghaihao <850814414@qq.com> Date: Mon, 14 Aug 2023 15:25:59 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E6=97=B6=E5=80=99=E4=BB=8E=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E4=B8=AD=E8=8E=B7=E5=8F=96=E6=A8=A1=E5=9E=8B=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E5=A1=AB=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/equipment/service/impl/EmInfoServiceImpl.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java index 25cd987..c3ece74 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java @@ -91,6 +91,8 @@ public class EmInfoServiceImpl extends BaseServiceImpl treeIds) { + private void copyDeviceTree(StationEntity station, Long pid, Long definitionId, String modelSignage, List treeIds) { List projectDTOList = new ArrayList<>(); LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); wrapper.eq(EmTreeEntity::getDefinitionId, definitionId); @@ -814,6 +817,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl