| | |
| | | @PostMapping("getBattAlmParam") |
| | | @ApiOperation("获取电池告警参数") |
| | | public Response getBattAlmParam(@RequestBody ParamAlmDto dto){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | dto.setUid(uid); |
| | | return battAlmparamService.getBattAlmParam(dto); |
| | | } |
| | | |
| | |
| | | @PostMapping("getPwrAlmParam") |
| | | @ApiOperation("获取电源告警参数") |
| | | public Response getPwrAlmParam(@RequestBody ParamAlmDto dto){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | dto.setUid(uid); |
| | | return pwrAlmparamService.getPwrAlmParam(dto); |
| | | } |
| | | |
| | |
| | | private String country; |
| | | private String stationName; |
| | | private String company; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseStartTime;//开始时间 |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseEndTime;//结束时间 |
| | | //投入使用年限 |
| | | //全部不传 |
| | | //3年内 0~3年 3 |
| | | //5年内 0~5年 5 |
| | | //5年上 5年以上 1 |
| | | private Integer inuseYear; |
| | | private Date pwrInUseTime; |
| | | private String stationType; |
| | | private Integer performance;//电池性能:1优秀,2劣化,3损坏 4未放电 不传全部 |
| | | private Integer performance;//电池性能:1优秀,2一般,3预警 4严重 不传全部 |
| | | private String groupName; |
| | | private Integer uid; |
| | | private Integer pageNum; |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private Date recordDatetime; |
| | | private Float acin1Vola; |
| | | private Float acoutVola; |
| | | private Float acoutCurra; |
| | | private Float dcoutVol; |
| | | private Float dcoutCurr; |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_param.ApptimeParam; |
| | | |
| | | public interface ApptimeParamMapper extends CustomMapper<ApptimeParam>{ |
| | | } |
| | |
| | | //获取站点下的电池组(下拉) |
| | | List<BattInf> getBattByUid(@Param("uid") Integer uid, @Param("provice") String provice, @Param("city") String city, @Param("country") String country, @Param("stationName") String stationName); |
| | | //根据查询条件获取电池组集合 |
| | | List<Integer> getBattgroupIdList(@Param("dto") ParamAlmDto dto); |
| | | BattInf getBattgroupIdList(@Param("battgroupId") Integer battgroupId); |
| | | } |
| | |
| | | |
| | | List<PowerInf> getListByUserId(Integer userId); |
| | | //根据查询条件获取电源集合 |
| | | List<Integer> getPowerIdList(@Param("dto") ParamAlmDto dto); |
| | | PowerInf getPowerIdList(@Param("powerId") Integer powerId); |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_param.PowerPropertyParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PowerPropertyParamMapper extends CustomMapper<PowerPropertyParam>{ |
| | | //获取电源优良判断的标准参数值 |
| | | List<PowerPropertyParam> getPwrStandardParam(Integer powerType); |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.db_param; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 平台时间参数设置表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2025-06-19 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_param",value ="tb_apptime_param") |
| | | @ApiModel(value="ApptimeParam对象", description="平台时间参数设置表") |
| | | public class ApptimeParam implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "自增主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "参数名称") |
| | | private String paramName; |
| | | |
| | | @ApiModelProperty(value = "设置时间参数") |
| | | private Date paramValue; |
| | | |
| | | @ApiModelProperty(value = "参数类别") |
| | | private Integer categoryId; |
| | | |
| | | @ApiModelProperty(value = "参数英文名称") |
| | | private String paramNamePsx; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.db_param; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 电源性能评估参考字段配置表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2025-06-19 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_param",value ="tb_power_property_param") |
| | | @ApiModel(value="PowerPropertyParam对象", description="电源性能评估参考字段配置表") |
| | | public class PowerPropertyParam implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "自增主键") |
| | | @TableId(value = "num", type = IdType.AUTO) |
| | | private Long num; |
| | | |
| | | @ApiModelProperty(value = "1:直流,2:通信,3配网") |
| | | private Integer powerType; |
| | | |
| | | @ApiModelProperty(value = "字段名称") |
| | | private String propertyName; |
| | | |
| | | @ApiModelProperty(value = "字段中文名称") |
| | | private String propertyNameZh; |
| | | |
| | | @ApiModelProperty(value = "字段使能[0-未启用 1-启用]") |
| | | private Integer fieldEn; |
| | | |
| | | @TableField(exist = false) |
| | | private Float basisVal; |
| | | |
| | | @TableField(exist = false) |
| | | private Float alarmLimithUpper; |
| | | |
| | | @TableField(exist = false) |
| | | private Float alarmLimithLowper; |
| | | } |
| | |
| | | private Float alarmLimith; |
| | | |
| | | @ApiModelProperty(value = "上上限阈值") |
| | | private Float alarmLimithUpeper; |
| | | private Float alarmLimithUpper; |
| | | |
| | | @ApiModelProperty(value = "下限阈值") |
| | | private Float alarmLimitl; |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.mapper.ApptimeParamMapper; |
| | | import com.whyc.pojo.db_param.ApptimeParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class ApptimeParamService { |
| | | @Autowired(required = false) |
| | | private ApptimeParamMapper mapper; |
| | | |
| | | public ApptimeParam getPwrPerformanceStrartTime(Integer powerId) { |
| | | QueryWrapper apptimeParamWrapper=new QueryWrapper(); |
| | | apptimeParamWrapper.eq("param_name_psx","power_performance_strart_time"); |
| | | apptimeParamWrapper.last("limit 1"); |
| | | ApptimeParam apptimeParam=mapper.selectOne(apptimeParamWrapper); |
| | | return apptimeParam; |
| | | } |
| | | } |
| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattAlmparamMapper; |
| | | import com.whyc.pojo.db_param.BattAlmparam; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class BattAlmparamService { |
| | |
| | | //获取电池告警参数 |
| | | public Response getBattAlmParam(ParamAlmDto dto) { |
| | | //根据查询条件获取电池组集合 |
| | | List<Integer> idList=binfService.getBattgroupIdList(dto); |
| | | BattInf binf=binfService.getBattgroupIdList(dto.getBattgroupId()); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | if(idList!=null){ |
| | | wrapper.in("battgroup_id",idList); |
| | | } |
| | | wrapper.eq("battgroup_id",dto.getBattgroupId()); |
| | | if(dto.getAlmIdList()!=null){ |
| | | wrapper.in("alm_id",dto.getAlmIdList()); |
| | | } |
| | |
| | | //PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); |
| | | List<BattAlmparam> list = mapper.selectList(wrapper); |
| | | //PageInfo<BattAlmparam> pageInfo=new PageInfo<>(list); |
| | | return new Response().setII(1,list!=null,list,"获取电池告警参数"); |
| | | return new Response().setIII(1,list!=null,list,binf,"获取电池告警参数"); |
| | | } |
| | | //修改电池告警参数 |
| | | public Response setBattAlmParam(List<BattAlmparam> almparamList) { |
| | |
| | | return new Response().setII(1,list.size()>0,list,"获取站点下的电池组(下拉)"); |
| | | } |
| | | //根据查询条件获取电池组集合 |
| | | public List<Integer> getBattgroupIdList(ParamAlmDto dto) { |
| | | return mapper.getBattgroupIdList(dto); |
| | | public BattInf getBattgroupIdList(Integer battgroupId) { |
| | | return mapper.getBattgroupIdList(battgroupId); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | } |
| | | //优良电源数量统计(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)"); |
| | | } |
| | |
| | | return mapper.getListByUserId(userId); |
| | | } |
| | | //根据查询条件获取电源集合 |
| | | public List<Integer> getPowerIdList(ParamAlmDto dto) { |
| | | return mapper.getPowerIdList(dto); |
| | | public PowerInf getPowerIdList(Integer powerId) { |
| | | return mapper.getPowerIdList(powerId); |
| | | } |
| | | //获取电源性能(下拉) |
| | | public Response getPwrCapperformance() { |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.mapper.PowerPropertyParamMapper; |
| | | import com.whyc.pojo.db_param.PowerPropertyParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PowerPropertyParamService { |
| | | @Autowired(required = false) |
| | | private PowerPropertyParamMapper mapper; |
| | | |
| | | //获取电源优良判断的标准参数值 |
| | | public List<PowerPropertyParam> getPwrStandardParam(Integer powerType) { |
| | | List<PowerPropertyParam> list = mapper.getPwrStandardParam(powerType); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | import com.whyc.mapper.PwrdevAlarmParamMapper; |
| | | import com.whyc.pojo.db_param.BattAlmparam; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | //获取电源告警参数 |
| | | public Response getPwrAlmParam(ParamAlmDto dto) { |
| | | //根据查询条件获取电源集合 |
| | | List<Integer> idList=pinfService.getPowerIdList(dto); |
| | | PowerInf pinf=pinfService.getPowerIdList(dto.getPowerId()); |
| | | /*Map<String, List<PwrdevAlarmParam>> map=new HashMap<>(); |
| | | List<PwrdevAlarmParam> almmap30=new ArrayList<>(); |
| | | List<PwrdevAlarmParam> almmap31=new ArrayList<>(); |
| | |
| | | List<PwrdevAlarmParam> almmap35=new ArrayList<>(); |
| | | List<PwrdevAlarmParam> almmap36=new ArrayList<>();*/ |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | if(idList!=null){ |
| | | wrapper.in("power_id",idList); |
| | | } |
| | | wrapper.eq("power_id",dto.getPowerId()); |
| | | if(dto.getAlmIdList()!=null){ |
| | | wrapper.in("alm_id",dto.getAlmIdList()); |
| | | } |
| | |
| | | } |
| | | } |
| | | // PageInfo<PwrdevAlarmParam> pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,list,"获取电源告警参数"); |
| | | return new Response().setIII(1,list!=null,list,pinf,"获取电源告警参数"); |
| | | } |
| | | //修改电源告警参数 |
| | | public Response setPwrAlmParam(List<PwrdevAlarmParam> almparamList) { |
| | |
| | | if(stand.getAlarmLimitl()!=null){ |
| | | wrapper.set("alarm_limitl",stand.getAlarmLimitl()); |
| | | } |
| | | if(stand.getAlarmLimithUpeper()!=null){ |
| | | wrapper.set("alarm_limith_upeper",stand.getAlarmLimithUpeper()); |
| | | if(stand.getAlarmLimithUpper()!=null){ |
| | | wrapper.set("alarm_limith_upper",stand.getAlarmLimithUpper()); |
| | | } |
| | | if(stand.getAlarmLimitlLower()!=null){ |
| | | wrapper.set("alarm_limitl_lower",stand.getAlarmLimitlLower()); |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.dto.Real.CompareDto; |
| | | import com.whyc.dto.Real.PwrHisRealAcInDto; |
| | | import com.whyc.dto.Real.PwrHisRealDcoutInDto; |
| | |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_data_history.PwrdevHistorydataId; |
| | | import com.whyc.pojo.db_param.ApptimeParam; |
| | | import com.whyc.pojo.db_param.PowerPropertyParam; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private PowerInfService powerInfService; |
| | | |
| | | @Autowired |
| | | private ApptimeParamService apptimeParamService; |
| | | |
| | | @Autowired |
| | | private PowerPropertyParamService propertyParamService; |
| | | |
| | | //系统概览获取半小时交流输入统计 |
| | | public Response getHalfHourPwrHisAcinData(Integer powerId,Integer granularity) { |
| | |
| | | return new Response().setIII(1,datalist.size()>0,datalist,modelCfg,"获取半小时内直流输出统计"); |
| | | } |
| | | //1.2.7优良电源统计上一季度的电源某一属性和参数阈值超过的次数 |
| | | public Map<String,Integer> getPwrQuarter7(Integer powerId, Map<String,Float> paramValue) { |
| | | public Integer getPwrQuarter7(Integer powerId,Integer powerType) { |
| | | Map<String,Integer> map=new HashMap<>(); |
| | | map.put("acin1Vola",0); |
| | | map.put("acoutVola",0); |
| | | map.put("acin1_vola",0); |
| | | map.put("acout_curra",0); |
| | | map.put("dcoutVol",0); |
| | | map.put("dcoutCurr",0); |
| | | List<String> datelist = ActionUtil.getLastQuarterYearMonths(); |
| | | //获取优良电源性能统计在平台上的时间参数设置表 |
| | | ApptimeParam apptimeParam=apptimeParamService.getPwrPerformanceStrartTime(powerId); |
| | | //获取指定时间到当前时间一共多少月的集合 |
| | | List<String> datelist=ActionUtil.getDateListBetweenDates(apptimeParam.getParamValue(), new Date()); |
| | | //获取电源优良判断的标准参数值 |
| | | List<PowerPropertyParam> paramList=propertyParamService.getPwrStandardParam(powerType); |
| | | Map<String,Float> paramValues=new HashMap<>(); |
| | | for (PowerPropertyParam param : paramList) { |
| | | paramValues.put(param.getPropertyName()+"_upper", param.getBasisVal()*param.getAlarmLimithUpper()); |
| | | paramValues.put(param.getPropertyName()+"_lower", param.getBasisVal()*param.getAlarmLimithLowper()); |
| | | } |
| | | for (int i=0;i<datelist.size();i++) { |
| | | String date=datelist.get(i); |
| | | String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+date; |
| | |
| | | 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(paramValues.get("acin1_vola_upper")!=null){ |
| | | if ((data.getAcin1Vola() > paramValues.get("acin1_vola_upper"))||(data.getAcin1Vola() < paramValues.get("acin1_vola_lower"))) { |
| | | map.put("acin1_vola", map.get("acin1_vola") + 1); |
| | | } |
| | | } |
| | | if (data.getAcoutVola() > paramValue.get("acoutVola")) { |
| | | map.put("acoutVola", map.get("acoutVola") + 1); |
| | | if(paramValues.get("acout_curra_upper")!=null) { |
| | | if ((data.getAcoutCurra() > paramValues.get("acout_curra_upper")) || (data.getAcoutCurra() < paramValues.get("acout_curra_lower"))) { |
| | | map.put("acout_curra", map.get("acout_curra") + 1); |
| | | } |
| | | } |
| | | if (data.getDcoutVol() > paramValue.get("dcoutVol")) { |
| | | map.put("dcoutVol", map.get("dcoutVol") + 1); |
| | | if(paramValues.get("dcout_vol_upper")!=null) { |
| | | if ((data.getDcoutVol() > paramValues.get("dcout_vol_upper")) || (data.getDcoutVol() < paramValues.get("dcout_vo_lower"))) { |
| | | map.put("dcout_vol", map.get("dcout_vol") + 1); |
| | | } |
| | | } |
| | | if (data.getDcoutCurr() > paramValue.get("dcoutCurr")) { |
| | | map.put("dcoutCurr", map.get("dcoutCurr") + 1); |
| | | if(paramValues.get("dcout_curr_upper")!=null) { |
| | | if ((data.getDcoutCurr() > paramValues.get("dcout_curr_upper")) || (data.getDcoutCurr() < paramValues.get("dcout_curr_lower"))) { |
| | | map.put("dcout_curr", map.get("dcout_curr") + 1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return map; |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | } |
| | | //1.2.7优良电源统计上一季度的电源某一属性和参数阈值超过的次数 |
| | | public List<QuarterPwr7Res> getPwrQuarter7(String tableName) { |
| | | String sql=" select distinct record_datetime,acin1_vola,acout_vola,dcout_vol,dcout_curr " + |
| | | String sql=" select distinct record_datetime,acin1_vola,acout_curra,dcout_vol,dcout_curr " + |
| | | " from "+tableName+" " ; |
| | | sql+=" order by record_datetime asc"; |
| | | List<QuarterPwr7Res> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | |
| | | QuarterPwr7Res data=new QuarterPwr7Res(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_datetime")); |
| | | data.setAcin1Vola(rs.getFloat("acin1_vola")); |
| | | data.setAcoutVola(rs.getFloat("acout_vola")); |
| | | data.setAcoutCurra(rs.getFloat("acout_curra")); |
| | | data.setDcoutVol(rs.getFloat("dcout_vol")); |
| | | data.setDcoutCurr(rs.getFloat("dcout_curr")); |
| | | list.add(data); |
| | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | |
| | | public static String time_yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; |
| | | public static String time_yyyyMMdd = "yyyy-MM-dd"; |
| | | public static String time_yyyyMM = "yyyy-MM"; |
| | | public static String time_yyyyMMdd_HH_mm_ss = "yyyy-MM-dd_HH_mm_ss"; |
| | | public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | public static SimpleDateFormat sdfwithOutday = new SimpleDateFormat("yyyy_MM"); |
| | |
| | | } |
| | | return lang; |
| | | } |
| | | //两时间之间的年月集合 |
| | | public static List<String> getDateListBetweenDates(Date startTime, Date endTime) { |
| | | // 指定开始日期和结束日期 |
| | | LocalDate startDate = LocalDate.of(startTime.getYear() + 1900, startTime.getMonth() + 1, startTime.getDay()); // 示例起始日期 |
| | | LocalDate endDate = LocalDate.of(endTime.getYear() + 1900, endTime.getMonth() + 1, endTime.getDay()); // 示例结束日期 |
| | | |
| | | List<String> dateList = new ArrayList<>(); |
| | | LocalDate currentDate = startDate; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(ActionUtil.time_yyyyMM); |
| | | while (!currentDate.isAfter(endDate)) { |
| | | String formattedDate = currentDate.format(formatter); |
| | | dateList.add(formattedDate); |
| | | currentDate = currentDate.plusMonths(1); |
| | | } |
| | | return dateList; |
| | | } |
| | | |
| | | public static void main(String[] args) throws ParseException { |
| | | List<String> dateList =getDateListBetweenDates(ActionUtil.sdf.parse("2025-01-01 00:00:00"),new Date()); |
| | | for (String date : dateList) { |
| | | System.out.println(date); |
| | | } |
| | | } |
| | | } |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getBattgroupIdList" resultType="java.lang.Integer"> |
| | | select distinct battgroup_id from db_station.tb_batt_inf,db_station.tb_station_inf |
| | | <select id="getBattgroupIdList" 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="dto.provice!=null"> |
| | | and tb_station_inf.provice=#{dto.provice} |
| | | </if> |
| | | <if test="dto.city!=null"> |
| | | and tb_station_inf.city=#{dto.city} |
| | | </if> |
| | | <if test="dto.country!=null"> |
| | | and tb_station_inf.country=#{dto.country} |
| | | </if> |
| | | <if test="dto.stationId!=null"> |
| | | and tb_station_inf.station_id=#{dto.stationId} |
| | | </if> |
| | | <if test="dto.battgroupId!=null"> |
| | | and battgroup_id.battgroup_id=#{dto.battgroupId} |
| | | </if> |
| | | <if test="dto.uid>100"> |
| | | and tb_station_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=#{dto.uid} |
| | | ) |
| | | <if test="battgroupId!=null"> |
| | | and tb_batt_inf.battgroup_id=#{battgroupId} |
| | | </if> |
| | | </where> |
| | | limit 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | <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 test="stic.inuseYear!=null"> |
| | | <if test="stic.inuseYear==1"> |
| | | and tb_power_inf.power_inuse_time<=#{stic.pwrInUseTime} |
| | | </if> |
| | | <if test="stic.inuseYear!=1"> |
| | | and tb_power_inf.power_inuse_time>=#{stic.pwrInUseTime} |
| | | </if> |
| | | </if> |
| | | <if test="stic.uid>100"> |
| | | and tb_power_inf.power_id in( |
| | |
| | | and bu.uid = #{userId} |
| | | ) |
| | | </select> |
| | | <select id="getPowerIdList" resultType="java.lang.Integer"> |
| | | select distinct power_id from db_station.tb_power_inf,db_station.tb_station_inf |
| | | <select id="getPowerIdList" 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="dto.provice!=null"> |
| | | and tb_station_inf.provice=#{dto.provice} |
| | | </if> |
| | | <if test="dto.city!=null"> |
| | | and tb_station_inf.city=#{dto.city} |
| | | </if> |
| | | <if test="dto.country!=null"> |
| | | and tb_station_inf.country=#{dto.country} |
| | | </if> |
| | | <if test="dto.stationId!=null"> |
| | | and tb_station_inf.station_id=#{dto.stationId} |
| | | </if> |
| | | <if test="dto.powerId!=null"> |
| | | and tb_power_inf.power_id=#{dto.powerId} |
| | | </if> |
| | | <if test="dto.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=#{dto.uid} |
| | | ) |
| | | <if test="powerId!=null"> |
| | | and tb_power_inf.power_id=#{powerId} |
| | | </if> |
| | | </where> |
| | | limit 1 |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.PowerPropertyParamMapper"> |
| | | |
| | | <select id="getPwrStandardParam" resultType="com.whyc.pojo.db_param.PowerPropertyParam"> |
| | | select tb_power_property_param.* |
| | | ,tb_pwrdev_alarm_param_stand.basis_val,tb_pwrdev_alarm_param_stand.alarm_limith_upper,tb_pwrdev_alarm_param_stand.alarm_limitl_lower |
| | | from db_param.tb_power_property_param,db_pwrdev_alarm.tb_pwrdev_alarm_param_stand |
| | | where tb_power_property_param.property_name=tb_pwrdev_alarm_param_stand.property_name |
| | | and tb_power_property_param.power_type=#{powerType} |
| | | </select> |
| | | </mapper> |