| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.constant.PwrCapperformanceEnum; |
| | | import com.whyc.dto.Real.CompareDto; |
| | | import com.whyc.dto.Real.PwrHisRealAcInDto; |
| | | import com.whyc.dto.Real.PwrHisRealDcoutInDto; |
| | |
| | | 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()); |
| | | paramValues.put(param.getPropertyName()+"_lower", param.getBasisVal()*param.getAlarmLimitlLower()); |
| | | map.put(param.getPropertyName(), 0); |
| | | } |
| | | for (int i=0;i<datelist.size();i++) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | //判断优良电源性能 |
| | | int pwrPerformence=judgePwrPerformence(map); |
| | | return pwrPerformence; |
| | | } |
| | | //判断优良电源性能 |
| | | private Integer judgePwrPerformence(Map<String,Integer> map){ |
| | |
| | | warningVal=appParam.getParamValue(); |
| | | } |
| | | } |
| | | return 1; |
| | | Integer performance = PwrCapperformanceEnum.PWRSTATE_1.getStateId(); // 初始化为最优等级 |
| | | for (Map.Entry<String, Integer> entry : map.entrySet()) { |
| | | Integer level = evaluateValue(entry.getValue(), excellentVal, commonlyVal, warningVal); |
| | | // 根据等级排序确定当前是否是最差等级 |
| | | if (PwrCapperformanceEnum.PWRSTATE_4.getStateId()==level) { |
| | | performance = PwrCapperformanceEnum.PWRSTATE_4.getStateId(); |
| | | return performance; // 一旦出现差,直接返回 |
| | | } else if (PwrCapperformanceEnum.PWRSTATE_3.getStateId()==level && PwrCapperformanceEnum.PWRSTATE_4.getStateId()!=performance) { |
| | | performance = PwrCapperformanceEnum.PWRSTATE_3.getStateId(); |
| | | } else if (PwrCapperformanceEnum.PWRSTATE_2.getStateId()==level &&(PwrCapperformanceEnum.PWRSTATE_3.getStateId()!=performance||PwrCapperformanceEnum.PWRSTATE_4.getStateId()!=performance)) { |
| | | performance = PwrCapperformanceEnum.PWRSTATE_2.getStateId(); |
| | | } |
| | | } |
| | | return performance; |
| | | } |
| | | // 判断单个值的等级 |
| | | public Integer evaluateValue(Integer value, Float excellentVal, Float commonlyVal, Float warningVal) { |
| | | if (value <= excellentVal) { |
| | | return PwrCapperformanceEnum.PWRSTATE_1.getStateId(); |
| | | } else if (value <= commonlyVal&&value > excellentVal) { |
| | | return PwrCapperformanceEnum.PWRSTATE_2.getStateId(); |
| | | } else if (value <= warningVal&&value > commonlyVal) { |
| | | return PwrCapperformanceEnum.PWRSTATE_3.getStateId(); |
| | | } else { |
| | | return PwrCapperformanceEnum.PWRSTATE_4.getStateId(); |
| | | } |
| | | } |
| | | } |