From a6018ae593fc2d2fb3ccfa4e7c34f28387326f6b Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期四, 19 六月 2025 15:06:25 +0800 Subject: [PATCH] 3.1电池/电源告警参数,1.2.7优良电源统计 --- src/main/java/com/whyc/service/BatttestdataInfService.java | 50 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java index 954d64d..219895b 100644 --- a/src/main/java/com/whyc/service/BatttestdataInfService.java +++ b/src/main/java/com/whyc/service/BatttestdataInfService.java @@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.constant.BattCapperformanceEnum; +import com.whyc.constant.PwrCapperformanceEnum; import com.whyc.constant.StopReasonEnum; import com.whyc.dto.Real.TestDataDto; import com.whyc.dto.Response; @@ -19,10 +20,12 @@ import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_user.Baojigroup; import com.whyc.util.ActionUtil; +import com.whyc.util.DateUtil; import com.whyc.util.PageInfoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; import java.util.*; @Service @@ -937,35 +940,42 @@ } //浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7) public Response getPwr7Statistic(Pwr7Stic stic) { + Date inuseTimeStart =new Date(); + if(stic.getInuseYear()==1){ + //鎶曞叆浣跨敤鏃堕棿鏉′欢绛涢�� + LocalDateTime startTime = LocalDateTime.now().minusYears(5); + inuseTimeStart = DateUtil.convertToDate(startTime); + }else{ + //鎶曞叆浣跨敤鏃堕棿鏉′欢绛涢�� + LocalDateTime startTime = LocalDateTime.now().minusYears(stic.getInuseYear()); + inuseTimeStart = DateUtil.convertToDate(startTime); + } + stic.setPwrInUseTime(inuseTimeStart); //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 List<PowerInf> pinfList=powerInfService.getPwr7Statistic(stic); if(pinfList==null||pinfList.size()==0){ - return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫簮"); } List<SticPwr7Res> reslist=new ArrayList<>(); for (PowerInf pinf:pinfList) { - SticPwr7Res res=new SticPwr7Res(); - //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍 + SticPwr7Res res = new SticPwr7Res(); + //鏌ヨ鐢垫簮鎵�鍦ㄧ殑鐝粍 String groupName = bjService.getGroupName(pinf.getPowerId()); - if(groupName.equals("none")){ - continue; - }else{ - if(stic.getGroupName()==null||res.getGroupName()==stic.getGroupName()){ - res.setProvice(pinf.getProvice()); - res.setCity(pinf.getCity()); - res.setCountry(pinf.getCountry()); - res.setStationName(pinf.getStationName()); - res.setPowerName(pinf.getPowerName()); - res.setCompany(pinf.getCompany()); - res.setStationType(pinf.getStationType()); - res.setGroupName(groupName); - res.setInuseTime(pinf.getPowerInuseTime()); - Map<String,Integer> map=pwrHisdataIdService.getPwrQuarter7(pinf.getPowerId(),null); - reslist.add(res); - } + if (stic.getGroupName() == null || groupName == stic.getGroupName()) { + res.setProvice(pinf.getProvice()); + res.setCity(pinf.getCity()); + res.setCountry(pinf.getCountry()); + res.setStationName(pinf.getStationName()); + res.setPowerName(pinf.getPowerName()); + res.setCompany(pinf.getCompany()); + res.setStationType(pinf.getStationType()); + res.setGroupName(groupName); + res.setInuseTime(pinf.getPowerInuseTime()); + Integer performance= pwrHisdataIdService.getPwrQuarter7(pinf.getPowerId(),pinf.getPowerType()); + res.setPerformanceName(PwrCapperformanceEnum.getValue(performance)); + reslist.add(res); } } - PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); return new Response().setII(1,reslist.size()>0,pageInfo,"浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7)"); } -- Gitblit v1.9.1