1
0

6 کامیت‌ها 0a667ef685 ... f5cd82037a

نویسنده SHA1 پیام تاریخ
  rainwer f5cd82037a Merge branch 'feature/management' into feature/develop 5 ماه پیش
  rainwer 040d8b75b2 多门店管理 5 ماه پیش
  rainwer 71e21c5eb0 修改数据库到v3 5 ماه پیش
  rainwer 0d0f52ba46 Merge branch 'feature/master' 5 ماه پیش
  rainwer 6a00867399 添加本地配置文件 6 ماه پیش
  rainwer e3e88725ae 修改jar运行参数 6 ماه پیش

+ 2 - 1
Dockerfile

@@ -14,6 +14,7 @@ ADD ./jar/ezhizao_yzbh_sys.jar /jar
 EXPOSE 8040
 
 #  启动系统服务
-ENTRYPOINT ["java", "-XX:+UseG1GC", "-Xms128m","-Xmx256m","-Xmn64m","-Xss1024k","-jar","/jar/ezhizao_yzbh_sys.jar"]
+ENTRYPOINT ["java","-Xms512m","-Xmx512m","-Xmn64m","-Xss1024k","-jar","/jar/ezhizao_yzbh_sys.jar"]
+
 
 

+ 16 - 4
src/main/java/cn/ezhizao/framework/web/controller/BaseController.java

@@ -22,6 +22,7 @@ import com.github.pagehelper.PageInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.WebDataBinder;
 import org.springframework.web.bind.annotation.InitBinder;
 
@@ -235,7 +236,11 @@ public class BaseController
     protected Long getTenantId() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         if(!user.isAdmin()){
-            return user.getTenantId();
+            if(!CollectionUtils.isEmpty(user.getRoles()) && user.getRoles().stream().filter(role -> role.getRoleId() == 2).findAny().isPresent()) {
+                return Long.parseLong(request.getHeader("tenantId"));
+            } else {
+                return user.getTenantId();
+            }
         } else {
             return Long.parseLong(request.getHeader("tenantId"));
         }
@@ -244,9 +249,16 @@ public class BaseController
     protected <T> void setTenantId(T t) throws NoSuchFieldException, IllegalAccessException {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         if(!user.isAdmin()){
-            Field field =  t.getClass().getDeclaredField("tenantId");
-            field.setAccessible(true);
-            field.set(t, user.getTenantId());
+            if(!CollectionUtils.isEmpty(user.getRoles()) && user.getRoles().stream().filter(role -> role.getRoleId() == 2).findAny().isPresent()) {
+                Long tenantId = Long.parseLong(request.getHeader("tenantId"));
+                Field field =  t.getClass().getDeclaredField("tenantId");
+                field.setAccessible(true);
+                field.set(t, tenantId);
+            } else {
+                Field field =  t.getClass().getDeclaredField("tenantId");
+                field.setAccessible(true);
+                field.set(t, user.getTenantId());
+            }
         } else {
             Long tenantId = Long.parseLong(request.getHeader("tenantId"));
 //            Long tenantId = SecurityUtils.getLoginUser().getTenantId();

+ 1 - 1
src/main/resources/application-linux.yml

@@ -33,7 +33,7 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://172.18.0.1:3306/ezhizao_yzbh_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=GMT%2B8&connectTimeout=360000&socketTimeout=360000
+                url: jdbc:mysql://172.18.0.1:3306/ezhizao_yzbh_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=GMT%2B8&connectTimeout=360000&socketTimeout=360000
                 username: root
                 password: ezhizao.cn123456
             # 从库数据源

+ 82 - 0
src/main/resources/application-local.yml

@@ -0,0 +1,82 @@
+# 数据源配置
+spring:
+    cloud:
+        nacos:
+            discovery:
+                server-addr: 120.46.59.90:19848
+    application:
+        name: ezhizao-yzbh-sys
+    # redis 配置
+    redis:
+        # 地址
+        host: 120.46.59.90
+        # 端口,默认为6379
+        port: 16379
+        # 数据库索引
+        database: 8
+        # 密码
+        password: ezhizao.cn123456
+        # 连接超时时间
+        timeout: 10s
+        lettuce:
+            pool:
+                # 连接池中的最小空闲连接
+                min-idle: 0
+                # 连接池中的最大空闲连接
+                max-idle: 8
+                # 连接池的最大数据库连接数
+                max-active: 8
+                # #连接池最大阻塞等待时间(使用负值表示没有限制)
+                max-wait: -1ms
+    datasource:
+        type: com.alibaba.druid.pool.DruidDataSource
+        driverClassName: com.mysql.cj.jdbc.Driver
+        druid:
+            # 主库数据源
+            master:
+                url: jdbc:mysql://120.46.59.90:3306/ezhizao_yzbh_v2_0327?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&rewriteBatchedStatements=true&serverTimezone=GMT%2B8&connectTimeout=360000&socketTimeout=360000
+                username: root
+                password: ezhizao.cn123456
+            # 初始连接数
+            initialSize: 5
+            # 最小连接池数量
+            minIdle: 10
+            # 最大连接池数量
+            maxActive: 20
+            # 配置获取连接等待超时的时间
+            maxWait: 60000
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+            timeBetweenEvictionRunsMillis: 60000
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
+            minEvictableIdleTimeMillis: 300000
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
+            maxEvictableIdleTimeMillis: 900000
+            # 配置检测连接是否有效
+            validationQuery: SELECT 1 FROM DUAL
+            testWhileIdle: true
+            testOnBorrow: false
+            testOnReturn: false
+            webStatFilter:
+                enabled: true
+            statViewServlet:
+                enabled: true
+                # 设置白名单,不填则允许所有访问
+                allow:
+                url-pattern: /druid/*
+                # 控制台管理用户名和密码
+                login-username: ezhizao
+                login-password: 123456
+            filter:
+                stat:
+                    enabled: true
+                    # 慢SQL记录
+                    log-slow-sql: true
+                    slow-sql-millis: 1000
+                    merge-sql: true
+                wall:
+                    config:
+                        multi-statement-allow: true
+            socket-timeout: 3600000
+# 文件上传
+ruoyi:
+    profile: /home/ruoyi/yzbh/