Commit 3132dfdc authored by caotao's avatar caotao

户用光伏api初版提交

parent bb95c568
......@@ -2,6 +2,7 @@ package com.yeejoin.amos;
import java.net.InetAddress;
import com.yeejoin.amos.component.utils.ClassPathUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.mybatis.spring.annotation.MapperScan;
......@@ -47,14 +48,14 @@ import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
@ComponentScan({ "org.typroject", "com.yeejoin.amos" })
public class AccessapiApplication {
// @Autowired
// private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
@Autowired
private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
private static final Logger logger = LogManager.getLogger(AccessapiApplication.class);
public static void main(String[] args) throws Exception {
// //license授权验证
// System.setProperty("root.path",ClassPathUtil.getPath()+"/config");
//license授权验证
// System.setProperty("root.path", ClassPathUtil.getPath()+"/config");
// log.info("(license.bat)url:" + ClassPathUtil.getPath()+"/config");
// A.v();
// 服务启动
......@@ -69,9 +70,9 @@ public class AccessapiApplication {
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
// @Bean
// public void initAccessConfig() {
// taAccessConfigServiceImpl.refreshConfig();
// taAccessConfigServiceImpl.startTask();
// }
@Bean
public void initAccessConfig() {
taAccessConfigServiceImpl.refreshConfig();
taAccessConfigServiceImpl.startTask();
}
}
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 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
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
@Autowired
private HouseholdPvApiServiceImpl householdPvApiServiceImpl;
@Autowired
InfluxDbConnection influxDbConnection;
@Autowired
HouseholdPvUtils householdPvUtils;
//初始化执行
@PostConstruct
public void init(){
this.getDate();
}
//每二十分钟执行一次
@Scheduled(cron = "0 0/20 * * * ?")
public void fixedRate() {
this.getDate();
}
//请求获取数据
public void getDate(){
List<HouseholdPvApi> householdPvApiList =householdPvApiServiceImpl.list();
householdPvApiList.forEach(householdPvApi -> householdPvUtils.gerResponseByAPiID(householdPvApi.getSequenceNbr()));
// //首航
// String data1=householdPvUtils.gerResponseByAPiID(1000000002L);
// JSONObject json= JSON.parseObject(data1);
//
// if((Boolean)json.get("success")){
// JSONArray obj= json.get("stationList") !=null?(JSONArray)json.get("stationList"):null;
// if (obj!=null) {
// for (Object o : obj) {
// Map<String,Object> maps1 = (Map<String,Object>)o;
// Map<String,String> maps2=new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("SH_DZ",maps2,maps1);
// }
// }
// }
//
// String data2=householdPvUtils.gerResponseByAPiID(1000000003L);
// JSONObject json2= JSON.parseObject(data2);
// if((Boolean)json2.get("success")) {
// JSONArray obj2 = json.get("deviceList") != null ? (JSONArray) json2.get("deviceList") : null;
// if (obj2!=null) {
// for (Object o : obj2) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("SH_ZB", maps2, maps1);
// }
// }
// }
//
// //固德威
// String data3 = householdPvUtils.gerResponseByAPiID(1000000006L);
//
// JSONObject json3= JSON.parseObject(data3);
// if(Integer.valueOf(json3.get("code").toString())==0) {
// JSONObject obj3 = json3.get("data") != null ? (JSONObject)json3.get("data") : null;
// if (obj3!=null&&obj3.get("list")!=null) {
//
// JSONArray ob = obj3.get("list") != null ? (JSONArray) obj3.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_DZ", maps2, maps1);
// }
// }
// }
//
// String data4 = householdPvUtils.gerResponseByAPiID(1000000007L);
//
// JSONObject json4= JSON.parseObject(data4);
// if(Integer.valueOf(json4.get("code").toString())==0) {
// JSONObject obj4 = json4.get("data") != null ? (JSONObject)json4.get("data") : null;
// if (obj4!=null&&obj4.get("list")!=null) {
//
// JSONArray ob = obj4.get("list") != null ? (JSONArray) obj4.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_ZT", maps2, maps1);
// }
// }
// }
//
// String data5 = householdPvUtils.gerResponseByAPiID(1000000008L);
//
// JSONObject json5= JSON.parseObject(data5);
// if(Integer.valueOf(json5.get("code").toString())==0) {
// JSONObject obj5 = json5.get("data") != null ? (JSONObject)json5.get("data") : null;
// if (obj5!=null&&obj5.get("list")!=null) {
//
// JSONArray ob = obj5.get("list") != null ? (JSONArray) obj5.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_GJ", maps2, maps1);
// }
// }
// }
//
//
// String data6 = householdPvUtils.gerResponseByAPiID(1686897906789L);
//
// JSONObject json6= JSON.parseObject(data6);
// if(Integer.valueOf(json6.get("code").toString())==0) {
// JSONObject obj6 = json6.get("data") != null ? (JSONObject)json6.get("data") : null;
// if (obj6!=null&&obj6.get("page")!=null) {
//
// JSONArray ob = ((JSONObject)obj6.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj6.get("page")).get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("JL_CZ", maps2, maps1);
// }
// }
// }
// String data7 = householdPvUtils.gerResponseByAPiID(1686900771946L);
// JSONObject json7= JSON.parseObject(data7);
// if(Integer.valueOf(json7.get("code").toString())==0) {
// JSONObject obj7 = json7.get("data") != null ? (JSONObject)json7.get("data") : null;
// if (obj7!=null&&obj7.get("page")!=null) {
//
// JSONArray ob = ((JSONObject)obj7.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj7.get("page")).get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
//
// maps1.put("etotal1",maps1.get("etotal1").toString());
// maps1.put("etoday1",maps1.get("etoday1").toString());
// influxDbConnection.insert("JL_NBQ", maps2, maps1);
// }
// }
// }
// String data8 = householdPvUtils.gerResponseByAPiID(1686900972965L);
// JSONObject json8= JSON.parseObject(data8);
// if(Integer.valueOf(json8.get("code").toString())==0) {
// JSONObject obj8 = json8.get("data") != null ? (JSONObject)json8.get("data") : null;
// if (obj8!=null&&obj8.get("records")!=null) {
//
// JSONArray ob = obj8.get("records")!= null ? (JSONArray)obj8.get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("JL_GJ", maps2, maps1);
// }
// }
// }
}
}
This diff is collapsed.
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-data</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-data-housepvapi</artifactId>
<name>amos-boot-data-housepvapi</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-foundation</artifactId>
<version>${tyboot-version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-restful</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>${tyboot-version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-event</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-opendata</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>${amos.version}</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-config</artifactId>
<version>${amos.version}</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-rdbms</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-cache</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.3.7</version>
</dependency>
<dependency>
<groupId>fakepath</groupId>
<artifactId>license-sdk</artifactId>
<version>1.0.0</version>
</dependency>
<!-- druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- Vastbase G100 -->
<dependency>
<groupId>cn.com.vastdata</groupId>
<artifactId>vastbase</artifactId>
<version>1.0.0.1</version>
</dependency>
<!-- LOG4J -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.22</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-influxdb</artifactId>
<version>1.8.5-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>3.2.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.yeejoin.amos;
import java.net.InetAddress;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
/**
*
* <pre>
*
* </pre>
*
* @author gwb
* @version $Id: OpenapiApplication.java, v 0.1 2021年9月27日 下午3:29:30 gwb Exp $
*/
@SpringBootApplication
@EnableTransactionManagement
@EnableConfigurationProperties
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@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" })
@ComponentScan({ "org.typroject", "com.yeejoin.amos" })
public class HousevPVapiApplication {
private static final Logger logger = LogManager.getLogger(HousevPVapiApplication.class);
public static void main(String[] args) throws Exception {
// 服务启动
ConfigurableApplicationContext context = SpringApplication.run(HousevPVapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
}
package com.yeejoin.amos.api.common.restful.utils;
import org.springframework.http.HttpStatus;
public class ResponseHelper
{
public static <T> ResponseModel<T> buildResponse(T t) {
ResponseModel<T> response = new ResponseModel<>();
response.setResult(t);
response.setMessage("ok");
response.setStatus(HttpStatus.OK.value());
return response;
}
}
package com.yeejoin.amos.api.common.restful.utils;
import java.io.Serializable;
/**
*
* <pre>
* 返回封装对象
* </pre>
*
* @author gwb
* @version $Id: CommonResponse.java, v 0.1 2021年9月28日 下午4:37:40 gwb Exp $
*/
public class ResponseModel<T> implements Serializable {
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = 2969089929549147825L;
/**
* 响应数据
*/
private T result ;
/**
* 状态码
*/
private int status;
/**
* 提示信息
*/
private String message = "";
public ResponseModel(){
}
public T getResult()
{
return result;
}
public void setResult(T result)
{
this.result = result;
}
public int getStatus()
{
return status;
}
public void setStatus(int status)
{
this.status = status;
}
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
@Override
public String toString()
{
return "CommonResponse [status=" + status + ", result=" + result + ", message=" + message + "]";
}
}
package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.Hutool;
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.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qiniu.util.Json;
import com.google.common.base.Joiner;
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
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 io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -25,17 +21,17 @@ import org.typroject.tyboot.component.cache.Redis;
import java.util.*;
@Component
@Slf4j
public class HouseholdPvUtils {
private final static String API_REDIS_PREFIX = "HOUSEHOLD_API_CACHE_";
@Autowired
InfluxDbConnection influxDbConnection;
@Autowired
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
@Autowired
private HouseholdPvApiServiceImpl householdPvApiServiceImpl;
@Autowired
InfluxDbConnection influxDbConnection;
private final static String API_REDIS_PREFIX = "HOUSEHOLD_API_CACHE_" +
"";
private TdEngineUtils tdEngineUtils;
/**
* @param code 厂商code
......@@ -116,7 +112,7 @@ public class HouseholdPvUtils {
Thread.sleep(500);
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, params, headMap);
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement(),householdPvApiDto.getProducerId());
} catch (Exception e) {
e.printStackTrace();
} finally {
......@@ -130,7 +126,7 @@ public class HouseholdPvUtils {
}
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement(),householdPvApiDto.getProducerId());
if (ObjectUtil.isNotEmpty(householdPvApiDto.getIsPage())) {
Integer size = getPagesize(householdPvApiDto.getPagesizeResolveRule(), respone);
for (int i = 1; i < size; i++) {
......@@ -144,7 +140,7 @@ public class HouseholdPvUtils {
}
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement(),householdPvApiDto.getProducerId());
}
}
......@@ -188,29 +184,38 @@ public class HouseholdPvUtils {
* @param measurement 要在influxdb中存储的数
* @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
*/
public void handleResponseAndCacheData(String seq, String cacheField, JSONArray jsonArray, String measurement) {
public void handleResponseAndCacheData(String seq, String cacheField, JSONArray jsonArray, String measurement,String produceID) {
String apiID = API_REDIS_PREFIX + seq;
List list = new ArrayList();
List saveList = new ArrayList();
if (jsonArray.size() > 0) {
for (Object o : jsonArray) {
List<Map<String, Object>> lines = new ArrayList<>();
Map<String, Object> maps1 = (Map<String, Object>) o;
LinkedHashMap<String,Object> sortHashMap =new LinkedHashMap<>();
sortHashMap.put("station_list","station_list."+measurement);
sortHashMap.put("timestamp",System.currentTimeMillis());
sortHashMap.put("value",10.1);
Set<String> keys = maps1.keySet();
keys.forEach((key) -> {
maps1.put(key,ObjectUtils.isEmpty(maps1.get(key))?"" :maps1.get(key).toString());
maps1.put(key, ObjectUtils.isEmpty(maps1.get(key)) ? "null" : maps1.get(key).toString());
});
if (!ObjectUtils.isEmpty("cacheField")) {
list.add(maps1.get(cacheField));
}
Map<String, String> maps2 = new HashMap<>();
maps2.put("key", UUID.randomUUID().toString());
sortHashMap.put("tags",maps1);
lines.add(sortHashMap);
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
if (!ObjectUtils.isEmpty(measurement)) {
influxDbConnection.insert(measurement, maps2, maps1);
// influxDbConnection.insert(measurement, maps2, maps1);
log.error(JSONObject.toJSONString(lines));
tdEngineUtils.writeDataIntoTdEngine(JSONObject.toJSONString(lines));
}
}
}
if ( !ObjectUtils.isEmpty(cacheField)) {
// tdEngineUtils.writeDataIntoTdEngine(lines.stream().map(s -> String.valueOf(s)).toArray(String[]::new));
if (!ObjectUtils.isEmpty(cacheField)) {
saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
if (saveList.size() == 0) {
Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
......
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 java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class TDengineTEST {
// format: measurement,tag_set field_set timestamp
private static String[] lines = {
"sofarstationlist,name=屈伟东,regionLevel2=158044,regionLevel3=158144,regionLevel1=156913,contactPhone=null 1648432611249000", // micro
// // seconds
// "meters,location=California.LosAngeles,groupid=2 current=11.8,voltage=221,phase=0.28 1648432611249000", // micro
// // seconds
// "meters,location=California.LosAngeles,groupid=2 current=13.4,voltage=223,phase=0.29 1648432611249500",
// "meters,location=California.LosAngeles,groupid=3 current=10.8,voltage=223,phase=0.29 1648432611249300",
// "meters,location=California.LosAngeles,groupid=3 current=11.3,voltage=221,phase=0.35 1648432611249800",
};
private static Connection getConnection() throws SQLException, ClassNotFoundException {
// Class.forName("com.taosdata.jdbc.TSDBDriver");
String jdbcUrl = "jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata";
return DriverManager.getConnection(jdbcUrl);
}
public static void main(String[] args) throws SQLException, ClassNotFoundException {
try (Connection conn = getConnection()) {
SchemalessWriter writer = new SchemalessWriter(conn);
writer.write(lines, SchemalessProtocolType.LINE, SchemalessTimestampType.MICRO_SECONDS);
}
}
}
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;
public class GoLangConstant {
}
......@@ -43,7 +43,7 @@ public class HouseholdTestController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/gdwdemo")
@ApiOperation(httpMethod = "get", value = "固德威示例", notes = "固德威示例")
@ApiOperation(httpMethod = "POST", value = "固德威示例", notes = "固德威示例")
public String save(Long seq) throws IOException {
return householdPvUtils.gerResponseByAPiID(seq);
}
......
package com.yeejoin.amos.config;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.util.Properties;
/**
* mysql配置类
* @author zhengwen
*/
@Configuration
@MapperScan(basePackages = {"com.yeejoin.amos.boot.module.hygf.api.mapper"}, sqlSessionTemplateRef = "mysqlSqlSessionTemplate")
public class MysqHouselServerConfig {
private static final String MAPPER_LOCATION = "classpath*:mapper/mysql/*.xml";
@Bean(name = "mysqlDataSource")
@ConfigurationProperties(prefix = "spring.datasource.mysql-service")
@Primary
public DataSource mysqlDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "mysqlSqlSessionFactory")
@Primary
public SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSource") DataSource dataSource, GlobalConfig globalConfig) throws Exception {
//注意这里一定要用MybatisSqlSessionFactoryBean,如果用SqlSessionFactory,配置无效
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
//分页插件
Interceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("helperDialect", "mysql");
properties.setProperty("offsetAsPageNum", "true");
properties.setProperty("rowBoundsWithCount", "true");
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params","pageNum=current;pageSize=size" +
"" +
";");
interceptor.setProperties(properties);
bean.setPlugins(new Interceptor[] {interceptor,
paginationInterceptor() });
return bean.getObject();
}
@Bean(name = "mysqlTransactionManager")
@Primary
public DataSourceTransactionManager mysqlTransactionManager(@Qualifier("mysqlDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "mysqlSqlSessionTemplate")
@Primary
public SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
return new SqlSessionTemplate(sqlSessionFactory);
}
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
paginationInterceptor.setDialectType("mysql");
return paginationInterceptor;
}
}
\ No newline at end of file
package com.yeejoin.amos.config;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.util.Properties;
/**
* mysql配置类
* @author zhengwen
*/
@Configuration
@MapperScan(basePackages = {"com.yeejoin.amos.boot.module.hygf.api.mapper"}, sqlSessionTemplateRef = "mysqlSqlSessionTemplate")
public class MysqlServerConfig {
private static final String MAPPER_LOCATION = "classpath*:mapper/mysql/*.xml";
@Bean(name = "mysqlDataSource")
@ConfigurationProperties(prefix = "spring.datasource.mysql-service")
@Primary
public DataSource mysqlDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "mysqlSqlSessionFactory")
@Primary
public SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSource") DataSource dataSource, GlobalConfig globalConfig) throws Exception {
//注意这里一定要用MybatisSqlSessionFactoryBean,如果用SqlSessionFactory,配置无效
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
//分页插件
Interceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("helperDialect", "mysql");
properties.setProperty("offsetAsPageNum", "true");
properties.setProperty("rowBoundsWithCount", "true");
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params","pageNum=current;pageSize=size" +
"" +
";");
interceptor.setProperties(properties);
bean.setPlugins(new Interceptor[] {interceptor,
paginationInterceptor() });
return bean.getObject();
}
@Bean(name = "mysqlTransactionManager")
@Primary
public DataSourceTransactionManager mysqlTransactionManager(@Qualifier("mysqlDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "mysqlSqlSessionTemplate")
@Primary
public SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
return new SqlSessionTemplate(sqlSessionFactory);
}
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
paginationInterceptor.setDialectType("mysql");
return paginationInterceptor;
}
}
\ No newline at end of file
package com.yeejoin.amos.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.util.Properties;
/**
* @description:
* @author: tw
* @createDate: 2023/9/19
*/
@Configuration
@MapperScan(basePackages = "com.xiaotian.datatrans.mapper.tdenginemapper", sqlSessionTemplateRef = "tdengineSqlSessionTemplate")
public class TDengineServerConfig {
private static final String MAPPER_LOCATION = "classpath*:mapper/tdengine/*.xml";
@Bean(name = "tdengineDataSource")
@ConfigurationProperties(prefix = "spring.datasource.tdengine-service")
public DataSource tdengineDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "tdengineSqlSessionFactory")
public SqlSessionFactory tdengineSqlSessionFactory(@Qualifier("tdengineDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
//分页插件
Interceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("helperDialect", "mysql");
properties.setProperty("offsetAsPageNum", "true");
properties.setProperty("rowBoundsWithCount", "true");
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params","pageNum=pageNum;pageSize=pageSize" +
"" +
";");
interceptor.setProperties(properties);
bean.setPlugins(new Interceptor[] {interceptor,paginationInterceptor()});
return bean.getObject();
}
@Bean(name = "tdengineTransactionManager")
public DataSourceTransactionManager tdengineTransactionManager(@Qualifier("tdengineDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "tdengineSqlSessionTemplate")
public SqlSessionTemplate tdengineSqlSessionTemplate(@Qualifier("tdengineSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
return new SqlSessionTemplate(sqlSessionFactory);
}
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
paginationInterceptor.setDialectType("mysql");
return paginationInterceptor;
}
}
\ No newline at end of file
//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()));
// }
//}
spring.application.name=AMOS-API-HOUSEPVAPI
server.servlet.context-path=/housepvapi
server.port=11006
# jdbc_config
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.220:3306/amos_openapi?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
# tdengine ?????
spring.datasource.tdengine-service.driver-class-name=com.taosdata.jdbc.TSDBDriver
spring.datasource.tdengine-service.jdbc-url=jdbc:TAOS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata&timezone=GMT+8
spring.datasource.tdengine-service.username=root
spring.datasource.tdengine-service.password=taosdata
spring.datasource.tdengine-service.type=com.zaxxer.hikari.HikariDataSource
tdengine-server.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
tdengine-server.jdbc-url=jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=%s&password=%s&timezone=GMT+8
tdengine-server.username=root
tdengine-server.password=taosdata
# REDIS (RedisProperties)
spring.redis.database=1
spring.redis.host=172.16.10.220
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.10.220:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
eureka.instance.ip-address=localhost
eureka.instance.instance-id=${eureka.instance.ip-address}:${server.port}
##emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.220:1883
emqx.client-user-name=admin
emqx.client-password=public
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
# influxDB
spring.influx.url=http://139.9.173.44:8086
spring.influx.password=Yeejoin@2020
spring.influx.user=root
spring.influx.database=station_platform
spring.influx.retention_policy=default
spring.influx.retention_policy_time=30d
spring.influx.actions=10000
spring.influx.bufferLimit=20000
\ No newline at end of file
spring.application.name=AMOS-API-ACCESSAPI
server.servlet.context-path=/accessapi
server.port=11005
# jdbc_config
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://172.16.10.213:5432/per_tzs_amos_tzs_biz?currentSchema=per_tzs_amos_data_accessapi
spring.datasource.username=vbadmin
spring.datasource.password=Yeejoin@2023
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
# REDIS (RedisProperties)
spring.redis.database=1
spring.redis.host=172.16.10.210
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.10.210:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
eureka.instance.ip-address=localhost
eureka.instance.instance-id=${eureka.instance.ip-address}:${server.port}
##emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.210:1883
emqx.client-user-name=admin
emqx.client-password=public
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
\ No newline at end of file
spring.application.name=AMOS-API-ACCESSAPI
server.servlet.context-path=/accessapi
server.port=11005
# jdbc_config
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_openapi?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
# REDIS (RedisProperties)
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
##emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
##biz custem properties
biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
\ No newline at end of file
spring.profiles.active=dev
server.compression.enabled=true
spring.jackson.dateFormat=yyyy-MM-dd HH:mm:ss
logging.config=classpath:logback-${spring.profiles.active}.xml
#设置文件上传的大小限制
spring.servlet.multipart.maxFileSize=3MB
spring.servlet.multipart.maxRequestSize=3MB
## redis失效时间
redis.cache.failure.time=10800
# mybatis-plus
mybatis-plus.mapper-locations=classpath:mapper/*Mapper.xml
mybatis-plus.type-aliases-super-type=org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
mybatis-plus.global-config.db-config.id-type=ID_WORKER
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/opt/log/qa" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/tzs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>10mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/opt/log/qa" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/tzs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>10mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="/opt/log/qa" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/accessqa.log.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>20mb</MaxFileSize>
</triggeringPolicy>
</appender>
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis" level="ERROR" />
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.typroject" level="ERROR"/>
<logger name="com.yeejoin" level="ERROR"/>
<logger name="org.springframework" level="INFO"/>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="FILE" />
</root>
</configuration>
\ No newline at end of file
......@@ -20,5 +20,6 @@
<module>amos-boot-data-common</module>
<module>amos-boot-data-openapi</module>
<module>amos-boot-data-accessapi</module>
<module>amos-boot-data-housepvapi</module>
</modules>
</project>
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