Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {

Expand Down