diff --git a/austin-cron/src/main/java/com/java3y/austin/cron/handler/CronTaskHandler.java b/austin-cron/src/main/java/com/java3y/austin/cron/handler/CronTaskHandler.java index 7587e3c..0c8efbd 100644 --- a/austin-cron/src/main/java/com/java3y/austin/cron/handler/CronTaskHandler.java +++ b/austin-cron/src/main/java/com/java3y/austin/cron/handler/CronTaskHandler.java @@ -25,7 +25,7 @@ public class CronTaskHandler { @Autowired private ThreadPoolUtils threadPoolUtils; - private DtpExecutor dtpExecutor = CronAsyncThreadPoolConfig.getXxlCronExecutor(); + private final DtpExecutor dtpExecutor = CronAsyncThreadPoolConfig.getXxlCronExecutor(); /** * 处理后台的 austin 定时任务消息 diff --git a/austin-cron/src/main/java/com/java3y/austin/cron/handler/NightShieldLazyPendingHandler.java b/austin-cron/src/main/java/com/java3y/austin/cron/handler/NightShieldLazyPendingHandler.java index ed29faa..d70953f 100644 --- a/austin-cron/src/main/java/com/java3y/austin/cron/handler/NightShieldLazyPendingHandler.java +++ b/austin-cron/src/main/java/com/java3y/austin/cron/handler/NightShieldLazyPendingHandler.java @@ -14,7 +14,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; -import java.util.Arrays; +import java.util.Collections; /** @@ -48,8 +48,8 @@ public class NightShieldLazyPendingHandler { String taskInfo = redisUtils.lPop(NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY); if (CharSequenceUtil.isNotBlank(taskInfo)) { try { - kafkaTemplate.send(topicName, JSON.toJSONString(Arrays.asList(JSON.parseObject(taskInfo, TaskInfo.class)) - , new SerializerFeature[]{SerializerFeature.WriteClassName})); + kafkaTemplate.send(topicName, JSON.toJSONString(Collections.singletonList(JSON.parseObject(taskInfo, TaskInfo.class)) + , SerializerFeature.WriteClassName)); } catch (Exception e) { log.error("nightShieldLazyJob send kafka fail! e:{},params:{}", Throwables.getStackTraceAsString(e), taskInfo); } diff --git a/austin-data-house/src/main/java/com/java3y/austin/datahouse/AustinHiveBootStrap.java b/austin-data-house/src/main/java/com/java3y/austin/datahouse/AustinHiveBootStrap.java index 656e264..b87d2f5 100644 --- a/austin-data-house/src/main/java/com/java3y/austin/datahouse/AustinHiveBootStrap.java +++ b/austin-data-house/src/main/java/com/java3y/austin/datahouse/AustinHiveBootStrap.java @@ -74,7 +74,7 @@ public class AustinHiveBootStrap { // 3. 将kafka_source 数据写入到kafka_sink 完成 tableEnv.getConfig().setSqlDialect(SqlDialect.DEFAULT); - tableEnv.executeSql("INSERT INTO " + DataHouseConstant.CATALOG_DEFAULT_DATABASE + "." + DataHouseConstant.KAFKA_SINK_TABLE_NAME + " SELECT ids,state,businessId,logTimestamp FROM " + DataHouseConstant.CATALOG_DEFAULT_DATABASE + "." + DataHouseConstant.KAFKA_SOURCE_TABLE_NAME + ""); + tableEnv.executeSql("INSERT INTO " + DataHouseConstant.CATALOG_DEFAULT_DATABASE + "." + DataHouseConstant.KAFKA_SINK_TABLE_NAME + " SELECT ids,state,businessId,logTimestamp FROM " + DataHouseConstant.CATALOG_DEFAULT_DATABASE + "." + DataHouseConstant.KAFKA_SOURCE_TABLE_NAME); } } diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/config/AlipayClientSingleton.java b/austin-handler/src/main/java/com/java3y/austin/handler/config/AlipayClientSingleton.java index 96dfae3..a221bce 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/config/AlipayClientSingleton.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/config/AlipayClientSingleton.java @@ -18,7 +18,7 @@ import java.util.Map; public class AlipayClientSingleton { - private static Map alipayClientMap = new HashMap<>(); + private static final Map alipayClientMap = new HashMap<>(); private AlipayClientSingleton() { } diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/HandlerHolder.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/HandlerHolder.java index 645ba89..9303d4d 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/handler/HandlerHolder.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/HandlerHolder.java @@ -14,7 +14,7 @@ import java.util.Map; @Component public class HandlerHolder { - private Map handlers = new HashMap<>(128); + private final Map handlers = new HashMap<>(128); public void putHandler(Integer channelCode, Handler handler) { handlers.put(channelCode, handler); diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java index 00b7b2f..68f140c 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java @@ -24,10 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Random; +import java.util.*; /** * 短信发送处理 @@ -142,7 +139,7 @@ public class SmsHandler extends BaseHandler{ */ if (!taskInfo.getSendAccount().equals(AUTO_FLOW_RULE)) { SmsAccount account = accountUtils.getAccountById(taskInfo.getSendAccount(), SmsAccount.class); - return Arrays.asList(MessageTypeSmsConfig.builder().sendAccount(taskInfo.getSendAccount()).scriptName(account.getScriptName()).weights(100).build()); + return Collections.singletonList(MessageTypeSmsConfig.builder().sendAccount(taskInfo.getSendAccount()).scriptName(account.getScriptName()).weights(100).build()); } /** diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/pending/TaskPendingHolder.java b/austin-handler/src/main/java/com/java3y/austin/handler/pending/TaskPendingHolder.java index 19aec62..8997cdb 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/pending/TaskPendingHolder.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/pending/TaskPendingHolder.java @@ -24,10 +24,10 @@ public class TaskPendingHolder { /** * 获取得到所有的groupId */ - private static List groupIds = GroupIdMappingUtils.getAllGroupIds(); + private static final List groupIds = GroupIdMappingUtils.getAllGroupIds(); @Autowired private ThreadPoolUtils threadPoolUtils; - private Map holder = new HashMap<>(32); + private final Map holder = new HashMap<>(32); /** * 给每个渠道,每种消息类型初始化一个线程池 diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/receiver/kafka/ReceiverStart.java b/austin-handler/src/main/java/com/java3y/austin/handler/receiver/kafka/ReceiverStart.java index 4ba8cc0..f0252cb 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/receiver/kafka/ReceiverStart.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/receiver/kafka/ReceiverStart.java @@ -39,7 +39,7 @@ public class ReceiverStart { /** * 获取得到所有的groupId */ - private static List groupIds = GroupIdMappingUtils.getAllGroupIds(); + private static final List groupIds = GroupIdMappingUtils.getAllGroupIds(); /** * 下标(用于迭代groupIds位置) */ diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java index 520ad94..b08b9b7 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java @@ -152,7 +152,7 @@ public class TencentSmsScript implements SmsScript { */ private List assemblePullSmsRecord(TencentSmsAccount account, PullSmsSendStatusResponse resp) { List smsRecordList = new ArrayList<>(); - if (Objects.nonNull(resp) && Objects.nonNull(resp.getPullSmsSendStatusSet()) && resp.getPullSmsSendStatusSet().length > 0) { + if (Objects.nonNull(resp) && Objects.nonNull(resp.getPullSmsSendStatusSet())) { for (PullSmsSendStatus pullSmsSendStatus : resp.getPullSmsSendStatusSet()) { SmsRecord smsRecord = SmsRecord.builder() .sendDate(Integer.valueOf(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN))) diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java index 01c6a61..b411de4 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java @@ -6,7 +6,6 @@ import cn.hutool.core.net.URLEncodeUtil; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.StrPool; import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.util.StrUtil; import cn.hutool.http.Header; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; @@ -38,7 +37,7 @@ public class YunPianSmsScript implements SmsScript { private static final String PARAMS_SPLIT_KEY = "{|}"; private static final String PARAMS_KV_SPLIT_KEY = "{:}"; - private static Logger log = LoggerFactory.getLogger(YunPianSmsScript.class); + private static final Logger log = LoggerFactory.getLogger(YunPianSmsScript.class); @Autowired private AccountUtils accountUtils; diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/recall/RecallMqAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/recall/RecallMqAction.java index 1afbdb0..4d91fcd 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/recall/RecallMqAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/recall/RecallMqAction.java @@ -37,7 +37,7 @@ public class RecallMqAction implements BusinessProcess { public void process(ProcessContext context) { RecallTaskInfo recallTaskInfo = context.getProcessModel().getRecallTaskInfo(); try { - String message = JSON.toJSONString(recallTaskInfo, new SerializerFeature[]{SerializerFeature.WriteClassName}); + String message = JSON.toJSONString(recallTaskInfo, SerializerFeature.WriteClassName); sendMqService.send(austinRecall, message, tagId); } catch (Exception e) { context.setNeedBreak(true).setResponse(BasicResultVO.fail(RespStatusEnum.SERVICE_ERROR)); diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendMqAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendMqAction.java index 0fee9da..2e07b6d 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendMqAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendMqAction.java @@ -47,7 +47,7 @@ public class SendMqAction implements BusinessProcess { SendTaskModel sendTaskModel = context.getProcessModel(); List taskInfo = sendTaskModel.getTaskInfo(); try { - String message = JSON.toJSONString(sendTaskModel.getTaskInfo(), new SerializerFeature[]{SerializerFeature.WriteClassName}); + String message = JSON.toJSONString(sendTaskModel.getTaskInfo(), SerializerFeature.WriteClassName); sendMqService.send(sendMessageTopic, message, tagId); context.setResponse(BasicResultVO.success(taskInfo.stream().map(v -> SimpleTaskInfo.builder().businessId(v.getBusinessId()).messageId(v.getMessageId()).bizId(v.getBizId()).build()).collect(Collectors.toList()))); diff --git a/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java b/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java index 0639839..af41f52 100644 --- a/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java +++ b/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java @@ -23,7 +23,7 @@ public class LettuceRedisUtils { /** * 初始化 redisClient */ - private static RedisClient redisClient; + private static final RedisClient redisClient; static { RedisURI redisUri = RedisURI.Builder.redis(AustinFlinkConstant.REDIS_IP) diff --git a/austin-support/src/main/java/com/java3y/austin/support/mq/eventbus/EventBusSendMqServiceImpl.java b/austin-support/src/main/java/com/java3y/austin/support/mq/eventbus/EventBusSendMqServiceImpl.java index e5d3a28..4bcfedc 100644 --- a/austin-support/src/main/java/com/java3y/austin/support/mq/eventbus/EventBusSendMqServiceImpl.java +++ b/austin-support/src/main/java/com/java3y/austin/support/mq/eventbus/EventBusSendMqServiceImpl.java @@ -21,7 +21,7 @@ import org.springframework.stereotype.Service; @Service @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.EVENT_BUS) public class EventBusSendMqServiceImpl implements SendMqService { - private EventBus eventBus = new EventBus(); + private final EventBus eventBus = new EventBus(); @Autowired private EventBusListener eventBusListener; diff --git a/austin-support/src/main/java/com/java3y/austin/support/mq/kafka/KafkaSendMqServiceImpl.java b/austin-support/src/main/java/com/java3y/austin/support/mq/kafka/KafkaSendMqServiceImpl.java index 16d8166..bd19329 100644 --- a/austin-support/src/main/java/com/java3y/austin/support/mq/kafka/KafkaSendMqServiceImpl.java +++ b/austin-support/src/main/java/com/java3y/austin/support/mq/kafka/KafkaSendMqServiceImpl.java @@ -14,7 +14,7 @@ import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; import java.nio.charset.StandardCharsets; -import java.util.Arrays; +import java.util.Collections; import java.util.List; @@ -36,7 +36,7 @@ public class KafkaSendMqServiceImpl implements SendMqService { @Override public void send(String topic, String jsonValue, String tagId) { if (CharSequenceUtil.isNotBlank(tagId)) { - List
headers = Arrays.asList(new RecordHeader(tagIdKey, tagId.getBytes(StandardCharsets.UTF_8))); + List
headers = Collections.singletonList(new RecordHeader(tagIdKey, tagId.getBytes(StandardCharsets.UTF_8))); kafkaTemplate.send(new ProducerRecord(topic, null, null, null, jsonValue, headers)); return; } diff --git a/austin-support/src/main/java/com/java3y/austin/support/mq/springeventbus/AustinSpringEventBusEvent.java b/austin-support/src/main/java/com/java3y/austin/support/mq/springeventbus/AustinSpringEventBusEvent.java index 961a6ce..cb118d6 100644 --- a/austin-support/src/main/java/com/java3y/austin/support/mq/springeventbus/AustinSpringEventBusEvent.java +++ b/austin-support/src/main/java/com/java3y/austin/support/mq/springeventbus/AustinSpringEventBusEvent.java @@ -12,7 +12,7 @@ import org.springframework.context.ApplicationEvent; @Getter public class AustinSpringEventBusEvent extends ApplicationEvent { - private AustinSpringEventSource austinSpringEventSource; + private final AustinSpringEventSource austinSpringEventSource; public AustinSpringEventBusEvent(Object source, AustinSpringEventSource austinSpringEventSource) { super(source); diff --git a/austin-support/src/main/java/com/java3y/austin/support/service/impl/ConfigServiceImpl.java b/austin-support/src/main/java/com/java3y/austin/support/service/impl/ConfigServiceImpl.java index b38351c..dd8086e 100644 --- a/austin-support/src/main/java/com/java3y/austin/support/service/impl/ConfigServiceImpl.java +++ b/austin-support/src/main/java/com/java3y/austin/support/service/impl/ConfigServiceImpl.java @@ -23,7 +23,7 @@ public class ConfigServiceImpl implements ConfigService { * 本地配置 */ private static final String PROPERTIES_PATH = "local.properties"; - private Props props = new Props(PROPERTIES_PATH, StandardCharsets.UTF_8); + private final Props props = new Props(PROPERTIES_PATH, StandardCharsets.UTF_8); /** * apollo配置 diff --git a/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java b/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java index 91817aa..e1ece79 100644 --- a/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java +++ b/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java @@ -45,8 +45,8 @@ public class AccountUtils { /** * 消息的小程序/微信服务号账号 */ - private ConcurrentMap officialAccountServiceMap = new ConcurrentHashMap<>(); - private ConcurrentMap miniProgramServiceMap = new ConcurrentHashMap<>(); + private final ConcurrentMap officialAccountServiceMap = new ConcurrentHashMap<>(); + private final ConcurrentMap miniProgramServiceMap = new ConcurrentHashMap<>(); @Bean public RedisTemplateWxRedisOps redisTemplateWxRedisOps() { diff --git a/austin-web/src/main/java/com/java3y/austin/web/service/impl/DataServiceImpl.java b/austin-web/src/main/java/com/java3y/austin/web/service/impl/DataServiceImpl.java index 8057203..3c9eeb4 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/service/impl/DataServiceImpl.java +++ b/austin-web/src/main/java/com/java3y/austin/web/service/impl/DataServiceImpl.java @@ -101,7 +101,7 @@ public class DataServiceImpl implements DataService { Integer sendDate = Integer.valueOf(DateUtil.format(new Date(dataParam.getDateTime() * 1000L), DatePattern.PURE_DATE_PATTERN)); List smsRecordList = smsRecordDao.findByPhoneAndSendDate(Long.valueOf(dataParam.getReceiver()), sendDate); if (CollUtil.isEmpty(smsRecordList)) { - return SmsTimeLineVo.builder().items(Arrays.asList(SmsTimeLineVo.ItemsVO.builder().build())).build(); + return SmsTimeLineVo.builder().items(Collections.singletonList(SmsTimeLineVo.ItemsVO.builder().build())).build(); } Map> maps = smsRecordList.stream().collect(Collectors.groupingBy(o -> o.getPhone() + o.getSeriesId())); diff --git a/austin-web/src/main/java/com/java3y/austin/web/service/impl/MaterialServiceImpl.java b/austin-web/src/main/java/com/java3y/austin/web/service/impl/MaterialServiceImpl.java index dfe1c87..ead5443 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/service/impl/MaterialServiceImpl.java +++ b/austin-web/src/main/java/com/java3y/austin/web/service/impl/MaterialServiceImpl.java @@ -55,7 +55,7 @@ public class MaterialServiceImpl implements MaterialService { String accessToken = accessTokenUtils.getAccessToken(ChannelType.DING_DING_WORK_NOTICE.getCode(), Integer.valueOf(sendAccount), account, false); DingTalkClient client = new DefaultDingTalkClient(SendChanelUrlConstant.DING_DING_UPLOAD_URL); OapiMediaUploadRequest req = new OapiMediaUploadRequest(); - FileItem item = new FileItem(new StringBuilder().append(IdUtil.fastSimpleUUID()).append(file.getOriginalFilename()).toString(), + FileItem item = new FileItem(IdUtil.fastSimpleUUID() + file.getOriginalFilename(), file.getInputStream()); req.setMedia(item); req.setType(EnumUtil.getDescriptionByCode(Integer.valueOf(fileType), FileType.class)); diff --git a/austin-web/src/main/java/com/java3y/austin/web/utils/Convert4Amis.java b/austin-web/src/main/java/com/java3y/austin/web/utils/Convert4Amis.java index 729ae87..2563a4a 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/utils/Convert4Amis.java +++ b/austin-web/src/main/java/com/java3y/austin/web/utils/Convert4Amis.java @@ -58,7 +58,7 @@ public class Convert4Amis { * 需要打散的字段(将json字符串打散为一个一个字段返回) * (主要是用于回显数据) */ - private static final List FLAT_FIELD_NAME = Arrays.asList("msgContent"); + private static final List FLAT_FIELD_NAME = Collections.singletonList("msgContent"); /** * 需要格式化为jsonArray返回的字段 @@ -350,7 +350,7 @@ public class Convert4Amis { List columnsDtoS = new ArrayList<>(); //使用i作为变量循环 for (int i=0;i