| | |
| | | private String city; |
| | | private String country; |
| | | private String stationName; |
| | | private String battgroupName; |
| | | private String product; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private String company; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseStartTime;//开始时间 |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseEndTime;//结束时间 |
| | | private Float monvolstd; |
| | | private String stationType; |
| | | private Integer performance;//电池性能:1优秀,2劣化,3损坏 4未放电 不传全部 |
| | | private Integer baojiGroupId; |
| | | private String groupName; |
| | | private Integer uid; |
| | | private Integer pageNum; |
| | | private Integer pageSize; |
New file |
| | |
| | | package com.whyc.dto.Statistic; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class QuarterPwr7Res { |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private Date recordDatetime; |
| | | private Float acin1Vola; |
| | | private Float acoutVola; |
| | | private Float dcoutVol; |
| | | private Float dcoutCurr; |
| | | } |
New file |
| | |
| | | package com.whyc.dto.Statistic; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class SticPwr7Res { |
| | | private String provice; |
| | | private String city; |
| | | private String country; |
| | | private String stationName; |
| | | private String powerName; |
| | | private String company; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseTime; |
| | | private String stationType; |
| | | private String groupName; |
| | | private String performanceName;//电池性能:1优秀,2劣化,3损坏 4未放电 不传全部 |
| | | } |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.dto.PowerDto; |
| | | import com.whyc.dto.Statistic.Pwr7Stic; |
| | | import com.whyc.dto.Statistic.StationStic; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | | import com.whyc.pojo.db_station.StationInf; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | List<PowerInf> getPowerStatistic(@Param("stic") StationStic stic); |
| | | //查询机房所在的班组 |
| | | String getGroupName(Integer powerId); |
| | | |
| | | //优良电源数量统计(1.2.7) |
| | | List<PowerInf> getPwr7Statistic(@Param("stic") Pwr7Stic stic); |
| | | } |
| | |
| | | public List<BattInf> getDischrChart(Integer uid) { |
| | | return mapper.getDischrChart(uid); |
| | | } |
| | | //优良电源数量统计(1.2.7) |
| | | public List<BattInf> getPwr7Statistic(Pwr7Stic stic) { |
| | | return mapper.getPwr7Statistic(stic); |
| | | } |
| | | } |
| | |
| | | import com.whyc.pojo.db_ram_db.BattRtdata; |
| | | import com.whyc.pojo.db_ram_db.BattRtstate; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | | import com.whyc.pojo.db_user.Baojigroup; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.PageInfoUtils; |
| | |
| | | @Autowired(required = false) |
| | | private BaojigroupService bjService; |
| | | |
| | | @Autowired(required = false) |
| | | private PowerInfService powerInfService; |
| | | |
| | | |
| | | @Autowired(required = false) |
| | | private PwrdevHistorydataIdService pwrHisdataIdService; |
| | | |
| | | |
| | | //获取最后一次测试数据并计算剩余容量 |
| | |
| | | } |
| | | //优良电源数量统计(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(); |
| | | //1查询符合条件的电池组 |
| | | List<PowerInf> pinfList=powerInfService.getPwr7Statistic(stic); |
| | | if(pinfList==null||pinfList.size()==0){ |
| | | return new Response().set(1,false,"当前用户未管理满足条件的电池组"); |
| | | } |
| | | if(param.getParamNamePsx().equals("batt_mon_damage_val")){ |
| | | damageValue=param.getParamValue(); |
| | | List<SticPwr7Res> reslist=new ArrayList<>(); |
| | | for (PowerInf pinf:pinfList) { |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | //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)"); |
| | | } |
| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.PowerDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.Statistic.Pwr7Stic; |
| | | import com.whyc.dto.Statistic.StationStic; |
| | | import com.whyc.mapper.BaojigroupPowerMapper; |
| | | import com.whyc.mapper.BaojigroupUsrMapper; |
| | |
| | | PageInfo<PowerInf> pageInfo=new PageInfo<>(list); |
| | | return new Response().setII(1,list.size()>0,pageInfo,"电源信息统计"); |
| | | } |
| | | //优良电源数量统计(1.2.7) |
| | | public List<PowerInf> getPwr7Statistic(Pwr7Stic stic) { |
| | | return mapper.getPwr7Statistic(stic); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.Real.CompareDto; |
| | | import com.whyc.dto.Real.PwrHisRealAcInDto; |
| | | import com.whyc.dto.Real.PwrHisRealDcoutInDto; |
| | | import com.whyc.dto.Real.QuarterDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.Statistic.QuarterPwr7Res; |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_data_history.PwrdevHistorydataId; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class PwrdevHistorydataIdService { |
| | |
| | | } |
| | | return new Response().setIII(1,datalist.size()>0,datalist,modelCfg,"获取半小时内直流输出统计"); |
| | | } |
| | | //1.2.7优良电源统计上一季度的电源某一属性和参数阈值超过的次数 |
| | | public Map<String,Integer> getPwrQuarter7(Integer powerId, Map<String,Float> paramValue) { |
| | | Map<String,Integer> map=new HashMap<>(); |
| | | map.put("acin1Vola",0); |
| | | map.put("acoutVola",0); |
| | | map.put("dcoutVol",0); |
| | | map.put("dcoutCurr",0); |
| | | List<String> datelist = ActionUtil.getLastQuarterYearMonths(); |
| | | for (int i=0;i<datelist.size();i++) { |
| | | String date=datelist.get(i); |
| | | String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+date; |
| | | String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+date); |
| | | //判断表是否存在 |
| | | if(existTableName == null){ |
| | | continue; |
| | | } |
| | | List<QuarterPwr7Res> datalist=subTablePageInfoService.getPwrQuarter7(tableName); |
| | | // 遍历 dataList 并比较属性值 |
| | | for (QuarterPwr7Res data : datalist) { |
| | | if (data.getAcin1Vola() > paramValue.get("acin1Vola")) { |
| | | map.put("acin1Vola", map.get("acin1Vola") + 1); |
| | | } |
| | | if (data.getAcoutVola() > paramValue.get("acoutVola")) { |
| | | map.put("acoutVola", map.get("acoutVola") + 1); |
| | | } |
| | | if (data.getDcoutVol() > paramValue.get("dcoutVol")) { |
| | | map.put("dcoutVol", map.get("dcoutVol") + 1); |
| | | } |
| | | if (data.getDcoutCurr() > paramValue.get("dcoutCurr")) { |
| | | map.put("dcoutCurr", map.get("dcoutCurr") + 1); |
| | | } |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | } |
| | |
| | | import com.whyc.dto.AlmHis.DevAlmPar; |
| | | import com.whyc.dto.AlmHis.PwrAlmPar; |
| | | import com.whyc.dto.Real.*; |
| | | import com.whyc.dto.Statistic.QuarterPwr7Res; |
| | | import com.whyc.mapper.CallBack; |
| | | import com.whyc.pojo.db_alarm.BattalarmDataHistory; |
| | | import com.whyc.pojo.db_alarm.DevalarmDataHistory; |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | //1.2.7优良电源统计上一季度的电源某一属性和参数阈值超过的次数 |
| | | public List<QuarterPwr7Res> getPwrQuarter7(String tableName) { |
| | | String sql=" select distinct record_datetime,acin1_vola,acout_vola,dcout_vol,dcout_curr " + |
| | | " from "+tableName+" " ; |
| | | sql+=" order by record_datetime asc"; |
| | | List<QuarterPwr7Res> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<QuarterPwr7Res> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | QuarterPwr7Res data=new QuarterPwr7Res(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_datetime")); |
| | | data.setAcin1Vola(rs.getFloat("acin1_vola")); |
| | | data.setAcoutVola(rs.getFloat("acout_vola")); |
| | | data.setDcoutVol(rs.getFloat("dcout_vol")); |
| | | data.setDcoutCurr(rs.getFloat("dcout_curr")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | 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> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getPwr7Statistic" resultType="com.whyc.pojo.db_station.PowerInf"> |
| | | select distinct tb_power_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_power_inf,db_station.tb_station_inf |
| | | <where> |
| | | tb_power_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.stationType!=null"> |
| | | and tb_station_inf.station_type=#{stic.stationType} |
| | | </if> |
| | | <if test="stic.company!=null"> |
| | | and tb_power_inf.company=#{stic.company} |
| | | </if> |
| | | <if test="stic.inuseStartTime!=null"> |
| | | and tb_power_inf.power_inuse_time>=#{stic.inuseStartTime} |
| | | </if> |
| | | <if test="stic.inuseEndTime!=null"> |
| | | and tb_power_inf.power_inuse_time<=#{stic.inuseEndTimee} |
| | | </if> |
| | | <if test="stic.uid>100"> |
| | | and tb_power_inf.power_id in( |
| | | select distinct power_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_power_inf.power_id asc |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |