src/main/java/com/whyc/mapper/BattInfMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/BattInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/EchartPictureDowloadService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/config/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/BattInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/mapper/BattInfMapper.java
@@ -72,4 +72,6 @@ List<Battinf> getStationList8059(Long uId); int searchByDeviceId(int uId); //取出电池组信息构建excel文件的名称 Battinf serchExcelName(int battGroupId); } src/main/java/com/whyc/service/BattInfService.java
@@ -9,6 +9,7 @@ import com.whyc.dto.Response; import com.whyc.mapper.BattInfMapper; import com.whyc.pojo.Battinf; import com.whyc.util.ActionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -285,4 +286,14 @@ public List<Battinf> getStationList8059(Long uId) { return battInfMapper.getStationList8059(uId); } //取出电池组信息构建excel文件的名称 public String serchExcelName(int battGroupId) { Battinf binf=battInfMapper.serchExcelName(battGroupId); String excelName=binf.getStationName1()+"-"+binf.getStationName2()+"-"+binf.getStationName5()+"-"+binf.getStationName3() +"-"+ ActionUtil.sdfwithOutday.format(binf.getBattProductDate()).replace("_","年")+"月-"+(int)((float)binf.getMonCapStd())+"AH"+"-"+binf.getBattGroupName(); return excelName; } } src/main/java/com/whyc/service/EchartPictureDowloadService.java
@@ -44,6 +44,9 @@ private Ld9testdatastopService stopservice; //ld9stop的service @Autowired private BattInfService binfservice; //battinf的service @Autowired private Environment environment; //文件导出 @@ -123,6 +126,9 @@ List<FBOTestData> list=fboservice.getList(battGroupId,testRecordCount); //查询4059充放电数据 //取出电池组信息构建excel文件的名称 String excelName =binfservice.serchExcelName(battGroupId); int monCount= fboservice.getMonCuntBytestRecordCount(battGroupId,testRecordCount); //查询具体一次充放电单体个数 //处理图片 try { @@ -142,9 +148,7 @@ }catch (Exception e){ e.printStackTrace(); } //当前日期 String nowFormat = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); String excelName = "FGCD-"+nowFormat; HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("Sheet1"); @@ -177,12 +181,18 @@ row.createCell(4+i).setCellValue("#"+Integer.valueOf(i+1)); } rowNum++; //取出放电开始时间 Date test_starttime=null ; //数据栏 if(monCount!=0){ for (int i = 0; i < list.size(); i++) { sheet.createRow(rowNum); //创建行 for(int j=0;j<monCount;j++){ FBOTestData fbo=list.get(i+j); if(i==0&&j==0){ test_starttime=fbo.getTestStartTime(); } sheet.getRow(rowNum).createCell(0).setCellValue(ActionUtil.secToTime(fbo.getTestTimeLong())); sheet.getRow(rowNum).createCell(1).setCellValue(fbo.getSumVol()); sheet.getRow(rowNum).createCell(2).setCellValue(fbo.getTestCurr()); @@ -194,6 +204,13 @@ } } rowNum+=2; //excel文件名 String testTime = new SimpleDateFormat("yyyy-MM-dd").format(test_starttime); excelName = excelName+"-"+testTime; String regEx="[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。, 、?]"; excelName = excelName.replace(regEx,""); //插入图片 int picNum = 0; String[] picName = new String[]{ @@ -1436,7 +1453,13 @@ sheet1.getRow(rownum).createCell(5).setCellValue(qth.getQh() + "%"); sheet1.getRow(rownum).createCell(6).setCellValue(qth.getTitle()); } //取出电池组信息构建excel文件的名称 String excelName =binfservice.serchExcelName(bmd.getBinf().getBattGroupId()); //excel文件名 String testTime = new SimpleDateFormat("yyyy-MM-dd").format(bmd.getSdata().getTestStarttime()); excelName = excelName+"-"+testTime; String regEx="[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。, 、?]"; excelName = excelName.replace(regEx,""); // 转码防止乱码 resp.addHeader("Content-Disposition", "attachment;filename=" + new String(excelName.getBytes("UTF-8"), "ISO8859-1") src/main/resources/config/application.yml
@@ -6,6 +6,9 @@ port: 8091 servlet: context-path: /fg tomcat: max-http-form-post-size: 102400000 #数据库 spring: @@ -86,3 +89,5 @@ #Config文件读取 涉及License和FGCDFileDownload configFile: type: 1 #1:本地测试;2:打包jar src/main/resources/mapper/BattInfMapper.xml
@@ -454,5 +454,9 @@ limit 1 </select> <select id="serchExcelName" resultType="com.whyc.pojo.Battinf"> select distinct * from db_battinf.tb_battinf where db_battinf.tb_battinf.battGroupId=#{battGroupId} limit 1 </select> </mapper>