Commit 78bbf8cf authored by caotao's avatar caotao

1.数据采集服务架构搭建。

parent 72601f7a
<?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-system-jxiop</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-module-jxiop-das</artifactId>
<version>1.0.0</version>
<name>amos-boot-module-jxiop-das</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-ugp-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-module-common-biz</artifactId>-->
<!-- <version>${amos-biz-boot.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-biz-common</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.yeejoin.amos.boot.module.das;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
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 java.net.InetAddress;
/**
* <pre>
* 智信能源科技服务启动类
* </pre>
*
* @author DELL
*/
@EnableTransactionManagement
@EnableConfigurationProperties
@ServletComponentScan
@EnableAsync
@EnableScheduling
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class})
@MapperScan({"com.yeejoin.amos.boot.module.das.mapper.msyql","com.yeejoin.amos.boot.module.das.mapper.tdengineanalysis","com.yeejoin.amos.boot.module.das.mapper.tdengineiot"})
@ComponentScan({"springfox.documentation.schema", "com.yeejoin.amos.boot.module.das"})
public class AmosJxiopDasApplication {
private static final Logger logger = LoggerFactory.getLogger(AmosJxiopDasApplication.class);
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosJxiopDasApplication.class, args);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path") == null ? "" : env.getProperty("server.servlet.context-path");
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot-Jxiop-Montior is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
}
package com.yeejoin.amos.boot.module.das.config;
import com.alibaba.druid.pool.DruidDataSource;
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.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
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;
/**
* 从数据源配置
* 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可
*/
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.das.tdengineanalysis", sqlSessionFactoryRef = "clusterSqlSessionFactory")
public class ClusterDbConfig {
private Logger logger = LoggerFactory.getLogger(ClusterDbConfig.class);
// 精确到 cluster 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/*.xml";
@Value("${spring.db2.datasource.url}")
private String dbUrl;
@Value("${spring.db2.datasource.username}")
private String username;
@Value("${spring.db2.datasource.password}")
private String password;
@Value("${spring.db2.datasource.driver-class-name}")
private String driverClassName;
@Bean(name = "clusterDataSource2") //声明其为Bean实例
public DataSource clusterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
return datasource;
}
@Bean(name = "clusterTransactionManager")
public DataSourceTransactionManager clusterTransactionManager() {
return new DataSourceTransactionManager(clusterDataSource());
}
@Bean(name = "clusterSqlSessionFactory")
public SqlSessionFactory clusterSqlSessionFactory(@Qualifier("clusterDataSource2") DataSource culsterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(culsterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(ClusterDbConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.das.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
//分页插件
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);
sessionFactory.setPlugins(new Interceptor[] {interceptor,
paginationInterceptor() });
return sessionFactory.getObject();
}
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
paginationInterceptor.setDialectType("mysql");
return paginationInterceptor;
}
}
package com.yeejoin.amos.boot.module.das.config;
import com.alibaba.druid.pool.DruidDataSource;
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.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
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;
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.das.mapper.mysql", sqlSessionFactoryRef = "masterSqlSessionFactory1")
public class MasterDbConfig {
private Logger logger = LoggerFactory.getLogger(MasterDbConfig.class);
// 精确到 master 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/*.xml";
@Value("${spring.db1.datasource.url}")
private String dbUrl;
@Value("${spring.db1.datasource.username}")
private String username;
@Value("${spring.db1.datasource.password}")
private String password;
@Value("${spring.db1.datasource.driver-class-name}")
private String driverClassName;
@Bean(name="masterDataSource") //声明其为Bean实例
@Primary //在同样的DataSource中,首先使用被标注的DataSource
public DataSource masterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
return datasource;
}
@Bean(name = "masterTransactionManager")
@Primary
public DataSourceTransactionManager masterTransactionManager() {
return new DataSourceTransactionManager(masterDataSource());
}
@Bean(name = "masterSqlSessionFactory1")
@Primary
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(masterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(MasterDbConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.das.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
//分页插件
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);
sessionFactory.setPlugins(new Interceptor[] {interceptor});
return sessionFactory.getObject();
}
}
package com.yeejoin.amos.boot.module.das.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
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.sql.SQLException;
/**
* 从数据源配置
* 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可
*/
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.das.mapper.tdengineanalysis", sqlSessionFactoryRef = "taosSqlSessionFactory")
public class TdEngineConfig {
private Logger logger = LoggerFactory.getLogger(TdEngineConfig.class);
// 精确到 cluster 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/*.xml";
@Value("${spring.db3.datasource.url}")
private String dbUrl;
@Value("${spring.db3.datasource.username}")
private String username;
@Value("${spring.db3.datasource.password}")
private String password;
@Value("${spring.db3.datasource.driver-class-name}")
private String driverClassName;
@Bean(name = "taosDataSource") //声明其为Bean实例
public DataSource clusterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
datasource.setInitialSize(100); // 初始连接数
datasource.setMaxActive(200); // 最大连接数
datasource.setMaxWait(60000); // 最大等待时间
datasource.setMinIdle(5); // 最小空闲连接数
datasource.setValidationQuery("SELECT 1"); // 验证查询
try {
datasource.setFilters("stat");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
datasource.setQueryTimeout(30); // 查询超时时间
datasource.setConnectionProperties("useUnicode=true;characterEncoding=UTF-8"); // 连接属性
return datasource;
}
@Bean(name = "taosTransactionManager")
public DataSourceTransactionManager clusterTransactionManager() {
return new DataSourceTransactionManager(clusterDataSource());
}
@Bean(name = "taosSqlSessionFactory")
public SqlSessionFactory clusterSqlSessionFactory(@Qualifier("taosDataSource") DataSource culsterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(culsterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.das.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
return sessionFactory.getObject();
}
}
package com.yeejoin.amos.boot.module.das.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.io.Serializable;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-10-24
*/
@Data
@Accessors(chain = true)
@TableName("iot_front_gateway_device_points")
public class FrontGatewayDevicePoints implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "SEQUENCE_NBR" , type = IdType.ID_WORKER)
protected Long sequenceNbr;
@TableField("REC_DATE" )
protected Date recDate;
@TableField("REC_USER_ID" )
protected String recUserId;
/**
* 测点名称
*/
@TableField("POINT_NAME")
private String pointName;
/**
* 测点类型(装置测点,合成测点)
*/
@TableField("POINT_TYPE")
private String pointType;
/**
* 测点值数据类型(遥测,遥信,遥脉)
*/
@TableField("POINT_DATA_TYPE")
private String pointDataType;
/**
* 测点描述
*/
@TableField("POINT_DESC")
private String pointDesc;
/**
* 公式
*/
@TableField("POINT_FORMULA")
private String pointFormula;
/**
* 地址
*/
@TableField("POINT_ADDRESS")
private String pointAddress;
/**
* 网关设备ID
*/
@TableField("POINT_DEVICE_ID")
private Long pointDeviceId;
/**
* 测点位置
*/
@TableField("POINT_LOCATION")
private String pointLocation;
@TableField ("POINT_LOCATION_CODE")
private String pointLocationCode;
/**
* 关联设备ID,多个用逗号隔开
*/
@TableField("DEVICE_ID")
private String deviceId;
@TableField(exist=false)
private String deviceName;
/**
* 网关ID
*/
@TableField("GATEWAY_ID")
private Long gatewayId;
@TableField("POINT_RESOURCE_ID")
private Long pointResourceId;
@TableField ("GROUP_ID")
private Long groupId;
/**
* 数据类型遥信等对应的枚举
*/
@TableField ("DATA_TYPE")
private String dataType;
/**
* 采样周期
*/
@TableField("SAMPLING_PERIOD")
private String samplingPeriod;
}
package com.yeejoin.amos.boot.module.das.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author caotao
* @Description: 指标数据表
* @date 2023/09/14 14:30
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IndicatorData {
private String address;
private String gatewayId;
private String equipmentsIdx;
private String dataType;
private String isAlarm;
private String equipmentSpecificName;
private String equipmentIndexName;
private String valueLabel;
private String value;
private float valueF;
private String unit;
private String signalType;
private Date createdTime;
}
package com.yeejoin.amos.boot.module.das.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.A;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StbDtoData {
private String value;
private String pointSeq;
}
package com.yeejoin.amos.boot.module.das.mapper.msyql;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.das.entity.FrontGatewayDevicePoints;
public interface FrontGatewayDevicePointsMapper extends BaseMapper<FrontGatewayDevicePoints> {
}
package com.yeejoin.amos.boot.module.das.mapper.tdengineanalysis;
import com.yeejoin.amos.boot.module.das.entity.IndicatorData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Mapper
public interface IndicatorDataMapper {
int insertBatch(@Param("list") List<IndicatorData> indicatorDataList, @Param("gatewayId")String gatewayId);
void createDB();
void createTable();
}
package com.yeejoin.amos.boot.module.das.mapper.tdengineiot;
import com.yeejoin.amos.boot.module.das.entity.StbDtoData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import java.util.List;
@Mapper
public interface TdengineIotDataMapper {
@Select(" select last(`value`) as `value` ,point_seq from iot_data_data.stb_#{gateWayId} group by point_seq")
List<StbDtoData> getStbDtoDataByStbName(String gateWayId);
}
## db1 - amos-iot-data-view
spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db1.datasource.url=jdbc:mysql://10.20.1.157:3306/amos-iot-data-view?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.username=root
spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
## db2 - analysis_data
spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db2.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db2.datasource.username=root
spring.db2.datasource.password=taosdata
spring.db2.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
#spring.db3 iot-data
spring.db3.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/iot_data_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
## eureka properties:
eureka.instance.hostname=10.20.1.160
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
## redis properties:
spring.redis.database=1
spring.redis.host=10.20.1.210
spring.redis.port=6379
spring.redis.password=yeejoin@2020
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://10.20.1.210:2883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://10.20.1.210:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
emqx.max-inflight=1000
knife4j.production=false
knife4j.enable=true
knife4j.basic.enable=true
knife4j.basic.username=admin
knife4j.basic.password=a1234560
management.security.enabled=true
spring.security.user.name=admin
spring.security.user.password=a1234560
spring.application.name=AMOS-JXIOP-DAS
server.servlet.context-path=/jxiop-das
server.port=33500
server.uri-encoding=UTF-8
spring.profiles.active=dev
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
logging.config=classpath:logback-${spring.profiles.active}.xml
## mybatis-plus配置控制台打印完整带参数SQL语句
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
### DB properties:
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.type=com.zaxxer.hikari.HikariDataSource
#spring.datasource.hikari.minimum-idle=10
#spring.datasource.hikari.maximum-pool-size=25
#spring.datasource.hikari.auto-commit=true
#spring.datasource.hikari.idle-timeout=30000
#spring.datasource.hikari.pool-name=DatebookHikariCP
#spring.datasource.hikari.max-lifetime=120000
#spring.datasource.hikari.connection-timeout=30000
#spring.datasource.hikari.connection-test-query=SELECT 1
#JPA Configuration:
spring.jpa.show-sql=false
spring.jpa.open-in-view=true
#spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
##liquibase
spring.liquibase.change-log=classpath:/db/changelog/changelog-master.xml
spring.liquibase.enabled=false
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<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.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ccs.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>${LOG_PATTERN}</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>30mb</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.das.mapper.tdengineanalysis.IndicatorDataMapper">
<!--创建数据库,指定压缩比-->
<update id="createDB">
create database if not exists iot_data vgroups 10 buffer 10 COMP 2 PRECISION 'ns';
</update>
<!--创建超级表-->
<update id="createTable">
create STABLE if not exists s_indicator_his
(created_time timestamp,
address binary(64),
equipments_idx NCHAR(64),
data_type NCHAR(12),
is_alarm BIGINT,
equipment_index_name VARCHAR(200) ,
equipment_specific_name VARCHAR(200),
`value` VARCHAR(12),
`value_f` float,
value_label VARCHAR(24),
unit NCHAR(12))
TAGS (gateway_id binary(64));
</update>
<insert id="insertBatch" parameterType="java.util.List">
insert into
<foreach separator=" " collection="list" item="item" index="index">
indicator_his_#{gatewayId,jdbcType=VARCHAR} USING s_indicator_his
TAGS (#{item.gatewayId,jdbcType=VARCHAR})
VALUES (NOW + #{index}a,
#{item.address,jdbcType=VARCHAR},
#{item.equipmentsIdx,jdbcType=VARCHAR},
#{item.dataType,jdbcType=VARCHAR},
#{item.isAlarm,jdbcType=VARCHAR},
#{item.equipmentSpecificName,jdbcType=VARCHAR},
#{item.equipmentIndexName,jdbcType=VARCHAR},
#{item.value,jdbcType=VARCHAR},
#{item.valueF,jdbcType=FLOAT},
#{item.valueLabel,jdbcType=VARCHAR},
#{item.unit,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -19,6 +19,7 @@
<module>amos-boot-module-jxiop-bigscreen-biz</module>
<module>amos-boot-module-jxiop-analyse-biz</module>
<module>amos-boot-module-jxiop-warn-biz</module>
<module>amos-boot-module-jxiop-das</module>
</modules>
<dependencies>
......
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