Merge pull request 'build : dubbo版本改为3.2.1' (#29) from master into gateway
Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/29
This commit is contained in:
@@ -96,10 +96,7 @@ trigger:
|
|||||||
- code-gen
|
- code-gen
|
||||||
- custom-query
|
- custom-query
|
||||||
- sentinel-dashboard
|
- sentinel-dashboard
|
||||||
- sentinel-dashboard-pro
|
|
||||||
- code-gen-test-mysql
|
|
||||||
- workflow
|
- workflow
|
||||||
- flowable
|
|
||||||
|
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
@@ -70,8 +70,9 @@ public class MenuController {
|
|||||||
return Result.ok(optionMenuVo);
|
return Result.ok(optionMenuVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取树形接口的option")
|
@ApiOperation("菜单详情")
|
||||||
@GetMapping("/info/{menuId}")
|
@GetMapping("/info/{menuId}")
|
||||||
|
@PreAuthorize("@ss.hasPermission('admin:menu:info')")
|
||||||
public Result<MenuVo> info(@PathVariable Long menuId) {
|
public Result<MenuVo> info(@PathVariable Long menuId) {
|
||||||
ObjectUtils.checkPk(menuId);
|
ObjectUtils.checkPk(menuId);
|
||||||
MenuVo menu = menuService.searchByMenuId(menuId);
|
MenuVo menu = menuService.searchByMenuId(menuId);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class UserController {
|
|||||||
return Result.ok(userChooseList);
|
return Result.ok(userChooseList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取用户列表")
|
@ApiOperation("获取用户详情")
|
||||||
@GetMapping("/info/{userId}")
|
@GetMapping("/info/{userId}")
|
||||||
@PreAuthorize("@ss.hasPermission('admin:user:info')")
|
@PreAuthorize("@ss.hasPermission('admin:user:info')")
|
||||||
public Result<UserDetailVo> info(@PathVariable Long userId) {
|
public Result<UserDetailVo> info(@PathVariable Long userId) {
|
||||||
@@ -200,7 +200,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("建立角色用户绑定关系")
|
@ApiOperation("建立岗位用户绑定关系")
|
||||||
@PutMapping("/bind/post")
|
@PutMapping("/bind/post")
|
||||||
@PreAuthorize("@ss.hasPermission('admin:user:bindPost')")
|
@PreAuthorize("@ss.hasPermission('admin:user:bindPost')")
|
||||||
@Log(title = "建立角色用户绑定关系", businessType = BusinessType.UPDATE)
|
@Log(title = "建立角色用户绑定关系", businessType = BusinessType.UPDATE)
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.fateverse.admin.entity;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.vo.IpBackVo;
|
||||||
|
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||||
|
import cn.fateverse.common.core.entity.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Clay
|
||||||
|
* @date 2023-10-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EnableAutoField
|
||||||
|
public class IpBack extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* ip地址
|
||||||
|
*/
|
||||||
|
private String ipAddr;
|
||||||
|
/**
|
||||||
|
* ip类型 ipv4 ipv6
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public IpBackVo toIPBackVo(){
|
||||||
|
return IpBackVo.builder()
|
||||||
|
.id(id)
|
||||||
|
.ipAddr(ipAddr)
|
||||||
|
.type(type)
|
||||||
|
.createTime(getCreateTime())
|
||||||
|
.remark(getRemark())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -87,19 +87,23 @@ public class MappingSwitchVo {
|
|||||||
private String operName;
|
private String operName;
|
||||||
|
|
||||||
public static MappingSwitchVo toMappingSwitchVo(MappingSwitchInfo mappingSwitchInfo) {
|
public static MappingSwitchVo toMappingSwitchVo(MappingSwitchInfo mappingSwitchInfo) {
|
||||||
return MappingSwitchVo.builder()
|
MappingSwitchVo mappingSwitchVo = MappingSwitchVo.builder()
|
||||||
.key(mappingSwitchInfo.getKey())
|
.key(mappingSwitchInfo.getKey())
|
||||||
.applicationName(mappingSwitchInfo.getApplicationName())
|
.applicationName(mappingSwitchInfo.getApplicationName())
|
||||||
.className(mappingSwitchInfo.getClassName())
|
.className(mappingSwitchInfo.getClassName())
|
||||||
.description(mappingSwitchInfo.getDescription())
|
.description(mappingSwitchInfo.getDescription())
|
||||||
.methodName(mappingSwitchInfo.getMethodName())
|
.methodName(mappingSwitchInfo.getMethodName())
|
||||||
.uris(mappingSwitchInfo.getUris())
|
.uris(mappingSwitchInfo.getUris())
|
||||||
.type(mappingSwitchInfo.getType().toString())
|
|
||||||
.httpMethods(mappingSwitchInfo.getHttpMethods())
|
.httpMethods(mappingSwitchInfo.getHttpMethods())
|
||||||
.state(mappingSwitchInfo.getState())
|
.state(mappingSwitchInfo.getState())
|
||||||
.operName(mappingSwitchInfo.getOperName())
|
.operName(mappingSwitchInfo.getOperName())
|
||||||
.operTime(mappingSwitchInfo.getOperTime())
|
.operTime(mappingSwitchInfo.getOperTime())
|
||||||
.build();
|
.build();
|
||||||
|
MappingSwitchInfo.MappingSwitchType switchType = mappingSwitchInfo.getType();
|
||||||
|
if (switchType != null) {
|
||||||
|
mappingSwitchVo.setType(switchType.name());
|
||||||
|
}
|
||||||
|
return mappingSwitchVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.fateverse.admin.service.impl;
|
package cn.fateverse.admin.service.impl;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.entity.Dept;
|
||||||
import cn.fateverse.common.core.entity.PageInfo;
|
import cn.fateverse.common.core.entity.PageInfo;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
import cn.fateverse.common.core.utils.TableSupport;
|
import cn.fateverse.common.core.utils.TableSupport;
|
||||||
@@ -35,7 +36,7 @@ public class OnlineUserServiceImpl implements OnlineUserService {
|
|||||||
* todo 现阶段一次性将所有用户全部返回,后期想办法进行分页操作
|
* todo 现阶段一次性将所有用户全部返回,后期想办法进行分页操作
|
||||||
*
|
*
|
||||||
* @param place
|
* @param place
|
||||||
* @param username
|
* @param username 用户名
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -72,19 +73,25 @@ public class OnlineUserServiceImpl implements OnlineUserService {
|
|||||||
@Override
|
@Override
|
||||||
public void force(String tokenId) {
|
public void force(String tokenId) {
|
||||||
redisTemplate.delete(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
redisTemplate.delete(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||||
|
redisTemplate.delete(CacheConstants.ROUTE_CACHE_KEY + tokenId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OnlineUser toOnlineUser(LoginUser user) {
|
private OnlineUser toOnlineUser(LoginUser user) {
|
||||||
return OnlineUser.builder()
|
OnlineUser onlineUser = OnlineUser.builder()
|
||||||
.tokenId(user.getUuid())
|
.tokenId(user.getUuid())
|
||||||
.username(user.getUsername())
|
.username(user.getUsername())
|
||||||
.deptName(user.getUser().getDept().getDeptName())
|
|
||||||
.ipAddr(user.getIpddr())
|
.ipAddr(user.getIpddr())
|
||||||
.loginLocation(user.getLoginLocation())
|
.loginLocation(user.getLoginLocation())
|
||||||
.browser(user.getBrowser())
|
.browser(user.getBrowser())
|
||||||
.os(user.getOs())
|
.os(user.getOs())
|
||||||
.loginTime(new Date(user.getLoginTime()))
|
.loginTime(new Date(user.getLoginTime()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
Dept dept = user.getUser().getDept();
|
||||||
|
if (dept != null) {
|
||||||
|
onlineUser.setDeptName(dept.getDeptName());
|
||||||
|
}
|
||||||
|
return onlineUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,13 +61,38 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectListByUserId" resultType="cn.fateverse.admin.entity.Menu">
|
<select id="selectListByUserId" resultType="cn.fateverse.admin.entity.Menu">
|
||||||
<include refid="selectMenuVo"/>
|
select distinct m.menu_id,
|
||||||
|
m.menu_name,
|
||||||
|
m.parent_id,
|
||||||
|
m.order_num,
|
||||||
|
m.path,
|
||||||
|
m.path_params,
|
||||||
|
m.component,
|
||||||
|
m.no_redirect,
|
||||||
|
m.breadcrumb,
|
||||||
|
m.is_frame,
|
||||||
|
m.is_cache,
|
||||||
|
m.menu_type,
|
||||||
|
m.visible,
|
||||||
|
m.state,
|
||||||
|
m.order_num,
|
||||||
|
ifnull(m.perms, '') as perms,
|
||||||
|
m.icon,
|
||||||
|
m.create_by,
|
||||||
|
m.create_time,
|
||||||
|
m.update_by,
|
||||||
|
m.update_time,
|
||||||
|
m.remark
|
||||||
|
from sys_menu m
|
||||||
|
left join sys_role_menu rm on rm.menu_id = m.menu_id
|
||||||
|
left join sys_role r on r.role_id = rm.role_id
|
||||||
|
left join sys_user_role ur on ur.role_id = r.role_id
|
||||||
<where>
|
<where>
|
||||||
<if test="userId != null">and user_id = #{userId}</if>
|
<if test="userId != null">and ur.user_id = #{userId}</if>
|
||||||
<if test="menuName != null and menuName != ''">and menu_name like concat('%',#{menuName},'%')</if>
|
<if test="menuName != null and menuName != ''">and m.menu_name like concat('%',#{menuName},'%')</if>
|
||||||
<if test="state != null and state != ''">and state = #{state}</if>
|
<if test="state != null and state != ''">and m.state = #{state}</if>
|
||||||
<if test="excludeId != null ">and menu_id != #{excludeId} and parent_id != #{excludeId}</if>
|
<if test="excludeId != null ">and m.menu_id != #{excludeId} and parent_id != #{excludeId}</if>
|
||||||
<if test="button">and menu_type in ('D', 'M')</if>
|
<if test="button">and m.menu_type in ('D', 'M')</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import org.springframework.security.authentication.BadCredentialsException;
|
|||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -156,11 +157,15 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RouterVo> getMenuRouterByUserId() {
|
public List<RouterVo> getMenuRouterByUserId() {
|
||||||
List<RouterVo> result = (List<RouterVo>) redisTemplate.opsForValue().get(CacheConstants.ROUTE_CACHE_KEY + SecurityUtils.getUserId());
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
if (ObjectUtils.isEmpty(loginUser)){
|
||||||
|
throw new CustomException("获取用户信息失败!");
|
||||||
|
}
|
||||||
|
List<RouterVo> result = (List<RouterVo>) redisTemplate.opsForValue().get(CacheConstants.ROUTE_CACHE_KEY + loginUser.getUuid());
|
||||||
if (result == null || result.isEmpty()) {
|
if (result == null || result.isEmpty()) {
|
||||||
RLock lock = redissonClient.getLock(CacheConstants.ROUTE_CACHE_KEY + "lock:" + SecurityUtils.getUserId());
|
RLock lock = redissonClient.getLock(CacheConstants.ROUTE_CACHE_KEY + "lock:" + loginUser.getUuid());
|
||||||
try {
|
try {
|
||||||
result = (List<RouterVo>) redisTemplate.opsForValue().get(CacheConstants.ROUTE_CACHE_KEY + SecurityUtils.getUserId());
|
result = (List<RouterVo>) redisTemplate.opsForValue().get(CacheConstants.ROUTE_CACHE_KEY + loginUser.getUuid());
|
||||||
if (result == null || result.isEmpty()) {
|
if (result == null || result.isEmpty()) {
|
||||||
result = menuService.selectMenuRouterByUserId(SecurityUtils.getUserId());
|
result = menuService.selectMenuRouterByUserId(SecurityUtils.getUserId());
|
||||||
if (result == null || result.isEmpty()) {
|
if (result == null || result.isEmpty()) {
|
||||||
@@ -168,7 +173,7 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
// throw new CustomException("获取路由异常!");
|
// throw new CustomException("获取路由异常!");
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
redisTemplate.opsForValue().set(CacheConstants.ROUTE_CACHE_KEY + SecurityUtils.getUserId(),result,30, TimeUnit.MINUTES);
|
redisTemplate.opsForValue().set(CacheConstants.ROUTE_CACHE_KEY + loginUser.getUuid(), result, 30, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class CacheConstants {
|
|||||||
/**
|
/**
|
||||||
* 路由缓存地址
|
* 路由缓存地址
|
||||||
*/
|
*/
|
||||||
public static final String ROUTE_CACHE_KEY = "router_key:";
|
public static final String ROUTE_CACHE_KEY = "router:key:";
|
||||||
/**
|
/**
|
||||||
* 登录用户 redis key
|
* 登录用户 redis key
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,11 +12,15 @@
|
|||||||
<artifactId>common-dubbo</artifactId>
|
<artifactId>common-dubbo</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<dubbo.version>3.0.3</dubbo.version>
|
<dubbo.version>3.2.1</dubbo.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Dubbo Nacos registry dependency -->
|
<!-- Dubbo Nacos registry dependency -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.fateverse</groupId>
|
||||||
|
<artifactId>common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo-registry-nacos</artifactId>
|
<artifactId>dubbo-registry-nacos</artifactId>
|
||||||
@@ -45,6 +49,12 @@
|
|||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
<version>${dubbo.version}</version>
|
<version>${dubbo.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--dubbo sentinel 适配器-->
|
<!--dubbo sentinel 适配器-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import cn.fateverse.common.log.service.OperationService;
|
|||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,13 +18,13 @@ import org.springframework.context.annotation.Bean;
|
|||||||
public class LogAutoConfiguration {
|
public class LogAutoConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public LogAspect logAspect(){
|
public LogAspect logAspect() {
|
||||||
return new LogAspect();
|
return new LogAspect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public OperationService operationService(OperationProperties properties) {
|
public OperationService operationService(OperationProperties properties, Environment environment) {
|
||||||
return new OperationService(properties);
|
return new OperationService(properties, environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class LogAspect {
|
|||||||
|
|
||||||
|
|
||||||
@Around("@within(log) || @annotation(log)")
|
@Around("@within(log) || @annotation(log)")
|
||||||
public Object before(ProceedingJoinPoint point, Log log) throws Throwable {
|
public Object around(ProceedingJoinPoint point, Log log) throws Throwable {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
Object proceed = point.proceed(point.getArgs());
|
Object proceed = point.proceed(point.getArgs());
|
||||||
|
|||||||
@@ -11,10 +11,12 @@ import com.alibaba.fastjson2.JSON;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,14 +37,23 @@ public class OperationService {
|
|||||||
@DubboReference
|
@DubboReference
|
||||||
private DubboLogService logService;
|
private DubboLogService logService;
|
||||||
|
|
||||||
|
|
||||||
|
private final String applicationName;
|
||||||
|
|
||||||
private final OperationProperties properties;
|
private final OperationProperties properties;
|
||||||
|
|
||||||
|
|
||||||
private final List<OperationLog> operationLogListCache;
|
private final List<OperationLog> operationLogListCache;
|
||||||
|
|
||||||
public OperationService(OperationProperties properties) {
|
public OperationService(OperationProperties properties, Environment environment) {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.operationLogListCache = new ArrayList<>(properties.getCacheSize());
|
this.operationLogListCache = new ArrayList<>(properties.getCacheSize());
|
||||||
|
String applicationName = environment.getProperty("spring.application.name");
|
||||||
|
if (ObjectUtils.isEmpty(applicationName)) {
|
||||||
|
log.error("applicationName can not be null");
|
||||||
|
throw new RuntimeException("applicationName can not be null");
|
||||||
|
}
|
||||||
|
this.applicationName = applicationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -62,6 +73,7 @@ public class OperationService {
|
|||||||
@Async
|
@Async
|
||||||
public void asyncExecute(OperationLog operationLog, Object jsonResult, Throwable e, Long time) {
|
public void asyncExecute(OperationLog operationLog, Object jsonResult, Throwable e, Long time) {
|
||||||
operationLog.setState(BusinessState.SUCCESS.ordinal());
|
operationLog.setState(BusinessState.SUCCESS.ordinal());
|
||||||
|
operationLog.setApplicationName(applicationName);
|
||||||
// 返回参数
|
// 返回参数
|
||||||
if (jsonResult instanceof Result) {
|
if (jsonResult instanceof Result) {
|
||||||
Result<Object> result = (Result<Object>) jsonResult;
|
Result<Object> result = (Result<Object>) jsonResult;
|
||||||
|
|||||||
@@ -23,6 +23,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.seata</groupId>
|
<groupId>io.seata</groupId>
|
||||||
|
|||||||
@@ -27,6 +27,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--Token生成与解析-->
|
<!--Token生成与解析-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ public class TokenService {
|
|||||||
if (!StrUtil.isEmpty(token)) {
|
if (!StrUtil.isEmpty(token)) {
|
||||||
String userKey = getTokenKey(token);
|
String userKey = getTokenKey(token);
|
||||||
redisTemplate.delete(userKey);
|
redisTemplate.delete(userKey);
|
||||||
|
redisTemplate.delete(CacheConstants.ROUTE_CACHE_KEY + token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- SpringCloud Alibaba Sentinel Gateway -->
|
<!-- SpringCloud Alibaba Sentinel Gateway -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ public class OperationLog implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用名称
|
||||||
|
*/
|
||||||
|
private String applicationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作模块
|
* 操作模块
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package cn.fateverse.log.query;
|
package cn.fateverse.log.query;
|
||||||
|
|
||||||
import cn.fateverse.common.core.entity.QueryTime;
|
import cn.fateverse.common.core.entity.QueryTime;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
@@ -12,7 +11,6 @@ import lombok.Data;
|
|||||||
* @Version: V2.0
|
* @Version: V2.0
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("日志查询实体")
|
|
||||||
public class OperationLogQuery extends QueryTime {
|
public class OperationLogQuery extends QueryTime {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,6 +18,8 @@ public class OperationLogQuery extends QueryTime {
|
|||||||
*/
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
private String applicationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作人员
|
* 操作人员
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public class OperationLogVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
private String applicationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务类型(0其它 1新增 2修改 3删除)
|
* 业务类型(0其它 1新增 2修改 3删除)
|
||||||
*/
|
*/
|
||||||
@@ -111,6 +113,7 @@ public class OperationLogVo implements Serializable {
|
|||||||
public static OperationLogVo toOperationLogVo(OperationLog operationLog) {
|
public static OperationLogVo toOperationLogVo(OperationLog operationLog) {
|
||||||
return OperationLogVo.builder()
|
return OperationLogVo.builder()
|
||||||
.operId(operationLog.getOperId())
|
.operId(operationLog.getOperId())
|
||||||
|
.applicationName(operationLog.getApplicationName())
|
||||||
.title(operationLog.getTitle())
|
.title(operationLog.getTitle())
|
||||||
.businessType(operationLog.getBusinessType())
|
.businessType(operationLog.getBusinessType())
|
||||||
.method(operationLog.getMethod())
|
.method(operationLog.getMethod())
|
||||||
|
|||||||
@@ -2,12 +2,9 @@ package cn.fateverse.log.controller;
|
|||||||
|
|
||||||
import cn.fateverse.common.core.result.Result;
|
import cn.fateverse.common.core.result.Result;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
import cn.fateverse.common.security.annotation.Anonymity;
|
|
||||||
import cn.fateverse.log.query.OperationLogQuery;
|
import cn.fateverse.log.query.OperationLogQuery;
|
||||||
import cn.fateverse.log.service.OperationService;
|
import cn.fateverse.log.service.OperationService;
|
||||||
import cn.fateverse.log.vo.OperationLogVo;
|
import cn.fateverse.log.vo.OperationLogVo;
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -19,7 +16,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/11/1
|
* @date 2022/11/1
|
||||||
*/
|
*/
|
||||||
@Api(tags = "操作日志管理")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/log")
|
@RequestMapping("/log")
|
||||||
@@ -31,13 +27,7 @@ public class OperationLogController {
|
|||||||
this.operationService = operationService;
|
this.operationService = operationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param operationLogQuery
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Anonymity
|
|
||||||
@ApiOperation("查询日志信息")
|
|
||||||
@PreAuthorize("@ss.hasPermission('admin:log:list')")
|
@PreAuthorize("@ss.hasPermission('admin:log:list')")
|
||||||
public Result<TableDataInfo<OperationLogVo>> SearchLog(OperationLogQuery operationLogQuery) {
|
public Result<TableDataInfo<OperationLogVo>> SearchLog(OperationLogQuery operationLogQuery) {
|
||||||
TableDataInfo<OperationLogVo> dataTable = operationService.search(operationLogQuery);
|
TableDataInfo<OperationLogVo> dataTable = operationService.search(operationLogQuery);
|
||||||
@@ -45,7 +35,6 @@ public class OperationLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{operId}")
|
@GetMapping("/{operId}")
|
||||||
@ApiOperation("查询日志信息")
|
|
||||||
@PreAuthorize("@ss.hasPermission('admin:log:list')")
|
@PreAuthorize("@ss.hasPermission('admin:log:list')")
|
||||||
public Result<OperationLogVo> SearchLog(@PathVariable Long operId) {
|
public Result<OperationLogVo> SearchLog(@PathVariable Long operId) {
|
||||||
OperationLogVo operationLogVo = operationService.select(operId);
|
OperationLogVo operationLogVo = operationService.select(operId);
|
||||||
@@ -53,7 +42,6 @@ public class OperationLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{operIds}")
|
@DeleteMapping("/{operIds}")
|
||||||
@ApiOperation("操作日志删除")
|
|
||||||
@PreAuthorize("@ss.hasPermission('admin:log:del')")
|
@PreAuthorize("@ss.hasPermission('admin:log:del')")
|
||||||
public Result<Integer> OperationInfoRemove(@PathVariable Long[] operIds) {
|
public Result<Integer> OperationInfoRemove(@PathVariable Long[] operIds) {
|
||||||
if (operIds.length == 0) {
|
if (operIds.length == 0) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<resultMap type="cn.fateverse.log.entity.OperationLog" id="OperationLogResult">
|
<resultMap type="cn.fateverse.log.entity.OperationLog" id="OperationLogResult">
|
||||||
<id property="operId" column="oper_id"/>
|
<id property="operId" column="oper_id"/>
|
||||||
<result property="title" column="title"/>
|
<result property="title" column="title"/>
|
||||||
|
<result property="applicationName" column="application_name"/>
|
||||||
<result property="businessType" column="business_type"/>
|
<result property="businessType" column="business_type"/>
|
||||||
<result property="method" column="method"/>
|
<result property="method" column="method"/>
|
||||||
<result property="requestMethod" column="request_method"/>
|
<result property="requestMethod" column="request_method"/>
|
||||||
@@ -24,15 +25,35 @@
|
|||||||
<result property="consumeTime" column="consume_time"/>
|
<result property="consumeTime" column="consume_time"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSql">
|
||||||
|
select oper_id,
|
||||||
|
title,
|
||||||
|
application_name,
|
||||||
|
business_type,
|
||||||
|
method,
|
||||||
|
request_method,
|
||||||
|
operator_type,
|
||||||
|
oper_name,
|
||||||
|
dept_name,
|
||||||
|
oper_url,
|
||||||
|
oper_ip,
|
||||||
|
oper_location,
|
||||||
|
state,
|
||||||
|
oper_time,
|
||||||
|
consume_time
|
||||||
|
from sys_operation_log
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
<insert id="batchSave">
|
<insert id="batchSave">
|
||||||
insert into sys_operation_log
|
insert into sys_operation_log
|
||||||
(oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip,
|
(oper_id, title, application_name, business_type, method, request_method, operator_type, oper_name, dept_name,
|
||||||
|
oper_url, oper_ip,
|
||||||
oper_location, oper_param, json_result, state, error_msg, error_stack_trace, oper_time, consume_time)
|
oper_location, oper_param, json_result, state, error_msg, error_stack_trace, oper_time, consume_time)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="log" separator=",">
|
<foreach collection="list" item="log" separator=",">
|
||||||
(#{log.operId}, #{log.title}, #{log.businessType}, #{log.method}, #{log.requestMethod}, #{log.operatorType},
|
(#{log.operId}, #{log.title}, #{log.applicationName}, #{log.businessType}, #{log.method},
|
||||||
#{log.operName},
|
#{log.requestMethod}, #{log.operatorType},#{log.operName},
|
||||||
#{log.deptName}, #{log.operUrl}, #{log.operIp}, #{log.operLocation}, #{log.operParam}, #{log.jsonResult},
|
#{log.deptName}, #{log.operUrl}, #{log.operIp}, #{log.operLocation}, #{log.operParam}, #{log.jsonResult},
|
||||||
#{log.state}, #{log.errorMsg},
|
#{log.state}, #{log.errorMsg},
|
||||||
#{log.errorStackTrace}, #{log.operTime}, #{log.consumeTime})
|
#{log.errorStackTrace}, #{log.operTime}, #{log.consumeTime})
|
||||||
@@ -41,15 +62,16 @@
|
|||||||
|
|
||||||
<select id="searchSubQuery" resultMap="OperationLogResult"
|
<select id="searchSubQuery" resultMap="OperationLogResult"
|
||||||
parameterType="cn.fateverse.log.query.OperationLogQuery">
|
parameterType="cn.fateverse.log.query.OperationLogQuery">
|
||||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url,
|
<include refid="selectSql"/>
|
||||||
oper_ip, oper_location, state, oper_time, consume_time
|
|
||||||
from sys_operation_log
|
|
||||||
<where>
|
<where>
|
||||||
oper_id >= (select oper_id from sys_operation_log
|
oper_id >= (select oper_id from sys_operation_log
|
||||||
<where>
|
<where>
|
||||||
<if test="operation.title !=null and operation.title !=''">
|
<if test="operation.title !=null and operation.title !=''">
|
||||||
and title like concat('%',#{operation.title},'%')
|
and title like concat('%',#{operation.title},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="operation.applicationName !=null and operation.applicationName !=''">
|
||||||
|
and application_name like concat('%',#{operation.applicationName},'%')
|
||||||
|
</if>
|
||||||
<if test="operation.operName !=null and operation.operName !=''">
|
<if test="operation.operName !=null and operation.operName !=''">
|
||||||
and oper_name like concat('%',#{operation.operName},'%')
|
and oper_name like concat('%',#{operation.operName},'%')
|
||||||
</if>
|
</if>
|
||||||
@@ -71,6 +93,9 @@
|
|||||||
<if test="operation.title !=null and operation.title !=''">
|
<if test="operation.title !=null and operation.title !=''">
|
||||||
and title like concat('%',#{operation.title},'%')
|
and title like concat('%',#{operation.title},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="operation.applicationName !=null and operation.applicationName !=''">
|
||||||
|
and application_name like concat('%',#{operation.applicationName},'%')
|
||||||
|
</if>
|
||||||
<if test="operation.operName !=null and operation.operName !=''">
|
<if test="operation.operName !=null and operation.operName !=''">
|
||||||
and oper_name like concat('%',#{operation.operName},'%')
|
and oper_name like concat('%',#{operation.operName},'%')
|
||||||
</if>
|
</if>
|
||||||
@@ -93,13 +118,14 @@
|
|||||||
|
|
||||||
<select id="search" resultMap="OperationLogResult"
|
<select id="search" resultMap="OperationLogResult"
|
||||||
parameterType="cn.fateverse.log.query.OperationLogQuery">
|
parameterType="cn.fateverse.log.query.OperationLogQuery">
|
||||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url,
|
<include refid="selectSql"/>
|
||||||
oper_ip, oper_location, state, oper_time, consume_time
|
|
||||||
from sys_operation_log
|
|
||||||
<where>
|
<where>
|
||||||
<if test="operation.title !=null and operation.title !=''">
|
<if test="operation.title !=null and operation.title !=''">
|
||||||
and title like concat('%',#{operation.title},'%')
|
and title like concat('%',#{operation.title},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="operation.applicationName !=null and operation.applicationName !=''">
|
||||||
|
and application_name like concat('%',#{operation.applicationName},'%')
|
||||||
|
</if>
|
||||||
<if test="operation.operName !=null and operation.operName !=''">
|
<if test="operation.operName !=null and operation.operName !=''">
|
||||||
and oper_name like concat('%',#{operation.operName},'%')
|
and oper_name like concat('%',#{operation.operName},'%')
|
||||||
</if>
|
</if>
|
||||||
@@ -125,6 +151,9 @@
|
|||||||
<if test="operation.title !=null and operation.title !=''">
|
<if test="operation.title !=null and operation.title !=''">
|
||||||
and title like concat('%',#{operation.title},'%')
|
and title like concat('%',#{operation.title},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="operation.applicationName !=null and operation.applicationName !=''">
|
||||||
|
and application_name like concat('%',#{operation.applicationName},'%')
|
||||||
|
</if>
|
||||||
<if test="operation.operName !=null and operation.operName !=''">
|
<if test="operation.operName !=null and operation.operName !=''">
|
||||||
and oper_name like concat('%',#{operation.operName},'%')
|
and oper_name like concat('%',#{operation.operName},'%')
|
||||||
</if>
|
</if>
|
||||||
@@ -153,6 +182,7 @@
|
|||||||
<select id="selectById" resultMap="OperationLogResult">
|
<select id="selectById" resultMap="OperationLogResult">
|
||||||
select oper_id,
|
select oper_id,
|
||||||
title,
|
title,
|
||||||
|
application_name,
|
||||||
business_type,
|
business_type,
|
||||||
method,
|
method,
|
||||||
request_method,
|
request_method,
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
package cn.fateverse.notice.config;
|
|
||||||
|
|
||||||
import cn.fateverse.notice.entity.UserInfo;
|
|
||||||
import org.redisson.spring.data.connection.RedissonConnectionFactory;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Clay
|
|
||||||
* @date 2023-10-15
|
|
||||||
*/
|
|
||||||
//@Configuration
|
|
||||||
public class RedisTemplateConfig {
|
|
||||||
|
|
||||||
|
|
||||||
@Bean("noticeRedisTemplate")
|
|
||||||
public RedisTemplate<String, UserInfo> noticeRedisTemplate(RedissonConnectionFactory redissonConnectionFactory) {
|
|
||||||
RedisTemplate<String, UserInfo> redisTemplate = new RedisTemplate<>();
|
|
||||||
redisTemplate.setConnectionFactory(redissonConnectionFactory);
|
|
||||||
//设置key序列化方式string
|
|
||||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
|
||||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
|
||||||
redisTemplate.afterPropertiesSet();
|
|
||||||
return redisTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package cn.fateverse.workflow.entity.dto;
|
package cn.fateverse.workflow.entity.dto;
|
||||||
|
|
||||||
import cn.fateverse.workflow.entity.ProcessListener;
|
import cn.fateverse.workflow.entity.ProcessListener;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="selectProcessInstanceListByUserIdAndState"
|
<select id="selectProcessInstanceListByUserIdAndState"
|
||||||
resultType="cn.fateverse.workflow.entity.UserInstance">
|
resultType="cn.fateverse.workflow.entity.UserInstance">
|
||||||
select process_instance_id,
|
select distinct process_instance_id,
|
||||||
user_id,
|
user_id,
|
||||||
deployment_name,
|
deployment_name,
|
||||||
submit_time,
|
submit_time,
|
||||||
|
|||||||
Reference in New Issue
Block a user