From 76db14cf235cf04e1634e78115ed13a61c915a40 Mon Sep 17 00:00:00 2001 From: aa1214761728 Date: Fri, 5 Nov 2021 10:43:33 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3=E7=94=A8=E6=88=B7=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/cetc32/dh/config/DataManageConfig.java | 2 +- .../java/com/cetc32/dh/controller/rest/AuthRoleController.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cetc32/dh/config/DataManageConfig.java b/src/main/java/com/cetc32/dh/config/DataManageConfig.java index d2b8efd..5804a78 100644 --- a/src/main/java/com/cetc32/dh/config/DataManageConfig.java +++ b/src/main/java/com/cetc32/dh/config/DataManageConfig.java @@ -113,7 +113,7 @@ public class DataManageConfig implements WebMvcConfigurer { //是否发送Cookie信息 .allowCredentials(true) //放行哪些原始域(请求方式) - .allowedMethods("GET","POST", "PUT", "DELETE") + .allowedMethods("GET","POST", "PUT", "DELETE","OPTIONS") //放行哪些原始域(头部信息) .allowedHeaders("*") //暴露哪些头部信息(因为跨域访问默认不能获取全部头部信息) diff --git a/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java b/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java index f682fc7..e697ce4 100644 --- a/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java +++ b/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java @@ -75,6 +75,9 @@ public class AuthRoleController { } if(newRole.getId() == null){ BaseAdminRole br=new BaseAdminRole(); + if(newRole.getSystemMenu().stream().noneMatch(f-> f==("SOOO接口用户"))){ + newRole.getSystemMenu().add("S000接口服务"); + } BeanUtils.copyProperties(newRole, br); //新增角色 if(adminRoleService.addRole(br)>0) -- Gitee From 3fb6492905166f24e7d4782e680361e0426be495 Mon Sep 17 00:00:00 2001 From: aa1214761728 Date: Fri, 5 Nov 2021 13:06:41 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=94=A8=E6=88=B7=E6=9D=83=E9=99=90=EF=BC=8C?= =?UTF-8?q?=E5=8F=8A=E5=90=AF=E5=8A=A8=E6=97=B6=E6=9B=B4=E6=96=B0=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/rest/AuthRoleController.java | 12 ++- src/main/resources/application-xwybjb.yml | 76 +++++++++++++++++++ src/main/resources/mapper/SysInfoMapper.xml | 2 +- 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/application-xwybjb.yml diff --git a/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java b/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java index e697ce4..f6ef882 100644 --- a/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java +++ b/src/main/java/com/cetc32/dh/controller/rest/AuthRoleController.java @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; @@ -29,6 +30,9 @@ import java.util.Map; @RestController @RequestMapping("/rest/role/") public class AuthRoleController { + @Value("${sso.basePermission}") + String basePermission; + @Autowired AdminRoleServiceImpl adminRoleService; @@ -75,9 +79,10 @@ public class AuthRoleController { } if(newRole.getId() == null){ BaseAdminRole br=new BaseAdminRole(); - if(newRole.getSystemMenu().stream().noneMatch(f-> f==("SOOO接口用户"))){ - newRole.getSystemMenu().add("S000接口服务"); + if(newRole.getSystemMenu().stream().noneMatch(f-> f==(basePermission))){ + newRole.getSystemMenu().add(basePermission); } + System.out.println("权限个数"+newRole.getSystemMenu().size()); BeanUtils.copyProperties(newRole, br); //新增角色 if(adminRoleService.addRole(br)>0) @@ -115,6 +120,9 @@ public class AuthRoleController { } } BaseAdminRole br=new BaseAdminRole(); + if(role.getSystemMenu().stream().noneMatch(f-> f==(basePermission))){ + role.getSystemMenu().add(basePermission); + } BeanUtils.copyProperties(role, br); if(adminRoleService.updateRole(br)>0) { diff --git a/src/main/resources/application-xwybjb.yml b/src/main/resources/application-xwybjb.yml new file mode 100644 index 0000000..48f9dd0 --- /dev/null +++ b/src/main/resources/application-xwybjb.yml @@ -0,0 +1,76 @@ +server: + port: 8081 + server: + connectionTimeout: 18000000 + +spring: + application: + name: dhManager + datasource: + url: jdbc:postgresql://180.184.65.203:5432/dhmanage + #url: jdbc:postgresql://192.168.1.60:5432/dhmanage + username: postgres + #password: 123456 + password: Zdk@824. + driver-class-name: org.postgresql.Driver + +# datasource: +# url: jdbc:mysql://localhost:3306/dhmanage?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8 +# username: root +# password: 123 +# initial-size: 1 +# min-idle: 1 +# max-active: 20 +# test-on-borrow: true +# driver-class-name: com.mysql.cj.jdbc.Driver +# type: com.zaxxer.hikari.HikariDataSource + + servlet: + multipart: + max-file-size: 5GB + max-request-size: 5GB + +#设置静态资源路径,多个以逗号分隔 + resources: + static-locations: classpath:static/,file:static/ + thymeleaf: + cache: false + mode: HTML +mybatis: + mapper-locations: classpath:mapper/*.xml + type-aliases-package: com.cetc32.dh.entity.* #对应实体类的包名 + configuration: + map-underscore-to-camel-case: true #配置驼峰命名转换 在进行sql查询和初始化实体时mybatis会为我们自动转化 + +generator: + targetProject: src/main/java + mappers: tk.mybatis.mapper.common.Mapper + javaModel-targetPackage: com.cetc32.dh.entity + sqlMap-targetPackage: mapper + javaClient-targetPackage: com.cetc32.dh.mybatis +logging: + level: + com.cetc32: debug + +storePath: /root/ +upLoadPath: ${storePath}upLoad + +rootPath: /root/daohang/data +myPath: ${rootPath}myPath +writePath: ${rootPath}/product +eip: http://192.168.1.209:8080/ +#verifyUrl: ${sso.authcenter}/rest/auth/verify?token= +#passportUrl: ${sso.authcenter}/?ReturnUrl= +#defaultLoginRequiredEnable: false +sso: + authcenter: http://192.168.43.138:8081 + verifyUrl: ${sso.authcenter}/rest/auth/verify?token= + passportUrl: ${sso.authcenter}/?ReturnUrl= + defaultLoginRequiredEnable: false + permission: S000^接口用户@/rest/auth/**;*权限管理@/**; + sysurl : http://192.168.43.138:${server.port} + sysname : 用户中心 + registerUrl : ${sso.authcenter}/rest/api/sys/sync + #loginInclude: /rest/auth/**,/rest/role/**,/rest/audit/** + syscode: S000 + basePermission: S000接口用户 diff --git a/src/main/resources/mapper/SysInfoMapper.xml b/src/main/resources/mapper/SysInfoMapper.xml index cf79384..78199d0 100644 --- a/src/main/resources/mapper/SysInfoMapper.xml +++ b/src/main/resources/mapper/SysInfoMapper.xml @@ -25,7 +25,7 @@ insert into sysinfos(syscode,sysname,pcode,url) values(#{sysCode},#{sysName},#{pCode},#{url}) - on conflict (syscode) do update set sysname =#{sysName},url = #{url} + on conflict (syscode) do update set sysname =#{sysName},url = #{url},pcode =#{pCode}