From 96d9b8401833c4bfa47cc08c3509428087d421e0 Mon Sep 17 00:00:00 2001 From: super_liu <396572590@qq.com> Date: Sun, 19 Sep 2021 15:58:26 +0800 Subject: [PATCH] feat: There is no way the MQ conf --- pom.xml | 5 +++++ .../business_mq/service/SendDoneMQService.java | 12 +++++------- .../todoContent/NotifyTodoSendContext.java | 4 +++- src/main/resources/application.yml | 12 +++++++----- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 377df6dd..4504c8b0 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,11 @@ org.springframework.boot spring-boot-starter-amqp + + org.springframework.amqp + spring-rabbit-test + test + org.springframework.cloud diff --git a/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendDoneMQService.java b/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendDoneMQService.java index 6d153160..e35f2bbd 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendDoneMQService.java +++ b/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendDoneMQService.java @@ -44,7 +44,7 @@ public class SendDoneMQService { value = @Queue(value = "createMQDone_SQ_GSAR", durable = "true"), exchange = @Exchange(value = "sendDone-exchange_MQ_GSAR", ignoreDeclarationExceptions = "true"), key = "sendDone-key_MQ_GSAR")) - public void createMQ(NotifyTodoSendContext object, Message message, Channel channel) throws Exception{ + public void createMQDone(NotifyTodoSendContext object, Message message, Channel channel) throws Exception{ try{ try{ insertOrUpdateInfo(object); @@ -84,24 +84,22 @@ public class SendDoneMQService { } public void restartSendMq(NotifyTodoSendContext object) throws Exception{ - SendTodoLog sendTodoLog = new SendTodoLog(); QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("TODO_ID",object.getModelId()); wrapper.eq("MSG_TYPE","1"); List list = sendTodoLogMapper.selectList(wrapper); - if(!list.isEmpty()){ - sendTodoLog = list.get(0); - } SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); - if(sendTodoLog != null){ + if(!list.isEmpty()){ + SendTodoLog sendTodoLog = list.get(0); int againNumNew = Integer.valueOf(sendTodoLog.getErrNum()); if(againNumNew >= 6){ // 发送待办 或 发送给管理员邮箱 - logger.info("发送失败9次,发送给管理员邮箱"); + logger.info("发送失败6次,发送给管理员邮箱"); }else { restSendDoneTodo(object, sdf, sendTodoLog, againNumNew); } + }else { sendTodoSave(object, sdf, "3"); } diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/todoContent/NotifyTodoSendContext.java b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/todoContent/NotifyTodoSendContext.java index 25005d4e..ac0b8be0 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/todoContent/NotifyTodoSendContext.java +++ b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/todoContent/NotifyTodoSendContext.java @@ -3,13 +3,15 @@ package com.ydw.bat.wkflow.business_oa.webService.todoContent; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; + /** * @Description: TODO * @author: super_liu * @date: 2021年09月08日 15:05 */ @Data -public class NotifyTodoSendContext { +public class NotifyTodoSendContext implements Serializable { @ApiModelProperty(value = "标识待办来源的系统") private String appName; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ff43a3ab..eebfe46d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -15,7 +15,7 @@ logging: eureka: client: serviceUrl: - defaultZone: http://127.0.0.1:8761/eureka/ + defaultZone: http://62.234.136.153:8761/eureka/ spring: application: name: bat-wkflow @@ -31,7 +31,7 @@ spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/foton-bat-wkflow?nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=utf-8 + url: jdbc:mysql://39.100.23.127:3306/foton-bat-wkflow?nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=utf-8 username: root password: root activiti: @@ -42,12 +42,14 @@ spring: active: dev # 相关服务配置同业务系统 rabbitmq: - host: 127.0.0.1 + host: 62.234.136.153 port: 5672 username: guest password: guest listener: simple: + concurrency: 5 + max-concurrency: 10 acknowledge-mode: manual #消费失败消息干掉 default-requeue-rejected: true @@ -56,7 +58,7 @@ spring: initial-interval: 5000 enabled: true #最大重试9次 - max-attempts: 9 + max-attempts: 6 mybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl @@ -66,5 +68,5 @@ ribbon: ConnectTimeout: 60000 # 配置前端服务全路径地址 如下 /#/ -webUrl: http://127.0.0.1:10088/#/ +webUrl: http://62.234.136.153:8038/#/