whycxzp
2025-03-18 f127214ad1076769c9cb4a97963ee3ad5053e970
锂电设备A200相关代码更新
8 文件已重命名
8个文件已修改
3个文件已删除
3个文件已添加
420 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/BattLithiumTestDataInfController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/DevActmTestParamController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattLithiumRtDataMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattLithiumTestDataInfMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattLithiumTestDataMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattRtDataMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattTestDataIdMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattTestDataInfMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_lithium_ram_db/BattLithiumRtData.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_lithium_testdata/BattLithiumTestData.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_lithium_testdata/BattLithiumTestDataInf.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattLithiumRtDataService.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattLithiumTestDataInfService.java 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattLithiumTestDataService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ExcelExportService.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SubTablePageInfoService.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SubTableService.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/util/SubTablePageInfoUtil.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/webSocket/DevLithiumRtStateSocket.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/webSocket/DevLithiumStatisticSocket.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattLithiumTestDataInfMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattTestDataIdMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/BattLithiumTestDataInfController.java
File was renamed from src/main/java/com/whyc/controller/BattTestDataInfController.java
@@ -1,7 +1,7 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.service.BattTestDataInfService;
import com.whyc.service.BattLithiumTestDataInfService;
import com.whyc.service.ExcelExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -15,11 +15,11 @@
import java.util.Map;
@RestController
@Api(tags = "测试管理")
@RequestMapping("tinf")
public class BattTestDataInfController {
@Api(tags = "锂电池测试信息表")
@RequestMapping("battLithiumTestDataInf")
public class BattLithiumTestDataInfController {
    @Autowired
    private BattTestDataInfService service;
    private BattLithiumTestDataInfService service;
    @Autowired
    private ExcelExportService exportService;
src/main/java/com/whyc/controller/DevActmTestParamController.java
@@ -10,6 +10,11 @@
import java.util.List;
/**
 * TODO 暂无这个字段,项目完结时确认没有的时候删除
 */
@Deprecated
@RestController
@Api(tags = "actm均衡仪控制操作")
@RequestMapping("actmparam")
src/main/java/com/whyc/mapper/BattLithiumRtDataMapper.java
New file
@@ -0,0 +1,6 @@
package com.whyc.mapper;
import com.whyc.pojo.db_lithium_ram_db.BattLithiumRtData;
public interface BattLithiumRtDataMapper extends CustomMapper<BattLithiumRtData>{
}
src/main/java/com/whyc/mapper/BattLithiumTestDataInfMapper.java
New file
@@ -0,0 +1,22 @@
package com.whyc.mapper;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestDataInf;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface BattLithiumTestDataInfMapper extends CustomMapper<BattLithiumTestDataInf>{
    //充放电一体机测试统计
    List<BattLithiumTestDataInf> getDevTinf(@Param("uid") int uid);
    //本年
    List<BattLithiumTestDataInf> getDevTinfByYear(@Param("uid")int userId);
    //本月
    List<BattLithiumTestDataInf> getDevTinfByMonth(@Param("uid")int userId);
    //近一周(mysql中不会算上今天)
    List<BattLithiumTestDataInf> getDevTinfByWeek(@Param("uid")int userId, @Param("type")int type);
    //获取充放电数据
    List<BattLithiumTestDataInf> getTinfById(@Param("type")int type, @Param("devId")Integer devId);
}
src/main/java/com/whyc/mapper/BattLithiumTestDataMapper.java
New file
@@ -0,0 +1,6 @@
package com.whyc.mapper;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData;
public interface BattLithiumTestDataMapper extends CustomMapper<BattLithiumTestData>{
}
src/main/java/com/whyc/mapper/BattRtDataMapper.java
File was deleted
src/main/java/com/whyc/mapper/BattTestDataIdMapper.java
File was deleted
src/main/java/com/whyc/mapper/BattTestDataInfMapper.java
File was deleted
src/main/java/com/whyc/pojo/db_lithium_ram_db/BattLithiumRtData.java
File was renamed from src/main/java/com/whyc/pojo/db_lithium_ram_db/BattRtdata.java
@@ -13,19 +13,16 @@
import java.util.Date;
/**
 * <p>
 * 电池组单体实时状态信息表
 * </p>
 *
 * @author lxw
 * @since 2024-08-28
 * 锂电设备电池组状态
 *
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(schema = "db_lithium_ram_db",value ="tb_batt_rtdata")
@ApiModel(value="BattRtdata对象", description="电池组单体实时状态信息表")
public class BattRtdata implements Serializable {
@TableName(schema = "db_lithium_ram_db",value ="tb_lithium_rtdata")
@ApiModel(value="锂电设备电池组状态", description="电池组单体实时状态信息表")
public class BattLithiumRtData implements Serializable {
    private static final long serialVersionUID = 1L;
src/main/java/com/whyc/pojo/db_lithium_testdata/BattLithiumTestData.java
File was renamed from src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataId.java
@@ -1,4 +1,4 @@
package com.whyc.pojo.db_batt_testdata;
package com.whyc.pojo.db_lithium_testdata;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -15,18 +15,15 @@
import java.util.List;
/**
 * <p>
 * 设备电池历史数据记录表
 * </p>
 *
 * @author lxw
 * @since 2024-09-09
 * 锂电电池组测试数据记录表
 *
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="BatttestdataId对象", description="设备电池历史数据记录表")
public class BattTestDataId implements Serializable {
@ApiModel(value="锂电电池组测试数据表", description="设备电池历史数据记录表")
public class BattLithiumTestData implements Serializable {
    private static final long serialVersionUID = 1L;
src/main/java/com/whyc/pojo/db_lithium_testdata/BattLithiumTestDataInf.java
File was renamed from src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataInf.java
@@ -1,4 +1,4 @@
package com.whyc.pojo.db_batt_testdata;
package com.whyc.pojo.db_lithium_testdata;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -14,19 +14,16 @@
import java.util.Date;
/**
 * <p>
 * 电池组历史数据总表
 * </p>
 *
 * @author lxw
 * @since 2024-09-05
 * 锂电电池组的测试数据
 *
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(schema = "db_batt_testdata",value ="tb_batttestdata_inf")
@ApiModel(value="BatttestdataInf对象", description="电池组历史数据总表")
public class BattTestDataInf implements Serializable {
@TableName(schema = "db_lithium_testdata",value ="tb_batttestdata_inf")
@ApiModel(value="锂电电池组的测试数据", description="电池组历史数据总表")
public class BattLithiumTestDataInf implements Serializable {
    private static final long serialVersionUID = 1L;
src/main/java/com/whyc/service/BattLithiumRtDataService.java
File was renamed from src/main/java/com/whyc/service/BattRtDataService.java
@@ -2,18 +2,18 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.BattRtDataMapper;
import com.whyc.pojo.db_lithium_ram_db.BattRtdata;
import com.whyc.mapper.BattLithiumRtDataMapper;
import com.whyc.pojo.db_lithium_ram_db.BattLithiumRtData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class BattRtDataService {
public class BattLithiumRtDataService {
    @Autowired(required = false)
    private BattRtDataMapper mapper;
    private BattLithiumRtDataMapper mapper;
    //获取a200电池组数据
@@ -22,7 +22,7 @@
        wrapper.eq("dev_id",devId);
        wrapper.orderByAsc("batt_idx");
        wrapper.orderByAsc("mon_num");
        List<BattRtdata> list=mapper.selectList(wrapper);
        List<BattLithiumRtData> list=mapper.selectList(wrapper);
        return new Response().setII(1,list!=null,list,"获取电池组数据");
    }
@@ -33,7 +33,7 @@
        wrapper.eq("batt_idx",index);
        wrapper.orderByAsc("batt_idx");
        wrapper.orderByAsc("mon_num");
        List<BattRtdata> list=mapper.selectList(wrapper);
        List<BattLithiumRtData> list=mapper.selectList(wrapper);
        return new Response().setII(1,list!=null,list,"获取电池组数据");
    }
}
src/main/java/com/whyc/service/BattLithiumTestDataInfService.java
File was renamed from src/main/java/com/whyc/service/BattTestDataInfService.java
@@ -2,10 +2,10 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.BattTestDataIdMapper;
import com.whyc.mapper.BattTestDataInfMapper;
import com.whyc.pojo.db_batt_testdata.BattTestDataId;
import com.whyc.pojo.db_batt_testdata.BattTestDataInf;
import com.whyc.mapper.BattLithiumTestDataMapper;
import com.whyc.mapper.BattLithiumTestDataInfMapper;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestDataInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -16,13 +16,13 @@
import java.util.stream.Collectors;
@Service
public class BattTestDataInfService {
public class BattLithiumTestDataInfService {
    @Autowired(required = false)
    private BattTestDataInfMapper mapper;
    private BattLithiumTestDataInfMapper mapper;
    @Autowired(required = false)
    private BattTestDataIdMapper dataMapper;
    private BattLithiumTestDataMapper dataMapper;
    @Autowired(required = false)
    private SubTablePageInfoService subService;
@@ -31,7 +31,7 @@
    public Map<String, Object> getDevTinfByYearMonth(int userId) {
        Map<String,Object> map=new HashMap<>();
        //本年
        List<BattTestDataInf> listYear=mapper.getDevTinfByYear(userId);
        List<BattLithiumTestDataInf> listYear=mapper.getDevTinfByYear(userId);
        Map<String,Object> a200Map=new HashMap<>();
        Map<String,Object> actmMap=new HashMap<>();
@@ -44,11 +44,11 @@
        actmYearMap.put(3,0);
        actmYearMap.put(4,0);
        //本年
        Map<Integer, List<BattTestDataInf>> typeMapY = listYear.stream().collect(Collectors.groupingBy(BattTestDataInf::getDevType));
        Map<Integer, List<BattLithiumTestDataInf>> typeMapY = listYear.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getDevType));
        for (Integer type : typeMapY.keySet()) {
            List<BattTestDataInf> list=typeMapY.get(type);
            Map<Integer, List<BattTestDataInf>> testMapY = list.stream().collect(Collectors.groupingBy(BattTestDataInf::getTestType));
            List<BattLithiumTestDataInf> list=typeMapY.get(type);
            Map<Integer, List<BattLithiumTestDataInf>> testMapY = list.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getTestType));
            for (Integer test : testMapY.keySet()) {
                if(type==1){
                    a200YearMap.put(test, testMapY.get(test).size());
@@ -70,11 +70,11 @@
        actmMonthMap.put(2,0);
        actmMonthMap.put(3,0);
        actmMonthMap.put(4,0);
        List<BattTestDataInf> listMonth=mapper.getDevTinfByMonth(userId);
        Map<Integer, List<BattTestDataInf>> typeMapM = listMonth.stream().collect(Collectors.groupingBy(BattTestDataInf::getDevType));
        List<BattLithiumTestDataInf> listMonth=mapper.getDevTinfByMonth(userId);
        Map<Integer, List<BattLithiumTestDataInf>> typeMapM = listMonth.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getDevType));
        for (Integer type : typeMapM.keySet()) {
            List<BattTestDataInf> list=typeMapM.get(type);
            Map<Integer, List<BattTestDataInf>> testMapM = list.stream().collect(Collectors.groupingBy(BattTestDataInf::getTestType));
            List<BattLithiumTestDataInf> list=typeMapM.get(type);
            Map<Integer, List<BattLithiumTestDataInf>> testMapM = list.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getTestType));
            for (Integer test : testMapM.keySet()) {
                if(type==1){
                    a200MonthMap.put(test, testMapM.get(test).size());
@@ -116,11 +116,11 @@
            actmdataMap.put(resultDate.toString(),actmweekDataMap);
        }
        List<BattTestDataInf> listW1=mapper.getDevTinfByWeek(userId,1);
        Map<String, List<BattTestDataInf>> typeMapW1 = listW1.stream().collect(Collectors.groupingBy(BattTestDataInf::getWeekDay));
        List<BattLithiumTestDataInf> listW1=mapper.getDevTinfByWeek(userId,1);
        Map<String, List<BattLithiumTestDataInf>> typeMapW1 = listW1.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getWeekDay));
        for (String day : typeMapW1.keySet()) {
            List<BattTestDataInf> list1=typeMapW1.get(day);
            Map<Integer, List<BattTestDataInf>> testMapM1 = list1.stream().collect(Collectors.groupingBy(BattTestDataInf::getTestType));
            List<BattLithiumTestDataInf> list1=typeMapW1.get(day);
            Map<Integer, List<BattLithiumTestDataInf>> testMapM1 = list1.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getTestType));
            //近一周a200
            Map<Integer,Integer> a200weekMap=new HashMap<>();
            a200weekMap.put(2,0);
@@ -131,11 +131,11 @@
            a200dataMap.put(day,a200weekMap);
        }
        List<BattTestDataInf> listW2=mapper.getDevTinfByWeek(userId,2);
        Map<String, List<BattTestDataInf>> typeMapW2= listW2.stream().collect(Collectors.groupingBy(BattTestDataInf::getWeekDay));
        List<BattLithiumTestDataInf> listW2=mapper.getDevTinfByWeek(userId,2);
        Map<String, List<BattLithiumTestDataInf>> typeMapW2= listW2.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getWeekDay));
        for (String day : typeMapW2.keySet()) {
            List<BattTestDataInf> list2=typeMapW2.get(day);
            Map<Integer, List<BattTestDataInf>> testMapM2 = list2.stream().collect(Collectors.groupingBy(BattTestDataInf::getTestType));
            List<BattLithiumTestDataInf> list2=typeMapW2.get(day);
            Map<Integer, List<BattLithiumTestDataInf>> testMapM2 = list2.stream().collect(Collectors.groupingBy(BattLithiumTestDataInf::getTestType));
            //近一周actm
            Map<Integer,Integer> actmweekMap=new HashMap<>();
            actmweekMap.put(2,0);
@@ -154,12 +154,12 @@
    public Response getTinfById(Integer devId) {
        Map<String,Object> map=new HashMap<>();
        //获取充放电数据
        List<BattTestDataInf> listDis=mapper.getTinfById(3,devId);
        List<BattTestDataInf> listChr=mapper.getTinfById(2,devId);
        List<BattLithiumTestDataInf> listDis=mapper.getTinfById(3,devId);
        List<BattLithiumTestDataInf> listChr=mapper.getTinfById(2,devId);
        map.put("dis",listDis);
        map.put("chr",listChr);
        if(devId/100000000==2){
            List<BattTestDataInf> listJun=mapper.getTinfById(4,devId);
            List<BattLithiumTestDataInf> listJun=mapper.getTinfById(4,devId);
            map.put("jun",listJun);
        }
@@ -167,17 +167,17 @@
    }
    //获取设备某次记录详细的单体放电过程
    public Response getTdataById(Integer devId, Integer testRecordCount) {
        List<BattTestDataId> list=subService.getTdataById(devId,testRecordCount);
        List<BattLithiumTestData> list=subService.getTdataById(devId,testRecordCount);
        return new Response().setII(1,list!=null,list,"获取设备某次记录详细的单体放电过程");
    }
    //获取放电inf
    public BattTestDataInf getTinfExport(Integer devId, Integer testRecordCount) {
    public BattLithiumTestDataInf getTinfExport(Integer devId, Integer testRecordCount) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("dev_id",devId);
        wrapper.eq("test_record_count",testRecordCount);
        wrapper.last("limit 1");
        BattTestDataInf tinf=mapper.selectOne(wrapper);
        BattLithiumTestDataInf tinf=mapper.selectOne(wrapper);
        return  tinf;
    }
}
src/main/java/com/whyc/service/BattLithiumTestDataService.java
File was renamed from src/main/java/com/whyc/service/BattTestDataIdService.java
@@ -3,5 +3,5 @@
import org.springframework.stereotype.Service;
@Service
public class BattTestDataIdService {
public class BattLithiumTestDataService {
}
src/main/java/com/whyc/service/ExcelExportService.java
@@ -1,8 +1,8 @@
package com.whyc.service;
import com.whyc.dto.ActmStopReason;
import com.whyc.pojo.db_batt_testdata.BattTestDataId;
import com.whyc.pojo.db_batt_testdata.BattTestDataInf;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestDataInf;
import com.whyc.util.ActionUtil;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -23,7 +23,7 @@
    private SubTablePageInfoService subService;
    @Autowired(required = false)
    private BattTestDataInfService infService;
    private BattLithiumTestDataInfService infService;
    //导出文件
    public void exportExcel1(Integer devId,  Integer testRecordCount,HttpServletResponse response) {
@@ -40,12 +40,12 @@
            row.createCell(i).setCellValue(titiles[i]);
        }
        rowNum++;
        List<BattTestDataId> list=subService.getTdataById(devId,testRecordCount);
        List<BattLithiumTestData> list=subService.getTdataById(devId,testRecordCount);
        if(list!=null){
            //数据栏
            for (int i = 0; i < list.size(); i++) {
                sheet.createRow(rowNum);  //创建行
                BattTestDataId tdata=list.get(i);
                BattLithiumTestData tdata=list.get(i);
                for(int j=0;j<titiles.length;j++){
                    sheet.getRow(rowNum).createCell(0 ).setCellValue(ActionUtil.secToTime(tdata.getTestTimelong()));
                    sheet.getRow(rowNum).createCell(1).setCellValue(tdata.getBattIdx()+1);
@@ -106,7 +106,7 @@
        cellStyle.setFont(font);
        String[] titiles=new String[]{"Time(H:M:S)","Group V(V)","Group A(A)","Cap (AH)","Temp H(°C)","Temp L(°C)"};
        List<BattTestDataId> list=subService.getTdataByIdWithListA200(devId,testRecordCount);
        List<BattLithiumTestData> list=subService.getTdataByIdWithListA200(devId,testRecordCount);
        int rowNum=0;
        // 创建标题行
@@ -129,7 +129,7 @@
            for (int i = 0; i < list.size(); i++) {
                Row row1 =  sheet.createRow(rowNum);  //创建行
                row1.setHeightInPoints(20.0f);
                BattTestDataId tdata=list.get(i);
                BattLithiumTestData tdata=list.get(i);
                sheet.getRow(rowNum).createCell(0 ).setCellValue(ActionUtil.secToTime(tdata.getTestTimelong()));
                sheet.getRow(rowNum).createCell(1).setCellValue(String.format("%.1f",tdata.getGroupVol()));
                sheet.getRow(rowNum).createCell(2).setCellValue(String.format("%.1f",tdata.getTestCurr()));
@@ -177,7 +177,7 @@
        cellStyle.setFont(font);
        //获取放电inf
        BattTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        BattLithiumTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        String[] titiles33=new String[]{"PACK/模组号:","测试开始时间:","测试结束时间:","数据类型:","停止原因:","预放容量(AH):"
                ,"放电电流(A):","测试时长(h:m:s):","单串下限(V):","组端下限(V):","电芯串数:","最高温度(°C):","最低温度(°C):","采集频率(秒):"};
        String[] titiles34=new String[]{tinf.getBatteryName(),ActionUtil.sdf.format(tinf.getTestStarttime()),ActionUtil.sdf.format(tinf.getRecordTime()), "放电数据",tinf.getStopTypeReason(),String.format("%.1f",tinf.getTestCap())
@@ -226,7 +226,7 @@
        cellStyle.setFont(font);
        String[] titiles=new String[]{"测试时长"};
        List<BattTestDataId> list=subService.getTdataByIdWithListActm(devId,testRecordCount);
        List<BattLithiumTestData> list=subService.getTdataByIdWithListActm(devId,testRecordCount);
        int rowNum=0;
        // 创建标题行
@@ -252,7 +252,7 @@
            for (int i = 0; i < list.size(); i++) {
                Row row1 =  sheet.createRow(rowNum);  //创建行
                row1.setHeightInPoints(20.0f);
                BattTestDataId tdata=list.get(i);
                BattLithiumTestData tdata=list.get(i);
                sheet.getRow(rowNum).createCell(0 ).setCellValue(ActionUtil.secToTime(tdata.getTestTimelong()));
                List<Float> monVols = tdata.getMonVols();
                List<Float> monCurrs = tdata.getMonCurrs();
@@ -302,7 +302,7 @@
        cellStyle.setFont(font);
        //获取放电inf
        BattTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        BattLithiumTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        String[] titiles3=new String[]{"电池包序号:","模组编号:","工作模式:","电池类型:","电池串数:","电压阀值(v):"
                ,"工作电流(A):","开始测试时间:","结束测试时间:","停止原因:"};
src/main/java/com/whyc/service/SubTablePageInfoService.java
@@ -3,7 +3,7 @@
import com.whyc.dto.DevA200AlarmDto;
import com.whyc.mapper.CallBack;
import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear;
import com.whyc.pojo.db_batt_testdata.BattTestDataId;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData;
import com.whyc.util.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -19,16 +19,16 @@
    @Autowired
    private MybatisSqlExecuteService sqlExecuteService;
    //获取设备某次记录详细的单体放电过程
    public List<BattTestDataId> getTdataById(Integer devId, Integer testRecordCount) {
    public List<BattLithiumTestData> getTdataById(Integer devId, Integer testRecordCount) {
        String sql="select  * from db_batt_testdata.tb_batttestdata_" +devId
                +" where need_test=1 and test_record_count="+testRecordCount+" ";
        sql+="  ORDER BY record_num asc ";
        List list = sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
                List<BattTestDataId> list=new ArrayList<>();
                List<BattLithiumTestData> list=new ArrayList<>();
                while (rs.next()){
                    BattTestDataId tdata=new BattTestDataId();
                    BattLithiumTestData tdata=new BattLithiumTestData();
                    tdata.setNum(rs.getInt("num"));
                    tdata.setDevId(rs.getInt("dev_id"));
                    tdata.setBattIdx(rs.getInt("batt_idx"));
@@ -59,7 +59,7 @@
    }
    //获取设备某次记录详细的单体放电过程
    public List<BattTestDataId> getTdataByIdWithListA200(Integer devId, Integer testRecordCount) {
    public List<BattLithiumTestData> getTdataByIdWithListA200(Integer devId, Integer testRecordCount) {
        String sql="select  * from db_batt_testdata.tb_batttestdata_" +devId
                +" where need_test=1 and test_record_count="+testRecordCount+" ";
        sql+="  ORDER BY record_num asc ";
@@ -69,7 +69,7 @@
                List list=new ArrayList<>();
                List<Float> monVols=null;
                List<Integer> monNums=null;
                BattTestDataId tdata=null;
                BattLithiumTestData tdata=null;
                int num=0;
                try {
                    while (rs.next()){
@@ -82,7 +82,7 @@
                                tdata.setMonNums(monNums);
                                list.add(tdata);
                            }
                            tdata=new BattTestDataId();
                            tdata=new BattLithiumTestData();
                            monVols=new ArrayList<>();
                            monNums=new ArrayList<>();
                            tdata.setDevId(rs.getInt("dev_id"));
@@ -212,7 +212,7 @@
    }
    public List<BattTestDataId> getTdataByIdWithListActm(Integer devId, Integer testRecordCount) {
    public List<BattLithiumTestData> getTdataByIdWithListActm(Integer devId, Integer testRecordCount) {
        String sql="select  * from db_batt_testdata.tb_batttestdata_" +devId
                +" where need_test=1 and test_record_count="+testRecordCount+" ";
        sql+="  ORDER BY record_num asc ";
@@ -225,7 +225,7 @@
                List<Float> monCaps=null;
                List<Float> monWhs=null;
                List<Integer> monNums=null;
                BattTestDataId tdata=null;
                BattLithiumTestData tdata=null;
                int num=0;
                try {
                    while (rs.next()){
@@ -245,7 +245,7 @@
                                tdata.setMonWhs(monWhs);
                                list.add(tdata);
                            }
                            tdata=new BattTestDataId();
                            tdata=new BattLithiumTestData();
                            monVols=new ArrayList<>();
                            monNums=new ArrayList<>();
                            monCurrs=new ArrayList<>();
src/main/java/com/whyc/service/SubTableService.java
@@ -1,7 +1,9 @@
package com.whyc.service;
import com.whyc.dto.DevA200AlarmDto;
import com.whyc.mapper.CallBack;
import com.whyc.pojo.db_alarm.BattAlarmHistory;
import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear;
import com.whyc.pojo.db_dis_batt.BattTestInfData;
import com.whyc.pojo.db_power_alarm.PowerAlarmHistory;
import com.whyc.util.ActionUtil;
@@ -210,4 +212,101 @@
        });
        return list.stream().findFirst().orElse((BattTestInfData) ActionUtil.objeNull);
    }
    //查询DevAlm历史告警数量
    public int getCountForDevAlm(DevA200AlarmDto dto) {
        String sql="select  count(distinct num) as number from db_alarm." +dto.getTableName()
                +" where 1=1 ";
        if(dto.getStartTime()!=null){
            sql+=" and alm_starttime  >='"+ ThreadLocalUtil.format(dto.getStartTime(),1)+"' ";
        }
        if(dto.getEndTime()!=null){
            sql+=" and alm_endtime  <='"+ThreadLocalUtil.format(dto.getEndTime(),1)+"' ";
        }
        if(dto.getDevType()!=null){
            sql+=" and  FLOOR(dev_id/100000000)="+dto.getDevType();
        }
        if(dto.getDevId()!=null){
            sql+=" and  dev_id="+dto.getDevId();
        }
        if(dto.getAlmId()!=null){
            sql+=" and alm_id="+dto.getAlmId();
        }
        sql+=" and dev_id in (" +
                "            SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr" +
                "            where tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id" +
                "           and uid="+dto.getUid()+
                ")";
        sql+="  order by alm_starttime desc ";
        List list = sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
                LinkedList<Object> temp = new LinkedList<>();
                try {
                    while (rs.next())
                        temp.add(rs.getInt("number"));
                } catch (SQLException e) {
                    e.printStackTrace();
                }
                return temp;
            }
        });
        int num =0;
        if(list!=null){
            num= (int) list.get(0);
        }
        return num;
    }
    //查询devalm历史告警
    public List getListDevAlm(DevA200AlarmDto dto){
        String sql="select  * from db_alarm." +dto.getTableName()
                +" where 1=1 ";
        if(dto.getStartTime()!=null){
            sql+=" and alm_starttime  >='"+ ThreadLocalUtil.format(dto.getStartTime(),1)+"' ";
        }
        if(dto.getEndTime()!=null){
            sql+=" and alm_endtime  <='"+ThreadLocalUtil.format(dto.getEndTime(),1)+"' ";
        }
        if(dto.getDevType()!=null){
            sql+=" and  FLOOR(dev_id/100000000)="+dto.getDevType();
        }
        if(dto.getDevId()!=null){
            sql+=" and  dev_id="+dto.getDevId();
        }
        if(dto.getAlmId()!=null){
            sql+=" and alm_id="+dto.getAlmId();
        }
        sql+=" and dev_id in (" +
                "            SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr" +
                "           where tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id" +
                "           and uid="+dto.getUid()+
                ")";
        sql+="  ORDER BY alm_starttime desc  limit "+dto.getLimitStart()+","+dto.getLimitEnd()+" ";
        List list = sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
                List<DevLithiumAlarmDataYear> list=new ArrayList<>();
                while (rs.next()){
                    DevLithiumAlarmDataYear dataYear=new DevLithiumAlarmDataYear();
                    dataYear.setNum(rs.getInt("num"));
                    dataYear.setDevId(rs.getInt("dev_id"));
                    dataYear.setAlmId(rs.getInt("alm_id"));
                    dataYear.setAlmSignalId(rs.getInt("alm_signal_id"));
                    dataYear.setAlmStarttime(rs.getTimestamp("alm_starttime"));
                    dataYear.setAlmValue(rs.getFloat("alm_value"));
                    dataYear.setAlmIsConfirmed(rs.getInt("alm_is_confirmed"));
                    dataYear.setConfirmedUid(rs.getInt("confirmed_uid"));
                    dataYear.setConfirmedTime(rs.getTimestamp("confirmed_time"));
                    dataYear.setAlmEndtime(rs.getTimestamp("alm_endtime"));
                    dataYear.setAlmClearedType(rs.getInt("alm_cleared_type"));
                    list.add(dataYear);
                }
                return list;
            }
        });
        return list;
    }
}
src/main/java/com/whyc/util/SubTablePageInfoUtil.java
@@ -1,12 +1,18 @@
package com.whyc.util;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.DevAlmEnum;
import com.whyc.dto.DevA200AlarmDto;
import com.whyc.factory.ThreadPoolExecutorFactory;
import com.whyc.mapper.CommonMapper;
import com.whyc.pojo.db_alarm.BattAlarmHistory;
import com.whyc.pojo.db_power_alarm.PowerAlarm;
import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear;
import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf;
import com.whyc.pojo.db_power_alarm.PowerAlarmHistory;
import com.whyc.pojo.db_user.UserInf;
import com.whyc.service.DevLithiumInfService;
import com.whyc.service.SubTableService;
import com.whyc.service.UserInfService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -17,6 +23,7 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
 * 数据量极大的表,按照年份分表,分页查询时获取数据
 */
@@ -27,6 +34,12 @@
    @Autowired
    private SubTableService service;
    @Autowired
    private DevLithiumInfService devLithiumInfService;
    @Autowired
    private UserInfService userInfService;
    //按年月分表
    /**按年份表分页查询*/
@@ -64,6 +77,14 @@
                powerAlarmHistory.setAlmEndTime(queryTime.get(1));
                powerAlarmHistory.setRecordYear(tableName);
                int currentCount = service.getPowerHisCount(powerAlarmHistory);
                queryCountMap.put(tableYear, currentCount);
            }
            else if (pojo instanceof DevA200AlarmDto) {
                DevA200AlarmDto dto = (DevA200AlarmDto) pojo;
                dto.setStartTime(queryTime.get(0));
                dto.setEndTime(queryTime.get(1));
                dto.setTableName(tableName);
                int currentCount = service.getCountForDevAlm(dto);
                queryCountMap.put(tableYear, currentCount);
            }
@@ -121,6 +142,30 @@
                List<PowerAlarmHistory> list =  service.getPowerHisList(powerAlarmHistory);
                dataList.addAll(list);
            }
            else if (pojo instanceof DevA200AlarmDto) {
                if(!key.equals("default")){
                    DevA200AlarmDto dto = (DevA200AlarmDto) pojo;
                    dto.setStartTime(queryTime.get(0));
                    dto.setEndTime(queryTime.get(1));
                    List<Integer> limitList = tableAndLimitMap.get(key);
                    dto.setLimitStart(limitList.get(0));
                    dto.setLimitEnd(limitList.get(1));
                    dto.setTableName(recordYear);
                    List<DevLithiumAlarmDataYear> list =  service.getListDevAlm(dto);
                    for (DevLithiumAlarmDataYear year:list) {
                        int devId=year.getDevId();
                        int uid=year.getConfirmedUid();
                        DevLithiumInf dinf=devLithiumInfService.getDinfByDevId(devId);
                        UserInf uinf= userInfService.getUinfByUId(uid);
                        int almId=year.getAlmId();
                        String almName= DevAlmEnum.getValue(almId);
                        year.setAlmName(almName!=null?almName:"");
                        year.setDevInf(dinf);
                        year.setConfirmedUname(uinf!=null?uinf.getUname():"");
                    }
                    dataList.addAll(list);
                }
            }
        }
        pageInfo.setList(dataList);
        return pageInfo;
src/main/java/com/whyc/webSocket/DevLithiumRtStateSocket.java
@@ -5,7 +5,7 @@
import com.whyc.dto.RtStateDto;
import com.whyc.service.A200RealStateService;
import com.whyc.service.ActmRealStateService;
import com.whyc.service.BattRtDataService;
import com.whyc.service.BattLithiumRtDataService;
import com.whyc.service.WorkStateChangeEventService;
import com.whyc.util.ActionUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +27,7 @@
    private Thread thread;
    private static BattRtDataService battRtDataService;
    private static BattLithiumRtDataService battLithiumRtDataService;
    private static A200RealStateService a200RtStateService;
@@ -43,8 +43,8 @@
    private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>();
    @Autowired
    public void setBattRtDataService(BattRtDataService battRtDataService) {
        DevLithiumRtStateSocket.battRtDataService = battRtDataService;
    public void setBattRtDataService(BattLithiumRtDataService battLithiumRtDataService) {
        DevLithiumRtStateSocket.battLithiumRtDataService = battLithiumRtDataService;
    }
    @Autowired
@@ -111,8 +111,8 @@
    private Response getActmState(int devId) {
        Map<String, Response> map = new HashMap<>();
        Response resActmState=actmRtStateService.getActmState(devId);
        Response rtDataState0=battRtDataService.getActmRtdataState(devId,0);
        Response rtDataState1=battRtDataService.getActmRtdataState(devId,1);
        Response rtDataState0= battLithiumRtDataService.getActmRtdataState(devId,0);
        Response rtDataState1= battLithiumRtDataService.getActmRtdataState(devId,1);
        Response event=eventService.getWorkEvent(devId);
        map.put("resActmState",resActmState);
        map.put("rtDataState0",rtDataState0);
@@ -125,7 +125,7 @@
    private Response getA200State(int devId) {
        Map<String, Response> map = new HashMap<>();
        Response resA200State=a200RtStateService.getA200State(devId);
        Response rtDataState=battRtDataService.getA200RtdataState(devId);
        Response rtDataState= battLithiumRtDataService.getA200RtdataState(devId);
        Response event=eventService.getWorkEvent(devId);
        map.put("resA200State",resA200State);
        map.put("rtDataState",rtDataState);
src/main/java/com/whyc/webSocket/DevLithiumStatisticSocket.java
@@ -4,7 +4,7 @@
import com.whyc.dto.Response;
import com.whyc.factory.ThreadPoolExecutorFactory;
import com.whyc.pojo.db_user.UserInf;
import com.whyc.service.BattTestDataInfService;
import com.whyc.service.BattLithiumTestDataInfService;
import com.whyc.service.DevLithiumInfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -32,7 +32,7 @@
    private static DevLithiumInfService devLithiumInfService;
    private static BattTestDataInfService battTestDataInfService;
    private static BattLithiumTestDataInfService battLithiumTestDataInfService;
    private HttpSession httpSession;
@@ -43,8 +43,8 @@
    }
    @Autowired
    public void setBattTestDataInfService(BattTestDataInfService battTestDataInfService) {
        DevLithiumStatisticSocket.battTestDataInfService = battTestDataInfService;
    public void setBattTestDataInfService(BattLithiumTestDataInfService battLithiumTestDataInfService) {
        DevLithiumStatisticSocket.battLithiumTestDataInfService = battLithiumTestDataInfService;
    }
@@ -79,7 +79,7 @@
            CountDownLatch latch = new CountDownLatch(3);
            //充放电一体机测试统计/锂电均衡仪测试统计
            poolExecutor.execute(() -> {
                Map<String,Object> lithiumTestInfMap = battTestDataInfService.getDevTinfByYearMonth(userId);
                Map<String,Object> lithiumTestInfMap = battLithiumTestDataInfService.getDevTinfByYearMonth(userId);
                map.put("lithiumTestInf",lithiumTestInfMap);
                latch.countDown();
            });
@@ -91,7 +91,7 @@
            });
            //近一周电池测试趋势统计(从当前时间开始)
            poolExecutor.execute(() -> {
                Map<String,Object> devTestByWeekMap=battTestDataInfService.getDevTinfByWeek(userId);
                Map<String,Object> devTestByWeekMap= battLithiumTestDataInfService.getDevTinfByWeek(userId);
                map.put("devLithiumTestByWeek",devTestByWeekMap);
                latch.countDown();
            });
src/main/resources/mapper/BattLithiumTestDataInfMapper.xml
File was renamed from src/main/resources/mapper/BattTestDataInfMapper.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.whyc.mapper.BattTestDataInfMapper">
    <resultMap id="staticTinf" type="battTestDataInf">
<mapper namespace="com.whyc.mapper.BattLithiumTestDataInfMapper">
    <resultMap id="staticTinf" type="BattLithiumTestDataInf">
        <id property="num" column="num"></id>
        <result property="devId" column="dev_id"></result>
        <result property="testType" column="test_type"></result>
@@ -51,7 +51,7 @@
            )
        </where>
    </select>
    <resultMap id="staticTinfWeek" type="batttestdataInf">
    <resultMap id="staticTinfWeek" type="BattLithiumTestDataInf">
        <id property="num" column="num"></id>
        <result property="devId" column="dev_id"></result>
        <result property="testType" column="test_type"></result>
@@ -75,7 +75,7 @@
            )
        </where>
    </select>
    <select id="getTinfById" resultType="com.whyc.pojo.db_batt_testdata.BattTestDataInf">
    <select id="getTinfById" resultType="com.whyc.pojo.db_lithium_testdata.BattLithiumTestDataInf">
        select *
        from db_batt_testdata.tb_batttestdata_inf
        <where>
src/main/resources/mapper/BattTestDataIdMapper.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.whyc.mapper.BattTestDataIdMapper">
<mapper namespace="com.whyc.mapper.BattLithiumTestDataMapper">
</mapper>