whycxzp
2022-10-14 298e75c24c0f790f8f1af0fae40e5783b4590953
更新
3个文件已删除
3个文件已添加
12个文件已修改
474 ■■■■ 已修改文件
pom.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/BattGroupDataController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ExcelExportController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/TestParamController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/BattGroupStationInfoWithFileParam.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/ResTestReportDTO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/StationInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/BattgroupData.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/FileParam.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/TestParam.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattGroupDataService.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ExcelExportService.java 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/StationInfoService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/excel_templates/res_test_report_compare_template.xls 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/excel_templates/res_test_report_single_template.xls 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/excel_templates/rest_test_report_compare_template.xls 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/excel_templates/rest_test_report_single_template.xls 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/StationInfoMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -120,10 +120,10 @@
            <artifactId>jaxen</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
        <!--<dependency>
            <groupId>cn.afterturn</groupId>
            <artifactId>easypoi-base</artifactId>
<!--            <version>3.0.3</version>-->
&lt;!&ndash;            <version>3.0.3</version>&ndash;&gt;
            <version>4.1.2</version>
            <exclusions>
                <exclusion>
@@ -135,7 +135,7 @@
        <dependency>
            <groupId>cn.afterturn</groupId>
            <artifactId>easypoi-web</artifactId>
<!--            <version>3.0.3</version>-->
&lt;!&ndash;            <version>3.0.3</version>&ndash;&gt;
            <version>4.1.2</version>
        </dependency>
        <dependency>
@@ -143,6 +143,32 @@
            <artifactId>easypoi-annotation</artifactId>
            <version>4.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>4.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>4.1.2</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>
            </exclusions>
        </dependency>
    </dependencies>
    <build>
src/main/java/com/whyc/controller/BattGroupDataController.java
@@ -1,5 +1,6 @@
package com.whyc.controller;
import com.whyc.dto.BattGroupStationInfoWithFileParam;
import com.whyc.dto.Response;
import com.whyc.pojo.BattgroupData;
import com.whyc.service.BattGroupDataService;
@@ -25,9 +26,10 @@
    @ApiOperation("单数据分析-单体数据列表")
    @GetMapping("list")
    public Response getListWithTestTime(@RequestParam String fileId){
        List<BattgroupData> monList = service.getListWithTestTime(fileId);
        Map<String,String> map = service.getStandardDeviation(monList);
        return new Response().setII(1,monList,map,null);
        //List<BattgroupData> monList = service.getListWithTestTime(fileId);
        BattGroupStationInfoWithFileParam info = service.getListWithTestTime(fileId);
        Map<String,String> map = service.getStandardDeviation(info.getDataList());
        return new Response().setII(1,info,map,null);
    }
    @ApiOperation(value = "对比分析-两组数据列表",notes = "data:第一行的基础数据,data2:第二行的基础数据," +
src/main/java/com/whyc/controller/ExcelExportController.java
@@ -1,15 +1,14 @@
package com.whyc.controller;
import com.whyc.dto.BattGroupStationInfoWithFileParam;
import com.whyc.service.ExcelExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Api(tags = "excel导出")
@RestController
@@ -19,10 +18,16 @@
    @Autowired
    private ExcelExportService service;
    @ApiOperation("内阻计测试")
    @GetMapping("resTestReport")
    public void resTestReport(@RequestParam String fileId,@RequestParam(required = false) String fileId2,@RequestParam String volPic,@RequestParam String resPic, HttpServletResponse response){
        service.resTestReport(fileId,response);
    @ApiOperation("内阻计测试-单数据分析导出")
    @PostMapping("resTestReport")
    public void resTestReport(@RequestBody BattGroupStationInfoWithFileParam info, HttpServletResponse response) throws IOException {
        service.resTestReport(info,response);
    }
    @ApiOperation("内阻计测试-对比分析导出")
    @PostMapping("resTestCompareReport")
    public void resTestCompareReport(@RequestParam String fileId,@RequestParam String fileId2,@RequestBody BattGroupStationInfoWithFileParam dto, HttpServletResponse response) throws IOException {
        service.resTestCompareReport(fileId,fileId2,dto,response);
    }
}
src/main/java/com/whyc/controller/TestParamController.java
@@ -11,7 +11,7 @@
@RestController
@RequestMapping(("testParam"))
@Api(value = "测试参数-分级评价")
@Api(tags = "测试参数-分级评价")
public class TestParamController {
    @Autowired
src/main/java/com/whyc/dto/BattGroupStationInfoWithFileParam.java
New file
@@ -0,0 +1,125 @@
package com.whyc.dto;
import com.whyc.pojo.BattgroupData;
import com.whyc.pojo.BattgroupInfo;
import com.whyc.pojo.FileParam;
import com.whyc.pojo.StationInfo;
import java.util.List;
/**
 * 电池组信息+文件参数信息
 */
public class BattGroupStationInfoWithFileParam {
    private List<BattgroupData> dataList;
    private FileParam fileParam;
    private StationInfo stationInfo;
    private String volPic;
    private String resPic;
    private String stdDevBv;
    private String stdDevBr;
    private String stdDevCr;
    private String stdDevBs;
    //总体评价
    private int resGoodCount;
    private int volGoodCount;
    private int chainResGoodCount;
    public List<BattgroupData> getDataList() {
        return dataList;
    }
    public void setDataList(List<BattgroupData> dataList) {
        this.dataList = dataList;
    }
    public FileParam getFileParam() {
        return fileParam;
    }
    public void setFileParam(FileParam fileParam) {
        this.fileParam = fileParam;
    }
    public StationInfo getStationInfo() {
        return stationInfo;
    }
    public void setStationInfo(StationInfo stationInfo) {
        this.stationInfo = stationInfo;
    }
    public String getVolPic() {
        return volPic;
    }
    public void setVolPic(String volPic) {
        this.volPic = volPic;
    }
    public String getResPic() {
        return resPic;
    }
    public void setResPic(String resPic) {
        this.resPic = resPic;
    }
    public int getResGoodCount() {
        return resGoodCount;
    }
    public void setResGoodCount(int resGoodCount) {
        this.resGoodCount = resGoodCount;
    }
    public int getVolGoodCount() {
        return volGoodCount;
    }
    public void setVolGoodCount(int volGoodCount) {
        this.volGoodCount = volGoodCount;
    }
    public int getChainResGoodCount() {
        return chainResGoodCount;
    }
    public void setChainResGoodCount(int chainResGoodCount) {
        this.chainResGoodCount = chainResGoodCount;
    }
    public String getStdDevBv() {
        return stdDevBv;
    }
    public void setStdDevBv(String stdDevBv) {
        this.stdDevBv = stdDevBv;
    }
    public String getStdDevBr() {
        return stdDevBr;
    }
    public void setStdDevBr(String stdDevBr) {
        this.stdDevBr = stdDevBr;
    }
    public String getStdDevCr() {
        return stdDevCr;
    }
    public void setStdDevCr(String stdDevCr) {
        this.stdDevCr = stdDevCr;
    }
    public String getStdDevBs() {
        return stdDevBs;
    }
    public void setStdDevBs(String stdDevBs) {
        this.stdDevBs = stdDevBs;
    }
}
src/main/java/com/whyc/dto/ResTestReportDTO.java
File was deleted
src/main/java/com/whyc/mapper/StationInfoMapper.java
@@ -27,4 +27,7 @@
    //修改StationName2
    int updateStationName3(String stationName1, String stationName2, String stationName3, String updateName);
    StationInfo getByFileId(String fileId);
}
src/main/java/com/whyc/pojo/BattgroupData.java
@@ -58,16 +58,22 @@
    @TableField(exist = false)
    private Date testTime;
    @TableField(exist = false)
    private int lowVolFlag;
    private boolean lowVolFlag;
    @TableField(exist = false)
    private int highVolFlag;
    private boolean highVolFlag;
    @TableField(exist = false)
    @ApiModelProperty("内阻高告警")
    private int highResFlag1;
    private boolean highResFlag1;
    @TableField(exist = false)
    @ApiModelProperty("内阻高严重告警")
    private int highResFlag2;
    private boolean highResFlag2;
    @TableField(exist = false)
    private int highChainResFlag;
    private boolean highChainResFlag;
    @TableField(exist = false)
    @ApiModelProperty("评价")
    private String resEvaluation;
    @TableField(exist = false)
    private String monNumStr;
}
src/main/java/com/whyc/pojo/FileParam.java
@@ -5,7 +5,7 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@@ -37,6 +37,7 @@
    @ApiModelProperty(value = "测试时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss",iso = DateTimeFormat.ISO.DATE_TIME)
    private Date testTime;
    @ApiModelProperty(value = "版本")
@@ -142,5 +143,7 @@
    @ApiModelProperty(value = "电池组信息集合")
    private List<BattgroupInfo> battInfoList;
    @TableField(exist = false)
    private String testTimeStr;
}
src/main/java/com/whyc/pojo/TestParam.java
@@ -18,7 +18,8 @@
    private Float resGoodCoeK3;
    @TableField(value = "res_bad_coe_k4")
    private Float resBadCoeK4;
    private Float chainRes;
    @TableField(value = "chain_res_coe_k5")
    private Float chainResCoeK5;
    @ApiModelProperty("启用")
    private Integer enabled;
@@ -62,12 +63,12 @@
        this.resBadCoeK4 = resBadCoeK4;
    }
    public Float getChainRes() {
        return chainRes;
    public Float getChainResCoeK5() {
        return chainResCoeK5;
    }
    public void setChainRes(Float chainRes) {
        this.chainRes = chainRes;
    public void setChainResCoeK5(Float chainResCoeK5) {
        this.chainResCoeK5 = chainResCoeK5;
    }
    public Integer getEnabled() {
src/main/java/com/whyc/service/BattGroupDataService.java
@@ -1,5 +1,6 @@
package com.whyc.service;
import com.whyc.dto.BattGroupStationInfoWithFileParam;
import com.whyc.dto.Response;
import com.whyc.mapper.BattGroupDataMapper;
import com.whyc.pojo.*;
@@ -31,15 +32,26 @@
    @Autowired
    private TestParamService testParamService;
    public List<BattgroupData> getListWithTestTime(String fileId) {
    @Autowired
    private StationInfoService stationInfoService;
    public BattGroupStationInfoWithFileParam getListWithTestTime(String fileId) {
        BattGroupStationInfoWithFileParam info = new BattGroupStationInfoWithFileParam();
        //查询站点信息和文件参数信息
        StationInfo stationInfo = stationInfoService.getByFileId(fileId);
        String battGroupId = battGroupInfoService.getByFileId(fileId).getBattgroupId();
        List<BattgroupData> dataList = mapper.getListWithTestTime(battGroupId);
        //查询系数和阈值是否禁用
        //BattgroupInfo info = battGroupInfoService.getByBattGroupId(fileId);
        FileParam param = fileParamService.getByFileId(fileId);
        TestParam param2 = testParamService.getFactorsAndThreshold();
        info.setStationInfo(stationInfo);
        info.setFileParam(param);
        if(param2.getEnabled() == 0){ //系数和阈值禁用,不需要判断处理阈值
            return dataList;
            info.setDataList(dataList);
            return info;
        }
        Float stdVol = param.getBattVol();
        Float stdRes = param.getBattRes();
@@ -47,7 +59,7 @@
        Float volHighCoeK2 = param2.getVolHighCoeK2();
        Float resGoodCoeK3 = param2.getResGoodCoeK3();
        Float resBadCoeK4 = param2.getResBadCoeK4();
        Float chainRes = param2.getChainRes();
        Float chainRes = param.getChainRes();
        dataList.forEach(data->{
            //判断处理阈值
            Float br = data.getBr();
@@ -55,33 +67,35 @@
            Float cr = data.getCr(); //连接条阻抗
            if(bv < stdVol*volLowCoeK1){
                data.setLowVolFlag(1);
                data.setLowVolFlag(true);
            }else if(bv > stdVol*volHighCoeK2){
                data.setHighVolFlag(1);
                data.setHighVolFlag(true);
            }
            if(br > stdRes*resGoodCoeK3){
                if(br > stdRes*resBadCoeK4){
                    data.setHighResFlag2(1);
                    data.setHighResFlag2(true);
                }else{
                    data.setHighResFlag1(1);
                    data.setHighResFlag1(true);
                }
            }
            if(cr > chainRes){
                data.setHighChainResFlag(1);
            if(cr > chainRes*param2.getChainResCoeK5()){
                data.setHighChainResFlag(true);
            }
        });
        return dataList;
        info.setDataList(dataList);
        return info;
    }
    public Map<String, String> getStandardDeviation(List<BattgroupData> monList) {
        Map<String,String> map = new HashMap<>();
        Stream<BattgroupData> stream = monList.stream();
        List<Float> bvList = stream.map(BattgroupData::getBv).collect(Collectors.toList());
        List<Float> brList = stream.map(BattgroupData::getBr).collect(Collectors.toList());
        List<Float> crList = stream.map(BattgroupData::getCr).collect(Collectors.toList());
        List<Float> bsList = stream.map(BattgroupData::getBs).collect(Collectors.toList());
        List<Float> bvList = monList.stream().map(BattgroupData::getBv).collect(Collectors.toList());
        List<Float> brList = monList.stream().map(BattgroupData::getBr).collect(Collectors.toList());
        List<Float> crList = monList.stream().map(BattgroupData::getCr).collect(Collectors.toList());
        List<Float> bsList = monList.stream().map(BattgroupData::getBs).collect(Collectors.toList());
        float stdDevBv = MathUtil.getStandardDeviation(bvList);
        float stdDevBr = MathUtil.getStandardDeviation(brList);
        float stdDevCr = MathUtil.getStandardDeviation(crList);
@@ -96,8 +110,10 @@
    public Response getComparedList(String baseFileId, String fileId) {
        //String baseBattGroupId = battGroupInfoService.getByFileId(baseFileId).getBattgroupId();
        //String battGroupId = battGroupInfoService.getByFileId(fileId).getBattgroupId();
        List<BattgroupData> baseDataList = getListWithTestTime(baseFileId);
        List<BattgroupData> dataList = getListWithTestTime(fileId);
        BattGroupStationInfoWithFileParam baseInfo = getListWithTestTime(baseFileId);
        List<BattgroupData> baseDataList = baseInfo.getDataList();
        BattGroupStationInfoWithFileParam info = getListWithTestTime(fileId);
        List<BattgroupData> dataList = info.getDataList();
        //内阻变化率,均一性;电压变化率,均一性
        Map<String,List<String>> map = new HashMap<>();
src/main/java/com/whyc/service/ExcelExportService.java
@@ -1,23 +1,31 @@
package com.whyc.service;
import cn.afterturn.easypoi.entity.ImageEntity;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.google.common.collect.Maps;
import com.whyc.dto.ResTestReportDTO;
import com.whyc.dto.BattGroupStationInfoWithFileParam;
import com.whyc.dto.Response;
import com.whyc.pojo.BattgroupData;
import com.whyc.pojo.FileParam;
import com.whyc.pojo.StationInfo;
import com.whyc.util.MathUtil;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import sun.misc.BASE64Decoder;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class ExcelExportService {
@@ -28,27 +36,166 @@
    @Autowired
    private BattGroupDataService battGroupDataService;
    public void resTestReport(String fileId, HttpServletResponse response) {
        HashMap<String, Object> map = Maps.newHashMap();
        List list = new LinkedList<>();
        ResTestReportDTO dto = new ResTestReportDTO();
        dto.setP1("excel模板");
        list.add(dto);
        //基础测试数据
        //battGroupDataService.getListWithTestTime(fileId);
        //文件所属的电池组信息
        FileParam fileParam = fileParamService.getByFileId(fileId);
    @Autowired
    private StationInfoService stationInfoService;
        map.put("dto", list);
    public void resTestReport(BattGroupStationInfoWithFileParam info, HttpServletResponse response) throws IOException {
        HashMap<String, Object> map = Maps.newHashMap();
        //总体评价:内阻/电压/连接条/?容量
        int resGoodCount = 0;
        int volGoodCount = 0;
        int chainResGoodCount = 0;
        FileParam fileParam = info.getFileParam();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        fileParam.setTestTimeStr(format.format(fileParam.getTestTime()));
        List<BattgroupData> dataList = info.getDataList();
        for(BattgroupData data : dataList){
            data.setMonNumStr("#"+data.getMonNum());
            if(!data.isHighResFlag1() && !data.isHighResFlag2()){
                resGoodCount +=1;
                data.setResEvaluation("优");
            }else if(data.isHighResFlag1()){
                data.setResEvaluation("差");
            }else{
                data.setResEvaluation("很差");
            }
            if(!data.isLowVolFlag() && !data.isHighVolFlag()){
                volGoodCount +=1;
            }
            if(!data.isHighChainResFlag()){
                chainResGoodCount +=1;
            }
        };
        info.setResGoodCount(resGoodCount);
        info.setVolGoodCount(volGoodCount);
        info.setChainResGoodCount(chainResGoodCount);
        map.put("dto", info);
        //图片
        BASE64Decoder decoder = new BASE64Decoder();
        ImageEntity volImage = new ImageEntity();
        volImage.setData(decoder.decodeBuffer(info.getVolPic().substring(info.getVolPic().indexOf(",")+1)));
        volImage.setColspan(7);
        volImage.setRowspan(17);
        ImageEntity resImage = new ImageEntity();
        resImage.setData(decoder.decodeBuffer(info.getResPic().substring(info.getResPic().indexOf(",")+1)));
        resImage.setColspan(7);
        resImage.setRowspan(16);
        map.put("volImage",volImage);
        map.put("resImage",resImage);
        //map.put("volImage","volImage");
        //map.put("resImage","resImage");
        //获取导出模板地址
        ClassPathResource classPathResource = new ClassPathResource("excel_templates/rest_test_report_single_template.xls");
        ClassPathResource classPathResource = new ClassPathResource("excel_templates/res_test_report_single_template.xls");
        String path = classPathResource.getPath();
        TemplateExportParams templateExportParams1 = new TemplateExportParams(path);
        Workbook wb = ExcelExportUtil.exportExcel(templateExportParams1, map);
        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss"));
        String fileName = "内阻计测试"+time+".xls";
        try {
            response.setContentType("application/octet-stream;charset=utf-8");
            //response.setContentType("application/octet-stream;charset=utf-8");
            response.setContentType("application/vnd.ms-excel");
            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8"));
            response.flushBuffer();
            wb.write(response.getOutputStream());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void resTestCompareReport(String fileId, String fileId2, BattGroupStationInfoWithFileParam dto, HttpServletResponse response) throws IOException {
        Map<String,Object> map = new HashMap<>();
        Response comparedList = battGroupDataService.getComparedList(fileId, fileId2);
        List<BattgroupData> dataList = (List<BattgroupData>) comparedList.getData();
        List<BattgroupData> dataList2 = (List<BattgroupData>) comparedList.getData2();
        Map<String,List<String>> data3 = (Map<String, List<String>>) comparedList.getData3();
        //变化率
        List<String> resChangeRateList = data3.get("resChangeRate");
        List<String> volChangeRateList = data3.get("volChangeRate");
        //均一性:res/vol
        List<String> resBalanceRateList = data3.get("resBalanceRate");
        List<String> volBalanceRateList = data3.get("volBalanceRate");
        //均一性:chainRes/?容量/bs(电导)
        List<Float> chainResList = dataList2.stream().map(BattgroupData::getCr).collect(Collectors.toList());
        List<Float> bsList = dataList2.stream().map(BattgroupData::getBs).collect(Collectors.toList());
        String chainResBalanceRate = MathUtil.getStandardDeviation(chainResList) * 10000 / 100 + "%";
        String bsBalanceRate = MathUtil.getStandardDeviation(bsList) * 10000 / 100 + "%";
        //获取FileParam和StationInfo
        StationInfo stationInfo = stationInfoService.getByFileId(fileId2);
        FileParam param = fileParamService.getByFileId(fileId2);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        param.setTestTimeStr(format.format(param.getTestTime()));
        FileParam paramBase = fileParamService.getByFileId(fileId);
        String testTimeStrBase = format.format(paramBase.getTestTime());
        //图片
        BASE64Decoder decoder = new BASE64Decoder();
        ImageEntity volImage = new ImageEntity();
        volImage.setData(decoder.decodeBuffer(dto.getVolPic().substring(dto.getVolPic().indexOf(",")+1)));
        volImage.setColspan(7);
        volImage.setRowspan(17);
        ImageEntity resImage = new ImageEntity();
        resImage.setData(decoder.decodeBuffer(dto.getResPic().substring(dto.getResPic().indexOf(",")+1)));
        resImage.setColspan(7);
        resImage.setRowspan(16);
        map.put("volImage",volImage);
        map.put("resImage",resImage);
        map.put("fileParam",param);
        map.put("stationInfo",stationInfo);
        //总体评价:内阻/电压/连接条/?容量
        int resGoodCount = 0;
        int volGoodCount = 0;
        int chainResGoodCount = 0;
        for(BattgroupData data : dataList2){
            data.setMonNumStr("#"+data.getMonNum());
            if(!data.isHighResFlag1() && !data.isHighResFlag2()){
                resGoodCount +=1;
                data.setResEvaluation("优");
            }else if(data.isHighResFlag1()){
                data.setResEvaluation("差");
            }else{
                data.setResEvaluation("很差");
            }
            if(!data.isLowVolFlag() && !data.isHighVolFlag()){
                volGoodCount +=1;
            }
            if(!data.isHighChainResFlag()){
                chainResGoodCount +=1;
            }
        };
        map.put("resGoodCount",resGoodCount);
        map.put("volGoodCount",volGoodCount);
        map.put("chainResGoodCount",chainResGoodCount);
        map.put("dataList",dataList);
        map.put("dataList2",dataList2);
        map.put("stdDevBv",volBalanceRateList.get(1));
        map.put("stdDevBr",resBalanceRateList.get(1));
        map.put("stdDevCr",chainResBalanceRate);
        map.put("stdDevBs",bsBalanceRate);
        map.put("testTimeStrBase",testTimeStrBase);
        //获取导出模板地址
        ClassPathResource classPathResource = new ClassPathResource("excel_templates/res_test_report_compare_template.xls");
        String path = classPathResource.getPath();
        TemplateExportParams templateExportParams1 = new TemplateExportParams(path);
        templateExportParams1.setColForEach(true);
        Workbook wb = ExcelExportUtil.exportExcel(templateExportParams1, map);
        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss"));
        String fileName = "内阻计测试"+time+".xls";
        try {
            //response.setContentType("application/octet-stream;charset=utf-8");
            response.setContentType("application/vnd.ms-excel");
            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8"));
            response.flushBuffer();
            wb.write(response.getOutputStream());
src/main/java/com/whyc/service/StationInfoService.java
@@ -303,4 +303,7 @@
        }
    }
    public StationInfo getByFileId(String fileId) {
        return mapper.getByFileId(fileId);
    }
}
src/main/resources/excel_templates/res_test_report_compare_template.xls
Binary files differ
src/main/resources/excel_templates/res_test_report_single_template.xls
Binary files differ
src/main/resources/excel_templates/rest_test_report_compare_template.xls
Binary files differ
src/main/resources/excel_templates/rest_test_report_single_template.xls
Binary files differ
src/main/resources/mapper/StationInfoMapper.xml
@@ -35,4 +35,7 @@
    <select id="selectIdByName1" resultType="StationInfo">
        select distinct station_id,station_name from db_res_meter.tb_station_info where station_name1=#{stationName1}
    </select>
    <select id="getByFileId" resultType="com.whyc.pojo.StationInfo">
        SELECT si.* FROM db_res_meter.tb_battgroup_info bi,tb_station_info si where bi.station_id = si.station_id and bi.file_id = #{fileId}
    </select>
</mapper>