Commit 9d212a62 authored by tangwei's avatar tangwei

解决冲突

parents 839d7866 25285773
package com.yeejoin.amos.boot.module.jxiop.biz.Enum;
public enum HealthLevelSortEnum {
ANQUAN(1,"安全"),
ZHUYI(2,"注意"),
JINGGAO(3, "警告"),
WEIXIAN(4,"危险");
private int code;
private String name;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
HealthLevelSortEnum(int code, String name) {
this.code = code;
this.name = name;
}
public static int getCode(String name) {
for (HealthLevelSortEnum warningNameEnum : HealthLevelSortEnum.values())
{
if (warningNameEnum.getName().equals(name))
{
return warningNameEnum.getCode();
}
}
return 0;
}
}
......@@ -11,9 +11,15 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariabl
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IAlarmInfoDetailService;
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.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -22,7 +28,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author system_generator
......@@ -41,6 +49,11 @@ public class AnalyseController extends BaseController {
@Autowired
IAlarmInfoDetailService iAlarmInfoDetailService;
@Autowired
FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
PvHealthIndexMapper pvHealthIndexMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "工况测点区间划分-风机", notes = "工况测点区间划分-风机")
@GetMapping(value = "/getFanConditionVariablesByTime")
......@@ -252,15 +265,35 @@ public class AnalyseController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "预警详情信息-光伏", notes = "预警详情信息-光伏")
@GetMapping(value = "/queryIndexByArae")
public ResponseModel<Map<String, Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE, String startTimeTop, String endTimeTop) {
List<Map<String, Object>> maps = idxBizFanHealthIndexMapper.queryIndexByArae(ARAE, ANALYSISTYPE, startTimeTop, endTimeTop);
List<String> axisData = new ArrayList<>();
List<String> seriesData = new ArrayList<>();
public ResponseModel<Map<String, Object>> queryIndexByArae(String area, String analysisType, String startTimeTop, String endTimeTop) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop);
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop);
for (PvHealthIndex pvHealthIndex : pvHealthIndices) {
FanHealthIndex fanHealthIndex = new FanHealthIndex();
BeanUtils.copyProperties(pvHealthIndex,fanHealthIndex);
fanHealthIndices.add(fanHealthIndex);
}
Map<String, Object> map = new HashMap<>();
for (Map<String, Object> obj : maps) {
axisData.add(obj.get("HEALTHINDEX").toString());
seriesData.add(obj.get("ANALYSISTIME").toString());
List<Object> axisData = new ArrayList<>();
List<Object> seriesData = new ArrayList<>();
Map<String, List<FanHealthIndex>> mapList = fanHealthIndices.stream().collect(Collectors.groupingBy(FanHealthIndex::getAnalysisTime));
for (String s : mapList.keySet()) {
List<FanHealthIndex> fanHealthIndices1 = mapList.get(s);
Double healtnIndex = fanHealthIndices1.stream().collect(Collectors.averagingDouble(FanHealthIndex::getHealthIndex));
seriesData.add(healtnIndex.intValue());
axisData.add(s);
}
map.put("axisData", axisData);
map.put("seriesData", seriesData);
return ResponseHelper.buildResponse(map);
......
......@@ -13,6 +13,8 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanMap;
......@@ -50,6 +52,9 @@ public class IdxBizFanWarningRecordController extends BaseController {
@Autowired
IdxBizPvWarningRuleSetServiceImpl idxBizPvWarningRuleSetService;
@Autowired
FanWaringRecordMapper fanWaringRecordMapper;
/**
* 新增
*
......@@ -327,4 +332,34 @@ public class IdxBizFanWarningRecordController extends BaseController {
boolean b = idxBizFanWarningRuleSetService.updateBatchById(idxBizFanWarningRecordList);
return ResponseHelper.buildResponse(b);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectFanWarningNum")
@ApiOperation(httpMethod = "GET", value = "查询各风机预警状况", notes = "查询各风机预警状况")
public ResponseModel<List<Map<String,Object>>> selectFanWarningNum(@RequestParam String station) {
List<Map<String, Object>> maps = fanWaringRecordMapper.selectFanWarningNum(station);
return ResponseHelper.buildResponse(maps);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<List<Map<String,Object>>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME) {
List<Map<String, Object>> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME);
return ResponseHelper.buildResponse(maps);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectWarningPoint")
@ApiOperation(httpMethod = "GET", value = "预警监测设备右侧预警重复列表", notes = "预警监测设备右侧预警重复列表")
public ResponseModel<List<FanWarningRecord>> selectFanWarningNum(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME) {
List<FanWarningRecord> maps = fanWaringRecordMapper.selectWarningPoint(STATION,EQUIPMENTNAME);
return ResponseHelper.buildResponse(maps);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Data
public class FanHealthIndexDto implements Serializable {
private Long ts;
private String recDate;
private String analysisObjType;
private String analysisObjSeq;
private Double weight;
private Double healthIndex;
private String healthLevel;
private String analysisType;
private String analysisStartTime;
private String analysisEndTime;
private String area;
private String station;
private String subSystem;
private String number;
private String equipmentName;
private String gatewayId;
private String indexAddress;
private Double anomaly;
private String pointName;
private String analysisTime;
private String kks;
private String startDate;
private String endDate;
private List<Map<String, String>> sorts = new ArrayList<>();
private Integer current;
private Integer size;
private String orderColumns;
private String warningName;
private String warningStatus;
private String disposotionState;
private String subarray;
}
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*
* @author system_generator
* @date 2023-08-15
*/
@Data
public class PvHealthIndexDto {
private Long ts;
private String recDate;
private String analysisObjType;
private String analysisObjSeq;
private Double weight;
private Double healthIndex;
private String healthLevel;
private String analysisType;
private String analysisStartTime;
private String analysisEndTime;
private String area;
private String station;
private String subarray;
private String manufacturer;
private String deviceType;
private String gatewayId;
private String indexAddress;
private String equipmentName;
private Double anomaly;
private String pointName;
private String analysisTime;
private String kks;
private String startDate;
private String endDate;
private List<Map<String, String>> sorts = new ArrayList<>();
private Integer current;
private Integer size;
private String orderColumns;
}
package com.yeejoin.amos.boot.module.jxiop.biz.emqx;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.FanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HealthStatusIndicatorServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PvWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Component
......@@ -35,19 +36,20 @@ public class WarningRecordStatusMessage extends EmqxListener {
public static final String WARNING_CHANGE_MESSAGE = "+/warning/change";
private static final BlockingQueue<JSONArray> blockingQueueFan = new LinkedBlockingQueue<JSONArray>();
@Autowired
private FanWaringRecordMapper fanWaringRecordMapper;
private static final BlockingQueue<JSONArray> blockingQueuePv = new LinkedBlockingQueue<JSONArray>();
@Autowired
private PvWaringRecordMapper pvWaringRecordMapper;
@Autowired
private IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService;
FanWarningRecordServiceImpl fanWarningRecordService;
@Autowired
private IdxBizPvWarningRecordServiceImpl idxBizPvWarningRecordService;
PvWarningRecordServiceImpl pvWarningRecordService;
@PostConstruct
void init() throws Exception {
new Thread(taskRunnable).start();
emqKeeper.subscript(WARNING_CHANGE_MESSAGE, 2, this);
}
......@@ -56,57 +58,61 @@ public class WarningRecordStatusMessage extends EmqxListener {
if (topic.contains(HealthStatusIndicatorServiceImpl.SMART_ANALYSE_PV)) {
log.info("预警状态改变消息-光伏{}", new String(message.getPayload()));
JSONArray ja = JSON.parseArray(new String(message.getPayload()));
blockingQueuePv.add(ja);
jxIopUpdatePv(ja);
} else if (topic.contains(HealthStatusIndicatorServiceImpl.SMART_ANALYSE_FAN)) {
log.info("预警状态改变消息-风电{}", new String(message.getPayload()));
JSONArray ja = JSON.parseArray(new String(message.getPayload()));
blockingQueueFan.add(ja);
jxIopUpdateFan(ja);
}
}
Runnable taskRunnable = new Runnable() {
@Override
public void run() {
boolean isRun = true;
int k = 0;
while (isRun) {
k++;
isRun = k < Integer.MAX_VALUE;
try {
JSONArray analysisResultFan = blockingQueueFan.take();
jxIopUpdateFan(analysisResultFan);
JSONArray analysisResultPv = blockingQueuePv.take();
jxIopUpdatePv(analysisResultPv);
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
@Async("async")
public void jxIopUpdateFan(JSONArray analysisResult) {
log.info("修改预警状态信息:{}", analysisResult);
List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class);
List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList());
LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizFanWarningRecord::getStatus, "1");
lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date());
lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
idxBizFanWarningRecordService.update(lambda);
// LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
// lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
// lambda.set(IdxBizFanWarningRecord::getStatus, "1");
// lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date());
// lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
// idxBizFanWarningRecordService.update(lambda);
List<FanWarningRecord> list = new ArrayList<>();
for (String traceId : traceIds) {
FanWarningRecord fanWarningRecord = new FanWarningRecord();
fanWarningRecord.setTs(Long.valueOf(traceId));
fanWarningRecord.setDisposotionDate(DateUtil.now());
fanWarningRecord.setStatus("1");
fanWarningRecord.setDisposotionState("已处置");
list.add(fanWarningRecord);
}
fanWaringRecordMapper.updateStatusByTs(list);
}
@Async("async")
public void jxIopUpdatePv(JSONArray analysisResult) {
log.info("修改预警状态信息:{}", analysisResult);
List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class);
List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList());
LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizPvWarningRecord::getStatus, "1");
lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
idxBizPvWarningRecordService.update(lambda);
// LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
// lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
// lambda.set(IdxBizPvWarningRecord::getStatus, "1");
// lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
// lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
// idxBizPvWarningRecordService.update(lambda);
// td
List<PvWarningRecord> list = new ArrayList<>();
for (String traceId : traceIds) {
PvWarningRecord pvWarningRecord = new PvWarningRecord();
pvWarningRecord.setTs(Long.valueOf(traceId));
pvWarningRecord.setDisposotionDate(DateUtil.now());
pvWarningRecord.setStatus("1");
pvWarningRecord.setDisposotionState("已处置");
list.add(pvWarningRecord);
}
pvWaringRecordMapper.updateStatusByTs(list);
}
}
......@@ -131,7 +131,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
Map<String,Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME);
List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME);
Integer pointNum(String STATION, String SUBARRAY, String EQUIPMENTNAME);
Integer pointNum(String STATION, String SUBSYSTEM, String EQUIPMENTNAME);
Map<String, Object> getPvEquipStatusByStation(String station);
......
......@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -33,4 +36,10 @@ public interface IdxBizPvHealthIndexMapper extends BaseMapper<IdxBizPvHealthInde
List<Map<String,Object>> selectPointByANALYSISTYPE(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME,String SUBARRAY,String startTime,String endTime);
int saveBatchHealthIndexLatestInfo(@Param("list") List<FanHealthIndex> list);
void deleteAllDataByTableName(@Param("tableName") String tableName, @Param("analysisType") String analysisType);
int saveBatchHealthIndexLatestInfoPv(@Param("list") List<PvHealthIndex> list);
}
......@@ -150,6 +150,10 @@ public class CommonServiceImpl {
private FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
private IdxBizPvHealthIndexMapper idxFanHealthIndexMapper;
@Autowired
private PvHealthIndexMapper pvHealthIndexMapper;
......@@ -1708,7 +1712,7 @@ public class CommonServiceImpl {
}
idxBizFanHealthIndexService.saveBatch(idxBizFanHealthIndexs);
// 按时刻相关数据插入TDEngine 【异步】
insertFanDataTDEngine(fanHealthIndices1, format);
insertFanDataTDEngine(fanHealthIndices1, format, "按时刻");
}
......@@ -1732,7 +1736,8 @@ public class CommonServiceImpl {
* @param fanHealthIndices
*/
@Async
public void insertFanDataTDEngine(ArrayList<FanHealthIndex> fanHealthIndices, String recDate) {
public void insertFanDataTDEngine(ArrayList<FanHealthIndex> fanHealthIndices, String recDate, String analysisType) {
idxFanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", analysisType);
// 按时刻 - 测点插入
ArrayList<FanHealthIndex> newList = new ArrayList<>();
for (int i = 0; i < fanHealthIndices.size(); i++) {
......@@ -1740,7 +1745,8 @@ public class CommonServiceImpl {
newList.add(fanHealthIndices.get(i));//循环将数据填入载体list
if (500 == newList.size() || i == fanHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
fanHealthIndexMapper.saveBatchHealthIndexList(newList, "fan_health_index_moment");
fanHealthIndexMapper.saveBatchHealthIndexList(newList, "fan_health_index_moment", analysisType);
idxFanHealthIndexMapper.saveBatchHealthIndexLatestInfo(newList);
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......@@ -1982,7 +1988,7 @@ public class CommonServiceImpl {
}
idxBizPvHealthIndexService.saveBatch(idxBizPvHealthIndexs);
//按时刻 - 相关数据插入
insertPvDataTDEngine(fanHealthIndices1, format);
insertPvDataTDEngine(fanHealthIndices1, format, "按时刻");
}
try {
logger.info("--------------------response: " + response);
......@@ -2000,7 +2006,10 @@ public class CommonServiceImpl {
* @param pvHealthIndices
*/
@Async
public void insertPvDataTDEngine(ArrayList<PvHealthIndex> pvHealthIndices, String recDate) {
public void insertPvDataTDEngine(ArrayList<PvHealthIndex> pvHealthIndices, String recDate, String analysisType) {
idxFanHealthIndexMapper.deleteAllDataByTableName("pv_health_index_latest_data", analysisType);
// 按时刻 - 测点插入
ArrayList<PvHealthIndex> newList = new ArrayList<>();
for (int i = 0; i < pvHealthIndices.size(); i++) {
......@@ -2008,7 +2017,8 @@ public class CommonServiceImpl {
newList.add(pvHealthIndices.get(i));//循环将数据填入载体list
if (500 == newList.size() || i == pvHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
pvHealthIndexMapper.saveBatchHealthIndexList(newList, "pv_health_index_moment");
pvHealthIndexMapper.saveBatchHealthIndexList(newList, "pv_health_index_moment", analysisType);
idxFanHealthIndexMapper.saveBatchHealthIndexLatestInfoPv(newList);
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class FanWarningRecordServiceImpl extends BaseService<FanWarningRecord, FanWarningRecord, FanWaringRecordMapper> {
}
......@@ -203,8 +203,8 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
return this.getBaseMapper().queryForLeftTableListByPointNum(STATION,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME);
}
public int pointNum(String STATION, String SUBARRAY,String EQUIPMENTNAME) {
return this.getBaseMapper().pointNum(STATION, SUBARRAY,EQUIPMENTNAME);
public int pointNum(String STATION, String SUBSYSTEM,String EQUIPMENTNAME) {
return this.getBaseMapper().pointNum(STATION, SUBSYSTEM,EQUIPMENTNAME);
}
public List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY , String EQUIPMENTNAME) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class PvWarningRecordServiceImpl extends BaseService<PvWarningRecord, PvWarningRecord, PvWaringRecordMapper> {
}
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
......@@ -13,6 +14,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -33,6 +35,10 @@ public class TdengineTimeServiceImpl {
private FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
private IdxBizPvHealthIndexMapper idxFanHealthIndexMapper;
@Autowired
private PvHealthIndexMapper pvHealthIndexMapper;
@Autowired
......@@ -41,7 +47,8 @@ public class TdengineTimeServiceImpl {
@Autowired
private IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper;
@Value("${openHealth:true}")
Boolean openHealth;
/**
* 风电 - 按时刻生成子系统、设备、场站、区域 数据
......@@ -73,6 +80,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0/1 * * ? ")
public void insertHourData() throws ParseException {
if (!openHealth) {
return;
}
idxFanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", "按小时");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd HH:00:00");
// 8小时 + 59分钟
String startTime = DateUtils.dateFormat(DateUtils.dateAddMinutes(new Date(), -541), DateUtils.DATE_TIME_PATTERN);
......@@ -103,6 +114,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0 1/1 * ? ")
public void insertDayData() throws ParseException {
if (!openHealth) {
return;
}
idxFanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", "按天");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
String startTime = DateUtils.dateFormat(DateUtils.dateAddHours(new Date(), -32), DateUtils.DATE_TIME_PATTERN);
List<IdxBizFanHealthLevel> levelList = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
......@@ -155,7 +170,8 @@ public class TdengineTimeServiceImpl {
newList.add(fanHealthIndex);//循环将数据填入载体list
if (500 == newList.size() || i == fanHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
fanHealthIndexMapper.saveBatchHealthIndexList(newList, tableName);
fanHealthIndexMapper.saveBatchHealthIndexList(newList, tableName, analysisType);
idxFanHealthIndexMapper.saveBatchHealthIndexLatestInfo(newList);
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......@@ -189,6 +205,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0/1 * * ? ")
public void insertHourDataPv() throws ParseException {
if (!openHealth) {
return;
}
idxFanHealthIndexMapper.deleteAllDataByTableName("pv_health_index_latest_data", "按小时");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd HH:00:00");
// 8小时 + 59分钟
String startTime = DateUtils.dateFormat(DateUtils.dateAddMinutes(new Date(), -541), DateUtils.DATE_TIME_PATTERN);
......@@ -219,6 +239,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0 1/1 * ? ")
public void insertDayDataPv() throws ParseException {
if (!openHealth) {
return;
}
idxFanHealthIndexMapper.deleteAllDataByTableName("pv_health_index_latest_data", "按天");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
List<IdxBizPvHealthLevel> levelList = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
String startTime = DateUtils.dateFormat(DateUtils.dateAddHours(new Date(), -32), DateUtils.DATE_TIME_PATTERN);
......@@ -270,7 +294,8 @@ public class TdengineTimeServiceImpl {
newList.add(item);//循环将数据填入载体list
if (500 == newList.size() || i == pvHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
pvHealthIndexMapper.saveBatchHealthIndexList(newList, tableName);
pvHealthIndexMapper.saveBatchHealthIndexList(newList, tableName, analysisType);
idxFanHealthIndexMapper.saveBatchHealthIndexLatestInfoPv(newList);
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......
......@@ -7,10 +7,11 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType}" +
"SELECT `health_index` AS healthIndex,anomaly, `health_index` AS `value`, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
......@@ -20,8 +21,16 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"order by health_index "+
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("equipmentName")String equipmentName,@Param("subSystem")String subSystem,@Param("analysisType")String analysisType,@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("pointName")String pointName, @Param("indexAddress")String indexAddress,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
@Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} AND ts >= TODAY()-8h" +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
" GROUP BY station,health_level order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByStation(@Param("area")String area,@Param("analysisObjType")String analysisObjType,@Param("station")String station);
}
......@@ -10,7 +10,7 @@ import java.util.List;
public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
"SELECT `health_index` AS healthIndex, anomaly, `health_index` AS `value`, rec_date AS recDate, analysis_time AS analysisTime, station,equipment_name AS equipmentName,point_name as pointName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
......@@ -20,7 +20,8 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour>
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"order by health_index "+
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<FanHealthIndexHour> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
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.FanHealthIndexDay;
......@@ -11,7 +12,7 @@ import java.util.List;
public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_data WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"SELECT `health_index` AS healthIndex, rec_date AS recDate, `health_index` AS `value`,analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_data WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
......@@ -22,9 +23,13 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<FanHealthIndex> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName);
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
// int saveBatchHealthIndexLatestInfo(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName);
//
// void deleteAllDataByTableName(@Param("tableName") String tableName, @Param("analysisType") String analysisType);
/**
* 测点
......@@ -62,4 +67,8 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
List<FanHealthIndex> getInfoListByGroupByQyFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<FanHealthIndex> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") FanHealthIndexDto dto);
}
......@@ -10,7 +10,7 @@ import java.util.List;
public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMoment> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_moment WHERE analysis_obj_type = #{analysisObjType}" +
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, anomaly, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_moment WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
......@@ -20,7 +20,8 @@ public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMom
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"order by health_index "+
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<FanHealthIndexMoment> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
public List<Map<String,Object>> selectFanWarningNum(String station);
public List<FanWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBSYSTEM);
public List<FanWarningRecord> selectWarningPoint(String STATION,String EQUIPMENTNAME);
public List<Map<String,Object>> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME);
int saveBatchWarningRecords(@Param("list") List<FanWarningRecord> list);
List<FanWarningRecord> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") FanHealthIndexDto dto);
FanWarningRecord getInfoByTs(@Param("ts") Long ts);
int updateStatusByTs(@Param("list") List<FanWarningRecord> list);
}
......@@ -10,8 +10,8 @@ import java.util.List;
public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_day WHERE and analysis_obj_type = #{analysisObjType}" +
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
......
......@@ -10,8 +10,8 @@ import java.util.List;
public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_hour WHERE and analysis_obj_type = #{analysisObjType}" +
"SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
......@@ -22,6 +22,6 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<PvHealthIndexHour> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.PvHealthIndexDto;
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.FanHealthIndex;
......@@ -13,8 +15,8 @@ import java.util.List;
public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_data WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_data WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
......@@ -25,9 +27,11 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<PvHealthIndex> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
// int saveBatchHealthIndexLatestInfo(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
List<PvHealthIndex> getInfoListByGroupByCdPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
......@@ -48,4 +52,9 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
List<PvHealthIndex> getInfoListByGroupByQyPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<PvHealthIndex> getInfoByPage(@Param("dto") PvHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") PvHealthIndexDto dto);
}
......@@ -10,8 +10,8 @@ import java.util.List;
public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_moment WHERE and analysis_obj_type = #{analysisObjType}" +
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_moment WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
......@@ -22,5 +22,5 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
List<PvHealthIndexMoment> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> {
int saveBatchWarningRecords(@Param("list") List<PvWarningRecord> list);
public List<PvWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBARRAY);
public List<Map<String,Object>> selectFanWarningNum(String station);
List<PvWarningRecord> selectWarningPoint(String STATION, String EQUIPMENTNAME, String SUBARRAY);
List<Map<String, Object>> selectEquipWarningTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY);
List<PvWarningRecord> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") FanHealthIndexDto dto);
PvWarningRecord getInfoByTs(@Param("ts") Long ts);
int updateStatusByTs(@Param("list") List<PvWarningRecord> list);
}
......@@ -30,4 +30,5 @@ public class FanHealthIndexDay implements Serializable {
private String analysisTime;
private String kks;
private String status;
private String value;
}
......@@ -29,4 +29,6 @@ public class FanHealthIndexHour implements Serializable {
private String pointName;
private String analysisTime;
private String kks;
private String status;
private String value;
}
......@@ -29,4 +29,6 @@ public class FanHealthIndexMoment implements Serializable {
private String pointName;
private String analysisTime;
private String kks;
private String status;
private String value;
}
......@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.jxiop.biz.tdengine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@Data
@TableName(value = "", autoResultMap = true)
public class FanWarningRecord {
@TableName(value = "fan_warning_record", autoResultMap = true)
public class FanWarningRecord implements Serializable {
private Long ts;
private String recDate;
private String disposotionState;
......@@ -25,4 +27,5 @@ public class FanWarningRecord {
private String disposotionDate;
private String kks;
private String warningPeriod;
private String status;
}
......@@ -4,14 +4,15 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "", autoResultMap = true)
public class PvWarningRecord {
@TableName(value = "pv_warning_record", autoResultMap = true)
public class PvWarningRecord implements Serializable {
private Long ts;
private String recDate;
private String disposotionState;
private String healthIndexSeq;
private String healthIndex;
private String analysisPointId;
private String warningName;
private String arae;
......@@ -28,4 +29,5 @@ public class PvWarningRecord {
private String disposotionDate;
private String kks;
private String warningPeriod;
private String status;
}
......@@ -61,7 +61,7 @@
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM
idx_biz_fan_health_index
fan_health_index_latest_data
<where>
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天'
......@@ -95,7 +95,7 @@
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM
idx_biz_pv_health_index
pv_health_index_latest_data
<where>
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天'
......@@ -1165,22 +1165,22 @@
</select>
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord">
SELECT
*
FROM
idx_biz_fan_warning_record re
WHERE
re.`STATUS` = 0
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND re.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND re.SUBARRAY = #{SUBARRAY}
</if>
<if test="STATION != null and STATION != '' ">
AND re.STATION = #{STATION}
</if>
</select>
SELECT
*
FROM
idx_biz_fan_warning_record re
WHERE
re.`STATUS` = 0
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND re.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND re.SUBARRAY = #{SUBARRAY}
</if>
<if test="STATION != null and STATION != '' ">
AND re.STATION = #{STATION}
</if>
</select>
<select id="pointNum" resultType="int">
SELECT
......@@ -1192,8 +1192,8 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND cl.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND cl.SUBARRAY = #{SUBARRAY}
<if test="SUBSYSTEM != null and SUBSYSTEM != '' ">
AND cl.SUB_SYSTEM = #{SUBSYSTEM}
</if>
<if test="STATION != null and STATION != '' ">
AND cl.STATION = #{STATION}
......@@ -1367,7 +1367,7 @@
FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
STATION AS STATION
FROM idx_biz_fan_health_index
FROM fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '场站'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
......@@ -1388,7 +1388,7 @@
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
STATION AS STATION
FROM idx_biz_pv_health_index
FROM pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '场站'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
......@@ -1416,7 +1416,7 @@
FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName
FROM idx_biz_fan_health_index
FROM fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '设备'
......@@ -1438,7 +1438,7 @@
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUBARRAY AS equipmentName
FROM idx_biz_pv_health_index
FROM pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '子阵'
......@@ -1471,7 +1471,7 @@
FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUB_SYSTEM AS subSystem
FROM idx_biz_fan_health_index
FROM fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '子系统'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
......@@ -1492,7 +1492,7 @@
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME AS subSystem
FROM idx_biz_pv_health_index
FROM pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '设备'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
......@@ -1522,7 +1522,7 @@
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM idx_biz_fan_health_index
FROM fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '测点'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
......@@ -1544,7 +1544,7 @@
(
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM idx_biz_pv_health_index
FROM pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '测点'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
......
......@@ -335,4 +335,112 @@
</select>
<insert id="saveBatchHealthIndexLatestInfo">
insert into
fan_health_index_latest_data
(
`REC_DATE`,
`ANALYSIS_OBJ_TYPE`,
`ANALYSIS_OBJ_SEQ`,
`WEIGTH`,
`HEALTH_INDEX`,
`HEALTH_LEVEL`,
`ANALYSIS_TYPE`,
`ANALYSIS_START_TIME`,
`ANALYSIS_END_TIME`,
`ARAE`,
`STATION`,
`SUB_SYSTEM`,
`NUMBER`,
`EQUIPMENT_NAME`,
`GATEWAY_ID`,
`INDEX_ADDRESS`,
`ANOMALY`,
`POINT_NAME`,
`ANALYSIS_TIME`,
`KKS`
)
values
<foreach collection="list" separator="," item="item" index="index">
(
#{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.analysisType, 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>
<delete id="deleteAllDataByTableName">
delete from ${tableName} where analysis_type = #{analysisType}
</delete>
<insert id="saveBatchHealthIndexLatestInfoPv">
insert into pv_health_index_latest_data
(
`REC_DATE`,
`ANALYSIS_OBJ_TYPE`,
`ANALYSIS_OBJ_SEQ`,
`WEIGTH`,
`HEALTH_INDEX`,
`HEALTH_LEVEL`,
`ANALYSIS_TYPE`,
`ANALYSIS_START_TIME`,
`ANALYSIS_END_TIME`,
`ARAE`,
`STATION`,
`SUBARRAY`,
`MANUFACTURER`,
`DEVICE_TYPE`,
`GATEWAY_ID`,
`INDEX_ADDRESS`,
`EQUIPMENT_NAME`,
`ANOMALY`,
`POINT_NAME`,
`ANALYSIS_TIME`,
`KKS`
)
values
<foreach collection="list" separator="," item="item" index="index">
(
#{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.analysisType, 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.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper>
......@@ -5,7 +5,7 @@
<insert id="saveBatchHealthIndexList">
insert into
${tableName}
using fan_health_index_data TAGS ('按时刻')
using fan_health_index_data TAGS (#{analysisType})
values
<foreach collection="list" separator="," item="item" index="index">
(
......@@ -77,6 +77,7 @@
area,
sub_system,
equipment_name,
number,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
......@@ -90,7 +91,8 @@
analysis_obj_type,
area,
sub_system,
equipment_name
equipment_name,
number
</select>
<select id="getInfoListByGroupBySbFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
......@@ -152,4 +154,79 @@
analysis_obj_type,
area
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
SELECT * FROM fan_health_index_data
<where>
<if test="dto.analysisObjType!= null and dto.analysisObjType!= ''">analysis_obj_type = #{dto.analysisObjType}</if>
<if test="dto.analysisType!= null and dto.analysisType!= ''">and analysis_type = #{dto.analysisType}</if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.area!= null and dto.area!= ''"> AND area = #{area} </if>
<if test="dto.number!= null and dto.number!= ''"> AND `number` = #{dto.number} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.healthLevel!= null and dto.healthLevel!= ''">AND health_level = #{dto.healthLevel} </if>
<if test="dto.subSystem!= null and dto.subSystem!= ''">AND sub_system = #{dto.subSystem} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
limit #{dto.current}, #{dto.size}
</select>
<select id="getInfoByPageTotal" resultType="java.lang.Integer">
SELECT count(1) FROM fan_health_index_data
<where>
<if test="dto.analysisObjType!= null and dto.analysisObjType!= ''">analysis_obj_type = #{dto.analysisObjType}</if>
<if test="dto.analysisType!= null and dto.analysisType!= ''">and analysis_type = #{dto.analysisType}</if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.area!= null and dto.area!= ''"> AND area = #{area} </if>
<if test="dto.number!= null and dto.number!= ''"> AND `number` = #{dto.number} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.healthLevel!= null and dto.healthLevel!= ''">AND health_level = #{dto.healthLevel} </if>
<if test="dto.subSystem!= null and dto.subSystem!= ''">AND sub_system = #{dto.subSystem} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
</select>
<select id="saveBatchHealthIndexLatestInfo" resultType="int">
insert into
${tableName}
values
<foreach collection="list" separator="," item="item" index="index">
(
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.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>
</select>
<delete id="deleteAllDataByTableName">
delete from ${tableName} where analysis_type = #{analysisType}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!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.FanWaringRecordMapper">
<insert id="saveBatchWarningRecords">
insert
into
fan_warning_record
<!-- (ts,-->
<!-- rec_date,-->
<!-- disposotion_state,-->
<!-- health_index_seq,-->
<!-- health_index,-->
<!-- analysis_point_id,-->
<!-- warning_name,-->
<!-- arae,-->
<!-- station,-->
<!-- subarray,-->
<!-- manufacturer,-->
<!-- device_type,-->
<!-- equipment_name,-->
<!-- gateway_id,-->
<!-- index_address,-->
<!-- content,-->
<!-- point_name,-->
<!-- health_level,-->
<!-- disposotion_date,-->
<!-- kks,-->
<!-- warning_period,-->
<!-- status)-->
values
<foreach collection="list" separator="," item="item" index="index">
(#{item.ts, jdbcType=TIMESTAMP},
#{item.recDate, jdbcType=VARCHAR},
#{item.disposotionState, jdbcType=VARCHAR},
<!-- #{item.healthIndexSeq, jdbcType=VARCHAR},-->
#{item.healthIndex, jdbcType=VARCHAR},
#{item.analysisPointId, jdbcType=VARCHAR},
#{item.warningName, jdbcType=VARCHAR},
#{item.arae, 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.content, jdbcType=VARCHAR},
#{item.pointName, jdbcType=VARCHAR},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.disposotionDate, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
#{item.warningPeriod, jdbcType=VARCHAR},
#{item.status, jdbcType=VARCHAR})
</foreach>
</insert>
<select id="selectFanWarningNum" resultType="map">
SELECT `b`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`b`.`STATION` AS `STATION`,
`b`.`警告` AS `警告`,
`b`.`注意` AS `注意`,
`b`.`危险` AS `危险`,
sum(((`b`.`注意` + `b`.`危险`) + `b`.`警告`)) AS `sort`
FROM (select `a`.`EQUIPMENT_NAME` as `EQUIPMENT_NAME`,
a.`STATION` as `STATION`,
max(case `a`.`WARNING_NAME` when '危险' then `a`.`num` else 0 end) as `危险`,
max(case `a`.`WARNING_NAME` when '注意' then `a`.`num` else 0 end) as `注意`,
max(case `a`.`WARNING_NAME` when '警告' then `a`.`num` else 0 end) as `警告`
from (
select `warning_name` as `WARNING_NAME`,
`equipment_name` as `EQUIPMENT_NAME`,
`station` as `STATION`,
count(1) as `num`
from analysis_data.fan_warning_record
where `status` = 0
or (`status` = 1
and `ts` > (now() - 3D - 8h))
<if test="station != null">
and station = #{station}
</if>
group by `station`,
`equipment_name`,
`warning_name`) a
group by `a`.`EQUIPMENT_NAME`, a.`STATION`) b
GROUP BY `b`.`EQUIPMENT_NAME`,
`b`.`STATION`, `b`.`警告`, `b`.`注意`, `b`.`危险`
order by sort DESC
</select>
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord">
SELECT
warning_name as WarningName
FROM
analysis_data.fan_warning_record re
WHERE
re.`status` = 0
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND re.equipment_name = #{EQUIPMENTNAME}
</if>
<if test="SUBSYSTEM != null and SUBSYSTEM != '' ">
AND re.sub_system = #{SUBSYSTEM}
</if>
<if test="STATION != null and STATION != '' ">
AND re.station = #{STATION}
</if>
</select>
<select id="selectWarningPoint" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord">
SELECT
a.station,
a.warning_name,
a.content,
a.equipment_name,
a.point_name,
a.rec_date
from
analysis_data.fan_warning_record a
where
a.status = 0
<if test="STATION != null and STATION != '' ">
AND a.station = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND a.equipment_name = #{EQUIPMENTNAME}
</if>
group by
station,
equipment_name,
point_name,
rec_date ,
content,
warning_name
</select>
<select id="selectEquipWarningTotal" resultType="map">
SELECT
`STATION` AS `STATION`,
`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
max( ( case `WARNING_NAME` WHEN '注意' THEN `num` ELSE 0 END ) ) AS `zhuyi`,
max( ( case `WARNING_NAME` WHEN '警告' THEN `num` ELSE 0 END ) ) AS `jinggao`,
max( ( case `WARNING_NAME` WHEN '危险' THEN `num` ELSE 0 END ) ) AS `weixian`,
sum(
(
(
( CASE `WARNING_NAME` WHEN '注意' THEN `num` ELSE 0 END ) + ( case `WARNING_NAME` WHEN '警告' THEN `num` ELSE 0 END
)
) + ( case `WARNING_NAME` WHEN '危险' THEN `num` ELSE 0 END )
)
) AS `total`
FROM
(
select
`z`.`station` as `STATION`,
`z`.`equipment_name` as `EQUIPMENT_NAME`,
`z`.`warning_name` as `WARNING_NAME`,
count( 1 ) as `num`
from
analysis_data.fan_warning_record z where
( `z`.`status` = 0 )
<if test="STATION != null and STATION != '' ">
AND z.station = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND z.equipment_name = #{EQUIPMENTNAME}
</if>
group by
`z`.`station`,
`z`.`warning_name`,
`z`.`equipment_name`
) b
GROUP BY
`b`.`STATION`,
`b`.`EQUIPMENT_NAME`
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord">
SELECT * FROM fan_warning_record
<where>
<if test="dto.area!= null and dto.area!= ''"> AND arae = #{dto.area} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}</if>
<if test="dto.subSystem!= null and dto.subSystem!= ''">AND sub_system = #{dto.subSystem} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.warningName!= null and dto.warningName!= ''">AND warning_name = #{dto.warningName} </if>
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
</where>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
limit #{dto.current}, #{dto.size}
</select>
<select id="getInfoByPageTotal" resultType="java.lang.Integer">
SELECT count(1) FROM fan_warning_record
<where>
<if test="dto.area!= null and dto.area!= ''"> AND arae = #{dto.area} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}</if>
<if test="dto.subSystem!= null and dto.subSystem!= ''">AND sub_system = #{dto.subSystem} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.warningName!= null and dto.warningName!= ''">AND warning_name = #{dto.warningName} </if>
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
</where>
</select>
<select id="getInfoByTs" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord">
select * from analysis_data.fan_warning_record where ts = #{ts,jdbcType=TIMESTAMP} limit 1
</select>
<insert id="updateStatusByTs">
insert
into
fan_warning_record
(ts,
disposotion_state,
disposotion_date,
status)
values
<foreach collection="list" separator="," item="item" index="index">
(#{item.ts, jdbcType=TIMESTAMP},
#{item.disposotionState, jdbcType=VARCHAR},
#{item.disposotionDate, jdbcType=VARCHAR},
#{item.status, jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>
......@@ -38,7 +38,7 @@
<insert id="saveBatchHealthIndexList">
insert into ${tableName}
using pv_health_index_data TAGS ('按时刻')
using pv_health_index_data TAGS (#{analysisType})
values
<foreach collection="list" separator="," item="item" index="index">
(
......@@ -186,4 +186,72 @@
analysis_obj_type,
area
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
SELECT * FROM pv_health_index_data
<where>
<if test="dto.analysisObjType!= null and dto.analysisObjType!= ''">analysis_obj_type = #{dto.analysisObjType}</if>
<if test="dto.analysisType!= null and dto.analysisType!= ''">and analysis_type = #{dto.analysisType}</if>
<if test="dto.endDate!= null and dto.endDate!= ''"> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.area!= null and dto.area!= ''"> AND area = #{area} </if>
<if test="dto.subarray!= null and dto.subarray!= ''"> AND `subarray` = #{dto.subarray} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.healthLevel!= null and dto.healthLevel!= ''">AND health_level = #{dto.healthLevel} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
limit #{dto.current}, #{dto.size}
</select>
<select id="getInfoByPageTotal" resultType="java.lang.Integer">
SELECT count(1) FROM fan_health_index_data
<where>
<if test="dto.analysisObjType!= null and dto.analysisObjType!= ''">analysis_obj_type = #{dto.analysisObjType}</if>
<if test="dto.analysisType!= null and dto.analysisType!= ''">and analysis_type = #{dto.analysisType}</if>
<if test="dto.endDate!= null and dto.endDate!= ''"> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.area!= null and dto.area!= ''"> AND area = #{area} </if>
<if test="dto.subarray!= null and dto.subarray!= ''"> AND `subarray` = #{dto.subarray} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.healthLevel!= null and dto.healthLevel!= ''">AND health_level = #{dto.healthLevel} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
</select>
<select id="saveBatchHealthIndexLatestInfo" resultType="int">
insert into ${tableName}
values
<foreach collection="list" separator="," item="item" index="index">
(
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>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!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.PvWaringRecordMapper">
<insert id="saveBatchWarningRecords">
insert
into
pv_warning_record
<!-- (ts,-->
<!-- rec_date,-->
<!-- disposotion_state,-->
<!-- health_index_seq,-->
<!-- health_index,-->
<!-- analysis_point_id,-->
<!-- warning_name,-->
<!-- arae,-->
<!-- station,-->
<!-- subarray,-->
<!-- manufacturer,-->
<!-- device_type,-->
<!-- equipment_name,-->
<!-- gateway_id,-->
<!-- index_address,-->
<!-- content,-->
<!-- point_name,-->
<!-- health_level,-->
<!-- disposotion_date,-->
<!-- kks,-->
<!-- warning_period,-->
<!-- status)-->
values
<foreach collection="list" separator="," item="item" index="index">
(#{item.ts, jdbcType=TIMESTAMP},
#{item.recDate, jdbcType=VARCHAR},
#{item.disposotionState, jdbcType=VARCHAR},
#{item.healthIndex, jdbcType=VARCHAR},
#{item.analysisPointId, jdbcType=VARCHAR},
#{item.warningName, jdbcType=VARCHAR},
#{item.arae, 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.content, jdbcType=VARCHAR},
#{item.pointName, jdbcType=VARCHAR},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.disposotionDate, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
#{item.warningPeriod, jdbcType=VARCHAR},
#{item.status, jdbcType=VARCHAR})
</foreach>
</insert>
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord">
SELECT
warning_name as WarningName
FROM
analysis_data.pv_warning_record re
WHERE
re.`status` = 0
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND re.equipment_name = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND re.subarray = #{SUBARRAY}
</if>
<if test="STATION != null and STATION != '' ">
AND re.station = #{STATION}
</if>
</select>
<select id="selectFanWarningNum" resultType="map">
select
`a`.`subarray` as `subarray`,
`a`.`station` as `station`,
`a`.`警告` as `警告`,
`a`.`注意` as `注意`,
`a`.`危险` as `危险`,
sum(((`a`.`注意` + `a`.`危险`) + `a`.`警告`)) AS `sort`
from
(select
a.subarray,
a.station,
max( case a.warning_name when '危险' then num else 0 end ) as `危险`,
max( case a.warning_name when '注意' then num else 0 end ) as `注意`,
max( case a.warning_name when '警告' then num else 0 end ) as `警告`
from
(
select
re.warning_name,
re.subarray,
re.station,
count( 1 ) as num
from
analysis_data.pv_warning_record re
where
re.`status` = 0
or ( re.`status` = 1 and `ts` > (now() - 3d - 8h))
<if test="station != null">
and station = #{station}
</if>
group by
re.station,
re.subarray,
re.warning_name
) a
group by
a.subarray,a.station) a
group by
`a`.`subarray`,
`a`.`station`,`a`.`警告`, `a`.`注意`, `a`.`危险`
order by sort DESC
</select>
<select id="selectWarningPoint" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord">
SELECT
a.station,
a.warning_name,
a.content,
a.equipment_name,
a.point_name,
a.rec_date
from
analysis_data.pv_warning_record a
where
a.status = 0
<if test="STATION != null and STATION != '' ">
AND a.station = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND a.equipment_name = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != '' and SUBARRAY != null">
AND a.subarray = #{SUBARRAY}
</if>
group by
station,
equipment_name,
point_name,
rec_date ,
content,
warning_name
</select>
<select id="selectEquipWarningTotal" resultType="map">
SELECT
`STATION` AS `STATION`,
`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
max( ( case `WARNING_NAME` WHEN '注意' THEN `num` ELSE 0 END ) ) AS `zhuyi`,
max( ( case `WARNING_NAME` WHEN '警告' THEN `num` ELSE 0 END ) ) AS `jinggao`,
max( ( case `WARNING_NAME` WHEN '危险' THEN `num` ELSE 0 END ) ) AS `weixian`,
sum(
(
(
( CASE `WARNING_NAME` WHEN '注意' THEN `num` ELSE 0 END ) + ( case `WARNING_NAME` WHEN '警告' THEN `num` ELSE 0 END
)
) + ( case `WARNING_NAME` WHEN '危险' THEN `num` ELSE 0 END )
)
) AS `total`
FROM
(
select
`z`.`station` as `STATION`,
`z`.`equipment_name` as `EQUIPMENT_NAME`,
`z`.`warning_name` as `WARNING_NAME`,
count( 1 ) as `num`
from
analysis_data.fan_warning_record z where
( `z`.`status` = 0 )
<if test="STATION != null and STATION != '' ">
AND z.station = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND z.equipment_name = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != '' and SUBARRAY != null">
AND z.subarray = #{SUBARRAY}
</if>
group by
`z`.`station`,
`z`.`warning_name`,
`z`.`equipment_name`
) b
GROUP BY
`b`.`STATION`,
`b`.`EQUIPMENT_NAME`
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord">
SELECT * FROM pv_warning_record
<where>
<if test="dto.area!= null and dto.area!= ''"> AND arae = #{dto.area} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}</if>
<if test="dto.subarray!= null and dto.subarray!= ''">AND subarray = #{dto.subarray} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.warningName!= null and dto.warningName!= ''">AND warning_name = #{dto.warningName} </if>
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
</where>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
limit #{dto.current}, #{dto.size}
</select>
<select id="getInfoByPageTotal" resultType="java.lang.Integer">
SELECT count(1) FROM pv_warning_record
<where>
<if test="dto.area!= null and dto.area!= ''"> AND arae = #{dto.area} </if>
<if test="dto.station!= null and dto.station!= ''">AND station = #{dto.station} </if>
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}</if>
<if test="dto.subarray!= null and dto.subarray!= ''">AND subarray = #{dto.subarray} </if>
<if test="dto.pointName!= null and dto.pointName!= ''">AND point_name = #{dto.pointName} </if>
<if test="dto.warningName!= null and dto.warningName!= ''">AND warning_name = #{dto.warningName} </if>
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
</where>
</select>
<select id="getInfoByTs" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord">
select * from analysis_data.pv_warning_record where ts = #{ts,jdbcType=TIMESTAMP} limit 1
</select>
<insert id="updateStatusByTs">
insert
into
pv_warning_record
(ts,
disposotion_state,
disposotion_date,
status)
values
<foreach collection="list" separator="," item="item" index="index">
(#{item.ts, jdbcType=TIMESTAMP},
#{item.disposotionState, jdbcType=VARCHAR},
#{item.disposotionDate, jdbcType=VARCHAR},
#{item.status, jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>
......@@ -1515,4 +1515,10 @@ public class MonitorFanIdxController extends BaseController {
// return ResponseHelper.buildResponse(hashMap);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "给部盾提供的发电率完成情况接口")
@GetMapping("/getGenPowerInfoForBuDun")
public ResponseModel<Map<String, String>> getGenPowerInfoForBuDun(@RequestParam(required = false) String areaCode,@RequestParam(required = false) String stationId) {
return ResponseHelper.buildResponse(monitoringService.getGenPowerInfoForBuDun(areaCode,stationId));
}
}
......@@ -318,9 +318,8 @@ public class MonitoringMapController extends BaseController {
wrapper.eq(areaCode!=null,StationBasic::getAreaCode,areaCode);
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
List<String> ids = stationBasics.stream().map(StationBasic::getFanGatewayId).collect(Collectors.toList());
// 2023年11月8日 12点51分 库中存储的历史数据存在问题逻辑由原来的通过网关id查询数据修改为场站id
List<String> ids = stationBasics.stream().map(stationBasic -> String.valueOf(stationBasic.getSequenceNbr())).collect(Collectors.toList());
SeriesData map= largeScreenImpl.getSeriesDataqy( new Date(),ids, areaCode);
......
......@@ -508,7 +508,7 @@ public class LargeScreenImpl {
public List<Double> gettimedateqy( Date date,List<String> gatewayId){
public List<Double> gettimedateqy( Date date,List<String> stationId){
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyyMM");
String monthy= myFmt2.format(date);
......@@ -517,7 +517,7 @@ public class LargeScreenImpl {
value.add(RSD);
Map<String,List<String>> map=new HashMap<>();
map.put("equipmentIndexName.keyword",value);
map.put("gatewayId.keyword", gatewayId);
map.put("stationId.keyword", stationId);
List<String> value1=new ArrayList<>();
value1.add(monthy);
map.put("moon.keyword",value1);
......
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