| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.*; |
| | | import com.whyc.mapper.BattGroupDataMapper; |
| | | import com.whyc.mapper.FileParamMapper; |
| | | import com.whyc.pojo.FileInfo; |
| | | import com.whyc.pojo.FileParam; |
| | | import com.whyc.mapper.TestParamMapper; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.MathUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | public class FileParamService { |
| | | @Autowired(required = false) |
| | | private FileParamMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private BattGroupDataMapper dataMapper; |
| | | |
| | | @Autowired(required = false) |
| | | private FileParamMapper paramMapper; |
| | | |
| | | @Autowired(required = false) |
| | | private TestParamMapper testParamMapper; |
| | | |
| | | //解析xml文件(传参一个文件) |
| | | public Response getXmlValue(String filePath) { |
| | |
| | | return new Response().setII(1,list.size()>0,list,"返回所有的标称电压类型"); |
| | | } |
| | | //按照筛选条件查询数据库信息 |
| | | public Response getDataByCondition(Date testTime1, Date testTime2, int battVol) { |
| | | List<FileParam> list=mapper.getDataByCondition(testTime1,testTime2,battVol); |
| | | return new Response().setII(1,list.size()>0,list,"筛选数据库信息"); |
| | | public Response getDataByCondition(Date testTime1, Date testTime2, int battVol,int pageCurr,int pageSize) { |
| | | PageHelper.startPage(pageCurr,pageSize); |
| | | List<FileParam> list=mapper.getDataByCondition(testTime1,testTime2,battVol); |
| | | QueryWrapper testParamWrapper=new QueryWrapper(); |
| | | testParamWrapper.eq("enabled",1); |
| | | TestParam testParam=testParamMapper.selectOne(testParamWrapper); |
| | | float std=0f; |
| | | if(list!=null&&list.size()>0){ |
| | | for (FileParam fparam:list) { |
| | | List<BattgroupInfo> binfInfoList=fparam.getBattInfoList(); |
| | | std=fparam.getBattRes(); |
| | | if(binfInfoList!=null&&binfInfoList.size()>0){ |
| | | for (BattgroupInfo binfo:binfInfoList) { |
| | | List<BattgroupData> binfDataList=binfo.getBattDataList(); |
| | | float minStd=9999999.0f; |
| | | List listBv=new ArrayList(); |
| | | List listBr=new ArrayList(); |
| | | List listBs=new ArrayList(); |
| | | List listCr=new ArrayList(); |
| | | if(binfDataList!=null&&binfDataList.size()>0) { |
| | | for (BattgroupData bData : binfDataList) { |
| | | listBv.add(bData.getBv()); |
| | | listBr.add(bData.getBr()); |
| | | listBs.add(bData.getBs()); |
| | | listCr.add(bData.getCr()); |
| | | if(bData.getBr()<=minStd){ |
| | | minStd=bData.getBr(); |
| | | } |
| | | } |
| | | binfo.setSdBasebv(MathUtil.getStandardDeviation(listBv)); |
| | | binfo.setSdBasebr(MathUtil.getStandardDeviation(listBr)); |
| | | binfo.setSdBasebs(MathUtil.getStandardDeviation(listBs)); |
| | | binfo.setSdBasecr(MathUtil.getStandardDeviation(listCr)); |
| | | binfo.setBrJudge(MathUtil.getJudge(minStd,std,testParam)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list.size()>0,pageInfo,"筛选数据库信息"); |
| | | } |
| | | |
| | | |
| | | public FileParam getByFileId(String fileId) { |
| | | QueryWrapper<FileParam> query = Wrappers.query(); |
| | | query.eq("file_id",fileId).last(" limit 1"); |
| | | return mapper.selectOne(query); |
| | | } |
| | | //删除基站下数据 |
| | | public Response deleteDataById(int stationId, int fileId) { |
| | | //删除所有文件数据(指定机房id和文件id) |
| | | dataMapper.deleteDataAndInfo(stationId,fileId); |
| | | //删除所有文件参数 |
| | | paramMapper.deleteParamByFileId(fileId); |
| | | return new Response().set(1,"删除成功!"); |
| | | } |
| | | } |