mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-02 11:48:54 +08:00
🆕 #2905【企业微信】增加OA模块创建审批模板、更新审批模板的接口
This commit is contained in:
parent
901fceba27
commit
baa8a6da37
@ -213,6 +213,39 @@ public interface WxCpOaService {
|
||||
*/
|
||||
WxCpTemplateResult getTemplateDetail(@NonNull String templateId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 创建审批模板
|
||||
* <br>
|
||||
* 可以调用此接口创建审批模板。创建新模板后,管理后台及审批应用内将生成对应模板,并生效默认流程和规则配置。
|
||||
* <pre>
|
||||
* 文档地址: <a href="https://developer.work.weixin.qq.com/document/path/97437">https://developer.work.weixin.qq.com/document/path/97437</a>
|
||||
* 权限说明
|
||||
* • 仅『审批』系统应用、自建应用和代开发自建应用可调用。
|
||||
* </pre>
|
||||
*
|
||||
* @param wxCpTemplateCreate wxCpTemplateCreate
|
||||
* @return templateId
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
String createTemplate(WxCpTemplateCreate wxCpTemplateCreate) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 更新审批模板
|
||||
* <br>
|
||||
* 可调用本接口更新审批模板。更新模板后,管理后台及审批应用内将更新原模板的内容,已配置的审批流程和规则不变。
|
||||
* <pre>
|
||||
* 文档地址: <a href="https://developer.work.weixin.qq.com/document/path/97438">https://developer.work.weixin.qq.com/document/path/97438</a>
|
||||
* 权限说明
|
||||
* • 仅『审批』系统应用,自建应用和代开发自建应用可调用
|
||||
* • 所有应用都可以通过本接口更新自己的模板
|
||||
* • 『审批』系统应用可以修改管理员手动创建的模板
|
||||
* • 自建应用和代开发自建应用不可通过本接口更新其他应用创建的模板
|
||||
* </pre>
|
||||
*
|
||||
* @param wxCpTemplateUpdate wxCpTemplateUpdate
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
void updateTemplate(WxCpTemplateUpdate wxCpTemplateUpdate) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取打卡日报数据
|
||||
|
@ -259,6 +259,20 @@ public class WxCpOaServiceImpl implements WxCpOaService {
|
||||
return WxCpGsonBuilder.create().fromJson(responseContent, WxCpTemplateResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTemplate(WxCpTemplateCreate wxCpTemplateCreate) throws WxErrorException {
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(CREATE_TEMPLATE);
|
||||
String responseContent = this.mainService.post(url, WxCpGsonBuilder.create().toJson(wxCpTemplateCreate));
|
||||
JsonObject tmpJson = GsonParser.parse(responseContent);
|
||||
return tmpJson.get("template_id").getAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTemplate(WxCpTemplateUpdate wxCpTemplateUpdate) throws WxErrorException {
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_TEMPLATE);
|
||||
this.mainService.post(url, WxCpGsonBuilder.create().toJson(wxCpTemplateUpdate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxCpCheckinDayData> getCheckinDayData(@NonNull Date startTime, @NonNull Date endTime,
|
||||
List<String> userIdList)
|
||||
|
@ -0,0 +1,34 @@
|
||||
package me.chanjar.weixin.cp.bean.oa;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import me.chanjar.weixin.cp.bean.oa.templatedata.TemplateContent;
|
||||
import me.chanjar.weixin.cp.bean.oa.templatedata.TemplateTitle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 创建审批模板
|
||||
*
|
||||
* @author yiyingcanfeng
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxCpTemplateCreate implements Serializable {
|
||||
private static final long serialVersionUID = 4918111784546859769L;
|
||||
|
||||
@SerializedName("template_name")
|
||||
private List<TemplateTitle> templateName;
|
||||
|
||||
@SerializedName("template_content")
|
||||
private TemplateContent templateContent;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package me.chanjar.weixin.cp.bean.oa;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import me.chanjar.weixin.cp.bean.oa.templatedata.TemplateContent;
|
||||
import me.chanjar.weixin.cp.bean.oa.templatedata.TemplateTitle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 更新审批模板
|
||||
*
|
||||
* @author yiyingcanfeng
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxCpTemplateUpdate implements Serializable {
|
||||
private static final long serialVersionUID = 8332120725354015143L;
|
||||
|
||||
@SerializedName("template_id")
|
||||
private String templateId;
|
||||
|
||||
@SerializedName("template_name")
|
||||
private List<TemplateTitle> templateName;
|
||||
|
||||
@SerializedName("template_content")
|
||||
private TemplateContent templateContent;
|
||||
|
||||
}
|
@ -289,6 +289,14 @@ public interface WxCpApiPathConsts {
|
||||
* The constant GET_TEMPLATE_DETAIL.
|
||||
*/
|
||||
String GET_TEMPLATE_DETAIL = "/cgi-bin/oa/gettemplatedetail";
|
||||
/**
|
||||
* The constant CREATE_TEMPLATE.
|
||||
*/
|
||||
String CREATE_TEMPLATE = "/cgi-bin/oa/approval/create_template";
|
||||
/**
|
||||
* The constant CREATE_TEMPLATE.
|
||||
*/
|
||||
String UPDATE_TEMPLATE = "/cgi-bin/oa/approval/update_template";
|
||||
/**
|
||||
* The constant APPLY_EVENT.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user