mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	优化部分代码格式
This commit is contained in:
		| @ -24,11 +24,11 @@ public final class FileBuilder extends BaseBuilder<FileBuilder> { | |||||||
|   /** |   /** | ||||||
|    * Media id file builder. |    * Media id file builder. | ||||||
|    * |    * | ||||||
|    * @param media_id the media id |    * @param mediaId the media id | ||||||
|    * @return the file builder |    * @return the file builder | ||||||
|    */ |    */ | ||||||
|   public FileBuilder mediaId(String media_id) { |   public FileBuilder mediaId(String mediaId) { | ||||||
|     this.mediaId = media_id; |     this.mediaId = mediaId; | ||||||
|     return this; |     return this; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ public class WxMaLiveGoodInfo implements Serializable { | |||||||
|    */ |    */ | ||||||
|   private String thirdPartyTag; |   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; |   private List<String> goodsKey; | ||||||
|  |  | ||||||
|  | |||||||
| @ -4,9 +4,9 @@ import me.chanjar.weixin.common.error.WxErrorException; | |||||||
| import me.chanjar.weixin.open.bean.ma.privacy.*; | 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 |  * (从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/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> |  * @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"; |   String APPLY_PRIVATE_INTERFACE = "https://api.weixin.qq.com/wxa/security/apply_privacy_interface"; | ||||||
|  |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 查询小程序用户隐私保护指引 |    * <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html">查询小程序用户隐私保护指引</a> | ||||||
|    * 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html |  | ||||||
|    * |    * | ||||||
|    * @param privacyVer 1表示现网版本,即,传1则该接口返回的内容是现网版本的;2表示开发版,即,传2则该接口返回的内容是开发版本的。默认是2。 |    * @param privacyVer 1表示现网版本,即,传1则该接口返回的内容是现网版本的;2表示开发版,即,传2则该接口返回的内容是开发版本的。默认是2。 | ||||||
|    * @return 查询结果 |    * @return 查询结果 | ||||||
| @ -48,22 +46,19 @@ public interface WxOpenMaPrivacyService { | |||||||
|    */ |    */ | ||||||
|   GetPrivacySettingResult getPrivacySetting(Integer privacyVer) throws WxErrorException; |   GetPrivacySettingResult getPrivacySetting(Integer privacyVer) throws WxErrorException; | ||||||
|  |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 设置小程序用户隐私保护指引 |    * <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html">设置小程序用户隐私保护指引</a> | ||||||
|    * 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html |  | ||||||
|    * |    * | ||||||
|    * @param dto 参数对象 |    * @param dto 参数对象 | ||||||
|    * @throws WxErrorException 如果出错,抛出此异常 |    * @throws WxErrorException 如果出错,抛出此异常 | ||||||
|    */ |    */ | ||||||
|   void setPrivacySetting(SetPrivacySetting dto) throws WxErrorException; |   void setPrivacySetting(SetPrivacySetting dto) throws WxErrorException; | ||||||
|  |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 上传小程序用户隐私保护指引文件 |    * 上传小程序用户隐私保护指引文件 | ||||||
|    * 本接口用于上传自定义的小程序的用户隐私保护指引 |    * 本接口用于上传自定义的小程序的用户隐私保护指引 | ||||||
|    * 仅限文本文件, 限制文件大小为不超过100kb,否则会报错 |    * 仅限文本文件, 限制文件大小为不超过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 文本文件内容 |    * @param content 文本文件内容 | ||||||
|    * @return 上传结果 |    * @return 上传结果 | ||||||
| @ -71,22 +66,20 @@ public interface WxOpenMaPrivacyService { | |||||||
|    */ |    */ | ||||||
|   UploadPrivacyFileResult uploadPrivacyFile(String content) throws WxErrorException; |   UploadPrivacyFileResult uploadPrivacyFile(String content) throws WxErrorException; | ||||||
|  |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 隐私接口-获取接口列表 |    * 隐私接口-获取接口列表 | ||||||
|    * 从2022年4月18日开始,部分小程序前端 api 需申请后,方可使用。该接口用于获取“需申请并审核通过”后才可使用的接口列表。 |    * 从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 获取结果 |    * @return 获取结果 | ||||||
|    * @throws WxErrorException 如果出错,抛出此异常 |    * @throws WxErrorException 如果出错,抛出此异常 | ||||||
|    */ |    */ | ||||||
|   GetPrivacyInterfaceResult getPrivacyInterface() throws WxErrorException; |   GetPrivacyInterfaceResult getPrivacyInterface() throws WxErrorException; | ||||||
|  |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 隐私接口-申请接口 |    * 隐私接口-申请接口 | ||||||
|    * 从2022年4月18日开始,部分小程序前端 api 需申请后,方可使用。该接口用于获取“需申请并审核通过”后才可使用的接口列表。 |    * 从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 请求参数 |    * @param dto 请求参数 | ||||||
|    * @return 获取结果 |    * @return 获取结果 | ||||||
|  | |||||||
| @ -45,7 +45,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|   public PartnerTransferResult batchTransfer(PartnerTransferRequest request) throws WxPayException { |   public PartnerTransferResult batchTransfer(PartnerTransferRequest request) throws WxPayException { | ||||||
|     request.getTransferDetailList().stream().forEach(p -> { |     request.getTransferDetailList().stream().forEach(p -> { | ||||||
|       try { |       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); |         p.setUserName(userName); | ||||||
|       } catch (IllegalBlockSizeException e) { |       } catch (IllegalBlockSizeException e) { | ||||||
|         throw new RuntimeException("姓名转换异常!", e); |         throw new RuntimeException("姓名转换异常!", e); | ||||||
| @ -61,7 +62,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|    * 接口说明 |    * 接口说明 | ||||||
|    * 适用对象:服务商 |    * 适用对象:服务商 | ||||||
|    * 请求URL:https://api.mch.weixin.qq.com/v3/partner-transfer/batches/batch-id/{batch_id} |    * 请求URL:https://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 |    * 请求方式:GET | ||||||
|    * 接口限频:单个服务商 50QPS,如果超过频率限制,会报错FREQUENCY_LIMITED,请降低频率请求。 |    * 接口限频:单个服务商 50QPS,如果超过频率限制,会报错FREQUENCY_LIMITED,请降低频率请求。 | ||||||
|    * |    * | ||||||
| @ -71,14 +73,16 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|    */ |    */ | ||||||
|   @Override |   @Override | ||||||
|   public BatchNumberResult queryBatchByBatchId(BatchNumberRequest request) throws WxPayException { |   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) { |     if (request.getOffset() == null) { | ||||||
|       request.setOffset(0); |       request.setOffset(0); | ||||||
|     } |     } | ||||||
|     if (request.getLimit() == null || request.getLimit() <= 0) { |     if (request.getLimit() == null || request.getLimit() <= 0) { | ||||||
|       request.setLimit(20); |       request.setLimit(20); | ||||||
|     } |     } | ||||||
|     String query = String.format("?need_query_detail=%s&detail_status=ALL&offset=%s&limit=%s", request.getNeedQueryDetail(), request.getOffset(), request.getLimit()); |     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())) { |     if (StringUtil.isNotBlank(request.getDetailStatus())) { | ||||||
|       query += "&detail_status=" + request.getDetailStatus(); |       query += "&detail_status=" + request.getDetailStatus(); | ||||||
|     } |     } | ||||||
| @ -100,14 +104,16 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|    */ |    */ | ||||||
|   @Override |   @Override | ||||||
|   public BatchNumberResult queryBatchByOutBatchNo(MerchantBatchRequest request) throws WxPayException { |   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) { |     if (request.getOffset() == null) { | ||||||
|       request.setOffset(0); |       request.setOffset(0); | ||||||
|     } |     } | ||||||
|     if (request.getLimit() == null || request.getLimit() <= 0) { |     if (request.getLimit() == null || request.getLimit() <= 0) { | ||||||
|       request.setLimit(20); |       request.setLimit(20); | ||||||
|     } |     } | ||||||
|     String query = String.format("?need_query_detail=%s&offset=%s&limit=%s", request.getNeedQueryDetail(), request.getOffset(), request.getLimit()); |     String query = String.format("?need_query_detail=%s&offset=%s&limit=%s", request.getNeedQueryDetail(), | ||||||
|  |       request.getOffset(), request.getLimit()); | ||||||
|     if (StringUtil.isNotBlank(request.getDetailStatus())) { |     if (StringUtil.isNotBlank(request.getDetailStatus())) { | ||||||
|       query += "&detail_status=" + request.getDetailStatus(); |       query += "&detail_status=" + request.getDetailStatus(); | ||||||
|     } |     } | ||||||
| @ -130,11 +136,14 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|    * @throws BadPaddingException the wx decrypt exception |    * @throws BadPaddingException the wx decrypt exception | ||||||
|    */ |    */ | ||||||
|   @Override |   @Override | ||||||
|   public BatchDetailsResult queryBatchDetailByWeChat(String batchId, String detailId) throws WxPayException, BadPaddingException { |   public BatchDetailsResult queryBatchDetailByWeChat(String batchId, String detailId) throws WxPayException, | ||||||
|     String url = String.format("%s/v3/partner-transfer/batches/batch-id/%s/details/detail-id/%s", this.payService.getPayBaseUrl(), batchId, detailId); |     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); |     String response = this.payService.getV3(url); | ||||||
|     BatchDetailsResult batchDetailsResult = GSON.fromJson(response, BatchDetailsResult.class); |     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); |     batchDetailsResult.setUserName(userName); | ||||||
|     return batchDetailsResult; |     return batchDetailsResult; | ||||||
|   } |   } | ||||||
| @ -143,7 +152,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|    * 商家明细单号查询明细单API |    * 商家明细单号查询明细单API | ||||||
|    * 接口说明 |    * 接口说明 | ||||||
|    * 适用对象:服务商 |    * 适用对象:服务商 | ||||||
|    * 请求URL:https://api.mch.weixin.qq.com/v3/partner-transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no} |    * 请求URL:https://api.mch.weixin.qq.com/v3/partner-transfer/batches/out-batch-no/{out_batch_no}/details/out-detail | ||||||
|  |    * -no/{out_detail_no} | ||||||
|    * 请求方式:GET |    * 请求方式:GET | ||||||
|    * 接口限频:单个服务商 50QPS,如果超过频率限制,会报错FREQUENCY_LIMITED,请降低频率请求。 |    * 接口限频:单个服务商 50QPS,如果超过频率限制,会报错FREQUENCY_LIMITED,请降低频率请求。 | ||||||
|    * |    * | ||||||
| @ -154,11 +164,14 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|    * @throws BadPaddingException the wx decrypt exception |    * @throws BadPaddingException the wx decrypt exception | ||||||
|    */ |    */ | ||||||
|   @Override |   @Override | ||||||
|   public BatchDetailsResult queryBatchDetailByMch(String outBatchNo, String outDetailNo) throws WxPayException, BadPaddingException { |   public BatchDetailsResult queryBatchDetailByMch(String outBatchNo, String outDetailNo) throws WxPayException, | ||||||
|     String url = String.format("%s/v3/partner-transfer/batches/out-batch-no/%s/details/out-detail-no/%s", this.payService.getPayBaseUrl(), outBatchNo, outDetailNo); |     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); |     String response = this.payService.getV3(url); | ||||||
|     BatchDetailsResult batchDetailsResult = GSON.fromJson(response, BatchDetailsResult.class); |     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); |     batchDetailsResult.setUserName(userName); | ||||||
|     return batchDetailsResult; |     return batchDetailsResult; | ||||||
|   } |   } | ||||||
| @ -240,7 +253,8 @@ public class PartnerTransferServiceImpl implements PartnerTransferService { | |||||||
|   @Override |   @Override | ||||||
|   public ElectronicReceiptsResult queryTransferElectronicResult(ElectronicReceiptsRequest request) throws WxPayException { |   public ElectronicReceiptsResult queryTransferElectronicResult(ElectronicReceiptsRequest request) throws WxPayException { | ||||||
|     String url = String.format("%s/v3/transfer-detail/electronic-receipts", this.payService.getPayBaseUrl()); |     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); |     String response = this.payService.getV3(url + query); | ||||||
|     return GSON.fromJson(response, ElectronicReceiptsResult.class); |     return GSON.fromJson(response, ElectronicReceiptsResult.class); | ||||||
|   } |   } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang