8000 增加查询小程序可回退的版本 接口 by hywr · Pull Request #2163 · binarywang/WxJava · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f14b88c
添加对话能力(原导购)相关结果 均通过单元测试
May 14, 2021
1c049e4
Merge remote-tracking branch 'origin/develop' into develop
hywr May 14, 2021
32695c7
Merge remote-tracking branch 'origin/develop' into develop
hywr May 17, 2021
aec9387
修改公众号、小程序、企业微信的access token自动刷新逻辑,用于避免当使用secrete误调用第三方平台专属接口的情况下出现循环递…
hywr May 17, 2021
edc935a
1.修复公众号在由第三方平台管理时OAuth2Service授权相关报错问题
hywr May 21, 2021
32028de
Merge remote-tracking branch 'origin/develop' into develop
hywr May 21, 2021
41791eb
1.增加查询小程序可回退的版本 接口
hywr Jun 23, 2021
1611b41
:memo: 更新版本信息
binarywang Jun 2, 2021
5d276b7
:memo: 更新部分信息
binarywang Jun 2, 2021
9279156
:art: 修复单元测试代码
binarywang Jun 3, 2021
933e058
:arrow_up: upgrade guava version
binarywang Jun 3, 2021
1905871
:new: #2142 【企业微信】被动回复消息内容新增任务卡片格式
arthur0201 Jun 4, 2021
d47d687
:arrow_up: Bump httpclient from 4.5 to 4.5.13 (#2143)
dependabot[bot] Jun 4, 2021
953b5f9
:art: 优化部分代码
binarywang Jun 4, 2021
a736621
:art: #2144【企业微信】更新任务卡片消息状态接口参数跟文档保持一致
arthur0201 Jun 7, 2021
d1e8fe3
:new: #2135 【小程序】实现获取 URL Link接口 以及微信电子发票报销方相关接口
mr-xiaoyu Jun 11, 2021
d6d3625
:art: #2155 【企业微信】发送新客户欢迎语接口增加对视频类型的支持,同时修复结构不正确的问题
chutian0124 Jun 21, 2021
4f5be60
:new: #2150 【企业微信】补充完善部分客户联系接口,以及服务商模式外部联系人openid转换接口
chutian0124 Jun 22, 2021
b6092db
:new: #2161 【公众号】微信推送消息类增加群发接口事件相关字段
arthur0201 Jun 23, 2021
e56eb91
1.增加查询小程序可回退的版本 接口
hywr Jun 23, 2021
a6cd1e3
Merge branch 'develop' into develop2
hywr Jun 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🆕 #2135 【小程序】实现获取 URL Link接口 以及微信电子发票报销方相关接口
  • Loading branch information
mr-xiaoyu authored and hywr committed Jun 23, 2021
commit d1e8fe354ae96cee8a05e7d5efb41996124225a6
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cn.binarywang.wx.miniapp.api;


import cn.binarywang.wx.miniapp.bean.urllink.GenerateUrlLinkRequest;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 获取小程序 URL Link接口
* 接口文档: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-link/urllink.generate.html
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2021-06-10
*/
public interface WxMaLinkService {

String generate(GenerateUrlLinkRequest request) throws WxErrorException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package cn.binarywang.wx.miniapp.api;

import cn.binarywang.wx.miniapp.bean.invoice.reimburse.*;
import me.chanjar.weixin.common.error.WxErrorException;

import java.util.List;

/**
* 电子发票报销方相关接口
* 接口文档: https://developers.weixin.qq.com/doc/offiaccount/WeChat_Invoice/E_Invoice/Reimburser_API_List.html
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2021-06-10
*/
public interface WxMaReimburseInvoiceService {

/**
* 查询报销发票信息
* @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<InvoiceInfoResponse> 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,16 @@ public interface WxMaService extends WxService {
* @return
*/
WxMaShopSpuService getShopSpuService();

/**
* 获取小程序 URL Link服务接口
* @return
*/
WxMaLinkService getLinkService();

/**
* 获取电子发票报销方服务接口
* @return
*/
WxMaReimburseInvoiceService getReimburseInvoiceService();
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
private final WxImgProcService imgProcService = new WxMaImgProcServiceImpl(this);
private final WxMaShopSpuService shopSpuService = new WxMaShopSpuServiceImpl(this);
private final WxMaShopOrderService shopOrderService = new WxMaShopOrderServiceImpl(this);
private final WxMaLinkService linkService = new WxMaLinkServiceImpl(this);
private final WxMaReimburseInvoiceService reimburseInvoiceService = new WxMaReimburseInvoiceServiceImpl(this);
private Map<String, WxMaConfig> configMap;
private int retrySleepMillis = 1000;
private int maxRetryTimes = 5;
Expand Down Expand Up @@ -512,4 +514,14 @@ public WxMaShopSpuService getShopSpuService() {
public WxMaShopOrderService getShopOrderService() {
return this.shopOrderService;
}

@Override
public WxMaLinkService getLinkService() {
return this.linkService;
}

@Override
public WxMaReimburseInvoiceService getReimburseInvoiceService() {
return this.reimburseInvoiceService;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package cn.binarywang.wx.miniapp.api.impl;

import cn.binarywang.wx.miniapp.api.WxMaLinkService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.urllink.GenerateUrlLinkRequest;
import com.google.gson.JsonObject;
import lombok.AllArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.GsonParser;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;

import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Link.GENERATE_URLLINK_URL;

/**
* 获取小程序 URL Link接口实现
* 接口文档: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-link/urllink.generate.html
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2021-06-10
*/
@AllArgsConstructor
public class WxMaLinkServiceImpl implements WxMaLinkService {

private final WxMaService wxMaService;

@Override
public String generate(GenerateUrlLinkRequest request) throws WxErrorException {
String result = this.wxMaService.post(GENERATE_URLLINK_URL,request);
String linkField = "url_link";
JsonObject jsonObject = GsonParser.parse(result);
if(jsonObject.has(linkField)){
return jsonObject.get(linkField).toString();
}
throw new WxErrorException("无url_link");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package cn.binarywang.wx.miniapp.api.impl;

import cn.binarywang.wx.miniapp.api.WxMaReimburseInvoiceService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.invoice.reimburse.*;
import lombok.AllArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;

import java.util.List;

import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Invoice.*;

/**
* 电子发票报销方相关接口实现
* 接口文档: https://developers.weixin.qq.com/doc/offiaccount/WeChat_Invoice/E_Invoice/Reimburser_API_List.html
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2021-06-10
*/
@AllArgsConstructor
public class WxMaReimburseInvoiceServiceImpl implements WxMaReimburseInvoiceService {

private final WxMaService wxMaService;

@Override
public InvoiceInfoResponse getInvoiceInfo(InvoiceInfoRequest request) throws WxErrorException {
return InvoiceInfoResponse.fromJson(this.wxMaService.post(GET_INVOICE_INFO,request.toJson()));
}

@Override
public List<InvoiceInfoResponse> getInvoiceBatch(InvoiceBatchRequest request) throws WxErrorException {
return InvoiceInfoResponse.toList(this.wxMaService.post(GET_INVOICE_BATCH,request.toJson()));
}

@Override
public void updateInvoiceStatus(UpdateInvoiceStatusRequest request) throws WxErrorException {
this.wxMaService.post(UPDATE_INVOICE_STATUS,request.toJson());
}

@Override
public void updateStatusBatch(UpdateStatusBatchRequest request) throws WxErrorException {
this.wxMaService.post(UPDATE_STATUS_BATCH,request.toJson());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package cn.binarywang.wx.miniapp.bean.invoice.reimburse;

import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
* <pre>
* 批量查询报销发票信息参数对象
* </pre>
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2021-03-23
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InvoiceBatchRequest implements Serializable {

private static final long serialVersionUID = -9121443117105107231L;

/**
* 发票卡券的card_id
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("item_list")
private List<InvoiceInfoRequest> itemList;


public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cn.binarywang.wx.miniapp.bean.invoice.reimburse;

import lombok.Data;

/**
* <pre>
* 发票商品信息
* </pre>
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2021-03-23
*/
@Data
public class InvoiceCommodityInfo {

/**
* 项目(商品)名称
*/
private String name;

/**
* 项目数量
*/
private Integer num;

/**
* 项目单位
*/
private String unit;

/**
* 单价,以分为单位
*/
private Integer price;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package cn.binarywang.wx.miniapp.bean.invoice.reimburse;


import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* <pre>
* 查询报销发票信息参数对象
* </pre>
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2021-03-23
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InvoiceInfoRequest implements Serializable {

private static final long serialVersionUID = 7854633127026139444L;


/**
* 发票卡券的card_id
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("card_id")
private String cardId;


/**
* 发票卡券的加密code,和card_id共同构成一张发票卡券的唯一标识
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("encrypt_code")
private String encryptCode;



public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package cn.binarywang.wx.miniapp.bean.invoice.reimburse;

import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
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 java.util.List;

/**
* <pre>
* 查询报销发票信息响应对象
* </pre>
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @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 WxMaGsonBuilder.create().fromJson(json, InvoiceInfoResponse.class);
}


public static List<InvoiceInfoResponse> toList(String json) {
JsonObject jsonObject = GsonParser.parse(json);
return WxMaGsonBuilder.create().fromJson(jsonObject.get("item_list").toString(),
new TypeToken<List<InvoiceInfoResponse>>() {
}.getType());
}
}
Loading
0