🆕 #1369 【企业微信】增加效率工具-日程相关接口

This commit is contained in:
Binary Wang
2020-12-25 17:09:18 +08:00
parent 55e1399fe8
commit 02d3c160b2
12 changed files with 501 additions and 48 deletions

View File

@ -0,0 +1,88 @@
package me.chanjar.weixin.cp.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.bean.oa.WxCpOaSchedule;
import java.util.List;
/**
* 企业微信日程接口.
* 官方文档https://work.weixin.qq.com/api/doc/90000/90135/93648
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2020 -12-25
*/
public interface WxCpOaScheduleService {
/**
* 创建日程
* <p>
* 该接口用于在日历中创建一个日程。
* <p>
* 请求方式: POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/oa/schedule/add?access_token=ACCESS_TOKEN
*
* @param schedule the schedule
* @param agentId 授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数
* @return 日程ID string
* @throws WxErrorException the wx error exception
*/
String add(WxCpOaSchedule schedule, Integer agentId) throws WxErrorException;
/**
* 更新日程
* <p>
* 该接口用于在日历中更新指定的日程。
* <p>
* 注意,更新操作是覆盖式,而不是增量式
* 不可更新组织者和日程所属日历ID
* <p>
* 请求方式: POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/oa/schedule/update?access_token=ACCESS_TOKEN
*
* @param schedule the schedule
* @throws WxErrorException the wx error exception
*/
void update(WxCpOaSchedule schedule) throws WxErrorException;
/**
* 获取日程详情
* <p>
* 该接口用于获取指定的日程详情。
* <p>
* 请求方式: POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/oa/schedule/get?access_token=ACCESS_TOKEN
*
* @param scheduleIds the schedule ids
* @return the details
* @throws WxErrorException the wx error exception
*/
List<WxCpOaSchedule> getDetails(List<String> scheduleIds) throws WxErrorException;
/**
* 取消日程
* 该接口用于取消指定的日程。
* <p>
* 请求方式: POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/oa/schedule/del?access_token=ACCESS_TOKEN
*
* @param scheduleId 日程id
* @throws WxErrorException the wx error exception
*/
void delete(String scheduleId) throws WxErrorException;
/**
* 获取日历下的日程列表
* 该接口用于获取指定的日历下的日程列表。
* 仅可获取应用自己创建的日历下的日程。
* <p>
* 请求方式: POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/oa/schedule/get_by_calendar?access_token=ACCESS_TOKEN
*
* @param calId 日历ID
* @param offset 分页,偏移量, 默认为0
* @param limit 分页预期请求的数据量默认为500取值范围 1 ~ 1000
* @return the string
* @throws WxErrorException the wx error exception
*/
List<WxCpOaSchedule> listByCalendar(String calId, Integer offset, Integer limit) throws WxErrorException;
}

View File

@ -1,7 +1,5 @@
package me.chanjar.weixin.cp.api;
import com.google.gson.JsonObject;
import me.chanjar.weixin.common.bean.ToJson;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.service.WxService;
@ -39,7 +37,7 @@ public interface WxCpService extends WxService {
*
* @return the access token
* @throws WxErrorException the wx error exception
* @see #getAccessToken(boolean) #getAccessToken(boolean)
* @see #getAccessToken(boolean) #getAccessToken(boolean)#getAccessToken(boolean)
*/
String getAccessToken() throws WxErrorException;
@ -63,7 +61,7 @@ public interface WxCpService extends WxService {
*
* @return the jsapi ticket
* @throws WxErrorException the wx error exception
* @see #getJsapiTicket(boolean) #getJsapiTicket(boolean)
* @see #getJsapiTicket(boolean) #getJsapiTicket(boolean)#getJsapiTicket(boolean)
*/
String getJsapiTicket() throws WxErrorException;
@ -90,7 +88,7 @@ public interface WxCpService extends WxService {
*
* @return the agent jsapi ticket
* @throws WxErrorException the wx error exception
* @see #getJsapiTicket(boolean) #getJsapiTicket(boolean)
* @see #getJsapiTicket(boolean) #getJsapiTicket(boolean)#getJsapiTicket(boolean)
*/
String getAgentJsapiTicket() throws WxErrorException;
@ -376,10 +374,17 @@ public interface WxCpService extends WxService {
/**
* 获取日历相关接口的服务类对象
*
* @return the menu service
* @return the oa calendar service
*/
WxCpOaCalendarService getOaCalendarService();
/**
* 获取日程相关接口的服务类对象
*
* @return the oa schedule service
*/
WxCpOaScheduleService getOaScheduleService();
/**
* 获取群机器人消息推送服务
*
@ -387,11 +392,11 @@ public interface WxCpService extends WxService {
*/
WxCpGroupRobotService getGroupRobotService();
/*
/**
* 获取工作台服务
*
* @return the workbench service
* */
*/
WxCpAgentWorkBenchService getWorkBenchService();
/**

View File

@ -55,6 +55,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
private WxCpGroupRobotService groupRobotService = new WxCpGroupRobotServiceImpl(this);
private WxCpMessageService messageService = new WxCpMessageServiceImpl(this);
private WxCpOaCalendarService oaCalendarService = new WxCpOaCalendarServiceImpl(this);
private WxCpOaScheduleService oaScheduleService = new WxCpOaOaScheduleServiceImpl(this);
private WxCpAgentWorkBenchService workBenchService = new WxCpAgentWorkBenchServiceImpl(this);
/**
@ -512,4 +513,9 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
public void setAgentService(WxCpAgentService agentService) {
this.agentService = agentService;
}
@Override
public WxCpOaScheduleService getOaScheduleService() {
return this.oaScheduleService;
}
}

View File

@ -0,0 +1,82 @@
package me.chanjar.weixin.cp.api.impl;
import com.google.common.collect.ImmutableMap;
import com.google.gson.reflect.TypeToken;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.GsonParser;
import me.chanjar.weixin.cp.api.WxCpOaScheduleService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.oa.WxCpOaSchedule;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Oa.*;
/**
* 企业微信日程接口实现类.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2020-12-25
*/
@Slf4j
@RequiredArgsConstructor
public class WxCpOaOaScheduleServiceImpl implements WxCpOaScheduleService {
private final WxCpService cpService;
@Override
public String add(WxCpOaSchedule schedule, Integer agentId) throws WxErrorException {
Map<String, Serializable> param;
if (agentId == null) {
param = ImmutableMap.of("schedule", schedule);
} else {
param = ImmutableMap.of("schedule", schedule, "agentid", agentId);
}
return this.cpService.post(this.cpService.getWxCpConfigStorage().getApiUrl(SCHEDULE_ADD),
WxCpGsonBuilder.create().toJson(param));
}
@Override
public void update(WxCpOaSchedule schedule) throws WxErrorException {
this.cpService.post(this.cpService.getWxCpConfigStorage().getApiUrl(SCHEDULE_UPDATE),
WxCpGsonBuilder.create().toJson(ImmutableMap.of("schedule", schedule)));
}
@Override
public List<WxCpOaSchedule> getDetails(List<String> scheduleIds) throws WxErrorException {
final String response = this.cpService.post(this.cpService.getWxCpConfigStorage().getApiUrl(SCHEDULE_GET),
WxCpGsonBuilder.create().toJson(ImmutableMap.of("schedule_id_list", scheduleIds)));
return WxCpGsonBuilder.create().fromJson(GsonParser.parse(response).get("schedule_list"),
new TypeToken<List<WxCpOaSchedule>>() {
}.getType());
}
@Override
public void delete(String scheduleId) throws WxErrorException {
this.cpService.post(this.cpService.getWxCpConfigStorage().getApiUrl(SCHEDULE_DEL),
WxCpGsonBuilder.create().toJson(ImmutableMap.of("schedule_id", scheduleId)));
}
@Override
public List<WxCpOaSchedule> listByCalendar(String calId, Integer offset, Integer limit) throws WxErrorException {
final Map<String, Object> param = new HashMap<>(3);
param.put("cal_id", calId);
if (offset != null) {
param.put("offset", offset);
}
if (limit != null) {
param.put("limit", limit);
}
final String response = this.cpService.post(this.cpService.getWxCpConfigStorage().getApiUrl(SCHEDULE_LIST),
WxCpGsonBuilder.create().toJson(param));
return WxCpGsonBuilder.create().fromJson(GsonParser.parse(response).get("schedule_list"),
new TypeToken<List<WxCpOaSchedule>>() {
}.getType());
}
}

View File

@ -0,0 +1,194 @@
package me.chanjar.weixin.cp.bean.oa;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.experimental.Accessors;
import me.chanjar.weixin.common.bean.ToJson;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;
import java.util.List;
/**
* 日程信息bean.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2020-12-25
*/
@Data
@Accessors(chain = true)
public class WxCpOaSchedule implements Serializable, ToJson {
private static final long serialVersionUID = -6821274247372646346L;
/**
* 日程id
*/
@SerializedName("schedule_id")
private String scheduleId;
/**
* 日程编号,是一个自增数字
*/
@SerializedName("sequence")
private Integer sequence;
/**
* 组织者。不多于64字节
*/
@SerializedName("organizer")
private String organizer;
/**
* 日程参与者列表。最多支持2000人
*/
@SerializedName("attendees")
private List<Attendee> attendees;
/**
* 日程标题。0 ~ 128 字符。不填会默认显示为“新建事件”
*/
@SerializedName("summary")
private String summary;
/**
* 日程描述。不多于512个字符
*/
@SerializedName("description")
private String description;
/**
* 提醒相关信息
*/
@SerializedName("reminders")
private Reminder reminders;
/**
* 日程地址。
* 不多于128个字符
*/
@SerializedName("location")
private String location;
/**
* 日程开始时间Unix时间戳
*/
@SerializedName("start_time")
private Long startTime;
/**
* 日程结束时间Unix时间戳
*/
@SerializedName("end_time")
private Long endTime;
/**
*
*/
@SerializedName("status")
private Integer status;
/**
* 日程所属日历ID。该日历必须是access_token所对应应用所创建的日历。
* 注意,这个日历必须是属于组织者(organizer)的日历;
* 如果不填,那么插入到组织者的默认日历上。
* 第三方应用必须指定cal_id
* 不多于64字节
*/
@SerializedName("cal_id")
private String calId;
@Override
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
@Data
@Accessors(chain = true)
public static class Attendee implements Serializable {
private static final long serialVersionUID = 5419000348428480645L;
/**
* 日程参与者ID
* 不多于64字节
*/
@SerializedName("userid")
private String userid;
/**
* 日程参与者的接受状态。
* 0 - 未处理
* 1 - 待定
* 2 - 全部接受
* 3 - 仅接受一次
* 4 - 拒绝
*/
@SerializedName("response_status")
private Integer responseStatus;
}
@Data
@Accessors(chain = true)
public static class Reminder implements Serializable {
private static final long serialVersionUID = 5030527150838243356L;
/**
* 是否需要提醒。0-否1-是
*/
@SerializedName("is_remind")
private Integer isRemind;
/**
* 是否重复日程。0-否1-是
*/
@SerializedName("is_repeat")
private Integer isRepeat;
/**
* 日程开始start_time前多少秒提醒当is_remind为1时有效。
* 例如: 300表示日程开始前5分钟提醒。目前仅支持以下数值
* 0 - 事件开始时
* 300 - 事件开始前5分钟
* 900 - 事件开始前15分钟
* 3600 - 事件开始前1小时
* 86400 - 事件开始前1天
*/
@SerializedName("remind_before_event_secs")
private Integer remindBeforeEventSecs;
/**
* 重复类型当is_repeat为1时有效。目前支持如下类型
* 0 - 每日
* 1 - 每周
* 2 - 每月
* 5 - 每年
* 7 - 工作日
*/
@SerializedName("repeat_type")
private Integer repeatType;
/**
* 重复结束时刻Unix时间戳。不填或填0表示一直重复
*/
@SerializedName("repeat_until")
private Long repeatUntil;
/**
* 是否自定义重复。0-否1-是
*/
@SerializedName("is_custom_repeat")
private Integer isCustomRepeat;
/**
* 重复间隔
* 仅当指定为自定义重复时有效
* 该字段随repeat_type不同而含义不同
* 例如:
* repeat_interval指定为3repeat_type指定为每周重复那么每3周重复一次
* repeat_interval指定为3repeat_type指定为每月重复那么每3个月重复一次
*/
@SerializedName("repeat_interval")
private Integer repeatInterval;
/**
* 每周周几重复
* 仅当指定为自定义重复且重复类型为每周时有效
* 取值范围1 ~ 7分别表示周一至周日
*/
@SerializedName("repeat_day_of_week")
private List<Integer> repeatDayOfWeek;
/**
* 每月哪几天重复
* 仅当指定为自定义重复且重复类型为每月时有效
* 取值范围1 ~ 31分别表示1~31号
*/
@SerializedName("repeat_day_of_month")
private List<Integer> repeatDayOfMonth;
/**
* 时区。UTC偏移量表示(即偏离零时区的小时数),东区为正数,西区为负数。
* 例如:+8 表示北京时间东八区
* 默认为北京时间东八区
* 取值范围:-12 ~ +12
*/
@SerializedName("timezone")
private Integer timezone;
}
}

View File

@ -113,6 +113,12 @@ public final class WxCpApiPathConsts {
public static final String CALENDAR_UPDATE = "/cgi-bin/oa/calendar/update";
public static final String CALENDAR_GET = "/cgi-bin/oa/calendar/get";
public static final String CALENDAR_DEL = "/cgi-bin/oa/calendar/del";
public static final String SCHEDULE_ADD = "/cgi-bin/oa/schedule/add";
public static final String SCHEDULE_UPDATE = "/cgi-bin/oa/schedule/update";
public static final String SCHEDULE_GET = "/cgi-bin/oa/schedule/get";
public static final String SCHEDULE_DEL = "/cgi-bin/oa/schedule/del";
public static final String SCHEDULE_LIST = "/cgi-bin/oa/schedule/get_by_calendar";
}
@UtilityClass

View File

@ -0,0 +1,54 @@
package me.chanjar.weixin.cp.api.impl;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.ApiTestModule;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.oa.WxCpOaSchedule;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.Arrays;
/**
* 单元测试类.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2020-12-25
*/
@Test
@Guice(modules = ApiTestModule.class)
public class WxCpOaScheduleServiceImplTest {
@Inject
protected WxCpService wxService;
@Test
public void testAdd() throws WxErrorException {
this.wxService.getOaScheduleService().add(new WxCpOaSchedule().setOrganizer("userid1")
.setDescription("description").setStartTime(111111111111L).setEndTime(222222222222L)
.setSummary("summary"), null);
}
@Test
public void testUpdate() throws WxErrorException {
this.wxService.getOaScheduleService().update(new WxCpOaSchedule().setScheduleId("2222").setOrganizer("userid1")
.setDescription("description").setStartTime(111111111111L).setEndTime(222222222222L)
.setSummary("summary"));
}
@Test
public void testGetDetails() throws WxErrorException {
this.wxService.getOaScheduleService().getDetails(Arrays.asList("11111"));
}
@Test
public void testDelete() throws WxErrorException {
this.wxService.getOaScheduleService().delete("111");
}
@Test
public void testListByCalendar() throws WxErrorException {
this.wxService.getOaScheduleService().listByCalendar("111", null, null);
}
}

View File

@ -50,8 +50,9 @@ public interface WxMpMaterialService {
*
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
* @param file 文件对象
* @throws WxErrorException
* @see #mediaUpload(String, String, InputStream)
* @return the wx media upload result
* @throws WxErrorException the wx error exception
* @see #mediaUpload(String, String, InputStream) #mediaUpload(String, String, InputStream)
*/
WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException;
@ -67,8 +68,9 @@ public interface WxMpMaterialService {
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
* @param fileType 文件类型,请看{@link me.chanjar.weixin.common.api.WxConsts}
* @param inputStream 输入流
* @throws WxErrorException
* @see #mediaUpload(java.lang.String, java.io.File)
* @return the wx media upload result
* @throws WxErrorException the wx error exception
* @see #mediaUpload(java.lang.String, java.io.File) #mediaUpload(java.lang.String, java.io.File)
*/
WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException;
@ -83,8 +85,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param mediaId 媒体文件Id
* @return 保存到本地的临时文件
* @throws WxErrorException
* @return 保存到本地的临时文件 file
* @throws WxErrorException the wx error exception
*/
File mediaDownload(String mediaId) throws WxErrorException;
@ -99,8 +101,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param mediaId 媒体文件Id
* @return 保存到本地的临时文件
* @throws WxErrorException
* @return 保存到本地的临时文件 file
* @throws WxErrorException the wx error exception
*/
File jssdkMediaDownload(String mediaId) throws WxErrorException;
@ -114,7 +116,7 @@ public interface WxMpMaterialService {
*
* @param file 上传的文件对象
* @return WxMediaImgUploadResult 返回图片url
* @throws WxErrorException
* @throws WxErrorException the wx error exception
*/
WxMediaImgUploadResult mediaImgUpload(File file) throws WxErrorException;
@ -139,6 +141,8 @@ public interface WxMpMaterialService {
*
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
* @param material 上传的素材, 请看{@link WxMpMaterial}
* @return the wx mp material upload result
* @throws WxErrorException the wx error exception
*/
WxMpMaterialUploadResult materialFileUpload(String mediaType, WxMpMaterial material) throws WxErrorException;
@ -159,6 +163,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param news 上传的图文消息, 请看{@link WxMpMaterialNews}
* @return the wx mp material upload result
* @throws WxErrorException the wx error exception
*/
WxMpMaterialUploadResult materialNewsUpload(WxMpMaterialNews news) throws WxErrorException;
@ -171,6 +177,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param mediaId 永久素材的id
* @return the input stream
* @throws WxErrorException the wx error exception
*/
InputStream materialImageOrVoiceDownload(String mediaId) throws WxErrorException;
@ -183,6 +191,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param mediaId 永久素材的id
* @return the wx mp material video info result
* @throws WxErrorException the wx error exception
*/
WxMpMaterialVideoInfoResult materialVideoInfo(String mediaId) throws WxErrorException;
@ -195,6 +205,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param mediaId 永久素材的id
* @return the wx mp material news
* @throws WxErrorException the wx error exception
*/
WxMpMaterialNews materialNewsInfo(String mediaId) throws WxErrorException;
@ -207,6 +219,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param wxMpMaterialArticleUpdate 用来更新图文素材的bean, 请看{@link WxMpMaterialArticleUpdate}
* @return the boolean
* @throws WxErrorException the wx error exception
*/
boolean materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate) throws WxErrorException;
@ -223,6 +237,8 @@ public interface WxMpMaterialService {
* </pre>
*
* @param mediaId 永久素材的id
* @return the boolean
* @throws WxErrorException the wx error exception
*/
boolean materialDelete(String mediaId) throws WxErrorException;
@ -238,6 +254,9 @@ public interface WxMpMaterialService {
* 详情请见: <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738733&token=&lang=zh_CN">获取素材总数</a>
* 接口url格式https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=ACCESS_TOKEN
* </pre>
*
* @return the wx mp material count result
* @throws WxErrorException the wx error exception
*/
WxMpMaterialCountResult materialCount() throws WxErrorException;
@ -251,6 +270,8 @@ public interface WxMpMaterialService {
*
* @param offset 从全部素材的该偏移位置开始返回0表示从第一个素材 返回
* @param count 返回素材的数量取值在1到20之间
* @return the wx mp material news batch get result
* @throws WxErrorException the wx error exception
*/
WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count) throws WxErrorException;
@ -265,6 +286,8 @@ public interface WxMpMaterialService {
* @param type 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
* @param offset 从全部素材的该偏移位置开始返回0表示从第一个素材 返回
* @param count 返回素材的数量取值在1到20之间
* @return the wx mp material file batch get result
* @throws WxErrorException the wx error exception
*/
WxMpMaterialFileBatchGetResult materialFileBatchGet(String type, int offset, int count) throws WxErrorException;

View File

@ -69,7 +69,7 @@ public interface WxPayService {
/**
* 发送post请求得到响应字符串.
*
* <p>
* 部分字段会包含敏感信息,所以在提交前需要在请求头中会包含"Wechatpay-Serial"信息
*
* @param url 请求地址
@ -102,7 +102,7 @@ public interface WxPayService {
* 发送下载 V3请求得到响应流.
*
* @param url 请求地址
* @return 返回请求响应流
* @return 返回请求响应流 input stream
* @throws WxPayException the wx pay exception
*/
InputStream downloadV3(URI url) throws WxPayException;
@ -117,7 +117,7 @@ public interface WxPayService {
/**
* 获取红包接口服务类.
*
* @return .
* @return . redpack service
*/
RedpackService getRedpackService();
@ -138,13 +138,15 @@ public interface WxPayService {
/**
* 获取电商收付通服务类
* @return
*
* @return the ecommerce service
*/
EcommerceService getEcommerceService();
/**
* 微信支付通用媒体服务类
* @return
* 获取微信支付通用媒体服务类
*
* @return the merchant media service
*/
MerchantMediaService getMerchantMediaService();
@ -243,11 +245,12 @@ public interface WxPayService {
/**
* 调用统一下单接口,并组装生成支付所需参数对象.
*
* @param <T> the type parameter
* @param specificTradeType 将使用的交易方式,不能为 null
* @param request 统一下单请求参数,设定的 tradeType 及配置里的 tradeType 将被忽略,转而使用 specificTradeType
* @return 返回 {@link WxPayConstants.TradeType.Specific} 指定的类
* @throws WxPayException the wx pay exception
* @see WxPayService#createOrder(WxPayUnifiedOrderRequest)
* @see WxPayService#createOrder(WxPayUnifiedOrderRequest) WxPayService#createOrder(WxPayUnifiedOrderRequest)
*/
<T> T createOrder(WxPayConstants.TradeType.Specific<T> specificTradeType, WxPayUnifiedOrderRequest request) throws WxPayException;
@ -518,7 +521,7 @@ public interface WxPayService {
* @param billType 账单类型 bill_type ALL返回当日所有订单信息默认值SUCCESS返回当日成功支付的订单REFUND返回当日退款订单
* @param tarType 压缩账单 tar_type 非必传参数固定值GZIP返回格式为.gzip的压缩包账单。不传则默认为数据流形式。
* @param deviceInfo 设备号 device_info 非必传参数,终端设备号
* @return 对账内容原始字符串
* @return 对账内容原始字符串 string
* @throws WxPayException the wx pay exception
*/
String downloadRawBill(String billDate, String billType, String tarType, String deviceInfo) throws WxPayException;
@ -537,7 +540,7 @@ public interface WxPayService {
* </pre>
*
* @param request 下载对账单请求
* @return 对账内容原始字符串
* @return 对账内容原始字符串 string
* @throws WxPayException the wx pay exception
*/
String downloadRawBill(WxPayDownloadBillRequest request) throws WxPayException;
@ -684,7 +687,7 @@ public interface WxPayService {
* @param longUrl 需要被压缩的网址
* @return the string
* @throws WxPayException the wx pay exception
* @see WxPayService#shorturl(WxPayShorturlRequest) WxPayService#shorturl(WxPayShorturlRequest)
* @see WxPayService#shorturl(WxPayShorturlRequest) WxPayService#shorturl(WxPayShorturlRequest)WxPayService#shorturl(WxPayShorturlRequest)
*/
String shorturl(String longUrl) throws WxPayException;
@ -712,7 +715,7 @@ public interface WxPayService {
* @param authCode 授权码
* @return openid string
* @throws WxPayException the wx pay exception
* @see WxPayService#authcode2Openid(WxPayAuthcode2OpenidRequest) WxPayService#authcode2Openid(WxPayAuthcode2OpenidRequest)
* @see WxPayService#authcode2Openid(WxPayAuthcode2OpenidRequest) WxPayService#authcode2Openid(WxPayAuthcode2OpenidRequest)WxPayService#authcode2Openid(WxPayAuthcode2OpenidRequest)
*/
String authcode2Openid(String authCode) throws WxPayException;
@ -860,7 +863,7 @@ public interface WxPayService {
*
* @param feeType 外币币种
* @param date 日期格式为yyyyMMdd如2009年12月25日表示为20091225。时区为GMT+8 beijing
* @return .
* @return . wx pay query exchange rate result
* @throws WxPayException .
*/
WxPayQueryExchangeRateResult queryExchangeRate(String feeType, String date) throws WxPayException;

View File

@ -50,25 +50,18 @@ import static com.github.binarywang.wxpay.constant.WxPayConstants.TarType;
public abstract class BaseWxPayServiceImpl implements WxPayService {
private static final String TOTAL_FUND_COUNT = "资金流水总笔数";
/**
* The Log.
*/
final Logger log = LoggerFactory.getLogger(this.getClass());
/**
* The constant wxApiData.
*/
static ThreadLocal<WxPayApiData> wxApiData = new ThreadLocal<>();
private EntPayService entPayService = new EntPayServiceImpl(this);
private ProfitSharingService profitSharingService = new ProfitSharingServiceImpl(this);
private RedpackService redpackService = new RedpackServiceImpl(this);
private PayScoreService payScoreService = new PayScoreServiceImpl(this);
private EcommerceService ecommerceService = new EcommerceServiceImpl(this);
private MerchantMediaService merchantMediaService =new MerchantMediaServiceImpl(this);
private final ProfitSharingService profitSharingService = new ProfitSharingServiceImpl(this);
private final RedpackService redpackService = new RedpackServiceImpl(this);
private final PayScoreService payScoreService = new PayScoreServiceImpl(this);
private final EcommerceService ecommerceService = new EcommerceServiceImpl(this);
private final MerchantMediaService merchantMediaService = new MerchantMediaServiceImpl(this);
/**
* The Config.
*/
protected WxPayConfig config;
@Override
@ -98,7 +91,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public MerchantMediaService getMerchantMediaService() {
return merchantMediaService;
return this.merchantMediaService;
}
@Override

View File

@ -19,7 +19,6 @@ import java.net.URI;
@Slf4j
@RequiredArgsConstructor
public class MerchantMediaServiceImpl implements MerchantMediaService {
private final WxPayService payService;
@Override