From ac4f36a716198037fc9d3af8c51b4be9ca159b96 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期四, 12 六月 2025 15:40:38 +0800 Subject: [PATCH] 蓄电池组1.2.5,1.2.6 --- src/main/java/com/whyc/service/BattInfService.java | 4 + src/main/java/com/whyc/service/BatttestdataInfService.java | 81 ++++++++++++++++--- src/main/java/com/whyc/dto/Response.java | 18 ++++ src/main/java/com/whyc/dto/Statistic/Pwr7Stic.java | 26 ++++++ src/main/java/com/whyc/controller/StatisticController.java | 8 + src/main/java/com/whyc/mapper/BattInfMapper.java | 2 src/main/java/com/whyc/controller/ConditionController.java | 10 ++ src/main/java/com/whyc/service/BaojigroupService.java | 2 src/main/resources/mapper/BattInfMapper.xml | 40 ++++++++++ 9 files changed, 174 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/whyc/controller/ConditionController.java b/src/main/java/com/whyc/controller/ConditionController.java index efd7b9d..581a269 100644 --- a/src/main/java/com/whyc/controller/ConditionController.java +++ b/src/main/java/com/whyc/controller/ConditionController.java @@ -1,6 +1,7 @@ package com.whyc.controller; import com.whyc.dto.Response; +import com.whyc.pojo.db_user.Baojigroup; import com.whyc.pojo.db_user.User; import com.whyc.service.*; import com.whyc.util.ActionUtil; @@ -8,6 +9,8 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import java.util.List; @RestController @Api(tags = "涓嬫媺鏉′欢绠$悊") @@ -188,6 +191,13 @@ return rtstateService.getBattState(); } + @ApiOperation(value = "鑾峰彇鎵�鏈夌殑鐝粍(涓嬫媺)") + @GetMapping("getBattGroupBZ") + public Response getBattGroupBZ(){ + List<Baojigroup> list=bjGroupService.getGroupList(); + return new Response().setII(1,true,list,"鑾峰彇鎵�鏈夌殑鐝粍(涓嬫媺)"); + } + } \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/StatisticController.java b/src/main/java/com/whyc/controller/StatisticController.java index e4c87fa..a8e4dcf 100644 --- a/src/main/java/com/whyc/controller/StatisticController.java +++ b/src/main/java/com/whyc/controller/StatisticController.java @@ -92,7 +92,13 @@ } return battTinfService.getDischr6Statistic(stic); } - + @ApiOperation(value = "浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7)") + @PostMapping("getPwr7Statistic") + public Response getPwr7Statistic(@RequestBody Pwr7Stic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battTinfService.getPwr7Statistic(stic); + } @ApiOperation(value = "鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)") @PostMapping("getPerformanceStatistic") public Response getPerformanceStatistic(@RequestBody PerformanceStic stic){ diff --git a/src/main/java/com/whyc/dto/Response.java b/src/main/java/com/whyc/dto/Response.java index 2401c54..ee240df 100644 --- a/src/main/java/com/whyc/dto/Response.java +++ b/src/main/java/com/whyc/dto/Response.java @@ -18,6 +18,7 @@ private T data; private T data2; private T data3; + private T data4; private String msg; public Response<T> setCode(Integer code) { @@ -69,6 +70,15 @@ this.data3 = data3; return this; } + public Response<T> setIIII(Integer code, T data, T data2, T data3,T data4, String msg) { + this.code = code; + this.msg = msg; + this.data = data; + this.data2 = data2; + this.data3 = data3; + this.data4 = data4; + return this; + } public Integer getCode() { return code; @@ -101,4 +111,12 @@ public void setData3(T data3) { this.data3 = data3; } + + public T getData4() { + return data4; + } + + public void setData4(T data4) { + this.data4 = data4; + } } diff --git a/src/main/java/com/whyc/dto/Statistic/Pwr7Stic.java b/src/main/java/com/whyc/dto/Statistic/Pwr7Stic.java new file mode 100644 index 0000000..11fa0c9 --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/Pwr7Stic.java @@ -0,0 +1,26 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class Pwr7Stic { + private String provice; + private String city; + private String country; + private String stationName; + private String battgroupName; + private String product; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date inuseStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date inuseEndTime;//缁撴潫鏃堕棿 + private Float monvolstd; + private Integer performance;//鐢垫睜鎬ц兘锛�1浼樼锛�2鍔e寲锛�3鎹熷潖 4鏈斁鐢� 涓嶄紶鍏ㄩ儴 + private Integer baojiGroupId; + private Integer uid; + private Integer pageNum; + private Integer pageSize; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattInfMapper.java b/src/main/java/com/whyc/mapper/BattInfMapper.java index a291b1c..f479160 100644 --- a/src/main/java/com/whyc/mapper/BattInfMapper.java +++ b/src/main/java/com/whyc/mapper/BattInfMapper.java @@ -53,4 +53,6 @@ List<BattInf> getPerformanceStatistic(@Param("stic") PerformanceStic stic); //鏈勾搴﹀凡/鏈斁鐢垫暟閲忕粺璁″彸渚у浘琛�(1.2.5) List<BattInf> getDischrChart(@Param("uid") Integer uid); + //浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7) + List<BattInf> getPwr7Statistic(@Param("stic") Pwr7Stic stic); } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BaojigroupService.java b/src/main/java/com/whyc/service/BaojigroupService.java index 4d55691..a636bfe 100644 --- a/src/main/java/com/whyc/service/BaojigroupService.java +++ b/src/main/java/com/whyc/service/BaojigroupService.java @@ -249,7 +249,7 @@ String groupName = powerInfMapper.getGroupName(powerId); return groupName; } - //鏌ヨ鎵�鏈夌殑鍖呮満缁勫悕闆嗗悎 + //鏌ヨ鎵�鏈夌殑鍖呮満缁勫悕闆嗗悎锛堢彮缁勶級 public List<Baojigroup> getGroupList() { QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("team_flag",1); diff --git a/src/main/java/com/whyc/service/BattInfService.java b/src/main/java/com/whyc/service/BattInfService.java index 534ae58..9f5d008 100644 --- a/src/main/java/com/whyc/service/BattInfService.java +++ b/src/main/java/com/whyc/service/BattInfService.java @@ -473,4 +473,8 @@ public List<BattInf> getDischrChart(Integer uid) { return mapper.getDischrChart(uid); } + //浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7) + public List<BattInf> getPwr7Statistic(Pwr7Stic stic) { + return mapper.getPwr7Statistic(stic); + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java index b5fccd7..1700aec 100644 --- a/src/main/java/com/whyc/service/BatttestdataInfService.java +++ b/src/main/java/com/whyc/service/BatttestdataInfService.java @@ -612,8 +612,18 @@ } return new Response().setII(1,true,map,"鍘嗗彶娴嬭瘯璁板綍"); } - //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5) + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5)<鍙煡鐪嬪凡鏀剧數鏁版嵁> public Response getDischr5Statistic(DisChargeStic stic) { + //鐝粍 + Map<String, Object> bzmap=new HashMap<>(); + //鎬ц兘 + Map<String, Integer> xnmap=new HashMap<>(); + xnmap.put("浼樼",0); + xnmap.put("鍔e寲",0); + xnmap.put("鎹熷潖",0); + xnmap.put("鏈斁鐢�",0); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(bzmap); //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� List<AppParam> paramList=appParamService.getHrParam(); Float badValue=0f; @@ -647,16 +657,21 @@ //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); if(tinf==null){ - res.setRealCap(0f); + /* res.setRealCap(0f); res.setTestStartTime(ThreadLocalUtil.parse("1972-01-01 00:00:00",1)); res.setTestTimelong(0); res.setTestCap(0f); res.setStopReason(""); res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); - res.setDisChargeType(2); + res.setDisChargeType(2);*/ continue; } - + if(!groupName.equals("none")){ + BanZu bz= (BanZu) bzmap.get(groupName); + int dischargeNum=bz.getDischargeNum(); + bz.setDischargeNum(dischargeNum+1); + bzmap.put(groupName,bz); + } res.setTestStartTime(tinf.getTestStarttime()); res.setTestTimelong(tinf.getTestTimelong()); res.setTestCap(tinf.getTestCap()); @@ -665,27 +680,27 @@ int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); res.setRealCap(grouprealCap); - res.setDisChargeType(1); + //res.setDisChargeType(1); if(grouprealCap>=moncapStd*badValue){ res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); + int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); + xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()),value+1); } if(grouprealCap<=moncapStd*damageValue){ res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()),value+1); } if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); + int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); + xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()),value+1); } - if(stic.getDisChargeType()==null){ - reslist.add(res); - }else{ - if(res.getDisChargeType()==stic.getDisChargeType()){ - reslist.add(res); - } - } + reslist.add(res); } PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); - return new Response().setII(1,reslist.size()>0,pageInfo,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻"); - }//鏈勾搴﹀凡鏀剧數鏁伴噺缁熻鍙充晶鍥捐〃(1.2.5) + return new Response().setIIII(1,reslist.size()>0,pageInfo,bzmap,xnmap,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻"); + }//鏈勾搴﹀凡鏀剧數鏁伴噺缁熻鍙充晶鍥捐〃(1.2.5/6) public Response getDischr5Chart(Integer uid) { //鐝粍 Map<String, Object> bzmap=new HashMap<>(); @@ -774,6 +789,10 @@ //鏈勾搴︽湭鏀剧數鏁伴噺缁熻(1.2.6) public Response getDischr6Statistic(DisChargeStic stic) { + //鐝粍 + Map<String, Object> bzmap=new HashMap<>(); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(bzmap); //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 List<BattInf> binfList=battInfService.getDischr6Statistic(stic); if(binfList==null||binfList.size()==0){ @@ -805,9 +824,19 @@ reslist.add(res); } } + if(tinf==null){ + if(!groupName.equals("none")){ + BanZu bz= (BanZu) bzmap.get(groupName); + int nochargeNum=bz.getNochargeNum(); + bz.setNochargeNum(nochargeNum+1); + bzmap.put(groupName,bz); + } + continue; + } + } PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); - return new Response().setII(1,reslist.size()>0,pageInfo,"鏈勾搴︽湭鏀剧數鏁伴噺缁熻"); + return new Response().setIII(1,reslist.size()>0,pageInfo,bzmap,"鏈勾搴︽湭鏀剧數鏁伴噺缁熻"); } //2.鑾峰彇鐢垫睜缁勬湭鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) private void getNoDischargeData(Integer battgroupId, Date testStartTime, Date testEndTime, List<Integer> typeList, SticDischarge6Res res) { @@ -905,5 +934,27 @@ PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); return new Response().setII(1,reslist.size()>0,pageInfo,"鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)"); } + //浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7) + public Response getPwr7Statistic(Pwr7Stic stic) { + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + } + } + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getPwr7Statistic(stic); + List<PerformanceRes> reslist=new ArrayList<>(); + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setII(1,reslist.size()>0,pageInfo,"浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7)"); + } } \ No newline at end of file diff --git a/src/main/resources/mapper/BattInfMapper.xml b/src/main/resources/mapper/BattInfMapper.xml index 6d8f68f..36b74db 100644 --- a/src/main/resources/mapper/BattInfMapper.xml +++ b/src/main/resources/mapper/BattInfMapper.xml @@ -418,4 +418,44 @@ order by tb_batt_inf.dev_id asc,battgroup_id asc </where> </select> + <select id="getPwr7Statistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.monvolstd!=null"> + and tb_batt_inf.monvolstd=#{stic.monvolstd} + </if> + <if test="stic.product!=null"> + and tb_batt_inf.product=#{stic.product} + </if> + <if test="stic.inuseStartTime!=null"> + and tb_batt_inf.inuse_time>=#{stic.inuseStartTime} + </if> + <if test="stic.inuseEndTime!=null"> + and tb_batt_inf.inuse_time<=#{stic.inuseEndTimee} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1