mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
package com.cf.imes.framework.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -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 的请求
|
||||
@@ -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
|
||||
@@ -159,5 +159,4 @@ chenfeng:
|
||||
- infra_data_source_config
|
||||
encrypt:
|
||||
enable: false
|
||||
publicKey: cfimes
|
||||
debug: false
|
||||
publicKey: cfimes
|
||||
+1
-2
@@ -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
|
||||
|
||||
+2
-1
@@ -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:
|
||||
|
||||
+1
-8
@@ -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
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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:
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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:
|
||||
|
||||
@@ -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
|
||||
@@ -42,6 +42,10 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-banner</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-operatelog</artifactId>
|
||||
|
||||
+50
@@ -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<RegisterDO> 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+23
@@ -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;
|
||||
}
|
||||
+18
@@ -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<RegisterDO> {
|
||||
|
||||
@Select("select * from system_db_register")
|
||||
List<RegisterDO> findAll();
|
||||
}
|
||||
@@ -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 # 开启演示模式
|
||||
|
||||
@@ -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
|
||||
@@ -105,6 +105,4 @@ chenfeng:
|
||||
ignore-tables:
|
||||
encrypt:
|
||||
enable: false
|
||||
publicKey: cfimes
|
||||
|
||||
debug: false
|
||||
publicKey: cfimes
|
||||
+2
@@ -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 = "我是一个角色")
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class MenuController {
|
||||
public CommonResult<List<MenuSimpleRespVO>> getSimpleMenuList() {
|
||||
// status:0 开启 visiable:1 显示
|
||||
List<MenuDO> 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));
|
||||
}
|
||||
|
||||
-36
@@ -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<OrderStatisticsUnitInEnum, Integer> {
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-2
@@ -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<DictTypeDO> 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<DictDataDO>().set(DictDataDO::getDictType, updateReqVOType).eq(DictDataDO::getDictType, oldDictTypeDOType).eq(DictDataDO::getStatus, DeletedCodeEnum.NOT_DELETED.getStatus()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-8
@@ -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 {};
|
||||
|
||||
+27
@@ -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<CssClassValid, String> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user