🆕 #2201【企业微信】 增加获取打卡记录日报、获取打卡记录月报、获取打卡人员排班信息接口
This commit is contained in:
@@ -26,7 +26,7 @@ public interface WxCpOaService {
|
||||
* </pre>
|
||||
*
|
||||
* @param request 请求
|
||||
* @return 表单提交成功后,返回的表单编号
|
||||
* @return 表单提交成功后 ,返回的表单编号
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String apply(WxCpOaApplyEventRequest request) throws WxErrorException;
|
||||
@@ -41,7 +41,7 @@ public interface WxCpOaService {
|
||||
* @param startTime 获取打卡记录的开始时间
|
||||
* @param endTime 获取打卡记录的结束时间
|
||||
* @param userIdList 需要获取打卡记录的用户列表
|
||||
* @return 打卡数据列表
|
||||
* @return 打卡数据列表 checkin data
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date startTime, Date endTime,
|
||||
@@ -55,7 +55,7 @@ public interface WxCpOaService {
|
||||
*
|
||||
* @param datetime 需要获取规则的当天日期
|
||||
* @param userIdList 需要获取打卡规则的用户列表
|
||||
* @return 打卡规则列表
|
||||
* @return 打卡规则列表 checkin option
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
List<WxCpCheckinOption> getCheckinOption(Date datetime, List<String> userIdList) throws WxErrorException;
|
||||
@@ -78,7 +78,7 @@ public interface WxCpOaService {
|
||||
* @param cursor 分页查询游标,默认为0,后续使用返回的next_cursor进行分页拉取
|
||||
* @param size 一次请求拉取审批单数量,默认值为100,上限值为100
|
||||
* @param filters 筛选条件,可对批量拉取的审批申请设置约束条件,支持设置多个条件,nullable
|
||||
* @return WxCpApprovalInfo
|
||||
* @return WxCpApprovalInfo approval info
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpApprovalInfo getApprovalInfo(@NonNull Date startTime, @NonNull Date endTime, Integer cursor, Integer size,
|
||||
@@ -89,9 +89,9 @@ public interface WxCpOaService {
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return WxCpApprovalInfo
|
||||
* @return WxCpApprovalInfo approval info
|
||||
* @throws WxErrorException .
|
||||
* @see me.chanjar.weixin.cp.api.WxCpOaService#getApprovalInfo
|
||||
* @see me.chanjar.weixin.cp.api.WxCpOaService#getApprovalInfo me.chanjar.weixin.cp.api.WxCpOaService#getApprovalInfo
|
||||
*/
|
||||
WxCpApprovalInfo getApprovalInfo(@NonNull Date startTime, @NonNull Date endTime) throws WxErrorException;
|
||||
|
||||
@@ -105,7 +105,7 @@ public interface WxCpOaService {
|
||||
* </pre>
|
||||
*
|
||||
* @param spNo 审批单编号。
|
||||
* @return WxCpApprovaldetail
|
||||
* @return WxCpApprovaldetail approval detail
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpApprovalDetailResult getApprovalDetail(@NonNull String spNo) throws WxErrorException;
|
||||
@@ -117,7 +117,7 @@ public interface WxCpOaService {
|
||||
* @param endTime 查询的结束时间戳
|
||||
* @param offset 分页查询的偏移量
|
||||
* @param limit 分页查询的每页大小,默认为100条,如该参数大于100则按100处理
|
||||
* @return .
|
||||
* @return . dial record
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
List<WxCpDialRecord> getDialRecord(Date startTime, Date endTime, Integer offset,
|
||||
@@ -127,9 +127,45 @@ public interface WxCpOaService {
|
||||
* 获取审批模板详情
|
||||
*
|
||||
* @param templateId 模板ID
|
||||
* @return .
|
||||
* @return . template detail
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpTemplateResult getTemplateDetail(@NonNull String templateId) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取打卡日报数据
|
||||
*
|
||||
* @param startTime 获取日报的开始时间
|
||||
* @param endTime 获取日报的结束时间
|
||||
* @param userIdList 获取日报的userid列表
|
||||
* @return 日报数据列表 checkin day data
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
List<WxCpCheckinDayData> getCheckinDayData(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取打卡月报数据
|
||||
*
|
||||
* @param startTime 获取月报的开始时间
|
||||
* @param endTime 获取月报的结束时间
|
||||
* @param userIdList 获取月报的userid列表
|
||||
* @return 月报数据列表
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
List<WxCpCheckinMonthData> getCheckinMonthData(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取打卡人员排班信息
|
||||
*
|
||||
* @param startTime 获取排班信息的开始时间。Unix时间戳
|
||||
* @param endTime 获取排班信息的结束时间。Unix时间戳(与starttime跨度不超过一个月)
|
||||
* @param userIdList 需要获取排班信息的用户列表(不超过100个)
|
||||
* @return 排班表信息
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpCheckinSchedule getCheckinScheduleList(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -212,4 +212,115 @@ public class WxCpOaServiceImpl implements WxCpOaService {
|
||||
String responseContent = this.mainService.post(url, jsonObject.toString());
|
||||
return WxCpGsonBuilder.create().fromJson(responseContent, WxCpTemplateResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxCpCheckinDayData> getCheckinDayData(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException {
|
||||
|
||||
if (startTime == null || endTime == null) {
|
||||
throw new WxRuntimeException("starttime and endtime can't be null");
|
||||
}
|
||||
|
||||
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
|
||||
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
|
||||
}
|
||||
|
||||
long endTimestamp = endTime.getTime() / 1000L;
|
||||
long startTimestamp = startTime.getTime() / 1000L;
|
||||
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
JsonArray jsonArray = new JsonArray();
|
||||
|
||||
jsonObject.addProperty("starttime", startTimestamp);
|
||||
jsonObject.addProperty("endtime", endTimestamp);
|
||||
|
||||
for (String userid : userIdList) {
|
||||
jsonArray.add(userid);
|
||||
}
|
||||
jsonObject.add("useridlist", jsonArray);
|
||||
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_DAY_DATA);
|
||||
String responseContent = this.mainService.post(url, jsonObject.toString());
|
||||
JsonObject tmpJson = GsonParser.parse(responseContent);
|
||||
return WxCpGsonBuilder.create()
|
||||
.fromJson(
|
||||
tmpJson.get("datas"),
|
||||
new TypeToken<List<WxCpCheckinDayData>>() {
|
||||
}.getType()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxCpCheckinMonthData> getCheckinMonthData(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException {
|
||||
if (startTime == null || endTime == null) {
|
||||
throw new WxRuntimeException("starttime and endtime can't be null");
|
||||
}
|
||||
|
||||
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
|
||||
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
|
||||
}
|
||||
|
||||
long endTimestamp = endTime.getTime() / 1000L;
|
||||
long startTimestamp = startTime.getTime() / 1000L;
|
||||
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
JsonArray jsonArray = new JsonArray();
|
||||
|
||||
jsonObject.addProperty("starttime", startTimestamp);
|
||||
jsonObject.addProperty("endtime", endTimestamp);
|
||||
|
||||
for (String userid : userIdList) {
|
||||
jsonArray.add(userid);
|
||||
}
|
||||
jsonObject.add("useridlist", jsonArray);
|
||||
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_MONTH_DATA);
|
||||
String responseContent = this.mainService.post(url, jsonObject.toString());
|
||||
JsonObject tmpJson = GsonParser.parse(responseContent);
|
||||
return WxCpGsonBuilder.create()
|
||||
.fromJson(
|
||||
tmpJson.get("datas"),
|
||||
new TypeToken<List<WxCpCheckinMonthData>>() {
|
||||
}.getType()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpCheckinSchedule getCheckinScheduleList(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException {
|
||||
if (startTime == null || endTime == null) {
|
||||
throw new WxRuntimeException("starttime and endtime can't be null");
|
||||
}
|
||||
|
||||
if (userIdList == null || userIdList.size() > USER_IDS_LIMIT) {
|
||||
throw new WxRuntimeException("用户列表不能为空,不超过 " + USER_IDS_LIMIT + " 个,若用户超过 " + USER_IDS_LIMIT + " 个,请分批获取");
|
||||
}
|
||||
|
||||
|
||||
long endTimestamp = endTime.getTime() / 1000L;
|
||||
long startTimestamp = startTime.getTime() / 1000L;
|
||||
|
||||
if (endTimestamp - startTimestamp < 0 || endTimestamp - startTimestamp >= MONTH_SECONDS) {
|
||||
throw new WxRuntimeException("获取记录时间跨度不超过一个月");
|
||||
}
|
||||
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
JsonArray jsonArray = new JsonArray();
|
||||
|
||||
jsonObject.addProperty("starttime", startTimestamp);
|
||||
jsonObject.addProperty("endtime", endTimestamp);
|
||||
|
||||
for (String userid : userIdList) {
|
||||
jsonArray.add(userid);
|
||||
}
|
||||
jsonObject.add("useridlist", jsonArray);
|
||||
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_SCHEDULE_DATA);
|
||||
String responseContent = this.mainService.post(url, jsonObject.toString());
|
||||
JsonObject tmpJson = GsonParser.parse(responseContent);
|
||||
return WxCpGsonBuilder.create()
|
||||
.fromJson(
|
||||
tmpJson,
|
||||
new TypeToken<WxCpCheckinSchedule>() {
|
||||
}.getType()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
package me.chanjar.weixin.cp.bean.oa;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业微信打卡日报数据
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class WxCpCheckinDayData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5950483201268226746L;
|
||||
|
||||
/**
|
||||
* base_info 基础信息
|
||||
*/
|
||||
@SerializedName("base_info")
|
||||
private BaseInfo baseInfo;
|
||||
|
||||
@Data
|
||||
public class BaseInfo implements Serializable{
|
||||
|
||||
|
||||
private static final long serialVersionUID = 3679745559788648438L;
|
||||
/**
|
||||
* date 日报日期 时间戳
|
||||
*/
|
||||
@SerializedName("date")
|
||||
private Integer date;
|
||||
|
||||
/**
|
||||
* record_type 记录类型:1-固定上下班;2-外出(此报表中不会出现外出打卡数据);3-按班次上下班;4-自由签到;5-加班;7-无规则
|
||||
*/
|
||||
@SerializedName("record_type")
|
||||
private Integer recordType;
|
||||
|
||||
/**
|
||||
* name 打卡人员姓名
|
||||
*/
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* name_ex 打卡人员姓名
|
||||
*/
|
||||
@SerializedName("name_ex")
|
||||
private String nameEx;
|
||||
|
||||
/**
|
||||
* departs_name 打卡人员所在部门,会显示所有所在部门
|
||||
*/
|
||||
@SerializedName("departs_name")
|
||||
private String departsName;
|
||||
|
||||
/**
|
||||
* acctid 打卡人员帐号,即userid
|
||||
*/
|
||||
@SerializedName("acctid")
|
||||
private String acctId;
|
||||
|
||||
/**
|
||||
* rule_info 打卡人员所属规则信息
|
||||
*/
|
||||
@SerializedName("rule_info")
|
||||
private RuleInfo ruleInfo;
|
||||
|
||||
@Data
|
||||
public class RuleInfo implements Serializable {
|
||||
private static final long serialVersionUID = -5512479811648914189L;
|
||||
/**
|
||||
* groupid 所属规则的id
|
||||
*/
|
||||
@SerializedName("groupid")
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* groupname 打卡规则名
|
||||
*/
|
||||
@SerializedName("groupname")
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* scheduleid 当日所属班次id,仅按班次上下班才有值,显示在打卡日报-班次列
|
||||
*/
|
||||
@SerializedName("scheduleid")
|
||||
private Integer scheduleId;
|
||||
|
||||
/**
|
||||
* schedulename 当日所属班次名称,仅按班次上下班才有值,显示在打卡日报-班次列
|
||||
*/
|
||||
@SerializedName("schedulename")
|
||||
private String scheduleName;
|
||||
|
||||
/**
|
||||
* checkintime 当日打卡时间,仅固定上下班规则有值,显示在打卡日报-班次列
|
||||
*/
|
||||
@SerializedName("checkintime")
|
||||
private List<CheckinTime> checkinTime;
|
||||
|
||||
@Data
|
||||
public class CheckinTime implements Serializable{
|
||||
private static final long serialVersionUID = 1582835435812966332L;
|
||||
/**
|
||||
* work_sec 上班时间,为距离0点的时间差
|
||||
*/
|
||||
@SerializedName("work_sec")
|
||||
private Integer workSec;
|
||||
|
||||
/**
|
||||
* off_work_sec 下班时间,为距离0点的时间差
|
||||
*/
|
||||
@SerializedName("off_work_sec")
|
||||
private Integer offWorkSec;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* day_type 日报类型:0-工作日日报;1-休息日日报
|
||||
*/
|
||||
@SerializedName("day_type")
|
||||
private Integer dayType;
|
||||
}
|
||||
|
||||
/**
|
||||
* summary_info 汇总信息
|
||||
*/
|
||||
@SerializedName("summary_info")
|
||||
private SummaryInfo summaryInfo;
|
||||
|
||||
@Data
|
||||
public class SummaryInfo implements Serializable{
|
||||
private static final long serialVersionUID = 3428576099259666595L;
|
||||
/**
|
||||
* checkin_count 当日打卡次数
|
||||
*/
|
||||
@SerializedName("checkin_count")
|
||||
private Integer checkinCount;
|
||||
|
||||
/**
|
||||
* regular_work_sec 当日实际工作时长,单位:秒
|
||||
*/
|
||||
@SerializedName("regular_work_sec")
|
||||
private Integer regularWorkSec;
|
||||
|
||||
/**
|
||||
* standard_work_sec 当日标准工作时长,单位:秒
|
||||
*/
|
||||
@SerializedName("standard_work_sec")
|
||||
private Integer standardWorkSec;
|
||||
|
||||
/**
|
||||
* earliest_time 当日最早打卡时间
|
||||
*/
|
||||
@SerializedName("earliest_time")
|
||||
private Integer earliestTime;
|
||||
|
||||
/**
|
||||
* lastest_time 当日最晚打卡时间
|
||||
*/
|
||||
@SerializedName("lastest_time")
|
||||
private Integer lastestTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* holiday_infos 假勤相关信息
|
||||
*/
|
||||
@SerializedName("holiday_infos")
|
||||
private List<HolidayInfos> holidayInfos;
|
||||
|
||||
@Data
|
||||
public class HolidayInfos implements Serializable{
|
||||
private static final long serialVersionUID = -6671577072585561527L;
|
||||
/**
|
||||
* sp_number 假勤相关信息
|
||||
*/
|
||||
@SerializedName("sp_number")
|
||||
private String spNumber;
|
||||
|
||||
/**
|
||||
* sp_title 假勤信息摘要-标题信息
|
||||
*/
|
||||
@SerializedName("sp_title")
|
||||
private SpTitle spTitle;
|
||||
|
||||
@Data
|
||||
public class SpTitle implements Serializable {
|
||||
private static final long serialVersionUID = 2148815417115384998L;
|
||||
/**
|
||||
* data 多种语言描述,目前只有中文一种
|
||||
*/
|
||||
@SerializedName("data")
|
||||
private List<Data> data;
|
||||
|
||||
@lombok.Data
|
||||
public class Data implements Serializable{
|
||||
private static final long serialVersionUID = -1672692024530543180L;
|
||||
/**
|
||||
* text 假勤信息摘要-标题文本
|
||||
*/
|
||||
@SerializedName("text")
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* lang 语言类型:”zh_CN”
|
||||
*/
|
||||
@SerializedName("lang")
|
||||
private String lang;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sp_description 假勤信息摘要-描述信息
|
||||
*/
|
||||
@SerializedName("sp_description")
|
||||
private SpDescription spDescription;
|
||||
|
||||
@Data
|
||||
public class SpDescription implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 77680581771933449L;
|
||||
/**
|
||||
* data 多种语言描述,目前只有中文一种
|
||||
*/
|
||||
@SerializedName("data")
|
||||
private List<Data> data;
|
||||
|
||||
@lombok.Data
|
||||
public class Data implements Serializable{
|
||||
private static final long serialVersionUID = 3555479101375365805L;
|
||||
/**
|
||||
* text 假勤信息摘要-标题文本
|
||||
*/
|
||||
@SerializedName("text")
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* lang 语言类型:”zh_CN”
|
||||
*/
|
||||
@SerializedName("lang")
|
||||
private String lang;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* exception_infos 校准状态信息
|
||||
*/
|
||||
@SerializedName("exception_infos")
|
||||
private List<ExceptionInfos> exceptionInfos;
|
||||
|
||||
@Data
|
||||
public class ExceptionInfos implements Serializable{
|
||||
private static final long serialVersionUID = -5987438373762518299L;
|
||||
/**
|
||||
* exception 校准状态类型:1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常
|
||||
*/
|
||||
@SerializedName("exception")
|
||||
private Integer exception;
|
||||
|
||||
/**
|
||||
* count 当日此异常的次数
|
||||
*/
|
||||
@SerializedName("count")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* duration 当日此异常的时长(迟到/早退/旷工才有值)
|
||||
*/
|
||||
@SerializedName("duration")
|
||||
private Integer duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* ot_info 加班信息
|
||||
*/
|
||||
@SerializedName("ot_info")
|
||||
private OtInfo otInfo;
|
||||
|
||||
@Data
|
||||
public class OtInfo implements Serializable{
|
||||
private static final long serialVersionUID = -6557759801572150175L;
|
||||
/**
|
||||
* ot_status 状态:0-无加班;1-正常;2-缺时长
|
||||
*/
|
||||
@SerializedName("ot_status")
|
||||
private Integer otStatus;
|
||||
|
||||
/**
|
||||
* ot_duration 加班时长
|
||||
*/
|
||||
@SerializedName("ot_duration")
|
||||
private Integer otDuration;
|
||||
|
||||
/**
|
||||
* exception_duration ot_status为2下,加班不足的时长
|
||||
*/
|
||||
@SerializedName("exception_duration")
|
||||
private List<Integer> exceptionDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* sp_items 假勤统计信息
|
||||
*/
|
||||
@SerializedName("sp_items")
|
||||
private List<SpItem> spItems;
|
||||
|
||||
@Data
|
||||
public class SpItem implements Serializable{
|
||||
private static final long serialVersionUID = 2423158264958352024L;
|
||||
/**
|
||||
* type 类型:1-请假;2-补卡;3-出差;4-外出;100-外勤
|
||||
*/
|
||||
@SerializedName("type")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* vacation_id 具体请假类型,当type为1请假时,具体的请假类型id,可通过审批相关接口获取假期详情
|
||||
*/
|
||||
@SerializedName("vacation_id")
|
||||
private Integer vacationId;
|
||||
|
||||
/**
|
||||
* count 当日假勤次数
|
||||
*/
|
||||
@SerializedName("count")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* duration 当日假勤时长秒数,时长单位为天直接除以86400即为天数,单位为小时直接除以3600即为小时数
|
||||
*/
|
||||
@SerializedName("duration")
|
||||
private Integer duration;
|
||||
|
||||
/**
|
||||
* time_type 时长单位:0-按天 1-按小时
|
||||
*/
|
||||
@SerializedName("time_type")
|
||||
private Integer timeType;
|
||||
|
||||
/**
|
||||
* name 统计项名称
|
||||
*/
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package me.chanjar.weixin.cp.bean.oa;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业微信打卡月报数据
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class WxCpCheckinMonthData implements Serializable {
|
||||
private static final long serialVersionUID = -3062328201807894236L;
|
||||
|
||||
/**
|
||||
* baseInfo 基础信息
|
||||
*/
|
||||
@SerializedName("base_info")
|
||||
private BaseInfo baseInfo;
|
||||
|
||||
@Data
|
||||
public class BaseInfo implements Serializable {
|
||||
private static final long serialVersionUID = -5368331890851903885L;
|
||||
/**
|
||||
* record_type 记录类型:1-固定上下班;2-外出(此报表中不会出现外出打卡数据);3-按班次上下班;4-自由签到;5-加班;7-无规则
|
||||
*/
|
||||
@SerializedName("record_type")
|
||||
private Integer recordType;
|
||||
|
||||
/**
|
||||
* name 打卡人员姓名
|
||||
*/
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* name_ex 打卡人员别名
|
||||
*/
|
||||
@SerializedName("name_ex")
|
||||
private String nameEx;
|
||||
|
||||
/**
|
||||
* departs_name 打卡人员所在部门,会显示所有所在部门
|
||||
*/
|
||||
@SerializedName("departs_name")
|
||||
private String departsName;
|
||||
|
||||
/**
|
||||
* acctid 打卡人员帐号,即userid
|
||||
*/
|
||||
@SerializedName("acctid")
|
||||
private String acctId;
|
||||
|
||||
/**
|
||||
* rule_info 打卡人员所属规则信息
|
||||
*/
|
||||
@SerializedName("rule_info")
|
||||
private RuleInfo ruleInfo;
|
||||
|
||||
@Data
|
||||
public class RuleInfo implements Serializable {
|
||||
private static final long serialVersionUID = 9152263355916880710L;
|
||||
/**
|
||||
* groupid 所属规则Id
|
||||
*/
|
||||
@SerializedName("groupid")
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* groupname 所属规则Id
|
||||
*/
|
||||
@SerializedName("groupname")
|
||||
private String groupName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* summary_info 打卡人员所属规则信息
|
||||
*/
|
||||
@SerializedName("summary_info")
|
||||
private SummaryInfo summaryInfo;
|
||||
|
||||
@Data
|
||||
public class SummaryInfo implements Serializable {
|
||||
private static final long serialVersionUID = -1956770107240513983L;
|
||||
/**
|
||||
* work_days 应打卡天数
|
||||
*/
|
||||
@SerializedName("work_days")
|
||||
private Integer workDays;
|
||||
|
||||
/**
|
||||
* regular_days 正常天数
|
||||
*/
|
||||
@SerializedName("regular_days")
|
||||
private Integer regularDays;
|
||||
|
||||
/**
|
||||
* except_days 异常天数
|
||||
*/
|
||||
@SerializedName("except_days")
|
||||
private Integer exceptDays;
|
||||
|
||||
/**
|
||||
* regular_work_sec 实际工作时长,为统计周期每日实际工作时长之和
|
||||
*/
|
||||
@SerializedName("regular_work_sec")
|
||||
private Integer regularWorkSec;
|
||||
|
||||
/**
|
||||
* standard_work_sec 正常天数
|
||||
*/
|
||||
@SerializedName("standard_work_sec")
|
||||
private Integer standardWorkSec;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* exception_infos 异常状态统计信息
|
||||
*/
|
||||
@SerializedName("exception_infos")
|
||||
private List<ExceptionInfo> exceptionInfos;
|
||||
|
||||
@Data
|
||||
public class ExceptionInfo implements Serializable {
|
||||
private static final long serialVersionUID = -4855850255704089359L;
|
||||
/**
|
||||
* exception 异常类型:1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常
|
||||
*/
|
||||
@SerializedName("exception")
|
||||
private Integer exception;
|
||||
|
||||
/**
|
||||
* count 异常次数,为统计周期内每日此异常次数之和
|
||||
*/
|
||||
@SerializedName("count")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* duration 异常时长(迟到/早退/旷工才有值),为统计周期内每日此异常时长之和
|
||||
*/
|
||||
@SerializedName("duration")
|
||||
private Integer duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* sp_items 假勤统计信息
|
||||
*/
|
||||
@SerializedName("sp_items")
|
||||
private List<SpItem> spItems;
|
||||
|
||||
@Data
|
||||
public class SpItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 224472626753597080L;
|
||||
/**
|
||||
* type 假勤类型:1-请假;2-补卡;3-出差;4-外出;100-外勤
|
||||
*/
|
||||
@SerializedName("type")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* vacation_id 具体请假类型,当type为1请假时,具体的请假类型id,可通过审批相关接口获取假期详情
|
||||
*/
|
||||
@SerializedName("vacation_id")
|
||||
private Integer vacationId;
|
||||
|
||||
/**
|
||||
* count 假勤次数,为统计周期内每日此假勤发生次数之和
|
||||
*/
|
||||
@SerializedName("count")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* duration 假勤时长,为统计周期内每日此假勤发生时长之和,时长单位为天直接除以86400即为天数,单位为小时直接除以3600即为小时数
|
||||
*/
|
||||
@SerializedName("duration")
|
||||
private Integer duration;
|
||||
|
||||
/**
|
||||
* time_type 时长单位:0-按天 1-按小时
|
||||
*/
|
||||
@SerializedName("time_type")
|
||||
private Integer timeType;
|
||||
|
||||
/**
|
||||
* name 统计项名称
|
||||
*/
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
}
|
||||
|
||||
/**
|
||||
* overwork_info 加班情况
|
||||
*/
|
||||
@SerializedName("overwork_info")
|
||||
private OverWorkInfo overworkInfo;
|
||||
|
||||
@Data
|
||||
public class OverWorkInfo implements Serializable {
|
||||
private static final long serialVersionUID = -9149524232645899305L;
|
||||
/**
|
||||
* workday_over_sec 工作日加班时长
|
||||
*/
|
||||
@SerializedName("workday_over_sec")
|
||||
private Integer workdayOverSec;
|
||||
|
||||
/**
|
||||
* holidays_over_sec 节假日加班时长
|
||||
*/
|
||||
@SerializedName("holidays_over_sec")
|
||||
private Integer holidaysOverSec;
|
||||
|
||||
/**
|
||||
* restdays_over_sec 休息日加班时长
|
||||
*/
|
||||
@SerializedName("restdays_over_sec")
|
||||
private Integer restdaysOverSec;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package me.chanjar.weixin.cp.bean.oa;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 打卡人员排班信息
|
||||
*/
|
||||
@Data
|
||||
public class WxCpCheckinSchedule implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5399197385827384108L;
|
||||
|
||||
/**
|
||||
* schedule_list 排班表信息
|
||||
*/
|
||||
@SerializedName("schedule_list")
|
||||
private List<UserScheduleInfo> scheduleList;
|
||||
|
||||
@Data
|
||||
public class UserScheduleInfo implements Serializable {
|
||||
private static final long serialVersionUID = 5515056962298169806L;
|
||||
/**
|
||||
* userid 打卡人员userid
|
||||
*/
|
||||
@SerializedName("userid")
|
||||
private String userid;
|
||||
|
||||
/**
|
||||
* yearmonth 排班表月份,格式为年月,如202011
|
||||
*/
|
||||
@SerializedName("yearmonth")
|
||||
private Integer yearmonth;
|
||||
|
||||
/**
|
||||
* groupid 打卡规则id
|
||||
*/
|
||||
@SerializedName("groupid")
|
||||
private Integer groupid;
|
||||
|
||||
/**
|
||||
* groupname 打卡规则名
|
||||
*/
|
||||
@SerializedName("groupname")
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* schedule 个人排班信息
|
||||
*/
|
||||
@SerializedName("schedule")
|
||||
private UserSchedule schedule;
|
||||
|
||||
@Data
|
||||
public class UserSchedule implements Serializable {
|
||||
private static final long serialVersionUID = 9138985222324576857L;
|
||||
/**
|
||||
* scheduleList 个人排班表信息
|
||||
*/
|
||||
@SerializedName("scheduleList")
|
||||
private List<Schedule> scheduleList;
|
||||
|
||||
@Data
|
||||
public class Schedule implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 8344153237512495728L;
|
||||
|
||||
/**
|
||||
* day 排班日期,为表示当月第几天的数字
|
||||
*/
|
||||
@SerializedName("day")
|
||||
private Integer day;
|
||||
|
||||
/**
|
||||
* schedule_info 排班日期,为表示当月第几天的数字
|
||||
*/
|
||||
@SerializedName("schedule_info")
|
||||
private ScheduleInfo scheduleInfo;
|
||||
|
||||
@Data
|
||||
public class ScheduleInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1317096341116256963L;
|
||||
/**
|
||||
* schedule_id 当日安排班次id,班次id也可在打卡规则中查询获得
|
||||
*/
|
||||
@SerializedName("schedule_id")
|
||||
private Integer scheduleId;
|
||||
|
||||
/**
|
||||
* schedule_name 排班日期,为表示当月第几天的数字
|
||||
*/
|
||||
@SerializedName("schedule_name")
|
||||
private String scheduleName;
|
||||
|
||||
/**
|
||||
* time_section 排班日期,为表示当月第几天的数字
|
||||
*/
|
||||
@SerializedName("time_section")
|
||||
private List<TimeSection> timeSection;
|
||||
|
||||
|
||||
@Data
|
||||
public class TimeSection implements Serializable {
|
||||
private static final long serialVersionUID = -3447467962751285748L;
|
||||
/**
|
||||
* id 时段id,为班次中某一堆上下班时间组合的id
|
||||
*/
|
||||
@SerializedName("id")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* work_sec 上班时间。距当天00:00的秒数
|
||||
*/
|
||||
@SerializedName("work_sec")
|
||||
private Integer workSec;
|
||||
|
||||
/**
|
||||
* off_work_sec 下班时间。距当天00:00的秒数
|
||||
*/
|
||||
@SerializedName("off_work_sec")
|
||||
private Integer offWorkSec;
|
||||
|
||||
/**
|
||||
* remind_work_sec 上班提醒时间。距当天00:00的秒数
|
||||
*/
|
||||
@SerializedName("remind_work_sec")
|
||||
private Integer remindWorkSec;
|
||||
|
||||
/**
|
||||
* remind_off_work_sec 下班提醒时间。距当天00:00的秒数
|
||||
*/
|
||||
@SerializedName("remind_off_work_sec")
|
||||
private Integer remindOffWorkSec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,9 @@ public interface WxCpApiPathConsts {
|
||||
interface Oa {
|
||||
String GET_CHECKIN_DATA = "/cgi-bin/checkin/getcheckindata";
|
||||
String GET_CHECKIN_OPTION = "/cgi-bin/checkin/getcheckinoption";
|
||||
String GET_CHECKIN_DAY_DATA = "/cgi-bin/checkin/getcheckin_daydata";
|
||||
String GET_CHECKIN_MONTH_DATA = "/cgi-bin/checkin/getcheckin_monthdata";
|
||||
String GET_CHECKIN_SCHEDULE_DATA = "/cgi-bin/checkin/getcheckinschedulist";
|
||||
String GET_APPROVAL_INFO = "/cgi-bin/oa/getapprovalinfo";
|
||||
String GET_APPROVAL_DETAIL = "/cgi-bin/oa/getapprovaldetail";
|
||||
String GET_DIAL_RECORD = "/cgi-bin/dial/get_dial_record";
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package me.chanjar.weixin.cp.api.impl;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import me.chanjar.weixin.cp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.oa.*;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
@@ -47,6 +51,48 @@ public class WxCpOaServiceImplTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCheckinDayData() throws ParseException, WxErrorException {
|
||||
Date startTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2021-07-01");
|
||||
Date endTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2021-07-31");
|
||||
|
||||
List<WxCpCheckinDayData> results = wxService.getOaService()
|
||||
.getCheckinDayData(startTime, endTime, Lists.newArrayList("12003648"));
|
||||
|
||||
assertThat(results).isNotNull();
|
||||
|
||||
|
||||
System.out.println("results ");
|
||||
System.out.println(gson.toJson(results));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCheckinMonthData() throws ParseException, WxErrorException {
|
||||
Date startTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2021-07-01");
|
||||
Date endTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2021-07-31");
|
||||
|
||||
List<WxCpCheckinMonthData> results = wxService.getOaService()
|
||||
.getCheckinMonthData(startTime, endTime, Lists.newArrayList("12003648"));
|
||||
|
||||
assertThat(results).isNotNull();
|
||||
System.out.println("results ");
|
||||
System.out.println(gson.toJson(results));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCheckinScheduleData() throws ParseException, WxErrorException {
|
||||
Date startTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2021-07-01");
|
||||
Date endTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2021-07-31");
|
||||
|
||||
WxCpCheckinSchedule results = wxService.getOaService()
|
||||
.getCheckinScheduleList(startTime, endTime, Lists.newArrayList("12003648"));
|
||||
|
||||
assertThat(results).isNotNull();
|
||||
System.out.println("results ");
|
||||
System.out.println(gson.toJson(results));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCheckinOption() throws WxErrorException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user