新增定时任务和治理数据最新时间记录
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package com.njcn.csdevice.job;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DayDataJob {
|
||||
|
||||
private final IRStatIntegrityDService statIntegrityDService;
|
||||
private final IRStatOnlineRateDService statOnlineRateDService;
|
||||
|
||||
/**
|
||||
* 每天1点计算治理设备的完整性
|
||||
*
|
||||
* @date 2025/7/1
|
||||
*/
|
||||
@Scheduled(cron = "0 0 1 * * ?")
|
||||
public void lineIntegrityJob() {
|
||||
StatisticsDataParam param = new StatisticsDataParam();
|
||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||
LocalDateTime start = yesterday.atStartOfDay();
|
||||
LocalDateTime end = yesterday.atTime(23, 59, 59);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN);
|
||||
param.setStartTime(start.format(formatter));
|
||||
param.setEndTime(end.format(formatter));
|
||||
statIntegrityDService.addData(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 每天2点计算治理设备的在线率
|
||||
*
|
||||
* @date 2025/7/1
|
||||
*/
|
||||
@Scheduled(cron = "0 0 2 * * ?")
|
||||
public void devOnlineRateJob() {
|
||||
StatisticsDataParam param = new StatisticsDataParam();
|
||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||
LocalDateTime start = yesterday.atStartOfDay();
|
||||
LocalDateTime end = yesterday.atTime(23, 59, 59);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN);
|
||||
param.setStartTime(start.format(formatter));
|
||||
param.setEndTime(end.format(formatter));
|
||||
statOnlineRateDService.addData(param);
|
||||
}
|
||||
}
|
||||
@@ -391,17 +391,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
//治理监测点
|
||||
if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||
// select
|
||||
// t1.id
|
||||
// from
|
||||
// cs_dev_model_relation t0
|
||||
// left join cs_dev_model t1 on
|
||||
// t0.model_id = t1.id
|
||||
// where
|
||||
// t0.status="1" and
|
||||
// t0.dev_id = #{devId} and t1.`type` = #{type}
|
||||
modelId = csDevModelRelationService.getModelByType(deviceId,0);
|
||||
//select * from cs_data_set where pid = modelId and clDev = 0
|
||||
dataSet = csDataSetService.findDataSetByModelId(modelId,0);
|
||||
}
|
||||
//电网侧监测点
|
||||
@@ -447,6 +437,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
addDataSet(dataSetList, item, "最新数据", "rt");
|
||||
addDataSet(dataSetList, item, "历史统计数据", "history");
|
||||
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
||||
addDataSet(dataSetList, item, "模块数据", "moduleData");
|
||||
if (isPortableDevice) {
|
||||
// 便携式设备特有的数据集
|
||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||
|
||||
Reference in New Issue
Block a user