Commit 69bbed26 authored by wujiang's avatar wujiang

Merge branch 'developer' of http://36.40.66.175:5000/moa/amos-boot-biz into developer

parents d4fd4095 d8a42455
......@@ -34,10 +34,10 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableTransactionManagement
@EnableConfigurationProperties
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
//@EnableDiscoveryClient
//@EnableFeignClients
@EnableAsync
@EnableEurekaClient
//@EnableEurekaClient
@EnableScheduling
@MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao",
"org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
......
package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.houseapi.HouseholdPvProducerInfo;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.GolangStationMapper;
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.component.cache.Redis;
import java.util.*;
@Component
public class GoodWeRequestUtil {
private final String redisKey = "GOODWE_REQUEST_TOKEN";
......
......@@ -2,9 +2,12 @@ package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
import com.yeejoin.amos.api.householdapi.constant.SoFarConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -16,23 +19,38 @@ import java.util.List;
public class SofarRequestUtil {
private final String redisKey = "SOFAR_REQUEST_TOKEN";
@Autowired
private RedisUtils redisUtils;
/**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer
*/
public HashMap<String, Object> getHeaderOfGolang() {
HashMap<String, Object> hashMap = new HashMap<>();
HashMap<String, String> hashMaphead = new HashMap<>();
String url = GoLangConstant.baseurl + GoLangConstant.tokenurl;
hashMap.put("apiurl", GoLangConstant.baseurl);
hashMaphead.put("Content-type", "application/json;charset=UTF-8");
hashMaphead.put("Authorization", "API " + GoLangConstant.prodcerappid);
hashMaphead.put("Content-MD5", null);
hashMaphead.put("Date", GoLangHeaderUtils.getGMTTime());
hashMap.put("header", hashMaphead);
hashMap.put("appsecret", GoLangConstant.prodcerappsecret);
return hashMap;
public HashMap<String, String> getHeaderOfSofar() {
HashMap<String,String> requestHeader = new HashMap<>();
if(ObjectUtil.isNotEmpty(redisUtils.get(redisKey))){
requestHeader.put("authorization",redisUtils.get(redisKey).toString());
return requestHeader;
}
HashMap<String, Object> map = new HashMap<>();
map.put("accountName", SoFarConstant.account);
map.put("appId",SoFarConstant.appId);
map.put("appSecret", SoFarConstant.appSecret);
map.put("corporationId", SoFarConstant.corporationId);
map.put("accountType", 2);
String body = JSON.toJSONString(map);
String url = SoFarConstant.baseurl+SoFarConstant.tokenurl;
String response = HttpUtil.createPost(url).body(body).execute().body();
JSONObject jsonObject = JSON.parseObject(response);
if(jsonObject.getString("msg").equals("success")){
String token = jsonObject.getString("data");
requestHeader.put("authorization",token);
redisUtils.set(redisKey,token,5183900);
}
return requestHeader;
}
/**
......@@ -50,19 +68,16 @@ public class SofarRequestUtil {
String params = "";
JSONArray jsonArray = null;
List<T> result = new ArrayList<>();
try {
HashMap<String, Object> producerInfo = getHeaderOfGolang();
String baseurl = (String) producerInfo.get("apiurl");
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
String orginalAuthorization = headMap.get("Authorization") + ":";
String url = baseurl + apiurl;
String appsecret = (String) producerInfo.get("appsecret");
JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret, apiurl);
HashMap<String, String> headMap = getHeaderOfSofar();
String url = SoFarConstant.baseurl + apiurl;
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
JSONObject jsonObject = JSONObject.parseObject(respone);
// jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
// if (!ObjectUtils.isEmpty(jsonArray)) {
// result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
// }
} catch (Exception exception) {
return result;
}
......@@ -112,27 +127,6 @@ public class SofarRequestUtil {
return respone;
}
/***
*
* @param params 参数字符窜
* @param headMap header头
* @param orginalAuthorization 原始的orginalAuthorization
* @param appsecret appsecret
* @desc 锦浪云请求参数及head头处理
*/
public void JLYHeaderMapHandler(String params, HashMap<String, String> headMap, String orginalAuthorization, String appsecret, String apiurl) {
String contentMD5 = GoLangHeaderUtils.getDigest(params);
headMap.put("Date", GoLangHeaderUtils.getGMTTime());
String param = "POST" + "\n" + contentMD5 + "\n" + "application/json" + "\n" + headMap.get("Date") + "\n" + apiurl;
String sign = "";
try {
sign = GoLangHeaderUtils.HmacSHA1Encrypt(param, appsecret);
} catch (Exception e) {
throw new RuntimeException(e);
}
headMap.put("Content-MD5", contentMD5);
headMap.put("Authorization", orginalAuthorization + sign);
}
/**
* @param pageSizeResovle
......
//package com.yeejoin.amos.api.householdapi.Utils;
//
//import com.taosdata.jdbc.SchemalessWriter;
//import com.taosdata.jdbc.enums.SchemalessProtocolType;
//import com.taosdata.jdbc.enums.SchemalessTimestampType;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import java.sql.Connection;
//import java.sql.DriverManager;
//import java.sql.SQLException;
//
//@Component
//public class TdEngineUtils {
// @Value("${tdengine-server.jdbc-url}")
// private String url;
// @Value("${tdengine-server.username}")
// private String user;
// @Value("${tdengine-server.password}")
// private String password;
// public void writeDataIntoTdEngine(String lines){
// try (Connection conn = this.getConnection()) {
// SchemalessWriter writer = new SchemalessWriter(conn);
// writer.write(lines, SchemalessProtocolType.JSON, SchemalessTimestampType.NOT_CONFIGURED);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// public Connection getConnection() throws SQLException {
// String jdbcUrl = String.format(url, user, password);
// return DriverManager.getConnection(jdbcUrl);
// }
//
//}
package com.yeejoin.amos.api.householdapi.constant;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
/**
* 首航常量
*/
public class SoFarConstant {
public static final HashMap<String, String> stationStaus = new HashMap<String, String>() {
{
put("-1", "离线");
put("0", "待机");
put("1", "正常");
put("2", "停机");
}
};
public static String baseurl = "https://openapi.sofarsolarmonitor.com";
public static String appId = "447430219192733696";
public static String appSecret = "5881ee8c062817016a2b34425c45937d";
public static String corporationId = "447430928264990720";
public static String account = "18120415291";
public static String password = "ZXNK123456..";
public static String tokenurl = "/account/auth/createToken";
public static String stationListUrl = "/station/v1.0/list";
public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor";
public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail";
public static String collectorListUrl = "/v1/api/collectorList";
public static String collectorDetailUrl = "/v1/api/collectorDetail";
public static String inverterListUrl = "/v1/api/inverterList";
public static String inverterDetailUrl = "/v1/api/inverterDetail";
public static String alarmListUrl = "/v1/api/alarmList";
public static String stationDayGenUrl ="/v1/api/stationDayEnergyList";
public static String stationMonthEnergyList ="/v1/api/stationDayEnergyList";
public static String stationYearEnergyList ="/v1/api/stationDayEnergyList";
public static String inverterDayURL ="/v1/api/inverterDay";
public static String inverterMonthURL ="/v1/api/inverterMonth";
public static String inverterYearURL ="/v1/api/inverterYear";
public static String resovleRule_data_page_records = "data,page,records";
public static String resovleRule_data_list = "data,list";
public static String resovleRule_data_records = "data,records";
public static String resovleRule_data = "data";
public static String requestPost = "POST";
public static String requestGet = "GET";
public static String datePattern = "yyyy-MM-dd HH:mm:ss.SSS";
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(datePattern);
public static Double kwhToMwh = 0.0001;
public static Double mwhTokwh = 1000.0;
}
......@@ -2,11 +2,9 @@ package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.service.GoodWeDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.service.ImasterDataService;
import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.service.*;
import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl;
import fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -40,6 +38,8 @@ public class HouseholdTestController {
private ImasterDataService imasterDataService;
@Autowired
private GoodWeDataAcquisitionService goodWeDataAcquisitionService;
@Autowired
private SofarDataAcquisitionService sofarDataAcquisitionService;
/**
......@@ -83,7 +83,7 @@ public class HouseholdTestController {
@PostMapping(value = "/sofarnew")
@ApiOperation(httpMethod = "POST", value = "首航", notes = "首航")
public void sofarnew() throws IOException {
// goLangDataAcquisitionService.stationList();
sofarDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
// goLangDataAcquisitionService.inverterList();
......
package com.yeejoin.amos.api.householdapi.face.service.impl;
import com.yeejoin.amos.api.householdapi.Utils.SofarRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.SoFarConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GolangStationList;
import com.yeejoin.amos.api.householdapi.face.service.SofarDataAcquisitionService;
import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionService {
@Autowired
private SofarRequestUtil requestUtil;
@Override
public void stationList() {
Map<String, Object> requestInfo = new HashMap<>();
requestInfo.put("page", 1);
requestInfo.put("size", 1000);
String param = JSON.toJSONString(requestInfo);
requestUtil.getResPonse(SoFarConstant.stationListUrl,SoFarConstant.requestPost, param, SoFarConstant.resovleRule_data, GolangStationList.class);
}
@Override
public void stationDetail() {
}
@Override
public void collectorList() {
}
@Override
public void collectorDetail() {
}
@Override
public void inverterList() {
}
@Override
public void inverterDetail() {
}
@Override
public void inverAlramInfo() {
}
}
//package com.yeejoin.amos.dockingData;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
//import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
//import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvApi;
//import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
//import org.jetbrains.annotations.TestOnly;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.util.*;
//import java.util.zip.Inflater;
//
///**
// * @description:
// * @author: tw
// * @createDate: 2023/6/16
// */
//@Component
//public class DockingData {
// @Autowired
// InfluxDbConnection influxDbConnection;
// @Autowired
// HouseholdPvUtils householdPvUtils;
// @Autowired
// private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
// @Autowired
// private HouseholdPvApiServiceImpl householdPvApiServiceImpl;
//
// //初始化执行
// @PostConstruct
// public void init() {
// //锦浪云
// this.getDataGolong();
// //固德威
//// this.getDataGoodWE();
// //首航
//// this.getDataSoFar();
// }
//
// //每二十分钟执行一次
// @Scheduled(cron = "0 0/20 * * * ?")
// public void fixedRateGolong() {
// this.getDataGolong();
// }
//
// @Scheduled(cron = "0 0/20 * * * ?")
//// public void fixedRateGoodWE() {
//// this.getDataGoodWE();
//// }
//
//
// @Scheduled(cron = "0 0/20 * * * ?")
//// public void fixedRateSoFar() {
//// this.getDataSoFar();
//// }
//
// //请求获取数据
// public void getDataGolong() {
// List<HouseholdPvApi> householdPvApiList = householdPvApiServiceImpl.list();
// householdPvApiList.stream().filter(householdPvApi -> householdPvApi.getProducerId().equals(PVProducerInfoEnum.JLY.getCode())).forEach(householdPvApi -> householdPvUtils.gerResponseByAPiID(householdPvApi.getSequenceNbr()));
// }
//
// public void getDataGoodWE() {
// List<HouseholdPvApi> householdPvApiList = householdPvApiServiceImpl.list();
// householdPvApiList.stream().filter(householdPvApi -> householdPvApi.getProducerId().equals(PVProducerInfoEnum.GDW.getCode())).forEach(householdPvApi -> householdPvUtils.gerResponseByAPiID(householdPvApi.getSequenceNbr()));
// }
//
// public void getDataSoFar() {
// List<HouseholdPvApi> householdPvApiList = householdPvApiServiceImpl.list();
// householdPvApiList.stream().filter(householdPvApi -> householdPvApi.getProducerId().equals(PVProducerInfoEnum.SH.getCode())).forEach(householdPvApi -> householdPvUtils.gerResponseByAPiID(householdPvApi.getSequenceNbr()));
// }
//}
......@@ -146,7 +146,7 @@ public class ClientHandler<path> implements Runnable {
// String product = robotAuthentication.getProduct();
// String appKey = robotAuthentication.getAppKey();
String token = "f5f5ebba-f68a-4093-a78e-388c925a6eaa"; // 如果token、失效,就去浏览器复制最新的token、
String token = "a1bae8ec-6ef4-40f3-94b0-78f16a249b0e"; // 如果token、失效,就去浏览器复制最新的token、
String product = "AMOS_STUDIO_WEB";
String appKey = "AMOS_STUDIO";
......@@ -254,57 +254,60 @@ public class ClientHandler<path> implements Runnable {
// String product = robotAuthentication.getProduct();
// String appKey = robotAuthentication.getAppKey();
String token = "f5f5ebba-f68a-4093-a78e-388c925a6eaa"; // 如果token、失效,就去浏览器复制最新的token、
String token = "a1bae8ec-6ef4-40f3-94b0-78f16a249b0e"; // 如果token、失效,就去浏览器复制最新的token、
String product = "AMOS_STUDIO_WEB";
String appKey = "AMOS_STUDIO";
String[] parts = url.split("/|:");
String dbIp = parts[2];
int dbPort = Integer.parseInt(parts[3]);
String dbName = parts[4];
String dbIp = parts[4];
int dbPort = Integer.parseInt(parts[5]);
String dbName = parts[6].split("\\?")[0];
RestTemplate restTemplate = new RestTemplate();
String defaultDatabaseName = "空工大_" + dbName;
//查询数据库是否已创建
String connId = "";
String datasourcesUrl = "http://" + hostAndPort + "/maas/dsm/datasources/query";
String datasourcesUrl = "http://" + hostAndPort + "/maas/maas/desktop/conns-jdbc";
Map<String, String> datasourcesParams = new HashMap<>();
datasourcesParams.put("pid", dataSourcesGroupId);
HttpEntity<Map<String, String>> datasourcesRequestEntity = new HttpEntity<>(datasourcesParams, getHeader(token, product, appKey, hostAndPort, false));
ResponseEntity<String> datasourcesResponse = restTemplate.exchange(datasourcesUrl, HttpMethod.POST, datasourcesRequestEntity, String.class);
ResponseEntity<String> datasourcesResponse = restTemplate.exchange(datasourcesUrl, HttpMethod.GET, datasourcesRequestEntity, String.class);
String datasourcesBody = datasourcesResponse.getBody();
JSONObject datasourcesJsonObject = JSONObject.parseObject(datasourcesBody);
JSONArray datasourcesResult = datasourcesJsonObject.getJSONArray("result");
if (datasourcesResult != null) {
if (datasourcesResult != null && datasourcesResult.size() > 0) {
for (int i = 0; i < datasourcesResult.size(); i++) {
Map<String, Object> stringObjectMap = (Map<String, Object>) datasourcesResult.get(i);
if (defaultDatabaseName.equals(stringObjectMap.get("name"))) {
connId = (String) stringObjectMap.get("id");
break;
}
}
}
//查询数据库表是否已创建
boolean isCreateTable = false;
String jdbcTablesUrl = "http://" + hostAndPort + "/maas/dsm/jdbc/tables";
Map<String, String> jdbcTablesParams = new HashMap<>();
datasourcesParams.put("dsId", connId);
datasourcesParams.put("dsType", "mysql");
datasourcesParams.put("resourceType", "mysql");
datasourcesParams.put("dsdetail", "{\"hostname\":\"" + dbIp + "\",\"port\":" + dbPort + ",\"name\":\"" + defaultDatabaseName + "\",\"database\":\"" + dbName + "\",\"username\":\"" + username + "\",\"password\":\"" + DesUtil.encode(password, passwordSecretKey) + "\",\"dbtype\":\"mysql\"}");
HttpEntity<Map<String, String>> jdbcTablesRequestEntity = new HttpEntity<>(jdbcTablesParams, getHeader(token, product, appKey, hostAndPort, false));
ResponseEntity<String> jdbcTablesResponse = restTemplate.exchange(jdbcTablesUrl, HttpMethod.POST, jdbcTablesRequestEntity, String.class);
String jdbcTablesBody = jdbcTablesResponse.getBody();
JSONObject jdbcTablesJsonObject = JSONObject.parseObject(jdbcTablesBody);
JSONArray jdbcTablesResult = jdbcTablesJsonObject.getJSONArray("result");
if (jdbcTablesResult != null) {
for (int i = 0; i < jdbcTablesResult.size(); i++) {
Map<String, Object> stringObjectMap = (Map<String, Object>) jdbcTablesResult.get(i);
if (StringUtil.isNotEmpty(connId)) {
String tablelistUrl = "http://" + hostAndPort + "/maas/maas/desktop/tablelist";
Map<String, String> tablelistParams = new HashMap<>();
tablelistParams.put("connId", connId);
tablelistParams.put("subcjectId", dataSourcesGroupId);
HttpEntity<Map<String, String>> tablelistRequestEntity = new HttpEntity<>(tablelistParams, getHeader(token, product, appKey, hostAndPort, false));
ResponseEntity<String> tablelistResponse = restTemplate.exchange(tablelistUrl, HttpMethod.POST, tablelistRequestEntity, String.class);
String tablelistBody = tablelistResponse.getBody();
JSONObject tablelistJsonObject = JSONObject.parseObject(tablelistBody);
JSONArray tablelistResult = tablelistJsonObject.getJSONArray("result");
if (tablelistResult != null && tablelistResult.size() > 0) {
for (int i = 0; i < tablelistResult.size(); i++) {
Map<String, Object> stringObjectMap = (Map<String, Object>) tablelistResult.get(i);
if (tableName.equals(stringObjectMap.get("name"))) {
isCreateTable = true;
break;
}
}
}
}
//3. 调用conn接口,数据库已创建过就不在创建
if (StringUtil.isEmpty(connId)) {
String connsUrl = "http://" + hostAndPort + "/maas/maas/desktop/conns";
......@@ -312,7 +315,7 @@ public class ClientHandler<path> implements Runnable {
connsParams.put("name", defaultDatabaseName);
connsParams.put("connType", "mysql");
connsParams.put("subjectid", dataSourcesGroupId);
connsParams.put("detail", "{\"hostname\":\""+dbIp+"\",\"port\":"+dbPort+",\"username\":\"" + username + "\",\"password\":\"" + DesUtil.encode(password, passwordSecretKey) + "\",\"name\":\"" + defaultDatabaseName + "\",\"database\":\"" + dbName + "\",\"dbtype\":\"mysql\"}");
connsParams.put("detail", "{\"hostname\":\"" + dbIp + "\",\"port\":" + dbPort + ",\"username\":\"" + username + "\",\"password\":\"" + DesUtil.encode(password, passwordSecretKey) + "\",\"name\":\"" + defaultDatabaseName + "\",\"database\":\"" + dbName + "\",\"dbtype\":\"mysql\"}");
HttpEntity<Map<String, String>> connsRequestEntity = new HttpEntity<>(connsParams, getHeader(token, product, appKey, hostAndPort, false));
ResponseEntity<String> connsResponse = restTemplate.exchange(connsUrl, HttpMethod.POST, connsRequestEntity, String.class);
......@@ -336,16 +339,6 @@ public class ClientHandler<path> implements Runnable {
JSONObject tablesJsonObject = JSONObject.parseObject(tablesBody);
String tablesResult = tablesJsonObject.getString("result");
String tablelistUrl = "http://" + hostAndPort + "/maas/maas/desktop/tablelist";
Map<String, String> tablelistParams = new HashMap<>();
tablesParams.put("connId", connId);
tablesParams.put("subcjectId", dataSourcesGroupId);
HttpEntity<Map<String, String>> tablelistRequestEntity = new HttpEntity<>(tablelistParams, getHeader(token, product, appKey, hostAndPort, false));
ResponseEntity<String> tablelistResponse = restTemplate.exchange(tablelistUrl, HttpMethod.POST, tablelistRequestEntity, String.class);
String tablelistBody = tablelistResponse.getBody();
JSONObject tablelistJsonObject = JSONObject.parseObject(tablelistBody);
String tablelistResult = tablelistJsonObject.getString("result");
}
}
}
......
......@@ -265,7 +265,7 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<PvWarningRecord> query = new LambdaQueryWrapper<>();
query.eq(PvWarningRecord::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
query.eq(PvWarningRecord::getStatus,0);
query.isNotNull(PvWarningRecord::getDisposotionDate);
query.orderByDesc(PvWarningRecord::getTs);
List<PvWarningRecord> idxBizPvWarningRecords = pvWaringRecordMapper.selectList(query);
......@@ -433,7 +433,8 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<PvWarningRecord> query = new LambdaQueryWrapper<>();
query.eq(PvWarningRecord::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
query.eq(PvWarningRecord::getStatus,0);
query.eq(PvWarningRecord::getStatus,"0");
query.isNotNull(PvWarningRecord::getDisposotionDate);
query.orderByDesc(PvWarningRecord::getRecDate);
List<PvWarningRecord> idxBizPvWarningRecords = pvWaringRecordMapper.selectList(query);
......@@ -599,7 +600,8 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<PvWarningRecord> query = new LambdaQueryWrapper<>();
query.eq(PvWarningRecord::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
query.eq(PvWarningRecord::getStatus,0);
query.eq(PvWarningRecord::getStatus,"0");
query.isNotNull(PvWarningRecord::getDisposotionDate);
query.orderByDesc(PvWarningRecord::getTs);
List<PvWarningRecord> idxBizPvWarningRecords = pvWaringRecordMapper.selectList(query);
......@@ -769,7 +771,8 @@ public class HealthStatusIndicatorServiceImpl {
//库里若已存在该测点预警 不生成重复的 若新生预警等级高于历史 则生成
LambdaQueryWrapper<FanWarningRecord> query = new LambdaQueryWrapper<>();
query.eq(FanWarningRecord::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
query.eq(FanWarningRecord::getStatus,0);
query.eq(FanWarningRecord::getStatus,"0");
query.isNotNull(FanWarningRecord::getDisposotionDate);
query.orderByDesc(FanWarningRecord::getTs);
List<FanWarningRecord> idxBizFanWarningRecords = fanWaringRecordMapper.selectList(query);
......@@ -938,7 +941,8 @@ public class HealthStatusIndicatorServiceImpl {
}
LambdaQueryWrapper<FanWarningRecord> query = new LambdaQueryWrapper<>();
query.eq(FanWarningRecord::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
query.eq(FanWarningRecord::getStatus,0);
query.eq(FanWarningRecord::getStatus,"0");
query.isNotNull(FanWarningRecord::getDisposotionDate);
query.orderByDesc(FanWarningRecord::getTs);
List<FanWarningRecord> idxBizFanWarningRecords = fanWaringRecordMapper.selectList(query);
......@@ -1111,7 +1115,8 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper<FanWarningRecord> query = new LambdaQueryWrapper<>();
query.eq(FanWarningRecord::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
query.eq(FanWarningRecord::getStatus,0);
query.eq(FanWarningRecord::getStatus,"0");
query.isNotNull(FanWarningRecord::getDisposotionDate);
query.orderByDesc(FanWarningRecord::getTs);
List<FanWarningRecord> idxBizFanWarningRecords = fanWaringRecordMapper.selectList(query);
......
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