1.终端周期检测定时任务

2.监测点超标统计定时任务
This commit is contained in:
xy
2024-06-26 11:22:53 +08:00
parent 5c36e2e4f4
commit 16e90de9eb
7 changed files with 21 additions and 21 deletions

View File

@@ -26,7 +26,7 @@ public interface ILineWarningService extends IService<LineWarning> {
/**
* 每日统计当前月各监测点各指标累计超标天数
*/
void addHeBeiNorthLineWarning();
void addHeBeiNorthLineWarning(String startTime, String endTime);
/**
* 获取在线监测的数据列表

View File

@@ -131,18 +131,18 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
@Override
@Transactional(rollbackFor = Exception.class)
public void addHeBeiNorthLineWarning() {
public void addHeBeiNorthLineWarning(String startTime, String endTime) {
List<LineWarning> result = new ArrayList<>();
//获取指标集合(8个指标,包含总指标)
//获取指标集合(8个指标)
List<DictData> dataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INDICATOR_TYPE.getCode()).getData();
Map<String, DictData> targetMap = dataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
//获取监测点和部门表关系
List<DeptLine> deptLines = deptLineFeignClient.getAllData().getData();
Map<String, List<DeptLine>> deptLineMap = deptLines.stream().collect(Collectors.groupingBy(DeptLine::getLineId));
//获取监测点按时间统计越限天数
LocalDate firstDayOfMonth = LocalDate.now().minusDays(1).with(TemporalAdjusters.firstDayOfMonth());
String date = DateUtil.format(firstDayOfMonth.atStartOfDay(), DatePattern.NORM_DATE_PATTERN);
String endDate = DateUtil.format(LocalDateTime.now().minusDays(1), DatePattern.NORM_DATE_PATTERN);
LocalDate firstDayOfMonth = Objects.isNull(startTime)?LocalDate.now().minusDays(1).with(TemporalAdjusters.firstDayOfMonth()):LocalDate.parse(startTime);
String date = Objects.isNull(startTime)?DateUtil.format(firstDayOfMonth.atStartOfDay(), DatePattern.NORM_DATE_PATTERN):startTime;
String endDate = Objects.isNull(endTime)?DateUtil.format(LocalDateTime.now().minusDays(1), DatePattern.NORM_DATE_PATTERN):endTime;
RStatLimitQueryParam rStatLimitQueryParam = new RStatLimitQueryParam(null,date,endDate);
List<RStatLimitTargetVO> limitTarget = limitRateDClient.monitorOverLimitDays(rStatLimitQueryParam).getData();
//按各指标统计越限天数