whycxzp
2025-03-14 ba29811c971a8ad9bdffd1bf1b33231e76c980d5
类名命名规范化
2 文件已重命名
6个文件已修改
112 ■■■■ 已修改文件
src/main/java/com/whyc/mapper/BatttestdataIdMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataId.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataInf.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ExcelExportService.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SubTablePageInfoService.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BatttestdataInfMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BatttestdataIdMapper.java
@@ -1,6 +1,6 @@
package com.whyc.mapper;
import com.whyc.pojo.db_batt_testdata.BatttestdataId;
import com.whyc.pojo.db_batt_testdata.BattTestDataId;
public interface BatttestdataIdMapper extends CustomMapper<BatttestdataId>{
public interface BatttestdataIdMapper extends CustomMapper<BattTestDataId>{
}
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java
@@ -1,22 +1,22 @@
package com.whyc.mapper;
import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
import com.whyc.pojo.db_batt_testdata.BattTestDataInf;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface BatttestdataInfMapper extends CustomMapper<BatttestdataInf>{
public interface BatttestdataInfMapper extends CustomMapper<BattTestDataInf>{
    //充放电一体机测试统计
    List<BatttestdataInf> getDevTinf(@Param("uid") int uid);
    List<BattTestDataInf> getDevTinf(@Param("uid") int uid);
    //本年
    List<BatttestdataInf> getDevTinfByYear(@Param("uid")int userId);
    List<BattTestDataInf> getDevTinfByYear(@Param("uid")int userId);
    //本月
    List<BatttestdataInf> getDevTinfByMonth(@Param("uid")int userId);
    List<BattTestDataInf> getDevTinfByMonth(@Param("uid")int userId);
    //近一周(mysql中不会算上今天)
    List<BatttestdataInf> getDevTinfByWeek(@Param("uid")int userId,@Param("type")int type);
    List<BattTestDataInf> getDevTinfByWeek(@Param("uid")int userId, @Param("type")int type);
    //获取充放电数据
    List<BatttestdataInf> getTinfById( @Param("type")int type, @Param("devId")Integer devId);
    List<BattTestDataInf> getTinfById(@Param("type")int type, @Param("devId")Integer devId);
}
src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataId.java
File was renamed from src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java
@@ -26,7 +26,7 @@
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="BatttestdataId对象", description="设备电池历史数据记录表")
public class BatttestdataId implements Serializable {
public class BattTestDataId implements Serializable {
    private static final long serialVersionUID = 1L;
src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataInf.java
File was renamed from src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java
@@ -26,7 +26,7 @@
@Accessors(chain = true)
@TableName(schema = "db_batt_testdata",value ="tb_batttestdata_inf")
@ApiModel(value="BatttestdataInf对象", description="电池组历史数据总表")
public class BatttestdataInf implements Serializable {
public class BattTestDataInf implements Serializable {
    private static final long serialVersionUID = 1L;
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -4,8 +4,8 @@
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.pojo.db_batt_testdata.BattTestDataId;
import com.whyc.pojo.db_batt_testdata.BattTestDataInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -31,7 +31,7 @@
    public Map<String, Object> getDevTinfByYearMonth(int userId) {
        Map<String,Object> map=new HashMap<>();
        //本年
        List<BatttestdataInf> listYear=mapper.getDevTinfByYear(userId);
        List<BattTestDataInf> 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<BattTestDataInf>> typeMapY = listYear.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> list=typeMapY.get(type);
            Map<Integer, List<BattTestDataInf>> testMapY = list.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> listMonth=mapper.getDevTinfByMonth(userId);
        Map<Integer, List<BattTestDataInf>> typeMapM = listMonth.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> list=typeMapM.get(type);
            Map<Integer, List<BattTestDataInf>> testMapM = list.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> listW1=mapper.getDevTinfByWeek(userId,1);
        Map<String, List<BattTestDataInf>> typeMapW1 = listW1.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> list1=typeMapW1.get(day);
            Map<Integer, List<BattTestDataInf>> testMapM1 = list1.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> listW2=mapper.getDevTinfByWeek(userId,2);
        Map<String, List<BattTestDataInf>> typeMapW2= listW2.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> list2=typeMapW2.get(day);
            Map<Integer, List<BattTestDataInf>> testMapM2 = list2.stream().collect(Collectors.groupingBy(BattTestDataInf::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<BattTestDataInf> listDis=mapper.getTinfById(3,devId);
        List<BattTestDataInf> 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<BattTestDataInf> 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<BattTestDataId> list=subService.getTdataById(devId,testRecordCount);
        return new Response().setII(1,list!=null,list,"获取设备某次记录详细的单体放电过程");
    }
    //获取放电inf
    public BatttestdataInf getTinfExport(Integer devId, Integer testRecordCount) {
    public BattTestDataInf 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);
        BattTestDataInf tinf=mapper.selectOne(wrapper);
        return  tinf;
    }
}
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_batt_testdata.BattTestDataId;
import com.whyc.pojo.db_batt_testdata.BattTestDataInf;
import com.whyc.util.ActionUtil;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -40,12 +40,12 @@
            row.createCell(i).setCellValue(titiles[i]);
        }
        rowNum++;
        List<BatttestdataId> list=subService.getTdataById(devId,testRecordCount);
        List<BattTestDataId> list=subService.getTdataById(devId,testRecordCount);
        if(list!=null){
            //数据栏
            for (int i = 0; i < list.size(); i++) {
                sheet.createRow(rowNum);  //创建行
                BatttestdataId tdata=list.get(i);
                BattTestDataId 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<BattTestDataId> 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);
                BattTestDataId 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);
        BattTestDataInf 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<BattTestDataId> 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);
                BattTestDataId 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);
        BattTestDataInf 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.DalmDto;
import com.whyc.mapper.CallBack;
import com.whyc.pojo.db_alarm.DevAlarmDataYear;
import com.whyc.pojo.db_batt_testdata.BatttestdataId;
import com.whyc.pojo.db_batt_testdata.BattTestDataId;
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<BattTestDataId> 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<BattTestDataId> list=new ArrayList<>();
                while (rs.next()){
                    BatttestdataId tdata=new BatttestdataId();
                    BattTestDataId tdata=new BattTestDataId();
                    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<BattTestDataId> 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;
                BattTestDataId tdata=null;
                int num=0;
                try {
                    while (rs.next()){
@@ -82,7 +82,7 @@
                                tdata.setMonNums(monNums);
                                list.add(tdata);
                            }
                            tdata=new BatttestdataId();
                            tdata=new BattTestDataId();
                            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<BattTestDataId> 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;
                BattTestDataId tdata=null;
                int num=0;
                try {
                    while (rs.next()){
@@ -245,7 +245,7 @@
                                tdata.setMonWhs(monWhs);
                                list.add(tdata);
                            }
                            tdata=new BatttestdataId();
                            tdata=new BattTestDataId();
                            monVols=new ArrayList<>();
                            monNums=new ArrayList<>();
                            monCurrs=new ArrayList<>();
src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -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_batt_testdata.BattTestDataInf">
        select *
        from db_batt_testdata.tb_batttestdata_inf
        <where>