8 文件已重命名
8个文件已修改
3个文件已删除
3个文件已添加
File was renamed from src/main/java/com/whyc/controller/BattTestDataInfController.java |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * TODO 暂无这个字段,项目完结时确认没有的时候删除 |
| | | */ |
| | | |
| | | @Deprecated |
| | | @RestController |
| | | @Api(tags = "actm均衡仪控制操作") |
| | | @RequestMapping("actmparam") |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_lithium_ram_db.BattLithiumRtData; |
| | | |
| | | public interface BattLithiumRtDataMapper extends CustomMapper<BattLithiumRtData>{ |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData; |
| | | |
| | | public interface BattLithiumTestDataMapper extends CustomMapper<BattLithiumTestData>{ |
| | | } |
File was renamed from src/main/java/com/whyc/pojo/db_lithium_ram_db/BattRtdata.java |
| | |
| | | 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; |
| | | |
File was renamed from src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataId.java |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
File was renamed from src/main/java/com/whyc/pojo/db_batt_testdata/BattTestDataInf.java |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
File was renamed from src/main/java/com/whyc/service/BattRtDataService.java |
| | |
| | | |
| | | 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电池组数据 |
| | |
| | | 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,"获取电池组数据"); |
| | | } |
| | | |
| | |
| | | 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,"获取电池组数据"); |
| | | } |
| | | } |
File was renamed from src/main/java/com/whyc/service/BattTestDataInfService.java |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | 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; |
| | |
| | | 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<>(); |
| | |
| | | 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()); |
| | |
| | | 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()); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | } |
| | | //获取设备某次记录详细的单体放电过程 |
| | | 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; |
| | | } |
| | | } |
File was renamed from src/main/java/com/whyc/service/BattTestDataIdService.java |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class BattTestDataIdService { |
| | | public class BattLithiumTestDataService { |
| | | } |
| | |
| | | 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; |
| | |
| | | private SubTablePageInfoService subService; |
| | | |
| | | @Autowired(required = false) |
| | | private BattTestDataInfService infService; |
| | | private BattLithiumTestDataInfService infService; |
| | | |
| | | //导出文件 |
| | | public void exportExcel1(Integer devId, Integer testRecordCount,HttpServletResponse response) { |
| | |
| | | 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); |
| | |
| | | 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; |
| | | // 创建标题行 |
| | |
| | | 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())); |
| | |
| | | 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()) |
| | |
| | | cellStyle.setFont(font); |
| | | |
| | | String[] titiles=new String[]{"测试时长"}; |
| | | List<BattTestDataId> list=subService.getTdataByIdWithListActm(devId,testRecordCount); |
| | | List<BattLithiumTestData> list=subService.getTdataByIdWithListActm(devId,testRecordCount); |
| | | |
| | | int rowNum=0; |
| | | // 创建标题行 |
| | |
| | | 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(); |
| | |
| | | cellStyle.setFont(font); |
| | | |
| | | //获取放电inf |
| | | BattTestDataInf tinf=infService.getTinfExport(devId,testRecordCount); |
| | | BattLithiumTestDataInf tinf=infService.getTinfExport(devId,testRecordCount); |
| | | |
| | | String[] titiles3=new String[]{"电池包序号:","模组编号:","工作模式:","电池类型:","电池串数:","电压阀值(v):" |
| | | ,"工作电流(A):","开始测试时间:","结束测试时间:","停止原因:"}; |
| | |
| | | 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; |
| | |
| | | @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")); |
| | |
| | | } |
| | | |
| | | //获取设备某次记录详细的单体放电过程 |
| | | 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 "; |
| | |
| | | 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()){ |
| | |
| | | tdata.setMonNums(monNums); |
| | | list.add(tdata); |
| | | } |
| | | tdata=new BattTestDataId(); |
| | | tdata=new BattLithiumTestData(); |
| | | monVols=new ArrayList<>(); |
| | | monNums=new ArrayList<>(); |
| | | tdata.setDevId(rs.getInt("dev_id")); |
| | |
| | | } |
| | | |
| | | |
| | | 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 "; |
| | |
| | | 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()){ |
| | |
| | | tdata.setMonWhs(monWhs); |
| | | list.add(tdata); |
| | | } |
| | | tdata=new BattTestDataId(); |
| | | tdata=new BattLithiumTestData(); |
| | | monVols=new ArrayList<>(); |
| | | monNums=new ArrayList<>(); |
| | | monCurrs=new ArrayList<>(); |
| | |
| | | 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; |
| | |
| | | }); |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 数据量极大的表,按照年份分表,分页查询时获取数据 |
| | | */ |
| | |
| | | |
| | | @Autowired |
| | | private SubTableService service; |
| | | |
| | | @Autowired |
| | | private DevLithiumInfService devLithiumInfService; |
| | | |
| | | @Autowired |
| | | private UserInfService userInfService; |
| | | |
| | | //按年月分表 |
| | | /**按年份表分页查询*/ |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | private Thread thread; |
| | | |
| | | private static BattRtDataService battRtDataService; |
| | | private static BattLithiumRtDataService battLithiumRtDataService; |
| | | |
| | | private static A200RealStateService a200RtStateService; |
| | | |
| | |
| | | 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 |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | |
| | | private static DevLithiumInfService devLithiumInfService; |
| | | |
| | | private static BattTestDataInfService battTestDataInfService; |
| | | private static BattLithiumTestDataInfService battLithiumTestDataInfService; |
| | | |
| | | |
| | | private HttpSession httpSession; |
| | |
| | | } |
| | | |
| | | @Autowired |
| | | public void setBattTestDataInfService(BattTestDataInfService battTestDataInfService) { |
| | | DevLithiumStatisticSocket.battTestDataInfService = battTestDataInfService; |
| | | public void setBattTestDataInfService(BattLithiumTestDataInfService battLithiumTestDataInfService) { |
| | | DevLithiumStatisticSocket.battLithiumTestDataInfService = battLithiumTestDataInfService; |
| | | } |
| | | |
| | | |
| | |
| | | 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(); |
| | | }); |
| | |
| | | }); |
| | | //近一周电池测试趋势统计(从当前时间开始) |
| | | poolExecutor.execute(() -> { |
| | | Map<String,Object> devTestByWeekMap=battTestDataInfService.getDevTinfByWeek(userId); |
| | | Map<String,Object> devTestByWeekMap= battLithiumTestDataInfService.getDevTinfByWeek(userId); |
| | | map.put("devLithiumTestByWeek",devTestByWeekMap); |
| | | latch.countDown(); |
| | | }); |
File was renamed from src/main/resources/mapper/BattTestDataInfMapper.xml |
| | |
| | | <?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> |
| | |
| | | ) |
| | | </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> |
| | |
| | | ) |
| | | </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> |
| | |
| | | <?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> |