优化部分代码格式

This commit is contained in:
Binary Wang 2022-10-21 13:56:03 +08:00
parent 791ec8d2db
commit b08530917c
4 changed files with 44 additions and 37 deletions

View File

@ -24,11 +24,11 @@ public final class FileBuilder extends BaseBuilder<FileBuilder> {
/**
* Media id file builder.
*
* @param media_id the media id
* @param mediaId the media id
* @return the file builder
*/
public FileBuilder mediaId(String media_id) {
this.mediaId = media_id;
public FileBuilder mediaId(String mediaId) {
this.mediaId = mediaId;
return this;
}

View File

@ -26,7 +26,7 @@ public class WxMaLiveGoodInfo implements Serializable {
*/
private String thirdPartyTag;
/**
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/liveplayer/pendant.html
* <a href="https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/liveplayer/pendant.html">see here</a>
*/
private List<String> goodsKey;

View File

@ -4,9 +4,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.ma.privacy.*;
/**
* 微信第三方平台 小程序用户隐私保护指引接口 / 申请隐私接口(从2022年4月18日开始部分小程序前端 api 需申请后方可使用该接口用于获取需申请并审核通过后才可使用的接口列表)
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
* 微信第三方平台 小程序用户隐私保护指引接口 / 申请隐私接口
* (从2022年4月18日开始部分小程序前端 api 需申请后方可使用该接口用于获取需申请并审核通过后才可使用的接口列表)
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html">配置小程序用户隐私保护指引</a><a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html">获取接口列表</a>
*
* @author <a href="https://www.sacoc.cn">广州跨界</a>
*/
@ -37,10 +37,8 @@ public interface WxOpenMaPrivacyService {
*/
String APPLY_PRIVATE_INTERFACE = "https://api.weixin.qq.com/wxa/security/apply_privacy_interface";
/**
* 查询小程序用户隐私保护指引
* 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html">查询小程序用户隐私保护指引</a>
*
* @param privacyVer 1表示现网版本传1则该接口返回的内容是现网版本的2表示开发版传2则该接口返回的内容是开发版本的默认是2
* @return 查询结果
@ -48,22 +46,19 @@ public interface WxOpenMaPrivacyService {
*/
GetPrivacySettingResult getPrivacySetting(Integer privacyVer) throws WxErrorException;
/**
* 设置小程序用户隐私保护指引
* 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html">设置小程序用户隐私保护指引</a>
*
* @param dto 参数对象
* @throws WxErrorException 如果出错,抛出此异常
*/
void setPrivacySetting(SetPrivacySetting dto) throws WxErrorException;
/**
* 上传小程序用户隐私保护指引文件
* 本接口用于上传自定义的小程序的用户隐私保护指引
* 仅限文本文件, 限制文件大小为不超过100kb否则会报错
* 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/upload_privacy_exfile.html
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/upload_privacy_exfile.html">上传小程序用户隐私保护指引文件</a>
*
* @param content 文本文件内容
* @return 上传结果
@ -71,22 +66,20 @@ public interface WxOpenMaPrivacyService {
*/
UploadPrivacyFileResult uploadPrivacyFile(String content) throws WxErrorException;
/**
* 隐私接口-获取接口列表
* 从2022年4月18日开始部分小程序前端 api 需申请后方可使用该接口用于获取需申请并审核通过后才可使用的接口列表
* 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html">隐私接口-获取接口列表</a>
*
* @return 获取结果
* @throws WxErrorException 如果出错,抛出此异常
*/
GetPrivacyInterfaceResult getPrivacyInterface() throws WxErrorException;
/**
* 隐私接口-申请接口
* 从2022年4月18日开始部分小程序前端 api 需申请后方可使用该接口用于获取需申请并审核通过后才可使用的接口列表
* 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html">隐私接口-申请接口</a>
*
* @param dto 请求参数
* @return 获取结果

View File

@ -45,7 +45,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
public PartnerTransferResult batchTransfer(PartnerTransferRequest request) throws WxPayException {
request.getTransferDetailList().stream().forEach(p -> {
try {
String userName = RsaCryptoUtil.encryptOAEP(p.getUserName(), this.payService.getConfig().getVerifier().getValidCertificate());
String userName = RsaCryptoUtil.encryptOAEP(p.getUserName(),
this.payService.getConfig().getVerifier().getValidCertificate());
p.setUserName(userName);
} catch (IllegalBlockSizeException e) {
throw new RuntimeException("姓名转换异常!", e);
@ -61,7 +62,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
* 接口说明
* 适用对象服务商
* 请求URLhttps://api.mch.weixin.qq.com/v3/partner-transfer/batches/batch-id/{batch_id}
* https://api.mch.weixin.qq.com/v3/partner-transfer/batches/batch-id/1030000071100999991182020050700019480001?need_query_detail=true&offset=1
* https://api.mch.weixin.qq.com/v3/partner-transfer/batches/batch-id/1030000071100999991182020050700019480001
* ?need_query_detail=true&offset=1
* 请求方式GET
* 接口限频单个服务商 50QPS如果超过频率限制会报错FREQUENCY_LIMITED请降低频率请求
*
@ -71,16 +73,18 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
*/
@Override
public BatchNumberResult queryBatchByBatchId(BatchNumberRequest request) throws WxPayException {
String url = String.format("%s/v3/partner-transfer/batches/batch-id/%s", this.payService.getPayBaseUrl(), request.getBatchId());
String url = String.format("%s/v3/partner-transfer/batches/batch-id/%s", this.payService.getPayBaseUrl(),
request.getBatchId());
if (request.getOffset() == null) {
request.setOffset(0);
}
if (request.getLimit() == null || request.getLimit() <= 0) {
request.setLimit(20);
}
String query = String.format("?need_query_detail=%s&detail_status=ALL&offset=%s&limit=%s", request.getNeedQueryDetail(), request.getOffset(), request.getLimit());
if (StringUtil.isNotBlank(request.getDetailStatus())){
query += "&detail_status="+request.getDetailStatus();
String query = String.format("?need_query_detail=%s&detail_status=ALL&offset=%s&limit=%s",
request.getNeedQueryDetail(), request.getOffset(), request.getLimit());
if (StringUtil.isNotBlank(request.getDetailStatus())) {
query += "&detail_status=" + request.getDetailStatus();
}
String response = this.payService.getV3(url + query);
return GSON.fromJson(response, BatchNumberResult.class);
@ -100,16 +104,18 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
*/
@Override
public BatchNumberResult queryBatchByOutBatchNo(MerchantBatchRequest request) throws WxPayException {
String url = String.format("%s/v3/partner-transfer/batches/out-batch-no/%s", this.payService.getPayBaseUrl(), request.getOutBatchNo());
String url = String.format("%s/v3/partner-transfer/batches/out-batch-no/%s", this.payService.getPayBaseUrl(),
request.getOutBatchNo());
if (request.getOffset() == null) {
request.setOffset(0);
}
if (request.getLimit() == null || request.getLimit() <= 0) {
request.setLimit(20);
}
String query = String.format("?need_query_detail=%s&offset=%s&limit=%s", request.getNeedQueryDetail(), request.getOffset(), request.getLimit());
if (StringUtil.isNotBlank(request.getDetailStatus())){
query += "&detail_status="+request.getDetailStatus();
String query = String.format("?need_query_detail=%s&offset=%s&limit=%s", request.getNeedQueryDetail(),
request.getOffset(), request.getLimit());
if (StringUtil.isNotBlank(request.getDetailStatus())) {
query += "&detail_status=" + request.getDetailStatus();
}
String response = this.payService.getV3(url + query);
return GSON.fromJson(response, BatchNumberResult.class);
@ -130,11 +136,14 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
* @throws BadPaddingException the wx decrypt exception
*/
@Override
public BatchDetailsResult queryBatchDetailByWeChat(String batchId, String detailId) throws WxPayException, BadPaddingException {
String url = String.format("%s/v3/partner-transfer/batches/batch-id/%s/details/detail-id/%s", this.payService.getPayBaseUrl(), batchId, detailId);
public BatchDetailsResult queryBatchDetailByWeChat(String batchId, String detailId) throws WxPayException,
BadPaddingException {
String url = String.format("%s/v3/partner-transfer/batches/batch-id/%s/details/detail-id/%s",
this.payService.getPayBaseUrl(), batchId, detailId);
String response = this.payService.getV3(url);
BatchDetailsResult batchDetailsResult = GSON.fromJson(response, BatchDetailsResult.class);
String userName = RsaCryptoUtil.decryptOAEP(batchDetailsResult.getUserName(), this.payService.getConfig().getPrivateKey());
String userName = RsaCryptoUtil.decryptOAEP(batchDetailsResult.getUserName(),
this.payService.getConfig().getPrivateKey());
batchDetailsResult.setUserName(userName);
return batchDetailsResult;
}
@ -143,7 +152,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
* 商家明细单号查询明细单API
* 接口说明
* 适用对象服务商
* 请求URLhttps://api.mch.weixin.qq.com/v3/partner-transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no}
* 请求URLhttps://api.mch.weixin.qq.com/v3/partner-transfer/batches/out-batch-no/{out_batch_no}/details/out-detail
* -no/{out_detail_no}
* 请求方式GET
* 接口限频单个服务商 50QPS如果超过频率限制会报错FREQUENCY_LIMITED请降低频率请求
*
@ -154,11 +164,14 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
* @throws BadPaddingException the wx decrypt exception
*/
@Override
public BatchDetailsResult queryBatchDetailByMch(String outBatchNo, String outDetailNo) throws WxPayException, BadPaddingException {
String url = String.format("%s/v3/partner-transfer/batches/out-batch-no/%s/details/out-detail-no/%s", this.payService.getPayBaseUrl(), outBatchNo, outDetailNo);
public BatchDetailsResult queryBatchDetailByMch(String outBatchNo, String outDetailNo) throws WxPayException,
BadPaddingException {
String url = String.format("%s/v3/partner-transfer/batches/out-batch-no/%s/details/out-detail-no/%s",
this.payService.getPayBaseUrl(), outBatchNo, outDetailNo);
String response = this.payService.getV3(url);
BatchDetailsResult batchDetailsResult = GSON.fromJson(response, BatchDetailsResult.class);
String userName = RsaCryptoUtil.decryptOAEP(batchDetailsResult.getUserName(), this.payService.getConfig().getPrivateKey());
String userName = RsaCryptoUtil.decryptOAEP(batchDetailsResult.getUserName(),
this.payService.getConfig().getPrivateKey());
batchDetailsResult.setUserName(userName);
return batchDetailsResult;
}
@ -240,7 +253,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService {
@Override
public ElectronicReceiptsResult queryTransferElectronicResult(ElectronicReceiptsRequest request) throws WxPayException {
String url = String.format("%s/v3/transfer-detail/electronic-receipts", this.payService.getPayBaseUrl());
String query = String.format("?accept_type=%s&out_batch_no=%s&out_detail_no=%s", request.getAcceptType(), request.getOutBatchNo(), request.getOutDetailNo());
String query = String.format("?accept_type=%s&out_batch_no=%s&out_detail_no=%s", request.getAcceptType(),
request.getOutBatchNo(), request.getOutDetailNo());
String response = this.payService.getV3(url + query);
return GSON.fromJson(response, ElectronicReceiptsResult.class);
}