mirror of https://github.com/jeecgboot/jeecg-boot
【I57I6O】 修复路由添加时Path无法添加问题
【I59M95】自定义JeecgCloudException异常供微服务,及starter模块使用,解决注解添加之后无法实现重复提交的拦截提示 【I58FJ5】修改quartz默认配置参数,延迟启动解决服务重启多次执行问题 【#3755】优化rabbitmq代码删除setQueueNames方法避免发送延迟 升级springcloud到2021.0.3,解决Spring Cloud Gateway SpEL表达式注入问题 升级积木报表到最新版 【issues/3666】同步钉钉用户到本地,违反数据库唯一主键规则,导致插入失败pull/3805/head v3.2.0
parent
63505e8f6e
commit
efd17cdd60
|
@ -133,6 +133,10 @@
|
||||||
filterArray: [ { key: 1, name: '限流过滤器' }],
|
filterArray: [ { key: 1, name: '限流过滤器' }],
|
||||||
//gateway对应的规则key
|
//gateway对应的规则key
|
||||||
tagArray: [
|
tagArray: [
|
||||||
|
{
|
||||||
|
name:'Path',
|
||||||
|
args:[]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name:'Header',
|
name:'Header',
|
||||||
args:{
|
args:{
|
||||||
|
|
|
@ -37,6 +37,15 @@ public class JeecgBootExceptionHandler {
|
||||||
return Result.error(e.getMessage());
|
return Result.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理自定义微服务异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(JeecgCloudException.class)
|
||||||
|
public Result<?> handleJeecgCloudException(JeecgCloudException e){
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理自定义异常
|
* 处理自定义异常
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.jeecg.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: jeecg-cloud自定义异常
|
||||||
|
* @Author: zyf
|
||||||
|
* @Date: 2022-05-30
|
||||||
|
*/
|
||||||
|
public class JeecgCloudException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public JeecgCloudException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -52,13 +52,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.jimureport</groupId>
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
<artifactId>jimureport-spring-boot-starter</artifactId>
|
<artifactId>jimureport-spring-boot-starter</artifactId>
|
||||||
<version>1.5.0-beta</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>fastjson</artifactId>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- DEMO 示例模块 -->
|
<!-- DEMO 示例模块 -->
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.net.UnknownHostException;
|
||||||
/**
|
/**
|
||||||
* 单体启动类(采用此类启动为单体模式)
|
* 单体启动类(采用此类启动为单体模式)
|
||||||
* 特别提醒:
|
* 特别提醒:
|
||||||
* 1.需要集成mogodb请删除 exclude={MongoAutoConfiguration.class}
|
* 1.需要集成mongodb请删除 exclude={MongoAutoConfiguration.class}
|
||||||
* 2.切换微服务 勾选profile的SpringCloud,这个类就无法启动,启动会报错
|
* 2.切换微服务 勾选profile的SpringCloud,这个类就无法启动,启动会报错
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
|
@ -44,8 +44,9 @@ import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@ -370,7 +371,8 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// api 接口执行成功,并且 sys_third_account 表匹配失败,就向 sys_third_account 里插入一条数据
|
// api 接口执行成功,并且 sys_third_account 表匹配失败,就向 sys_third_account 里插入一条数据
|
||||||
if (apiSuccess && (sysThirdAccount == null || oConvertUtils.isEmpty(sysThirdAccount.getThirdUserId()))) {
|
boolean flag = (sysThirdAccount == null || oConvertUtils.isEmpty(sysThirdAccount.getThirdUserId()));
|
||||||
|
if (apiSuccess && flag) {
|
||||||
if (sysThirdAccount == null) {
|
if (sysThirdAccount == null) {
|
||||||
sysThirdAccount = new SysThirdAccount();
|
sysThirdAccount = new SysThirdAccount();
|
||||||
sysThirdAccount.setSysUserId(sysUser.getId());
|
sysThirdAccount.setSysUserId(sysUser.getId());
|
||||||
|
@ -402,8 +404,14 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||||
List<Department> allDepartment = JdtDepartmentAPI.listAll(accessToken);
|
List<Department> allDepartment = JdtDepartmentAPI.listAll(accessToken);
|
||||||
// 根据钉钉部门查询所有钉钉用户,用于反向同步到本地
|
// 根据钉钉部门查询所有钉钉用户,用于反向同步到本地
|
||||||
List<User> ddUserList = this.getDtAllUserByDepartment(allDepartment, accessToken);
|
List<User> ddUserList = this.getDtAllUserByDepartment(allDepartment, accessToken);
|
||||||
|
// 记录已经同步过的用户id,当有多个部门的情况时,只同步一次
|
||||||
|
Set<String> syncedUserIdSet = new HashSet<>();
|
||||||
|
|
||||||
for (User dtUserInfo : ddUserList) {
|
for (User dtUserInfo : ddUserList) {
|
||||||
|
if (syncedUserIdSet.contains(dtUserInfo.getUserid())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
syncedUserIdSet.add(dtUserInfo.getUserid());
|
||||||
SysThirdAccount sysThirdAccount = sysThirdAccountService.getOneByThirdUserId(dtUserInfo.getUserid(), THIRD_TYPE);
|
SysThirdAccount sysThirdAccount = sysThirdAccountService.getOneByThirdUserId(dtUserInfo.getUserid(), THIRD_TYPE);
|
||||||
List<SysUser> collect = sysUsersList.stream().filter(user -> (dtUserInfo.getMobile().equals(user.getPhone()) || dtUserInfo.getUserid().equals(user.getUsername()))
|
List<SysUser> collect = sysUsersList.stream().filter(user -> (dtUserInfo.getMobile().equals(user.getPhone()) || dtUserInfo.getUserid().equals(user.getUsername()))
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
|
@ -581,12 +589,6 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||||
// update-begin--Author:liusq Date:20210713 for:钉钉同步到本地的人员没有状态,导致同步之后无法登录 #I3ZC2L
|
// update-begin--Author:liusq Date:20210713 for:钉钉同步到本地的人员没有状态,导致同步之后无法登录 #I3ZC2L
|
||||||
sysUser.setStatus(1);
|
sysUser.setStatus(1);
|
||||||
// update-end--Author:liusq Date:20210713 for:钉钉同步到本地的人员没有状态,导致同步之后无法登录 #I3ZC2L
|
// update-end--Author:liusq Date:20210713 for:钉钉同步到本地的人员没有状态,导致同步之后无法登录 #I3ZC2L
|
||||||
// 设置工号,如果工号为空,则使用username
|
|
||||||
if (oConvertUtils.isEmpty(dtUser.getJob_number())) {
|
|
||||||
sysUser.setWorkNo(dtUser.getUserid());
|
|
||||||
} else {
|
|
||||||
sysUser.setWorkNo(dtUser.getJob_number());
|
|
||||||
}
|
|
||||||
return this.dtUserToSysUser(dtUser, sysUser);
|
return this.dtUserToSysUser(dtUser, sysUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,7 +613,12 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||||
} else {
|
} else {
|
||||||
sysUser.setPhone(null);
|
sysUser.setPhone(null);
|
||||||
}
|
}
|
||||||
sysUser.setWorkNo(null);
|
// 设置工号,如果工号为空,则使用username
|
||||||
|
if (oConvertUtils.isEmpty(dtUser.getJob_number())) {
|
||||||
|
sysUser.setWorkNo(dtUser.getUserid());
|
||||||
|
} else {
|
||||||
|
sysUser.setWorkNo(dtUser.getJob_number());
|
||||||
|
}
|
||||||
// --- 钉钉没有逻辑删除功能
|
// --- 钉钉没有逻辑删除功能
|
||||||
// sysUser.getDelFlag()
|
// sysUser.getDelFlag()
|
||||||
// --- 钉钉没有冻结、启用禁用功能
|
// --- 钉钉没有冻结、启用禁用功能
|
||||||
|
@ -763,8 +770,8 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||||
return JdtMessageAPI.sendTextMessage(textMessage, accessToken);
|
return JdtMessageAPI.sendTextMessage(textMessage, accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean recallMessage(String msg_task_id) {
|
public boolean recallMessage(String msgTaskId) {
|
||||||
Response<JSONObject> response = this.recallMessageResponse(msg_task_id);
|
Response<JSONObject> response = this.recallMessageResponse(msgTaskId);
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -774,16 +781,16 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
||||||
/**
|
/**
|
||||||
* 撤回消息
|
* 撤回消息
|
||||||
*
|
*
|
||||||
* @param msg_task_id
|
* @param msgTaskId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Response<JSONObject> recallMessageResponse(String msg_task_id) {
|
public Response<JSONObject> recallMessageResponse(String msgTaskId) {
|
||||||
String accessToken = this.getAccessToken();
|
String accessToken = this.getAccessToken();
|
||||||
if (accessToken == null) {
|
if (accessToken == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int agentId = thirdAppConfig.getDingtalk().getAgentIdInt();
|
int agentId = thirdAppConfig.getDingtalk().getAgentIdInt();
|
||||||
return JdtMessageAPI.recallMessage(agentId, msg_task_id, getAccessToken());
|
return JdtMessageAPI.recallMessage(agentId, msgTaskId, getAccessToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,6 +41,8 @@ spring:
|
||||||
initialize-schema: embedded
|
initialize-schema: embedded
|
||||||
#定时任务启动开关,true-开 false-关
|
#定时任务启动开关,true-开 false-关
|
||||||
auto-startup: true
|
auto-startup: true
|
||||||
|
#延迟1秒启动定时任务
|
||||||
|
startup-delay: 1s
|
||||||
#启动时更新己存在的Job
|
#启动时更新己存在的Job
|
||||||
overwrite-existing-jobs: true
|
overwrite-existing-jobs: true
|
||||||
properties:
|
properties:
|
||||||
|
@ -54,8 +56,8 @@ spring:
|
||||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||||
tablePrefix: QRTZ_
|
tablePrefix: QRTZ_
|
||||||
isClustered: true
|
isClustered: true
|
||||||
misfireThreshold: 60000
|
misfireThreshold: 12000
|
||||||
clusterCheckinInterval: 10000
|
clusterCheckinInterval: 15000
|
||||||
threadPool:
|
threadPool:
|
||||||
class: org.quartz.simpl.SimpleThreadPool
|
class: org.quartz.simpl.SimpleThreadPool
|
||||||
threadCount: 10
|
threadCount: 10
|
||||||
|
|
|
@ -39,6 +39,8 @@ spring:
|
||||||
quartz:
|
quartz:
|
||||||
job-store-type: jdbc
|
job-store-type: jdbc
|
||||||
initialize-schema: embedded
|
initialize-schema: embedded
|
||||||
|
#延迟1秒启动定时任务
|
||||||
|
startup-delay: 1s
|
||||||
#定时任务启动开关,true-开 false-关
|
#定时任务启动开关,true-开 false-关
|
||||||
auto-startup: true
|
auto-startup: true
|
||||||
#启动时更新己存在的Job
|
#启动时更新己存在的Job
|
||||||
|
@ -54,8 +56,8 @@ spring:
|
||||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||||
tablePrefix: QRTZ_
|
tablePrefix: QRTZ_
|
||||||
isClustered: true
|
isClustered: true
|
||||||
misfireThreshold: 60000
|
misfireThreshold: 12000
|
||||||
clusterCheckinInterval: 10000
|
clusterCheckinInterval: 15000
|
||||||
threadPool:
|
threadPool:
|
||||||
class: org.quartz.simpl.SimpleThreadPool
|
class: org.quartz.simpl.SimpleThreadPool
|
||||||
threadCount: 10
|
threadCount: 10
|
||||||
|
|
|
@ -41,6 +41,8 @@ spring:
|
||||||
initialize-schema: embedded
|
initialize-schema: embedded
|
||||||
#定时任务启动开关,true-开 false-关
|
#定时任务启动开关,true-开 false-关
|
||||||
auto-startup: true
|
auto-startup: true
|
||||||
|
#延迟1秒启动定时任务
|
||||||
|
startup-delay: 1s
|
||||||
#启动时更新己存在的Job
|
#启动时更新己存在的Job
|
||||||
overwrite-existing-jobs: true
|
overwrite-existing-jobs: true
|
||||||
properties:
|
properties:
|
||||||
|
@ -54,8 +56,8 @@ spring:
|
||||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||||
tablePrefix: QRTZ_
|
tablePrefix: QRTZ_
|
||||||
isClustered: true
|
isClustered: true
|
||||||
misfireThreshold: 60000
|
misfireThreshold: 12000
|
||||||
clusterCheckinInterval: 10000
|
clusterCheckinInterval: 15000
|
||||||
threadPool:
|
threadPool:
|
||||||
class: org.quartz.simpl.SimpleThreadPool
|
class: org.quartz.simpl.SimpleThreadPool
|
||||||
threadCount: 10
|
threadCount: 10
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
<artifactId>jeecg-boot-starter-lock</artifactId>
|
<artifactId>jeecg-boot-starter-lock</artifactId>
|
||||||
<description>jeecg-boot-starter-分布式锁</description>
|
<description>jeecg-boot-starter-分布式锁</description>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-boot-base-tools</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.redisson</groupId>
|
<groupId>org.redisson</groupId>
|
||||||
<artifactId>redisson</artifactId>
|
<artifactId>redisson</artifactId>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.jeecg.boot.starter.lock.annotation.JRepeat;
|
import org.jeecg.boot.starter.lock.annotation.JRepeat;
|
||||||
import org.jeecg.boot.starter.lock.client.RedissonLockClient;
|
import org.jeecg.boot.starter.lock.client.RedissonLockClient;
|
||||||
|
import org.jeecg.common.exception.JeecgCloudException;
|
||||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ public class RepeatSubmitAspect extends BaseAspect{
|
||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
} else {
|
} else {
|
||||||
// 未获取到锁
|
// 未获取到锁
|
||||||
throw new Exception("请勿重复提交");
|
throw new JeecgCloudException("请勿重复提交");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// 如果锁还存在,在方法执行完成后,释放锁
|
// 如果锁还存在,在方法执行完成后,释放锁
|
||||||
|
|
|
@ -221,16 +221,6 @@ public class RabbitMqClient {
|
||||||
rabbitAdmin.declareBinding(binding);
|
rabbitAdmin.declareBinding(binding);
|
||||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
log.debug("发送时间:" + sf.format(new Date()));
|
log.debug("发送时间:" + sf.format(new Date()));
|
||||||
messageListenerContainer.setQueueNames(queueName);
|
|
||||||
/* messageListenerContainer.setMessageListener(new MqListener<Message>() {
|
|
||||||
@Override
|
|
||||||
public void onMessage(Message message, Channel channel) {
|
|
||||||
MqListener messageListener = SpringContextHolder.getHandler(queueName + "Listener", MqListener.class);
|
|
||||||
if (ObjectUtil.isNotEmpty(messageListener)) {
|
|
||||||
messageListener.onMessage(message, channel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
rabbitTemplate.convertAndSend(DelayExchangeBuilder.DEFAULT_DELAY_EXCHANGE, queueName, params, message -> {
|
rabbitTemplate.convertAndSend(DelayExchangeBuilder.DEFAULT_DELAY_EXCHANGE, queueName, params, message -> {
|
||||||
if (expiration != null && expiration > 0) {
|
if (expiration != null && expiration > 0) {
|
||||||
message.getMessageProperties().setHeader("x-delay", expiration);
|
message.getMessageProperties().setHeader("x-delay", expiration);
|
||||||
|
|
|
@ -4,6 +4,10 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nacos 启动类
|
* Nacos 启动类
|
||||||
|
@ -34,4 +38,15 @@ public class JeecgNacosApplication {
|
||||||
SpringApplication.run(JeecgNacosApplication.class, args);
|
SpringApplication.run(JeecgNacosApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认跳转首页
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/")
|
||||||
|
public String index(Model model, HttpServletResponse response) {
|
||||||
|
// 视图重定向 - 跳转
|
||||||
|
return "/nacos";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<!-- 微服务属性 -->
|
<!-- 微服务属性 -->
|
||||||
<skip.springboot.maven>false</skip.springboot.maven>
|
<skip.springboot.maven>false</skip.springboot.maven>
|
||||||
<spring-cloud.version>2021.0.0</spring-cloud.version>
|
<spring-cloud.version>2021.0.3</spring-cloud.version>
|
||||||
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
||||||
<alibaba.nacos.version>2.0.4</alibaba.nacos.version>
|
<alibaba.nacos.version>2.0.4</alibaba.nacos.version>
|
||||||
|
|
||||||
|
@ -336,6 +336,18 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 积木报表 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
|
<artifactId>jimureport-spring-boot-starter</artifactId>
|
||||||
|
<version>1.5.0</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue