diff --git a/jnpf-java-boot/jnpf-admin/src/main/resources/application-pro.yml b/jnpf-java-boot/jnpf-admin/src/main/resources/application-pro.yml index 58dd00d..cf657ce 100644 --- a/jnpf-java-boot/jnpf-admin/src/main/resources/application-pro.yml +++ b/jnpf-java-boot/jnpf-admin/src/main/resources/application-pro.yml @@ -13,15 +13,15 @@ spring: thymeleaf: cache: false #spring内置thymeleaf缓存 - # ===================== 数据源配置 ===================== + # ===================== 数据源配置 ===================== exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure #排除自动配置,手动配置druid datasource: db-type: MySQL #数据库类型(可选值 MySQL、SQLServer、Oracle、DM8、KingbaseES、PostgreSQL,请严格按可选值填写) - host: 192.168.0.210 + host: 127.0.0.1 port: 3306 - username: java_boot_test - password: pBx5HaW6WMGSTdDf - db-name: java_boot_test + username: root + password: root + db-name: jnpf_yys_dev db-schema: #金仓达梦选填 prepare-url: #自定义url @@ -30,23 +30,61 @@ spring: primary: master #设置默认的数据源或者数据源组,默认值即为master strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源 druid: - #定时执行数据链接检测语句 防止数据库闲时超时断开链接 - test-while-idle: true #空闲时执行 - time-between-eviction-runs-millis: 60000 #执行间隔 - # datasource: - # master: - # url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC - # username: ${spring.datasource.username} - # password: ${spring.datasource.password} - # driver-class-name: com.mysql.cj.jdbc.Driver + # 空闲时执行连接测试 + test-while-idle: true + # 连接测试最小间隔 + time-between-eviction-runs-millis: 60000 + # 获取连接等待3秒 根据网络情况设定 + max-wait: 3000 + # 初始化4个连接 + initial-size: 4 + # 最大20个连接 + max-active: 20 + # 最少保持4个空闲连接 + min-idle: 4 + # 空闲连接保活, 超过配置的空闲时间会进行连接检查完成保活操作(数据库自身会断开达到空闲时间的连接, 程序使用断开的连接会报错) + keep-alive: true + # 解除注释后Druid连接池打印SQL语句 忽略日志等级配置 + #filters: slf4j + slf4j: + statementLogEnabled: true + resultSetLogEnabled: false + connectionLogEnabled: false + dataSourceLogEnabled: false + statementCreateAfterLogEnabled: false + statementCloseAfterLogEnabled: false + statementExecuteAfterLogEnabled: false + #打印SQL替换参数 + statementExecutableSqlLogEnable: true + statementPrepareAfterLogEnabled: false + statementPrepareCallAfterLogEnabled: false + statementParameterSetLogEnabled: false + validation-query: SELECT 1 + datasource: + master: + url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8 + username: ${spring.datasource.username} + password: ${spring.datasource.password} + driver-class-name: com.mysql.cj.jdbc.Driver + slave_1: + url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/yys-sc?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + username: ${spring.datasource.username} + password: ${spring.datasource.password} + driver-class-name: com.mysql.cj.jdbc.Driver + slave_2: + url: jdbc:sqlserver://192.168.10.246:1433;DatabaseName=UFDATA_995_2024;trustServerCertificate=true + username: sa + password: '!sql2019' + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver # ===================== Redis配置 ===================== # redis单机模式 redis: database: 1 #缓存库编号 - host: 192.168.0.220 + # host: 222.71.165.188 + host: 127.0.0.1 port: 6379 - password: 123456 # 密码为空时,请将本行注释 + # password: qweasd,.123 # 密码为空时,请将本行注释 timeout: 3000 #超时时间(单位:秒) lettuce: #Lettuce为Redis的Java驱动包 pool: @@ -74,6 +112,18 @@ spring: # min-idle: 0 # 连接池中的最小空闲连接 # max-idle: 8 # 连接池中的最大空闲连接 +# SpringDoc接口文档 访问地址:http://127.0.0.1:30000/doc.html +springdoc: + default-flat-param-object: true + api-docs: + enabled: true +#SpringDoc增强 +#knife4j: +# basic: #接口文档访问鉴权 +# enable: true +# username: jnpf +# password: 123456 + config: # ===================== 是否开启测试环境 ===================== TestVersion: false @@ -88,7 +138,7 @@ config: enable-storage: true #启用存储 enable-access: true #启用访问(线上请使用 Nginx 配置,效率更高) domain: "" # 访问域名,例如:“http://127.0.0.1:8030/”,注意后面要和 path-patterns 保持一致,“/”结尾,本地存储建议使用相对路径,方便后期更换域名 - base-path: F:/work/jnpf-resources/ # 基础路径 + base-path: D:/project/jnpf-resources/ # 基础路径 path-patterns: /** # 访问路径 storage-path: # 存储路径 aliyun-oss: # 阿里云 OSS ,不使用的情况下可以不写 diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java index 645a572..ee16c60 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java @@ -24,8 +24,10 @@ import jnpf.permission.entity.UserEntity; import jnpf.service.YysBillMaterialService; import jnpf.service.YysSubsetMaterialService; import jnpf.util.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; @@ -46,6 +48,7 @@ import java.util.stream.Collectors; * 日期: 2024-08-08 */ @Service +@Slf4j public class YysBillMaterialServiceImpl extends ServiceImpl implements YysBillMaterialService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -338,12 +341,14 @@ public class YysBillMaterialServiceImpl extends ServiceImpl !syncList.contains(obj.getAutoId())).collect(Collectors.toList()); //子件物料 RowMapper subMapper = new BeanPropertyRowMapper<>(SyncSubsetMaterial.class); String subsetSql = "select * from v_bom_opcomponent_rpt"; List subsetMaterials = this.jdbcTemplate.query(subsetSql, subMapper); + log.info("子件物料信息,{}", subsetMaterials); Map> subsetCollect = Maps.newHashMap(); if (CollectionUtils.isNotEmpty(subsetMaterials)) { subsetCollect = subsetMaterials.stream().collect(Collectors.groupingBy(SyncSubsetMaterial::getBomId)); @@ -352,6 +357,7 @@ public class YysBillMaterialServiceImpl extends ServiceImpl materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class); String materialSql = "select * from dbo.Inventory"; List informationSyncs = this.jdbcTemplate.query(materialSql, materialMapper); + log.info("物料表数据,{}", informationSyncs); Map materialCollect = Maps.newHashMap(); if (CollectionUtils.isNotEmpty(informationSyncs)) { materialCollect = informationSyncs.stream().collect(Collectors.toMap(MaterialInformationSync::getCInvCode, Function.identity())); @@ -364,7 +370,7 @@ public class YysBillMaterialServiceImpl extends ServiceImpl implements YysInventoryQueryService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -323,12 +325,14 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl !syncList.contains(obj.getAutoId())).collect(Collectors.toList()); //物料表数据 不从自己库取数据,防止自己库未同步,从而取不到数据 RowMapper materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class); String materialSql = "select * from dbo.Inventory"; List informationSyncs = this.jdbcTemplate.query(materialSql, materialMapper); + log.info("物料表数据,{}", informationSyncs); Map materialCollect = Maps.newHashMap(); if (CollectionUtils.isNotEmpty(informationSyncs)) { materialCollect = informationSyncs.stream().collect(Collectors.toMap(MaterialInformationSync::getCInvCode, Function.identity())); diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialClassServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialClassServiceImpl.java index 3cffe07..682e0c7 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialClassServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialClassServiceImpl.java @@ -25,6 +25,7 @@ import jnpf.model.yyssupplierclass.SupplierClassSync; import jnpf.permission.entity.UserEntity; import jnpf.service.YysMaterialClassService; import jnpf.util.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.BeanPropertyRowMapper; @@ -48,6 +49,7 @@ import java.util.stream.Collectors; * 日期: 2024-08-08 */ @Service +@Slf4j public class YysMaterialClassServiceImpl extends ServiceImpl implements YysMaterialClassService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -321,16 +323,17 @@ public class YysMaterialClassServiceImpl extends ServiceImpl list = masterDataService.getMaterialClassIds(); //顶级分类 Map topCollect = query.stream() - .filter(obj -> obj.getCInvCCode().equals("1")) + .filter(obj -> obj.getIInvCGrade().equals("1")) .collect(Collectors.toMap(MaterialClassSync::getCInvCCode, MaterialClassSync::getCInvCName)); //二级分类 Map secondCollect = query.stream() - .filter(obj -> obj.getCInvCCode().equals("1")) + .filter(obj -> obj.getIInvCGrade().equals("2")) .collect(Collectors.toMap(MaterialClassSync::getCInvCCode, MaterialClassSync::getCInvCName)); List result = Lists.newArrayList(); diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialInformationServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialInformationServiceImpl.java index 61916fb..e86328d 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialInformationServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMaterialInformationServiceImpl.java @@ -31,6 +31,7 @@ import jnpf.model.QueryModel; import java.util.stream.Collectors; import jnpf.base.model.ColumnDataModel; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.jdbc.core.BeanPropertyRowMapper; @@ -61,6 +62,7 @@ import jnpf.permission.entity.UserEntity; * 日期: 2024-08-08 */ @Service +@Slf4j public class YysMaterialInformationServiceImpl extends ServiceImpl implements YysMaterialInformationService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -344,6 +346,7 @@ public class YysMaterialInformationServiceImpl extends ServiceImpl list = masterDataService.getMaterialInfoIds(); List result = Lists.newArrayList(); diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierClassServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierClassServiceImpl.java index 9dacbc3..4e8c9aa 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierClassServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierClassServiceImpl.java @@ -24,6 +24,7 @@ import jnpf.model.yyssupplierinformation.SupplierInfoSync; import jnpf.permission.entity.UserEntity; import jnpf.service.YysSupplierClassService; import jnpf.util.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.BeanPropertyRowMapper; @@ -46,6 +47,7 @@ import java.util.stream.Collectors; * 日期: 2024-08-08 */ @Service +@Slf4j public class YysSupplierClassServiceImpl extends ServiceImpl implements YysSupplierClassService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -319,6 +321,7 @@ public class YysSupplierClassServiceImpl extends ServiceImpl list = masterDataService.getSupplierClassIds(); //顶级分类 Map collect = query.stream() diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierInformationServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierInformationServiceImpl.java index cd68b1a..3685d2b 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierInformationServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysSupplierInformationServiceImpl.java @@ -23,6 +23,7 @@ import jnpf.model.yyssupplierinformation.YysSupplierInformationPagination; import jnpf.permission.entity.UserEntity; import jnpf.service.YysSupplierInformationService; import jnpf.util.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -45,6 +46,7 @@ import java.util.stream.Collectors; * 日期: 2024-08-08 */ @Service +@Slf4j public class YysSupplierInformationServiceImpl extends ServiceImpl implements YysSupplierInformationService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -318,6 +320,7 @@ public class YysSupplierInformationServiceImpl extends ServiceImpl list = masterDataService.getSupplierIds(); List result = Lists.newArrayList(); diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysUnitInformationServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysUnitInformationServiceImpl.java index 4f1dae7..1c7042e 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysUnitInformationServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysUnitInformationServiceImpl.java @@ -31,6 +31,7 @@ import jnpf.model.QueryModel; import java.util.stream.Collectors; import jnpf.base.model.ColumnDataModel; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.springframework.jdbc.core.BeanPropertyRowMapper; @@ -61,6 +62,7 @@ import jnpf.permission.entity.UserEntity; * 日期: 2024-08-08 */ @Service +@Slf4j public class YysUnitInformationServiceImpl extends ServiceImpl implements YysUnitInformationService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -323,6 +325,7 @@ public class YysUnitInformationServiceImpl extends ServiceImpl groupSyncRowMapper = new BeanPropertyRowMapper<>(UnitGroupSync.class); String groupSql = "select * from dbo.ComputationGroup"; List groupSyncs = this.jdbcTemplate.query(groupSql, groupSyncRowMapper);