Commit da276d5f authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents e62ba5b5 cd51b868
...@@ -30,6 +30,7 @@ import org.typroject.tyboot.core.foundation.context.SpringContextHelper; ...@@ -30,6 +30,7 @@ import org.typroject.tyboot.core.foundation.context.SpringContextHelper;
import java.io.*; import java.io.*;
import java.net.Socket; import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -69,6 +70,9 @@ public class ClientHandler<path> implements Runnable { ...@@ -69,6 +70,9 @@ public class ClientHandler<path> implements Runnable {
} }
private String upload2Maas(InputStream inputStream, String hostAndPort) throws IOException { private String upload2Maas(InputStream inputStream, String hostAndPort) throws IOException {
InputStream intercept = intercept(inputStream);
AmosRequestContext robotAuthentication = SpringContextHelper.getBean(AmosRequestContext.class); AmosRequestContext robotAuthentication = SpringContextHelper.getBean(AmosRequestContext.class);
if (Objects.nonNull(robotAuthentication)) { if (Objects.nonNull(robotAuthentication)) {
String token = robotAuthentication.getToken(); String token = robotAuthentication.getToken();
...@@ -93,16 +97,16 @@ public class ClientHandler<path> implements Runnable { ...@@ -93,16 +97,16 @@ public class ClientHandler<path> implements Runnable {
} }
}; };
params.add("file", resource); params.add("file", resource);
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, getHeader(token,product,appKey,hostAndPort,true)); HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, getHeader(token, product, appKey, hostAndPort, true));
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.exchange(uploadUrl, HttpMethod.POST, requestEntity, String.class); ResponseEntity<String> responseEntity = restTemplate.exchange(uploadUrl, HttpMethod.POST, requestEntity, String.class);
String body = responseEntity.getBody(); String body = responseEntity.getBody();
JSONObject jsonObject = JSONObject.parseObject(body); JSONObject jsonObject = JSONObject.parseObject(body);
String result = jsonObject.getString("result"); String result = jsonObject.getString("result");
String path = jsonObject.getString("path"); String path = jsonObject.getString("path");
if (jsonObject.getString("status").equals("200")){ if (jsonObject.getString("status").equals("200")) {
log.info("路径:"+path+"/"+result); log.info("路径:" + path + "/" + result);
}else { } else {
throw new RuntimeException("返回状态码错误"); throw new RuntimeException("返回状态码错误");
} }
...@@ -152,14 +156,14 @@ public class ClientHandler<path> implements Runnable { ...@@ -152,14 +156,14 @@ public class ClientHandler<path> implements Runnable {
return null; return null;
} }
private HttpHeaders getHeader(String token,String product,String appKey,String hostAndPort,Boolean isUpload){ private HttpHeaders getHeader(String token, String product, String appKey, String hostAndPort, Boolean isUpload) {
HttpHeaders header = new HttpHeaders(); HttpHeaders header = new HttpHeaders();
header.add(Constant.TOKEN, token); header.add(Constant.TOKEN, token);
header.add(Constant.PRODUCT, product); header.add(Constant.PRODUCT, product);
header.add(Constant.APPKEY, appKey); header.add(Constant.APPKEY, appKey);
if (isUpload){ if (isUpload) {
header.setContentType(MediaType.MULTIPART_FORM_DATA); header.setContentType(MediaType.MULTIPART_FORM_DATA);
}else { } else {
header.setContentType(MediaType.APPLICATION_JSON); header.setContentType(MediaType.APPLICATION_JSON);
} }
return header; return header;
...@@ -169,6 +173,58 @@ public class ClientHandler<path> implements Runnable { ...@@ -169,6 +173,58 @@ public class ClientHandler<path> implements Runnable {
requestInfoToSocketServer(); requestInfoToSocketServer();
} }
//截取文件流
public static InputStream intercept(InputStream is) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "/n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
String string1 = sb.toString();
int startFilePath = string1.indexOf("##STATITLE##");
int endFilePath = string1.indexOf("##ENDTITLE##");
int startFile = string1.indexOf("##STAFILE##");
int endFile = string1.indexOf("##ENDFILE##");
if (startFilePath < 0) {
log.info("不存在文件名开始标志");
return null;
}
if (endFilePath < 0) {
log.info("不存在文件名结束标志");
return null;
}
if (startFile < 0) {
log.info("不存在文件开始标志");
return null;
}
if (endFile < 0) {
log.info("不存在文件结束标志");
return null;
}
String filePath = string1.substring(startFilePath, endFilePath).substring("##STATITLE##".length());
log.info("文件名:" + filePath);
String file = string1.substring(startFile, endFile).substring("##STAFILE##".length());
log.info("文件:" + file);
InputStream fileInputStream = new ByteArrayInputStream(file.getBytes());
return fileInputStream;
}
private static void requestInfoToSocketServer() { private static void requestInfoToSocketServer() {
try { try {
Socket socket = new Socket("127.0.0.1", 7777); Socket socket = new Socket("127.0.0.1", 7777);
......
package com.yeejoin.amos.boot.module.cas.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.cas.api.entity.IdxBizXnzs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Value;
import java.util.List;
import java.sql.*;
import java.util.*;
public interface IdxBizSyncService extends IService<IdxBizXnzs> {
// 多个查询(分页)
List selectAllPageQuery(String tableName, Map params, int current, int size);
String getSql(String tableName, Map params, int current, int size);
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.cas.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.cas.api.service.IdxBizSyncService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/idx-biz-sync", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class IdxBizSyncController {
@Autowired
private IdxBizSyncService idxBizSyncService;
@TycloudOperation(ApiLevel = UserType.AGENCY ,needAuth = false)
@RequestMapping(value = "/page/{tableName}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
@ResponseBody
public List listPage(@PathVariable String tableName,
@RequestParam(value = "current",defaultValue = "1") int current,
@RequestParam(value = "size",defaultValue = "10") int size,
@RequestBody Map params) throws Exception{
List list = idxBizSyncService.selectAllPageQuery(tableName, params, current, size);
return list;
}
}
package com.yeejoin.amos.boot.module.cas.service.impl;
import com.yeejoin.amos.boot.module.cas.api.dto.IdxBizXnzsDto;
import com.yeejoin.amos.boot.module.cas.api.entity.IdxBizXnzs;
import com.yeejoin.amos.boot.module.cas.api.mapper.IdxBizXnzsMapper;
import com.yeejoin.amos.boot.module.cas.api.service.IIdxBizXnzsService;
import com.yeejoin.amos.boot.module.cas.api.service.IdxBizSyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@Service
public class IdxBizSyncServiceImpl extends BaseService<IdxBizXnzsDto, IdxBizXnzs, IdxBizXnzsMapper> implements IdxBizSyncService {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List selectAllPageQuery(String tableName, Map params, int current, int size) {
List<Map<String, Object>> list = jdbcTemplate.queryForList(getSql(tableName, params, current, size));
return list;
}
@Override
public String getSql(String tableName, Map params, int current, int size) {
String sql = "select * from " + tableName;
sql += " where ";
Iterator<Map.Entry<String, Object>> it = params.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
sql = sql + entry.getKey() + " = " + "'" + entry.getValue() + "'" + " AND ";
}
sql += "1 = 1 ";
sql += " limit " + (current - 1) * size + "," + size;
return sql;
}
}
#DB properties: #DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.210:3306/amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\ spring.datasource.url=jdbc:mysql://39.98.45.134:3306/amos_idx?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8 &characterEncoding=utf8&useSSL=false&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2020
......
...@@ -58,7 +58,7 @@ public class AmosJxiopAnalyseApplication { ...@@ -58,7 +58,7 @@ public class AmosJxiopAnalyseApplication {
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
//本地是否执行健康指数算法开关 //本地是否执行健康指数算法开关
@Value("${openHealth:true}") @Value("${openHealth:false}")
Boolean openHealth; Boolean openHealth;
@Autowired @Autowired
private SyncESDataToTdengineMqttListener syncESDataToTdengineMqttListener; private SyncESDataToTdengineMqttListener syncESDataToTdengineMqttListener;
...@@ -79,7 +79,7 @@ public class AmosJxiopAnalyseApplication { ...@@ -79,7 +79,7 @@ public class AmosJxiopAnalyseApplication {
@Bean @Bean
public void initMqtt() throws Exception { public void initMqtt() throws Exception {
if (!openHealth) { if (openHealth) {
//订阅固化周期性数据成功的消息 //订阅固化周期性数据成功的消息
emqKeeper.subscript("sync_esdata_to_tdengine_notice", 1, syncESDataToTdengineMqttListener); emqKeeper.subscript("sync_esdata_to_tdengine_notice", 1, syncESDataToTdengineMqttListener);
} }
......
...@@ -112,6 +112,14 @@ public class CommonConstans { ...@@ -112,6 +112,14 @@ public class CommonConstans {
} }
}; };
public static final HashMap<String, String> waringPeriodTowaringCycle = new HashMap<String, String>() {
{
put("按时刻", "分钟");
put("按小时", "小时");
put("按天", "天");
}
};
public static final HashMap<String, String> waringPeriodDateFormate = new HashMap<String, String>() { public static final HashMap<String, String> waringPeriodDateFormate = new HashMap<String, String>() {
{ {
......
...@@ -166,7 +166,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -166,7 +166,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
*/ */
public HashMap<String, Object> getFanAlarmTrendAndAlarmAbnormalityList(IdxBizFanWarningRecord idxBizFanWarningRecord) { public HashMap<String, Object> getFanAlarmTrendAndAlarmAbnormalityList(IdxBizFanWarningRecord idxBizFanWarningRecord) {
HashMap<String, Object> result = new HashMap<>(); HashMap<String, Object> result = new HashMap<>();
HashMap<String, List<String>> alarmTrendMap = new HashMap<>(); HashMap<String, Object> alarmTrendMap = new HashMap<>();
HashMap<String,Object> maxValueAndWaringCycle = getWaringCycleAndMaxValueByWaring(idxBizFanWarningRecord.getWarningPeriod(),idxBizFanWarningRecord.getCONTENT(),idxBizFanWarningRecord.getPointName());
List<HashMap<String, String>> alarmAbnormalityList = new ArrayList<>(); List<HashMap<String, String>> alarmAbnormalityList = new ArrayList<>();
List<IdxBizFanHealthIndex> idxBizFanHealthIndexList = idxBizFanHealthIndexMapper.selectList(new QueryWrapper<IdxBizFanHealthIndex>() List<IdxBizFanHealthIndex> idxBizFanHealthIndexList = idxBizFanHealthIndexMapper.selectList(new QueryWrapper<IdxBizFanHealthIndex>()
.eq("GATEWAY_ID", idxBizFanWarningRecord.getGatewayId()) .eq("GATEWAY_ID", idxBizFanWarningRecord.getGatewayId())
...@@ -176,7 +177,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -176,7 +177,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
.orderByDesc("ANALYSIS_TIME") .orderByDesc("ANALYSIS_TIME")
.last("limit 30")); .last("limit 30"));
List<String> xDatas = new ArrayList<>(); List<String> xDatas = new ArrayList<>();
List<String> yDatas = new ArrayList<>(); List<Double> yDatas = new ArrayList<>();
String startTime = ""; String startTime = "";
String endTime = ""; String endTime = "";
int idxBizFanHealthIndexListSize = idxBizFanHealthIndexList.size(); int idxBizFanHealthIndexListSize = idxBizFanHealthIndexList.size();
...@@ -184,7 +185,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -184,7 +185,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
HashMap<String, String> alarmAbnormalityItem = new HashMap<>(); HashMap<String, String> alarmAbnormalityItem = new HashMap<>();
IdxBizFanHealthIndex idxBizFanHealthIndex = idxBizFanHealthIndexList.get(i); IdxBizFanHealthIndex idxBizFanHealthIndex = idxBizFanHealthIndexList.get(i);
xDatas.add(idxBizFanHealthIndex.getANALYSISTIME()); xDatas.add(idxBizFanHealthIndex.getANALYSISTIME());
yDatas.add(String.valueOf(idxBizFanHealthIndex.getHealthIndex())); yDatas.add(idxBizFanHealthIndex.getHealthIndex());
alarmAbnormalityItem.put("sort", String.valueOf(i)); alarmAbnormalityItem.put("sort", String.valueOf(i));
alarmAbnormalityItem.put("time", idxBizFanHealthIndex.getANALYSISTIME()); alarmAbnormalityItem.put("time", idxBizFanHealthIndex.getANALYSISTIME());
alarmAbnormalityItem.put("abnormal", String.valueOf(idxBizFanHealthIndex.getANOMALY()).replace("null","0.0")); alarmAbnormalityItem.put("abnormal", String.valueOf(idxBizFanHealthIndex.getANOMALY()).replace("null","0.0"));
...@@ -215,6 +216,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -215,6 +216,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
} }
alarmTrendMap.put("xDatas", xDatas); alarmTrendMap.put("xDatas", xDatas);
alarmTrendMap.put("yDatas", yDatas); alarmTrendMap.put("yDatas", yDatas);
alarmTrendMap.put("maxValue", maxValueAndWaringCycle.get("maxValue"));
alarmTrendMap.put("warningCycle", maxValueAndWaringCycle.get("warningCycle"));
result.put("alarmTrend", alarmTrendMap); result.put("alarmTrend", alarmTrendMap);
// 异常度 alarmAbnormality // 异常度 alarmAbnormality
int alarmAbnormalitySize = idxBizFanHealthIndexListSize >= 3 ? 3 : idxBizFanHealthIndexListSize; int alarmAbnormalitySize = idxBizFanHealthIndexListSize >= 3 ? 3 : idxBizFanHealthIndexListSize;
...@@ -233,7 +236,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -233,7 +236,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
*/ */
public HashMap<String, Object> getPvAlarmTrendAndAlarmAbnormalityList(IdxBizPvWarningRecord idxBizPvWarningRecord) { public HashMap<String, Object> getPvAlarmTrendAndAlarmAbnormalityList(IdxBizPvWarningRecord idxBizPvWarningRecord) {
HashMap<String, Object> result = new HashMap<>(); HashMap<String, Object> result = new HashMap<>();
HashMap<String, List<String>> alarmTrendMap = new HashMap<>(); HashMap<String, Object> alarmTrendMap = new HashMap<>();
HashMap<String,Object> maxValueAndWaringCycle = getWaringCycleAndMaxValueByWaring(idxBizPvWarningRecord.getWarningPeriod(),idxBizPvWarningRecord.getCONTENT(),idxBizPvWarningRecord.getPointName());
List<HashMap<String, String>> alarmAbnormalityList = new ArrayList<>(); List<HashMap<String, String>> alarmAbnormalityList = new ArrayList<>();
List<IdxBizPvHealthIndex> idxBizPvHealthIndexList = idxBizPvHealthIndexMapper.selectList(new QueryWrapper<IdxBizPvHealthIndex>() List<IdxBizPvHealthIndex> idxBizPvHealthIndexList = idxBizPvHealthIndexMapper.selectList(new QueryWrapper<IdxBizPvHealthIndex>()
.eq("GATEWAY_ID", idxBizPvWarningRecord.getGatewayId()) .eq("GATEWAY_ID", idxBizPvWarningRecord.getGatewayId())
...@@ -243,7 +247,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -243,7 +247,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
.orderByDesc("ANALYSIS_TIME") .orderByDesc("ANALYSIS_TIME")
.last("limit 30")); .last("limit 30"));
List<String> xDatas = new ArrayList<>(); List<String> xDatas = new ArrayList<>();
List<String> yDatas = new ArrayList<>(); List<Double> yDatas = new ArrayList<>();
String startTime = ""; String startTime = "";
String endTime = ""; String endTime = "";
int idxBizPvHealthIndexListSize = idxBizPvHealthIndexList.size(); int idxBizPvHealthIndexListSize = idxBizPvHealthIndexList.size();
...@@ -251,7 +255,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -251,7 +255,7 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
HashMap<String, String> alarmAbnormalityItem = new HashMap<>(); HashMap<String, String> alarmAbnormalityItem = new HashMap<>();
IdxBizPvHealthIndex idxBizPvHealthIndex = idxBizPvHealthIndexList.get(i); IdxBizPvHealthIndex idxBizPvHealthIndex = idxBizPvHealthIndexList.get(i);
xDatas.add(idxBizPvHealthIndex.getANALYSISTIME()); xDatas.add(idxBizPvHealthIndex.getANALYSISTIME());
yDatas.add(String.valueOf(idxBizPvHealthIndex.getHealthIndex())); yDatas.add(idxBizPvHealthIndex.getHealthIndex());
alarmAbnormalityItem.put("sort", String.valueOf(i)); alarmAbnormalityItem.put("sort", String.valueOf(i));
alarmAbnormalityItem.put("time", idxBizPvHealthIndex.getANALYSISTIME()); alarmAbnormalityItem.put("time", idxBizPvHealthIndex.getANALYSISTIME());
alarmAbnormalityItem.put("abnormal", String.valueOf(idxBizPvHealthIndex.getANOMALY()).replace("null","0.0")); alarmAbnormalityItem.put("abnormal", String.valueOf(idxBizPvHealthIndex.getANOMALY()).replace("null","0.0"));
...@@ -282,6 +286,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -282,6 +286,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
} }
alarmTrendMap.put("xDatas", xDatas); alarmTrendMap.put("xDatas", xDatas);
alarmTrendMap.put("yDatas", yDatas); alarmTrendMap.put("yDatas", yDatas);
alarmTrendMap.put("maxValue", maxValueAndWaringCycle.get("maxValue"));
alarmTrendMap.put("warningCycle", maxValueAndWaringCycle.get("warningCycle"));
result.put("alarmTrend", alarmTrendMap); result.put("alarmTrend", alarmTrendMap);
// 异常度 alarmAbnormality // 异常度 alarmAbnormality
int alarmAbnormalitySize = idxBizPvHealthIndexListSize >= 3 ? 3 : idxBizPvHealthIndexListSize; int alarmAbnormalitySize = idxBizPvHealthIndexListSize >= 3 ? 3 : idxBizPvHealthIndexListSize;
...@@ -608,4 +614,30 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -608,4 +614,30 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
date = DateUtil.offsetMinute(date, offsetMinutes); date = DateUtil.offsetMinute(date, offsetMinutes);
return DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN); return DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
} }
/**
* 根据预预警类型获取预警周期与预警值
* @return
*/
public HashMap<String,Object> getWaringCycleAndMaxValueByWaring(String warningPeriod,String warningContenct,String pointName){
HashMap<String,Object> result = new HashMap<>();
warningContenct=warningContenct.replace(pointName+"连续","");
String spiltStr =CommonConstans.waringPeriodTowaringCycle.get(warningPeriod);
String [] strings= warningContenct.split(spiltStr);
Double maxValue=0.0;
Integer warningCycle=0;
if(strings.length == 2){
if (spiltStr.equals("分钟")){
warningCycle = Integer.valueOf(strings[0])/10;
}else {
warningCycle=Integer.valueOf(strings[0]);
}
if(strings[1].contains("<")){
maxValue = Double.valueOf(strings[1].split("<")[1]);
}
}
result.put("maxValue",maxValue);
result.put("warningCycle",warningCycle);
return result;
}
} }
...@@ -1451,11 +1451,13 @@ public class CommonServiceImpl { ...@@ -1451,11 +1451,13 @@ public class CommonServiceImpl {
// @Scheduled(cron = "0 0/10 * * * ?") // @Scheduled(cron = "0 0/10 * * * ?")
@Async("async") @Async("async")
public void healthWarningMinuteByFan() { public void healthWarningMinuteByFan() {
if (!openHealth) { if (!openHealth) {
return; return;
} }
String format = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:00"); String format = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:00");
Date time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00"); Date time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00");
logger.info("风机---------------------健康指数时间----"+time);
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));
...@@ -1722,6 +1724,7 @@ public class CommonServiceImpl { ...@@ -1722,6 +1724,7 @@ public class CommonServiceImpl {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String format = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:00"); String format = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:00");
Date time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00"); Date time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00");
logger.info("光伏---------------------健康指数时间----"+time);
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();
......
...@@ -119,7 +119,8 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -119,7 +119,8 @@ public class HealthStatusIndicatorServiceImpl {
if (!openHealth){ if (!openHealth){
return; return;
} }
// Calendar calendar = Calendar.getInstance(); log.info("光伏---------------------预警时间----"+time);
// Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1); calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
...@@ -555,6 +556,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -555,6 +556,7 @@ public class HealthStatusIndicatorServiceImpl {
return; return;
} }
// Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
log.info("风机---------------------预警时间----"+time);
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1); calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
......
...@@ -749,12 +749,13 @@ ...@@ -749,12 +749,13 @@
SELECT a.*, SELECT a.*,
row_number() over ( ORDER BY pointName ) AS id row_number() over ( ORDER BY pointName ) AS id
FROM ( FROM (
SELECT ARAE AS area, (SELECT ARAE AS area,
STATION AS station, STATION AS station,
EQUIPMENT_NAME AS equipmentName, EQUIPMENT_NAME AS equipmentName,
SUB_SYSTEM AS subSystem, SUB_SYSTEM AS subSystem,
POINT_NAME AS pointName, POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress INDEX_ADDRESS AS indexAddress,
KKS
FROM idx_biz_fan_point_process_variable_classification FROM idx_biz_fan_point_process_variable_classification
WHERE TAG_CODE = '分析变量' WHERE TAG_CODE = '分析变量'
AND ARAE is not null AND ARAE is not null
...@@ -763,13 +764,15 @@ ...@@ -763,13 +764,15 @@
AND SUB_SYSTEM is not null AND SUB_SYSTEM is not null
AND POINT_NAME is not null AND POINT_NAME is not null
AND INDEX_ADDRESS is not null AND INDEX_ADDRESS is not null
)
UNION ALL UNION ALL
SELECT ARAE AS area, (SELECT ARAE AS area,
STATION AS station, STATION AS station,
SUBARRAY AS equipmentName, SUBARRAY AS equipmentName,
EQUIPMENT_NAME AS subSystem, EQUIPMENT_NAME AS subSystem,
POINT_NAME AS pointName, POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress INDEX_ADDRESS AS indexAddress,
KKS
FROM idx_biz_pv_point_process_variable_classification FROM idx_biz_pv_point_process_variable_classification
WHERE TAG_CODE = '分析变量' WHERE TAG_CODE = '分析变量'
AND ARAE is not null AND ARAE is not null
...@@ -778,7 +781,9 @@ ...@@ -778,7 +781,9 @@
AND EQUIPMENT_NAME is not null AND EQUIPMENT_NAME is not null
AND POINT_NAME is not null AND POINT_NAME is not null
AND INDEX_ADDRESS is not null AND INDEX_ADDRESS is not null
)
) a ) a
ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc
</select> </select>
<select id="getStationIndexInfo" resultType="java.util.Map"> <select id="getStationIndexInfo" resultType="java.util.Map">
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
values values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
( (
now + #{index}, now,
#{item.recDate, jdbcType=VARCHAR}, #{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR}, #{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR}, #{item.analysisObjSeq, jdbcType=VARCHAR},
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
values values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
( (
now + #{index}, now,
#{item.recDate, jdbcType=VARCHAR}, #{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR}, #{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR}, #{item.analysisObjSeq, jdbcType=VARCHAR},
......
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