whyclxw
7 天以前 669906b87674d4b60a6fd5ea3a938c636952dbc2
src/main/java/com/whyc/service/BattRealdataIdService.java
@@ -9,6 +9,8 @@
import com.whyc.mapper.CommonMapper;
import com.whyc.pojo.db_data_history.BattRealdataId;
import com.whyc.pojo.db_param.AlmAnalysisParam;
import com.whyc.pojo.db_param.AppParam;
import com.whyc.util.ActionUtil;
import com.whyc.util.DateUtil;
import com.whyc.util.ThreadLocalUtil;
@@ -40,6 +42,12 @@
    @Autowired
    private BattInfService binfService;
    @Autowired
    private AlmAnalysisParamService almAnalysisParamService;
    @Autowired
    private AppParamService appParamService;
    //获取电池组最近一季度的单体数据
@@ -219,9 +227,16 @@
        return new Response().set(1, dataListSorted);
    }
    //电池告警点击具体告警信息查看从告警开始时间到现在的历史实时数据
    public Response getBattHisRealInAlm(Integer battgroupId, String startTime, Integer monNum) throws ParseException, InterruptedException {
    public Response getBattHisRealInAlm(Integer battgroupId, String startTime, Integer almId) throws ParseException, InterruptedException {
        //获取告警almId对应的分析配置属性值
        AlmAnalysisParam almAnalysisParam= almAnalysisParamService.getAnalysisParam(almId);
        List<RealDateDTO> dataList = new LinkedList<>();
        List<List<Date>> monthTimeList = DateUtil.getMonthTime(ThreadLocalUtil.parse(startTime,1),new Date());
        //获取预警分析周期阈值
        AppParam appParam = appParamService.getAlarmAnalysisCycle();
        Integer cycleTime=appParam.getParamValue().intValue();
        Date cyscleDate=ActionUtil.getDateAdd(ThreadLocalUtil.parse(startTime,1),cycleTime*(-1));
        //获取cyscleDate到现在所有的历史实时数据
        List<List<Date>> monthTimeList = DateUtil.getMonthTime(cyscleDate,new Date());
        ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor();
        CountDownLatch latch = new CountDownLatch(monthTimeList.size());
        for (int i = 0; i < monthTimeList.size(); i++) {
@@ -237,15 +252,7 @@
                int tableNum = subTablePageInfoService.judgeTable_realdata(table);
                List<RealDateDTO> list = new ArrayList();
                if (tableNum > 0) {
                    //获取指定时间段内最大最小recordNum确保数据的完整
                    List recordNums= subTablePageInfoService.getMaxAndMinRecordNum(realdata);
                    Integer maxRecordNum= 0;
                    Integer minRecordNum= 0;
                    if(recordNums.size()>0){
                        maxRecordNum=(Integer)recordNums.get(0);
                        minRecordNum=(Integer)recordNums.get(1);
                    }
                    list = subTablePageInfoService.getBattRealDataHis(realdata,1,maxRecordNum,minRecordNum);
                    list = subTablePageInfoService.getBattHisRealInAlm(realdata);
                }
                dataList.addAll(list);
                latch.countDown();
@@ -254,7 +261,7 @@
        }
        latch.await(10, TimeUnit.MINUTES);
        List dataListSorted = dataList.stream().sorted(Comparator.comparing(RealDateDTO::getRecordTime)).collect(Collectors.toList());
        return new Response().set(1, dataListSorted);
        return new Response().setIII(1,true, dataListSorted,almAnalysisParam,"电池告警点击具体告警信息查看从告警开始时间到现在的历史实时数据");
    }
}