From 07c8c742b7892d31370c2b606ee3ed0c4e9e5087 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 30 Apr 2024 15:56:25 +0800 Subject: [PATCH] =?UTF-8?q?#=E8=A7=86=E9=A2=91=E5=B9=B3=E5=8F=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/home/impl/RealTargetServiceImpl.java | 4 ---- .../census/service/impl/TargetServiceImpl.java | 21 +++++------------ .../fill/service/impl/GenerateServiceImpl.java | 2 +- .../controller/StationVideoTypeController.java | 26 ++++++++++++++++++++++ .../video/controller/VideoPlatformController.java | 22 ++++++++++-------- 5 files changed, 46 insertions(+), 29 deletions(-) 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 414198f..e0d8061 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 @@ -269,7 +269,6 @@ public class RealTargetServiceImpl implements RealTargetService { // 水电站站点 List stations = stationService.list(Wrappers.lambdaQuery() .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) - .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) ); if(CollectionUtil.isEmpty(stations)){ return; @@ -1227,9 +1226,6 @@ public class RealTargetServiceImpl implements RealTargetService { public void loadPowerData(String param, List types, Integer serveType, int year) { // 站点查询 List stations = stationService.list(new LambdaQueryWrapper() {{ - if (ObjectUtil.isNotEmpty(serveType)) { - eq(StationEntity::getServeType, serveType); - } if (CollectionUtil.isNotEmpty(types)) { in(StationEntity::getType, types); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index b43c4bb..3421b22 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java @@ -1242,7 +1242,8 @@ public class TargetServiceImpl implements TargetService { List powerMonths = generateService.fillPowerMon(station.getCode()); return powerMonths.stream().map(mon->{ HydropowerTargetDetailVo detail = new HydropowerTargetDetailVo(); - detail.setTime(mon.getStrMonth()); + Date date = DateUtil.parse(mon.getStrMonth() + " 00:00:00",DateUtil.PATTERN_DATETIME); + detail.setTime(DateUtil.format(date,"yyyy-MM")); if(MapUtils.isEmpty(powerMap)){ detail.setElectric(Double.valueOf(mon.getPower())); return detail; @@ -1264,26 +1265,16 @@ public class TargetServiceImpl implements TargetService { return powerDays.stream().map(day->{ HydropowerTargetDetailVo detail = new HydropowerTargetDetailVo(); detail.setTime(day.getDate()); + detail.setElectric(Double.valueOf(day.getGenerate())); if(CollectionUtil.isEmpty(targets)){ - detail.setElectric(Double.valueOf(day.getGenerate())); return detail; } - List stationTargets = targets.stream().filter(o->o.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(stationTargets)){ - detail.setElectric(Double.valueOf(day.getGenerate())); - return detail; - } - List generations = stationTargets.get(0).getGenerationPowerVoList(); + // 设备指标数据 + List generations = targets.stream().filter(o-> CollectionUtil.isNotEmpty(o.getGenerationPowerVoList()) && o.getDeptId().equals(station.getRefDept())).flatMap(v -> v.getGenerationPowerVoList().stream()).collect(Collectors.toList()); if(CollectionUtil.isEmpty(generations)){ - detail.setElectric(Double.valueOf(day.getGenerate())); - return detail; - } - List dayGenerations = generations.stream().filter(generation -> generation.getDate().equals(day.getDate())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(dayGenerations)){ - detail.setElectric(Double.valueOf(day.getGenerate())); return detail; } - detail.setElectric((double) (day.getGenerate() + dayGenerations.get(0).getGenerate())); + detail.setElectric(generations.stream().filter(o->o.getDate().equals(day.getDate())).mapToDouble(GenerationPowerVo::getGenerate).sum()); return detail; }).collect(Collectors.toList()); }else{ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java index f83a10c..2e170cd 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java @@ -297,4 +297,4 @@ public class GenerateServiceImpl extends BaseServiceImpl 0 ? R.fail(400, "该名称已录入数据,请找到相应记录做修改处理") : R.status(stationVideoTypeService.save(req)); } + + /** * 修改 代码自定义代号 */ @@ -328,4 +330,28 @@ public class StationVideoTypeController extends BladeController { return R.data(stationVideoTypeService.getVideoPointByRegion(refDept,regionCode)); } + @PostMapping("/saveBatch") + @ApiOperationSupport(order = 170) + @ApiOperation(value = "批量保存视频配置记录") + public R saveBatch(@RequestBody List entitys) { + return R.status(stationVideoTypeService.saveBatch(entitys)); + } + + @GetMapping ("/checkSaveEntry") + @ApiOperationSupport(order = 180) + @ApiOperation(value = "监查保存记录") + public R checkSaveEntry(@RequestParam(value = "pointCode") String pointCode, + @RequestParam(value = "stationId") String stationId, + @RequestParam(value = "name") String name) { + StationVideoTypeEntity entity = stationVideoTypeService.getOne(Wrappers.lambdaQuery() + .eq(StationVideoTypeEntity::getPointCode,pointCode) + .eq(StationVideoTypeEntity::getStationId,stationId) + .eq(StationVideoTypeEntity::getName,name) + ); + if(ObjectUtil.isEmpty(entity)){ + return R.data(true); + } + return R.data(false); + } + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java index f5acc95..eb7013d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java @@ -1,9 +1,9 @@ package com.hnac.hzims.operational.video.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.common.invalid.Create; import com.hnac.hzims.common.invalid.Update; -import com.hnac.hzims.common.support.constants.Order; import com.hnac.hzims.common.support.utils.Condition; import com.hnac.hzims.operational.OperationalConstants; import com.hnac.hzims.operational.video.dto.VideoPlaybackDTO; @@ -19,13 +19,16 @@ import io.swagger.annotations.ApiOperationSupport; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.*; - +/** + * @author ysj + */ @RestController @Api(value = "视频平台管理",tags = "视频平台管理") @RequestMapping("/video/platform") @@ -64,12 +67,13 @@ public class VideoPlatformController extends BladeController { @ApiOperation("查询视频平台列表") @ApiOperationSupport(order = 4) @Operate(label = "查询视频平台列表",type = BusinessType.QUERY,ignore = false) - public R> list(VideoPlatformEntity req) { - HashMap sort = new HashMap() {{ - put("create_time", Order.DESC); - }}; - LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(req, VideoPlatformEntity.class, sort); - return R.data(videoPlatformService.list(queryWrapper)); + public R> list(Query query, VideoPlatformEntity req) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.orderByDesc(VideoPlatformEntity::getCreateTime); + if(!StringUtil.isEmpty(req.getName())){ + queryWrapper.like(VideoPlatformEntity::getName,req.getName()); + } + return R.data(videoPlatformService.page(Condition.getPage(query),queryWrapper)); } @DeleteMapping("/remove")