diff --git a/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/DeletedCodeEnum.java b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/enums/DeletedCodeEnum.java similarity index 91% rename from cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/DeletedCodeEnum.java rename to cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/enums/DeletedCodeEnum.java index 8963aa73a..caedf91d6 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/DeletedCodeEnum.java +++ b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/enums/DeletedCodeEnum.java @@ -1,4 +1,4 @@ -package com.cf.imes.module.manage.enums; +package com.cf.imes.framework.common.enums; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml index 78902e226..07cf28e71 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml +++ b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-dev.yaml @@ -41,13 +41,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver - username: root - password: root - slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 - name: imes_base - url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver + driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root @@ -118,5 +112,4 @@ chenfeng: enable: false exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 - demo: false # 开启演示模式 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 \ No newline at end of file diff --git a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml index d9d55444d..a5f921f38 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml +++ b/cf-module-infra/cf-module-infra-biz/src/main/resources/application-local.yaml @@ -46,6 +46,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + driver-class-name: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -54,17 +55,6 @@ spring: password: root # username: sa # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W - slave: # 模拟从库,可根据自己需要修改 - name: imes_base - url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 - # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 - # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 - # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 - # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 - username: root - password: root - # username: sa - # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: @@ -148,5 +138,4 @@ chenfeng: access-log: # 访问日志的配置项 enable: false error-code: # 错误码相关配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/cf-module-infra/cf-module-infra-biz/src/main/resources/application.yaml b/cf-module-infra/cf-module-infra-biz/src/main/resources/application.yaml index 3f27b6988..36f432686 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/resources/application.yaml +++ b/cf-module-infra/cf-module-infra-biz/src/main/resources/application.yaml @@ -159,5 +159,4 @@ chenfeng: - infra_data_source_config encrypt: enable: false - publicKey: cfimes -debug: false + publicKey: cfimes \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml index 880b02439..ae26569e4 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-dev.yaml @@ -41,7 +41,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver + driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root @@ -139,7 +139,6 @@ chenfeng: pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify pay-return-url: http://niubi.natapp1.cc/api/pay/order/return refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify - demo: false # 开启演示模式 justauth: enabled: true diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml index 828692f7b..674ee39ad 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml @@ -42,6 +42,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + driver-class-name: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -53,6 +54,7 @@ spring: slave: # 模拟从库,可根据自己需要修改 name: imes_prod url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + driver-class-name: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -145,7 +147,6 @@ chenfeng: enable: false error-code: # 错误码相关配置项 enable: false - demo: false # 关闭演示模式 mybatis-plus: configuration: diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application.yaml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application.yaml index 56cd5da62..8d0bb2b1c 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application.yaml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application.yaml @@ -154,13 +154,6 @@ chenfeng: ignore-urls: - /rpc-api/** ignore-tables: - sms-code: # 短信验证码相关的配置项 - expire-times: 10m - send-frequency: 1m - send-maximum-quantity-per-day: 10 - begin-code: 9999 # 这里配置 9999 的原因是,测试方便。 - end-code: 9999 # 这里配置 9999 的原因是,测试方便。 encrypt: enable: false - publicKey: cfimes -debug: false + publicKey: cfimes \ No newline at end of file diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java index 821a823f0..6eb570638 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java @@ -5,7 +5,7 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePag import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO; import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO; import com.cf.imes.module.manage.dal.mysql.remainplaten.RemainPlateMapper; -import com.cf.imes.module.manage.enums.DeletedCodeEnum; +import com.cf.imes.framework.common.enums.DeletedCodeEnum; import com.cf.imes.module.manage.enums.RemainPlateStatusEnum; import com.cf.imes.module.manage.enums.RemainPlateUseTypeEnum; import org.springframework.stereotype.Service; diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-dev.yaml b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-dev.yaml index cab696a4d..0078f470c 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-dev.yaml +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-dev.yaml @@ -41,7 +41,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver + driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root @@ -138,7 +138,6 @@ chenfeng: pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify pay-return-url: http://niubi.natapp1.cc/api/pay/order/return refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify - demo: false # 开启演示模式 justauth: enabled: true diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-local.yaml b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-local.yaml index 9d6697e2a..a20f091c6 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-local.yaml +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application-local.yaml @@ -42,6 +42,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + driver-class-name: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -132,7 +133,6 @@ chenfeng: enable: false error-code: # 错误码相关配置项 enable: false - demo: false # 关闭演示模式 mybatis-plus: configuration: diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application.yaml b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application.yaml index 453122f78..341585cec 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application.yaml +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/application.yaml @@ -155,13 +155,6 @@ chenfeng: - /rpc-api/** ignore-tables: - test - sms-code: # 短信验证码相关的配置项 - expire-times: 10m - send-frequency: 1m - send-maximum-quantity-per-day: 10 - begin-code: 9999 # 这里配置 9999 的原因是,测试方便。 - end-code: 9999 # 这里配置 9999 的原因是,测试方便。 encrypt: enable: false - publicKey: cfimes -debug: false + publicKey: cfimes \ No newline at end of file diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml index cab696a4d..0078f470c 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-dev.yaml @@ -41,7 +41,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver + driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root @@ -138,7 +138,6 @@ chenfeng: pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify pay-return-url: http://niubi.natapp1.cc/api/pay/order/return refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify - demo: false # 开启演示模式 justauth: enabled: true diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml index 9882bd664..ea57564c5 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application-local.yaml @@ -42,6 +42,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + driver-class-name: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -134,7 +135,6 @@ chenfeng: enable: false error-code: # 错误码相关配置项 enable: false - demo: false # 关闭演示模式 mybatis-plus: configuration: diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application.yaml b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application.yaml index 07c6419b9..b270fd25f 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application.yaml +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/resources/application.yaml @@ -169,13 +169,6 @@ chenfeng: ignore-urls: - /rpc-api/** ignore-tables: - sms-code: # 短信验证码相关的配置项 - expire-times: 10m - send-frequency: 1m - send-maximum-quantity-per-day: 10 - begin-code: 9999 # 这里配置 9999 的原因是,测试方便。 - end-code: 9999 # 这里配置 9999 的原因是,测试方便。 encrypt: enable: false - publicKey: cfimes -debug: false + publicKey: cfimes \ No newline at end of file diff --git a/cf-module-report/cf-module-report-biz/pom.xml b/cf-module-report/cf-module-report-biz/pom.xml index 2ecedbb0a..2dd925473 100644 --- a/cf-module-report/cf-module-report-biz/pom.xml +++ b/cf-module-report/cf-module-report-biz/pom.xml @@ -42,6 +42,10 @@ + + com.cf.imes + cf-spring-boot-starter-banner + com.cf.imes cf-spring-boot-starter-biz-operatelog diff --git a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/config/DataSourceInitializer.java b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/config/DataSourceInitializer.java new file mode 100644 index 000000000..43865b4ef --- /dev/null +++ b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/config/DataSourceInitializer.java @@ -0,0 +1,50 @@ +package com.cf.imes.module.report.config; + +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.dynamic.datasource.creator.DataSourceProperty; +import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator; +import com.cf.imes.framework.organ.core.context.OrganContextHolder; +import com.cf.imes.module.report.dal.dataobject.register.RegisterDO; +import com.cf.imes.module.report.dal.mysql.register.RegisterMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.sql.DataSource; +import java.util.List; + +/** + * @author there + */ +@Slf4j +@Component +public class DataSourceInitializer { + + @Autowired + private DefaultDataSourceCreator defaultDataSourceCreator; + + @Autowired + private RegisterMapper registerMapper; + + @Autowired + private DataSource dataSource; + + @PostConstruct + public void init() { + DynamicRoutingDataSource dynamicRoutingDataSource = (DynamicRoutingDataSource) dataSource; + OrganContextHolder.setOrganId(0L); + List registerDOS = registerMapper.findAll(); + OrganContextHolder.clear(); + for (RegisterDO registerDO : registerDOS) { + DataSourceProperty dataSourceProperty = new DataSourceProperty(); + dataSourceProperty.setPoolName(registerDO.getCode()); + dataSourceProperty.setUrl(registerDO.getDbUrl()); + dataSourceProperty.setUsername(registerDO.getDbUsername()); + dataSourceProperty.setPassword(registerDO.getDbPassword()); + DataSource dataSource = defaultDataSourceCreator.createDataSource(dataSourceProperty); + dynamicRoutingDataSource.addDataSource(registerDO.getCode(), dataSource); + } + + } +} diff --git a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/dal/dataobject/register/RegisterDO.java b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/dal/dataobject/register/RegisterDO.java new file mode 100644 index 000000000..3cea4796f --- /dev/null +++ b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/dal/dataobject/register/RegisterDO.java @@ -0,0 +1,23 @@ +package com.cf.imes.module.report.dal.dataobject.register; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * @author there + */ +@Data +@TableName("system_db_register") +public class RegisterDO { + @TableId + private Integer id; + + private String code; + + private String dbUrl; + + private String dbUsername; + + private String dbPassword; +} diff --git a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/dal/mysql/register/RegisterMapper.java b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/dal/mysql/register/RegisterMapper.java new file mode 100644 index 000000000..6a72635ff --- /dev/null +++ b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/dal/mysql/register/RegisterMapper.java @@ -0,0 +1,18 @@ +package com.cf.imes.module.report.dal.mysql.register; + +import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; +import com.cf.imes.module.report.dal.dataobject.register.RegisterDO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * @author there + */ +@Mapper +public interface RegisterMapper extends BaseMapperX { + + @Select("select * from system_db_register") + List findAll(); +} diff --git a/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml b/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml index 7ce944449..05bc5e0cd 100644 --- a/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml +++ b/cf-module-report/cf-module-report-biz/src/main/resources/application-dev.yaml @@ -41,13 +41,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver - username: root - password: root - slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 - name: imes_base - url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver + driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root @@ -98,4 +92,3 @@ chenfeng: exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 - demo: false # 开启演示模式 diff --git a/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml b/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml index bbeccb625..44cd14b4c 100644 --- a/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml +++ b/cf-module-report/cf-module-report-biz/src/main/resources/application-local.yaml @@ -43,6 +43,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + driver-class-name: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -51,17 +52,6 @@ spring: password: root # username: sa # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W - slave: # 模拟从库,可根据自己需要修改 - name: imes_base - url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 - # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 - # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 - # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 - # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 - username: root - password: root - # username: sa - # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: @@ -122,5 +112,4 @@ chenfeng: access-log: # 访问日志的配置项 enable: false error-code: # 错误码相关配置项 - enable: false - demo: false # 关闭演示模式 + enable: false \ No newline at end of file diff --git a/cf-module-report/cf-module-report-biz/src/main/resources/application.yaml b/cf-module-report/cf-module-report-biz/src/main/resources/application.yaml index 13b2d085a..6b8f9c838 100644 --- a/cf-module-report/cf-module-report-biz/src/main/resources/application.yaml +++ b/cf-module-report/cf-module-report-biz/src/main/resources/application.yaml @@ -105,6 +105,4 @@ chenfeng: ignore-tables: encrypt: enable: false - publicKey: cfimes - -debug: false + publicKey: cfimes \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/dict/vo/data/DictDataSaveReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/dict/vo/data/DictDataSaveReqVO.java index 8537ef0d0..10650ce47 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/dict/vo/data/DictDataSaveReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/dict/vo/data/DictDataSaveReqVO.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.controller.admin.dict.vo.data; import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.validation.InEnum; +import com.cf.imes.module.system.validation.system.dict.CssClassValid; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -44,6 +45,7 @@ public class DictDataSaveReqVO { private String colorType; @Schema(description = "css 样式", example = "btn-visible") + @CssClassValid private String cssClass; @Schema(description = "备注", example = "我是一个角色") diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/MenuController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/MenuController.java index 1a6ea7b3b..a3d1a6264 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/MenuController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/MenuController.java @@ -110,7 +110,7 @@ public class MenuController { public CommonResult> getSimpleMenuList() { // status:0 开启 visiable:1 显示 List list = menuService.getMenuListByOrgan( - new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()).setVisiable(CommonStatusEnum.DISABLE.getStatus())); + new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus())); list.sort(Comparator.comparing(MenuDO::getSort)); return success(BeanUtils.toBean(list, MenuSimpleRespVO.class)); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/order/OrderStatisticsUnitInEnumValidator.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/order/OrderStatisticsUnitInEnumValidator.java deleted file mode 100644 index 85cd02a5e..000000000 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/order/OrderStatisticsUnitInEnumValidator.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.cf.imes.module.system.order; - -import cn.hutool.core.util.ObjectUtil; -import com.cf.imes.module.executor.enums.OrderStatisticsUnit; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -/** - * 生产单统计维度单位入参校验器 - * - * @author Gqr - * @since 2024/7/17 9:33 - */ -public class OrderStatisticsUnitInEnumValidator implements ConstraintValidator { - - @Override - public void initialize(OrderStatisticsUnitInEnum constraintAnnotation) { - ConstraintValidator.super.initialize(constraintAnnotation); - } - - @Override - public boolean isValid(Integer value, ConstraintValidatorContext context) { - if (ObjectUtil.isNull(value)) { - return true; - } - OrderStatisticsUnit unit = OrderStatisticsUnit.fromValue(value); - if (ObjectUtil.isNotNull(unit)) { - return true; - } else { - return false; - } - } - -} - diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java index 1af6b0759..134d04275 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java @@ -1,17 +1,23 @@ package com.cf.imes.module.system.service.dict; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.cf.imes.framework.common.enums.DeletedCodeEnum; import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.date.LocalDateTimeUtils; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.controller.admin.dict.vo.type.DictTypePageReqVO; import com.cf.imes.module.system.controller.admin.dict.vo.type.DictTypeSaveReqVO; +import com.cf.imes.module.system.dal.dataobject.dict.DictDataDO; import com.cf.imes.module.system.dal.dataobject.dict.DictTypeDO; +import com.cf.imes.module.system.dal.mysql.dict.DictDataMapper; import com.cf.imes.module.system.dal.mysql.dict.DictTypeMapper; import com.cf.imes.module.system.enums.ErrorCodeConstants; import com.google.common.annotations.VisibleForTesting; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDateTime; @@ -33,6 +39,9 @@ public class DictTypeServiceImpl implements DictTypeService { @Resource private DictTypeMapper dictTypeMapper; + @Resource + private DictDataMapper dictDataMapper; + @Override public PageResult getDictTypePage(DictTypePageReqVO pageReqVO) { return dictTypeMapper.selectPage(pageReqVO); @@ -63,17 +72,25 @@ public class DictTypeServiceImpl implements DictTypeService { } @Override + @Transactional(rollbackFor = Exception.class) public void updateDictType(DictTypeSaveReqVO updateReqVO) { + String updateReqVOType = updateReqVO.getType(); // 校验自己存在 - validateDictTypeExists(updateReqVO.getId()); + DictTypeDO oldDictTypeDO = validateDictTypeExists(updateReqVO.getId()); // 校验字典类型的名字的唯一性 validateDictTypeNameUnique(updateReqVO.getId(), updateReqVO.getName()); // 校验字典类型的类型的唯一性 - validateDictTypeUnique(updateReqVO.getId(), updateReqVO.getType()); + validateDictTypeUnique(updateReqVO.getId(), updateReqVOType); // 更新字典类型 DictTypeDO updateObj = BeanUtils.toBean(updateReqVO, DictTypeDO.class); dictTypeMapper.updateById(updateObj); + + // 字典类型发生改变,更新关联字典数据 + String oldDictTypeDOType = oldDictTypeDO.getType(); + if (ObjectUtil.isAllNotEmpty(oldDictTypeDOType, updateReqVOType) && ObjectUtil.notEqual(oldDictTypeDOType, updateReqVOType)) { + dictDataMapper.update(new LambdaUpdateWrapper().set(DictDataDO::getDictType, updateReqVOType).eq(DictDataDO::getDictType, oldDictTypeDOType).eq(DictDataDO::getStatus, DeletedCodeEnum.NOT_DELETED.getStatus())); + } } @Override diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/order/OrderStatisticsUnitInEnum.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/validation/system/dict/CssClassValid.java similarity index 51% rename from cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/order/OrderStatisticsUnitInEnum.java rename to cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/validation/system/dict/CssClassValid.java index 6bc77140e..4c4fe19de 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/order/OrderStatisticsUnitInEnum.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/validation/system/dict/CssClassValid.java @@ -1,14 +1,16 @@ -package com.cf.imes.module.system.order; +package com.cf.imes.module.system.validation.system.dict; import javax.validation.Constraint; import javax.validation.Payload; -import java.lang.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; /** - * 生产单统计维度单位入参校验注解 - * * @author Gqr - * @since 2024/7/17 9:33 + * @since 2024/9/20 15:24 */ @Target({ ElementType.METHOD, @@ -21,10 +23,10 @@ import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) @Documented @Constraint( - validatedBy = {OrderStatisticsUnitInEnumValidator.class} + validatedBy = {CssClassValidator.class} ) -public @interface OrderStatisticsUnitInEnum { - String message() default "生产单统计维度单位[unit]错误,请检查"; +public @interface CssClassValid { + String message() default "颜色格式错误,请检查"; Class[] groups() default {}; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/validation/system/dict/CssClassValidator.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/validation/system/dict/CssClassValidator.java new file mode 100644 index 000000000..b699b2cb9 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/validation/system/dict/CssClassValidator.java @@ -0,0 +1,27 @@ +package com.cf.imes.module.system.validation.system.dict; + +import org.apache.commons.lang3.StringUtils; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; + +/** + * @author Gqr + * @since 2024/9/20 15:27 + */ +public class CssClassValidator implements ConstraintValidator { + private static final String REGEX = "^#([0-9a-fA-F]{3}){1,2}$"; + + @Override + public void initialize(CssClassValid constraintAnnotation) { + ConstraintValidator.super.initialize(constraintAnnotation); + } + + @Override + public boolean isValid(String value, ConstraintValidatorContext context) { + if (StringUtils.isEmpty(value)) { + return true; + } + return value.matches(REGEX); + } +} diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml b/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml index bfbc1a29f..1162b5e8d 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/application-dev.yaml @@ -41,13 +41,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver - username: root - password: root - slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 - name: imes_base - url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true - driver-class-name: com.mysql.jdbc.Driver + driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root @@ -146,7 +140,6 @@ chenfeng: pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify pay-return-url: http://niubi.natapp1.cc/api/pay/order/return refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify - demo: false # 开启演示模式 justauth: enabled: true diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml b/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml index 0ae1abec3..99c0250e2 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/application-local.yaml @@ -42,6 +42,7 @@ spring: master: name: imes_base url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + driver-class-name: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -49,17 +50,6 @@ spring: username: root password: root # username: sa -# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W - slave: # 模拟从库,可根据自己需要修改 - name: imes_base - url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 -# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 -# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 -# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 -# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 - username: root - password: root -# username: sa # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 @@ -178,7 +168,6 @@ chenfeng: enable: false error-code: # 错误码相关配置项 enable: false - demo: false # 关闭演示模式 justauth: enabled: true diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml b/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml index ff3b4969c..085a8f37d 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml @@ -206,9 +206,9 @@ chenfeng: end-code: 9999 # 这里配置 9999 的原因是,测试方便。 sms: channel: DEBUG_DING_TALK - signature: - apiKey: 28PlJanD0aJLMyMLuH6JI5oVj1/j5ZNGvZPx/zguEvJl02PdrbWe5yIV4s1RSD3CDX9obUhITNlc6glW7MNJq03N7H/v50MFgN4f8mK1oAA= - apiSecret: O6Yk9gT3xQ9fqSKFuZa9I4bWOULCw2syH4/a1OrD2W7BAE2aQ+bSgqLXfBJT+de0GKHKgjuPNv0v+sDKkizLP22gsYIhdn/3OPSvyJF7Tng= + signature: sELLIaR5FAhCp8xx6tDJr1goyvsziMfTsD1HHxWnLkZgbVQOoly0GeadK81IkxbMVlvA5AhB7Apapg38Gx+MuE7G5xiVXt4JSzOqW1Qa6gn88joGXe0wh++lAtw= + apiKey: sELLIaR5FAhCp8xx6tDJr1goyvsziMfTsD1HHxWnLkZgbVQOoly0GeadK81IkxbMVlvA5AhB7Apapg38Gx+MuE7G5xiVXt4JSzOqW1Qa6gn88joGXe0wh++lAtw= + apiSecret: UjISv3wc1DfeFeG4WaPF4q8boPdrdhuUKuIhUDr1MImA0bK1KMqV76HL7fzEW2NR/Uqrq9Fe3vfWOCwblgKgL/J0twmrNCknBQSXhLNDw9zosoQR9Q1Lgql8dcI/d4g= encrypt: enable: false publicKey: cfimes