mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
修复admin事务不会滚,新增sdk-java
This commit is contained in:
@@ -129,8 +129,8 @@ public class IsvApi {
|
||||
|
||||
@Api(name = "isv.info.add")
|
||||
@ApiDocMethod(description = "添加isv")
|
||||
@Transactional
|
||||
void addIsv(IsvInfoFormAdd param) throws Exception {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addIsv(IsvInfoFormAdd param) throws Exception {
|
||||
if (isvInfoMapper.getByColumn("app_key", param.getAppKey()) != null) {
|
||||
throw new ApiException("appKey已存在");
|
||||
}
|
||||
@@ -147,8 +147,8 @@ public class IsvApi {
|
||||
|
||||
@Api(name = "isv.info.update")
|
||||
@ApiDocMethod(description = "修改isv")
|
||||
@Transactional
|
||||
void updateIsv(IsvInfoFormUpdate param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateIsv(IsvInfoFormUpdate param) {
|
||||
formatForm(param);
|
||||
IsvInfo rec = isvInfoMapper.getById(param.getId());
|
||||
CopyUtil.copyPropertiesIgnoreNull(param, rec);
|
||||
|
@@ -26,6 +26,7 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.curator.framework.recipes.cache.ChildData;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -143,7 +144,8 @@ public class RouteApi {
|
||||
|
||||
@Api(name = "route.role.update")
|
||||
@ApiDocMethod(description = "更新路由对应的角色")
|
||||
void updateRouteRole(RoutePermissionParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateRouteRole(RoutePermissionParam param) {
|
||||
String routeId = param.getRouteId();
|
||||
// 删除所有数据
|
||||
Query delQuery = new Query();
|
||||
|
@@ -1,43 +0,0 @@
|
||||
package com.gitee.sop.adminserver.interceptor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import com.auth0.jwt.interfaces.Claim;
|
||||
import com.gitee.easyopen.ApiContext;
|
||||
import com.gitee.easyopen.ApiMeta;
|
||||
import com.gitee.easyopen.support.BaseLockInterceptor;
|
||||
|
||||
/**
|
||||
* 使用分布式锁防止表单重复提交
|
||||
*
|
||||
* @author tanghc
|
||||
*/
|
||||
public class LockInterceptor extends BaseLockInterceptor {
|
||||
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
public LockInterceptor() {
|
||||
redisTemplate = ApiContext.getApplicationContext().getBean(StringRedisTemplate.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
protected RedisTemplate getRedisTemplate() {
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUserId() {
|
||||
Map<String, Claim> jwtData = ApiContext.getJwtData();
|
||||
String id = jwtData.get("id").asString(); // 用户id
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(ApiMeta apiMeta) {
|
||||
return "userlock.test".equals(apiMeta.getName()); // 只针对这个接口
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user