| | |
| | | import com.whyc.pojo.AnaylsisId; |
| | | import com.whyc.pojo.AnaysisData; |
| | | import com.whyc.pojo.BatttestdataId; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.AnalysisUtil; |
| | | import org.apache.poi.hssf.usermodel.*; |
| | | import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
| | |
| | | |
| | | //预估数据 |
| | | public String createAnaysisXls(int battGroupId, int testRecordCount) { |
| | | UserInf uinf= ActionUtil.getUser(); |
| | | String uid=String.valueOf(uinf.getUId()); |
| | | //1.查出需要预估的数据 |
| | | List<AnaysisData> list=subService.getAnaysisData(battGroupId,testRecordCount); |
| | | String excelName="测试数据.xlsx"; |
| | | //String root = FileDirPath.getFileDirName(); |
| | | //String excelOutPutPath=root+ File.separator+"outPath"; |
| | | String excelName="测试数据"+"_"+battGroupId+"_"+testRecordCount+".xlsx"; |
| | | //2.生成解析的xls |
| | | String root=exportDataToXls(excelName,list); |
| | | String root=exportDataToXls(uid,excelName,list); |
| | | String voltagePredictExePath=root+ File.separator+"10小时率电压预估\\voltage_predict_process\\main.exe"; |
| | | String excelOutPutPath=root+ File.separator+"outPath"; |
| | | String excelSourcePath=root+ File.separator+"测试数据.xlsx"; |
| | | String excelOutPutPath=root+ File.separator+"analysis"+File.separator+uid+ File.separator+"outPath"+File.separator+battGroupId+File.separator+testRecordCount; |
| | | String excelSourcePath=root+ File.separator+"analysis"+File.separator+uid+File.separator+excelName; |
| | | //4。将预估的数据存入数据库 |
| | | if(list!=null){ |
| | | int recordNum=list.size()+1; |
| | |
| | | } |
| | | |
| | | //生成解析的xls |
| | | private String exportDataToXls( String excelName,List<AnaysisData> list) { |
| | | private String exportDataToXls(String uid, String excelName,List<AnaysisData> list) { |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | String rootFace=""; |
| | | String[] titleNames=new String[]{"时间(HMS)","总电压(V)","总电流(A)","容量(AH)"}; |
| | |
| | | cell.setCellValue(j+1+"#"); |
| | | } |
| | | } |
| | | rootFace=fileDirName; |
| | | rootFace=fileDirName+File.separator+"analysis"; |
| | | File destfile = new File(rootFace); |
| | | if(!destfile.exists()) { |
| | | destfile.mkdir(); |
| | | } |
| | | rootFace=fileDirName+File.separator+"analysis"+File.separator+uid; |
| | | File destfile1 = new File(rootFace); |
| | | if(!destfile1.exists()) { |
| | | destfile1.mkdir(); |
| | | } |
| | | //将选中的文件存入指定目录下打包下载 |
| | | if(list!=null&&list.size()>0){ |
| | |
| | | } |
| | | } |
| | | } |
| | | return rootFace; |
| | | return fileDirName; |
| | | } |
| | | |
| | | //查询预估数据 |