lxw
2022-10-12 a286459eb8af29cf3347e4dbf532a6a66d6cd3c6
src/main/java/com/whyc/service/FileParamService.java
@@ -6,11 +6,10 @@
import com.github.pagehelper.PageInfo;
import com.whyc.dto.*;
import com.whyc.mapper.BattGroupDataMapper;
import com.whyc.mapper.FileInfoMapper;
import com.whyc.mapper.FileParamMapper;
import com.whyc.pojo.BattgroupData;
import com.whyc.pojo.BattgroupInfo;
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;
@@ -30,6 +29,12 @@
    @Autowired(required = false)
    private FileParamMapper paramMapper;
    @Autowired(required = false)
    private FileInfoMapper infoMapper;
    @Autowired(required = false)
    private TestParamMapper testParamMapper;
    //解析xml文件(传参一个文件)
    public Response getXmlValue(String filePath) {
@@ -130,12 +135,18 @@
    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();
@@ -146,11 +157,15 @@
                                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));
                        }
                    }
                }
@@ -171,6 +186,8 @@
        dataMapper.deleteDataAndInfo(stationId,fileId);
        //删除所有文件参数
        paramMapper.deleteParamByFileId(fileId);
        //移除机房下挂在的文件
        infoMapper.deleteFileInStation(stationId,fileId);
        return new Response().set(1,"删除成功!");
    }
}