| | |
| | | |
| | | import com.whyc.dto.AllModel; |
| | | import com.whyc.dto.BattMaintDealarm; |
| | | import com.whyc.dto.ReportBattDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.service.BattMaintDealarmService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | /** |
| | | * 电池组统计分析查询 |
| | | * |
| | | * @param bmd |
| | | * @param tinf |
| | | * @return |
| | | */ |
| | | //1.3根据电池组id查询电池的电导和充放电信息 |
| | | @PostMapping("searchLow") |
| | | @ApiOperation(notes = "TODO ", value = "电池组统计分析查询/serchLow") |
| | | public Response<List<AllModel>> searchLow(@RequestBody BattMaintDealarm bmd) { |
| | | //return battMaintDealarmService.searchLow(bmd); |
| | | return null; |
| | | @ApiOperation(notes = "/serchLow", value = "电池组统计分析查询") |
| | | public Response searchLow(@RequestBody ReportBattDTO tinf) { |
| | | UserInf userInf = ActionUtil.getUser(); |
| | | return battMaintDealarmService.searchLow(tinf,userInf.getUId().intValue()); |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.whyc.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | public class ReportBattDTO { |
| | | /**站点信息*/ |
| | | private String stationName; |
| | | private String stationName1;//省 |
| | | private Integer battGroupId; |
| | | /** |
| | | * 电池测试类型 |
| | | */ |
| | | @ApiModelProperty("0:无;1:浮充;2:充电;3:放电;4:均充;5:电导/内阻;6:电导;7:温度;8:连接条;9:在线监测") |
| | | private Integer testType; |
| | | private Date recordStartTime; |
| | | private Date recordEndTime; |
| | | /** |
| | | * 放电类型 |
| | | */ |
| | | @ApiModelProperty("测试仪表类型:停电放电;假负载放电2;节能放电3") |
| | | private Integer testStartType; |
| | | } |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.dto.BattInfAndEnduranceDTO; |
| | | import com.whyc.dto.ReportBattDTO; |
| | | import com.whyc.pojo.Battinf; |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | List<BattInfAndEnduranceDTO> findBattProducerInfoByYearCode(@Param("yearCode") int yearCode,@Param("userId") int uId); |
| | | |
| | | List<Battinf> searchByTestType(@Param("tinf") BatttestdataInf tinf,int userId); |
| | | List<Battinf> searchByTestType(@Param("tinf") ReportBattDTO tinf, int userId); |
| | | |
| | | //报表统计-电池组评估 |
| | | List<Battinf> searchGroupAssess(); |
| | | } |
| | |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BatttestdataInfMapper extends CustomMapper<BatttestdataInf>{ |
| | | |
| | | //查询是否存在db_batt_testdata_id表 |
| | | int judge(@Param("battGroupId") int battGroupId); |
| | | |
| | | List<BatttestdataInf> searchByTestType(@Param("tinf") BatttestdataInf tinf); |
| | | //1.4电池组性能评估(根据电池组id查询所有的放电记录求出放电总次数,最高历史容量,最低历史容量,平均容量,最新测试容量) |
| | | List<BatttestdataInf> searchDischargeTest(@Param("tinf") BatttestdataInf tinf); |
| | | } |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private Fbs9100Setparam fparam; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer testRecordCount; |
| | | |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.BattMaintDealarm; |
| | | import com.whyc.dto.ReportBattDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattInfMapper; |
| | | import com.whyc.mapper.BattMaintDealarmMapper; |
| | | import com.whyc.mapper.BatttestdataInfMapper; |
| | | import com.whyc.pojo.Battinf; |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class BattMaintDealarmService { |
| | |
| | | @Resource |
| | | private BattInfMapper battInfMapper; |
| | | |
| | | public Response searchLow(BattMaintDealarm bmd, int userId){ |
| | | BatttestdataInf tinf = new BatttestdataInf(); |
| | | @Resource |
| | | private BatttestdataInfService batttestdataInfService; |
| | | |
| | | public Response searchLow(ReportBattDTO tinf, int userId){ |
| | | Response res = new Response(); |
| | | List<Battinf> battinfList = battInfMapper.searchByTestType(tinf, userId); |
| | | BatttestdataInf tdata = bmd.getBtestinf(); |
| | | List<Map> result = new ArrayList<>(); |
| | | if (battinfList!=null && battinfList.size()>0){ |
| | | BatttestdataInf btdinf = new BatttestdataInf(); |
| | | btdinf.setRecordTime(tinf.getRecordStartTime()); |
| | | btdinf.setRecordTime1(tinf.getRecordEndTime()); |
| | | btdinf.setTestType(tinf.getTestType()); |
| | | btdinf.setTestStarttype(tinf.getTestStartType()); |
| | | for (Battinf binf:battinfList) { |
| | | btdinf.setBattGroupId(binf.getBattGroupId()); |
| | | btdinf.setGroupVol(binf.getMonVolStd()); |
| | | btdinf.setTestCap(binf.getMonCapStd()); |
| | | btdinf.setTestRecordCount(binf.getTestRecordCount()); |
| | | Map map = new HashMap(); |
| | | map.put("battinf",binf); |
| | | //该电池组的放电结果 |
| | | List<BatttestdataInf> batttestdataInfList = batttestdataInfService.searchByTestType(btdinf); |
| | | map.put("battTestDataInf",batttestdataInfList); |
| | | result.add(map); |
| | | } |
| | | } |
| | | return res.set(1,result,"查询成功"); |
| | | } |
| | | |
| | | //1.4电池性能评估 |
| | | public List searchGroupAssess(ReportBattDTO tinf, int userId){ |
| | | List<Battinf> battinfList = battInfMapper.searchByTestType(tinf, userId); |
| | | List<Map> result = new ArrayList<>(); |
| | | if (battinfList!=null && battinfList.size()>0){ |
| | | BatttestdataInf btdinf = new BatttestdataInf(); |
| | | btdinf.setRecordTime(tinf.getRecordStartTime()); |
| | | btdinf.setRecordTime1(tinf.getRecordEndTime()); |
| | | btdinf.setTestType(tinf.getTestType()); |
| | | btdinf.setTestStarttype(tinf.getTestStartType()); |
| | | for (Battinf binf:battinfList) { |
| | | btdinf.setBattGroupId(binf.getBattGroupId()); |
| | | btdinf.setGroupVol(binf.getMonVolStd()); |
| | | btdinf.setTestCap(binf.getMonCapStd()); |
| | | List<BatttestdataInf> batttestdataInfList = batttestdataInfService.searchDischargeTest(btdinf); |
| | | |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.BattCapFactory; |
| | | import com.whyc.dto.BattTestData; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattTestDataStopMapper; |
| | |
| | | } |
| | | return new Response().set(1,tinf); |
| | | } |
| | | |
| | | //报表分析使用 |
| | | public List<BatttestdataInf> searchByTestType(BatttestdataInf tinf){ |
| | | List<BatttestdataInf> list = mapper.searchByTestType(tinf); |
| | | float cap=0f;//实际容量 |
| | | float restcap=0f;//剩余容量 |
| | | for (BatttestdataInf binf:list) { |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(),binf.getTestCurr()); |
| | | cap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate,binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | restcap=(float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate,binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | binf.setGroupVol(cap);; |
| | | binf.setMonVol(restcap); |
| | | } |
| | | return list; |
| | | } |
| | | //1.4电池组性能评估(根据电池组id查询所有的放电记录求出放电总次数,最高历史容量,最低历史容量,平均容量,最新测试容量) |
| | | public List<BatttestdataInf> searchDischargeTest(BatttestdataInf tinf){ |
| | | List<BatttestdataInf> list = mapper.searchByTestType(tinf); |
| | | int sum=0;//总测试次数 |
| | | float cap=0f;//实际容量 |
| | | float allCap=0f;//总容量 |
| | | float maxCap=0f;//最高容量 |
| | | float minCap=10000f;//最低容量 |
| | | float avgCap=0f;//平均容量 |
| | | float lastCap=0f;//最近测试容量 |
| | | for (int i = 0; i <list.size() ; i++) { |
| | | BatttestdataInf binf = list.get(i); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(),binf.getTestCurr()); |
| | | cap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate,binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | if(sum==0){ |
| | | lastCap=cap; |
| | | } |
| | | if(maxCap<=cap){ |
| | | maxCap=cap;//最大 |
| | | } |
| | | if(minCap>=cap){ |
| | | minCap=cap;//最小 |
| | | } |
| | | allCap+=cap; |
| | | sum++; |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="serchBattPlan" resultMap="getPlanBattinf"> |
| | | select distinct db_battinf.tb_battinf.battgroupid,db_battinf.tb_battinf.stationid,FBSDeviceId,StationName,StationName1,stationip,BattGroupName,BattGroupName1,db_battinf.tb_battinf.battgroupnum,db_battinf.tb_battinf.moncount,moncapstd,monvolstd,battproducer,battproductdate,battinusedate,groupIndexInFBSDevice,load_curr |
| | | select distinct db_battinf.tb_battinf.battgroupid,db_battinf.tb_battinf.stationid,FBSDeviceId,StationName,StationName1,stationip,BattGroupName,BattGroupName1,db_battinf.tb_battinf.battgroupnum, |
| | | db_battinf.tb_battinf.moncount,moncapstd,monvolstd,battproducer,battproductdate,battinusedate,groupIndexInFBSDevice,load_curr |
| | | ,tb_fbs9100_setparam.HourRate,DisCurr,DisCap,DisTime,groupVol_Low,monomerVol_Low,monomerLowCount,tb_fbs9100_setparam.battGroupNum,onlineVolLowAction,dCVolHighLimit,chargeCurrSet |
| | | from db_battinf.tb_battinf,db_ram_db.tb_fbs9100_setparam |
| | | where StationName1 like '%${stationName1}%' and StationName2 like '%${stationName2}%' and StationName5 like '%${stationName5}%' and stationid like '%${stationId}%' |
| | | and db_battinf.tb_battinf.FBSDeviceId=db_ram_db.tb_fbs9100_setparam.dev_id |
| | | and db_battinf.tb_battinf.StationId in( |
| | | select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id |
| | | select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr |
| | | where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id |
| | | and db_user.tb_user_battgroup_baojigroup_usr.uId=#{uId} ) |
| | | and db_battinf.tb_battinf.battgroupid not in (select distinct battgroupid from web_site.tb_battdischarge_plan where (discharge_state=0 or discharge_state=1 or discharge_state=3 ) and discharge_cleartype=1 ) |
| | | order by db_battinf.tb_battinf.battgroupid asc |
| | |
| | | </select> |
| | | <select id="searchByTestType" resultType="com.whyc.pojo.Battinf"> |
| | | select distinct(db_battinf.tb_battinf.BattgroupId),StationName1,StationName,stationip,BattGroupName,BattGroupName1,moncount,moncapstd,monvolstd,battproducer,battproductdate,battinusedate |
| | | ,db_batt_testdata.tb_batttestdata_inf.test_record_count as num,test_starttime |
| | | ,db_batt_testdata.tb_batttestdata_inf.test_record_count ,test_starttime |
| | | from db_battinf.tb_battinf,db_batt_testdata.tb_batttestdata_inf |
| | | <where> |
| | | db_battinf.tb_battinf.battgroupid=db_batt_testdata.tb_batttestdata_inf.battgroupid |
| | | <if test="tinf.recordTime!=null"> |
| | | DATE_FORMAT(record_time, '%Y-%m-%d')>=DATE_FORMAT(#{tinf.recordTime}, '%Y-%m-%d') |
| | | <if test="tinf.recordStartTime!=null"> |
| | | DATE_FORMAT(record_time, '%Y-%m-%d')>=DATE_FORMAT(#{tinf.recordStartTime}, '%Y-%m-%d') |
| | | </if> |
| | | <if test="tinf.recordTime1!=null"> |
| | | DATE_FORMAT(record_time, '%Y-%m-%d')<=DATE_FORMAT(#{tinf.recordTime1}, '%Y-%m-%d') |
| | | <if test="tinf.recordEndTime!=null"> |
| | | DATE_FORMAT(record_time, '%Y-%m-%d')<=DATE_FORMAT(#{tinf.recordEndTime}, '%Y-%m-%d') |
| | | </if> |
| | | <if test="tinf.battGroupId!=0"> |
| | | and db_battinf.tb_battinf.battgroupid=#{binf.battGroupId} |
| | |
| | | and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id |
| | | and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid |
| | | and db_user.tb_user_inf.uid=#{userId} |
| | | </if> |
| | | <if test="tinf.stationName1!=null and tinf.stationName1!=''"> |
| | | and db_battinf.tb_battinf.stationName1 like CONCAT('%',#{tinf.stationName1},'%') |
| | | </if> |
| | | <if test="tinf.stationName!=null and tinf.stationName!=''"> |
| | | and db_battinf.tb_battinf.stationName like CONCAT('%',#{tinf.stationName},'%') ) |
| | | </if> |
| | | <if test="tinf.testType==2"><!--充电--> |
| | |
| | | order by db_battinf.tb_battinf.battgroupid asc,test_starttime asc |
| | | |
| | | </select> |
| | | <select id="searchGroupAssess" resultType="com.whyc.pojo.Battinf"> |
| | | select distinct(db_battinf.tb_battinf.BattgroupId), |
| | | db_battinf.tb_battinf.stationid,StationName1,StationName,stationip,BattGroupName,BattGroupName1, |
| | | moncount,moncapstd,monvolstd,battproducer,battproductdate,battinusedate |
| | | from db_battinf.tb_battinf |
| | | <where> |
| | | <if test="battGroupId!=0"> |
| | | and db_battinf.tb_battinf.battgroupid=#{battGroupId} |
| | | </if> |
| | | <if test="userId!=null and userId!=0"> |
| | | and db_battinf.tb_battinf.BattgroupId in(select distinct db_battinf.tb_battinf.battgroupid |
| | | from db_battinf.tb_battinf,db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr,db_user.tb_user_inf |
| | | where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId |
| | | and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id |
| | | and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid |
| | | and db_user.tb_user_inf.uid=#{userId} |
| | | </if> |
| | | <if test="tinf.stationName1!=null and tinf.stationName1!=''">and db_battinf.tb_battinf.stationName1 like CONCAT('%',#{tinf.stationName1},'%')</if> |
| | | <if test="tinf.stationName!=null and tinf.stationName!=''">and db_battinf.tb_battinf.stationName like CONCAT('%',#{tinf.stationName},'%') )</if> |
| | | </where> |
| | | order by db_battinf.tb_battinf.battgroupid asc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <select id="judge" resultType="java.lang.Integer"> |
| | | select count(table_name) as judgeNum from INFORMATION_SCHEMA.TABLES where table_name ='tb_batttestdatastop_${battGroupId}' and TABLE_SCHEMA='db_batt_testdata' |
| | | </select> |
| | | |
| | | <select id="searchByTestType" resultType="com.whyc.pojo.BatttestdataInf"> |
| | | select battgroupid,test_curr,max_monvol,test_starttime,test_timelong,min_monvol,test_cap,min_monnum |
| | | from db_batt_testdata.tb_batttestdata_inf |
| | | <where> |
| | | db_batt_testdata.tb_batttestdata_inf.data_available=1 |
| | | <if test="tinf.battGroupId!=null"> |
| | | and battgroupid=#{tinf.battGroupId} |
| | | </if> |
| | | <if test="tinf.testRecordCount!=null"> |
| | | and test_record_count=#{tinf.testRecordCount} |
| | | </if> |
| | | <if test="tinf.recordTime!=null and tinf.recordTime1!=null"> |
| | | and record_time>=#{tinf.recordTime} and record_time<=#{tinf.recordTime1} |
| | | </if> |
| | | <if test="tinf.testType==2"><!--充电--> |
| | | and test_type=2 |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==0"><!--放电 全部--> |
| | | and test_type=3 |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==1"><!--停电放电--> |
| | | and (test_starttype<5 and test_type not in(2,9) and test_starttype!=2 AND test_starttype!=3) |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==2"><!--假负载放电2--> |
| | | and (test_starttype=2 and test_type not in(2) ) |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==3"><!--节能放电3--> |
| | | and (test_starttype=3 and test_type not in(2) ) |
| | | </if> |
| | | </where> |
| | | order by test_starttime desc |
| | | </select> |
| | | <select id="searchDischargeTest" resultType="com.whyc.pojo.BatttestdataInf"> |
| | | select battgroupid,test_curr,max_monvol,min_monvol,test_cap |
| | | from db_batt_testdata.tb_batttestdata_inf |
| | | <where> |
| | | db_batt_testdata.tb_batttestdata_inf.data_available=1 |
| | | <if test="tinf.battGroupId!=null"> |
| | | and battgroupid=#{tinf.battGroupId} |
| | | </if> |
| | | <if test="tinf.testRecordCount!=null"> |
| | | and test_record_count=#{tinf.testRecordCount} |
| | | </if> |
| | | <if test="tinf.recordTime!=null and tinf.recordTime1!=null"> |
| | | and record_time>=#{tinf.recordTime} and record_time<=#{tinf.recordTime1} |
| | | </if> |
| | | <if test="tinf.testType==2"><!--充电--> |
| | | and test_type=2 |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==0"><!--放电 全部--> |
| | | and test_type=3 |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==1"><!--停电放电--> |
| | | and (test_starttype<5 and test_type not in(2,9) and test_starttype!=2 AND test_starttype!=3) |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==2"><!--假负载放电2--> |
| | | and (test_starttype=2 and test_type not in(2) ) |
| | | </if> |
| | | <if test="tinf.testType==3 and tinf.testStartType==3"><!--节能放电3--> |
| | | and (test_starttype=3 and test_type not in(2) ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |