mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-10 06:46:04 +08:00
refactor: 局部变量长类型名声明改用 var
嵌套内部类与顶层类名>=17字符的 Type x = new Type() 统一改用 var, 不改逻辑
This commit is contained in:
@@ -42,7 +42,7 @@ public class AlipayDirectConfigAssembler {
|
||||
AlipayDirectApp app = resolveApp(mchNo, channelMchNo, capability);
|
||||
AlipayDirectAppKeyConfig keyConfig = alipayDirectAppKeyConfigService.findByAlipayDirectAppId(app.getId());
|
||||
|
||||
AlipaySdkCredential credential = new AlipaySdkCredential();
|
||||
var credential = new AlipaySdkCredential();
|
||||
credential.setAliAppId(app.getAliAppId());
|
||||
credential.setPrivateKey(keyConfig.getPrivateKey());
|
||||
credential.setAlipayPublicKey(keyConfig.getAlipayPublicKey());
|
||||
|
||||
@@ -47,7 +47,7 @@ public class AlipayIsvConfigAssembler {
|
||||
// 服务商应用密钥/证书配置
|
||||
AlipayIsvAppKeyConfig keyConfig = alipayIsvAppKeyConfigService.findByAlipayIsvAppId(isvMerchant.getIsvAppId());
|
||||
|
||||
AlipaySdkCredential credential = new AlipaySdkCredential();
|
||||
var credential = new AlipaySdkCredential();
|
||||
credential.setAliAppId(isvApp.getAliAppId());
|
||||
credential.setPrivateKey(keyConfig.getPrivateKey());
|
||||
credential.setAlipayPublicKey(keyConfig.getAlipayPublicKey());
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AlipayRefundSyncService {
|
||||
/// @return 同步结果(含映射后的退款状态)
|
||||
public RefundResultBo sync(PayRefundOrder refundOrder, AlipaySdkCredential credential) {
|
||||
// 构建请求
|
||||
AlipayRefundSyncReq req = new AlipayRefundSyncReq();
|
||||
var req = new AlipayRefundSyncReq();
|
||||
req.setOutTradeNo(refundOrder.getOrderNo());
|
||||
req.setTradeNo(refundOrder.getOutOrderNo());
|
||||
req.setOutRequestNo(refundOrder.getRefundNo());
|
||||
|
||||
@@ -49,7 +49,7 @@ public class DouyinDirectChannelMerchantService {
|
||||
channelMerchant.setEnable(true);
|
||||
channelMerchantManager.save(channelMerchant);
|
||||
// 写直连绑定表(dyMchId 作为业务字段)
|
||||
DouyinDirectChannelMerchant entity = new DouyinDirectChannelMerchant();
|
||||
var entity = new DouyinDirectChannelMerchant();
|
||||
entity.setMchNo(param.getMchNo());
|
||||
entity.setChannelMchNo(channelMchNo);
|
||||
entity.setProduct(param.getProduct());
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WechatDirectChannelMerchantService {
|
||||
channelMerchant.setEnable(true);
|
||||
channelMerchantManager.save(channelMerchant);
|
||||
// 写直连绑定表(wxMchId 作为业务字段, 不参与关联)
|
||||
WechatDirectChannelMerchant entity = new WechatDirectChannelMerchant();
|
||||
var entity = new WechatDirectChannelMerchant();
|
||||
entity.setMchNo(param.getMchNo());
|
||||
entity.setChannelMchNo(channelMchNo);
|
||||
entity.setProduct(param.getProduct());
|
||||
|
||||
@@ -50,7 +50,7 @@ public class WechatIsvChannelMerchantService {
|
||||
channelMerchant.setEnable(true);
|
||||
channelMerchantManager.save(channelMerchant);
|
||||
// 写服务商绑定表
|
||||
WechatIsvChannelMerchant entity = new WechatIsvChannelMerchant();
|
||||
var entity = new WechatIsvChannelMerchant();
|
||||
entity.setMchNo(param.getMchNo());
|
||||
entity.setChannelMchNo(channelMchNo);
|
||||
entity.setProduct(param.getProduct());
|
||||
|
||||
@@ -43,7 +43,7 @@ public class WechatRefundSyncService {
|
||||
/// @return 同步结果(含映射后的退款状态)
|
||||
public RefundResultBo sync(PayRefundOrder refundOrder, WechatSdkCredential credential) {
|
||||
// 构建请求
|
||||
WechatRefundSyncReq req = new WechatRefundSyncReq();
|
||||
var req = new WechatRefundSyncReq();
|
||||
req.setOutRefundNo(refundOrder.getRefundNo());
|
||||
req.setCredential(credential);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class MchTenantInterceptorConfiguration {
|
||||
/// 租户拦截器
|
||||
@Bean
|
||||
public MpInterceptor MchTenantInterceptor() {
|
||||
TenantLineInnerInterceptor tenantInterceptor = new TenantLineInnerInterceptor();
|
||||
var tenantInterceptor = new TenantLineInnerInterceptor();
|
||||
tenantInterceptor.setTenantLineHandler(customTenantHandler);
|
||||
return new MpInterceptor(tenantInterceptor, -999);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class NormalPayService {
|
||||
payRouteFacade.resolve(payParam);
|
||||
var payStrategy = PaymentStrategyFactory.createByProduct(payParam.getProduct(), AbsNormalPayStrategy.class);
|
||||
// 支付前处理: 校验与通道配置组装(只依赖请求参数), 失败直接抛出不持久化(订单尚未创建)
|
||||
PayStrategyContext context = new PayStrategyContext().setPayParam(payParam);
|
||||
var context = new PayStrategyContext().setPayParam(payParam);
|
||||
payStrategy.doBeforePay(context);
|
||||
// 查询已有订单并校验,结果填充到 context
|
||||
payAssistService.findAndCheckOrder(payParam.getBizOrderNo(), context);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class PayCloseService {
|
||||
} else {
|
||||
// 处理中: 调用通道关闭/撤销策略
|
||||
closeType = useCancel ? CloseTypeEnum.CANCEL : CloseTypeEnum.CLOSE;
|
||||
PayStrategyContext context = new PayStrategyContext()
|
||||
var context = new PayStrategyContext()
|
||||
.setContainer(normalOrder)
|
||||
.setTrade(trade);
|
||||
AbsPayCloseStrategy strategy = PaymentStrategyFactory.createByProduct(
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PaySyncService {
|
||||
try {
|
||||
NormalPayOrder normalOrder = payNormalOrderManager.findById(trade.getContainerId())
|
||||
.orElse(null);
|
||||
PayStrategyContext context = new PayStrategyContext()
|
||||
var context = new PayStrategyContext()
|
||||
.setContainer(normalOrder)
|
||||
.setTrade(trade);
|
||||
var syncStrategy = PaymentStrategyFactory.createByProduct(
|
||||
@@ -190,7 +190,7 @@ public class PaySyncService {
|
||||
private void closeRemote(PayTrade trade, NormalPayOrder normalOrder) {
|
||||
AbsPayCloseStrategy strategy = PaymentStrategyFactory.createByProduct(
|
||||
trade.getProduct(), AbsPayCloseStrategy.class);
|
||||
PayStrategyContext context = new PayStrategyContext()
|
||||
var context = new PayStrategyContext()
|
||||
.setContainer(normalOrder)
|
||||
.setTrade(trade);
|
||||
strategy.doBeforeClose(context);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class DeviceVendorConfigAdminService {
|
||||
param.getDeviceType(), param.getVendorCode(), param.getConfigName(), null)) {
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.device.vendor.configNameExists");
|
||||
}
|
||||
DeviceVendorConfig entity = new DeviceVendorConfig()
|
||||
var entity = new DeviceVendorConfig()
|
||||
.setDeviceType(param.getDeviceType())
|
||||
.setVendorCode(param.getVendorCode())
|
||||
.setConfigName(param.getConfigName())
|
||||
|
||||
@@ -135,7 +135,7 @@ public class PayProductCapabilityService {
|
||||
|
||||
/// 关联行转为能力展示项
|
||||
private PayProductCapabilityResult toItem(PayProductCapability rel, PayCapability cap) {
|
||||
PayProductCapabilityResult item = new PayProductCapabilityResult()
|
||||
var item = new PayProductCapabilityResult()
|
||||
.setCode(cap.getCode())
|
||||
.setSortNo(rel.getSortNo());
|
||||
PayCapabilityEnum capabilityEnum = PayCapabilityEnum.findByCode(cap.getCode());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class PayProductConfigService {
|
||||
|
||||
/// PayProduct + 库表 + 策略合并为配置结果
|
||||
private PayProductConfigResult toConfigResult(PayProduct payProduct, Map<String, PayProductConfig> configMap) {
|
||||
PayProductConfigResult result = new PayProductConfigResult()
|
||||
var result = new PayProductConfigResult()
|
||||
.setProduct(payProduct.getCode())
|
||||
.setName(I18nUtil.getEnumName(ProductEnum.findByCode(payProduct.getCode())))
|
||||
.setChannel(payProduct.getChannel())
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PayProviderProductService {
|
||||
}
|
||||
Map<String, Set<String>> capabilityCodesByProduct = payProductCapabilityService.loadCapabilityCodesByProduct();
|
||||
for (PayProductResult product : payProductService.listAll()) {
|
||||
PayProviderProductResult productItem = new PayProviderProductResult()
|
||||
var productItem = new PayProviderProductResult()
|
||||
.setLabel(product.getName())
|
||||
.setValue(product.getCode())
|
||||
.setChannel(product.getChannel())
|
||||
|
||||
@@ -82,7 +82,7 @@ public class PayProviderService {
|
||||
int brandOrdinal = 0;
|
||||
for (PayProviderEnum brandEnum : PayProviderEnum.values()) {
|
||||
PayProvider dbBrand = providerMap.get(brandEnum.getCode());
|
||||
PayProviderGroupResult group = new PayProviderGroupResult()
|
||||
var group = new PayProviderGroupResult()
|
||||
.setProvider(brandEnum.getCode())
|
||||
.setProviderLabel(I18nUtil.getEnumName(brandEnum))
|
||||
.setIcon(dbBrand != null ? dbBrand.getIcon() : null)
|
||||
|
||||
@@ -83,7 +83,7 @@ public class PayRouteBasicConfigService {
|
||||
throw new BizInfoException(CommonErrorCode.VALIDATE_PARAMETERS_ERROR,
|
||||
"pay.route.error.productStrategyMissing");
|
||||
}
|
||||
PayRouteBasicConfig config = new PayRouteBasicConfig();
|
||||
var config = new PayRouteBasicConfig();
|
||||
config.setStrategyId(strategy.getId());
|
||||
config.setProvider(item.getProvider());
|
||||
config.setChannelMchNo(item.getChannelMchNo());
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PayRouteSceneConfigService {
|
||||
// 校验支付能力在候选集合内
|
||||
payRouteStrategyCapabilitySupport.validateSceneCapability(
|
||||
providerCode, item.getMethod(), item.getChannelMchNo(), item.getCapability());
|
||||
PayRouteSceneConfig config = new PayRouteSceneConfig();
|
||||
var config = new PayRouteSceneConfig();
|
||||
config.setStrategyId(strategy.getId());
|
||||
config.setMethod(item.getMethod());
|
||||
config.setChannelMchNo(item.getChannelMchNo());
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CacheInvalidationPublisher {
|
||||
/// @param cacheName 缓存名称
|
||||
/// @param key 缓存键
|
||||
public void publishEvict(String cacheName, Object key) {
|
||||
CacheInvalidationMessage message = new CacheInvalidationMessage();
|
||||
var message = new CacheInvalidationMessage();
|
||||
message.setCacheName(cacheName);
|
||||
message.setKey(String.valueOf(key));
|
||||
message.setType(CacheInvalidationType.EVICT.name());
|
||||
@@ -49,7 +49,7 @@ public class CacheInvalidationPublisher {
|
||||
///
|
||||
/// @param cacheName 缓存名称
|
||||
public void publishClear(String cacheName) {
|
||||
CacheInvalidationMessage message = new CacheInvalidationMessage();
|
||||
var message = new CacheInvalidationMessage();
|
||||
message.setCacheName(cacheName);
|
||||
message.setType(CacheInvalidationType.CLEAR.name());
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PlatformFileController {
|
||||
@NotNull(message = "{validation.field.fileId.notNull}") @RequestParam Long fileId,
|
||||
@NotNull(message = "{validation.field.objectKey.notBlank}") @RequestParam String objectKey,
|
||||
@RequestParam(required = false) String etag) {
|
||||
FileUploadConfirmParam param = new FileUploadConfirmParam();
|
||||
var param = new FileUploadConfirmParam();
|
||||
param.setFileId(fileId);
|
||||
param.setObjectKey(objectKey);
|
||||
param.setEtag(etag);
|
||||
|
||||
@@ -76,7 +76,7 @@ public class PlatformFileService {
|
||||
|
||||
OffsetDateTime expireTime = s3FileStorageService.calculateUploadExpireTime();
|
||||
|
||||
PlatformFileRecord platformFileRecord = new PlatformFileRecord()
|
||||
var platformFileRecord = new PlatformFileRecord()
|
||||
.setPath(path)
|
||||
.setSize(param.getFileSize())
|
||||
.setFilename(filename)
|
||||
@@ -89,7 +89,7 @@ public class PlatformFileService {
|
||||
|
||||
platformFileRecordManager.save(platformFileRecord);
|
||||
|
||||
FileUploadPresignResult result = new FileUploadPresignResult();
|
||||
var result = new FileUploadPresignResult();
|
||||
result.setFileId(platformFileRecord.getId());
|
||||
result.setObjectKey(objectKey);
|
||||
result.setFilename(filename);
|
||||
@@ -264,7 +264,7 @@ public class PlatformFileService {
|
||||
|
||||
s3FileStorageService.upload(data, objectKey, contentType);
|
||||
|
||||
PlatformFileRecord platformFileRecord = new PlatformFileRecord()
|
||||
var platformFileRecord = new PlatformFileRecord()
|
||||
.setPath(path)
|
||||
.setSize((long) data.length)
|
||||
.setFilename(filename)
|
||||
|
||||
@@ -38,7 +38,7 @@ public class WechatMaAuthService {
|
||||
/// 获取微信小程序API的Service
|
||||
public WxMaService getWxMaService(String appId, String appSecret) {
|
||||
WxMaService wxMaService = new WxMaServiceImpl();
|
||||
WxMaDefaultConfigImpl wxMaConfig = new WxMaDefaultConfigImpl();
|
||||
var wxMaConfig = new WxMaDefaultConfigImpl();
|
||||
wxMaConfig.setAppid(appId);
|
||||
wxMaConfig.setSecret(appSecret);
|
||||
try {
|
||||
|
||||
@@ -82,7 +82,7 @@ public class WechatMpAuthService {
|
||||
WxOAuth2UserInfo userInfo = wxMpService.getOAuth2Service().getUserInfo(accessToken, null);
|
||||
|
||||
// 转换结果
|
||||
WechatUserInfoResult result = new WechatUserInfoResult();
|
||||
var result = new WechatUserInfoResult();
|
||||
result.setOpenId(userInfo.getOpenid());
|
||||
result.setNickname(userInfo.getNickname());
|
||||
result.setHeadImgUrl(userInfo.getHeadImgUrl());
|
||||
@@ -106,7 +106,7 @@ public class WechatMpAuthService {
|
||||
/// 获取微信公众号API的Service
|
||||
public WxMpService getWxMpService(String appId, String appSecret) {
|
||||
WxMpService wxMpService = new WxMpServiceImpl();
|
||||
WxMpDefaultConfigImpl wxMpConfig = new WxMpDefaultConfigImpl();
|
||||
var wxMpConfig = new WxMpDefaultConfigImpl();
|
||||
wxMpConfig.setAppId(appId);
|
||||
wxMpConfig.setSecret(appSecret);
|
||||
try {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WechatUserService {
|
||||
}
|
||||
|
||||
// 转换结果
|
||||
WechatUserInfoResult result = new WechatUserInfoResult();
|
||||
var result = new WechatUserInfoResult();
|
||||
result.setOpenId(wxMpUser.getOpenId());
|
||||
result.setNickname(wxMpUser.getNickname());
|
||||
result.setHeadImgUrl(wxMpUser.getHeadImgUrl());
|
||||
@@ -104,7 +104,7 @@ public class WechatUserService {
|
||||
}
|
||||
|
||||
// 转换结果
|
||||
WechatPhoneResult result = new WechatPhoneResult();
|
||||
var result = new WechatPhoneResult();
|
||||
result.setPhoneNumber(phoneInfo.getPhoneNumber());
|
||||
result.setPurePhoneNumber(phoneInfo.getPurePhoneNumber());
|
||||
result.setCountryCode(phoneInfo.getCountryCode());
|
||||
@@ -126,7 +126,7 @@ public class WechatUserService {
|
||||
/// 创建微信公众号Service
|
||||
private WxMpService createWxMpService(String appId, String appSecret) {
|
||||
WxMpService wxMpService = new WxMpServiceImpl();
|
||||
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
|
||||
var config = new WxMpDefaultConfigImpl();
|
||||
config.setAppId(appId);
|
||||
config.setSecret(appSecret);
|
||||
wxMpService.setWxMpConfigStorage(config);
|
||||
@@ -136,7 +136,7 @@ public class WechatUserService {
|
||||
/// 创建微信小程序Service
|
||||
private WxMaService createWxMaService(String appId, String appSecret) {
|
||||
WxMaService wxMaService = new WxMaServiceImpl();
|
||||
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||
var config = new WxMaDefaultConfigImpl();
|
||||
config.setAppid(appId);
|
||||
config.setSecret(appSecret);
|
||||
wxMaService.setWxMaConfig(config);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class WechatMaMessageService {
|
||||
WechatMessageRecord record = createMessageRecord(param);
|
||||
recordService.saveRecord(record);
|
||||
|
||||
MessageSendResult result = new MessageSendResult()
|
||||
var result = new MessageSendResult()
|
||||
.setRecordId(record.getId())
|
||||
.setSuccess(false);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class WechatMaMessageService {
|
||||
|
||||
/// 创建消息记录
|
||||
private WechatMessageRecord createMessageRecord(UniformMessageParam param) {
|
||||
WechatMessageRecord record = new WechatMessageRecord();
|
||||
var record = new WechatMessageRecord();
|
||||
record.setMessageType("uniform");
|
||||
record.setOpenId(param.getOpenId());
|
||||
record.setTemplateId(param.getTemplateId());
|
||||
@@ -174,7 +174,7 @@ public class WechatMaMessageService {
|
||||
/// 注意:weixin-java-miniapp 4.8.1.B版本的统一服务消息API较为复杂
|
||||
/// 这里采用简化实现,实际使用时可能需要根据具体需求调整
|
||||
private WxMaUniformMessage buildUniformMessage(UniformMessageParam param) {
|
||||
WxMaUniformMessage uniformMessage = new WxMaUniformMessage();
|
||||
var uniformMessage = new WxMaUniformMessage();
|
||||
uniformMessage.setToUser(param.getOpenId());
|
||||
|
||||
// 设置为使用小程序模板消息
|
||||
@@ -190,7 +190,7 @@ public class WechatMaMessageService {
|
||||
/// 创建微信小程序Service
|
||||
private WxMaService createWxMaService(String wxAppId, String appSecret, String accessToken) {
|
||||
WxMaService wxMaService = new WxMaServiceImpl();
|
||||
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||
var config = new WxMaDefaultConfigImpl();
|
||||
config.setAppid(wxAppId);
|
||||
config.setSecret(appSecret);
|
||||
config.setToken(accessToken);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class WechatMessageRecordService {
|
||||
/// @param errorMsg 错误信息
|
||||
public void updateStatus(Long recordId, String status, String msgId, String errorMsg) {
|
||||
try {
|
||||
WechatMessageRecord record = new WechatMessageRecord();
|
||||
var record = new WechatMessageRecord();
|
||||
record.setId(recordId);
|
||||
record.setStatus(status);
|
||||
record.setMsgId(msgId);
|
||||
@@ -172,7 +172,7 @@ public class WechatMessageRecordService {
|
||||
/// 构建模板消息参数
|
||||
@SuppressWarnings("unchecked")
|
||||
private TemplateMessageParam buildTemplateMessageParam(WechatMessageRecord record) {
|
||||
TemplateMessageParam param = new TemplateMessageParam();
|
||||
var param = new TemplateMessageParam();
|
||||
param.setWxAppId(record.getWxAppId());
|
||||
// AppSecret需要从外部传入,这里暂时为空,实际使用时需要调用方提供
|
||||
param.setOpenId(record.getOpenId());
|
||||
@@ -192,7 +192,7 @@ public class WechatMessageRecordService {
|
||||
/// 构建统一服务消息参数
|
||||
@SuppressWarnings("unchecked")
|
||||
private UniformMessageParam buildUniformMessageParam(WechatMessageRecord record) {
|
||||
UniformMessageParam param = new UniformMessageParam();
|
||||
var param = new UniformMessageParam();
|
||||
param.setWxAppId(record.getWxAppId());
|
||||
// AppSecret需要从外部传入,这里暂时为空,实际使用时需要调用方提供
|
||||
param.setOpenId(record.getOpenId());
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WechatMpMessageService {
|
||||
WechatMessageRecord record = createMessageRecord(param);
|
||||
recordService.saveRecord(record);
|
||||
|
||||
MessageSendResult result = new MessageSendResult()
|
||||
var result = new MessageSendResult()
|
||||
.setRecordId(record.getId())
|
||||
.setSuccess(false);
|
||||
|
||||
@@ -156,7 +156,7 @@ public class WechatMpMessageService {
|
||||
|
||||
/// 创建消息记录
|
||||
private WechatMessageRecord createMessageRecord(TemplateMessageParam param) {
|
||||
WechatMessageRecord record = new WechatMessageRecord();
|
||||
var record = new WechatMessageRecord();
|
||||
record.setMessageType("template");
|
||||
record.setOpenId(param.getOpenId());
|
||||
record.setTemplateId(param.getTemplateId());
|
||||
@@ -192,7 +192,7 @@ public class WechatMpMessageService {
|
||||
/// 创建微信公众号Service
|
||||
private WxMpService createWxMpService(String wxAppId, String appSecret, String accessToken) {
|
||||
WxMpService wxMpService = new WxMpServiceImpl();
|
||||
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
|
||||
var config = new WxMpDefaultConfigImpl();
|
||||
config.setAppId(wxAppId);
|
||||
config.setSecret(appSecret);
|
||||
config.setAccessToken(accessToken);
|
||||
|
||||
@@ -137,7 +137,7 @@ public class WechatTokenService {
|
||||
/// 创建微信公众号Service
|
||||
private WxMpService createWxMpService(String wxAppId, String appSecret) {
|
||||
WxMpService wxMpService = new WxMpServiceImpl();
|
||||
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
|
||||
var config = new WxMpDefaultConfigImpl();
|
||||
config.setAppId(wxAppId);
|
||||
config.setSecret(appSecret);
|
||||
wxMpService.setWxMpConfigStorage(config);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ArtemisCommonAutoConfiguration {
|
||||
@ConditionalOnMissingBean(name = ArtemisBeanNames.TOPIC_LISTENER_FACTORY)
|
||||
public JmsListenerContainerFactory<?> topicListenerFactory(ConnectionFactory connectionFactory,
|
||||
ObservationRegistry observationRegistry) {
|
||||
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
|
||||
var factory = new DefaultJmsListenerContainerFactory();
|
||||
factory.setConnectionFactory(connectionFactory);
|
||||
// Topic 模式(pub-sub),对应 broker 端 multicast 路由类型
|
||||
factory.setPubSubDomain(true);
|
||||
|
||||
@@ -19,7 +19,7 @@ public class I18nAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public MessageSource messageSource(ResourcePatternResolver resourceResolver) {
|
||||
JsonMessageSource source = new JsonMessageSource(resourceResolver);
|
||||
var source = new JsonMessageSource(resourceResolver);
|
||||
source.setDefaultLocale(Locale.CHINA);
|
||||
// 初始化 I18nUtil
|
||||
I18nUtil.setMessageSource(source);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MpConfiguration {
|
||||
/// 总结: 对sql进行单次改造的优先放入,不对sql进行改造的最后放入
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor(List<MpInterceptor> interceptors) {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
var interceptor = new MybatisPlusInterceptor();
|
||||
interceptors.stream()
|
||||
.sorted(Comparator.comparing(MpInterceptor::getSortNo))
|
||||
.map(MpInterceptor::getInnerInterceptor)
|
||||
|
||||
@@ -13,7 +13,7 @@ public class MpInterceptorConfiguration {
|
||||
/// 分页(无参构造:由 MyBatis-Plus 从 DataSource 的 JDBC URL 自动推断数据库方言,换库零改动)
|
||||
@Bean
|
||||
public MpInterceptor paginationInnerInterceptor() {
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
|
||||
var paginationInnerInterceptor = new PaginationInnerInterceptor();
|
||||
paginationInnerInterceptor.setOptimizeJoin(false);
|
||||
return new MpInterceptor(paginationInnerInterceptor, 1);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RedisAutoConfiguration {
|
||||
/// 字符串类型Redis模板,适用于简单字符串值
|
||||
@Bean
|
||||
public StringRedisTemplate stringRedisTemplate(LettuceConnectionFactory connectionFactory) {
|
||||
StringRedisTemplate template = new StringRedisTemplate();
|
||||
var template = new StringRedisTemplate();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
return template;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SpringCorsConfiguration {
|
||||
@ConditionalOnProperty(prefix = "daxpay.platform.common.spring.cors", value = "enable", havingValue = "true")
|
||||
public FilterRegistrationBean<CorsFilter> corsWebFilter() {
|
||||
PlatformCommonProperties.Spring.Cors cors = platformCommonProperties.getSpring().getCors();
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
var config = new CorsConfiguration();
|
||||
// 允许跨域发送身份凭证
|
||||
config.setAllowCredentials(cors.isAllowCredentials());
|
||||
// 预检请求有效期
|
||||
@@ -44,7 +44,7 @@ public class SpringCorsConfiguration {
|
||||
addConfigValues(cors.getAllowedOriginPatterns(), config::addAllowedOriginPattern);
|
||||
config.addExposedHeader(HttpHeaders.SET_COOKIE);
|
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
var source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
|
||||
bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class RsaSignUtil {
|
||||
byte[] decoded = Base64.getDecoder().decode(privateKeyPEM);
|
||||
|
||||
try {
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(decoded);
|
||||
var keySpec = new PKCS8EncodedKeySpec(decoded);
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
return kf.generatePrivate(keySpec);
|
||||
} catch (Exception e) {
|
||||
@@ -46,7 +46,7 @@ public class RsaSignUtil {
|
||||
.replaceAll("\\s", "");
|
||||
|
||||
byte[] decoded = Base64.getDecoder().decode(publicKeyPEM);
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(decoded);
|
||||
var keySpec = new X509EncodedKeySpec(decoded);
|
||||
try {
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
return kf.generatePublic(keySpec);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class UserPasswordHistoryManager {
|
||||
|
||||
/// 添加密码历史记录
|
||||
public void addHistory(Long userId, String passwordHash) {
|
||||
UserPasswordHistory history = new UserPasswordHistory()
|
||||
var history = new UserPasswordHistory()
|
||||
.setUserId(userId)
|
||||
.setPassword(passwordHash);
|
||||
history.setCreateTime(OffsetDateTime.now(ZoneOffset.UTC));
|
||||
|
||||
@@ -25,7 +25,7 @@ public class UserPasswordSecurityManager extends BaseManager<UserPasswordSecurit
|
||||
/// 根据用户ID查询,不存在则创建默认记录
|
||||
public UserPasswordSecurity getOrCreateByUserId(Long userId) {
|
||||
return findById(userId).orElseGet(() -> {
|
||||
UserPasswordSecurity security = new UserPasswordSecurity();
|
||||
var security = new UserPasswordSecurity();
|
||||
security.setId(userId);
|
||||
security.setPasswordErrorCount(0);
|
||||
security.setInitialPassword(true);
|
||||
@@ -101,7 +101,7 @@ public class UserPasswordSecurityManager extends BaseManager<UserPasswordSecurit
|
||||
|
||||
/// 初始化用户密码安全信息(创建用户时调用)
|
||||
public void initPasswordSecurity(Long userId, OffsetDateTime passwordExpireTime) {
|
||||
UserPasswordSecurity security = new UserPasswordSecurity();
|
||||
var security = new UserPasswordSecurity();
|
||||
security.setId(userId);
|
||||
security.setPasswordErrorCount(0);
|
||||
security.setInitialPassword(true);
|
||||
|
||||
@@ -83,7 +83,7 @@ public class RoleUnifiedAssignService {
|
||||
String treePid = menu.getPid() != null ? "menu-" + menu.getPid() : null;
|
||||
menuIdToTreeIdMap.put(menu.getId(), treeId);
|
||||
|
||||
RoleUnifiedAssignTreeResult menuNode = new RoleUnifiedAssignTreeResult()
|
||||
var menuNode = new RoleUnifiedAssignTreeResult()
|
||||
.setKey(treeId)
|
||||
.setType("menu")
|
||||
.setTreeId(treeId)
|
||||
@@ -107,7 +107,7 @@ public class RoleUnifiedAssignService {
|
||||
|
||||
for (PermCodeData code : codes) {
|
||||
String codeTreeId = "code-" + code.getId();
|
||||
RoleUnifiedAssignTreeResult codeNode = new RoleUnifiedAssignTreeResult()
|
||||
var codeNode = new RoleUnifiedAssignTreeResult()
|
||||
.setKey(codeTreeId)
|
||||
.setType("code")
|
||||
.setTreeId(codeTreeId)
|
||||
|
||||
@@ -67,7 +67,7 @@ public class PermCodeScanService {
|
||||
Map<String, PermCodeDefinition> definitionMap = this.collectDefinitions();
|
||||
this.validateDefinitions(definitionMap);
|
||||
|
||||
PermCodeScanResult result = new PermCodeScanResult();
|
||||
var result = new PermCodeScanResult();
|
||||
Map<String, PermCodeData> existedMap = permCodeManager.findAll().stream()
|
||||
.collect(Collectors.toMap(PermCodeData::getCode, item -> item, (a, b) -> a));
|
||||
|
||||
@@ -175,7 +175,7 @@ public class PermCodeScanService {
|
||||
Method method = handlerMethod.getMethod();
|
||||
String location = beanType.getName() + "#" + method.getName();
|
||||
|
||||
PermCodeDefinition definition = new PermCodeDefinition()
|
||||
var definition = new PermCodeDefinition()
|
||||
.setCode(code)
|
||||
.setNameCn(nameCn)
|
||||
.setNameEn(nameEn)
|
||||
|
||||
@@ -51,7 +51,7 @@ public class UserTwoFactorService {
|
||||
public TwoFactorStatusResult getStatus() {
|
||||
Long userId = SecurityUtil.getUserId();
|
||||
PlatformTwoFactorAuthConfig config = getConfig();
|
||||
TwoFactorStatusResult result = new TwoFactorStatusResult()
|
||||
var result = new TwoFactorStatusResult()
|
||||
.setPlatformEnabled(Boolean.TRUE.equals(config.getEnabled()));
|
||||
Optional<UserTwoFactor> bound = userTwoFactorManager.findByUserId(userId);
|
||||
if (bound.isPresent()) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class OssConfigProviderImpl implements OssConfigProvider {
|
||||
|
||||
/// 将平台OSS配置转换为文件存储配置
|
||||
private FileStorageConfig convertToFileStorageConfig(PlatformOssConfig config) {
|
||||
FileStorageConfig storageConfig = new FileStorageConfig();
|
||||
var storageConfig = new FileStorageConfig();
|
||||
storageConfig.setEndpoint(config.getEndpoint())
|
||||
.setRegion(config.getRegion())
|
||||
.setPublicBucket(config.getPublicBucket())
|
||||
|
||||
@@ -61,7 +61,7 @@ public class UserProtocolItemService {
|
||||
|
||||
/// 根据协议ID查询协议项列表
|
||||
public PageResult<UserProtocolItemResult> page(PageParam pageParam, Long protocolId){
|
||||
UserProtocolItemQuery query = new UserProtocolItemQuery();
|
||||
var query = new UserProtocolItemQuery();
|
||||
query.setProtocolId(protocolId);
|
||||
return MpUtil.toPageResult(userProtocolItemManager.page(pageParam, query));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user