1
0
mirror of synced 2025-12-16 20:28:11 +08:00

🆕 #2219 【企业微信】 新增为打卡人员排班接口

This commit is contained in:
longliveh
2021-07-27 20:53:19 +08:00
committed by GitHub
parent 5f23a6f101
commit 8511f8f826
5 changed files with 87 additions and 0 deletions

View File

@@ -180,4 +180,11 @@ public interface WxCpOaService {
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;
}

View File

@@ -336,4 +336,10 @@ public class WxCpOaServiceImpl implements WxCpOaService {
}.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));
}
}

View File

@@ -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;
}
}

View File

@@ -97,6 +97,7 @@ public interface WxCpApiPathConsts {
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";

View File

@@ -16,6 +16,7 @@ import org.testng.annotations.Test;
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 class WxCpOaServiceImplTest {
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 {