Skip to content

Commit

Permalink
🆕 #2219 【企业微信】 新增为打卡人员排班接口
Browse files Browse the repository at this point in the history
longliveh authored Jul 27, 2021
1 parent 5f23a6f commit 8511f8f
Showing 5 changed files with 87 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -180,4 +180,11 @@ List<WxCpDialRecord> getDialRecord(Date startTime, Date endTime, Integer offset,
List<WxCpCheckinSchedule> getCheckinScheduleList(Date startTime, Date endTime, List<String> userIdList) throws WxErrorException;


/**
* 为打卡人员排班
*
* @param wxCpSetCheckinSchedule the wx cp set checkin schedule
* @throws WxErrorException the wx error exception
*/
void setCheckinScheduleList(WxCpSetCheckinSchedule wxCpSetCheckinSchedule) throws WxErrorException;
}
Original file line number Diff line number Diff line change
@@ -336,4 +336,10 @@ public List<WxCpCheckinSchedule> getCheckinScheduleList(Date startTime, Date end
}.getType()
);
}

@Override
public void setCheckinScheduleList(WxCpSetCheckinSchedule wxCpSetCheckinSchedule) throws WxErrorException {
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(SET_CHECKIN_SCHEDULE_DATA);
this.mainService.post(url, WxCpGsonBuilder.create().toJson(wxCpSetCheckinSchedule));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package me.chanjar.weixin.cp.bean.oa;

import com.google.gson.annotations.SerializedName;
import lombok.Data;

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

/**
* The type Wx cp set checkin schedule.
*/
@Data
public class WxCpSetCheckinSchedule implements Serializable {
private static final long serialVersionUID = -7106074373528367075L;

/**
* 打卡规则的规则id,可通过“获取打卡规则”、“获取打卡数据”、“获取打卡人员排班信息”等相关接口获取
*/
@SerializedName("groupid")
private Integer groupId;

/**
* 排班表信息
*/
@SerializedName("items")
private List<Item> items;

/**
* 排班表月份,格式为年月,如202011
*/
@SerializedName("yearmonth")
private Integer yearmonth;


@Data
public static class Item implements Serializable{

private static final long serialVersionUID = -918057757709951513L;

/**
* 打卡人员userid
*/
@SerializedName("userid")
private String userid;

/**
* 要设置的天日期,取值在1-31之间。联合yearmonth组成唯一日期 比如20201205
*/
@SerializedName("day")
private Integer day;

/**
* 对应groupid规则下的班次id,通过预先拉取规则信息获取,0代表休息
*/
@SerializedName("schedule_id")
private Integer scheduleId;
}

}
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ interface Oa {
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 SET_CHECKIN_SCHEDULE_DATA = "/cgi-bin/checkin/setcheckinschedulist";
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";
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
import org.testng.collections.Lists;

import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

@@ -93,6 +94,19 @@ public void testGetCheckinScheduleData() throws ParseException, WxErrorException
System.out.println(gson.toJson(results));
}

@Test
public void testSetCheckinScheduleList() throws WxErrorException {
WxCpSetCheckinSchedule wxCpSetCheckinSchedule = new WxCpSetCheckinSchedule();
wxCpSetCheckinSchedule.setGroupId(3);
wxCpSetCheckinSchedule.setYearmonth(202108);
WxCpSetCheckinSchedule.Item item = new WxCpSetCheckinSchedule.Item();
item.setScheduleId(0);
item.setDay(20);
item.setUserid("12003648");
wxCpSetCheckinSchedule.setItems(Arrays.asList(item));
wxService.getOaService().setCheckinScheduleList(wxCpSetCheckinSchedule);
}

@Test
public void testGetCheckinOption() throws WxErrorException {

0 comments on commit 8511f8f

Please sign in to comment.