diff --git a/ant-design-vue-jeecg/src/views/system/modules/GateWayRouteModal.vue b/ant-design-vue-jeecg/src/views/system/modules/GateWayRouteModal.vue index 3e3409a9..bd017a13 100644 --- a/ant-design-vue-jeecg/src/views/system/modules/GateWayRouteModal.vue +++ b/ant-design-vue-jeecg/src/views/system/modules/GateWayRouteModal.vue @@ -133,6 +133,10 @@ filterArray: [ { key: 1, name: '限流过滤器' }], //gateway对应的规则key tagArray: [ + { + name:'Path', + args:[] + }, { name:'Header', args:{ diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java index bd688846..7140721a 100644 --- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java @@ -37,6 +37,15 @@ public class JeecgBootExceptionHandler { return Result.error(e.getMessage()); } + /** + * 处理自定义微服务异常 + */ + @ExceptionHandler(JeecgCloudException.class) + public Result handleJeecgCloudException(JeecgCloudException e){ + log.error(e.getMessage(), e); + return Result.error(e.getMessage()); + } + /** * 处理自定义异常 */ diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-tools/src/main/java/org/jeecg/common/exception/JeecgCloudException.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-tools/src/main/java/org/jeecg/common/exception/JeecgCloudException.java new file mode 100644 index 00000000..b7623ae9 --- /dev/null +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-tools/src/main/java/org/jeecg/common/exception/JeecgCloudException.java @@ -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); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/pom.xml b/jeecg-boot/jeecg-boot-module-system/pom.xml index 93df4e40..2fab1642 100644 --- a/jeecg-boot/jeecg-boot-module-system/pom.xml +++ b/jeecg-boot/jeecg-boot-module-system/pom.xml @@ -52,13 +52,6 @@ org.jeecgframework.jimureport jimureport-spring-boot-starter - 1.5.0-beta - - - fastjson - com.alibaba - - diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java index a5eeb774..5ab81d47 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java @@ -17,7 +17,7 @@ import java.net.UnknownHostException; /** * 单体启动类(采用此类启动为单体模式) * 特别提醒: -* 1.需要集成mogodb请删除 exclude={MongoAutoConfiguration.class} +* 1.需要集成mongodb请删除 exclude={MongoAutoConfiguration.class} * 2.切换微服务 勾选profile的SpringCloud,这个类就无法启动,启动会报错 */ @Slf4j diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/ThirdAppDingtalkServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/ThirdAppDingtalkServiceImpl.java index 88530823..39ff9453 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/ThirdAppDingtalkServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/ThirdAppDingtalkServiceImpl.java @@ -44,8 +44,9 @@ import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; import java.util.ArrayList; -import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; @@ -370,7 +371,8 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService { } // 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) { sysThirdAccount = new SysThirdAccount(); sysThirdAccount.setSysUserId(sysUser.getId()); @@ -402,8 +404,14 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService { List allDepartment = JdtDepartmentAPI.listAll(accessToken); // 根据钉钉部门查询所有钉钉用户,用于反向同步到本地 List ddUserList = this.getDtAllUserByDepartment(allDepartment, accessToken); + // 记录已经同步过的用户id,当有多个部门的情况时,只同步一次 + Set syncedUserIdSet = new HashSet<>(); for (User dtUserInfo : ddUserList) { + if (syncedUserIdSet.contains(dtUserInfo.getUserid())) { + continue; + } + syncedUserIdSet.add(dtUserInfo.getUserid()); SysThirdAccount sysThirdAccount = sysThirdAccountService.getOneByThirdUserId(dtUserInfo.getUserid(), THIRD_TYPE); List collect = sysUsersList.stream().filter(user -> (dtUserInfo.getMobile().equals(user.getPhone()) || dtUserInfo.getUserid().equals(user.getUsername())) ).collect(Collectors.toList()); @@ -581,12 +589,6 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService { // update-begin--Author:liusq Date:20210713 for:钉钉同步到本地的人员没有状态,导致同步之后无法登录 #I3ZC2L sysUser.setStatus(1); // 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); } @@ -611,7 +613,12 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService { } else { 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() // --- 钉钉没有冻结、启用禁用功能 @@ -763,8 +770,8 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService { return JdtMessageAPI.sendTextMessage(textMessage, accessToken); } - public boolean recallMessage(String msg_task_id) { - Response response = this.recallMessageResponse(msg_task_id); + public boolean recallMessage(String msgTaskId) { + Response response = this.recallMessageResponse(msgTaskId); if (response == null) { return false; } @@ -774,16 +781,16 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService { /** * 撤回消息 * - * @param msg_task_id + * @param msgTaskId * @return */ - public Response recallMessageResponse(String msg_task_id) { + public Response recallMessageResponse(String msgTaskId) { String accessToken = this.getAccessToken(); if (accessToken == null) { return null; } int agentId = thirdAppConfig.getDingtalk().getAgentIdInt(); - return JdtMessageAPI.recallMessage(agentId, msg_task_id, getAccessToken()); + return JdtMessageAPI.recallMessage(agentId, msgTaskId, getAccessToken()); } /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml index 49eef6b9..d8057f01 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml @@ -41,6 +41,8 @@ spring: initialize-schema: embedded #定时任务启动开关,true-开 false-关 auto-startup: true + #延迟1秒启动定时任务 + startup-delay: 1s #启动时更新己存在的Job overwrite-existing-jobs: true properties: @@ -54,8 +56,8 @@ spring: driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate tablePrefix: QRTZ_ isClustered: true - misfireThreshold: 60000 - clusterCheckinInterval: 10000 + misfireThreshold: 12000 + clusterCheckinInterval: 15000 threadPool: class: org.quartz.simpl.SimpleThreadPool threadCount: 10 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-prod.yml b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-prod.yml index c4ad62e1..2db8fb02 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-prod.yml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-prod.yml @@ -39,6 +39,8 @@ spring: quartz: job-store-type: jdbc initialize-schema: embedded + #延迟1秒启动定时任务 + startup-delay: 1s #定时任务启动开关,true-开 false-关 auto-startup: true #启动时更新己存在的Job @@ -54,8 +56,8 @@ spring: driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate tablePrefix: QRTZ_ isClustered: true - misfireThreshold: 60000 - clusterCheckinInterval: 10000 + misfireThreshold: 12000 + clusterCheckinInterval: 15000 threadPool: class: org.quartz.simpl.SimpleThreadPool threadCount: 10 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-test.yml b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-test.yml index 678d3c54..671e5592 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-test.yml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-test.yml @@ -41,6 +41,8 @@ spring: initialize-schema: embedded #定时任务启动开关,true-开 false-关 auto-startup: true + #延迟1秒启动定时任务 + startup-delay: 1s #启动时更新己存在的Job overwrite-existing-jobs: true properties: @@ -54,8 +56,8 @@ spring: driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate tablePrefix: QRTZ_ isClustered: true - misfireThreshold: 60000 - clusterCheckinInterval: 10000 + misfireThreshold: 12000 + clusterCheckinInterval: 15000 threadPool: class: org.quartz.simpl.SimpleThreadPool threadCount: 10 diff --git a/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/pom.xml b/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/pom.xml index 88777c06..1fc30297 100644 --- a/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/pom.xml +++ b/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/pom.xml @@ -11,6 +11,10 @@ jeecg-boot-starter-lock jeecg-boot-starter-分布式锁 + + org.jeecgframework.boot + jeecg-boot-base-tools + org.redisson redisson diff --git a/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/src/main/java/org/jeecg/boot/starter/lock/aspect/RepeatSubmitAspect.java b/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/src/main/java/org/jeecg/boot/starter/lock/aspect/RepeatSubmitAspect.java index 0225ce4a..d7eb932e 100644 --- a/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/src/main/java/org/jeecg/boot/starter/lock/aspect/RepeatSubmitAspect.java +++ b/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-lock/src/main/java/org/jeecg/boot/starter/lock/aspect/RepeatSubmitAspect.java @@ -11,6 +11,7 @@ import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.jeecg.boot.starter.lock.annotation.JRepeat; import org.jeecg.boot.starter.lock.client.RedissonLockClient; +import org.jeecg.common.exception.JeecgCloudException; import org.springframework.core.LocalVariableTableParameterNameDiscoverer; import org.springframework.stereotype.Component; @@ -63,7 +64,7 @@ public class RepeatSubmitAspect extends BaseAspect{ return joinPoint.proceed(); } else { // 未获取到锁 - throw new Exception("请勿重复提交"); + throw new JeecgCloudException("请勿重复提交"); } } finally { // 如果锁还存在,在方法执行完成后,释放锁 diff --git a/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-rabbitmq/src/main/java/org/jeecg/boot/starter/rabbitmq/client/RabbitMqClient.java b/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-rabbitmq/src/main/java/org/jeecg/boot/starter/rabbitmq/client/RabbitMqClient.java index a6025bb0..388f7498 100644 --- a/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-rabbitmq/src/main/java/org/jeecg/boot/starter/rabbitmq/client/RabbitMqClient.java +++ b/jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-rabbitmq/src/main/java/org/jeecg/boot/starter/rabbitmq/client/RabbitMqClient.java @@ -221,16 +221,6 @@ public class RabbitMqClient { rabbitAdmin.declareBinding(binding); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); log.debug("发送时间:" + sf.format(new Date())); - messageListenerContainer.setQueueNames(queueName); -/* messageListenerContainer.setMessageListener(new MqListener() { - @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 -> { if (expiration != null && expiration > 0) { message.getMessageProperties().setHeader("x-delay", expiration); diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-nacos/src/main/java/com/alibaba/nacos/JeecgNacosApplication.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-nacos/src/main/java/com/alibaba/nacos/JeecgNacosApplication.java index a927b0c0..91881b21 100644 --- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-nacos/src/main/java/com/alibaba/nacos/JeecgNacosApplication.java +++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-nacos/src/main/java/com/alibaba/nacos/JeecgNacosApplication.java @@ -4,6 +4,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +import javax.servlet.http.HttpServletResponse; /** * Nacos 启动类 @@ -34,4 +38,15 @@ public class JeecgNacosApplication { SpringApplication.run(JeecgNacosApplication.class, args); } + /** + * 默认跳转首页 + * + * @param model + * @return + */ + @GetMapping("/") + public String index(Model model, HttpServletResponse response) { + // 视图重定向 - 跳转 + return "/nacos"; + } } diff --git a/jeecg-boot/pom.xml b/jeecg-boot/pom.xml index b9cea280..0c811c6f 100644 --- a/jeecg-boot/pom.xml +++ b/jeecg-boot/pom.xml @@ -20,7 +20,7 @@ false - 2021.0.0 + 2021.0.3 2021.1 2.0.4 @@ -336,6 +336,18 @@ + + + org.jeecgframework.jimureport + jimureport-spring-boot-starter + 1.5.0 + + + fastjson + com.alibaba + + +