|
@@ -1,22 +1,20 @@
|
|
|
package com.sckw.slope.detection.service.task;
|
|
package com.sckw.slope.detection.service.task;
|
|
|
|
|
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.sckw.core.model.constant.StringConstant;
|
|
|
import com.sckw.core.model.enums.ReportTypeEnum;
|
|
import com.sckw.core.model.enums.ReportTypeEnum;
|
|
|
import com.sckw.excel.annotation.ExcelContext;
|
|
import com.sckw.excel.annotation.ExcelContext;
|
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
|
import com.sckw.slope.detection.dao.mysql.KwsReportTemplateMapper;
|
|
import com.sckw.slope.detection.dao.mysql.KwsReportTemplateMapper;
|
|
|
|
|
+import com.sckw.slope.detection.dao.tdengine.SlopeDataMapper;
|
|
|
import com.sckw.slope.detection.model.dos.mysql.KwsReportTemplate;
|
|
import com.sckw.slope.detection.model.dos.mysql.KwsReportTemplate;
|
|
|
-import com.sckw.slope.detection.model.dos.mysql.KwsThreshold;
|
|
|
|
|
import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
|
|
import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
|
|
|
import com.sckw.slope.detection.model.vo.DeviceVo;
|
|
import com.sckw.slope.detection.model.vo.DeviceVo;
|
|
|
-import com.sckw.slope.detection.model.vo.excel.KwsAlarmExportVO;
|
|
|
|
|
import com.sckw.slope.detection.model.vo.excel.TaskReportExportVO;
|
|
import com.sckw.slope.detection.model.vo.excel.TaskReportExportVO;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
-import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
|
-import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -27,7 +25,6 @@ import java.io.IOException;
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
-import java.time.ZoneId;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -43,6 +40,9 @@ import java.util.stream.Collectors;
|
|
|
@EnableScheduling
|
|
@EnableScheduling
|
|
|
public class ReportTemplateTaskService {
|
|
public class ReportTemplateTaskService {
|
|
|
|
|
|
|
|
|
|
+ @Value("${scheduled.template.enable}")
|
|
|
|
|
+ private String templateEnable;
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
KwsReportTemplateMapper reportTemplateMapper;
|
|
KwsReportTemplateMapper reportTemplateMapper;
|
|
|
|
|
|
|
@@ -75,15 +75,15 @@ public class ReportTemplateTaskService {
|
|
|
list.addAll(Arrays.asList(intergration));
|
|
list.addAll(Arrays.asList(intergration));
|
|
|
String projectId = kwsReportTemplate.getProjectId();
|
|
String projectId = kwsReportTemplate.getProjectId();
|
|
|
//首先查询模板中的要素关联的设备-项目中的设备
|
|
//首先查询模板中的要素关联的设备-项目中的设备
|
|
|
- List<DeviceVo> devices = reportTemplateMapper.selectDeviceByProjectId(projectId,list);
|
|
|
|
|
|
|
+ List<DeviceVo> devices = reportTemplateMapper.selectDeviceByProjectId(projectId, list);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
//List<Object> deviceName = new ArrayList<>();
|
|
//List<Object> deviceName = new ArrayList<>();
|
|
|
List<Map<String,Object>> deviceData = new ArrayList<>();
|
|
List<Map<String,Object>> deviceData = new ArrayList<>();
|
|
|
Map<String,List<Object>> map1 = new HashMap<>();
|
|
Map<String,List<Object>> map1 = new HashMap<>();
|
|
|
for (DeviceVo vo : devices){
|
|
for (DeviceVo vo : devices){
|
|
|
List<SlopeData> selectedData = slopeDataMapper.selectLineListByList(vo.getSnCode(), list, "2022-1-1 00:00:00", date2);
|
|
List<SlopeData> selectedData = slopeDataMapper.selectLineListByList(vo.getSnCode(), list, "2022-1-1 00:00:00", date2);
|
|
|
- if(Objects.nonNull(selectedData)){
|
|
|
|
|
- Map<String,List<SlopeData>> map = selectedData.stream().collect(Collectors.groupingBy(SlopeData::getMsgId));
|
|
|
|
|
|
|
+ if (Objects.nonNull(selectedData)) {
|
|
|
|
|
+ Map<String, List<SlopeData>> map = selectedData.stream().collect(Collectors.groupingBy(SlopeData::getMsgId));
|
|
|
|
|
|
|
|
List<Object> list1 = new ArrayList<>();
|
|
List<Object> list1 = new ArrayList<>();
|
|
|
map.forEach((key,value) -> {
|
|
map.forEach((key,value) -> {
|