mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 20:49:00 +08:00
Merge branch 'master' into leng_dev
This commit is contained in:
commit
f6f56995b6
9 files changed
+29
-26
No files matched your search
@@ -1,13 +1,6 @@
|
||||
特别说明: 为了方便其他群友查阅和工程师定位问题
|
||||
- 工单支持MD 语法格式化,注意可读性喔
|
||||
- 若问题已经解决,请及时反馈并关闭工单
|
||||
- 问题范围请局限PigX 现有功能范围内,扩展业务问题直接关闭
|
||||
|
||||
---
|
||||
### 环境信息 (*)
|
||||
|
||||
- pigx版本:
|
||||
- 是否二开:
|
||||
- pigx版本:
|
||||
- 是否修改包名:
|
||||
|
||||
---
|
||||
|
||||
@@ -173,7 +173,7 @@ public class PigxTokenEndpoint {
|
||||
redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
|
||||
Page result = new Page(MapUtil.getInt(params, PaginationConstants.CURRENT), MapUtil.getInt(params, PaginationConstants.SIZE));
|
||||
result.setRecords(redisTemplate.opsForValue().multiGet(pages));
|
||||
result.setTotal(Long.valueOf(redisTemplate.keys(key).size()));
|
||||
result.setTotal((long) redisTemplate.keys(key).size());
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -8,6 +8,13 @@ package com.pig4cloud.pigx.common.core.constant;
|
||||
*/
|
||||
public interface CacheConstants {
|
||||
|
||||
/**
|
||||
* 全局缓存,在缓存名称上加上该前缀表示该缓存不区分租户,比如:
|
||||
* <P/>
|
||||
* {@code @Cacheable(value = CacheConstants.GLOBALLY+CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")}
|
||||
*/
|
||||
String GLOBALLY = "gl@";
|
||||
|
||||
/**
|
||||
* 菜单信息缓存
|
||||
*/
|
||||
|
||||
+5
@@ -18,6 +18,7 @@
|
||||
package com.pig4cloud.pigx.common.data.cache;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.Cache;
|
||||
@@ -73,6 +74,10 @@ public class RedisAutoCacheManager extends RedisCacheManager {
|
||||
*/
|
||||
@Override
|
||||
public Cache getCache(String name) {
|
||||
// see https://gitee.wang/pig/pigx/issues/613
|
||||
if(name.startsWith(CacheConstants.GLOBALLY)){
|
||||
return super.getCache(name);
|
||||
}
|
||||
return super.getCache(TenantContextHolder.getTenantId() + StrUtil.COLON + name);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class JarTaskInvok implements ITaskInvok {
|
||||
}
|
||||
processBuilder.command(commands);
|
||||
try {
|
||||
Process process = processBuilder.start();
|
||||
processBuilder.start();
|
||||
} catch (IOException e) {
|
||||
log.error("定时任务jar反射执行异常,执行任务:{}", sysJob.getExecutePath());
|
||||
throw new TaskException("定时任务jar反射执行异常,执行任务:" + sysJob.getExecutePath());
|
||||
|
||||
+4
-4
@@ -37,10 +37,10 @@ import java.lang.reflect.Method;
|
||||
public class JavaClassTaskInvok implements ITaskInvok {
|
||||
@Override
|
||||
public void invokMethod(SysJob sysJob) throws TaskException {
|
||||
Object obj = null;
|
||||
Class clazz = null;
|
||||
Method method = null;
|
||||
Object returnValue = null;
|
||||
Object obj;
|
||||
Class clazz;
|
||||
Method method;
|
||||
Object returnValue;
|
||||
try {
|
||||
if (StrUtil.isNotEmpty(sysJob.getMethodParamsValue())) {
|
||||
clazz = Class.forName(sysJob.getClassName());
|
||||
|
||||
+6
-8
@@ -17,14 +17,12 @@
|
||||
|
||||
package com.pig4cloud.pigx.daemon.quartz.util;
|
||||
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.pig4cloud.pigx.daemon.quartz.entity.SysJob;
|
||||
import com.pig4cloud.pigx.daemon.quartz.exception.TaskException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* 定时任务rest反射实现
|
||||
@@ -32,16 +30,16 @@ import org.springframework.web.client.RestTemplate;
|
||||
* @author 郑健楠
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("restTaskInvok")
|
||||
@AllArgsConstructor
|
||||
@Component("restTaskInvok")
|
||||
public class RestTaskInvok implements ITaskInvok {
|
||||
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Override
|
||||
public void invokMethod(SysJob sysJob) throws TaskException {
|
||||
R r = restTemplate.getForObject(sysJob.getExecutePath(), R.class);
|
||||
if (CommonConstants.FAIL == r.getCode()) {
|
||||
try {
|
||||
HttpUtil.createGet(sysJob.getExecutePath())
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
log.error("定时任务restTaskInvok异常,执行任务:{}", sysJob.getExecutePath());
|
||||
throw new TaskException("定时任务restTaskInvok业务执行失败,任务:" + sysJob.getExecutePath());
|
||||
}
|
||||
|
||||
+3
-3
@@ -40,9 +40,9 @@ import java.lang.reflect.Method;
|
||||
public class SpringBeanTaskInvok implements ITaskInvok {
|
||||
@Override
|
||||
public void invokMethod(SysJob sysJob) throws TaskException {
|
||||
Object target = null;
|
||||
Method method = null;
|
||||
Object returnValue = null;
|
||||
Object target;
|
||||
Method method;
|
||||
Object returnValue;
|
||||
//通过Spring上下文去找 也有可能找不到
|
||||
target = SpringContextHolder.getBean(sysJob.getClassName());
|
||||
try {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class ModelInfoManager {
|
||||
|
||||
|
||||
private static ModelInfoManager manager = null;
|
||||
private List<ModelInfo> modelInfos = new CopyOnWriteArrayList<ModelInfo>();
|
||||
private List<ModelInfo> modelInfos = new CopyOnWriteArrayList<>();
|
||||
|
||||
public static ModelInfoManager getInstance() {
|
||||
if (manager == null) {
|
||||
|
||||
Reference in new issue
Block a user