src/main/java/com/whyc/service/FileParamService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/util/MathUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/service/FileParamService.java
@@ -6,6 +6,7 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.config.I18nLocaleResolver; import com.whyc.dto.*; import com.whyc.mapper.*; import com.whyc.pojo.*; @@ -39,6 +40,9 @@ @Autowired(required = false) private BattgroupInfoMapper groupInfoMapper; @Autowired private I18nLocaleResolver i18nLocaleResolver; //解析xml文件(传参一个文件) public Response getXmlValue(String filePath) { @@ -157,6 +161,8 @@ } //按照筛选条件查询数据库信息(内阻评价:内阻越大越差),然后再根据内阻手动分页 public Response getDataByCondition(Date testTime1, Date testTime2, String battVol,int pageCurr,int pageSize,int flag) { Locale local = i18nLocaleResolver.getLocal(); boolean zhFlag = local.getLanguage().toLowerCase().equals("zh"); //PageHelper.startPage(pageCurr,pageSize); List<FileParam> list=mapper.getDataByCondition(testTime1,testTime2,Float.valueOf(battVol)); List flagList=new ArrayList();//存放评价结果 @@ -192,7 +198,7 @@ binfo.setSdBasebs(MathUtil.getStandardDeviation(listBs)); binfo.setSdBasecr(MathUtil.getStandardDeviation(listCr)); resFlag=MathUtil.getflag(maxStd,std,testParam); binfo.setBrJudge(MathUtil.getJudge(resFlag)); binfo.setBrJudge(MathUtil.getJudge(zhFlag,resFlag)); } break; } src/main/java/com/whyc/util/MathUtil.java
@@ -1,11 +1,14 @@ package com.whyc.util; import com.whyc.config.I18nLocaleResolver; import com.whyc.pojo.TestParam; import org.springframework.beans.factory.annotation.Autowired; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.stream.Collectors; public class MathUtil { @@ -45,12 +48,38 @@ return flag; } //评判整组的好坏flag:1 电压; 内阻越大越不好 public static String getJudge(int flag){ String judge="未知"; public static String getJudge(boolean zhFlag,int flag){ String judge=""; if(zhFlag) { judge="未知"; }else{ judge="unknown"; } switch (flag){ case 1:judge="差";break; /*case 1:judge="差";break; case 2:judge="良";break; case 3:judge="优";break; case 3:judge="优";break;*/ case 1: if(zhFlag) { judge="差"; }else{ judge="bad"; } break; case 2: if(zhFlag) { judge="良"; }else{ judge="good"; } break; case 3: if(zhFlag) { judge="优"; }else{ judge="excellent"; } break; } return judge; }