From 5155c8c4b1b899034fc9e392f5514885ffdfdc61 Mon Sep 17 00:00:00 2001 From: mrxiao <39647988+mr-xiaoyu@users.noreply.github.com> Date: Wed, 24 Mar 2021 09:30:57 +0800 Subject: [PATCH] =?UTF-8?q?:new:=20#2052=20=E3=80=90=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E3=80=91=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1=E7=94=B5?= =?UTF-8?q?=E5=AD=90=E5=8F=91=E7=A5=A8=E6=8A=A5=E9=94=80=E6=96=B9=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、查询报销发票信息 2、批量查询报销发票信息 3、报销方更新发票状态 4、报销方批量更新发票状态 --- .../mp/api/WxMpReimburseInvoiceService.java | 48 ++++++ .../me/chanjar/weixin/mp/api/WxMpService.java | 12 ++ .../mp/api/impl/BaseWxMpServiceImpl.java | 4 + .../impl/WxMpReimburseInvoiceServiceImpl.java | 43 ++++++ .../reimburse/InvoiceBatchRequest.java | 36 +++++ .../reimburse/InvoiceCommodityInfo.java | 34 +++++ .../invoice/reimburse/InvoiceInfoRequest.java | 48 ++++++ .../reimburse/InvoiceInfoResponse.java | 79 ++++++++++ .../invoice/reimburse/InvoiceUserInfo.java | 137 ++++++++++++++++++ .../reimburse/UpdateInvoiceStatusRequest.java | 56 +++++++ .../reimburse/UpdateStatusBatchRequest.java | 53 +++++++ .../chanjar/weixin/mp/enums/WxMpApiUrl.java | 20 +++ .../WxMpReimburseInvoiceServiceImplTest.java | 84 +++++++++++ 13 files changed, 654 insertions(+) create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpReimburseInvoiceService.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImpl.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceBatchRequest.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceCommodityInfo.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoRequest.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoResponse.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceUserInfo.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateInvoiceStatusRequest.java create mode 100644 weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateStatusBatchRequest.java create mode 100644 weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImplTest.java diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpReimburseInvoiceService.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpReimburseInvoiceService.java new file mode 100644 index 000000000..51745558c --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpReimburseInvoiceService.java @@ -0,0 +1,48 @@ +package me.chanjar.weixin.mp.api; + +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.bean.invoice.reimburse.*; + +import java.util.List; + +/** + * 电子发票报销方相关接口 + * 接口文档: https://developers.weixin.qq.com/doc/offiaccount/WeChat_Invoice/E_Invoice/Reimburser_API_List.html + * @author xiaoyu + * @since 2021-03-23 + */ +public interface WxMpReimburseInvoiceService { + + /** + * 查询报销发票信息 + * @param request {@link InvoiceInfoRequest} 查询报销发票信息参数 + * @return {@link InvoiceInfoResponse} 查询结果 + * @throws WxErrorException 查询失败时 + */ + InvoiceInfoResponse getInvoiceInfo(InvoiceInfoRequest request) throws WxErrorException; + + + /** + * 批量查询报销发票信息 + * @param request {@link InvoiceBatchRequest} 批量查询报销发票信息参数对象 + * @return {@link InvoiceInfoResponse} 查询结果列表 + * @throws WxErrorException 查询失败时 + */ + List getInvoiceBatch(InvoiceBatchRequest request) throws WxErrorException; + + + /** + * 更新发票状态 + * @param request {@link UpdateInvoiceStatusRequest} 更新发票状态参数 + * @throws WxErrorException 更新失败时 + */ + void updateInvoiceStatus(UpdateInvoiceStatusRequest request) throws WxErrorException; + + + /** + * 批量更新发票状态 + * @param request {@link UpdateStatusBatchRequest} 批量更新发票状态参数 + * @throws WxErrorException 更新失败时 + */ + void updateStatusBatch(UpdateStatusBatchRequest request) throws WxErrorException; +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java index 1b81bf6e4..1c659a62c 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java @@ -533,6 +533,18 @@ public interface WxMpService extends WxService { */ WxImgProcService getImgProcService(); + /** + * 返回电子发票报销方相关接口 + * @return WxMpReimburseInvoiceService + */ + WxMpReimburseInvoiceService getReimburseInvoiceService(); + + /** + * . + * @param reimburseInvoiceService . + */ + void setReimburseInvoiceService(WxMpReimburseInvoiceService reimburseInvoiceService); + /** * . * diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java index 960d20027..932f130e1 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java @@ -129,6 +129,10 @@ public abstract class BaseWxMpServiceImpl implements WxMpService, RequestH @Setter private WxOAuth2Service oAuth2Service = new WxMpOAuth2ServiceImpl(this); + @Getter + @Setter + private WxMpReimburseInvoiceService reimburseInvoiceService = new WxMpReimburseInvoiceServiceImpl(this); + private Map configStorageMap; private int retrySleepMillis = 1000; diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImpl.java new file mode 100644 index 000000000..582443312 --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImpl.java @@ -0,0 +1,43 @@ +package me.chanjar.weixin.mp.api.impl; + +import lombok.AllArgsConstructor; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpReimburseInvoiceService; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.invoice.reimburse.*; + +import java.util.List; + +import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Invoice.*; + +/** + * 电子发票报销方相关接口实现 + * 接口文档: https://developers.weixin.qq.com/doc/offiaccount/WeChat_Invoice/E_Invoice/Reimburser_API_List.html + * @author xiaoyu + * @since 2021-03-23 + */ +@AllArgsConstructor +public class WxMpReimburseInvoiceServiceImpl implements WxMpReimburseInvoiceService { + + private final WxMpService wxMpService; + + @Override + public InvoiceInfoResponse getInvoiceInfo(InvoiceInfoRequest request) throws WxErrorException { + return InvoiceInfoResponse.fromJson(this.wxMpService.post(GET_INVOICE_INFO,request.toJson())); + } + + @Override + public List getInvoiceBatch(InvoiceBatchRequest request) throws WxErrorException { + return InvoiceInfoResponse.toList(this.wxMpService.post(GET_INVOICE_BATCH,request.toJson())); + } + + @Override + public void updateInvoiceStatus(UpdateInvoiceStatusRequest request) throws WxErrorException { + this.wxMpService.post(UPDATE_INVOICE_STATUS,request.toJson()); + } + + @Override + public void updateStatusBatch(UpdateStatusBatchRequest request) throws WxErrorException { + this.wxMpService.post(UPDATE_STATUS_BATCH,request.toJson()); + } +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceBatchRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceBatchRequest.java new file mode 100644 index 000000000..8b5bc799d --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceBatchRequest.java @@ -0,0 +1,36 @@ +package me.chanjar.weixin.mp.bean.invoice.reimburse; + +import com.google.gson.annotations.SerializedName; +import lombok.Builder; +import lombok.Data; +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; + +import java.io.Serializable; +import java.util.List; + +/** + *
+ * 批量查询报销发票信息参数对象
+ * 
+ * @author xiaoyu + * @since 2021-03-23 + */ +@Data +@Builder +public class InvoiceBatchRequest implements Serializable { + + private static final long serialVersionUID = -9121443117105107231L; + + /** + * 发票卡券的card_id + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("item_list") + private List itemList; + + public String toJson() { + return WxMpGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceCommodityInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceCommodityInfo.java new file mode 100644 index 000000000..a75874efa --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceCommodityInfo.java @@ -0,0 +1,34 @@ +package me.chanjar.weixin.mp.bean.invoice.reimburse; + +import lombok.Data; + +/** + *
+ * 发票商品信息
+ * 
+ * @author xiaoyu + * @since 2021-03-23 + */ +@Data +public class InvoiceCommodityInfo { + + /** + * 项目(商品)名称 + */ + private String name; + + /** + * 项目数量 + */ + private Integer num; + + /** + * 项目单位 + */ + private String unit; + + /** + * 单价,以分为单位 + */ + private Integer price; +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoRequest.java new file mode 100644 index 000000000..770e55cfa --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoRequest.java @@ -0,0 +1,48 @@ +package me.chanjar.weixin.mp.bean.invoice.reimburse; + + +import com.google.gson.annotations.SerializedName; +import lombok.Builder; +import lombok.Data; +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; + +import java.io.Serializable; + +/** + *
+ * 查询报销发票信息参数对象
+ * 
+ * @author xiaoyu + * @since 2021-03-23 + */ +@Data +@Builder +public class InvoiceInfoRequest implements Serializable { + + private static final long serialVersionUID = 7854633127026139444L; + + + /** + * 发票卡券的card_id + *
+  * 是否必填: 是
+  * 
+ */ + @SerializedName("card_id") + private String cardId; + + + /** + * 发票卡券的加密code,和card_id共同构成一张发票卡券的唯一标识 + *
+  * 是否必填: 是
+  * 
+ */ + @SerializedName("encrypt_code") + private String encryptCode; + + + public String toJson() { + return WxMpGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoResponse.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoResponse.java new file mode 100644 index 000000000..0dded411c --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceInfoResponse.java @@ -0,0 +1,79 @@ +package me.chanjar.weixin.mp.bean.invoice.reimburse; + +import com.google.gson.JsonObject; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import lombok.Data; +import me.chanjar.weixin.common.util.json.GsonParser; +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; + +import java.util.List; + +/** + *
+ * 查询报销发票信息响应对象
+ * 
+ * @author xiaoyu + * @since 2021-03-23 + */ +@Data +public class InvoiceInfoResponse { + + /** + * 发票ID + */ + @SerializedName("card_id") + private String cardId; + + + /** + * 发票的有效期起始时间 + */ + @SerializedName("begin_time") + private Integer beginTime; + + /** + * 发票的有效期截止时间 + */ + @SerializedName("end_time") + private Integer endTime; + + /** + * 用户标识 + */ + private String openid; + + /** + * 发票的类型 + */ + private String type; + + /** + * 发票的收款方 + */ + private String payee; + + /** + * 发票详情 + */ + private String detail; + + /** + * 用户可在发票票面看到的主要信息 + */ + @SerializedName("user_info") + private InvoiceUserInfo userInfo; + + + public static InvoiceInfoResponse fromJson(String json) { + return WxMpGsonBuilder.create().fromJson(json, InvoiceInfoResponse.class); + } + + + public static List toList(String json) { + JsonObject jsonObject = GsonParser.parse(json); + return WxMpGsonBuilder.create().fromJson(jsonObject.get("item_list").toString(), + new TypeToken>() { + }.getType()); + } +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceUserInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceUserInfo.java new file mode 100644 index 000000000..1d8d70924 --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/InvoiceUserInfo.java @@ -0,0 +1,137 @@ +package me.chanjar.weixin.mp.bean.invoice.reimburse; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.util.List; + +/** + *
+ * 用户可在发票票面看到的主要信息
+ * 
+ * @author xiaoyu + * @since 2021-03-23 + */ +@Data +public class InvoiceUserInfo { + + /** + * 发票加税合计金额,以分为单位 + */ + private Integer fee; + + /** + * 发票的抬头 + */ + private String title; + + /** + * 开票时间 + */ + @SerializedName("billing_time") + private Integer billingTime; + + /** + * 发票代码 + */ + @SerializedName("billing_no") + private String billingNo; + + /** + * 发票号码 + */ + @SerializedName("billing_code") + private String billingCode; + + /** + * 不含税金额,以分为单位 + */ + @SerializedName("fee_without_tax") + private Integer feeWithoutTax; + + /** + * 税额,以分为单位 + */ + private Integer tax; + + /** + * 发票对应的PDF_URL + */ + @SerializedName("pdf_url") + private String pdfUrl; + + /** + * 其它消费凭证附件对应的URL + */ + @SerializedName("trip_pdf_url") + private String tripPdfUrl; + + /** + * 发票报销状态 + */ + @SerializedName("reimburse_status") + private String reimburseStatus; + + /** + * 校验码 + */ + @SerializedName("check_code") + private String checkCode; + + /** + * 购买方纳税人识别号 + */ + @SerializedName("buyer_number") + private String buyerNumber; + + /** + * 购买方地址、电话 + */ + @SerializedName("buyer_address_and_phone") + private String buyerAddressAndPhone; + + /** + * 购买方开户行及账号 + */ + @SerializedName("buyer_bank_account") + private String buyerBankAccount; + + /** + * 销售方纳税人识别号 + */ + @SerializedName("seller_number") + private String sellerNumber; + + /** + * 销售方地址、电话 + */ + @SerializedName("seller_address_and_phone") + private String sellerAddressAndPhone; + + /** + * 销售方开户行及账号 + */ + @SerializedName("seller_bank_account") + private String sellerBankAccount; + + /** + * 备注 + */ + private String remarks; + + /** + * 收款人 + */ + private String cashier; + + /** + * 开票人 + */ + private String maker; + + /** + * 商品信息结构 + */ + private List info; +} + diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateInvoiceStatusRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateInvoiceStatusRequest.java new file mode 100644 index 000000000..2d21f9b3a --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateInvoiceStatusRequest.java @@ -0,0 +1,56 @@ +package me.chanjar.weixin.mp.bean.invoice.reimburse; + +import com.google.gson.annotations.SerializedName; +import lombok.Builder; +import lombok.Data; +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; + +import java.io.Serializable; + +/** + *
+ * 更新发票状态参数对象
+ * 
+ * @author xiaoyu + * @since 2021-03-23 + */ +@Data +@Builder +public class UpdateInvoiceStatusRequest implements Serializable { + + private static final long serialVersionUID = -4122242332481909977L; + + + /** + * 发票卡券的card_id + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("card_id") + private String cardId; + + + /** + * 发票卡券的加密code,和card_id共同构成一张发票卡券的唯一标识 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("encrypt_code") + private String encryptCode; + + + /** + * 发票报销状态 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("reimburse_status") + private String reimburseStatus; + + public String toJson() { + return WxMpGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateStatusBatchRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateStatusBatchRequest.java new file mode 100644 index 000000000..b923d059c --- /dev/null +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/invoice/reimburse/UpdateStatusBatchRequest.java @@ -0,0 +1,53 @@ +package me.chanjar.weixin.mp.bean.invoice.reimburse; + +import com.google.gson.annotations.SerializedName; +import lombok.Builder; +import lombok.Data; +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; + +import java.io.Serializable; +import java.util.List; + +/** + *
+ * 批量更新发票状态参数对象
+ * 
+ * @author xiaoyu + * @since 2021-03-23 + */ +@Data +@Builder +public class UpdateStatusBatchRequest implements Serializable { + + private static final long serialVersionUID = 7016357689566912199L; + /** + * 用户openid + *
+   * 是否必填: 是
+   * 
+ */ + private String openid; + + /** + * 发票报销状态 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("reimburse_status") + private String reimburseStatus; + + /** + * 发票列表 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("invoice_list") + private List invoiceList; + + public String toJson() { + return WxMpGsonBuilder.create().toJson(this); + } + +} diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java index 5bc828db1..b6a08b25a 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java @@ -1129,6 +1129,26 @@ public interface WxMpApiUrl { * 获取关联商户 */ GET_PAY_MCH_SET_BIZ_ATTR(API_DEFAULT_HOST_URL, "/card/invoice/setbizattr?action=get_pay_mch"), + + /** + * 报销方查询报销发票信息 + */ + GET_INVOICE_INFO(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/getinvoiceinfo"), + + /** + * 报销方批量查询报销发票信息 + */ + GET_INVOICE_BATCH(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/getinvoicebatch"), + + /** + * 报销方更新发票状态 + */ + UPDATE_INVOICE_STATUS(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/updateinvoicestatus"), + + /** + * 报销方批量更新发票状态 + */ + UPDATE_STATUS_BATCH(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/updatestatusbatch"), ; private final String prefix; private final String path; diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImplTest.java new file mode 100644 index 000000000..177b56d29 --- /dev/null +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpReimburseInvoiceServiceImplTest.java @@ -0,0 +1,84 @@ +package me.chanjar.weixin.mp.api.impl; + +import com.google.gson.GsonBuilder; +import com.google.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.test.ApiTestModule; +import me.chanjar.weixin.mp.bean.invoice.reimburse.*; +import org.testng.annotations.Guice; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Test(groups = "invoiceAPI") +@Guice(modules = ApiTestModule.class) +public class WxMpReimburseInvoiceServiceImplTest { + + @Inject + protected WxMpService wxService; + + + public void getInvoiceInfo() throws WxErrorException { + InvoiceInfoRequest request = InvoiceInfoRequest.builder() + .cardId("pnAsy0sHQukID3E8d2IUdh2DbzZ4") + .encryptCode("O/mPnGTpBu22a1szmK2ogzhFPBh9eYzv2p70L8yzyynlTOEE9fSC4PXvOGuLIWfqZQXA0yBPVcbELCLySWjiLH0RYjMqE4S2bekki6Z2VUjWHGp+shbOkYZ4y9zR4SpGVT6Dyha0ezDMVw6dFMatoA==") + .build(); + + InvoiceInfoResponse response = this.wxService.getReimburseInvoiceService().getInvoiceInfo(request); + + log.info("response: {}", new GsonBuilder().create().toJson(response)); + } + + + public void getInvoiceBatch() throws WxErrorException { + List invoices = new ArrayList<>(); + InvoiceInfoRequest r = InvoiceInfoRequest.builder() + .cardId("pnAsy0sHQukID3E8d2IUdh2DbzZ4") + .encryptCode("O/mPnGTpBu22a1szmK2ogzhFPBh9eYzv2p70L8yzyynlTOEE9fSC4PXvOGuLIWfqZQXA0yBPVcbELCLySWjiLH0RYjMqE4S2bekki6Z2VUjWHGp+shbOkYZ4y9zR4SpGVT6Dyha0ezDMVw6dFMatoA==") + .build(); + invoices.add(r); + r = InvoiceInfoRequest.builder() + .cardId("pnAsy0sHQukID3E8d2IUdh2DbzZ4") + .encryptCode("O/mPnGTpBu22a1szmK2ogzhFPBh9eYzv2p70L8yzyynlTOEE9fSC4PXvOGuLIWfqd+8BRcn/yz1GmRwW4LAccaL/dRsSc9RWXektgTHKnoHWHGp+shbOkYZ4y9zR4SpGVT6Dyha0ezDMVw6dFMatoA==") + .build(); + invoices.add(r); + + InvoiceBatchRequest request = InvoiceBatchRequest.builder().itemList(invoices).build(); + + List responses = this.wxService.getReimburseInvoiceService().getInvoiceBatch(request); + log.info("responses: {}",new GsonBuilder().create().toJson(responses)); + } + + + public void updateInvoiceStatus() throws WxErrorException { + UpdateInvoiceStatusRequest request = UpdateInvoiceStatusRequest.builder() + .cardId("**************") + .encryptCode("**************") + .reimburseStatus("INVOICE_REIMBURSE_INIT") + .build(); + + this.wxService.getReimburseInvoiceService().updateInvoiceStatus(request); + } + + public void updateStatusBatch() throws WxErrorException { + List invoices = new ArrayList<>(); + InvoiceInfoRequest r = InvoiceInfoRequest.builder() + .cardId("**************") + .encryptCode("**************") + .build(); + invoices.add(r); + + UpdateStatusBatchRequest request = UpdateStatusBatchRequest.builder() + .invoiceList(invoices) + .openid("**************") + .reimburseStatus("INVOICE_REIMBURSE_INIT") + .build(); + + this.wxService.getReimburseInvoiceService().updateStatusBatch(request); + } + +}