pom.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/controller/ExportFileController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/RealDataStatic/ResRealExportAc.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/ExportService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/webSocket/RealDataStaticHrSocket.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/excel_templates/realstic_ac_template.xlsx | 补丁 | 查看 | 原始文档 | blame | 历史 |
pom.xml
@@ -142,27 +142,7 @@ <artifactId>spring-context-support</artifactId> <version>5.3.9</version> </dependency> <!--poi--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.10.1</version> </dependency> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-spring-boot-starter</artifactId> <version>4.1.2</version> <exclusions> <exclusion> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </exclusion> <exclusion> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml-schemas</artifactId> </exclusion> </exclusions> </dependency> <!--<dependency> <groupId>org.springframework.plugin</groupId> @@ -188,6 +168,27 @@ <artifactId>poi-ooxml</artifactId> <version>4.1.2</version> </dependency> <!--poi--> <!--<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.10.1</version> </dependency>--> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-spring-boot-starter</artifactId> <version>4.1.2</version> <exclusions> <exclusion> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </exclusion> <exclusion> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml-schemas</artifactId> </exclusion> </exclusions> </dependency> <!--外部引入-人脸识别sdk--> <dependency> <groupId>org.apache.tomcat.embed</groupId> src/main/java/com/whyc/controller/ExportFileController.java
@@ -1,6 +1,7 @@ package com.whyc.controller; import com.whyc.dto.Real.ExportTinfDataDto; import com.whyc.dto.RealDataStatic.ResRealExportAc; import com.whyc.dto.Statistic.BattCompareStic; import com.whyc.dto.Statistic.MonStic; import com.whyc.service.ExportService; @@ -38,4 +39,10 @@ public void exportBattCompare(HttpServletRequest req, HttpServletResponse resp ,@RequestBody BattCompareStic stic) throws ParseException, IOException { service.exportBattCompare(req,resp,stic); } @PostMapping("exportRealStaticAc") @ApiOperation(value = "实时数据统计曲线-交流单元导出(2.2.1)") public void exportRealStaticAc(HttpServletRequest req, HttpServletResponse resp ,@RequestBody ResRealExportAc exportAc) throws ParseException, IOException { service.exportRealStaticAc(req,resp,exportAc); } } src/main/java/com/whyc/dto/RealDataStatic/ResRealExportAc.java
New file @@ -0,0 +1,10 @@ package com.whyc.dto.RealDataStatic; import lombok.Data; import java.util.List; @Data public class ResRealExportAc { private List<String> picList; } src/main/java/com/whyc/service/ExportService.java
@@ -4,7 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.whyc.dto.Real.ExportTinfDataDto; import com.whyc.dto.Response; import com.whyc.dto.RealDataStatic.ResRealExportAc; import com.whyc.dto.Statistic.BattCompareStic; import com.whyc.dto.Statistic.MonStic; import com.whyc.dto.Statistic.SticCompare15Res; @@ -16,7 +16,6 @@ import com.whyc.util.ActionUtil; import com.whyc.util.ServletUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.usermodel.ClientAnchor; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.factory.annotation.Autowired; @@ -276,4 +275,36 @@ e.printStackTrace(); } } //实时数据统计曲线-交流单元导出(2.5.2) public void exportRealStaticAc(HttpServletRequest req, HttpServletResponse resp, ResRealExportAc exportAc) throws IOException { List<String> picList=exportAc.getPicList(); Map<String,Object> map=new HashMap<>(); List<ImageEntity> imageList = new ArrayList<>(); BASE64Decoder decoder = new BASE64Decoder(); if(picList!=null&&picList.size()>0){ for(int i=0;i<picList.size();i++){ ImageEntity pic = new ImageEntity(); pic.setData(decoder.decodeBuffer(picList.get(i).substring(picList.get(i).indexOf(",") + 1))); pic.setHeight(1000); // 必须设置高度 pic.setColspan(6); pic.setRowspan(17); imageList.add(pic); } } map.put("imageList", imageList); //获取导出模板地址 ClassPathResource classPathResource = new ClassPathResource("excel_templates/realstic_ac_template.xls"); String path = classPathResource.getPath(); TemplateExportParams templateExportParams1 = new TemplateExportParams(path,true); Workbook wb = ExcelExportUtil.exportExcel(templateExportParams1, map); try { String fileName = "实时数据统计曲线-交流单元.xls"; resp.setContentType("application/vnd.ms-excel"); resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8")); resp.flushBuffer(); wb.write(resp.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } } } src/main/java/com/whyc/webSocket/RealDataStaticHrSocket.java
File was renamed from src/main/java/com/whyc/webSocket/RealDataStaticHtSocket.java @@ -7,7 +7,6 @@ import com.whyc.pojo.db_param.PowerheartParam; import com.whyc.service.BattRtstateService; import com.whyc.service.PowerheartParamService; import com.whyc.service.PwrdevAcdcdataService; import com.whyc.util.ActionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -23,7 +22,7 @@ */ @Component @ServerEndpoint(value = "/realsticHr",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) public class RealDataStaticHtSocket { public class RealDataStaticHrSocket { private Session session; private Thread thread; @@ -42,13 +41,13 @@ @Autowired public void setBattRtstateService(BattRtstateService service) { RealDataStaticHtSocket.rtstateService = service; RealDataStaticHrSocket.rtstateService = service; } @Autowired public void setPowerheartParamService(PowerheartParamService service) { RealDataStaticHtSocket.pwrHeartService = service; RealDataStaticHrSocket.pwrHeartService = service; } @OnOpen src/main/resources/excel_templates/realstic_ac_template.xlsxBinary files differ