style: 规范化项目(二):解决三十余处代码编译警告

pull/69/head
xiaoxiamo 5 months ago
parent 4a73ea8439
commit c51257e621

@ -25,7 +25,7 @@ public class CronTaskHandler {
@Autowired
private ThreadPoolUtils threadPoolUtils;
private DtpExecutor dtpExecutor = CronAsyncThreadPoolConfig.getXxlCronExecutor();
private final DtpExecutor dtpExecutor = CronAsyncThreadPoolConfig.getXxlCronExecutor();
/**
* austin

@ -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);
}

@ -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);
}
}

@ -18,7 +18,7 @@ import java.util.Map;
public class AlipayClientSingleton {
private static Map<String, DefaultAlipayClient> alipayClientMap = new HashMap<>();
private static final Map<String, DefaultAlipayClient> alipayClientMap = new HashMap<>();
private AlipayClientSingleton() {
}

@ -14,7 +14,7 @@ import java.util.Map;
@Component
public class HandlerHolder {
private Map<Integer, Handler> handlers = new HashMap<>(128);
private final Map<Integer, Handler> handlers = new HashMap<>(128);
public void putHandler(Integer channelCode, Handler handler) {
handlers.put(channelCode, handler);

@ -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());
}
/**

@ -24,10 +24,10 @@ public class TaskPendingHolder {
/**
* groupId
*/
private static List<String> groupIds = GroupIdMappingUtils.getAllGroupIds();
private static final List<String> groupIds = GroupIdMappingUtils.getAllGroupIds();
@Autowired
private ThreadPoolUtils threadPoolUtils;
private Map<String, ExecutorService> holder = new HashMap<>(32);
private final Map<String, ExecutorService> holder = new HashMap<>(32);
/**
* 线

@ -39,7 +39,7 @@ public class ReceiverStart {
/**
* groupId
*/
private static List<String> groupIds = GroupIdMappingUtils.getAllGroupIds();
private static final List<String> groupIds = GroupIdMappingUtils.getAllGroupIds();
/**
* (groupIds)
*/

@ -152,7 +152,7 @@ public class TencentSmsScript implements SmsScript {
*/
private List<SmsRecord> assemblePullSmsRecord(TencentSmsAccount account, PullSmsSendStatusResponse resp) {
List<SmsRecord> 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)))

@ -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;

@ -37,7 +37,7 @@ public class RecallMqAction implements BusinessProcess<RecallTaskModel> {
public void process(ProcessContext<RecallTaskModel> 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));

@ -47,7 +47,7 @@ public class SendMqAction implements BusinessProcess<SendTaskModel> {
SendTaskModel sendTaskModel = context.getProcessModel();
List<TaskInfo> 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())));

@ -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)

@ -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;

@ -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<Header> headers = Arrays.asList(new RecordHeader(tagIdKey, tagId.getBytes(StandardCharsets.UTF_8)));
List<Header> headers = Collections.singletonList(new RecordHeader(tagIdKey, tagId.getBytes(StandardCharsets.UTF_8)));
kafkaTemplate.send(new ProducerRecord(topic, null, null, null, jsonValue, headers));
return;
}

@ -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);

@ -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

@ -45,8 +45,8 @@ public class AccountUtils {
/**
* /
*/
private ConcurrentMap<ChannelAccount, WxMpService> officialAccountServiceMap = new ConcurrentHashMap<>();
private ConcurrentMap<ChannelAccount, WxMaService> miniProgramServiceMap = new ConcurrentHashMap<>();
private final ConcurrentMap<ChannelAccount, WxMpService> officialAccountServiceMap = new ConcurrentHashMap<>();
private final ConcurrentMap<ChannelAccount, WxMaService> miniProgramServiceMap = new ConcurrentHashMap<>();
@Bean
public RedisTemplateWxRedisOps redisTemplateWxRedisOps() {

@ -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<SmsRecord> 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<String, List<SmsRecord>> maps = smsRecordList.stream().collect(Collectors.groupingBy(o -> o.getPhone() + o.getSeriesId()));

@ -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));

@ -58,7 +58,7 @@ public class Convert4Amis {
* (json
* ()
*/
private static final List<String> FLAT_FIELD_NAME = Arrays.asList("msgContent");
private static final List<String> FLAT_FIELD_NAME = Collections.singletonList("msgContent");
/**
* jsonArray
@ -350,7 +350,7 @@ public class Convert4Amis {
List<CommonAmisVo.ColumnsDTO> columnsDtoS = new ArrayList<>();
//使用i作为变量循环
for (int i=0;i<data.length;i++) {
String name ="keyword"+String.valueOf(i+1);
String name ="keyword"+ (i + 1);
String label = data[i];
CommonAmisVo.ColumnsDTO columnsDTO = CommonAmisVo.ColumnsDTO.builder()
.name(name).type("input-text").required(true).quickEdit(true).label(label).build();
@ -443,9 +443,9 @@ public class Convert4Amis {
return EchartsVo.builder()
.title(EchartsVo.TitleVO.builder().text(title).build())
.legend(EchartsVo.LegendVO.builder().data(Arrays.asList("人数")).build())
.legend(EchartsVo.LegendVO.builder().data(Collections.singletonList("人数")).build())
.xAxis(EchartsVo.XaxisVO.builder().data(xAxisList).build())
.series(Arrays.asList(EchartsVo.SeriesVO.builder().name("人数").type("bar").data(actualData).build()))
.series(Collections.singletonList(EchartsVo.SeriesVO.builder().name("人数").type("bar").data(actualData).build()))
.yAxis(EchartsVo.YaxisVO.builder().build())
.tooltip(EchartsVo.TooltipVO.builder().build())
.build();

Loading…
Cancel
Save