From 7c4cd64b1d444dbbea40c660e7be47d1b6258da3 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期五, 03 十一月 2023 21:33:51 +0800
Subject: [PATCH] 文档
---
ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java b/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java
index 3f0f48c..8038a21 100644
--- a/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java
+++ b/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java
@@ -1,6 +1,9 @@
package com.ycl.smoke.task;
import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ycl.service.redis.RedisService;
import com.ycl.smoke.entity.*;
import com.ycl.smoke.dto.*;
@@ -31,6 +34,8 @@
IOdsInTimeService inTimeService;
+ IOdsInTimeCountService iOdsInTimeCountService;
+
IOdsLocaleService localeService;
IOdsCustomerService customerService;
@@ -45,6 +50,11 @@
@Autowired
public void setSmokeDetectionService(ISmokeDetectionService smokeDetectionService) {
this.smokeDetectionService = smokeDetectionService;
+ }
+
+ @Autowired
+ public void setIOdsInTimeCountService(IOdsInTimeCountService iOdsInTimeCountService) {
+ this.iOdsInTimeCountService = iOdsInTimeCountService;
}
@Autowired
@@ -98,7 +108,7 @@
if (responseDto.getStatus() == 200) {
AlarmMsgResponseDto dto = JSON.parseObject(responseDto.getData().toString(), AlarmMsgResponseDto.class);
List<OdsAlarmMsg> list = dto.getContent();
- System.out.println(list.size());
+ // System.out.println(list.size());
list.forEach(o -> {
try {
alarmMsgService.save(o);
@@ -185,21 +195,54 @@
}
- @Scheduled(cron = "0 0 1 * * ?") // 姣忓ぉ闆剁偣鎵ц
-// @Scheduled(cron = "0/1 * * * * ?") // 姣忕鎵ц
- public void listDataIntime() {
- try {
- DataIntimeParamDto paramDto = DataIntimeParamDto.builder().build();
+ // @Scheduled(cron = "0 0 1 * * ?") // 姣忓ぉ闆剁偣鎵ц
+ @Scheduled(cron = "0 */1 * * * ?") // 姣�5鍒嗛挓鎵ц
+ public void listDataInTime() {
+ DataIntimeParamDto paramDto = DataIntimeParamDto.builder().build();
+ // {"StartAt":0,"Size":20,"Typ":2,"SortBy":"status","SortMode":"asc","Param":{"StatusOfRecord":"NORMAL"}}
+ paramDto.setSize(20);
+ paramDto.setStartAt(0);
+ paramDto.setTyp(2);
+ paramDto.setSortBy("status");
+ paramDto.setSortMode("asc");
+ DataIntimeParamChildDto paramChildDto = new DataIntimeParamChildDto();
+ paramChildDto.setStatusOfRecord("NORMAL");
+ paramDto.setParam(paramChildDto);
+
+ getInTimeData(paramDto);
+
+ paramDto.setTyp(1);
+ getInTimeData(paramDto);
+ }
+
+ private void getInTimeData(DataIntimeParamDto paramDto) {
+ try {
+ String jj = JSON.toJSONString(paramDto);
String json = smokeDetectionService.listDataIntime(paramDto, redisService.get(RedisKey.SMOKE_TOKEN).toString());
SmokeResultResponseDto responseDto = JSON.parseObject(json, SmokeResultResponseDto.class);
if (responseDto.getStatus() == 200) {
DataIntimeResponseDto dataIntimeResponseDto = JSON.parseObject(responseDto.getData().toString(), DataIntimeResponseDto.class);
List<OdsInTime> list = dataIntimeResponseDto.getContent();
+
+ OdsInTimeCount odsInTimeCount = new OdsInTimeCount();
+ LambdaQueryWrapper<OdsInTimeCount> queryWrapper = new LambdaQueryWrapper<OdsInTimeCount>().eq(OdsInTimeCount::getType, paramDto.getTyp());
+ List<OdsInTimeCount> countList = iOdsInTimeCountService.list(queryWrapper);
+ if (countList.size() > 0) {
+ odsInTimeCount = countList.get(0);
+ }
+ odsInTimeCount.setDeviceNum(dataIntimeResponseDto.getDeviceNum());
+ odsInTimeCount.setLocaleNum(dataIntimeResponseDto.getLocaleNum());
+ odsInTimeCount.setOnlineNum(dataIntimeResponseDto.getOnlineNum());
+ odsInTimeCount.setTotal(dataIntimeResponseDto.getTotal());
+ iOdsInTimeCountService.saveOrUpdate(odsInTimeCount);
+
list.forEach(o -> {
try {
- inTimeService.save(o);
+ o.setModifyTime(LocalDateTime.now());
+ o.setTyp(paramDto.getTyp());
+ inTimeService.saveOrUpdate(o);
} catch (Exception ex) {
System.out.printf(ex.getMessage());
}
@@ -347,7 +390,7 @@
}
void login() {
- LoginParamDto loginParamDto = LoginParamDto.builder().username("connect_test2").password("test@234").noCode(true).build();
+ LoginParamDto loginParamDto = LoginParamDto.builder().username("閬傛槍鍩庣灞�").password("123456").noCode(true).build();
String json = smokeDetectionService.loginAction(loginParamDto);
SmokeResultResponseDto responseDto = JSON.parseObject(json, SmokeResultResponseDto.class);
if (responseDto.getStatus() == 200) {
--
Gitblit v1.8.0