src/main/java/com/whyc/service/BattInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/EchartPictureDowloadService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/util/ActionUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/service/BattInfService.java
@@ -383,7 +383,7 @@ Battinf binf = battInfMapper.serchExcelName(battGroupId); //导出格式:内蒙古自治区-鄂尔多斯市-东胜区-中心局-理士400AH1组-2022-04-21-第1次放电 String excelName = binf.getStationName1() + "-" + binf.getStationName2() + "-" + binf.getStationName5() + "-" + binf.getStationName3() + "-" + binf.getBattProducer() + binf.getMonCapStd() + "AH" + (binf.getGroupIndexInFBSDevice() + 1) + "组" + "-" + binf.getBattProductDate() + stateFlag; binf.getBattProducer() + binf.getMonCapStd() + "AH" + (binf.getGroupIndexInFBSDevice() + 1) + "组" + "-" + stateFlag; return excelName; } src/main/java/com/whyc/service/EchartPictureDowloadService.java
@@ -123,7 +123,7 @@ int battGroupId = Integer.valueOf(req.getParameter("battGroupId")); //电池组编号 int testRecordCount = Integer.valueOf(req.getParameter("testRecordCount")); //测试编号 String stateFlag = req.getParameter("stateFlag");//第几次放电 stateFlag = "第1次放电"; //stateFlag = "2022-02-10-第1次放电"; List<FBOTestData> list = fboservice.getList(battGroupId, testRecordCount); //查询4059充放电数据 @@ -198,33 +198,34 @@ sheet.getRow(rowNum).createCell(1).setCellValue(fbo.getSumVol()); sheet.getRow(rowNum).createCell(2).setCellValue(fbo.getTestCurr()); sheet.getRow(rowNum).createCell(3).setCellValue(fbo.getTestCap()); sheet.getRow(rowNum).createCell(4+j).setCellValue(fbo.getMonVol()); sheet.getRow(rowNum).createCell(4 + j).setCellValue(fbo.getMonVol()); } i=i+monCount-1; i = i + monCount - 1; rowNum++; } } rowNum+=2; rowNum += 2; //excel文件名 String testTime = new SimpleDateFormat("yyyy-MM-dd").format(test_starttime); excelName = excelName+"-"+testTime; String regEx="[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。, 、?]"; excelName = excelName.replace(regEx,""); /*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[]{ "总电压折线图","单体电压柱状图","电池电流折线图","单体电压折现图" "总电压折线图", "单体电压柱状图", "电池电流折线图", "单体电压折现图" }; for(int i=0;i<picName.length;i++){ sheet.createRow(rowNum-1); sheet.getRow(rowNum-1).createCell(0).setCellValue(picName[i]); for (int i = 0; i < picName.length; i++) { sheet.createRow(rowNum - 1); sheet.getRow(rowNum - 1).createCell(0).setCellValue(picName[i]); //rowNum++; HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 0, rowNum, (short) 10, rowNum+rowNumAdd); HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255, (short) 0, rowNum, (short) 10, rowNum + rowNumAdd); anchor.setAnchorType(3); patriarch.createPicture(anchor,wb.addPicture(bytes.get(picNum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); picNum ++;rowNum+=rowNumAdd; patriarch.createPicture(anchor, wb.addPicture(bytes.get(picNum), HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); picNum++; rowNum += rowNumAdd; } rowNum++; src/main/java/com/whyc/util/ActionUtil.java
@@ -5,7 +5,6 @@ import com.google.gson.JsonSyntaxException; import com.whyc.pojo.UserInf; import org.apache.commons.codec.digest.DigestUtils; import org.springframework.web.context.ContextLoader; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import sun.misc.BASE64Decoder; @@ -21,15 +20,13 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Optional; import static jdk.nashorn.internal.objects.NativeNumber.toFixed; public class ActionUtil{ public static String time_yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; public static String time_yyyyMMdd = "yyyy-MM-dd"; public static SimpleDateFormat sdfwithOutday=new SimpleDateFormat("yyyy_MM"); public static SimpleDateFormat sdfwithOutday = new SimpleDateFormat("yyyy_MM"); public static SimpleDateFormat sdfwithday = new SimpleDateFormat("yyyy-MM-dd"); /* * 获取HttpServletRequest @@ -436,8 +433,9 @@ * @return */ public static boolean generateImage(String imgStr, String path) { if (imgStr == null) return false; if (imgStr == null) { return false; } BASE64Decoder decoder = new BASE64Decoder(); try { // 解密