Browse Source

2023-11-30 升级动态数据源加载,删除冲突配置,配置文件修改,依赖更新,统计参数自动录入单据生成

develop
zhousq 12 months ago
parent
commit
d8ae512ef0
  1. 3
      lzbi-admin/src/main/java/com/lzbi/RuoYiApplication.java
  2. 140
      lzbi-admin/src/main/resources/application-dev.yml
  3. 2
      lzbi-admin/src/main/resources/application-test.yml
  4. 15
      lzbi-admin/src/main/resources/application.yml
  5. 11
      lzbi-common/pom.xml
  6. 6
      lzbi-framework/src/main/java/com/lzbi/framework/aspectj/DataSourceAspect.java
  7. 230
      lzbi-framework/src/main/java/com/lzbi/framework/config/DruidConfig.java
  8. 78
      lzbi-framework/src/main/java/com/lzbi/framework/config/properties/DruidProperties.java
  9. 14
      lzbi-module/pom.xml
  10. 70
      lzbi-module/src/main/java/com/lzbi/asset/controller/DcBusiWorkReadConfigController.java
  11. 2
      lzbi-module/src/main/java/com/lzbi/asset/domain/DcBusiWorkReadConfig.java
  12. 54
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillSubDao.java
  13. 1
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiParamBillMasterService.java
  14. 7
      lzbi-module/src/main/java/com/lzbi/task/domain/EumValueReadType.java
  15. 27
      lzbi-module/src/main/java/com/lzbi/task/domain/WorkReadVo.java
  16. 16
      lzbi-module/src/main/resources/mapper/asset/DcBusiParamBillMasterMapper.xml
  17. 11
      lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadConfigMapper.xml
  18. 8
      lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml

3
lzbi-admin/src/main/java/com/lzbi/RuoYiApplication.java

@ -1,5 +1,6 @@
package com.lzbi; package com.lzbi;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -11,7 +12,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* @author ruoyi * @author ruoyi
*/ */
@EnableKnife4j @EnableKnife4j
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class })
public class RuoYiApplication public class RuoYiApplication
{ {
public static void main(String[] args) public static void main(String[] args)

140
lzbi-admin/src/main/resources/application-dev.yml

@ -27,76 +27,78 @@ spring:
# #连接池最大阻塞等待时间(使用负值表示没有限制) # #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms max-wait: -1ms
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource dynamic:
driverClassName: com.mysql.cj.jdbc.Driver strict: true
druid: druid:
# 主库数据源 # 初始连接数
master: initialSize: 5
url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # 最小连接池数量
username: luenmei minIdle: 10
password: 123456 # 最大连接池数量
# 计费数据库 maxActive: 20
charge: # 配置获取连接等待超时的时间
url: jdbc:oracle:thin:@//10.10.10.60:1521/HX?CONNECT_TIMEOUT=10000&Read_Timeout=120000 maxWait: 60000
username: lmjt_sys # 配置连接超时时间
password: lmjt_sys connectTimeout: 30000
# 计费数据库 # 配置网络超时时间
workDB: socketTimeout: 60000
driverClassName: org.postgresql.Driver # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
type: com.alibaba.druid.pool.DruidDataSource timeBetweenEvictionRunsMillis: 60000
url: jdbc:postgresql://10.10.10.56:5432/dctestdb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai # 配置一个连接在池中最小生存的时间,单位是毫秒
username: postgres minEvictableIdleTimeMillis: 300000
password: 123456 # 配置一个连接在池中最大生存的时间,单位是毫秒
# 从库数据源 maxEvictableIdleTimeMillis: 900000
slave: # 配置检测连接是否有效
# 从数据源开关/默认关闭 validationQuery: SELECT 1
enabled: false testWhileIdle: true
url: testOnBorrow: false
username: testOnReturn: false
password: webStatFilter:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true enabled: true
# 慢SQL记录 statViewServlet:
log-slow-sql: true enabled: true
slow-sql-millis: 1000 # 设置白名单,不填则允许所有访问
merge-sql: true allow:
wall: url-pattern: /druid/*
config: # 控制台管理用户名和密码
multi-statement-allow: true login-username: luenmeilz
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
datasource:
# 主库数据源
master:
url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: luenmei
password: 123456
# # 计费数据库
# charge:
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//10.10.10.60:1521/HX?CONNECT_TIMEOUT=10000&Read_Timeout=120000
# username: lmjt_sys
# password: lmjt_sys
# 从库数据源
slave:
# 从数据源开关/默认关闭
url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: luenmei
password: 123456
workDB:
driverClassName: org.postgresql.Driver
#type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:postgresql://10.10.10.56:5432/dctestdb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: postgres
password: 123456
primary: master
# 日志配置 # 日志配置
logging: logging:
file: file:

2
lzbi-admin/src/main/resources/application-test.yml

@ -73,7 +73,7 @@ spring:
allow: allow:
url-pattern: /druid/* url-pattern: /druid/*
# 控制台管理用户名和密码 # 控制台管理用户名和密码
login-username: ruoyi login-username: luenmeilz
login-password: 123456 login-password: 123456
filter: filter:
stat: stat:

15
lzbi-admin/src/main/resources/application.yml

@ -1,17 +1,17 @@
# 项目相关配置 # 项目相关配置
luenmeilz: luenmeilz:
# 名称 # 名称
name: RuoYi name: luenmeilz
# 版本 # 版本
version: 3.8.6 version: 1.0.1
# 版权年份 # 版权年份
copyrightYear: 2023 copyrightYear: 2023
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: false
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile: D:/ruoyi/uploadPath profile: D:/ruoyi/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: true
# 验证码类型 math 数字计算 char 字符验证 # 验证码类型 math 数字计算 char 字符验证
captchaType: math captchaType: math
# 高德天气服务ip地址 # 高德天气服务ip地址
@ -41,12 +41,9 @@ server:
accept-count: 1000 accept-count: 1000
threads: threads:
# tomcat最大线程数,默认为200 # tomcat最大线程数,默认为200
max: 800 max: 1000
# Tomcat启动初始化的线程数,默认值10 # Tomcat启动初始化的线程数,默认值10
min-spare: 100 min-spare: 100
# 用户配置 # 用户配置
user: user:
password: password:
@ -83,7 +80,7 @@ token:
# 令牌密钥 # 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期(默认30分钟) # 令牌有效期(默认30分钟)
expireTime: 30 expireTime: 1440
# MyBatis Plus配置 # MyBatis Plus配置
mybatis-plus: mybatis-plus:

11
lzbi-common/pom.xml

@ -60,11 +60,11 @@
</dependency> </dependency>
<!-- &lt;!&ndash; 动态数据源 &ndash;&gt;--> <!-- &lt;!&ndash; 动态数据源 &ndash;&gt;-->
<!-- <dependency>--> <dependency>
<!-- <groupId>com.baomidou</groupId>--> <groupId>com.baomidou</groupId>
<!-- <artifactId>dynamic-datasource-spring-boot-starter</artifactId>--> <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<!-- <version>3.5.2</version>--> <version>3.5.2</version>
<!-- </dependency>--> </dependency>
<!-- 阿里JSON解析器 --> <!-- 阿里JSON解析器 -->
<dependency> <dependency>
@ -141,7 +141,6 @@
<groupId>com.oracle</groupId> <groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId> <artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version> <version>10.2.0.3.0</version>
<type>pom</type>
</dependency> </dependency>
<!-- --> <!-- -->
<dependency> <dependency>

6
lzbi-framework/src/main/java/com/lzbi/framework/aspectj/DataSourceAspect.java

@ -20,9 +20,9 @@ import com.lzbi.framework.datasource.DynamicDataSourceContextHolder;
* *
* @author ruoyi * @author ruoyi
*/ */
@Aspect //@Aspect
@Order(1) //@Order(1)
@Component //@Component
public class DataSourceAspect public class DataSourceAspect
{ {
protected Logger logger = LoggerFactory.getLogger(getClass()); protected Logger logger = LoggerFactory.getLogger(getClass());

230
lzbi-framework/src/main/java/com/lzbi/framework/config/DruidConfig.java

@ -1,126 +1,126 @@
package com.lzbi.framework.config; package com.lzbi.framework.config;
import java.io.IOException; //import java.io.IOException;
import java.util.HashMap; //import java.util.HashMap;
import java.util.Map; //import java.util.Map;
import javax.servlet.Filter; //import javax.servlet.Filter;
import javax.servlet.FilterChain; //import javax.servlet.FilterChain;
import javax.servlet.ServletException; //import javax.servlet.ServletException;
import javax.servlet.ServletRequest; //import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; //import javax.servlet.ServletResponse;
import javax.sql.DataSource; //import javax.sql.DataSource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; //import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties; //import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean; //import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; //import org.springframework.context.annotation.Primary;
import com.alibaba.druid.pool.DruidDataSource; //import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; //import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties; //import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
import com.alibaba.druid.util.Utils; //import com.alibaba.druid.util.Utils;
import com.lzbi.common.enums.DataSourceType; //import com.lzbi.common.enums.DataSourceType;
import com.lzbi.common.utils.spring.SpringUtils; //import com.lzbi.common.utils.spring.SpringUtils;
import com.lzbi.framework.config.properties.DruidProperties; //import com.lzbi.framework.config.properties.DruidProperties;
import com.lzbi.framework.datasource.DynamicDataSource; //import com.lzbi.framework.datasource.DynamicDataSource;
/** /**
* druid 配置多数据源 * druid 配置多数据源
* *
* @author ruoyi * @author ruoyi
*/ */
@Configuration //@Configuration
public class DruidConfig public class DruidConfig
{ {
@Bean // @Bean
@ConfigurationProperties("spring.datasource.druid.master") // @ConfigurationProperties("spring.datasource.druid.master")
public DataSource masterDataSource(DruidProperties druidProperties) // public DataSource masterDataSource(DruidProperties druidProperties)
{ // {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); // DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource); // return druidProperties.dataSource(dataSource);
} // }
//
@Bean // @Bean
@ConfigurationProperties("spring.datasource.druid.slave") // @ConfigurationProperties("spring.datasource.druid.slave")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") // @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
public DataSource slaveDataSource(DruidProperties druidProperties) // public DataSource slaveDataSource(DruidProperties druidProperties)
{ // {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); // DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource); // return druidProperties.dataSource(dataSource);
} // }
//
@Bean(name = "dynamicDataSource") // @Bean(name = "dynamicDataSource")
@Primary // @Primary
public DynamicDataSource dataSource(DataSource masterDataSource) // public DynamicDataSource dataSource(DataSource masterDataSource)
{ // {
Map<Object, Object> targetDataSources = new HashMap<>(); // Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); // targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); // setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
return new DynamicDataSource(masterDataSource, targetDataSources); // return new DynamicDataSource(masterDataSource, targetDataSources);
} // }
//
/** // /**
* 设置数据源 // * 设置数据源
* // *
* @param targetDataSources 备选数据源集合 // * @param targetDataSources 备选数据源集合
* @param sourceName 数据源名称 // * @param sourceName 数据源名称
* @param beanName bean名称 // * @param beanName bean名称
*/ // */
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName) // public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
{ // {
try // try
{ // {
DataSource dataSource = SpringUtils.getBean(beanName); // DataSource dataSource = SpringUtils.getBean(beanName);
targetDataSources.put(sourceName, dataSource); // targetDataSources.put(sourceName, dataSource);
} // }
catch (Exception e) // catch (Exception e)
{ // {
} // }
} // }
//
/** // /**
* 去除监控页面底部的广告 // * 去除监控页面底部的广告
*/ // */
@SuppressWarnings({ "rawtypes", "unchecked" }) // @SuppressWarnings({ "rawtypes", "unchecked" })
@Bean // @Bean
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true") // @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) // public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
{ // {
// 获取web监控页面的参数 // // 获取web监控页面的参数
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); // DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
// 提取common.js的配置路径 // // 提取common.js的配置路径
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"; // String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js"); // String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
final String filePath = "support/http/resources/js/common.js"; // final String filePath = "support/http/resources/js/common.js";
// 创建filter进行过滤 // // 创建filter进行过滤
Filter filter = new Filter() // Filter filter = new Filter()
{ // {
@Override // @Override
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException // public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
{ // {
} // }
@Override // @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) // public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException // throws IOException, ServletException
{ // {
chain.doFilter(request, response); // chain.doFilter(request, response);
// 重置缓冲区,响应头不会被重置 // // 重置缓冲区,响应头不会被重置
response.resetBuffer(); // response.resetBuffer();
// 获取common.js // // 获取common.js
String text = Utils.readFromResource(filePath); // String text = Utils.readFromResource(filePath);
// 正则替换banner, 除去底部的广告信息 // // 正则替换banner, 除去底部的广告信息
text = text.replaceAll("<a.*?banner\"></a><br/>", ""); // text = text.replaceAll("<a.*?banner\"></a><br/>", "");
text = text.replaceAll("powered.*?shrek.wang</a>", ""); // text = text.replaceAll("powered.*?shrek.wang</a>", "");
response.getWriter().write(text); // response.getWriter().write(text);
} // }
@Override // @Override
public void destroy() // public void destroy()
{ // {
} // }
}; // };
FilterRegistrationBean registrationBean = new FilterRegistrationBean(); // FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(filter); // registrationBean.setFilter(filter);
registrationBean.addUrlPatterns(commonJsPattern); // registrationBean.addUrlPatterns(commonJsPattern);
return registrationBean; // return registrationBean;
} // }
} }

78
lzbi-framework/src/main/java/com/lzbi/framework/config/properties/DruidProperties.java

@ -1,15 +1,15 @@
package com.lzbi.framework.config.properties; package com.lzbi.framework.config.properties;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import com.alibaba.druid.pool.DruidDataSource; //import com.alibaba.druid.pool.DruidDataSource;
/** /**
* druid 配置属性 * druid 配置属性
* *
* @author ruoyi * @author ruoyi
*/ */
@Configuration //@Configuration
public class DruidProperties public class DruidProperties
{ {
@Value("${spring.datasource.druid.initialSize}") @Value("${spring.datasource.druid.initialSize}")
@ -50,40 +50,40 @@ public class DruidProperties
@Value("${spring.datasource.druid.testOnReturn}") @Value("${spring.datasource.druid.testOnReturn}")
private boolean testOnReturn; private boolean testOnReturn;
//
public DruidDataSource dataSource(DruidDataSource datasource) // public DruidDataSource dataSource(DruidDataSource datasource)
{ // {
/** 配置初始化大小、最小、最大 */ // /** 配置初始化大小、最小、最大 */
datasource.setInitialSize(initialSize); // datasource.setInitialSize(initialSize);
datasource.setMaxActive(maxActive); // datasource.setMaxActive(maxActive);
datasource.setMinIdle(minIdle); // datasource.setMinIdle(minIdle);
//
/** 配置获取连接等待超时的时间 */ // /** 配置获取连接等待超时的时间 */
datasource.setMaxWait(maxWait); // datasource.setMaxWait(maxWait);
//
/** 配置驱动连接超时时间,检测数据库建立连接的超时时间,单位是毫秒 */ // /** 配置驱动连接超时时间,检测数据库建立连接的超时时间,单位是毫秒 */
datasource.setConnectTimeout(connectTimeout); // datasource.setConnectTimeout(connectTimeout);
//
/** 配置网络超时时间,等待数据库操作完成的网络超时时间,单位是毫秒 */ // /** 配置网络超时时间,等待数据库操作完成的网络超时时间,单位是毫秒 */
datasource.setSocketTimeout(socketTimeout); // datasource.setSocketTimeout(socketTimeout);
//
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ // /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); // datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
//
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ // /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); // datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); // datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
//
/** // /**
* 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'如果validationQuery为nulltestOnBorrowtestOnReturntestWhileIdle都不会起作用 // * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
*/ // */
datasource.setValidationQuery(validationQuery); // datasource.setValidationQuery(validationQuery);
/** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ // /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */
datasource.setTestWhileIdle(testWhileIdle); // datasource.setTestWhileIdle(testWhileIdle);
/** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ // /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */
datasource.setTestOnBorrow(testOnBorrow); // datasource.setTestOnBorrow(testOnBorrow);
/** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ // /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */
datasource.setTestOnReturn(testOnReturn); // datasource.setTestOnReturn(testOnReturn);
return datasource; // return datasource;
} // }
} }

14
lzbi-module/pom.xml

@ -42,15 +42,11 @@
</dependency> </dependency>
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <!-- <dependency>-->
<groupId>mysql</groupId> <!-- <groupId>mysql</groupId>-->
<artifactId>mysql-connector-java</artifactId> <!-- <artifactId>mysql-connector-java</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.6.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

70
lzbi-module/src/main/java/com/lzbi/asset/controller/DcBusiWorkReadConfigController.java

@ -1,14 +1,24 @@
package com.lzbi.asset.controller; package com.lzbi.asset.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lzbi.code.domain.DcBaseCoderuleDefineDao;
import com.lzbi.code.domain.DcBusiCoderuleConfigDao;
import com.lzbi.code.service.CodeNoGenerater; import com.lzbi.code.service.CodeNoGenerater;
import com.lzbi.code.service.DcBaseCoderuleDefineService;
import com.lzbi.common.annotation.Log; import com.lzbi.common.annotation.Log;
import com.lzbi.common.core.controller.BaseController; import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult; import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.core.page.TableDataInfo; import com.lzbi.common.core.page.TableDataInfo;
import com.lzbi.common.enums.BusinessType; import com.lzbi.common.enums.BusinessType;
import com.lzbi.common.utils.DateUtils; import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.common.utils.poi.ExcelUtil; import com.lzbi.common.utils.poi.ExcelUtil;
import com.lzbi.draft.domain.DcBusiParamBillMasterDao;
import com.lzbi.draft.domain.DcBusiParamBillSubDao;
import com.lzbi.draft.service.DcBusiParamBillMasterService;
import com.lzbi.task.domain.ReadQueryParams;
import com.lzbi.task.domain.WorkReadVo;
import com.lzbi.task.service.WorkParamReadService; import com.lzbi.task.service.WorkParamReadService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -16,9 +26,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List; import java.awt.geom.Arc2D;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.lzbi.asset.domain.DcBusiWorkReadConfig; import com.lzbi.asset.domain.DcBusiWorkReadConfig;
import com.lzbi.asset.service.DcBusiWorkReadConfigService; import com.lzbi.asset.service.DcBusiWorkReadConfigService;
@ -135,8 +148,59 @@ public class DcBusiWorkReadConfigController extends BaseController{
WorkParamReadService workParamReadService; WorkParamReadService workParamReadService;
@Autowired @Autowired
CodeNoGenerater codeNoGenerater; CodeNoGenerater codeNoGenerater;
@Autowired
DcBusiParamBillMasterService dcBusiParamBillMasterService;
@Autowired
DcBaseCoderuleDefineService dcBaseCoderuleDefineService;
@GetMapping("/getWork") @GetMapping("/getWork")
public AjaxResult getWorkParamValue(){ public AjaxResult getWorkParamValue(){
return success(); String inComeDate="2023-11-29";
DcBusiCoderuleConfigDao ruleIdByBusicode = dcBaseCoderuleDefineService.getRuleIdByBusicode("param_bill_adjust");
DcBaseCoderuleDefineDao ruleDao = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoById(ruleIdByBusicode.getRuleId());
DcBusiParamBillMasterDao billm=new DcBusiParamBillMasterDao();
String billNo=codeNoGenerater.getCode(ruleDao);
if(StringUtils.isNull(billNo)){
billNo= "AD_"+String.valueOf(System.currentTimeMillis());
}
billm.setBillNo(billNo);
billm.setCreatedBy("robot");
billm.setCreatedTime(DateUtil.date());
billm.setBillIncomeDate(inComeDate);
billm.setBillType("auto");
billm.setCheckType("1");
billm.setCheckStatus("0");
List<DcBusiParamBillSubDao> billSub=new ArrayList<>();
ReadQueryParams readQueryParams=new ReadQueryParams();
readQueryParams.setBeginTime(inComeDate+" 00:00:00");
readQueryParams.setEndTime(inComeDate+" 23:59:59");
DcBusiWorkReadConfig dwrc=new DcBusiWorkReadConfig();
dwrc.setAssetCode("SP00001");
dwrc.setGoalSource("work");
List<DcBusiWorkReadConfig> dcBusiWorkReadConfigs = dcBusiWorkReadConfigService.selectByVo(dwrc);
List<String> pcl=dcBusiWorkReadConfigs.parallelStream().map(DcBusiWorkReadConfig::getGoalParamCode).collect(Collectors.toList());
List<String> dcl=dcBusiWorkReadConfigs.parallelStream().map(DcBusiWorkReadConfig::getGoalParamExt1).collect(Collectors.toList());
readQueryParams.setParamCodes(pcl);
readQueryParams.setDeviceCodes(dcl);
List<WorkReadVo> workReadVos = workParamReadService.readWorkValue(readQueryParams);
final String billNo_c=billNo;
workReadVos.parallelStream().forEach(item->{
Optional<DcBusiWorkReadConfig> find = dcBusiWorkReadConfigs.parallelStream().filter(info -> info.getGoalParamCode().equals(item.getParamCode()) && info.getGoalParamExt1().equals(item.getDeviceCode())).findFirst();
if(find.isPresent()){
DcBusiParamBillSubDao subDao=new DcBusiParamBillSubDao();
subDao.setCreatedBy("robot");
subDao.setAssetCode(find.get().getAssetCode());
subDao.setBillNo(billNo_c);
Double va=item.getValueByType(find.get().getGoalParamType());
subDao.setParamValue(va);
subDao.setParamCode(find.get().getAssetParamCode());
subDao.setFieldType(find.get().getAssetFieldCode());
subDao.setCounDate(item.getDateCount());
billSub.add(subDao);
}
});
billm.setDcBusiParamBillSubDaoList(billSub);
//dcBusiParamBillMasterService.insertDcBusiParamBillMasterDao(billm);
//dcBusiParamBillMasterService.saveBatch()
return success(dcBusiParamBillMasterService.insertDcBusiParamBillMasterDao(billm));
} }
} }

2
lzbi-module/src/main/java/com/lzbi/asset/domain/DcBusiWorkReadConfig.java

@ -48,5 +48,7 @@ public class DcBusiWorkReadConfig extends BaseModuleEntity{
/** 数据来源;生产IOT:work;计费:charge;Erp:erp */ /** 数据来源;生产IOT:work;计费:charge;Erp:erp */
@ApiModelProperty(name = "数据来源",notes = "生产IOT:work;计费:charge;Erp:erp") @ApiModelProperty(name = "数据来源",notes = "生产IOT:work;计费:charge;Erp:erp")
private String goalSource ; private String goalSource ;
@ApiModelProperty(name = "所属专业")
private String assetFieldCode ;
} }

54
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillSubDao.java

@ -19,70 +19,20 @@ import com.lzbi.module.base.BaseModuleEntity;
public class DcBusiParamBillSubDao extends BaseModuleEntity public class DcBusiParamBillSubDao extends BaseModuleEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 租户号 */
private String tenantId;
/** 乐观锁 */
private Long REVISION;
/** 创建人 */
private String createdBy;
/** 创建时间 */
private Date createdTime;
/** 更新人 */
private String updatedBy;
/** 更新时间 */
private Date updatedTime;
/** 删除人 */
private String deleteBy;
/** 删除时间 */
private Date deleteTime;
/** 主键 */ /** 主键 */
private Long id; private Long id;
private String counDate;
/** 单据编码 */ /** 单据编码 */
@Excel(name = "单据编码") @Excel(name = "单据编码")
private String billNo; private String billNo;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyName;
/** 公司编码 */
@Excel(name = "公司编码")
private String companyCode;
/** 组织机构代码 */
@Excel(name = "组织机构代码")
private String orgCode;
/** 组织机构名称 */
@Excel(name = "组织机构名称")
private String orgName;
/** 统计单元编码 */ /** 统计单元编码 */
@Excel(name = "统计单元编码") @Excel(name = "统计单元编码")
private String assetCode; private String assetCode;
/** 统计单元名称 */
@Excel(name = "统计单元名称")
private String assetName;
/** 所属专业 */ /** 所属专业 */
@Excel(name = "所属专业") @Excel(name = "所属专业")
private String fieldType; private String fieldType;
/** 指标名称 */
@Excel(name = "指标名称")
private String paramName;
/** 指标编码 */ /** 指标编码 */
@Excel(name = "指标编码") @Excel(name = "指标编码")
private String paramCode; private String paramCode;
@ -93,6 +43,6 @@ public class DcBusiParamBillSubDao extends BaseModuleEntity
/** 参数值 */ /** 参数值 */
@Excel(name = "参数值") @Excel(name = "参数值")
private BigDecimal paramValue; private Double paramValue;
} }

1
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiParamBillMasterService.java

@ -56,6 +56,7 @@ public class DcBusiParamBillMasterService extends ServiceImpl<DcBusiParamBillMas
{ {
dcBusiParamBillMasterDao.setCreatedTime(DateUtils.getNowDate()); dcBusiParamBillMasterDao.setCreatedTime(DateUtils.getNowDate());
int rows = baseMapper.insertDcBusiParamBillMasterDao(dcBusiParamBillMasterDao); int rows = baseMapper.insertDcBusiParamBillMasterDao(dcBusiParamBillMasterDao);
insertDcBusiParamBillSubDao(dcBusiParamBillMasterDao); insertDcBusiParamBillSubDao(dcBusiParamBillMasterDao);
return rows; return rows;
} }

7
lzbi-module/src/main/java/com/lzbi/task/domain/EumValueReadType.java

@ -25,11 +25,14 @@ public enum EumValueReadType
/** /**
* 开始时间点值 * 开始时间点值
*/ */
PVBEGIN("pvbegin"), PVBEGIN("pvb"),
/** /**
* 结束时间点值 * 结束时间点值
*/ */
PVEND("pvend"), PVEND("pve"),
MAXV("max"),
MINV("min"),
; ;
private final String type; private final String type;
EumValueReadType(String type){ EumValueReadType(String type){

27
lzbi-module/src/main/java/com/lzbi/task/domain/WorkReadVo.java

@ -15,7 +15,7 @@ import java.util.Optional;
* WorkReadVo * WorkReadVo
* 从生产数据库读取的参数统计值 * 从生产数据库读取的参数统计值
*/ */
@Data
public class WorkReadVo { public class WorkReadVo {
/***/ /***/
@ApiModelProperty("参数编码") @ApiModelProperty("参数编码")
@ -140,4 +140,29 @@ public class WorkReadVo {
public Integer getHourCount() { public Integer getHourCount() {
return DateUtil.hour(this.thour, true); return DateUtil.hour(this.thour, true);
} }
public Double getValueByType(String type){
if(type.equals(EumValueReadType.AVG.toString())){
return getAvgAll();
}
if(type.equals(EumValueReadType.SUM.toString())){
return getTotal();
}
if(type.equals(EumValueReadType.AVGNOZERO.toString())){
return getAvgNoZero();
}
if(type.equals(EumValueReadType.PVBEGIN.toString())){
return getFirstVal();
}
if(type.equals(EumValueReadType.PVEND.toString())){
return getLastVal();
}
if(type.equals(EumValueReadType.MAXV.toString())){
return getMaxVal();
}
if(type.equals(EumValueReadType.MINV.toString())){
return getMinVal();
}
return 0.00;
}
} }

16
lzbi-module/src/main/resources/mapper/asset/DcBusiParamBillMasterMapper.xml

@ -27,7 +27,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="DcBusiParamBillSubDao" id="DcBusiParamBillSubDaoResult"> <resultMap type="DcBusiParamBillSubDao" id="DcBusiParamBillSubDaoResult">
<result property="tenantId" column="sub_TENANT_ID" /> <result property="tenantId" column="sub_TENANT_ID" />
<result property="REVISION" column="sub_REVISION" />
<result property="createdBy" column="sub_CREATED_BY" /> <result property="createdBy" column="sub_CREATED_BY" />
<result property="createdTime" column="sub_CREATED_TIME" /> <result property="createdTime" column="sub_CREATED_TIME" />
<result property="updatedBy" column="sub_UPDATED_BY" /> <result property="updatedBy" column="sub_UPDATED_BY" />
@ -36,14 +35,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deleteTime" column="sub_DELETE_TIME" /> <result property="deleteTime" column="sub_DELETE_TIME" />
<result property="id" column="sub_id" /> <result property="id" column="sub_id" />
<result property="billNo" column="sub_bill_no" /> <result property="billNo" column="sub_bill_no" />
<result property="companyName" column="sub_company_name" />
<result property="companyCode" column="sub_company_code" />
<result property="orgCode" column="sub_org_code" />
<result property="orgName" column="sub_org_name" />
<result property="assetCode" column="sub_asset_code" /> <result property="assetCode" column="sub_asset_code" />
<result property="assetName" column="sub_asset_name" />
<result property="fieldType" column="sub_field_type" /> <result property="fieldType" column="sub_field_type" />
<result property="paramName" column="sub_param_name" /> <result property="counDate" column="count_date" />
<result property="paramCode" column="sub_param_code" /> <result property="paramCode" column="sub_param_code" />
<result property="paramUint" column="sub_param_uint" /> <result property="paramUint" column="sub_param_uint" />
<result property="paramValue" column="sub_param_value" /> <result property="paramValue" column="sub_param_value" />
@ -66,9 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcBusiParamBillMasterDaoById" parameterType="Long" resultMap="DcBusiParamBillMasterDaoDcBusiParamBillSubDaoResult"> <select id="selectDcBusiParamBillMasterDaoById" parameterType="Long" resultMap="DcBusiParamBillMasterDaoDcBusiParamBillSubDaoResult">
select a.TENANT_ID, a.REVISION, a.CREATED_BY, a.CREATED_TIME, a.UPDATED_BY, a.UPDATED_TIME, a.DELETE_BY, a.DELETE_TIME, a.id, a.bill_no, a.bill_income_date, a.bill_type, a.check_type, a.check_status, select a.TENANT_ID, a.REVISION, a.CREATED_BY, a.CREATED_TIME, a.UPDATED_BY, a.UPDATED_TIME, a.DELETE_BY, a.DELETE_TIME, a.id, a.bill_no, a.bill_income_date, a.bill_type, a.check_type, a.check_status,
b.TENANT_ID as sub_TENANT_ID, b.REVISION as sub_REVISION, b.CREATED_BY as sub_CREATED_BY, b.CREATED_TIME as sub_CREATED_TIME, b.UPDATED_BY as sub_UPDATED_BY, b.UPDATED_TIME as sub_UPDATED_TIME, b.DELETE_BY as sub_DELETE_BY, b.DELETE_TIME as sub_DELETE_TIME, b.id as sub_id, b.bill_no as sub_bill_no, b.company_name as sub_company_name, b.company_code as sub_company_code, b.org_code as sub_org_code, b.org_name as sub_org_name, b.asset_code as sub_asset_code, b.asset_name as sub_asset_name, b.field_type as sub_field_type, b.param_name as sub_param_name, b.param_code as sub_param_code, b.param_uint as sub_param_uint, b.param_value as sub_param_value b.TENANT_ID as sub_TENANT_ID, b.CREATED_BY as sub_CREATED_BY, b.CREATED_TIME as sub_CREATED_TIME, b.UPDATED_BY as sub_UPDATED_BY, b.UPDATED_TIME as sub_UPDATED_TIME, b.DELETE_BY as sub_DELETE_BY, b.DELETE_TIME as sub_DELETE_TIME, b.id as sub_id, b.bill_no as sub_bill_no,b.asset_code as sub_asset_code, b.field_type as sub_field_type, b.param_code as sub_param_code, b.param_value as sub_param_value
from dc_busi_param_bill_master a from dc_busi_param_bill_master a
left join dc_busi_param_bill_sub b on b.bill_no = a.id left join dc_busi_param_bill_sub b on b.bill_no = a.bill_no
where a.id = #{id} where a.id = #{id}
</select> </select>
@ -149,9 +143,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<insert id="batchDcBusiParamBillSubDao"> <insert id="batchDcBusiParamBillSubDao">
insert into dc_busi_param_bill_sub( TENANT_ID, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETE_BY, DELETE_TIME, id, bill_no, company_name, company_code, org_code, org_name, asset_code, asset_name, field_type, param_name, param_code, param_uint, param_value) values insert into dc_busi_param_bill_sub( TENANT_ID, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETE_BY, DELETE_TIME, id, bill_no, asset_code, field_type, param_code, param_value) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.tenantId}, #{item.REVISION}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}, #{item.id}, #{item.billNo}, #{item.companyName}, #{item.companyCode}, #{item.orgCode}, #{item.orgName}, #{item.assetCode}, #{item.assetName}, #{item.fieldType}, #{item.paramName}, #{item.paramCode}, #{item.paramUint}, #{item.paramValue}) ( #{item.tenantId}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}, #{item.id}, #{item.billNo}, #{item.assetCode}, #{item.fieldType}, #{item.paramCode}, #{item.paramValue})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>

11
lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadConfigMapper.xml

@ -37,6 +37,9 @@
<result property="goalParamType" column="goal_param_type"/> <result property="goalParamType" column="goal_param_type"/>
<!-- 数据来源 --> <!-- 数据来源 -->
<result property="goalSource" column="goal_source"/> <result property="goalSource" column="goal_source"/>
<!-- 数据来源 -->
<result property="assetFieldCode" column="asset_field_code"/>
</resultMap> </resultMap>
<sql id="baseQuerySql"> <sql id="baseQuerySql">
select select
@ -56,6 +59,7 @@
goal_param_ext2, goal_param_ext2,
goal_param_type, goal_param_type,
goal_source, goal_source,
asset_field_code
from dc_busi_work_read_config from dc_busi_work_read_config
</sql> </sql>
<select id="selectByVo" resultMap="rmDcBusiWorkReadConfig" parameterType="com.lzbi.asset.domain.DcBusiWorkReadConfig"> <select id="selectByVo" resultMap="rmDcBusiWorkReadConfig" parameterType="com.lzbi.asset.domain.DcBusiWorkReadConfig">
@ -66,7 +70,7 @@
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if> <if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if> <if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if> <if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null a"> and updated_time = #{updatedTime}</if> <if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
<if test="deleteBy != null and deleteBy != ''"> and delete_by = #{deleteBy}</if> <if test="deleteBy != null and deleteBy != ''"> and delete_by = #{deleteBy}</if>
<if test="deleteTime != null "> and delete_time = #{deleteTime}</if> <if test="deleteTime != null "> and delete_time = #{deleteTime}</if>
<if test="id != null "> and id = #{id}</if> <if test="id != null "> and id = #{id}</if>
@ -77,7 +81,7 @@
<if test="goalParamExt2 != null and goalParamExt2 != ''"> and goal_param_ext2 = #{goalParamExt2}</if> <if test="goalParamExt2 != null and goalParamExt2 != ''"> and goal_param_ext2 = #{goalParamExt2}</if>
<if test="goalParamType != null and goalParamType != ''"> and goal_param_type = #{goalParamType}</if> <if test="goalParamType != null and goalParamType != ''"> and goal_param_type = #{goalParamType}</if>
<if test="goalSource != null and goalSource != ''"> and goal_source = #{goalSource}</if> <if test="goalSource != null and goalSource != ''"> and goal_source = #{goalSource}</if>
<if test="assetFieldCode != null and assetFieldCode != ''"> and asset_field_code = #{assetFieldCode}</if>
</where> </where>
</select> </select>
<insert id="insertByVo" parameterType="com.lzbi.asset.domain.DcBusiWorkReadConfig"> <insert id="insertByVo" parameterType="com.lzbi.asset.domain.DcBusiWorkReadConfig">
@ -99,6 +103,7 @@
<if test="goalParamExt2 != null and goalParamExt2 != ''">goal_param_ext2,</if> <if test="goalParamExt2 != null and goalParamExt2 != ''">goal_param_ext2,</if>
<if test="goalParamType != null and goalParamType != ''">goal_param_type,</if> <if test="goalParamType != null and goalParamType != ''">goal_param_type,</if>
<if test="goalSource != null and goalSource != ''">goal_source,</if> <if test="goalSource != null and goalSource != ''">goal_source,</if>
<if test="assetFieldCode != null and assetFieldCode != ''">asset_field_code</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantId != null and tenantId != ''">#{tenantId},</if> <if test="tenantId != null and tenantId != ''">#{tenantId},</if>
@ -117,7 +122,7 @@
<if test="goalParamExt2 != null and goalParamExt2 != ''">#{goalParamExt2},</if> <if test="goalParamExt2 != null and goalParamExt2 != ''">#{goalParamExt2},</if>
<if test="goalParamType != null and goalParamType != ''">#{goalParamType},</if> <if test="goalParamType != null and goalParamType != ''">#{goalParamType},</if>
<if test="goalSource != null and goalSource != ''">#{goalSource},</if> <if test="goalSource != null and goalSource != ''">#{goalSource},</if>
<if test="assetFieldCode != null and assetFieldCode != ''">#{assetFieldCode},</if>
</trim> </trim>
</insert> </insert>
</mapper> </mapper>

8
lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml

@ -29,12 +29,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM dc_base_log_history_level1 AS his FROM dc_base_log_history_level1 AS his
where timestamp_key BETWEEN to_timestamp(#{beginTime},'yyyy-MM-dd hh24:mi:ss') and to_timestamp(#{endTime},'yyyy-MM-dd hh24:mi:ss') where timestamp_key BETWEEN to_timestamp(#{beginTime},'yyyy-MM-dd hh24:mi:ss') and to_timestamp(#{endTime},'yyyy-MM-dd hh24:mi:ss')
and device_uuid in and device_uuid in
<foreach item="item" index="index" collection="deviceCodes" separator=","> <foreach item="item" index="index" collection="deviceCodes" open="(" close=")" separator=",">
( #{item}) #{item}
</foreach> </foreach>
and param_code in and param_code in
<foreach item="item" index="index" collection="paramCodes" separator=","> <foreach item="item" index="index" collection="paramCodes" open="(" close=")" separator=",">
( #{item}) #{item}
</foreach> </foreach>
GROUP BY thour, param_code,device_uuid GROUP BY thour, param_code,device_uuid
ORDER BY thour asc ORDER BY thour asc

Loading…
Cancel
Save