diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/receiver/rabbit/RabbitMqReceiver.java b/austin-handler/src/main/java/com/java3y/austin/handler/receiver/rabbit/RabbitMqReceiver.java index 99dbaff..2b50a77 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/receiver/rabbit/RabbitMqReceiver.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/receiver/rabbit/RabbitMqReceiver.java @@ -8,7 +8,10 @@ import com.java3y.austin.support.domain.MessageTemplate; import org.apache.commons.lang3.StringUtils; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.core.Message; -import org.springframework.amqp.rabbit.annotation.*; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; @@ -24,6 +27,9 @@ import java.util.List; @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.RABBIT_MQ) public class RabbitMqReceiver { + private static final String MSG_TYPE_SEND = "send"; + private static final String MSG_TYPE_RECALL = "recall"; + @Autowired private ConsumeService consumeService; @@ -39,11 +45,11 @@ public class RabbitMqReceiver { if (StringUtils.isBlank(messageContent)) { return; } - if ("send".equals(messageType)) { + if (MSG_TYPE_SEND.equals(messageType)) { // 处理发送消息 List taskInfoLists = JSON.parseArray(messageContent, TaskInfo.class); consumeService.consume2Send(taskInfoLists); - } else if ("recall".equals(messageType)) { + } else if (MSG_TYPE_RECALL.equals(messageType)) { // 处理撤回消息 MessageTemplate messageTemplate = JSON.parseObject(messageContent, MessageTemplate.class); consumeService.consume2recall(messageTemplate); diff --git a/austin-support/src/main/java/com/java3y/austin/support/utils/ContentHolderUtil.java b/austin-support/src/main/java/com/java3y/austin/support/utils/ContentHolderUtil.java index ae3f868..6721f29 100644 --- a/austin-support/src/main/java/com/java3y/austin/support/utils/ContentHolderUtil.java +++ b/austin-support/src/main/java/com/java3y/austin/support/utils/ContentHolderUtil.java @@ -1,7 +1,5 @@ package com.java3y.austin.support.utils; -import org.springframework.context.expression.MapAccessor; -import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.util.PropertyPlaceholderHelper; import java.text.MessageFormat; @@ -25,20 +23,11 @@ public class ContentHolderUtil { */ private static final String PLACE_HOLDER_SUFFIX = "}"; - private static final StandardEvaluationContext EVALUATION_CONTEXT; + private static final PropertyPlaceholderHelper PROPERTY_PLACEHOLDER_HELPER = new PropertyPlaceholderHelper(PLACE_HOLDER_PREFIX, PLACE_HOLDER_SUFFIX); - private static final PropertyPlaceholderHelper PROPERTY_PLACEHOLDER_HELPER = new PropertyPlaceholderHelper( - PLACE_HOLDER_PREFIX, PLACE_HOLDER_SUFFIX); - - static { - EVALUATION_CONTEXT = new StandardEvaluationContext(); - EVALUATION_CONTEXT.addPropertyAccessor(new MapAccessor()); - } public static String replacePlaceHolder(final String template, final Map paramMap) { - String replacedPushContent = PROPERTY_PLACEHOLDER_HELPER.replacePlaceholders(template, - new CustomPlaceholderResolver(template, paramMap)); - return replacedPushContent; + return PROPERTY_PLACEHOLDER_HELPER.replacePlaceholders(template, new CustomPlaceholderResolver(template, paramMap)); } private static class CustomPlaceholderResolver implements PropertyPlaceholderHelper.PlaceholderResolver { @@ -55,8 +44,7 @@ public class ContentHolderUtil { public String resolvePlaceholder(String placeholderName) { String value = paramMap.get(placeholderName); if (null == value) { - String errorStr = MessageFormat.format("template:{0} require param:{1},but not exist! paramMap:{2}", - template, placeholderName, paramMap.toString()); + String errorStr = MessageFormat.format("template:{0} require param:{1},but not exist! paramMap:{2}", template, placeholderName, paramMap.toString()); throw new IllegalArgumentException(errorStr); } return value; diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/RefreshTokenController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/RefreshTokenController.java index 01ba0f6..d6b98ef 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/controller/RefreshTokenController.java +++ b/austin-web/src/main/java/com/java3y/austin/web/controller/RefreshTokenController.java @@ -5,7 +5,6 @@ import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.cron.handler.RefreshDingDingAccessTokenHandler; import com.java3y.austin.cron.handler.RefreshGeTuiAccessTokenHandler; import com.java3y.austin.web.annotation.AustinAspect; -import com.java3y.austin.web.annotation.AustinResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired;