Commit 870bdbd9 authored by tangwei's avatar tangwei

解决冲突

parents 4656ba5e d352e924
package com.yeejoin.amos.boot.module.jxiop.biz.constants; package com.yeejoin.amos.boot.module.jxiop.biz.constants;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import java.util.HashMap; import java.util.HashMap;
public class CommonConstans { public class CommonConstans {
...@@ -100,7 +103,7 @@ public class CommonConstans { ...@@ -100,7 +103,7 @@ public class CommonConstans {
public static final String Fourdecimalplaces = "%.4f"; public static final String Fourdecimalplaces = "%.4f";
public static final String QueryStringFrontMoudleNotKeyWord = "frontModule"; public static final String QueryStringFrontMoudleNotKeyWord = "frontModule";
public static final HashMap<String, String> waringPeriodS = new HashMap<String, String>() { public static final HashMap<String, String> waringPeriodStatus = new HashMap<String, String>() {
{ {
put("按时刻", "按10分钟周期"); put("按时刻", "按10分钟周期");
...@@ -108,4 +111,13 @@ public class CommonConstans { ...@@ -108,4 +111,13 @@ public class CommonConstans {
put("按天", "按1天周期"); put("按天", "按1天周期");
} }
}; };
public static final HashMap<String, String> waringPeriodDateFormate = new HashMap<String, String>() {
{
put("按时刻", DatePattern.NORM_DATETIME_PATTERN);
put("按小时", DatePattern.NORM_DATETIME_PATTERN);
put("按天", DatePattern.NORM_DATE_PATTERN);
}
};
} }
...@@ -235,14 +235,14 @@ public class AnalyseController extends BaseController { ...@@ -235,14 +235,14 @@ public class AnalyseController extends BaseController {
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ; return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "post", value = "预警详情信息-风机", notes = "预警详情信息-风机") @ApiOperation(httpMethod = "GET", value = "预警详情信息-风机", notes = "预警详情信息-风机")
@PostMapping(value = "/getAlramInfoDetailOfFan") @GetMapping(value = "/getAlramInfoDetailOfFan")
public ResponseModel<Map<String, Object>> getAlramInfoDetailOfFan(@RequestParam(required = true) String id){ public ResponseModel<Map<String, Object>> getAlramInfoDetailOfFan(@RequestParam(required = true) String id){
return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfFan(id)); return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfFan(id));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "post", value = "预警详情信息-光伏", notes = "预警详情信息-光伏") @ApiOperation(httpMethod = "GET", value = "预警详情信息-光伏", notes = "预警详情信息-光伏")
@PostMapping(value = "/getAlramInfoDetailOfPv") @GetMapping(value = "/getAlramInfoDetailOfPv")
public ResponseModel<Map<String, Object>> getAlramInfoDetailOfPv(@RequestParam(required = true) String id){ public ResponseModel<Map<String, Object>> getAlramInfoDetailOfPv(@RequestParam(required = true) String id){
return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfPv(id)); return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfPv(id));
} }
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
...@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -61,31 +64,44 @@ public class TestController extends BaseController { ...@@ -61,31 +64,44 @@ public class TestController extends BaseController {
QueryWrapper<FanHealthIndex> fanHealthIndexQueryWrapper = new QueryWrapper<>(); QueryWrapper<FanHealthIndex> fanHealthIndexQueryWrapper = new QueryWrapper<>();
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectList(fanHealthIndexQueryWrapper); List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectList(fanHealthIndexQueryWrapper);
FanHealthIndex fanHealthIndex = new FanHealthIndex(); List<IdxBizFanHealthIndex> list = new ArrayList<>();
IdxBizFanHealthIndex fanHealthIndex = new IdxBizFanHealthIndex();
fanHealthIndex.setHealthIndex(2.0); fanHealthIndex.setHealthIndex(2.0);
fanHealthIndex.setTs(System.currentTimeMillis()); // fanHealthIndex.setTs(System.currentTimeMillis());
fanHealthIndex.setArea("区域"); fanHealthIndex.setArae("区域");
fanHealthIndex.setAnalysisEndTime(DateUtil.now()); fanHealthIndex.setAnalysisEndTime(DateUtil.date());
fanHealthIndex.setAnalysisObjSeq("2"); fanHealthIndex.setAnalysisObjSeq("2");
fanHealthIndex.setHealthLevel("2321"); fanHealthIndex.setHealthLevel("2321");
fanHealthIndex.setHealthIndex(25.0); fanHealthIndex.setHealthIndex(25.0);
fanHealthIndex.setAnalysisStartTime(DateUtil.now()); fanHealthIndex.setAnalysisStartTime(DateUtil.date());
fanHealthIndex.setAnalysisObjType("21"); fanHealthIndex.setAnalysisObjType("21");
fanHealthIndex.setAnalysisTime("21"); fanHealthIndex.setANALYSISTIME("21");
fanHealthIndex.setAnomaly(2.0); fanHealthIndex.setANOMALY(2.0);
fanHealthIndex.setEquipmentName("21"); fanHealthIndex.setEquipmentName("21");
fanHealthIndex.setGatewayId("213412"); fanHealthIndex.setGatewayId("213412");
fanHealthIndex.setPointName("21312"); fanHealthIndex.setPointName("21312");
fanHealthIndex.setNumber("213"); fanHealthIndex.setNumber("213");
fanHealthIndex.setKks("213"); fanHealthIndex.setKks("213");
fanHealthIndex.setRecDate(DateUtil.now()); fanHealthIndex.setRecDate(DateUtil.date());
fanHealthIndex.setSubSystem("213421"); fanHealthIndex.setSubSystem("213421");
fanHealthIndex.setWeight(2.2); fanHealthIndex.setWeigth(2.2);
fanHealthIndex.setAnalysisType("21"); fanHealthIndex.setAnalysisType("按时刻");
fanHealthIndex.setStation("rwwrrw"); fanHealthIndex.setStation("rwwrrw");
fanHealthIndex.setIndexAddress("2321"); fanHealthIndex.setIndexAddress("2321");
FanHealthIndex fanHealthIndex1 = new FanHealthIndex();
BeanUtil.copyProperties(fanHealthIndex, fanHealthIndex1);
fanHealthIndex1.setWeight(fanHealthIndex.getWeigth());
fanHealthIndex1.setAnomaly(fanHealthIndex.getANOMALY());
fanHealthIndex1.setRecDate(DateUtil.now());
fanHealthIndex1.setArea(fanHealthIndex.getArae());
fanHealthIndex1.setAnalysisTime(DateUtil.now());
fanHealthIndex1.setHealthLevel(fanHealthIndex.getHealthLevel());
fanHealthIndex1.setKks("123456");
ArrayList<FanHealthIndex> fanHealthIndices1 = new ArrayList<>();
fanHealthIndices1.add(fanHealthIndex1);
list.add(fanHealthIndex);
// commonService.healthWarningMinuteByFJ(); // commonService.healthWarningMinuteByFJ();
fanHealthIndexMapper.insert(fanHealthIndex); fanHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "fan_health_index_moment");
} }
} }
...@@ -138,5 +138,15 @@ public class IdxBizFanPointVarCorrelation{ ...@@ -138,5 +138,15 @@ public class IdxBizFanPointVarCorrelation{
*/ */
@TableField("EQUIPMENT_NAME") @TableField("EQUIPMENT_NAME")
private String equipmentName; private String equipmentName;
/**
* 分析变量名称
*/
@TableField("ANALYSIS_POINT_NAME")
private String analysisPointName;
/**
* 工况变量名称
*/
@TableField("PROCESS_POINT_NAME")
private String processPointName;
} }
...@@ -139,4 +139,16 @@ public class IdxBizPvPointVarCorrelation{ ...@@ -139,4 +139,16 @@ public class IdxBizPvPointVarCorrelation{
@TableField("EQUIPMENT_NAME") @TableField("EQUIPMENT_NAME")
private String equipmentName; private String equipmentName;
/**
* 分析变量名称
*/
@TableField("ANALYSIS_POINT_NAME")
private String analysisPointName;
/**
* 工况变量名称
*/
@TableField("PROCESS_POINT_NAME")
private String processPointName;
} }
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
...@@ -17,6 +20,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableC ...@@ -17,6 +20,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableC
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvPointProcessVariableClassificationDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvPointProcessVariableClassificationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
...@@ -34,6 +41,7 @@ import org.springframework.data.elasticsearch.core.SearchHit; ...@@ -34,6 +41,7 @@ import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.SearchHits; import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.elasticsearch.core.query.Query; import org.springframework.data.elasticsearch.core.query.Query;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,6 +54,7 @@ import tech.tablesaw.api.Table; ...@@ -46,6 +54,7 @@ import tech.tablesaw.api.Table;
import java.io.File; import java.io.File;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -136,6 +145,12 @@ public class CommonServiceImpl { ...@@ -136,6 +145,12 @@ public class CommonServiceImpl {
@Autowired @Autowired
private ElasticsearchRestTemplate elasticsearchTemplate; private ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
private FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
private PvHealthIndexMapper pvHealthIndexMapper;
/** /**
* @return * @return
* @deprecated 获取工况变量列表风机 * @deprecated 获取工况变量列表风机
...@@ -1439,6 +1454,7 @@ public class CommonServiceImpl { ...@@ -1439,6 +1454,7 @@ public class CommonServiceImpl {
return; return;
} }
Date time = new Date(); Date time = new Date();
String format = DateUtil.format(time, DatePattern.NORM_DATETIME_PATTERN);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData();
Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId)); Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId));
...@@ -1622,7 +1638,7 @@ public class CommonServiceImpl { ...@@ -1622,7 +1638,7 @@ public class CommonServiceImpl {
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点"); query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点");
query.in(IdxBizFanHealthLevel::getStatus, stations); query.in(IdxBizFanHealthLevel::getStatus, stations);
List<IdxBizFanHealthLevel> idxBizFanHealthLevels = idxBizFanHealthLevelMapper.selectList(query); List<IdxBizFanHealthLevel> idxBizFanHealthLevels = idxBizFanHealthLevelMapper.selectList(query);
ArrayList<FanHealthIndex> fanHealthIndices1 = new ArrayList<>();
for (IdxBizFanPointProcessVariableClassification obj : list) { for (IdxBizFanPointProcessVariableClassification obj : list) {
for (int i = 0; i < analysisVariableIdArray.size(); i++) { for (int i = 0; i < analysisVariableIdArray.size(); i++) {
if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) { if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) {
...@@ -1654,10 +1670,22 @@ public class CommonServiceImpl { ...@@ -1654,10 +1670,22 @@ public class CommonServiceImpl {
} }
idxBizFanHealthIndex.setANALYSISTIME(DateUtils.getDateNowString()); idxBizFanHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizFanHealthIndexs.add(idxBizFanHealthIndex); idxBizFanHealthIndexs.add(idxBizFanHealthIndex);
FanHealthIndex fanHealthIndex = new FanHealthIndex();
BeanUtil.copyProperties(idxBizFanHealthIndex, fanHealthIndex);
fanHealthIndex.setWeight(idxBizFanHealthIndex.getWeigth());
fanHealthIndex.setAnomaly(idxBizFanHealthIndex.getANOMALY());
fanHealthIndex.setRecDate(DateUtil.now());
fanHealthIndex.setArea(idxBizFanHealthIndex.getArae());
fanHealthIndex.setAnalysisTime(DateUtil.now());
fanHealthIndex.setHealthLevel(fanHealthIndex.getHealthLevel());
fanHealthIndex.setKks(idxBizFanHealthIndex.getKks());
fanHealthIndex.setRecDate(format);
fanHealthIndices1.add(fanHealthIndex);
} }
} }
} }
idxBizFanHealthIndexService.saveBatch(idxBizFanHealthIndexs); idxBizFanHealthIndexService.saveBatch(idxBizFanHealthIndexs);
fanHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "fan_health_index_moment");
} }
try { try {
...@@ -1682,6 +1710,7 @@ public class CommonServiceImpl { ...@@ -1682,6 +1710,7 @@ public class CommonServiceImpl {
} }
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Date time = new Date(); Date time = new Date();
String format = DateUtil.format(time, DatePattern.NORM_DATETIME_PATTERN);
List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData();
Map<String, List<IdxBizPvPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizPvPointProcessVariableClassificationDto::getGatewayId)); Map<String, List<IdxBizPvPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizPvPointProcessVariableClassificationDto::getGatewayId));
// BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery(); // BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
...@@ -1843,6 +1872,7 @@ public class CommonServiceImpl { ...@@ -1843,6 +1872,7 @@ public class CommonServiceImpl {
List<IdxBizPvHealthIndex> idxBizPvHealthIndexs = new ArrayList<>(); List<IdxBizPvHealthIndex> idxBizPvHealthIndexs = new ArrayList<>();
ArrayList<PvHealthIndex> fanHealthIndices1 = new ArrayList<>();
for (IdxBizPvPointProcessVariableClassification obj : list) { for (IdxBizPvPointProcessVariableClassification obj : list) {
for (int i = 0; i < analysisVariableIdArray.size(); i++) { for (int i = 0; i < analysisVariableIdArray.size(); i++) {
if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) { if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) {
...@@ -1868,10 +1898,22 @@ public class CommonServiceImpl { ...@@ -1868,10 +1898,22 @@ public class CommonServiceImpl {
idxBizPvHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i)); idxBizPvHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i));
idxBizPvHealthIndex.setANALYSISTIME(DateUtils.getDateNowString()); idxBizPvHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizPvHealthIndexs.add(idxBizPvHealthIndex); idxBizPvHealthIndexs.add(idxBizPvHealthIndex);
PvHealthIndex pvHealthIndex = new PvHealthIndex();
BeanUtil.copyProperties(idxBizPvHealthIndex, pvHealthIndex);
pvHealthIndex.setWeight(idxBizPvHealthIndex.getWeigth());
pvHealthIndex.setAnomaly(idxBizPvHealthIndex.getANOMALY());
pvHealthIndex.setRecDate(DateUtil.now());
pvHealthIndex.setArea(idxBizPvHealthIndex.getArae());
pvHealthIndex.setAnalysisTime(DateUtil.now());
pvHealthIndex.setHealthLevel(idxBizPvHealthIndex.getHealthLevel());
pvHealthIndex.setKks(idxBizPvHealthIndex.getKks());
pvHealthIndex.setRecDate(format);
fanHealthIndices1.add(pvHealthIndex);
} }
} }
} }
idxBizPvHealthIndexService.saveBatch(idxBizPvHealthIndexs); idxBizPvHealthIndexService.saveBatch(idxBizPvHealthIndexs);
pvHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "pv_health_index_moment");
} }
try { try {
logger.info("--------------------response: " + response); logger.info("--------------------response: " + response);
...@@ -1879,7 +1921,6 @@ public class CommonServiceImpl { ...@@ -1879,7 +1921,6 @@ public class CommonServiceImpl {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
healthStatusIndicatorService.healthWarningMinuteGF(calendar, time); healthStatusIndicatorService.healthWarningMinuteGF(calendar, time);
} }
......
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2; package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName);
} }
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2; package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> { public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
} }
...@@ -7,7 +7,7 @@ import java.io.Serializable; ...@@ -7,7 +7,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "fan_health_index", autoResultMap = true) @TableName(value = "fan_health_index_data", autoResultMap = true)
public class FanHealthIndex implements Serializable { public class FanHealthIndex implements Serializable {
private Long ts; private Long ts;
private String recDate; private String recDate;
......
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
* @date 2023-08-15 * @date 2023-08-15
*/ */
@Data @Data
@TableName(value = "pv_health_index", autoResultMap = true) @TableName(value = "pv_health_index_data", autoResultMap = true)
public class PvHealthIndex { public class PvHealthIndex {
private Long ts; private Long ts;
private String recDate; private String recDate;
......
...@@ -49,5 +49,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { ...@@ -49,5 +49,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select `value`,`value_f`, address, gateway_id from iot_data.indicator_data where ts > NOW()-10m and gateway_id = #{gatewayId}") @Select("select `value`,`value_f`, address, gateway_id from iot_data.indicator_data where ts > NOW()-10m and gateway_id = #{gatewayId}")
List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId); List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId);
@Select("select created_time,`value`,`value_f`, address, gateway_id from iot_data.indicator_data where gateway_id = #{gatewayId} and `address` in ( ${addresses} ) and ts >= #{startTime} and ts <= #{endTime}")
List<IndicatorData> selectDataByGatewayIdAndAddressForAlarmInfoDetail(@Param("gatewayId") String gatewayId,@Param("addresses") String addresses,@Param("startTime") String startTime, @Param("endTime") String endTime);
} }
...@@ -79,7 +79,7 @@ spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver ...@@ -79,7 +79,7 @@ spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
# 分析专用td数据库 analyse_data # 分析专用td数据库 analyse_data
#spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource #spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db4.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/analyse_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true spring.db4.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root spring.db4.datasource.username=root
spring.db4.datasource.password=taosdata spring.db4.datasource.password=taosdata
spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
......
...@@ -2,4 +2,34 @@ ...@@ -2,4 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper">
<insert id="saveBatchHealthIndexList">
insert into
<foreach collection="list" separator="," item="item" index="index">
${tableName}
using fan_health_index_data TAGS (#{item.analysisType})
values
(
now + #{index}a,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subSystem, jdbcType=VARCHAR},
#{item.number, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper> </mapper>
...@@ -2,4 +2,35 @@ ...@@ -2,4 +2,35 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper">
<insert id="saveBatchHealthIndexList">
insert into
<foreach collection="list" separator="," item="item" index="index">
${tableName}
using pv_health_index_data TAGS (#{item.analysisType})
values
(
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subarray, jdbcType=VARCHAR},
#{item.manufacturer, jdbcType=VARCHAR},
#{item.deviceType, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
)
</foreach>
</insert>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment