升级java17
This commit is contained in:
parent
facfaf5232
commit
2114d6642c
|
@ -1,10 +0,0 @@
|
||||||
# 默认忽略的文件
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# 基于编辑器的 HTTP 客户端请求
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
# GitHub Copilot persisted chat sessions
|
|
||||||
/copilot/chatSessions
|
|
|
@ -17,24 +17,19 @@
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
<bytecodeTargetLevel>
|
<bytecodeTargetLevel>
|
||||||
<module name="admin-api" target="1.8" />
|
<module name="xxl-job-admin" target="1.8" />
|
||||||
<module name="common-redis" target="1.8" />
|
|
||||||
</bytecodeTargetLevel>
|
</bytecodeTargetLevel>
|
||||||
</component>
|
</component>
|
||||||
<component name="JavacSettings">
|
<component name="JavacSettings">
|
||||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
<module name="admin-api" options="-parameters" />
|
|
||||||
<module name="admin-boot" options="-parameters" />
|
<module name="admin-boot" options="-parameters" />
|
||||||
<module name="common-base" options="-parameters" />
|
<module name="common-base" options="-parameters" />
|
||||||
<module name="common-mybatis-plus" options="-parameters" />
|
<module name="common-mybatis-plus" options="-parameters" />
|
||||||
<module name="common-redis" options="-parameters" />
|
|
||||||
<module name="common-web" options="-parameters" />
|
<module name="common-web" options="-parameters" />
|
||||||
<module name="hoe-admin" options="" />
|
|
||||||
<module name="hoe-auth" options="-parameters" />
|
<module name="hoe-auth" options="-parameters" />
|
||||||
<module name="hoe-common" options="" />
|
|
||||||
<module name="hoe-gateway" options="-parameters" />
|
<module name="hoe-gateway" options="-parameters" />
|
||||||
<module name="hoe-order" options="-parameters" />
|
<module name="hoe-order" options="-parameters" />
|
||||||
<module name="hoe-recovery" options="" />
|
<module name="xxl-job-admin" options="-parameters" />
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -11,15 +11,20 @@
|
||||||
<option name="name" value="rdc-releases" />
|
<option name="name" value="rdc-releases" />
|
||||||
<option name="url" value="https://packages.aliyun.com/maven/repository/2129281-release-rn0pJN/" />
|
<option name="url" value="https://packages.aliyun.com/maven/repository/2129281-release-rn0pJN/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="rdc-snapshots" />
|
<option name="id" value="rdc-snapshots" />
|
||||||
<option name="name" value="rdc-snapshots" />
|
<option name="name" value="rdc-snapshots" />
|
||||||
<option name="url" value="https://packages.aliyun.com/maven/repository/2129281-snapshot-71ZAnr/" />
|
<option name="url" value="https://packages.aliyun.com/maven/repository/2129281-snapshot-71ZAnr/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="central" />
|
<option name="id" value="Sonatype" />
|
||||||
<option name="name" value="Central Repository" />
|
<option name="name" value="Sonatype Repository" />
|
||||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
<option name="url" value="http://repository.sonatype.org/content/groups/public/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="central" />
|
<option name="id" value="central" />
|
||||||
|
@ -31,6 +36,11 @@
|
||||||
<option name="name" value="JBoss Community repository" />
|
<option name="name" value="JBoss Community repository" />
|
||||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://maven.aliyun.com/nexus/content/groups/public" />
|
||||||
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="com.e-iceblue" />
|
<option name="id" value="com.e-iceblue" />
|
||||||
<option name="name" value="com.e-iceblue" />
|
<option name="name" value="com.e-iceblue" />
|
||||||
|
|
|
@ -5,17 +5,19 @@
|
||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/xxl-job-admin/pom.xml" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
<option name="ignoredFiles">
|
<option name="ignoredFiles">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$/hoe-admin/admin-api/pom.xml" />
|
<option value="$PROJECT_DIR$/hoe-admin/admin-api/pom.xml" />
|
||||||
<option value="$PROJECT_DIR$/hoe-common/common-redis/pom.xml" />
|
<option value="$PROJECT_DIR$/hoe-common/common-redis/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/xxl-job-admin/pom.xml" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -12,8 +12,8 @@
|
||||||
<artifactId>admin-boot</artifactId>
|
<artifactId>admin-boot</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -36,6 +36,19 @@
|
||||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 添加Hibernate Validator依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.validator</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>6.2.0.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 添加Hibernate Validator依赖所需的依赖项 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish</groupId>
|
||||||
|
<artifactId>jakarta.el</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 注册中心 -->
|
<!-- 注册中心 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
@ -108,13 +121,9 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.nimbusds</groupId>
|
<groupId>com.nimbusds</groupId>
|
||||||
<artifactId>nimbus-jose-jwt</artifactId>
|
<artifactId>nimbus-jose-jwt</artifactId>
|
||||||
|
<version>9.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.recovery</groupId>
|
|
||||||
<artifactId>common-redis</artifactId>
|
|
||||||
<version>${hoe-version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.recovery</groupId>
|
<groupId>com.recovery</groupId>
|
||||||
<artifactId>common-mybatis-plus</artifactId>
|
<artifactId>common-mybatis-plus</artifactId>
|
||||||
|
@ -125,6 +134,10 @@
|
||||||
<artifactId>common-web</artifactId>
|
<artifactId>common-web</artifactId>
|
||||||
<version>${hoe-version}</version>
|
<version>${hoe-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.validation</groupId>
|
||||||
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.springframework</groupId>-->
|
<!-- <groupId>org.springframework</groupId>-->
|
||||||
<!-- <artifactId>spring-webmvc</artifactId>-->
|
<!-- <artifactId>spring-webmvc</artifactId>-->
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
package com.recovery.admin.boot.config.ds;
|
package com.recovery.admin.boot.config.ds;
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
|
|
||||||
import com.recovery.common.base.ds.DynamicDataSource;
|
import com.recovery.common.base.ds.DynamicDataSource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
@ -66,7 +65,7 @@ public class DataSourceConfig {
|
||||||
map.put("master", masterDataSource);
|
map.put("master", masterDataSource);
|
||||||
dynamicDataSource.setTargetDataSources(map);
|
dynamicDataSource.setTargetDataSources(map);
|
||||||
//设置默认数据源
|
//设置默认数据源
|
||||||
// dynamicDataSource.setDefaultTargetDataSource(masterDataSource);
|
dynamicDataSource.setDefaultTargetDataSource(masterDataSource);
|
||||||
//
|
//
|
||||||
return dynamicDataSource;
|
return dynamicDataSource;
|
||||||
}
|
}
|
||||||
|
@ -76,10 +75,13 @@ public class DataSourceConfig {
|
||||||
public SqlSessionFactory sqlSessionFactory(
|
public SqlSessionFactory sqlSessionFactory(
|
||||||
@Qualifier("commonDataSource") DataSource dynamicDataSource)
|
@Qualifier("commonDataSource") DataSource dynamicDataSource)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
// SqlSessionFactoryBean
|
||||||
|
// bean = new SqlSessionFactoryBean();
|
||||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||||
bean.setDataSource(dynamicDataSource);
|
bean.setDataSource(dynamicDataSource);
|
||||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver()
|
bean.setMapperLocations(new PathMatchingResourcePatternResolver()
|
||||||
.getResources(DataSourceConfig.MAPPER_LOCATION));
|
.getResources(DataSourceConfig.MAPPER_LOCATION));
|
||||||
|
bean.setTransactionFactory(new SpringManagedTransactionFactory());
|
||||||
return bean.getObject();
|
return bean.getObject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
//package com.recovery.admin.boot.config.ds;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
|
//import io.seata.rm.datasource.DataSourceProxy;
|
||||||
|
//import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
//import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
//import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
|
||||||
|
//import org.springframework.beans.factory.annotation.Value;
|
||||||
|
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
//import org.springframework.context.annotation.Bean;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
|
//
|
||||||
|
//import javax.sql.DataSource;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
////使用seata对DataSource进行代理
|
||||||
|
//@Configuration
|
||||||
|
//public class DataSourceProxyConfig {
|
||||||
|
//
|
||||||
|
// //mapper.xml路径
|
||||||
|
// static final String MAPPER_LOCATION = "classpath:mapper/*.xml";
|
||||||
|
//
|
||||||
|
// //手动配置bean
|
||||||
|
// @Bean
|
||||||
|
// @ConfigurationProperties(prefix = "master.datasource")
|
||||||
|
// public DataSource druidDataSource(){
|
||||||
|
//
|
||||||
|
// return new DruidDataSource();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Bean
|
||||||
|
// public SqlSessionFactory sessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
|
||||||
|
// MybatisSqlSessionFactoryBean sessionFactoryBean = new MybatisSqlSessionFactoryBean();
|
||||||
|
// sessionFactoryBean.setDataSource(dataSourceProxy);
|
||||||
|
// sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
|
||||||
|
// //事务管理工厂
|
||||||
|
// sessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
|
||||||
|
// return sessionFactoryBean.getObject();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Bean
|
||||||
|
// public DataSourceProxy dataSource() {
|
||||||
|
// DataSource source = druidDataSource();
|
||||||
|
// return new DataSourceProxy(druidDataSource());
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -1,35 +0,0 @@
|
||||||
//package com.recovery.admin.boot.controller;
|
|
||||||
//
|
|
||||||
//import cn.hutool.core.bean.BeanUtil;
|
|
||||||
//import cn.hutool.core.lang.Assert;
|
|
||||||
//
|
|
||||||
//import com.recovery.admin.boot.entity.SysOauthClient;
|
|
||||||
//import com.recovery.admin.boot.service.ISysOauthClientService;
|
|
||||||
//
|
|
||||||
//import com.recovery.common.base.dto.OAuth2ClientDTO;
|
|
||||||
//import com.recovery.common.base.result.ApiResult;
|
|
||||||
//import lombok.AllArgsConstructor;
|
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
|
||||||
//import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
//import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
//import org.springframework.web.bind.annotation.RestController;
|
|
||||||
///**
|
|
||||||
// * @author:
|
|
||||||
// */
|
|
||||||
//@RequestMapping("/api/oauth-clients")
|
|
||||||
//@Slf4j
|
|
||||||
//@AllArgsConstructor
|
|
||||||
//@RestController
|
|
||||||
//public class OauthClientController {
|
|
||||||
// private ISysOauthClientService iSysOauthClientService;
|
|
||||||
//
|
|
||||||
// @GetMapping("/getOAuth2ClientById")
|
|
||||||
// public ApiResult<OAuth2ClientDTO> getOAuth2ClientById(@RequestParam String clientId) {
|
|
||||||
// SysOauthClient client = iSysOauthClientService.getById(clientId);
|
|
||||||
// Assert.notNull(client, "OAuth2 客户端不存在");
|
|
||||||
// OAuth2ClientDTO oAuth2ClientDTO = new OAuth2ClientDTO();
|
|
||||||
// BeanUtil.copyProperties(client, oAuth2ClientDTO);
|
|
||||||
// return ApiResult.ok(oAuth2ClientDTO);
|
|
||||||
// }
|
|
||||||
//}
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.recovery.admin.boot.controller;
|
package com.recovery.admin.boot.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.recovery.admin.boot.service.IMemberUserService;
|
|
||||||
import com.recovery.admin.boot.service.UserService;
|
import com.recovery.admin.boot.service.UserService;
|
||||||
|
|
||||||
import com.recovery.common.base.dto.MemberUserAuthDTO;
|
import com.recovery.common.base.dto.MemberUserAuthDTO;
|
||||||
|
@ -22,7 +21,6 @@ public class UserController {
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
private final IMemberUserService memberUserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
|
@ -32,13 +30,5 @@ public class UserController {
|
||||||
UserAuthDTO user = userService.getByUsername(username);
|
UserAuthDTO user = userService.getByUsername(username);
|
||||||
return ApiResult.ok(user);
|
return ApiResult.ok(user);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 获取会员用户信息
|
|
||||||
*/
|
|
||||||
@GetMapping("/member/username/{username}")
|
|
||||||
public ApiResult<MemberUserAuthDTO> getMemberUserByUsername(@PathVariable String username) {
|
|
||||||
log.info("获取member user info。。。");
|
|
||||||
MemberUserAuthDTO user = memberUserService.getByUsername(username);
|
|
||||||
return ApiResult.ok(user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,20 @@ public class testController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/cs")
|
@GetMapping("/cs")
|
||||||
public ApiResult<UserAuthDTO> cs(@RequestParam String name, HttpServletRequest request) {
|
public ApiResult<UserAuthDTO> cs(@RequestParam String name, HttpServletRequest request) {
|
||||||
User user = new User();
|
try {
|
||||||
user.setUserName("测试库");
|
User user = new User();
|
||||||
user.setPhone("123");
|
user.setUserName("测试库");
|
||||||
userService.add(user);
|
user.setPhone("123");
|
||||||
|
List<User> list = userService.list();
|
||||||
|
log.info("测试库:"+list.size());
|
||||||
|
}catch (Exception e) {
|
||||||
|
return ApiResult.failed(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
// UserAuthDTO authDTO = userService.getByUsername(name);
|
// UserAuthDTO authDTO = userService.getByUsername(name);
|
||||||
// List<User> l = userService.list();
|
// List<User> l = userService.list();
|
||||||
|
|
||||||
// log.info("测试库:"+authDTO.getStatus());
|
// log.info("测试库:"+authDTO.getStatus());
|
||||||
// log.info("111获取线程的数据=="+HspHostUtil.getHspHost());
|
// log.info("111获取线程的数据=="+HspHostUtil.getHspHost());
|
||||||
// log.info("获取登陆值去除------"+ UtilTools.getUserId() +"");
|
// log.info("获取登陆值去除------"+ UtilTools.getUserId() +"");
|
||||||
|
@ -67,7 +74,7 @@ public class testController {
|
||||||
// log.info("cs异常"+e.getMessage(),e);
|
// log.info("cs异常"+e.getMessage(),e);
|
||||||
// return ApiResult.failed("cs异常");
|
// return ApiResult.failed("cs异常");
|
||||||
// }
|
// }
|
||||||
return ApiResult.failed("cs异常");
|
return ApiResult.ok();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,20 +27,6 @@ public class JwtInterceptor implements HandlerInterceptor {
|
||||||
public JwtInterceptor() {}
|
public JwtInterceptor() {}
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
response.setHeader( "Set-Cookie" , "cookiename=httponlyTest;Path=/;Domain=domainvalue;Max-Age=seconds;HTTPOnly");
|
|
||||||
response.setHeader( "Content-Security-Policy" , "default-src 'self'; script-src 'self'; frame-ancestors 'self'");
|
|
||||||
response.setHeader("Access-Control-Allow-Origin", (request).getHeader("Origin"));
|
|
||||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
|
||||||
response.setHeader("Referrer-Policy","no-referrer");
|
|
||||||
response.setContentType("application/json");
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
// 如果请求的header里面的SA-SAME-TOKEN 值和Authorization 值一样,就视为是内部接口调用,就直接返回ture
|
|
||||||
// 不在进行认证的相关逻辑。为什么相等时就视为是内部接口调用呢?请看上面的第一部分的feign拦截器的写法。
|
|
||||||
String saSameId = request.getHeader("SA-SAME-TOKEN");
|
|
||||||
String stoken = request.getHeader("Authorization");
|
|
||||||
if(saSameId.equals(stoken)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 获取当前token(这个token获取的是请求头的token,也可以用 request 获取)
|
// 获取当前token(这个token获取的是请求头的token,也可以用 request 获取)
|
||||||
String token = StpUtil.getTokenValue();
|
String token = StpUtil.getTokenValue();
|
||||||
long tokenTimeout = StpUtil.getTokenTimeout();// 获取过期时间
|
long tokenTimeout = StpUtil.getTokenTimeout();// 获取过期时间
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.recovery.admin.boot.listener;
|
package com.recovery.admin.boot.listener;
|
||||||
|
|
||||||
|
|
||||||
import com.recovery.admin.boot.service.ISysPermissionService;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
@ -15,7 +14,6 @@ import org.springframework.stereotype.Component;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class InitResourcePermissionCache implements CommandLineRunner {
|
public class InitResourcePermissionCache implements CommandLineRunner {
|
||||||
|
|
||||||
private ISysPermissionService iSysPermissionService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String... args) {
|
public void run(String... args) {
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.recovery.admin.boot.mapper;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.recovery.admin.boot.entity.MemberUser;
|
|
||||||
|
|
||||||
import com.recovery.common.base.dto.MemberUserAuthDTO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface MemberUserMapper extends BaseMapper<MemberUser> {
|
|
||||||
|
|
||||||
MemberUserAuthDTO getByUsername(@Param("userName") String userName);
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package com.recovery.admin.boot.mapper;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.recovery.admin.boot.entity.SysOauthClient;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SysOauthClientMapper extends BaseMapper<SysOauthClient> {
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.recovery.admin.boot.mapper;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.recovery.admin.boot.entity.SysPermission;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SysPermissionMapper extends BaseMapper<SysPermission> {
|
|
||||||
|
|
||||||
List<SysPermission> listPermRoles();
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.recovery.admin.boot.rest;
|
package com.recovery.admin.boot.rest;
|
||||||
|
|
||||||
|
|
||||||
import com.recovery.admin.boot.service.IMemberUserService;
|
|
||||||
import com.recovery.admin.boot.service.UserService;
|
import com.recovery.admin.boot.service.UserService;
|
||||||
import com.recovery.common.base.dto.MemberUserAuthDTO;
|
import com.recovery.common.base.dto.MemberUserAuthDTO;
|
||||||
import com.recovery.common.base.dto.UserAuthDTO;
|
import com.recovery.common.base.dto.UserAuthDTO;
|
||||||
|
@ -21,8 +20,7 @@ public class UserRest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
|
||||||
private IMemberUserService memberUserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
|
@ -35,13 +33,4 @@ public class UserRest {
|
||||||
}
|
}
|
||||||
return ApiResult.ok(user);
|
return ApiResult.ok(user);
|
||||||
}
|
}
|
||||||
/**12
|
|
||||||
* 获取会员用户信息
|
|
||||||
*/
|
|
||||||
@GetMapping("/member/username/{username}")
|
|
||||||
public ApiResult<MemberUserAuthDTO> getMemberUserByUsername(@RequestParam(value = "username") String username) {
|
|
||||||
log.info("获取member user info。。。");
|
|
||||||
MemberUserAuthDTO user = memberUserService.getByUsername(username);
|
|
||||||
return ApiResult.ok(user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.recovery.admin.boot.service;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.recovery.admin.boot.entity.MemberUser;
|
|
||||||
import com.recovery.common.base.dto.MemberUserAuthDTO;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
public interface IMemberUserService extends IService<MemberUser> {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户名获取认证用户信息,携带角色和密码
|
|
||||||
*
|
|
||||||
* @param username
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
MemberUserAuthDTO getByUsername(String username);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.recovery.admin.boot.service;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.recovery.admin.boot.entity.SysOauthClient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
public interface ISysOauthClientService extends IService<SysOauthClient> {
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.recovery.admin.boot.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.recovery.admin.boot.entity.SysPermission;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
public interface ISysPermissionService extends IService<SysPermission> {
|
|
||||||
/**
|
|
||||||
* 刷新Redis缓存中角色菜单的权限规则,角色和菜单信息变更调用
|
|
||||||
*/
|
|
||||||
boolean refreshPermRolesRules();
|
|
||||||
|
|
||||||
List<SysPermission> listPermRoles();
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.recovery.admin.boot.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.recovery.admin.boot.entity.MemberUser;
|
|
||||||
import com.recovery.admin.boot.mapper.MemberUserMapper;
|
|
||||||
import com.recovery.admin.boot.service.IMemberUserService;
|
|
||||||
|
|
||||||
import com.recovery.common.base.dto.MemberUserAuthDTO;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberUser> implements IMemberUserService {
|
|
||||||
@Override
|
|
||||||
public MemberUserAuthDTO getByUsername(String username) {
|
|
||||||
MemberUserAuthDTO memberUserAuthDTO = this.baseMapper.getByUsername(username);
|
|
||||||
return memberUserAuthDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.recovery.admin.boot.service.impl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.recovery.admin.boot.entity.SysOauthClient;
|
|
||||||
import com.recovery.admin.boot.mapper.SysOauthClientMapper;
|
|
||||||
import com.recovery.admin.boot.service.ISysOauthClientService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SysOauthClientServiceImpl extends ServiceImpl<SysOauthClientMapper, SysOauthClient> implements ISysOauthClientService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
package com.recovery.admin.boot.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.recovery.admin.boot.entity.SysPermission;
|
|
||||||
import com.recovery.admin.boot.mapper.SysPermissionMapper;
|
|
||||||
import com.recovery.admin.boot.service.ISysPermissionService;
|
|
||||||
import com.recovery.common.base.constant.GlobalConstants;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author:
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements ISysPermissionService {
|
|
||||||
|
|
||||||
private final RedisTemplate redisTemplate;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean refreshPermRolesRules() {
|
|
||||||
redisTemplate.delete(Arrays.asList(GlobalConstants.URL_PERM_ROLES_KEY));
|
|
||||||
List<SysPermission> permissions = this.listPermRoles();
|
|
||||||
if (CollectionUtil.isNotEmpty(permissions)) {
|
|
||||||
// 初始化URL- 角色规则
|
|
||||||
List<SysPermission> urlPermList = permissions.stream()
|
|
||||||
.filter(item -> StrUtil.isNotBlank(item.getUrlPerm()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(urlPermList)) {
|
|
||||||
Map<String, List<String>> urlPermRoles = new HashMap<>();
|
|
||||||
urlPermList.stream().forEach(item -> {
|
|
||||||
String perm = item.getUrlPerm();
|
|
||||||
List<String> roles = item.getRoles();
|
|
||||||
urlPermRoles.put(perm, roles);
|
|
||||||
});
|
|
||||||
redisTemplate.opsForHash().putAll(GlobalConstants.URL_PERM_ROLES_KEY, urlPermRoles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SysPermission> listPermRoles() {
|
|
||||||
return this.baseMapper.listPermRoles();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,11 +11,13 @@ import com.recovery.common.base.dto.UserAuthDTO;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author:
|
* @author:
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@ -29,9 +31,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void add(User user) {
|
public void add(User user) {
|
||||||
user.setId(2l);
|
user.setUserName("123");
|
||||||
this.baseMapper.deleteById(user);
|
this.baseMapper.insert(user);
|
||||||
String sc= orderFeignClient.test();
|
String sc= orderFeignClient.test();
|
||||||
|
|
||||||
System.out.println("123");
|
System.out.println("123");
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
spring:
|
spring:
|
||||||
# datasource:
|
datasource:
|
||||||
# dynamic:
|
dynamic:
|
||||||
# seata: true
|
seata: true
|
||||||
application:
|
application:
|
||||||
name: hoe-admin
|
name: hoe-admin
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
|
allow-circular-references: true
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# metadata:
|
metadata:
|
||||||
# serviceGroup: ytChen
|
serviceGroup: cpp
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
config:
|
config:
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
prefix: hoe-admin
|
prefix: hoe-admin
|
||||||
group: dev
|
group: dev
|
||||||
|
@ -83,7 +84,7 @@ server:
|
||||||
#分布式事务
|
#分布式事务
|
||||||
#seata:
|
#seata:
|
||||||
# enabled: true
|
# enabled: true
|
||||||
# enable-auto-data-source-proxy: true
|
# enable-auto-data-source-proxy: false
|
||||||
# config:
|
# config:
|
||||||
# type: nacos
|
# type: nacos
|
||||||
# nacos:
|
# nacos:
|
||||||
|
@ -92,6 +93,7 @@ server:
|
||||||
# username: nacos
|
# username: nacos
|
||||||
# password: nacos
|
# password: nacos
|
||||||
# data-id: seataServer.properties
|
# data-id: seataServer.properties
|
||||||
|
# namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
# registry:
|
# registry:
|
||||||
# type: nacos
|
# type: nacos
|
||||||
# nacos:
|
# nacos:
|
||||||
|
@ -100,3 +102,4 @@ server:
|
||||||
# group: SEATA_GROUP
|
# group: SEATA_GROUP
|
||||||
# username: nacos
|
# username: nacos
|
||||||
# password: nacos
|
# password: nacos
|
||||||
|
# namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,21 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 添加Hibernate Validator依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.validator</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>6.2.0.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 添加Hibernate Validator依赖所需的依赖项 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish</groupId>
|
||||||
|
<artifactId>jakarta.el</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Sa-Token 权限认证, 在线文档:https://sa-token.cc -->
|
<!-- Sa-Token 权限认证, 在线文档:https://sa-token.cc -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
package com.recovery.auth.config.ds;
|
//package com.recovery.auth.config.ds;
|
||||||
|
//
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
//import com.alibaba.druid.pool.DruidDataSource;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
//import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
//import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
//import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
//import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
//import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
|
//
|
||||||
import javax.sql.DataSource;
|
//import javax.sql.DataSource;
|
||||||
|
//
|
||||||
//@Configuration
|
////@Configuration
|
||||||
//// 扫描 Mapper 接口并容器管理
|
////// 扫描 Mapper 接口并容器管理
|
||||||
//@MapperScan(basePackages = TeachingDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "teachingSqlSessionFactory")
|
////@MapperScan(basePackages = TeachingDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "teachingSqlSessionFactory")
|
||||||
public class TeachingDataSourceConfig {
|
//public class TeachingDataSourceConfig {
|
||||||
// 精确到 auth 目录,以便跟其他数据源隔离
|
// // 精确到 auth 目录,以便跟其他数据源隔离
|
||||||
static final String PACKAGE = "com.recovery.auth.dao.mapper";
|
// static final String PACKAGE = "com.recovery.auth.dao.mapper";
|
||||||
static final String MAPPER_LOCATION = "classpath:mapper/*.xml";
|
// static final String MAPPER_LOCATION = "classpath:mapper/*.xml";
|
||||||
|
//
|
||||||
@Value("${admin.datasource.url}")
|
// @Value("${admin.datasource.url}")
|
||||||
private String url;
|
// private String url;
|
||||||
|
//
|
||||||
@Value("${admin.datasource.username}")
|
// @Value("${admin.datasource.username}")
|
||||||
private String user;
|
// private String user;
|
||||||
|
//
|
||||||
@Value("${admin.datasource.password}")
|
// @Value("${admin.datasource.password}")
|
||||||
private String password;
|
// private String password;
|
||||||
|
//
|
||||||
@Value("${admin.datasource.driverClassName}")
|
// @Value("${admin.datasource.driverClassName}")
|
||||||
private String driverClass;
|
// private String driverClass;
|
||||||
|
//
|
||||||
@Bean(name = "adminDataSource")
|
// @Bean(name = "adminDataSource")
|
||||||
public DataSource cpdDataSource() {
|
// public DataSource cpdDataSource() {
|
||||||
DruidDataSource dataSource = new DruidDataSource();
|
// DruidDataSource dataSource = new DruidDataSource();
|
||||||
dataSource.setDriverClassName(driverClass);
|
// dataSource.setDriverClassName(driverClass);
|
||||||
dataSource.setUrl(url);
|
// dataSource.setUrl(url);
|
||||||
dataSource.setUsername(user);
|
// dataSource.setUsername(user);
|
||||||
dataSource.setPassword(password);
|
// dataSource.setPassword(password);
|
||||||
return dataSource;
|
// return dataSource;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Bean(name = "adminTransactionManager")
|
// @Bean(name = "adminTransactionManager")
|
||||||
public DataSourceTransactionManager courseTransactionManager() {
|
// public DataSourceTransactionManager courseTransactionManager() {
|
||||||
return new DataSourceTransactionManager(cpdDataSource());
|
// return new DataSourceTransactionManager(cpdDataSource());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Bean(name = "adminSqlSessionFactory")
|
// @Bean(name = "adminSqlSessionFactory")
|
||||||
public SqlSessionFactory cpdSqlSessionFactory(@Qualifier("adminDataSource") DataSource cpdDataSource)
|
// public SqlSessionFactory cpdSqlSessionFactory(@Qualifier("adminDataSource") DataSource cpdDataSource)
|
||||||
throws Exception {
|
// throws Exception {
|
||||||
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
||||||
sessionFactory.setDataSource(cpdDataSource);
|
// sessionFactory.setDataSource(cpdDataSource);
|
||||||
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
|
// sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
|
||||||
.getResources(TeachingDataSourceConfig.MAPPER_LOCATION));
|
// .getResources(TeachingDataSourceConfig.MAPPER_LOCATION));
|
||||||
return sessionFactory.getObject();
|
// return sessionFactory.getObject();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -4,17 +4,18 @@ spring:
|
||||||
name: hoe-auth
|
name: hoe-auth
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
|
allow-circular-references: true
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
metadata:
|
# metadata:
|
||||||
serviceGroup: ytChen
|
# serviceGroup: ytChen
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
config:
|
config:
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
prefix: hoe-auth
|
prefix: hoe-auth
|
||||||
group: dev
|
group: dev
|
||||||
|
|
|
@ -4,17 +4,18 @@ spring:
|
||||||
name: hoe-auth
|
name: hoe-auth
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
|
allow-circular-references: true
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
metadata:
|
# metadata:
|
||||||
serviceGroup: ytChen
|
# serviceGroup: ytChen
|
||||||
server-addr: localhost:8848
|
server-addr: 192.168.110.210:8848
|
||||||
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
config:
|
config:
|
||||||
server-addr: localhost:8848
|
server-addr: 192.168.110.210:8848
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
prefix: hoe-auth
|
prefix: hoe-auth
|
||||||
group: dev
|
group: dev
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -30,7 +30,7 @@ public class DBInfo implements Serializable {
|
||||||
|
|
||||||
private String module;
|
private String module;
|
||||||
|
|
||||||
private String hospitalHost;
|
private String dbHost;
|
||||||
|
|
||||||
private String hospitalCode;
|
private String dbCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,8 @@ public final class EncryptUtil {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static byte[] hex2byte(byte[] b) {
|
private static byte[] hex2byte(byte[] b) {
|
||||||
if ((b.length % 2) != 0)
|
if ((b.length % 2) != 0){
|
||||||
throw new IllegalArgumentException("长度不是偶数");
|
throw new IllegalArgumentException("长度不是偶数");}
|
||||||
byte[] b2 = new byte[b.length / 2];
|
byte[] b2 = new byte[b.length / 2];
|
||||||
for (int n = 0; n < b.length; n += 2) {
|
for (int n = 0; n < b.length; n += 2) {
|
||||||
String item = new String(b, n, 2);
|
String item = new String(b, n, 2);
|
||||||
|
@ -116,10 +116,11 @@ public final class EncryptUtil {
|
||||||
String stmp = "";
|
String stmp = "";
|
||||||
for (int n = 0; n < b.length; n++) {
|
for (int n = 0; n < b.length; n++) {
|
||||||
stmp = (Integer.toHexString(b[n] & 0XFF));
|
stmp = (Integer.toHexString(b[n] & 0XFF));
|
||||||
if (stmp.length() == 1)
|
if (stmp.length() == 1){
|
||||||
hs = hs + "0" + stmp;
|
hs = hs + "0" + stmp;
|
||||||
else
|
} else {
|
||||||
hs = hs + stmp;
|
hs = hs + stmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return hs.toUpperCase();
|
return hs.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class HspHostUtil {
|
||||||
* @param dbInfo
|
* @param dbInfo
|
||||||
*/
|
*/
|
||||||
public static void switchDB(DBInfo dbInfo,StringRedisTemplate redisTemplate){
|
public static void switchDB(DBInfo dbInfo,StringRedisTemplate redisTemplate){
|
||||||
String host = dbInfo.getHospitalCode();
|
String host = dbInfo.getDbCode();
|
||||||
String dataSourceKey = "dynamic-slave"+"_"+host;
|
String dataSourceKey = "dynamic-slave"+"_"+host;
|
||||||
Map<Object, Object> dataSourceMap = DynamicDataSource.getInstance().getDataSourceMap();
|
Map<Object, Object> dataSourceMap = DynamicDataSource.getInstance().getDataSourceMap();
|
||||||
if (!dataSourceMap.containsKey(dataSourceKey)) {
|
if (!dataSourceMap.containsKey(dataSourceKey)) {
|
||||||
|
|
|
@ -438,7 +438,7 @@ public class UtilTools {
|
||||||
public static String formatNum(Object num, String format){
|
public static String formatNum(Object num, String format){
|
||||||
if(null==num){
|
if(null==num){
|
||||||
return "";
|
return "";
|
||||||
}else if(null==format || format.equals("")){
|
}else if(null==format || "".equals(format)){
|
||||||
return num.toString();
|
return num.toString();
|
||||||
}
|
}
|
||||||
DecimalFormat df = new DecimalFormat(format);
|
DecimalFormat df = new DecimalFormat(format);
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class RedisUtils {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static DBInfo getDBInfoByHostAndModule(StringRedisTemplate redisTemplate, String host, String module){
|
public static DBInfo getDBInfoByHostAndModule(StringRedisTemplate redisTemplate, String host, String module){
|
||||||
log.info("查询数据库:"+"hoe:hospital:dbInfo:"+host+"_"+module);
|
log.info("查询数据库:"+"hoe:common:dbInfo:"+host+"_"+module);
|
||||||
String dbStr = redisTemplate.opsForValue().get("hoe:hospital:dbInfo:"+host+"_"+module);
|
String dbStr = redisTemplate.opsForValue().get("hoe:common:dbInfo:"+host+"_"+module);
|
||||||
if(UtilTools.isNotEmpty(dbStr)){
|
if(UtilTools.isNotEmpty(dbStr)){
|
||||||
return JSONObject.parseObject(dbStr, DBInfo.class);
|
return JSONObject.parseObject(dbStr, DBInfo.class);
|
||||||
}else{
|
}else{
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -11,26 +11,26 @@
|
||||||
|
|
||||||
<artifactId>common-redis</artifactId>
|
<artifactId>common-redis</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<!-- <dependencies>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.recovery</groupId>
|
<!-- <groupId>com.recovery</groupId>-->
|
||||||
<artifactId>common-base</artifactId>
|
<!-- <artifactId>common-base</artifactId>-->
|
||||||
<version>${hoe-version}</version>
|
<!-- <version>${hoe-version}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.apache.commons</groupId>
|
<!-- <groupId>org.apache.commons</groupId>-->
|
||||||
<artifactId>commons-pool2</artifactId>
|
<!-- <artifactId>commons-pool2</artifactId>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<!-- <artifactId>spring-boot-configuration-processor</artifactId>-->
|
||||||
<optional>true</optional>
|
<!-- <optional>true</optional>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
</dependencies>
|
<!-- </dependencies>-->
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -45,6 +45,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.nimbusds</groupId>
|
<groupId>com.nimbusds</groupId>
|
||||||
<artifactId>nimbus-jose-jwt</artifactId>
|
<artifactId>nimbus-jose-jwt</artifactId>
|
||||||
|
<version>9.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Sentinel流量控制、熔断降级 -->
|
<!-- Sentinel流量控制、熔断降级 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class FeignConfig {
|
||||||
String name = headerNames.nextElement();
|
String name = headerNames.nextElement();
|
||||||
String values = request.getHeader(name);
|
String values = request.getHeader(name);
|
||||||
//将请求头保存到模板中
|
//将请求头保存到模板中
|
||||||
if (!name.equalsIgnoreCase("serviceName")){
|
if (!"serviceName".equalsIgnoreCase(name)){
|
||||||
template.header(name, values);
|
template.header(name, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -13,7 +13,7 @@
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>common-base</module>
|
<module>common-base</module>
|
||||||
<module>common-redis</module>
|
<!-- <module>common-redis</module>-->
|
||||||
<module>common-mybatis-plus</module>
|
<module>common-mybatis-plus</module>
|
||||||
<module>common-web</module>
|
<module>common-web</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
<artifactId>hoe-gateway</artifactId>
|
<artifactId>hoe-gateway</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class DataInitTask {
|
||||||
public void initHospitalDB(){
|
public void initHospitalDB(){
|
||||||
try {
|
try {
|
||||||
JdbcTemplate jdbcTemplate=new JdbcTemplate(generateDataSource());
|
JdbcTemplate jdbcTemplate=new JdbcTemplate(generateDataSource());
|
||||||
List<Map<String,Object>> mapList = jdbcTemplate.queryForList("SELECT id,db_name,db_ip,db_port,db_user,db_passwd,`module`,hospital_host,hospital_code FROM db_info");
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList("SELECT id,db_name,db_ip,db_port,db_user,db_passwd,`module`,db_host,db_code FROM db_info");
|
||||||
if(mapList.size() > 0){
|
if(mapList.size() > 0){
|
||||||
Map<String,List<DBInfo>> dbMap = new HashMap<>();
|
Map<String,List<DBInfo>> dbMap = new HashMap<>();
|
||||||
for(Map<String,Object> map : mapList){
|
for(Map<String,Object> map : mapList){
|
||||||
|
@ -47,11 +47,11 @@ public class DataInitTask {
|
||||||
dbInfo.setDbPasswd(map.get("db_passwd").toString());
|
dbInfo.setDbPasswd(map.get("db_passwd").toString());
|
||||||
dbInfo.setModule(map.get("module").toString());
|
dbInfo.setModule(map.get("module").toString());
|
||||||
|
|
||||||
if(map.get("hospital_host") != null) {
|
if(map.get("db_host") != null) {
|
||||||
dbInfo.setHospitalHost(map.get("hospital_host").toString());
|
dbInfo.setDbHost(map.get("db_host").toString());
|
||||||
}
|
}
|
||||||
dbInfo.setHospitalCode((String)map.get("hospital_code"));
|
dbInfo.setDbCode((String)map.get("db_code"));
|
||||||
String codeKey = "hoe:hospital:dbInfo:"+dbInfo.getHospitalCode()+"_"+dbInfo.getModule();
|
String codeKey = "hoe:common:dbInfo:"+dbInfo.getDbCode()+"_"+dbInfo.getModule();
|
||||||
redisCache.put(codeKey, JSONObject.toJSONString(dbInfo));
|
redisCache.put(codeKey, JSONObject.toJSONString(dbInfo));
|
||||||
/** 废弃host字段 迁移至新表 website_info
|
/** 废弃host字段 迁移至新表 website_info
|
||||||
if(UtilTools.isNotEmpty(dbInfo.getModule()) && dbInfo.getModule().equals("common")){
|
if(UtilTools.isNotEmpty(dbInfo.getModule()) && dbInfo.getModule().equals("common")){
|
||||||
|
@ -69,7 +69,7 @@ public class DataInitTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbMap.forEach((k,v)->{
|
dbMap.forEach((k,v)->{
|
||||||
String redisKey = "hoe:hospital:dbs:"+k;
|
String redisKey = "hoe:dbs:"+k;
|
||||||
redisCache.put(redisKey,JSONObject.toJSONString(v));
|
redisCache.put(redisKey,JSONObject.toJSONString(v));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# metadata:
|
# metadata:
|
||||||
# serviceGroup: ytChen
|
# serviceGroup: ytChen
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
config:
|
config:
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
prefix: hoe-gateway
|
prefix: hoe-gateway
|
||||||
group: dev
|
group: dev
|
||||||
|
|
|
@ -11,10 +11,10 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# metadata:
|
# metadata:
|
||||||
# serviceGroup: ytChen
|
# serviceGroup: ytChen
|
||||||
server-addr: localhost:8848
|
server-addr: 192.168.110.210:8848
|
||||||
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
config:
|
config:
|
||||||
server-addr: localhost:8848
|
server-addr: 192.168.110.210:8848
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
prefix: hoe-gateway
|
prefix: hoe-gateway
|
||||||
group: dev
|
group: dev
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -12,8 +12,8 @@
|
||||||
<artifactId>hoe-order</artifactId>
|
<artifactId>hoe-order</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -57,8 +57,24 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.nimbusds</groupId>
|
<groupId>com.nimbusds</groupId>
|
||||||
<artifactId>nimbus-jose-jwt</artifactId>
|
<artifactId>nimbus-jose-jwt</artifactId>
|
||||||
|
<version>9.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 添加Hibernate Validator依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.validator</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>6.2.0.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 添加Hibernate Validator依赖所需的依赖项 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish</groupId>
|
||||||
|
<artifactId>jakarta.el</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.persistence</groupId>
|
<groupId>javax.persistence</groupId>
|
||||||
<artifactId>javax.persistence-api</artifactId>
|
<artifactId>javax.persistence-api</artifactId>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.recovery.order;
|
package com.recovery.order;
|
||||||
|
|
||||||
import com.dtp.core.spring.EnableDynamicTp;
|
import com.dtp.core.spring.EnableDynamicTp;
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
@ -79,6 +80,7 @@ public class DataSourceConfig {
|
||||||
bean.setDataSource(dynamicDataSource);
|
bean.setDataSource(dynamicDataSource);
|
||||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver()
|
bean.setMapperLocations(new PathMatchingResourcePatternResolver()
|
||||||
.getResources(DataSourceConfig.MAPPER_LOCATION));
|
.getResources(DataSourceConfig.MAPPER_LOCATION));
|
||||||
|
bean.setTransactionFactory(new SpringManagedTransactionFactory());
|
||||||
return bean.getObject();
|
return bean.getObject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.recovery.order.mapper.OrderInMapper;
|
||||||
import com.recovery.order.service.OrderInService;
|
import com.recovery.order.service.OrderInService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -23,8 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
public class OrderInServiceImpl extends ServiceImpl<OrderInMapper, OrderIn> implements OrderInService {
|
public class OrderInServiceImpl extends ServiceImpl<OrderInMapper, OrderIn> implements OrderInService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// @Transactional
|
@Transactional
|
||||||
// @GlobalTransactional
|
// @GlobalTransactional(rollbackFor = Exception.class)
|
||||||
public boolean saveOrderIn(OrderIn orderIn) {
|
public boolean saveOrderIn(OrderIn orderIn) {
|
||||||
orderIn.setIsDeleted(0);
|
orderIn.setIsDeleted(0);
|
||||||
orderIn.setUserId(1L);
|
orderIn.setUserId(1L);
|
||||||
|
|
|
@ -4,6 +4,7 @@ spring:
|
||||||
name: hoe-order
|
name: hoe-order
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
|
allow-circular-references: true
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
cloud:
|
cloud:
|
||||||
|
@ -11,10 +12,10 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# metadata:
|
# metadata:
|
||||||
# serviceGroup: ytChen
|
# serviceGroup: ytChen
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
config:
|
config:
|
||||||
server-addr: 192.168.110.209:8848
|
server-addr: 192.168.110.210:8848
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
prefix: hoe-order
|
prefix: hoe-order
|
||||||
group: dev
|
group: dev
|
||||||
|
@ -25,7 +26,7 @@ server:
|
||||||
#分布式事务
|
#分布式事务
|
||||||
#seata:
|
#seata:
|
||||||
# enabled: true
|
# enabled: true
|
||||||
# enable-auto-data-source-proxy: true
|
# enable-auto-data-source-proxy: false
|
||||||
# config:
|
# config:
|
||||||
# type: nacos
|
# type: nacos
|
||||||
# nacos:
|
# nacos:
|
||||||
|
@ -34,6 +35,7 @@ server:
|
||||||
# username: nacos
|
# username: nacos
|
||||||
# password: nacos
|
# password: nacos
|
||||||
# data-id: seataServer.properties
|
# data-id: seataServer.properties
|
||||||
|
# namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
# registry:
|
# registry:
|
||||||
# type: nacos
|
# type: nacos
|
||||||
# nacos:
|
# nacos:
|
||||||
|
@ -42,3 +44,4 @@ server:
|
||||||
# group: SEATA_GROUP
|
# group: SEATA_GROUP
|
||||||
# username: nacos
|
# username: nacos
|
||||||
# password: nacos
|
# password: nacos
|
||||||
|
# namespace: 11bfd099-10d6-4f2c-b969-58b76e435cce
|
||||||
|
|
16
pom.xml
16
pom.xml
|
@ -17,12 +17,12 @@
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<spring-cloud.version>2020.0.3</spring-cloud.version>
|
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||||
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
||||||
<spring-boot.version>2.5.4</spring-boot.version>
|
<spring-boot.version>2.7.5</spring-boot.version>
|
||||||
<hoe-version>1.0.0</hoe-version>
|
<hoe-version>1.0.0</hoe-version>
|
||||||
<hutool-version>5.7.14</hutool-version>
|
<hutool-version>5.7.14</hutool-version>
|
||||||
<mysql.version>8.0.22</mysql.version>
|
<mysql.version>8.0.22</mysql.version>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.5.4</version>
|
<version>2.7.5</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<!-- 公共依赖-->
|
<!-- 公共依赖-->
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
|
@ -80,6 +81,11 @@
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>cglib</groupId>-->
|
||||||
|
<!-- <artifactId>cglib</artifactId>-->
|
||||||
|
<!-- <version>3.3.0</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- Spring Cloud Alibaba 相关依赖-->
|
<!-- Spring Cloud Alibaba 相关依赖-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
Loading…
Reference in New Issue