From 19c08e6e905e6fa90c5ce649d5a8c91f8f64d732 Mon Sep 17 00:00:00 2001
From: haozq <1611483981@qq.com>
Date: Tue, 23 Apr 2024 16:06:31 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=8A=A0?=
=?UTF-8?q?=E5=AF=86=E3=80=81token=E8=A7=A3=E6=9E=90401?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 1 -
securitycontrol-auth/pom.xml | 6 +++
.../auth/VscAuthApplication.java | 2 +
.../auth/service/SysPasswordService.java | 5 +-
.../src/main/resources/bootstrap.yml | 8 ++-
.../common/core/utils/ExcelStyleUtil.java | 1 -
.../common/core/utils/JwtUtils.java | 6 ++-
.../common/core/utils/WordUtils.java | 2 +-
.../common/log/aspect/OperLogAspect.java | 5 +-
.../common/redis/service/RedisService.java | 14 ++++--
.../interceptor/ParamSecureHandler.java | 4 +-
securitycontrol-gateway/pom.xml | 6 ++-
.../gateway/GatewayApplication.java | 3 ++
.../gateway/filter/AuthFilter.java | 4 +-
.../gateway/filter/RequestCoverFilter.java | 10 +++-
...saDecryptResponseGatewayFilterFactory.java | 4 +-
.../src/main/resources/bootstrap.yml | 9 ++--
.../securitycontrol-Interface/pom.xml | 5 ++
.../inter/VscInterApplication.java | 2 +
.../src/main/resources/bootstrap.yml | 9 ++--
.../background/VscBackgroundApplication.java | 2 +
.../service/impl/TbAreaServiceImpl.java | 8 +--
.../src/main/resources/bootstrap.yml | 10 ++--
.../securitycontrol-files/pom.xml | 5 ++
.../files/VscFileApplication.java | 2 +
.../src/main/resources/bootstrap.yml | 32 ++++++------
.../securitycontrol-screen/pom.xml | 5 ++
.../screen/VscScreenApplication.java | 49 ++++++++++++++++++-
.../screen/config/CodeSheepEncryptorCfg.java | 32 ++++++++++++
.../service/impl/ConstructionQualityImpl.java | 4 +-
.../src/main/resources/bootstrap.yml | 11 ++---
.../main/resources/mapper/ScIndexMapper.xml | 8 +--
.../main/resources/mapper/XcIndexMapper.xml | 1 +
.../securitycontrol-system/pom.xml | 6 ++-
.../system/VscSystemApplication.java | 4 +-
.../system/service/ExportSqlService.java | 5 --
.../system/service/SysLogServiceImpl.java | 5 +-
.../src/main/resources/bootstrap.yml | 15 +++---
38 files changed, 222 insertions(+), 88 deletions(-)
create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/config/CodeSheepEncryptorCfg.java
diff --git a/pom.xml b/pom.xml
index bebf581..ca97f5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,7 +75,6 @@
fastdfs-client
${tobato.version}
-
org.mybatis.spring.boot
diff --git a/securitycontrol-auth/pom.xml b/securitycontrol-auth/pom.xml
index 240b54b..3b5daac 100644
--- a/securitycontrol-auth/pom.xml
+++ b/securitycontrol-auth/pom.xml
@@ -12,6 +12,7 @@
securitycontrol-auth
+
com.alibaba.cloud
@@ -25,6 +26,11 @@
+
+ com.github.ulisesbocchio
+ jasypt-spring-boot-starter
+ 3.0.2
+
org.springframework.cloud
spring-cloud-loadbalancer
diff --git a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/VscAuthApplication.java b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/VscAuthApplication.java
index 9bb021c..f0d9cd3 100644
--- a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/VscAuthApplication.java
+++ b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/VscAuthApplication.java
@@ -1,5 +1,6 @@
package com.securitycontrol.auth;
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -12,6 +13,7 @@ import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
* @author czc
*/
@EnableRyFeignClients
+@EnableEncryptableProperties
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,MongoAutoConfiguration.class })
public class VscAuthApplication
{
diff --git a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysPasswordService.java b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysPasswordService.java
index 71c6f4e..62e442b 100644
--- a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysPasswordService.java
+++ b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysPasswordService.java
@@ -23,9 +23,9 @@ public class SysPasswordService
@Resource
private RedisService redisService;
- public int ERROR_TIMES=5;
+ public final static int ERROR_TIMES=5;
- public int LOCK_TIMES=5*60;
+ public final static int LOCK_TIMES=300;
private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
@@ -62,7 +62,6 @@ public class SysPasswordService
throw new ServiceException("用户不存在/密码错误",201);
} else {
- // redisService.deleteObject(username);
clearLoginRecordCache(username);
}
}
diff --git a/securitycontrol-auth/src/main/resources/bootstrap.yml b/securitycontrol-auth/src/main/resources/bootstrap.yml
index f38a0c5..9d58b7b 100644
--- a/securitycontrol-auth/src/main/resources/bootstrap.yml
+++ b/securitycontrol-auth/src/main/resources/bootstrap.yml
@@ -16,13 +16,13 @@ spring:
nacos:
discovery:
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
namespace: jjzhgd
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
namespace: jjzhgd
server-addr: 127.0.0.1:8848
# 配置文件格式
@@ -30,3 +30,7 @@ spring:
# 共享配置
shared-configs:
- vsc-dev.yml
+#加密组件
+jasypt:
+ encryptor:
+ password: Encrypt
diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/ExcelStyleUtil.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/ExcelStyleUtil.java
index 420b884..0b25857 100644
--- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/ExcelStyleUtil.java
+++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/ExcelStyleUtil.java
@@ -80,7 +80,6 @@ public class ExcelStyleUtil implements IExcelExportStyler {
*/
@Override
-
public CellStyle getStyles(boolean parity, ExcelExportEntity entity) {
return styles;
}
diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/JwtUtils.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/JwtUtils.java
index 88caec0..9fe4d10 100644
--- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/JwtUtils.java
+++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/JwtUtils.java
@@ -38,7 +38,11 @@ public class JwtUtils
*/
public static Claims parseToken(String token)
{
- return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
+ try{
+ return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
+ }catch (Exception e){
+ return null;
+ }
}
/**
diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/WordUtils.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/WordUtils.java
index 78af3d1..8fce6cc 100644
--- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/WordUtils.java
+++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/WordUtils.java
@@ -37,7 +37,7 @@ public class WordUtils {
private static Configuration configuration = null;
static {
- configuration = new Configuration();
+ configuration = new Configuration(Configuration.VERSION_2_3_30);
configuration.setDefaultEncoding("utf-8");
configuration.setClassForTemplateLoading(WordUtils.class, "/download/");
diff --git a/securitycontrol-commons/securitycontrol-commons-log/src/main/java/com/securitycontrol/common/log/aspect/OperLogAspect.java b/securitycontrol-commons/securitycontrol-commons-log/src/main/java/com/securitycontrol/common/log/aspect/OperLogAspect.java
index 4036166..8fb370b 100644
--- a/securitycontrol-commons/securitycontrol-commons-log/src/main/java/com/securitycontrol/common/log/aspect/OperLogAspect.java
+++ b/securitycontrol-commons/securitycontrol-commons-log/src/main/java/com/securitycontrol/common/log/aspect/OperLogAspect.java
@@ -159,13 +159,14 @@ public class OperLogAspect {
sysLog.setResult(0);
}
if(StringHelper.isEmpty(msg)){
- sysLog.setFailureReason("查询成功");
+ sysLog.setFailureReason("操作成功");
}else{
sysLog.setFailureReason(msg);
}
}
}else {
- sysLog.setFailureReason("查询成功");
+ sysLog.setResult(1);
+ sysLog.setFailureReason("操作成功");
}
}
asyncLogService.addSaveSysLog(sysLog);
diff --git a/securitycontrol-commons/securitycontrol-commons-redis/src/main/java/com/securitycontrol/common/redis/service/RedisService.java b/securitycontrol-commons/securitycontrol-commons-redis/src/main/java/com/securitycontrol/common/redis/service/RedisService.java
index 2bfc5ba..1f7cc85 100644
--- a/securitycontrol-commons/securitycontrol-commons-redis/src/main/java/com/securitycontrol/common/redis/service/RedisService.java
+++ b/securitycontrol-commons/securitycontrol-commons-redis/src/main/java/com/securitycontrol/common/redis/service/RedisService.java
@@ -93,6 +93,8 @@ public class RedisService
}
+
+
/**
* 获取有效时间
*
@@ -101,14 +103,18 @@ public class RedisService
*/
public long getExpireTimes(final String key) {
try{
+ long maxTime=240;
+ long maxTime2=180;
+ long maxTime3=120;
+ long maxTime4=60;
long time= redisTemplate.getExpire(key);
- if(time>240){
+ if(time>maxTime){
return 5;
- }else if(time>180){
+ }else if(time>maxTime2){
return 4;
- }else if(time>120){
+ }else if(time>maxTime3){
return 3;
- }else if(time>60){
+ }else if(time>maxTime4){
return 2;
}else{
return 1;
diff --git a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java
index 7fcdffa..b5601bb 100644
--- a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java
+++ b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java
@@ -48,6 +48,8 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
private String rnd = null;
public static String ur="/";
+
+ public static int max_length=4;
/**
* 越权 放权的请求 指定的前缀 -公共的请求+数据接口
*/
@@ -192,7 +194,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
return true;
}
String[] urls=requestUri.split(ur);
- if(urls.length>4){
+ if(urls.length>max_length){
requestUri=ur+urls[1]+ur+urls[2]+ur+urls[3];
}else {
String selected=ur+urls[1]+ur+urls[2]+ur;
diff --git a/securitycontrol-gateway/pom.xml b/securitycontrol-gateway/pom.xml
index 531edac..1ca66c5 100644
--- a/securitycontrol-gateway/pom.xml
+++ b/securitycontrol-gateway/pom.xml
@@ -22,7 +22,11 @@
org.springframework.cloud
spring-cloud-starter-gateway
-
+
+ com.github.ulisesbocchio
+ jasypt-spring-boot-starter
+ 3.0.2
+
com.alibaba.cloud
diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/GatewayApplication.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/GatewayApplication.java
index 3fb987f..1e7c659 100644
--- a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/GatewayApplication.java
+++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/GatewayApplication.java
@@ -1,5 +1,6 @@
package com.securitycontrol.gateway;
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -8,7 +9,9 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* springboot 网关服务
* @author HeiZi
*/
+
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
+@EnableEncryptableProperties
public class GatewayApplication {
public static void main(String[] args)
diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/AuthFilter.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/AuthFilter.java
index e07d005..30610a6 100644
--- a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/AuthFilter.java
+++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/AuthFilter.java
@@ -36,6 +36,8 @@ public class AuthFilter implements GlobalFilter, Ordered
{
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);
+ public static final String NULL_TOKEN="null";
+
/**
*
*/
@@ -56,7 +58,7 @@ public class AuthFilter implements GlobalFilter, Ordered
return chain.filter(exchange);
}
String token = getToken(request);
- if (StringUtils.isEmpty(token))
+ if (StringUtils.isEmpty(token) || NULL_TOKEN.equals(token))
{
return unauthorizedResponse(exchange, "令牌不能为空");
}
diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java
index 8a632c6..8bd6914 100644
--- a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java
+++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java
@@ -40,6 +40,8 @@ import java.util.Map;
@Slf4j
public class RequestCoverFilter implements GlobalFilter, Ordered {
+
+ public final static String APPLICATION_JSON_UTF8="application/json;charset=UTF-8";
/**
* default HttpMessageReader
*/
@@ -222,7 +224,7 @@ public class RequestCoverFilter implements GlobalFilter, Ordered {
MediaType contentType = headers.getContentType();
long contentLength = headers.getContentLength();
if (contentLength > 0) {
- if (MediaType.APPLICATION_JSON.equals(contentType) || MediaType.APPLICATION_JSON_UTF8.equals(contentType)) {
+ if (MediaType.APPLICATION_JSON.equals(contentType) || APPLICATION_JSON_UTF8.equals(contentType)) {
return readBody(exchange, chain, gatewayContext);
}
if (MediaType.APPLICATION_FORM_URLENCODED.equals(contentType)) {
@@ -233,4 +235,8 @@ public class RequestCoverFilter implements GlobalFilter, Ordered {
log.debug("[GatewayContext]ContentType:{},Gateway context is set with {}", contentType, gatewayContext);
return chain.filter(exchange);
}
-}
\ No newline at end of file
+ public static void main(String[] args) {
+ System.err.println(APPLICATION_JSON_UTF8);
+ }
+}
+
diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java
index 16c6060..1afb4d9 100644
--- a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java
+++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java
@@ -82,7 +82,7 @@ class RsaDecryptResponseGatewayFilterFactory extends AbstractGatewayFilterFactor
updateRequestParam(exchange);
}catch (Exception e){
log.error(e.toString(),e);
- return CommonConstant.buildResponse(exchange, HttpStatus.BAD_REQUEST.value(), "请求参数异常");
+ return CommonConstant.buildResponse(exchange, HttpStatus.BAD_REQUEST.value(), "请输入正确的请求参数");
}
}
//未强制加密
@@ -98,7 +98,7 @@ class RsaDecryptResponseGatewayFilterFactory extends AbstractGatewayFilterFactor
decrypBytes = decryptMsg.getBytes();
} catch (Exception e) {
log.error("数据 解密失败:{}", e);
- return CommonConstant.buildResponse(exchange, 201, "请求参数异常!");
+ return CommonConstant.buildResponse(exchange, 201, "请输入正确的请求参数!");
}
// 根据解密后的参数重新构建请求
DataBufferFactory dataBufferFactory = exchange.getResponse().bufferFactory();
diff --git a/securitycontrol-gateway/src/main/resources/bootstrap.yml b/securitycontrol-gateway/src/main/resources/bootstrap.yml
index f28e084..13a3e83 100644
--- a/securitycontrol-gateway/src/main/resources/bootstrap.yml
+++ b/securitycontrol-gateway/src/main/resources/bootstrap.yml
@@ -17,7 +17,7 @@ spring:
nacos:
discovery:
username: nacos
- password: nacos
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
namespace: jjzhgd
# 服务注册地址
server-addr: 127.0.0.1:8848
@@ -32,7 +32,7 @@ spring:
shared-configs:
- vsc-dev.yml
username: nacos
- password: nacos
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
namespace: jjzhgd
# server-addr: 10.138.132.188:18848
management:
@@ -50,4 +50,7 @@ endpoints:
enable: false
system:
jm: true
-
+#加密组件
+jasypt:
+ encryptor:
+ password: Encrypt
diff --git a/securitycontrol-model/securitycontrol-Interface/pom.xml b/securitycontrol-model/securitycontrol-Interface/pom.xml
index f8721f9..ac10486 100644
--- a/securitycontrol-model/securitycontrol-Interface/pom.xml
+++ b/securitycontrol-model/securitycontrol-Interface/pom.xml
@@ -33,6 +33,11 @@
com.securitycontrol
securitycontrol-commons-security
+
+ com.github.ulisesbocchio
+ jasypt-spring-boot-starter
+ 3.0.2
+
com.securitycontrol
securitycontrol-commons-swagger
diff --git a/securitycontrol-model/securitycontrol-Interface/src/main/java/com/securitycontrol/inter/VscInterApplication.java b/securitycontrol-model/securitycontrol-Interface/src/main/java/com/securitycontrol/inter/VscInterApplication.java
index 2a38137..1822a2e 100644
--- a/securitycontrol-model/securitycontrol-Interface/src/main/java/com/securitycontrol/inter/VscInterApplication.java
+++ b/securitycontrol-model/securitycontrol-Interface/src/main/java/com/securitycontrol/inter/VscInterApplication.java
@@ -4,6 +4,7 @@ package com.securitycontrol.inter;
import com.securitycontrol.common.security.annotation.EnableCustomConfig;
import com.securitycontrol.common.security.annotation.EnableRyFeignClients;
import com.securitycontrol.common.swagger.annotation.EnableCustomSwagger2;
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
@@ -19,6 +20,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableRyFeignClients
@SpringBootApplication(exclude = MongoAutoConfiguration.class )
@EnableScheduling
+@EnableEncryptableProperties
public class VscInterApplication {
public static void main(String[] args) {
SpringApplication.run(VscInterApplication.class, args);
diff --git a/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml
index ed56487..7d1707a 100644
--- a/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml
+++ b/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml
@@ -19,12 +19,12 @@ spring:
nacos:
discovery:
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
server-addr: 127.0.0.1:8848
namespace: jjzhgd
config:
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
namespace: jjzhgd
server-addr: 127.0.0.1:8848
# 配置文件格式
@@ -35,10 +35,7 @@ spring:
#加密组件
jasypt:
encryptor:
- bean: codeSheepEncryptorBean3
- property:
- prefix: CodeSheep(
- suffix: )
+ password: Encrypt
logging:
config: classpath:logback.xml
log:
diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/VscBackgroundApplication.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/VscBackgroundApplication.java
index 2247006..66be2ac 100644
--- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/VscBackgroundApplication.java
+++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/VscBackgroundApplication.java
@@ -3,6 +3,7 @@ package com.securitycontrol.background;
import com.securitycontrol.common.security.annotation.EnableCustomConfig;
import com.securitycontrol.common.security.annotation.EnableRyFeignClients;
import com.securitycontrol.common.swagger.annotation.EnableCustomSwagger2;
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
@@ -18,6 +19,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableRyFeignClients
@SpringBootApplication(exclude = MongoAutoConfiguration.class )
@EnableScheduling
+@EnableEncryptableProperties
public class VscBackgroundApplication {
public static void main(String[] args) {
SpringApplication.run(VscBackgroundApplication.class, args);
diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java
index a89bf7f..623b617 100644
--- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java
+++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java
@@ -255,19 +255,19 @@ public class TbAreaServiceImpl implements TbAreaService {
if(files==null || files.length<1){
return Result.fail("三维文件未上传");
}
- long allSIz=0;
+ long allSize=0;
for (int i = 0; i max_size){
- return Result.fail("文件过大,不允许超过30M");
+ if (allSize>max_size){
+ return Result.fail("文件过大,不允许超过40M");
}
String result=checkData(dto);
diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml
index dc66f4f..7d39758 100644
--- a/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml
+++ b/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml
@@ -21,12 +21,12 @@ spring:
server-addr: 127.0.0.1:8848
namespace: jjzhgd
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
config:
server-addr: 127.0.0.1:8848
namespace: jjzhgd
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
# 配置文件格式
file-extension: yml
# 共享配置
@@ -35,10 +35,8 @@ spring:
#加密组件
jasypt:
encryptor:
- bean: codeSheepEncryptorBean3
- property:
- prefix: CodeSheep(
- suffix: )
+ password: Encrypt
+
file:
# upload_path: /data/ahsbs/file
temp_file_path: E:\\tempFile
diff --git a/securitycontrol-model/securitycontrol-files/pom.xml b/securitycontrol-model/securitycontrol-files/pom.xml
index 9d69e6a..dc7c072 100644
--- a/securitycontrol-model/securitycontrol-files/pom.xml
+++ b/securitycontrol-model/securitycontrol-files/pom.xml
@@ -28,6 +28,11 @@
org.springframework.cloud
spring-cloud-loadbalancer
+
+ com.github.ulisesbocchio
+ jasypt-spring-boot-starter
+ 3.0.2
+
com.securitycontrol
securitycontrol-commons-security
diff --git a/securitycontrol-model/securitycontrol-files/src/main/java/com/securitycontrol/files/VscFileApplication.java b/securitycontrol-model/securitycontrol-files/src/main/java/com/securitycontrol/files/VscFileApplication.java
index 2fe54c6..266c1c8 100644
--- a/securitycontrol-model/securitycontrol-files/src/main/java/com/securitycontrol/files/VscFileApplication.java
+++ b/securitycontrol-model/securitycontrol-files/src/main/java/com/securitycontrol/files/VscFileApplication.java
@@ -4,6 +4,7 @@ import com.securitycontrol.common.security.annotation.EnableCustomConfig;
import com.securitycontrol.common.security.annotation.EnableRyFeignClients;
import com.securitycontrol.common.swagger.annotation.EnableCustomSwagger2;
import com.securitycontrol.files.mongodb.config.MongoConfig;
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -20,6 +21,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableRyFeignClients
@SpringBootApplication
@EnableScheduling
+@EnableEncryptableProperties
public class VscFileApplication
{
public static void main(String[] args)
diff --git a/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml
index d64f08a..d9b2914 100644
--- a/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml
+++ b/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml
@@ -20,36 +20,32 @@ spring:
server-addr: 127.0.0.1:8848
namespace: jjzhgd
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
config:
server-addr: 127.0.0.1:8848
namespace: jjzhgd
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- vsc-dev.yml
-# data:
-# mongodb:
-# host: 192.168.0.56
-# port: 27017
-# database: zhgd
-# username: zhgd
-# password: Bonus@admin123
data:
mongodb:
- host: 47.115.207.135
+ host: 192.168.0.56
port: 27017
- database: admin
- username: admin
- password: Bonus@admin123!
-
+ database: zhgd
+ username: zhgd
+ password: ENC(ci7FU+lq7Z9eEAUJLDFTEO/zXVfGN4g1iPHc5Mh5iIWONtM4wcl0lC1+t3nxiaEl)
+# data:
+# mongodb:
+# host: 47.115.207.135
+# port: 27017
+# database: admin
+# username: admin
+# password: Bonus@admin123!
#加密组件
jasypt:
encryptor:
- bean: codeSheepEncryptorBean3
- property:
- prefix: CodeSheep(
- suffix: )
+ password: Encrypt
diff --git a/securitycontrol-model/securitycontrol-screen/pom.xml b/securitycontrol-model/securitycontrol-screen/pom.xml
index 7dd33bd..16f5b99 100644
--- a/securitycontrol-model/securitycontrol-screen/pom.xml
+++ b/securitycontrol-model/securitycontrol-screen/pom.xml
@@ -90,6 +90,11 @@
com.securitycontrol
securitycontrol-commons-entity
+
+ com.github.ulisesbocchio
+ jasypt-spring-boot-starter
+ 3.0.2
+
com.securitycontrol
securitycontrol-system
diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java
index 3758ceb..25811f4 100644
--- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java
+++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java
@@ -3,11 +3,19 @@ package com.securitycontrol.screen;
import com.securitycontrol.common.security.annotation.EnableCustomConfig;
import com.securitycontrol.common.security.annotation.EnableRyFeignClients;
import com.securitycontrol.common.swagger.annotation.EnableCustomSwagger2;
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
+import org.jasypt.encryption.StringEncryptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
+import javax.annotation.Resource;
+
/**
* 系统模块
*
@@ -18,9 +26,48 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableRyFeignClients
@SpringBootApplication(exclude = MongoAutoConfiguration.class )
@EnableScheduling
-public class VscScreenApplication {
+@EnableEncryptableProperties
+public class VscScreenApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(VscScreenApplication.class, args);
System.out.println("智慧工地大屏管理模块启动成功!");
}
+
+
+ @Resource
+ private StringEncryptor encryptor;
+ @Autowired
+ private ApplicationContext applicationContext;
+ @Override
+ public void run(String... args) throws Exception {
+
+ Environment environment = applicationContext.getBean(Environment.class);
+
+ // 首先获取配置文件里的原始明文信息
+ // 根据自己配置文件中的密码读取路径自行更改
+ String oldPassword = environment.getProperty("spring.datasource.dynamic.datasource.master.password");
+ String nacosPwd = environment.getProperty("spring.cloud.nacos.discovery.password");
+ // 加密
+ String encryptPassword = encrypt( oldPassword );
+ String nacsopwdPass = encrypt( nacosPwd );
+ String mogodb = encrypt("Bonus@admin123" );
+ System.out.println( "mogodb原始明文密码加密后的结果为:" + mogodb );
+ // 打印加密前后的结果对比
+ System.out.println( "MySQL原始明文密码为:" + oldPassword );
+ System.out.println( "Nacos原始明文密码为:" + nacosPwd );
+ System.out.println( "====================================" );
+ System.out.println( "MySQL原始明文密码加密后的结果为:" + encryptPassword );
+ System.out.println( "Nacos原始明文密码加密后的结果为:" + nacsopwdPass );
+ }
+
+
+ private String encrypt( String originPassord ) {
+ return encryptor.encrypt( originPassord );
+ }
+
+ private String decrypt( String encryptedPassword ) {
+ return encryptor.decrypt( encryptedPassword );
+ }
+
+
}
diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/config/CodeSheepEncryptorCfg.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/config/CodeSheepEncryptorCfg.java
new file mode 100644
index 0000000..c83d577
--- /dev/null
+++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/config/CodeSheepEncryptorCfg.java
@@ -0,0 +1,32 @@
+package com.securitycontrol.screen.config;
+
+import org.jasypt.encryption.StringEncryptor;
+import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
+import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 自定义密码加密
+ * @author 黑子
+ */
+//@Configuration
+public class CodeSheepEncryptorCfg {
+
+ @Bean(name = "codeSheepEncryptorBean" )
+ public StringEncryptor codesheepStringEncryptor() {
+
+ PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
+ SimpleStringPBEConfig config = new SimpleStringPBEConfig();
+ config.setPassword("CodeSheep");
+ config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256");
+ config.setKeyObtentionIterations("1000");
+ config.setPoolSize("1");
+ config.setProviderName("SunJCE");
+ config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
+ config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
+ config.setStringOutputType("base64");
+ encryptor.setConfig(config);
+ return encryptor;
+ }
+}
diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ConstructionQualityImpl.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ConstructionQualityImpl.java
index 4e5be6b..8cfec0d 100644
--- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ConstructionQualityImpl.java
+++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ConstructionQualityImpl.java
@@ -107,9 +107,11 @@ public class ConstructionQualityImpl implements ConstructionQualityService {
* @author jjLv
* @date 2024/3/27 19:54
*/
+
+ public final static int NUM_MONTHS_IN_YEAR = 12;
@Override
public List getDetectionRecord(ConstructionQualityDto dto) {
- final int NUM_MONTHS_IN_YEAR = 12;
+
YearMonth currentYearMonth = YearMonth.now();
YearMonth[] lastTwelveMonths = new YearMonth[12];
for (int i = 0; i < NUM_MONTHS_IN_YEAR; i++) {
diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml
index 4f0512a..7c0d0e5 100644
--- a/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml
+++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml
@@ -21,24 +21,23 @@ spring:
server-addr: 127.0.0.1:8848
namespace: jjzhgd
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
config:
server-addr: 127.0.0.1:8848
namespace: jjzhgd
username: nacos
- password: Jjsp@nacos2023
+ password: ENC(F5JW7y8V4MGKsimz8gTPeKInjs3A8ool76KS4TVMFHhN94dB76BaWvMbM+6PZKwD)
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- vsc-dev.yml
+
#加密组件
jasypt:
encryptor:
- bean: codeSheepEncryptorBean3
- property:
- prefix: CodeSheep(
- suffix: )
+ password: Encrypt
+
diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml
index 38d2aab..a45dc1e 100644
--- a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml
+++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml
@@ -29,7 +29,8 @@
tcm.bid_code AS bidCode,
tcm.work_manager AS workManager
FROM t_class_metting tcm
- WHERE tcm.work_day = CURRENT_DATE AND tcm.del_flag = 0
+ WHERE tcm.del_flag = 0
+
diff --git a/securitycontrol-model/securitycontrol-system/pom.xml b/securitycontrol-model/securitycontrol-system/pom.xml
index 12ce27c..ff9c0b2 100644
--- a/securitycontrol-model/securitycontrol-system/pom.xml
+++ b/securitycontrol-model/securitycontrol-system/pom.xml
@@ -91,7 +91,11 @@
org.springframework
spring-web
-
+
+ com.github.ulisesbocchio
+ jasypt-spring-boot-starter
+ 3.0.2
+
net.logstash.logback
diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/VscSystemApplication.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/VscSystemApplication.java
index 4455fcb..a316edf 100644
--- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/VscSystemApplication.java
+++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/VscSystemApplication.java
@@ -1,9 +1,8 @@
package com.securitycontrol.system;
-
-
import com.securitycontrol.common.security.annotation.EnableCustomConfig;
import com.securitycontrol.common.security.annotation.EnableRyFeignClients;
import com.securitycontrol.common.swagger.annotation.EnableCustomSwagger2;
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
@@ -19,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableRyFeignClients
@EnableScheduling
@SpringBootApplication(exclude = MongoAutoConfiguration.class )
+@EnableEncryptableProperties
public class VscSystemApplication {
public static void main(String[] args) {
SpringApplication.run(VscSystemApplication.class, args);
diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/ExportSqlService.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/ExportSqlService.java
index fa7d6cf..3dba02e 100644
--- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/ExportSqlService.java
+++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/ExportSqlService.java
@@ -38,11 +38,6 @@ public class ExportSqlService {
@Value("${sql.filePath}")
private String filePath;
- /**
- * 数据库名
- */
- @Value("${sql.dbname}")
- private String database_name;
@Resource
diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/SysLogServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/SysLogServiceImpl.java
index 1a6ac65..d95cbf6 100644
--- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/SysLogServiceImpl.java
+++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/SysLogServiceImpl.java
@@ -170,9 +170,8 @@ public class SysLogServiceImpl implements ISysLogService {
}
return Result.ok("设置成功","'设置成功'");
}
-
+ public final static String SUCCESS="成功";
/**
- *
* @param dto
* @return
*/
@@ -180,7 +179,7 @@ public class SysLogServiceImpl implements ISysLogService {
public Result