src/main/java/com/whyc/controller/BatttestdataInfController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/paramter/GroupTestCapPar.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/result/GroupTestCapRes.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/BatttestdataInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/BatttestdataInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/BatttestdataInfController.java
@@ -1,6 +1,7 @@ package com.whyc.controller; import com.whyc.dto.Response; import com.whyc.dto.paramter.GroupTestCapPar; import com.whyc.pojo.Battinf; import com.whyc.service.BatttestdataInfService; import io.swagger.annotations.Api; @@ -50,4 +51,10 @@ return new Response().set(1, false, "参数错误"); } @PostMapping("/searchGroupTestCap") @ApiOperation(value = "统计时间段内设备的测试容量") public Response searchGroupTestCap(@RequestBody GroupTestCapPar groupCapPar) { return service.searchGroupTestCap(groupCapPar); } } src/main/java/com/whyc/dto/paramter/GroupTestCapPar.java
New file @@ -0,0 +1,20 @@ package com.whyc.dto.paramter; import lombok.Data; import lombok.ToString; import java.io.Serializable; import java.util.Date; @Data @ToString public class GroupTestCapPar implements Serializable { private String stationName1; private String stationName2; private String stationName3; private String stationName5; private int pageCurr; private int pageSize; private Date testStartTime; private Date testEndTime; } src/main/java/com/whyc/dto/result/GroupTestCapRes.java
New file @@ -0,0 +1,18 @@ package com.whyc.dto.result; import lombok.Data; import lombok.ToString; import java.io.Serializable; @Data @ToString public class GroupTestCapRes implements Serializable { private String stationName1; private String stationName2; private String stationName3; private String stationName5; private int countNum; private float sumNum; private String testCaps; } src/main/java/com/whyc/mapper/BatttestdataInfMapper.java
@@ -1,7 +1,8 @@ package com.whyc.mapper; import com.whyc.dto.BattState; import com.whyc.pojo.BattRtstate; import com.whyc.dto.paramter.GroupTestCapPar; import com.whyc.dto.result.GroupTestCapRes; import com.whyc.pojo.Battinf; import com.whyc.pojo.BatttestdataInf; import org.apache.ibatis.annotations.Param; @@ -14,11 +15,16 @@ int judge(@Param("battGroupId") int battGroupId); List<BatttestdataInf> searchByTestType(@Param("tinf") BatttestdataInf tinf); //1.4电池组性能评估(根据电池组id查询所有的放电记录求出放电总次数,最高历史容量,最低历史容量,平均容量,最新测试容量) List<BatttestdataInf> searchDischargeTest(@Param("tinf") BatttestdataInf tinf); //机房历史放电数据续航能力查询(实时) List<BattState> searchBattLifeNow(@Param("binf")Battinf binf); List<BattState> searchBattLifeNow(@Param("binf") Battinf binf); //机房历史放电数据续航能力查询(历史) List searchBattLife(@Param("binf")Battinf binf); List searchBattLife(@Param("binf") Battinf binf); //统计时间段内设备的测试容量 List<GroupTestCapRes> searchGroupTestCap(GroupTestCapPar groupCapPar); } src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -4,6 +4,8 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.dto.*; import com.whyc.dto.paramter.GroupTestCapPar; import com.whyc.dto.result.GroupTestCapRes; import com.whyc.dto.result.ReportBattTestDTO; import com.whyc.mapper.BattParamLowMapper; import com.whyc.mapper.BattTestDataStopMapper; @@ -220,16 +222,22 @@ data.add(listE.get(i)); } }else { int a1=(pageNum-1)*pageSize; int a2=(listE.size()-((pageNum-1)*pageSize)); for (int i = (pageNum-1)*pageSize; i < listE.size(); i++) { int a1 = (pageNum - 1) * pageSize; int a2 = (listE.size() - ((pageNum - 1) * pageSize)); for (int i = (pageNum - 1) * pageSize; i < listE.size(); i++) { data.add(listE.get(i)); } } } page.setData(data); return new Response().set(1,page,"查询成功"); return new Response().set(1, page, "查询成功"); } //统计时间段内设备的测试容量 public Response searchGroupTestCap(GroupTestCapPar groupCapPar) { PageHelper.startPage(groupCapPar.getPageCurr(), groupCapPar.getPageSize()); List<GroupTestCapRes> list = mapper.searchGroupTestCap(groupCapPar); PageInfo pageInfo = new PageInfo(list); return new Response().setII(1, list.size() > 0 ? true : false, pageInfo, "统计时间段内设备的测试容量"); } } src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -146,15 +146,16 @@ ORDER BY db_battinf.tb_battinf.stationid asc,tb_batttestdata_inf.BattGroupId asc,db_batt_testdata.tb_batttestdata_inf.test_starttime desc </select> <resultMap id="resultLifeDTO" type="com.whyc.dto.result.ReportBattTestDTO"> <association property="binf" javaType="com.whyc.pojo.Battinf"> <result column="battGroupId" jdbcType="INTEGER" property="battGroupId" /> <result column="stationid" jdbcType="VARCHAR" property="stationId" /> <result column="monCapStd" jdbcType="FLOAT" property="monCapStd" /> <result column="MonVolStd" jdbcType="FLOAT" property="monVolStd" /> <result column="battgroupname" jdbcType="VARCHAR" property="battGroupName" /> <result column="stationname" jdbcType="VARCHAR" property="stationName" /> <result column="stationname1" jdbcType="VARCHAR" property="stationName1" /> <result column="battGroupId" jdbcType="INTEGER" property="battGroupId"/> <result column="stationid" jdbcType="VARCHAR" property="stationId"/> <result column="monCapStd" jdbcType="FLOAT" property="monCapStd"/> <result column="MonVolStd" jdbcType="FLOAT" property="monVolStd"/> <result column="battgroupname" jdbcType="VARCHAR" property="battGroupName"/> <result column="stationname" jdbcType="VARCHAR" property="stationName"/> <result column="stationname1" jdbcType="VARCHAR" property="stationName1"/> </association> <association property="tdata" javaType="com.whyc.pojo.BatttestdataInf"> <result column="battGroupId" javaType="INTEGER" property="battGroupId"/> @@ -197,15 +198,39 @@ <result column="minmonvol" jdbcType="FLOAT" property="monTmp" /> </association> <association property="binf" javaType="com.whyc.pojo.Battinf"> <result column="battGroupId" jdbcType="FLOAT" property="battGroupId" /> <result column="stationid" jdbcType="VARCHAR" property="stationId" /> <result column="monCapStd" jdbcType="FLOAT" property="monCapStd" /> <result column="MonVolStd" jdbcType="FLOAT" property="monVolStd" /> <result column="BattGroupName" jdbcType="VARCHAR" property="battGroupName" /> <result column="deviceName" jdbcType="VARCHAR" property="deviceName" /> <result column="stationName" jdbcType="VARCHAR" property="stationName" /> <result column="stationName1" jdbcType="VARCHAR" property="stationName1" /> <result column="batt_state" jdbcType="INTEGER" property="num" /> <result column="battGroupId" jdbcType="FLOAT" property="battGroupId"/> <result column="stationid" jdbcType="VARCHAR" property="stationId"/> <result column="monCapStd" jdbcType="FLOAT" property="monCapStd"/> <result column="MonVolStd" jdbcType="FLOAT" property="monVolStd"/> <result column="BattGroupName" jdbcType="VARCHAR" property="battGroupName"/> <result column="deviceName" jdbcType="VARCHAR" property="deviceName"/> <result column="stationName" jdbcType="VARCHAR" property="stationName"/> <result column="stationName1" jdbcType="VARCHAR" property="stationName1"/> <result column="batt_state" jdbcType="INTEGER" property="num"/> </association> </resultMap> <select id="searchGroupTestCap" resultType="com.whyc.dto.result.GroupTestCapRes"> SELECT stationName1,stationName2,stationName3,stationName5,IFNULL(count(*),0) as countNum,IFNULL(truncate(sum(abs(test_cap)),3),0) as sumNum,GROUP_CONCAT(test_cap) as testCaps from db_battinf.tb_battinf LEFT OUTER JOIN db_batt_testdata.tb_batttestdata_inf on tb_battinf.BattGroupId=tb_batttestdata_inf.BattGroupId <where> test_type=3 and test_starttype=3 <if test="stationName1!=null&&stationName1!=''"> and stationName1=#{stationName1} </if> <if test="stationName2!=null&&stationName2!=''"> and stationName2=#{stationName2} </if> <if test="stationName3!=null&&stationName3!=''"> and stationName3=#{stationName3} </if> <if test="stationName5!=null&&stationName5!=''"> and stationName5=#{stationName5} </if> </where> and tb_batttestdata_inf.test_starttime>=#{testStartTime} and tb_batttestdata_inf.test_starttime<=#{testEndTime} group by FBSDeviceId </select> </mapper>