78 changed files with 4071 additions and 0 deletions
@ -0,0 +1,80 @@ |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Response; |
|||
using LINGYUN.Abp.WeChat.Work.Features; |
|||
using LINGYUN.Abp.WeChat.Work.Token; |
|||
using System.Net.Http; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Features; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals; |
|||
|
|||
[RequiresFeature(WeChatWorkFeatureNames.Enable)] |
|||
public class ApprovalTemplateProvider : IApprovalTemplateProvider, ISingletonDependency |
|||
{ |
|||
protected IHttpClientFactory HttpClientFactory { get; } |
|||
protected IWeChatWorkTokenProvider WeChatWorkTokenProvider { get; } |
|||
|
|||
public ApprovalTemplateProvider( |
|||
IHttpClientFactory httpClientFactory, |
|||
IWeChatWorkTokenProvider weChatWorkTokenProvider) |
|||
{ |
|||
HttpClientFactory = httpClientFactory; |
|||
WeChatWorkTokenProvider = weChatWorkTokenProvider; |
|||
} |
|||
|
|||
public async virtual Task<WeChatWorkApplyEventResponse> ApplyEventAsync(WeChatWorkApplyEventRequest request, CancellationToken cancellationToken = default) |
|||
{ |
|||
var token = await WeChatWorkTokenProvider.GetTokenAsync(cancellationToken); |
|||
var client = HttpClientFactory.CreateClient(AbpWeChatWorkGlobalConsts.ApiClient); |
|||
|
|||
using var response = await client.ApplyEventAsync(token.AccessToken, request, cancellationToken); |
|||
return await response.DeserializeObjectAsync<WeChatWorkApplyEventResponse>(); |
|||
} |
|||
|
|||
public async virtual Task<WeChatWorkCreateTemplateResponse> CreateTemplateAsync(WeChatWorkCreateTemplateRequest request, CancellationToken cancellationToken = default) |
|||
{ |
|||
var token = await WeChatWorkTokenProvider.GetTokenAsync(cancellationToken); |
|||
var client = HttpClientFactory.CreateClient(AbpWeChatWorkGlobalConsts.ApiClient); |
|||
|
|||
using var response = await client.CreateTemplateAsync(token.AccessToken, request, cancellationToken); |
|||
return await response.DeserializeObjectAsync<WeChatWorkCreateTemplateResponse>(); |
|||
} |
|||
|
|||
public async virtual Task<WeChatWorkGetApprovalDetailResponse> GetApprovalDetailAsync(WeChatWorkGetApprovalDetailRequest request, CancellationToken cancellationToken = default) |
|||
{ |
|||
var token = await WeChatWorkTokenProvider.GetTokenAsync(cancellationToken); |
|||
var client = HttpClientFactory.CreateClient(AbpWeChatWorkGlobalConsts.ApiClient); |
|||
|
|||
using var response = await client.GetApprovalDetailAsync(token.AccessToken, request, cancellationToken); |
|||
return await response.DeserializeObjectAsync<WeChatWorkGetApprovalDetailResponse>(); |
|||
} |
|||
|
|||
public async virtual Task<WeChatWorkGetApprovalInfoResponse> GetApprovalInfoAsync(WeChatWorkGetApprovalInfoRequest request, CancellationToken cancellationToken = default) |
|||
{ |
|||
var token = await WeChatWorkTokenProvider.GetTokenAsync(cancellationToken); |
|||
var client = HttpClientFactory.CreateClient(AbpWeChatWorkGlobalConsts.ApiClient); |
|||
|
|||
using var response = await client.GetApprovalInfoAsync(token.AccessToken, request, cancellationToken); |
|||
return await response.DeserializeObjectAsync<WeChatWorkGetApprovalInfoResponse>(); |
|||
} |
|||
|
|||
public async virtual Task<WeChatWorkTemplateResponse> GetTemplateAsync(WeChatWorkGetTemplateRequest request, CancellationToken cancellationToken = default) |
|||
{ |
|||
var token = await WeChatWorkTokenProvider.GetTokenAsync(cancellationToken); |
|||
var client = HttpClientFactory.CreateClient(AbpWeChatWorkGlobalConsts.ApiClient); |
|||
|
|||
using var response = await client.GetTemplateAsync(token.AccessToken, request, cancellationToken); |
|||
return await response.DeserializeObjectAsync<WeChatWorkTemplateResponse>(); |
|||
} |
|||
|
|||
public async virtual Task<WeChatWorkResponse> UpdateTemplateAsync(WeChatWorkCreateTemplateRequest request, CancellationToken cancellationToken = default) |
|||
{ |
|||
var token = await WeChatWorkTokenProvider.GetTokenAsync(cancellationToken); |
|||
var client = HttpClientFactory.CreateClient(AbpWeChatWorkGlobalConsts.ApiClient); |
|||
|
|||
using var response = await client.UpdateTemplateAsync(token.AccessToken, request, cancellationToken); |
|||
return await response.DeserializeObjectAsync<WeChatWorkResponse>(); |
|||
} |
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Response; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals; |
|||
// TODO: 自建应用审批未实现: https://developer.work.weixin.qq.com/document/path/90269
|
|||
/// <summary>
|
|||
/// 审批模板接口
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91854
|
|||
/// </remarks>
|
|||
public interface IApprovalTemplateProvider |
|||
{ |
|||
/// <summary>
|
|||
/// 创建审批模板
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见:https://developer.work.weixin.qq.com/document/path/97437
|
|||
/// </remarks>
|
|||
/// <param name="request">创建审批模板请求参数</param>
|
|||
/// <param name="cancellationToken"></param>
|
|||
/// <returns>创建审批模板响应参数</returns>
|
|||
Task<WeChatWorkCreateTemplateResponse> CreateTemplateAsync( |
|||
WeChatWorkCreateTemplateRequest request, |
|||
CancellationToken cancellationToken = default); |
|||
/// <summary>
|
|||
/// 更新审批模板
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见:https://developer.work.weixin.qq.com/document/path/97438
|
|||
/// </remarks>
|
|||
/// <param name="request">更新审批模板请求参数</param>
|
|||
/// <param name="cancellationToken"></param>
|
|||
/// <returns>更新审批模板响应参数</returns>
|
|||
Task<WeChatWorkResponse> UpdateTemplateAsync( |
|||
WeChatWorkCreateTemplateRequest request, |
|||
CancellationToken cancellationToken = default); |
|||
/// <summary>
|
|||
/// 获取审批模板详情
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见:https://developer.work.weixin.qq.com/document/path/91982
|
|||
/// </remarks>
|
|||
/// <param name="request">获取审批模板请求参数</param>
|
|||
/// <param name="cancellationToken"></param>
|
|||
/// <returns>审批模板响应参数</returns>
|
|||
Task<WeChatWorkTemplateResponse> GetTemplateAsync( |
|||
WeChatWorkGetTemplateRequest request, |
|||
CancellationToken cancellationToken = default); |
|||
/// <summary>
|
|||
/// 批量获取审批单号
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见:https://developer.work.weixin.qq.com/document/path/91816
|
|||
/// </remarks>
|
|||
/// <param name="request">批量获取审批单号请求参数</param>
|
|||
/// <param name="cancellationToken"></param>
|
|||
/// <returns>批量获取审批单号响应参数</returns>
|
|||
Task<WeChatWorkGetApprovalInfoResponse> GetApprovalInfoAsync( |
|||
WeChatWorkGetApprovalInfoRequest request, |
|||
CancellationToken cancellationToken = default); |
|||
/// <summary>
|
|||
/// 获取审批申请详情
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见:https://developer.work.weixin.qq.com/document/path/91983
|
|||
/// </remarks>
|
|||
/// <param name="request">获取审批申请详情请求参数</param>
|
|||
/// <param name="cancellationToken"></param>
|
|||
/// <returns>获取审批申请详情响应参数</returns>
|
|||
Task<WeChatWorkGetApprovalDetailResponse> GetApprovalDetailAsync( |
|||
WeChatWorkGetApprovalDetailRequest request, |
|||
CancellationToken cancellationToken = default); |
|||
/// <summary>
|
|||
/// 提交审批申请
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见:https://developer.work.weixin.qq.com/document/path/91853
|
|||
/// </remarks>
|
|||
/// <param name="request">提交审批申请请求参数</param>
|
|||
/// <param name="cancellationToken"></param>
|
|||
/// <returns>提交审批申请响应参数</returns>
|
|||
Task<WeChatWorkApplyEventResponse> ApplyEventAsync( |
|||
WeChatWorkApplyEventRequest request, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批申请数据
|
|||
/// </summary>
|
|||
public class ApprovalApplyData |
|||
{ |
|||
/// <summary>
|
|||
/// 审批申请详情,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("contents")] |
|||
[JsonPropertyName("contents")] |
|||
public List<ControlData> Contents { get; set; } |
|||
public ApprovalApplyData() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApprovalApplyData(List<ControlData> contents) |
|||
{ |
|||
Contents = contents; |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 申请流程
|
|||
/// </summary>
|
|||
public class ApprovalApplyProcess |
|||
{ |
|||
/// <summary>
|
|||
/// 流程节点列表
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("node_list")] |
|||
[JsonPropertyName("node_list")] |
|||
public List<ApprovalApplyProcessNode> Nodes { get; set; } |
|||
public ApprovalApplyProcess() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApprovalApplyProcess(List<ApprovalApplyProcessNode> nodes) |
|||
{ |
|||
Nodes = nodes; |
|||
} |
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 申请流程节点
|
|||
/// </summary>
|
|||
public class ApprovalApplyProcessNode |
|||
{ |
|||
/// <summary>
|
|||
/// 节点类型 1:审批人 2:抄送人 3:办理人
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public ApprovalProcessNodeType Type { get; set; } |
|||
/// <summary>
|
|||
/// 多人审批方式 1-会签;2-或签 3-依次审批
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// type为1、3时必填
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("apv_rel")] |
|||
[JsonPropertyName("apv_rel")] |
|||
public byte? ApvRel { get; set; } |
|||
/// <summary>
|
|||
/// 用户id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("userid")] |
|||
[JsonPropertyName("userid")] |
|||
public string UserId { get; set; } |
|||
public ApprovalApplyProcessNode() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private ApprovalApplyProcessNode(ApprovalProcessNodeType type, string userId, byte? apvRel = null) |
|||
{ |
|||
Type = type; |
|||
UserId = userId; |
|||
ApvRel = apvRel; |
|||
} |
|||
/// <summary>
|
|||
/// 审批人节点
|
|||
/// </summary>
|
|||
/// <param name="userId">审批人Id</param>
|
|||
/// <param name="apvRel">多人审批方式 1-会签;2-或签 3-依次审批</param>
|
|||
/// <returns></returns>
|
|||
public static ApprovalApplyProcessNode Approver(string userId, byte apvRel) |
|||
{ |
|||
return new ApprovalApplyProcessNode(ApprovalProcessNodeType.Approver, userId, apvRel); |
|||
} |
|||
/// <summary>
|
|||
/// 办理人节点
|
|||
/// </summary>
|
|||
/// <param name="userId">办理人Id</param>
|
|||
/// <param name="apvRel">多人审批方式 1-会签;2-或签 3-依次审批</param>
|
|||
/// <returns></returns>
|
|||
public static ApprovalApplyProcessNode Handler(string userId, byte apvRel) |
|||
{ |
|||
return new ApprovalApplyProcessNode(ApprovalProcessNodeType.Handler, userId, apvRel); |
|||
} |
|||
/// <summary>
|
|||
/// 抄送人节点
|
|||
/// </summary>
|
|||
/// <param name="userId">抄送人Id</param>
|
|||
/// <returns></returns>
|
|||
public static ApprovalApplyProcessNode To(string userId) |
|||
{ |
|||
return new ApprovalApplyProcessNode(ApprovalProcessNodeType.CC, userId); |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 申请人信息
|
|||
/// </summary>
|
|||
public class ApprovalApplyer : ApprovalUser |
|||
{ |
|||
/// <summary>
|
|||
/// 申请人所在部门id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("partyid")] |
|||
[JsonPropertyName("partyid")] |
|||
public int PartyId { get; set; } |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System.ComponentModel; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 节点审批方式
|
|||
/// </summary>
|
|||
public enum ApprovalApproverAttr : byte |
|||
{ |
|||
/// <summary>
|
|||
/// 或签
|
|||
/// </summary>
|
|||
[Description("或签")] |
|||
OrSign = 1, |
|||
/// <summary>
|
|||
/// 会签
|
|||
/// </summary>
|
|||
[Description("会签")] |
|||
CoSign = 2, |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批申请备注信息
|
|||
/// </summary>
|
|||
public class ApprovalComment |
|||
{ |
|||
/// <summary>
|
|||
/// 备注人信息
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("commentUserInfo")] |
|||
[JsonPropertyName("commentUserInfo")] |
|||
public ApprovalUser CommentUserInfo { get; set; } |
|||
/// <summary>
|
|||
/// 审批申请提交时间,Unix时间戳
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("commenttime")] |
|||
[JsonPropertyName("commenttime")] |
|||
public long CommentTime { get; set; } |
|||
/// <summary>
|
|||
/// 备注文本内容
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("commentcontent")] |
|||
[JsonPropertyName("commentcontent")] |
|||
public string CommentContent { get; set; } |
|||
/// <summary>
|
|||
/// 备注id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("commentid")] |
|||
[JsonPropertyName("commentid")] |
|||
public string CommentId { get; set; } |
|||
/// <summary>
|
|||
/// 备注附件id,可能有多个,微盘文件无法获取
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("media_id")] |
|||
[JsonPropertyName("media_id")] |
|||
public List<string> MediaId { get; set; } |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批申请单控件数据
|
|||
/// </summary>
|
|||
public class ApprovalControlData |
|||
{ |
|||
/// <summary>
|
|||
/// 控件类型
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Text-文本<br />
|
|||
/// Textarea-多行文本<br />
|
|||
/// Number-数字<br />
|
|||
/// Money-金额<br />
|
|||
/// Date-日期/日期+时间<br />
|
|||
/// Selector-单选/多选<br />
|
|||
/// Contact-成员/部门<br />
|
|||
/// Tips-说明文字<br />
|
|||
/// File-附件<br />
|
|||
/// Table-明细<br />
|
|||
/// Location-位置<br />
|
|||
/// RelatedApproval-关联审批单<br />
|
|||
/// Formula-公式<br />
|
|||
/// DateRange-时长
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("control")] |
|||
[JsonPropertyName("control")] |
|||
public string Control { get; set; } |
|||
/// <summary>
|
|||
/// 控件id:控件的唯一id,可通过“获取审批模板详情”接口获取
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("id")] |
|||
[JsonPropertyName("id")] |
|||
public string Id { get; set; } |
|||
/// <summary>
|
|||
/// 控件值 ,需在此为申请人在各个控件中填写内容不同控件有不同的赋值参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 模板配置的控件属性为必填时,对应value值需要有值。
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public ApprovalControlValue Value { get; set; } |
|||
/// <summary>
|
|||
/// 控件隐藏标识,为1表示控件被隐藏
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("display")] |
|||
[JsonPropertyName("display")] |
|||
public int? Display { get; set; } |
|||
/// <summary>
|
|||
/// 控件必输标识,为1表示控件必输
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("require")] |
|||
[JsonPropertyName("require")] |
|||
public int? Require { get; set; } |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批申请单数据
|
|||
/// </summary>
|
|||
public class ApprovalControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 文本内容,即申请人在此控件填写的文本内容
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
/// <summary>
|
|||
/// 数字内容,即申请人在此控件填写的数字内容
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("new_number")] |
|||
[JsonPropertyName("new_number")] |
|||
public decimal? NewNumber { get; set; } |
|||
/// <summary>
|
|||
/// 金额内容,即申请人在此控件填写的金额内容
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("new_money")] |
|||
[JsonPropertyName("new_money")] |
|||
public decimal? NewMoney { get; set; } |
|||
/// <summary>
|
|||
/// 所选成员内容,即申请人在此控件选择的成员,多选模式下可以有多个
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("members")] |
|||
[JsonPropertyName("members")] |
|||
public List<MemberValue> Members { get; set; } |
|||
/// <summary>
|
|||
/// 所选部门内容,即申请人在此控件选择的部门,多选模式下可能有多个
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("departments")] |
|||
[JsonPropertyName("departments")] |
|||
public List<DepartmentValue> Departments { get; set; } |
|||
/// <summary>
|
|||
/// 附件列表
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("files")] |
|||
[JsonPropertyName("files")] |
|||
public List<FileValue> Files { get; set; } |
|||
/// <summary>
|
|||
/// 明细内容,一个明细控件可能包含多个子明细
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("children")] |
|||
[JsonPropertyName("children")] |
|||
public List<ApprovalDataChildrenValue> Children { get; set; } |
|||
/// <summary>
|
|||
/// 关联审批单
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("related_approval")] |
|||
[JsonPropertyName("related_approval")] |
|||
public List<RelatedApprovalValue> RelatedApproval { get; set; } |
|||
} |
|||
|
|||
public class ApprovalDataChildrenValue |
|||
{ |
|||
/// <summary>
|
|||
/// 明细内容,一个明细控件可能包含多个子明细
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("list")] |
|||
[JsonPropertyName("list")] |
|||
public List<ApprovalControlData> List { get; set; } |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
|
|||
/// <summary>
|
|||
/// 审批申请单数据
|
|||
/// </summary>
|
|||
public class ApprovalData |
|||
{ |
|||
/// <summary>
|
|||
/// 审批申请详情,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("contents")] |
|||
[JsonPropertyName("contents")] |
|||
public List<ApprovalControlData> Contents { get; set; } |
|||
public ApprovalData() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApprovalData(List<ApprovalControlData> contents) |
|||
{ |
|||
Contents = contents; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,96 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批申请详情
|
|||
/// </summary>
|
|||
public class ApprovalDetailInfo |
|||
{ |
|||
/// <summary>
|
|||
/// 审批编号
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_no")] |
|||
[JsonPropertyName("sp_no")] |
|||
public string SpNo { get; set; } |
|||
/// <summary>
|
|||
/// 审批申请类型名称(审批模板名称)
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_name")] |
|||
[JsonPropertyName("sp_name")] |
|||
public string SpName { get; set; } |
|||
/// <summary>
|
|||
/// 申请单状态
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_status")] |
|||
[JsonPropertyName("sp_status")] |
|||
public ApprovalSpStatus SpStatus { get; set; } |
|||
/// <summary>
|
|||
/// 审批模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_id")] |
|||
[JsonPropertyName("template_id")] |
|||
public string TemplateId { get; set; } |
|||
/// <summary>
|
|||
/// 审批申请提交时间,Unix时间戳
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("apply_time")] |
|||
[JsonPropertyName("apply_time")] |
|||
public long ApplyTime { get; set; } |
|||
/// <summary>
|
|||
/// 申请人信息
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("applyer")] |
|||
[JsonPropertyName("applyer")] |
|||
public ApprovalApplyer Applyer { get; set; } |
|||
/// <summary>
|
|||
/// 批量申请人信息(和applyer字段互斥)
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("batch_applyer")] |
|||
[JsonPropertyName("batch_applyer")] |
|||
public List<ApprovalUser> BatchApplyer { get; set; } |
|||
/// <summary>
|
|||
/// 审批流程信息,可能有多个审批节点
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_record")] |
|||
[JsonPropertyName("sp_record")] |
|||
public List<ApprovalSpRecord> SpRecord { get; set; } |
|||
/// <summary>
|
|||
/// 抄送信息,可能有多个抄送节点
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("notifyer")] |
|||
[JsonPropertyName("notifyer")] |
|||
public List<ApprovalUser> Notifyer { get; set; } |
|||
/// <summary>
|
|||
/// 审批申请数据
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("apply_data")] |
|||
[JsonPropertyName("apply_data")] |
|||
public ApprovalData ApplyData { get; set; } |
|||
/// <summary>
|
|||
/// 审批申请备注信息,可能有多个备注节点
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("comments")] |
|||
[JsonPropertyName("comments")] |
|||
public List<ApprovalComment> Comments { get; set; } |
|||
/// <summary>
|
|||
/// 审批流程列表
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("process_list")] |
|||
[JsonPropertyName("process_list")] |
|||
public ApprovalProcess Process { get; set; } |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 筛选条件
|
|||
/// </summary>
|
|||
public class ApprovalInfoFilter |
|||
{ |
|||
/// <summary>
|
|||
/// 筛选类型
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 包括如下值:<br />
|
|||
/// template_id - 模板类型/模板id;<br />
|
|||
/// creator - 申请人;<br />
|
|||
/// department - 审批单提单者所在部门;<br />
|
|||
/// sp_status - 审批状态;<br />
|
|||
/// record_type - 审批单类型属性;<br />
|
|||
/// <br />
|
|||
/// 注意:<br />
|
|||
/// 1、仅“部门”支持同时配置多个筛选条件。<br />
|
|||
/// 2、不同类型的筛选条件之间为“与”的关系,同类型筛选条件之间为“或”的关系<br />
|
|||
/// 3、record_type筛选类型仅支持2021/05/31以后新提交的审批单,历史单不支持表单类型属性过滤<br />
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("key")] |
|||
[JsonPropertyName("key")] |
|||
public string Key { get; set; } |
|||
/// <summary>
|
|||
/// 筛选值
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 对应值:<br />
|
|||
/// template_id-模板id;<br />
|
|||
/// creator-申请人userid;<br />
|
|||
/// department-所在部门id;<br />
|
|||
/// sp_status-审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付);<br />
|
|||
/// record_type-审批单类型属性(1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批)<br />
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public string Value { get; set; } |
|||
public ApprovalInfoFilter(string key, string value) |
|||
{ |
|||
Key = key; |
|||
Value = value; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 流程
|
|||
/// </summary>
|
|||
public class ApprovalProcess |
|||
{ |
|||
/// <summary>
|
|||
/// 流程节点
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("node_list")] |
|||
[JsonPropertyName("node_list")] |
|||
public List<ApprovalProcessNode> Nodes { get; set; } |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 流程节点
|
|||
/// </summary>
|
|||
public class ApprovalProcessNode |
|||
{ |
|||
/// <summary>
|
|||
/// 节点类型 1:审批人 2:抄送人 3:办理人
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public ApprovalProcessNodeType Type { get; set; } |
|||
/// <summary>
|
|||
/// 节点状态 1-审批中;2-同意;3-驳回;4-转审;11-退回给指定审批人;12-加签;13-同意并加签;14-办理;15-转交
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_status")] |
|||
[JsonPropertyName("sp_status")] |
|||
public ApprovalProcessNodeStatus Status { get; set; } |
|||
/// <summary>
|
|||
/// 多人审批方式 1-会签;2-或签 3-依次审批
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("apv_rel")] |
|||
[JsonPropertyName("apv_rel")] |
|||
public byte? ApvRel { get; set; } |
|||
/// <summary>
|
|||
/// 子节点列表
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("sub_node_list")] |
|||
[JsonPropertyName("sub_node_list")] |
|||
public List<ApprovalProcessSubNode> SubNodes { get; set; } |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
using System.ComponentModel; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 节点状态
|
|||
/// </summary>
|
|||
public enum ApprovalProcessNodeStatus : byte |
|||
{ |
|||
/// <summary>
|
|||
/// 审批中
|
|||
/// </summary>
|
|||
[Description("审批中")] |
|||
UnderApproval = 1, |
|||
/// <summary>
|
|||
/// 同意
|
|||
/// </summary>
|
|||
[Description("同意")] |
|||
Agree = 2, |
|||
/// <summary>
|
|||
/// 驳回
|
|||
/// </summary>
|
|||
[Description("驳回")] |
|||
Rejection = 3, |
|||
/// <summary>
|
|||
/// 转审
|
|||
/// </summary>
|
|||
[Description("转审")] |
|||
TransferForReview = 4, |
|||
/// <summary>
|
|||
/// 退回给指定审批人
|
|||
/// </summary>
|
|||
[Description("退回给指定审批人")] |
|||
ReturnToApprover = 11, |
|||
/// <summary>
|
|||
/// 加签
|
|||
/// </summary>
|
|||
[Description("加签")] |
|||
Additional = 12, |
|||
/// <summary>
|
|||
/// 同意并加签
|
|||
/// </summary>
|
|||
[Description("同意并加签")] |
|||
AgreeAndSign = 13, |
|||
/// <summary>
|
|||
/// 办理
|
|||
/// </summary>
|
|||
[Description("办理")] |
|||
Processing = 14, |
|||
/// <summary>
|
|||
/// 转交
|
|||
/// </summary>
|
|||
[Description("转交")] |
|||
Transfer = 15, |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System.ComponentModel; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 节点类型
|
|||
/// </summary>
|
|||
public enum ApprovalProcessNodeType : byte |
|||
{ |
|||
/// <summary>
|
|||
/// 审批人
|
|||
/// </summary>
|
|||
[Description("审批人")] |
|||
Approver = 1, |
|||
/// <summary>
|
|||
/// 抄送人
|
|||
/// </summary>
|
|||
[Description("抄送人")] |
|||
CC = 2, |
|||
/// <summary>
|
|||
/// 办理人
|
|||
/// </summary>
|
|||
[Description("办理人")] |
|||
Handler = 3, |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 子节点
|
|||
/// </summary>
|
|||
public class ApprovalProcessSubNode |
|||
{ |
|||
/// <summary>
|
|||
/// 处理人信息
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("userid")] |
|||
[JsonPropertyName("userid")] |
|||
public string UserId { get; set; } |
|||
/// <summary>
|
|||
/// 审批/办理意见
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("speech")] |
|||
[JsonPropertyName("speech")] |
|||
public string Speech { get; set; } |
|||
/// <summary>
|
|||
/// 子节点状态 1-审批中;2-同意;3-驳回;4-转审;11-退回给指定审批人;12-加签;13-同意并加签;14-办理;15-转交
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_yj")] |
|||
[JsonPropertyName("sp_yj")] |
|||
public ApprovalProcessNodeStatus Status { get; set; } |
|||
/// <summary>
|
|||
/// 操作时间
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sptime")] |
|||
[JsonPropertyName("sptime")] |
|||
public long SpTime { get; set; } |
|||
/// <summary>
|
|||
/// 附件,微盘文件无法获取
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("media_ids")] |
|||
[JsonPropertyName("media_ids")] |
|||
public List<string> MediaIds { get; set; } |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批流程信息
|
|||
/// </summary>
|
|||
public class ApprovalSpRecord |
|||
{ |
|||
/// <summary>
|
|||
/// 审批节点状态
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_status")] |
|||
[JsonPropertyName("sp_status")] |
|||
public ApprovalSpRecordStatus SpStatus { get; set; } |
|||
/// <summary>
|
|||
/// 节点审批方式
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("approverattr")] |
|||
[JsonPropertyName("approverattr")] |
|||
public ApprovalApproverAttr ApproverAttr { get; set; } |
|||
/// <summary>
|
|||
/// 审批节点详情,一个审批节点有多个审批人
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("details")] |
|||
[JsonPropertyName("details")] |
|||
public List<ApprovalSpRecordDetail> Details { get; set; } |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批节点详情
|
|||
/// </summary>
|
|||
public class ApprovalSpRecordDetail |
|||
{ |
|||
/// <summary>
|
|||
/// 分支审批人
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("approver")] |
|||
[JsonPropertyName("approver")] |
|||
public ApprovalUser Approver { get; set; } |
|||
/// <summary>
|
|||
/// 审批意见
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("speech")] |
|||
[JsonPropertyName("speech")] |
|||
public string Speech { get; set; } |
|||
/// <summary>
|
|||
/// 分支审批人审批状态
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_status")] |
|||
[JsonPropertyName("sp_status")] |
|||
public ApprovalSpRecordStatus SpStatus { get; set; } |
|||
/// <summary>
|
|||
/// 节点分支审批人审批操作时间戳,0表示未操作
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sptime")] |
|||
[JsonPropertyName("sptime")] |
|||
public long SpTime { get; set; } |
|||
/// <summary>
|
|||
/// 节点分支审批人审批意见附件,微盘文件无法获取
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("media_id")] |
|||
[JsonPropertyName("media_id")] |
|||
public List<string> MediaId { get; set; } |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
using System.ComponentModel; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批节点状态
|
|||
/// </summary>
|
|||
public enum ApprovalSpRecordStatus : byte |
|||
{ |
|||
/// <summary>
|
|||
/// 审批中
|
|||
/// </summary>
|
|||
[Description("审批中")] |
|||
UnderApproval = 1, |
|||
/// <summary>
|
|||
/// 已同意
|
|||
/// </summary>
|
|||
[Description("已同意")] |
|||
Passed = 2, |
|||
/// <summary>
|
|||
/// 已驳回
|
|||
/// </summary>
|
|||
[Description("已驳回")] |
|||
Rejected = 3, |
|||
/// <summary>
|
|||
/// 已转审
|
|||
/// </summary>
|
|||
[Description("已转审")] |
|||
Transferred = 4, |
|||
/// <summary>
|
|||
/// 已退回
|
|||
/// </summary>
|
|||
[Description("已退回")] |
|||
Returned = 11, |
|||
/// <summary>
|
|||
/// 已加签
|
|||
/// </summary>
|
|||
[Description("已加签")] |
|||
Signed = 12, |
|||
/// <summary>
|
|||
/// 已同意并加签
|
|||
/// </summary>
|
|||
[Description("已同意并加签")] |
|||
AgreedAndSigned = 13, |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
using System.ComponentModel; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 申请单状态
|
|||
/// </summary>
|
|||
public enum ApprovalSpStatus : byte |
|||
{ |
|||
/// <summary>
|
|||
/// 审批中
|
|||
/// </summary>
|
|||
[Description("审批中")] |
|||
UnderApproval = 1, |
|||
/// <summary>
|
|||
/// 已通过
|
|||
/// </summary>
|
|||
[Description("已通过")] |
|||
Passed = 2, |
|||
/// <summary>
|
|||
/// 已驳回
|
|||
/// </summary>
|
|||
[Description("已驳回")] |
|||
Rejected = 3, |
|||
/// <summary>
|
|||
/// 已撤销
|
|||
/// </summary>
|
|||
[Description("已撤销")] |
|||
Revoked = 4, |
|||
/// <summary>
|
|||
/// 通过后撤销
|
|||
/// </summary>
|
|||
[Description("通过后撤销")] |
|||
RevokeAfterApproval = 6, |
|||
/// <summary>
|
|||
/// 已删除
|
|||
/// </summary>
|
|||
[Description("已删除")] |
|||
Deleted = 7, |
|||
/// <summary>
|
|||
/// 已支付
|
|||
/// </summary>
|
|||
[Description("已支付")] |
|||
Paid = 10, |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 摘要信息
|
|||
/// </summary>
|
|||
public class ApprovalSummary |
|||
{ |
|||
/// <summary>
|
|||
/// 摘要行信息,用于定义某一行摘要显示的内容
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("summary_info")] |
|||
[JsonPropertyName("summary_info")] |
|||
public List<ApprovalSummaryInfo> SummaryInfo { get; set; } |
|||
public ApprovalSummary() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApprovalSummary(List<ApprovalSummaryInfo> summaryInfo) |
|||
{ |
|||
SummaryInfo = summaryInfo; |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 摘要信息
|
|||
/// </summary>
|
|||
public class ApprovalSummaryInfo |
|||
{ |
|||
/// <summary>
|
|||
/// 摘要行显示文字,用于记录列表和消息通知的显示,不要超过20个字符
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[StringLength(20)] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
/// <summary>
|
|||
/// 摘要行显示语言,中文:zh_CN(注意不是zh-CN),英文:en。
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[StringLength(30)] |
|||
[JsonProperty("lang")] |
|||
[JsonPropertyName("lang")] |
|||
public string Lang { get; set; } |
|||
public ApprovalSummaryInfo() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApprovalSummaryInfo(string text, string lang = "zh_CN") |
|||
{ |
|||
Text = text; |
|||
Lang = lang; |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批节点关联人员
|
|||
/// </summary>
|
|||
public class ApprovalUser |
|||
{ |
|||
/// <summary>
|
|||
/// 人员Id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("userid")] |
|||
[JsonPropertyName("userid")] |
|||
public string UserId { get; set; } |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 假勤组件-出差/外出/加班组件配置
|
|||
/// </summary>
|
|||
public class AttendanceControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 假勤组件-出差/外出/加班组件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("attendance")] |
|||
[JsonPropertyName("attendance")] |
|||
public AttendanceConfig Attendance { get; set; } |
|||
public AttendanceControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AttendanceControlConfig(AttendanceConfig attendance) |
|||
{ |
|||
Attendance = attendance; |
|||
} |
|||
} |
|||
|
|||
public class AttendanceConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 假勤组件类型:3-出差;4-外出;5-加班
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public byte Type { get; set; } |
|||
/// <summary>
|
|||
/// 假勤组件时间选择范围
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("date_range")] |
|||
[JsonPropertyName("date_range")] |
|||
public DateRangeConfig DateRange { get; set; } |
|||
public AttendanceConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AttendanceConfig(byte type, DateRangeConfig dateRange) |
|||
{ |
|||
Type = type; |
|||
DateRange = dateRange; |
|||
} |
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 假勤组件-出差/外出/加班组件值
|
|||
/// </summary>
|
|||
public class AttendanceControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 时长
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("attendance")] |
|||
[JsonPropertyName("attendance")] |
|||
public AttendanceValue Attendance { get; set; } |
|||
public AttendanceControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AttendanceControlValue(AttendanceValue attendance) |
|||
{ |
|||
Attendance = attendance; |
|||
} |
|||
} |
|||
|
|||
public class AttendanceValue |
|||
{ |
|||
/// <summary>
|
|||
/// 假勤组件时间选择范围
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("date_range")] |
|||
[JsonPropertyName("date_range")] |
|||
public DateRangeValue DateRange { get; set; } |
|||
/// <summary>
|
|||
/// 假勤组件类型:1-请假;3-出差;4-外出;5-加班
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public byte Type { get; set; } |
|||
/// <summary>
|
|||
/// 非必填。时长分片信息
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("slice_info")] |
|||
[JsonPropertyName("slice_info")] |
|||
public AttendanceSliceInfo SliceInfo { get; set; } |
|||
} |
|||
|
|||
public class AttendanceSliceInfo |
|||
{ |
|||
/// <summary>
|
|||
/// 假勤组件类型:1-请假;3-出差;4-外出;5-加班
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public byte Type { get; set; } |
|||
/// <summary>
|
|||
/// 某一天的分片
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("day_items")] |
|||
[JsonPropertyName("day_items")] |
|||
public List<AttendanceSliceDayItem> DayItems { get; set; } |
|||
public AttendanceSliceInfo() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AttendanceSliceInfo(byte type, List<AttendanceSliceDayItem> dayItems) |
|||
{ |
|||
Type = type; |
|||
DayItems = dayItems; |
|||
} |
|||
} |
|||
|
|||
public class AttendanceSliceDayItem |
|||
{ |
|||
/// <summary>
|
|||
/// 当天零点时间戳 (当天的东八区的零点时间戳)
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("daytime")] |
|||
[JsonPropertyName("daytime")] |
|||
public long Daytime { get; set; } |
|||
/// <summary>
|
|||
/// 某一天的时长,秒数,可以为0,(type为halfday时:加班:需为8640整倍数,其他:需为43200的整倍数,type为hour时需为360的整倍数)
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("duration")] |
|||
[JsonPropertyName("duration")] |
|||
public long Duration { get; set; } |
|||
public AttendanceSliceDayItem() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AttendanceSliceDayItem(long daytime, long duration) |
|||
{ |
|||
Daytime = daytime; |
|||
Duration = duration; |
|||
} |
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 成员控件配置
|
|||
/// </summary>
|
|||
public class ContactControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 成员、部门控件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("contact")] |
|||
[JsonPropertyName("contact")] |
|||
public ContactConfig Contact { get; set; } |
|||
public ContactControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ContactControlConfig(ContactConfig contact) |
|||
{ |
|||
Contact = contact; |
|||
} |
|||
} |
|||
|
|||
public class ContactConfig |
|||
{ |
|||
/// <summary>
|
|||
/// single-单选、multi-多选
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// user-成员、department-部门
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("mode")] |
|||
[JsonPropertyName("mode")] |
|||
public string Mode { get; set; } |
|||
public ContactConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private ContactConfig(string type, string mode) |
|||
{ |
|||
Type = type; |
|||
Mode = mode; |
|||
} |
|||
|
|||
public static ContactConfig SingleUser() |
|||
{ |
|||
return new ContactConfig("single", "user"); |
|||
} |
|||
|
|||
public static ContactConfig SingleDepartment() |
|||
{ |
|||
return new ContactConfig("single", "department"); |
|||
} |
|||
|
|||
public static ContactConfig MultipleUser() |
|||
{ |
|||
return new ContactConfig("multi", "user"); |
|||
} |
|||
|
|||
public static ContactConfig MultipleDepartment() |
|||
{ |
|||
return new ContactConfig("multi", "department"); |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 成员/部门控件值
|
|||
/// </summary>
|
|||
public abstract class ContactControlValue : ControlValue |
|||
{ |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 模板控件
|
|||
/// </summary>
|
|||
[Newtonsoft.Json.JsonConverter(typeof(ControlNewtonsoftJsonConverter))] |
|||
[System.Text.Json.Serialization.JsonConverter(typeof(ControlSystemTextJsonConverter))] |
|||
public class Control |
|||
{ |
|||
/// <summary>
|
|||
/// 控件属性
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("property")] |
|||
[JsonPropertyName("property")] |
|||
public ControlInfo Property { get; set; } |
|||
/// <summary>
|
|||
/// 控件配置
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("config")] |
|||
[JsonPropertyName("config")] |
|||
public ControlConfig Config { get; set; } |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 控件配置
|
|||
/// </summary>
|
|||
public abstract class ControlConfig |
|||
{ |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
using Newtonsoft.Json.Linq; |
|||
using System.Text.Json; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
internal static class ControlConfigFactory |
|||
{ |
|||
/// <summary>
|
|||
/// 根据控件类型创建配置(System.Text.Json)
|
|||
/// </summary>
|
|||
public static ControlConfig CreateConfig(string controlType, JsonElement configElement) |
|||
{ |
|||
return controlType switch |
|||
{ |
|||
"Attendance" => JsonSerializer.Deserialize<AttendanceControlConfig>(configElement.GetRawText()), |
|||
"Contact" => JsonSerializer.Deserialize<ContactControlConfig>(configElement.GetRawText()), |
|||
"Date" => JsonSerializer.Deserialize<DateControlConfig>(configElement.GetRawText()), |
|||
"DateRange" => JsonSerializer.Deserialize<DateRangeControlConfig>(configElement.GetRawText()), |
|||
"File" => JsonSerializer.Deserialize<FileControlConfig>(configElement.GetRawText()), |
|||
"Location" => JsonSerializer.Deserialize<LocationControlConfig>(configElement.GetRawText()), |
|||
"RelatedApproval" => JsonSerializer.Deserialize<RelatedApprovalControlConfig>(configElement.GetRawText()), |
|||
"Selector" => JsonSerializer.Deserialize<SelectorControlConfig>(configElement.GetRawText()), |
|||
"Table" => JsonSerializer.Deserialize<TableControlConfig>(configElement.GetRawText()), |
|||
"Tips" => JsonSerializer.Deserialize<TipsControlConfig>(configElement.GetRawText()), |
|||
// 添加其他控件类型...
|
|||
_ => null |
|||
}; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据控件类型创建配置(Newtonsoft.Json)
|
|||
/// </summary>
|
|||
public static ControlConfig CreateConfig(string controlType, JToken configToken) |
|||
{ |
|||
return controlType switch |
|||
{ |
|||
"Attendance" => configToken.ToObject<AttendanceControlConfig>(), |
|||
"Contact" => configToken.ToObject<ContactControlConfig>(), |
|||
"Date" => configToken.ToObject<DateControlConfig>(), |
|||
"DateRange" => configToken.ToObject<DateRangeControlConfig>(), |
|||
"File" => configToken.ToObject<FileControlConfig>(), |
|||
"Location" => configToken.ToObject<LocationControlConfig>(), |
|||
"RelatedApproval" => configToken.ToObject<RelatedApprovalControlConfig>(), |
|||
"Selector" => configToken.ToObject<SelectorControlConfig>(), |
|||
"Table" => configToken.ToObject<TableControlConfig>(), |
|||
"Tips" => configToken.ToObject<TipsControlConfig>(), |
|||
// 添加其他控件类型...
|
|||
_ => null |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,202 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 审批申请详情
|
|||
/// </summary>
|
|||
public class ControlData |
|||
{ |
|||
/// <summary>
|
|||
/// 控件类型
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Text-文本<br />
|
|||
/// Textarea-多行文本<br />
|
|||
/// Number-数字<br />
|
|||
/// Money-金额<br />
|
|||
/// Date-日期/日期+时间<br />
|
|||
/// Selector-单选/多选<br />
|
|||
/// Contact-成员/部门<br />
|
|||
/// Tips-说明文字<br />
|
|||
/// File-附件<br />
|
|||
/// Table-明细<br />
|
|||
/// Location-位置<br />
|
|||
/// RelatedApproval-关联审批单<br />
|
|||
/// Formula-公式<br />
|
|||
/// DateRange-时长
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("control")] |
|||
[JsonPropertyName("control")] |
|||
public string Control { get; set; } |
|||
/// <summary>
|
|||
/// 控件id:控件的唯一id,可通过“获取审批模板详情”接口获取
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("id")] |
|||
[JsonPropertyName("id")] |
|||
public string Id { get; set; } |
|||
/// <summary>
|
|||
/// 控件值 ,需在此为申请人在各个控件中填写内容不同控件有不同的赋值参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 模板配置的控件属性为必填时,对应value值需要有值。
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public ControlValue Value { get; set; } |
|||
public ControlData() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private ControlData(string id, string control, ControlValue value) |
|||
{ |
|||
Id = id; |
|||
Control = control; |
|||
Value = value; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建一个Text控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Text(string id, TextControlValue value) |
|||
{ |
|||
return new ControlData(id, "Text", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Textarea控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Textarea(string id, TextareaControlValue value) |
|||
{ |
|||
return new ControlData(id, "Textarea", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Number控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Number(string id, NumberControlValue value) |
|||
{ |
|||
return new ControlData(id, "Number", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Money控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Money(string id, MoneyControlValue value) |
|||
{ |
|||
return new ControlData(id, "Money", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Date控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Date(string id, DateControlValue value) |
|||
{ |
|||
return new ControlData(id, "Date", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Selector控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Selector(string id, SelectorControlValue value) |
|||
{ |
|||
return new ControlData(id, "Selector", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Contact控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Contact(string id, ContactControlValue value) |
|||
{ |
|||
return new ControlData(id, "Contact", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Tips控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Tips(string id) |
|||
{ |
|||
return new ControlData(id, "Tips", null); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个File控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData File(string id, FileControlValue value) |
|||
{ |
|||
return new ControlData(id, "File", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Table控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Table(string id, TableControlValue value) |
|||
{ |
|||
return new ControlData(id, "Table", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Location控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Location(string id, LocationControlValue value) |
|||
{ |
|||
return new ControlData(id, "Location", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个RelatedApproval控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData RelatedApproval(string id, RelatedApprovalControlValue value) |
|||
{ |
|||
return new ControlData(id, "RelatedApproval", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个Formula控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData Formula(string id, FormulaControlValue value) |
|||
{ |
|||
return new ControlData(id, "Formula", value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个DateRange控件
|
|||
/// </summary>
|
|||
/// <param name="id">控件Id</param>
|
|||
/// <param name="value">控件值</param>
|
|||
/// <returns></returns>
|
|||
public static ControlData DateRange(string id, DateRangeControlValue value) |
|||
{ |
|||
return new ControlData(id, "DateRange", value); |
|||
} |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 模板控件属性
|
|||
/// </summary>
|
|||
public class ControlInfo |
|||
{ |
|||
/// <summary>
|
|||
/// 控件id。1-模版内控件id必须唯一;2-控件id格式:control-数字,如"Text-01"
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("id")] |
|||
[JsonPropertyName("id")] |
|||
public string Id { get; set; } |
|||
/// <summary>
|
|||
/// 控件类型
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Text-文本<br />
|
|||
/// Textarea-多行文本<br />
|
|||
/// Number-数字<br />
|
|||
/// Money-金额<br />
|
|||
/// Date-日期/日期+时间<br />
|
|||
/// Selector-单选/多选<br />
|
|||
/// Contact-成员/部门<br />
|
|||
/// Tips-说明文字<br />
|
|||
/// File-附件<br />
|
|||
/// Table-明细<br />
|
|||
/// Location-位置<br />
|
|||
/// RelatedApproval-关联审批单<br />
|
|||
/// DateRange-时长<br />
|
|||
/// PhoneNumber-电话号码<br />
|
|||
/// Vacation-假期<br />
|
|||
/// Attendance-外出/出差/加班<br />
|
|||
/// BankAccount-收款账户<br />
|
|||
/// 以上为目前可支持的控件类型
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("control")] |
|||
[JsonPropertyName("control")] |
|||
public string Control { get; set; } |
|||
/// <summary>
|
|||
/// 控件名称
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public List<ControlTtile> Title { get; set; } |
|||
/// <summary>
|
|||
/// 控件说明,假勤组件(Vacation、Attendance)暂不支持设置
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("placeholder")] |
|||
[JsonPropertyName("placeholder")] |
|||
public List<ControlPlaceholder> Placeholder { get; set; } |
|||
/// <summary>
|
|||
/// 控件是否必填。0-非必填;1-必填;默认为0;假勤组件(Vacation、Attendance)不支持设置非必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("require")] |
|||
[JsonPropertyName("require")] |
|||
public byte Require { get; set; } |
|||
/// <summary>
|
|||
/// 控件是否可打印。0-可打印;1-不可打印;默认为0;假勤组件(Vacation、Attendance)不支持设置不可打印
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("un_print")] |
|||
[JsonPropertyName("un_print")] |
|||
public byte UnPrint { get; set; } |
|||
/// <summary>
|
|||
/// un_replace
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("un_replace")] |
|||
[JsonPropertyName("un_replace")] |
|||
public byte UnReplace { get; set; } |
|||
/// <summary>
|
|||
/// inner_id
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("inner_id")] |
|||
[JsonPropertyName("inner_id")] |
|||
public string InnerId { get; set; } |
|||
/// <summary>
|
|||
/// 控件是否隐藏
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("display")] |
|||
[JsonPropertyName("display")] |
|||
public byte Display { get; set; } |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 控件说明
|
|||
/// </summary>
|
|||
public class ControlPlaceholder |
|||
{ |
|||
/// <summary>
|
|||
/// 控件说明。需满足以下条件:长度不得超过80个字符。
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[StringLength(80)] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
/// <summary>
|
|||
/// 显示语言,中文:zh_CN(注意不是zh-CN);若text填写,则该项为必填
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("lang")] |
|||
[JsonPropertyName("lang")] |
|||
public string Lang { get; set; } |
|||
public ControlPlaceholder() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ControlPlaceholder(string text, string lang = "zh_CN") |
|||
{ |
|||
Text = text; |
|||
Lang = lang; |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 控件名称
|
|||
/// </summary>
|
|||
public class ControlTtile |
|||
{ |
|||
/// <summary>
|
|||
/// 控件名称。需满足以下条件:1-控件名称不得和现有控件名称重复;2-长度不得超过40个字符。3-Attendance-外出/出差/加班控件title固定为外出/出差/加班,暂不支持自定义
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[StringLength(40)] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
/// <summary>
|
|||
/// 显示语言,中文:zh_CN(注意不是zh-CN)
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("lang")] |
|||
[JsonPropertyName("lang")] |
|||
public string Lang { get; set; } |
|||
public ControlTtile() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ControlTtile(string text, string lang = "zh_CN") |
|||
{ |
|||
Text = text; |
|||
Lang = lang; |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 控件值
|
|||
/// </summary>
|
|||
public abstract class ControlValue |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 日期/日期+时间控件配置
|
|||
/// </summary>
|
|||
public class DateControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 日期/日期+时间内容
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("date")] |
|||
[JsonPropertyName("date")] |
|||
public DateConfig Date { get; set; } |
|||
public DateControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DateControlConfig(DateConfig date) |
|||
{ |
|||
Date = date; |
|||
} |
|||
} |
|||
|
|||
public class DateConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 时间展示类型:day-日期;hour-日期+时间 ,和对应模板控件属性一致
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 日期/日期+时间控件值
|
|||
/// </summary>
|
|||
public class DateControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 金额内容,在此填写金额控件的输入值
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("date")] |
|||
[JsonPropertyName("date")] |
|||
public DateValue Date { get; set; } |
|||
public DateControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DateControlValue(DateValue date) |
|||
{ |
|||
Date = date; |
|||
} |
|||
} |
|||
|
|||
public class DateValue |
|||
{ |
|||
/// <summary>
|
|||
/// 时间展示类型:day-日期;hour-日期+时间 ,和对应模板控件属性一致
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// 时间戳-字符串类型,在此填写日期/日期+时间控件的选择值,以此为准
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("s_timestamp")] |
|||
[JsonPropertyName("s_timestamp")] |
|||
public string Timestamp { get; set; } |
|||
public DateValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private DateValue(string type, string timestamp) |
|||
{ |
|||
Type = type; |
|||
Timestamp = timestamp; |
|||
} |
|||
|
|||
public static DateValue Day(string timestamp) |
|||
{ |
|||
return new DateValue("day", timestamp); |
|||
} |
|||
|
|||
public static DateValue Hour(string timestamp) |
|||
{ |
|||
return new DateValue("hour", timestamp); |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 时长配置
|
|||
/// </summary>
|
|||
public class DateRangeConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 时间展示类型:halfday-日期;hour-日期+时间
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// 0-自然日;1-工作日
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("official_holiday")] |
|||
[JsonPropertyName("official_holiday")] |
|||
public byte OfficialHoliday { get; set; } |
|||
/// <summary>
|
|||
/// 一天的时长(单位为秒),必须大于0小于等于86400
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("perday_duration")] |
|||
[JsonPropertyName("perday_duration")] |
|||
public int PerdayDuration { get; set; } |
|||
public DateRangeConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DateRangeConfig(string type, byte officialHoliday, int perdayDuration) |
|||
{ |
|||
Type = type; |
|||
OfficialHoliday = officialHoliday; |
|||
PerdayDuration = perdayDuration; |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 时长组件配置
|
|||
/// </summary>
|
|||
public class DateRangeControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 时长组件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("date_range")] |
|||
[JsonPropertyName("date_range")] |
|||
public DateRangeConfig DateRange { get; set; } |
|||
public DateRangeControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DateRangeControlConfig(DateRangeConfig dateRange) |
|||
{ |
|||
DateRange = dateRange; |
|||
} |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 时长控件值
|
|||
/// </summary>
|
|||
public class DateRangeControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 时长
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("date_range")] |
|||
[JsonPropertyName("date_range")] |
|||
public DateRangeValue DateRange { get; set; } |
|||
public DateRangeControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DateRangeControlValue(DateRangeValue dateRange) |
|||
{ |
|||
DateRange = dateRange; |
|||
} |
|||
} |
|||
|
|||
public class DateRangeValue |
|||
{ |
|||
/// <summary>
|
|||
/// 时长粒度:halfday:按天 hour:按小时
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// 开始时间,unix时间戳。当type 为halfday时,取值只能为固定两个时间点 上午:当天00:00:00点时间戳 下午:当天12:00:00时间戳
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("new_begin")] |
|||
[JsonPropertyName("new_begin")] |
|||
public long NewBegin { get; set; } |
|||
/// <summary>
|
|||
/// 结束时间,unix时间戳。 当type 为halfday时,取值只能为固定两个时间点 上午:当天00:00:00点时间戳 下午:当天12:00:00时间戳
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("new_end")] |
|||
[JsonPropertyName("new_end")] |
|||
public long NewEnd { get; set; } |
|||
/// <summary>
|
|||
/// 时长范围, 单位秒
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("new_duration")] |
|||
[JsonPropertyName("new_duration")] |
|||
public long NewDuration { get; set; } |
|||
public DateRangeValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DateRangeValue(string type, long newBegin, long newEnd, long newDuration) |
|||
{ |
|||
Type = type; |
|||
NewBegin = newBegin; |
|||
NewEnd = newEnd; |
|||
NewDuration = newDuration; |
|||
} |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 部门控件值
|
|||
/// </summary>
|
|||
public class DepartmentControlValue : ContactControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 所选部门内容,即申请人在此控件选择的部门,多选模式下可能有多个
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("departments")] |
|||
[JsonPropertyName("departments")] |
|||
public List<DepartmentValue> Departments { get; set; } |
|||
public DepartmentControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private DepartmentControlValue(List<DepartmentValue> departments) |
|||
{ |
|||
Departments = departments; |
|||
} |
|||
|
|||
public static DepartmentControlValue Single(DepartmentValue department) |
|||
{ |
|||
return new DepartmentControlValue(new List<DepartmentValue> { department }); |
|||
} |
|||
|
|||
public static DepartmentControlValue Multiple(List<DepartmentValue> departments) |
|||
{ |
|||
return new DepartmentControlValue(departments); |
|||
} |
|||
} |
|||
|
|||
public class DepartmentValue |
|||
{ |
|||
/// <summary>
|
|||
/// 所选部门id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("openapi_id")] |
|||
[JsonPropertyName("openapi_id")] |
|||
public string DepartmentId { get; set; } |
|||
/// <summary>
|
|||
/// 所选部门名
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("name")] |
|||
[JsonPropertyName("name")] |
|||
public string Name { get; set; } |
|||
public DepartmentValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DepartmentValue(string departmentId, string name) |
|||
{ |
|||
DepartmentId = departmentId; |
|||
Name = name; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 附件控件配置
|
|||
/// </summary>
|
|||
public class FileControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 附件控件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("file")] |
|||
[JsonPropertyName("file")] |
|||
public FileConfig File { get; set; } |
|||
public FileControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public FileControlConfig(FileConfig file) |
|||
{ |
|||
File = file; |
|||
} |
|||
} |
|||
|
|||
public class FileConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 是否只允许拍照,1--是, 0--否
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("is_only_photo")] |
|||
[JsonPropertyName("is_only_photo")] |
|||
public byte IsOnlyPhoto { get; set; } |
|||
public FileConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public FileConfig(byte isOnlyPhoto) |
|||
{ |
|||
IsOnlyPhoto = isOnlyPhoto; |
|||
} |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 附件控件值
|
|||
/// </summary>
|
|||
public class FileControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 附件列表
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("files")] |
|||
[JsonPropertyName("files")] |
|||
public List<FileValue> Files { get; set; } |
|||
public FileControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public FileControlValue(List<FileValue> files) |
|||
{ |
|||
Files = files; |
|||
} |
|||
} |
|||
|
|||
public class FileValue |
|||
{ |
|||
/// <summary>
|
|||
/// 文件id,该id为临时素材上传接口返回的的media_id,注:提单后将作为单据内容转换为长期文件存储;目前一个审批申请单,全局仅支持上传6个附件,否则将失败。
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("file_id")] |
|||
[JsonPropertyName("file_id")] |
|||
public string FileId { get; set; } |
|||
/// <summary>
|
|||
/// 文件名称,类型为string,如果没有可以填空字符串。
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("file_name")] |
|||
[JsonPropertyName("file_name")] |
|||
public string FileName { get; set; } |
|||
/// <summary>
|
|||
/// 文件大小,类型为number,如果没有可以填空字符串。
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("file_size")] |
|||
[JsonPropertyName("file_size")] |
|||
public long? FileSize { get; set; } |
|||
/// <summary>
|
|||
/// 文件类型,类型为string,如果没有可以填空字符串。
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("file_type")] |
|||
[JsonPropertyName("file_type")] |
|||
public string FileType { get; set; } |
|||
/// <summary>
|
|||
/// 文件地址,类型为string,如果没有可以填空字符串。
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("file_url")] |
|||
[JsonPropertyName("file_url")] |
|||
public string FileUrl { get; set; } |
|||
public FileValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public FileValue(string fileId) |
|||
{ |
|||
FileId = fileId; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 公式控件值
|
|||
/// </summary>
|
|||
public class FormulaControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 公式
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("formula")] |
|||
[JsonPropertyName("formula")] |
|||
public FormulaValue Formula { get; set; } |
|||
public FormulaControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public FormulaControlValue(FormulaValue formula) |
|||
{ |
|||
Formula = formula; |
|||
} |
|||
} |
|||
|
|||
public class FormulaValue |
|||
{ |
|||
/// <summary>
|
|||
/// 公式的值,提交表单时无需填写,后台自动计算
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public string Value { get; set; } |
|||
public FormulaValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public FormulaValue(string value) |
|||
{ |
|||
Value = value; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 位置控件配置
|
|||
/// </summary>
|
|||
public class LocationControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 位置控件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("location")] |
|||
[JsonPropertyName("location")] |
|||
public LocationConfig Location { get; set; } |
|||
public LocationControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public LocationControlConfig(LocationConfig location) |
|||
{ |
|||
Location = location; |
|||
} |
|||
} |
|||
|
|||
public class LocationConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 距离,目前支持100、200、300
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("distance")] |
|||
[JsonPropertyName("distance")] |
|||
public int Distance { get; set; } |
|||
public LocationConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public LocationConfig(int distance) |
|||
{ |
|||
Distance = distance; |
|||
} |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 位置控件值
|
|||
/// </summary>
|
|||
public class LocationControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 位置
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("location")] |
|||
[JsonPropertyName("location")] |
|||
public LocationValue Location { get; set; } |
|||
public LocationControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public LocationControlValue(LocationValue location) |
|||
{ |
|||
Location = location; |
|||
} |
|||
} |
|||
|
|||
public class LocationValue |
|||
{ |
|||
/// <summary>
|
|||
/// 纬度,精确到6位小数
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("latitude")] |
|||
[JsonPropertyName("latitude")] |
|||
public decimal Latitude { get; set; } |
|||
/// <summary>
|
|||
/// 经度,精确到6位小数
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("longitude")] |
|||
[JsonPropertyName("longitude")] |
|||
public decimal Longitude { get; set; } |
|||
/// <summary>
|
|||
/// 地点标题
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 地点详情地址
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("address")] |
|||
[JsonPropertyName("address")] |
|||
public string Address { get; set; } |
|||
/// <summary>
|
|||
/// 选择地点的时间
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("time")] |
|||
[JsonPropertyName("time")] |
|||
public long Time { get; set; } |
|||
public LocationValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public LocationValue(decimal latitude, decimal longitude, string title, string address, long time) |
|||
{ |
|||
Latitude = latitude; |
|||
Longitude = longitude; |
|||
Title = title; |
|||
Address = address; |
|||
Time = time; |
|||
} |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 成员控件值
|
|||
/// </summary>
|
|||
public class MemberControlValue : ContactControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 所选成员内容,即申请人在此控件选择的成员,多选模式下可以有多个
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("members")] |
|||
[JsonPropertyName("members")] |
|||
public List<MemberValue> Members { get; set; } |
|||
public MemberControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private MemberControlValue(List<MemberValue> members) |
|||
{ |
|||
Members = members; |
|||
} |
|||
|
|||
public static MemberControlValue Single(MemberValue member) |
|||
{ |
|||
return new MemberControlValue(new List<MemberValue> { member }); |
|||
} |
|||
|
|||
public static MemberControlValue Multiple(List<MemberValue> members) |
|||
{ |
|||
return new MemberControlValue(members); |
|||
} |
|||
} |
|||
|
|||
public class MemberValue |
|||
{ |
|||
/// <summary>
|
|||
/// 所选成员的userid
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("userid")] |
|||
[JsonPropertyName("userid")] |
|||
public string UserId { get; set; } |
|||
/// <summary>
|
|||
/// 成员名
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("name")] |
|||
[JsonPropertyName("name")] |
|||
public string Name { get; set; } |
|||
public MemberValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public MemberValue(string userId, string name) |
|||
{ |
|||
UserId = userId; |
|||
Name = name; |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 金额控件值
|
|||
/// </summary>
|
|||
public class MoneyControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 金额内容,在此填写金额控件的输入值
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("new_money")] |
|||
[JsonPropertyName("new_money")] |
|||
public string NewMoney { get; set; } |
|||
public MoneyControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public MoneyControlValue(decimal newMoney) |
|||
{ |
|||
NewMoney = newMoney.ToString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 数字控件值
|
|||
/// </summary>
|
|||
public class NumberControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 数字内容,在此填写数字控件的输入值
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("new_number")] |
|||
[JsonPropertyName("new_number")] |
|||
public string NewMumber { get; set; } |
|||
public NumberControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public NumberControlValue(decimal newMumber) |
|||
{ |
|||
NewMumber = newMumber.ToString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 关联审批单控件配置
|
|||
/// </summary>
|
|||
public class RelatedApprovalControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 关联审批单控件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("related_approval")] |
|||
[JsonPropertyName("related_approval")] |
|||
public RelatedApprovalConfig RelatedApproval { get; set; } |
|||
public RelatedApprovalControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public RelatedApprovalControlConfig(RelatedApprovalConfig relatedApproval) |
|||
{ |
|||
RelatedApproval = relatedApproval; |
|||
} |
|||
} |
|||
|
|||
public class RelatedApprovalConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 关联审批单的template_id ,不填时表示可以关联所有模版,该template_id可通过获取审批模版接口获取
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_id")] |
|||
[JsonPropertyName("template_id")] |
|||
public string TemplateId { get; set; } |
|||
public RelatedApprovalConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public RelatedApprovalConfig(string templateId) |
|||
{ |
|||
TemplateId = templateId; |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 关联审批单控件值
|
|||
/// </summary>
|
|||
public class RelatedApprovalControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 关联审批单
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("related_approval")] |
|||
[JsonPropertyName("related_approval")] |
|||
public RelatedApprovalValue RelatedApproval { get; set; } |
|||
public RelatedApprovalControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public RelatedApprovalControlValue(RelatedApprovalValue relatedApproval) |
|||
{ |
|||
RelatedApproval = relatedApproval; |
|||
} |
|||
} |
|||
|
|||
|
|||
public class RelatedApprovalValue |
|||
{ |
|||
/// <summary>
|
|||
/// 关联审批单的审批单号
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_no")] |
|||
[JsonPropertyName("sp_no")] |
|||
public string SpNo { get; set; } |
|||
public RelatedApprovalValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public RelatedApprovalValue(string spNo) |
|||
{ |
|||
SpNo = spNo; |
|||
} |
|||
} |
|||
@ -0,0 +1,122 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 选择控件配置
|
|||
/// </summary>
|
|||
public class SelectorControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 选择控件内容,即申请人在此控件选择的选项内容
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("selector")] |
|||
[JsonPropertyName("selector")] |
|||
public SelectorConfig Selector { get; set; } |
|||
public SelectorControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public SelectorControlConfig(SelectorConfig selector) |
|||
{ |
|||
Selector = selector; |
|||
} |
|||
} |
|||
|
|||
public class SelectorConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 选择方式:single-单选;multi-多选
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// 多选选项,多选属性的选择控件允许输入多个
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("options")] |
|||
[JsonPropertyName("options")] |
|||
public List<SelectorOption> Options { get; set; } |
|||
public SelectorConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private SelectorConfig(string type, List<SelectorOption> options) |
|||
{ |
|||
Type = type; |
|||
Options = options; |
|||
} |
|||
|
|||
public static SelectorConfig Single(List<SelectorOption> options) |
|||
{ |
|||
return new SelectorConfig("single", options); |
|||
} |
|||
|
|||
public static SelectorConfig Multiple(List<SelectorOption> options) |
|||
{ |
|||
return new SelectorConfig("multi", options); |
|||
} |
|||
} |
|||
|
|||
public class SelectorOption |
|||
{ |
|||
/// <summary>
|
|||
/// 时间展示类型:day-日期;hour-日期+时间 ,和对应模板控件属性一致
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("key")] |
|||
[JsonPropertyName("key")] |
|||
public string Key { get; set; } |
|||
/// <summary>
|
|||
/// 选项说明
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public List<SelectorOptionValue> Value { get; set; } |
|||
public SelectorOption() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public SelectorOption(string key, List<SelectorOptionValue> value) |
|||
{ |
|||
Key = key; |
|||
Value = value; |
|||
} |
|||
} |
|||
|
|||
public class SelectorOptionValue |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
/// <summary>
|
|||
/// 显示语言
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("lang")] |
|||
[JsonPropertyName("lang")] |
|||
public string Lang { get; set; } |
|||
public SelectorOptionValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public SelectorOptionValue(string text, string lang = "zh_CN") |
|||
{ |
|||
Text = text; |
|||
Lang = lang; |
|||
} |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 单选/多选控件值
|
|||
/// </summary>
|
|||
public class SelectorControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 单选/多选内容
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("selector")] |
|||
[JsonPropertyName("selector")] |
|||
public SelectorValue Selector { get; set; } |
|||
public SelectorControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public SelectorControlValue(SelectorValue selector) |
|||
{ |
|||
Selector = selector; |
|||
} |
|||
} |
|||
|
|||
public class SelectorValue |
|||
{ |
|||
/// <summary>
|
|||
/// 选择方式:single-单选;multi-多选
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// 多选选项,多选属性的选择控件允许输入多个
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("options")] |
|||
[JsonPropertyName("options")] |
|||
public List<SelectorValueOption> Options { get; set; } |
|||
public SelectorValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private SelectorValue(string type, List<SelectorValueOption> options) |
|||
{ |
|||
Type = type; |
|||
Options = options; |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个单选选项
|
|||
/// </summary>
|
|||
/// <param name="option"></param>
|
|||
/// <returns></returns>
|
|||
public static SelectorValue Single(SelectorValueOption option) |
|||
{ |
|||
return new SelectorValue("single", new List<SelectorValueOption> { option }); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建一个多选选项
|
|||
/// </summary>
|
|||
/// <param name="option"></param>
|
|||
/// <returns></returns>
|
|||
public static SelectorValue Multiple(List<SelectorValueOption> options) |
|||
{ |
|||
return new SelectorValue("multi", options); |
|||
} |
|||
} |
|||
|
|||
public class SelectorValueOption |
|||
{ |
|||
/// <summary>
|
|||
/// 选项key,可通过“获取审批模板详情”接口获得
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("key")] |
|||
[JsonPropertyName("key")] |
|||
public string Key { get; set; } |
|||
public SelectorValueOption() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public SelectorValueOption(string key) |
|||
{ |
|||
Key = key; |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 明细控件配置
|
|||
/// </summary>
|
|||
public class TableControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 明细控件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("table")] |
|||
[JsonPropertyName("table")] |
|||
public TableConfig Table { get; set; } |
|||
public TableControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TableControlConfig(TableConfig table) |
|||
{ |
|||
Table = table; |
|||
} |
|||
} |
|||
|
|||
public class TableConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 打印格式;0-合并成一行打印,1-拆分成多行打印
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("print_format")] |
|||
[JsonPropertyName("print_format")] |
|||
public byte PrintFormat { get; set; } |
|||
/// <summary>
|
|||
/// 明细内容,一个明细控件可能包含多个子控件,每个子控件的属性和控件相同
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("children")] |
|||
[JsonPropertyName("children")] |
|||
public List<Control> Children { get; set; } |
|||
public TableConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TableConfig(byte printFormat, List<Control> children) |
|||
{ |
|||
PrintFormat = printFormat; |
|||
Children = children; |
|||
} |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 明细控件值
|
|||
/// </summary>
|
|||
public class TableControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 明细内容,一个明细控件可能包含多个子明细
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("children")] |
|||
[JsonPropertyName("children")] |
|||
public List<TableValue> Children { get; set; } |
|||
public TableControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TableControlValue(List<TableValue> children) |
|||
{ |
|||
Children = children; |
|||
} |
|||
} |
|||
|
|||
public class TableValue |
|||
{ |
|||
/// <summary>
|
|||
/// 子明细列表,在此填写子明细的所有子控件的值,子控件的数据结构同一般控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 注意:不能为空数组,至少需要包含一个子明细,子明细中必须包括模板中设置的全部子控件,如果子明细为空,则需要将所有子控件的值设为空
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("list")] |
|||
[JsonPropertyName("list")] |
|||
public List<ControlData> List { get; set; } |
|||
public TableValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TableValue(List<ControlData> list) |
|||
{ |
|||
List = list; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 模版控件定义
|
|||
/// </summary>
|
|||
public class TemplateContent |
|||
{ |
|||
/// <summary>
|
|||
/// 控件数组,模版中可以设置多个控件类型,排列顺序和管理端展示的相同
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("controls")] |
|||
[JsonPropertyName("controls")] |
|||
public List<Control> Controls { get; set; } |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 模版名称定义
|
|||
/// </summary>
|
|||
public class TemplateName |
|||
{ |
|||
/// <summary>
|
|||
/// 模板名称
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
/// <summary>
|
|||
/// 多语言名称
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("lang")] |
|||
[JsonPropertyName("lang")] |
|||
public string Lang { get; set; } |
|||
public TemplateName() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TemplateName(string text, string lang = "zh_CN") |
|||
{ |
|||
Text = text; |
|||
Lang = lang; |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 文本控件值
|
|||
/// </summary>
|
|||
public class TextControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 文本内容,在此填写文本/多行文本控件的输入值。文本控件Text内容不支持包含换行符。
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
public TextControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TextControlValue(string text) |
|||
{ |
|||
Text = text; |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 多行文本控件值
|
|||
/// </summary>
|
|||
public class TextareaControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 文本内容,在此填写文本/多行文本控件的输入值。文本控件Text内容不支持包含换行符。
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
public TextareaControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TextareaControlValue(string text) |
|||
{ |
|||
Text = text; |
|||
} |
|||
} |
|||
@ -0,0 +1,169 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 说明文字控件配置
|
|||
/// </summary>
|
|||
public class TipsControlConfig : ControlConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 说明文字控件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("tips")] |
|||
[JsonPropertyName("tips")] |
|||
public TipsConfig Tips { get; set; } |
|||
public TipsControlConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TipsControlConfig(TipsConfig tips) |
|||
{ |
|||
Tips = tips; |
|||
} |
|||
} |
|||
|
|||
public class TipsConfig |
|||
{ |
|||
/// <summary>
|
|||
/// 说明文字数组,元素为不同语言的富文本说明文字
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("tips_content")] |
|||
[JsonPropertyName("tips_content")] |
|||
public List<TipsContent> TipsContents { get; set; } |
|||
public TipsConfig() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TipsConfig(List<TipsContent> tipsContents) |
|||
{ |
|||
TipsContents = tipsContents; |
|||
} |
|||
} |
|||
|
|||
public class TipsContent |
|||
{ |
|||
/// <summary>
|
|||
/// 某个语言的富文本说明
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public TipsContentText Text { get; set; } |
|||
/// <summary>
|
|||
/// 多语言名称
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("lang")] |
|||
[JsonPropertyName("lang")] |
|||
public string Lang { get; set; } |
|||
public TipsContent() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TipsContent(TipsContentText text, string lang = "zh_CN") |
|||
{ |
|||
Text = text; |
|||
Lang = lang; |
|||
} |
|||
} |
|||
|
|||
public class TipsContentText |
|||
{ |
|||
/// <summary>
|
|||
/// 说明文字分段
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sub_text")] |
|||
[JsonPropertyName("sub_text")] |
|||
public List<TipsContentSubText> SubText { get; set; } |
|||
public TipsContentText() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public TipsContentText(List<TipsContentSubText> subText) |
|||
{ |
|||
SubText = subText; |
|||
} |
|||
} |
|||
|
|||
public class TipsContentSubText |
|||
{ |
|||
/// <summary>
|
|||
/// 文本类型 1:纯文本 2:链接,每个说明文字中只支持包含一个链接
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public byte Type { get; set; } |
|||
/// <summary>
|
|||
/// 内容
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("content")] |
|||
[JsonPropertyName("content")] |
|||
public SubTextContent Content { get; set; } |
|||
public TipsContentSubText() |
|||
{ |
|||
|
|||
} |
|||
|
|||
private TipsContentSubText(byte type, SubTextContent content) |
|||
{ |
|||
Type = type; |
|||
Content = content; |
|||
} |
|||
|
|||
public static TipsContentSubText Text(TipsContentPlainText content) |
|||
{ |
|||
return new TipsContentSubText(1, content); |
|||
} |
|||
|
|||
public static TipsContentSubText Link(TipsContentLinkText content) |
|||
{ |
|||
return new TipsContentSubText(2, content); |
|||
} |
|||
} |
|||
|
|||
public abstract class SubTextContent |
|||
{ |
|||
} |
|||
|
|||
public class TipsContentPlainText : SubTextContent |
|||
{ |
|||
/// <summary>
|
|||
/// 纯文本文字
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("content")] |
|||
[JsonPropertyName("content")] |
|||
public string Content { get; set; } |
|||
} |
|||
|
|||
public class TipsContentLinkText : SubTextContent |
|||
{ |
|||
/// <summary>
|
|||
/// 链接标题
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 链接url,不能超过600个字符
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[StringLength(600)] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
} |
|||
@ -0,0 +1,141 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
/// <summary>
|
|||
/// 假勤组件-请假组件值
|
|||
/// </summary>
|
|||
public class VacationControlValue : ControlValue |
|||
{ |
|||
/// <summary>
|
|||
/// 请假内容,即申请人在此组件内选择的请假信息
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("vacation")] |
|||
[JsonPropertyName("vacation")] |
|||
public VacationValue Vacation { get; set; } |
|||
public VacationControlValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public VacationControlValue(VacationValue vacation) |
|||
{ |
|||
Vacation = vacation; |
|||
} |
|||
} |
|||
|
|||
public class VacationValue |
|||
{ |
|||
/// <summary>
|
|||
/// 请假类型,所选选项与假期管理关联,为假期管理中的假期类型
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("selector")] |
|||
[JsonPropertyName("selector")] |
|||
public VacationSelector Selector { get; set; } |
|||
/// <summary>
|
|||
/// 假勤组件
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("attendance")] |
|||
[JsonPropertyName("attendance")] |
|||
public AttendanceValue Attendance { get; set; } |
|||
public VacationValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public VacationValue(VacationSelector selector, AttendanceValue attendance) |
|||
{ |
|||
Selector = selector; |
|||
Attendance = attendance; |
|||
} |
|||
} |
|||
|
|||
public class VacationSelector |
|||
{ |
|||
/// <summary>
|
|||
/// 选择方式:single-单选;multi-多选,在假勤控件中固定为单选
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// 用户所选选项
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("options")] |
|||
[JsonPropertyName("options")] |
|||
public List<VacationSelectorOption> Options { get; set; } |
|||
public VacationSelector() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public VacationSelector(List<VacationSelectorOption> options) |
|||
{ |
|||
Type = "single"; |
|||
Options = options; |
|||
} |
|||
} |
|||
|
|||
public class VacationSelectorOption |
|||
{ |
|||
/// <summary>
|
|||
/// 选项key,选项的唯一id,可通过“获取审批模板详情”接口获得vacation_list中item的id值
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("key")] |
|||
[JsonPropertyName("key")] |
|||
public string Key { get; set; } |
|||
/// <summary>
|
|||
/// 选项值,若配置了多语言则会包含中英文的选项值
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public VacationSelectorOptionValue Value { get; set; } |
|||
public VacationSelectorOption() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public VacationSelectorOption(string key, VacationSelectorOptionValue value) |
|||
{ |
|||
Key = key; |
|||
Value = value; |
|||
} |
|||
} |
|||
|
|||
public class VacationSelectorOptionValue |
|||
{ |
|||
/// <summary>
|
|||
/// 选项值
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
/// <summary>
|
|||
/// 多语言名称
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("lang")] |
|||
[JsonPropertyName("lang")] |
|||
public string Lang { get; set; } |
|||
public VacationSelectorOptionValue() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public VacationSelectorOptionValue(string text, string lang = "zh_CN") |
|||
{ |
|||
Text = text; |
|||
Lang = lang; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,94 @@ |
|||
using JetBrains.Annotations; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
/// <summary>
|
|||
/// 提交审批申请请求参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91853
|
|||
/// </remarks>
|
|||
public class WeChatWorkApplyEventRequest |
|||
{ |
|||
/// <summary>
|
|||
/// 流程
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// use_template_approver = 0 时必填
|
|||
/// </remarks>
|
|||
[CanBeNull] |
|||
[JsonProperty("process")] |
|||
[JsonPropertyName("process")] |
|||
public ApprovalApplyProcess Process { get; set; } |
|||
/// <summary>
|
|||
/// 摘要信息,用于显示在审批通知卡片、审批列表的摘要信息,最多3行
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("summary_list")] |
|||
[JsonPropertyName("summary_list")] |
|||
public List<ApprovalSummary> Summaries { get; set; } |
|||
/// <summary>
|
|||
/// 审批申请数据,可定义审批申请中各个控件的值,其中必填项必须有值,选填项可为空,数据结构同“获取审批申请详情”接口返回值中同名参数“apply_data”
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("apply_data")] |
|||
[JsonPropertyName("apply_data")] |
|||
public ApprovalApplyData ApplyData { get; set; } |
|||
/// <summary>
|
|||
/// 模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。暂不支持通过接口提交[打卡补卡][调班]模板审批单。
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_id")] |
|||
[JsonPropertyName("template_id")] |
|||
public string TemplateId { get; set; } |
|||
/// <summary>
|
|||
/// 申请人userid,此审批申请将以此员工身份提交,申请人需在应用可见范围内
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("creator_userid")] |
|||
[JsonPropertyName("creator_userid")] |
|||
public string CreatorUserId { get; set; } |
|||
/// <summary>
|
|||
/// 审批人模式
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 0-通过接口指定审批人、抄送人(此时process参数必填); <br />
|
|||
/// 1-使用此模板在管理后台设置的审批流程(需要保证审批流程中没有“申请人自选”节点),支持条件审批。默认为0
|
|||
/// </remarks>
|
|||
[NotNull] |
|||
[JsonProperty("use_template_approver")] |
|||
[JsonPropertyName("use_template_approver")] |
|||
public byte UseTemplateApprover |
|||
{ |
|||
get { |
|||
if (Process == null) |
|||
{ |
|||
return 1; |
|||
} |
|||
return 0; |
|||
} |
|||
} |
|||
/// <summary>
|
|||
/// 提单者提单部门id,不填默认为主部门
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("choose_department")] |
|||
[JsonPropertyName("choose_department")] |
|||
public byte? ChooseDepartment { get; set; } |
|||
public WeChatWorkApplyEventRequest( |
|||
string templateId, |
|||
string creatorUserid, |
|||
ApprovalApplyData applyData, |
|||
ApprovalApplyProcess process = null, |
|||
byte? chooseDepartment = null) |
|||
{ |
|||
TemplateId = templateId; |
|||
ApplyData = applyData; |
|||
CreatorUserId = creatorUserid; |
|||
ChooseDepartment = chooseDepartment; |
|||
Process = process; |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using JetBrains.Annotations; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
/// <summary>
|
|||
/// 创建审批模板请求参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/97437
|
|||
/// </remarks>
|
|||
public class WeChatWorkCreateTemplateRequest |
|||
{ |
|||
/// <summary>
|
|||
/// 模版名称数组
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_name")] |
|||
[JsonPropertyName("template_name")] |
|||
public List<TemplateName> TemplateName { get; set; } |
|||
/// <summary>
|
|||
/// 审批模版控件设置,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_content")] |
|||
[JsonPropertyName("template_content")] |
|||
public TemplateContent TemplateContent { get; set; } |
|||
|
|||
public WeChatWorkCreateTemplateRequest(List<TemplateName> templateName, TemplateContent templateContent) |
|||
{ |
|||
TemplateName = templateName; |
|||
TemplateContent = templateContent; |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
/// <summary>
|
|||
/// 获取审批申请详情请求参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91983
|
|||
/// </remarks>
|
|||
public class WeChatWorkGetApprovalDetailRequest |
|||
{ |
|||
/// <summary>
|
|||
/// 审批单编号
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_no")] |
|||
[JsonPropertyName("sp_no")] |
|||
public string SpNo { get; set; } |
|||
public WeChatWorkGetApprovalDetailRequest(string spNo) |
|||
{ |
|||
SpNo = spNo; |
|||
} |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
using JetBrains.Annotations; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
using Volo.Abp; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
/// <summary>
|
|||
/// 批量获取审批单号请求参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91816
|
|||
/// </remarks>
|
|||
public class WeChatWorkGetApprovalInfoRequest |
|||
{ |
|||
/// <summary>
|
|||
/// 审批单提交的时间范围,开始时间,UNix时间戳
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("starttime")] |
|||
[JsonPropertyName("starttime")] |
|||
public long StartTime { get; set; } |
|||
/// <summary>
|
|||
/// 审批单提交的时间范围,结束时间,Unix时间戳
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("endtime")] |
|||
[JsonPropertyName("endtime")] |
|||
public long EndTime { get; set; } |
|||
/// <summary>
|
|||
/// 分页查询游标,默认为空串,后续使用返回的new_next_cursor进行分页拉取
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("new_cursor")] |
|||
[JsonPropertyName("new_cursor")] |
|||
public string NewCursor { get; set; } = ""; |
|||
/// <summary>
|
|||
/// 一次请求拉取审批单数量,默认值为100,上限值为100。
|
|||
/// 若accesstoken为自建应用,仅允许获取在应用可见范围内申请人提交的表单,返回的sp_no_list个数可能和size不一致,开发者需用next_cursor判断表单记录是否拉取完
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("size")] |
|||
[JsonPropertyName("size")] |
|||
public int Size { get; set; } |
|||
/// <summary>
|
|||
/// 筛选条件,可对批量拉取的审批申请设置约束条件,支持设置多个条件
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("filters")] |
|||
[JsonPropertyName("filters")] |
|||
public List<ApprovalInfoFilter> Filters { get; set; } |
|||
public WeChatWorkGetApprovalInfoRequest( |
|||
long sartTime, |
|||
long endTime, |
|||
int size = 100, |
|||
List<ApprovalInfoFilter> filters = null) |
|||
{ |
|||
StartTime = sartTime; |
|||
EndTime = endTime; |
|||
Size = Check.Range(size, nameof(size), 1, 100); |
|||
|
|||
Filters = filters; |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
/// <summary>
|
|||
/// 获取审批模板请求参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91982
|
|||
/// </remarks>
|
|||
public class WeChatWorkGetTemplateRequest |
|||
{ |
|||
/// <summary>
|
|||
/// 模版id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_id")] |
|||
[JsonPropertyName("template_id")] |
|||
public string TemplateId { get; set; } |
|||
public WeChatWorkGetTemplateRequest(string templateId) |
|||
{ |
|||
TemplateId = templateId; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using JetBrains.Annotations; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
/// <summary>
|
|||
/// 更新审批模板请求参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/97438
|
|||
/// </remarks>
|
|||
public class WeChatWorkUpdateTemplateRequest |
|||
{ |
|||
/// <summary>
|
|||
/// 模版id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_id")] |
|||
[JsonPropertyName("template_id")] |
|||
public string TemplateId { get; set; } |
|||
/// <summary>
|
|||
/// 模版名称数组
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_name")] |
|||
[JsonPropertyName("template_name")] |
|||
public List<TemplateName> TemplateName { get; set; } |
|||
/// <summary>
|
|||
/// 审批模版控件设置,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_content")] |
|||
[JsonPropertyName("template_content")] |
|||
public TemplateContent TemplateContent { get; set; } |
|||
|
|||
public WeChatWorkUpdateTemplateRequest( |
|||
string templateId, |
|||
List<TemplateName> templateName, |
|||
TemplateContent templateContent) |
|||
{ |
|||
TemplateId = templateId; |
|||
TemplateName = templateName; |
|||
TemplateContent = templateContent; |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Response; |
|||
/// <summary>
|
|||
/// 提交审批申请响应参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91853
|
|||
/// </remarks>
|
|||
public class WeChatWorkApplyEventResponse : WeChatWorkResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 表单提交成功后,返回的表单编号
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_no")] |
|||
[JsonPropertyName("sp_no")] |
|||
public string SpNo { get; set; } |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Response; |
|||
/// <summary>
|
|||
/// 创建审批模板响应参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/97437
|
|||
/// </remarks>
|
|||
public class WeChatWorkCreateTemplateResponse : WeChatWorkResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 模版创建成功后返回的模版id
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_id")] |
|||
[JsonPropertyName("template_id")] |
|||
public string TemplateId { get; set; } |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using JetBrains.Annotations; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Response; |
|||
/// <summary>
|
|||
/// 获取审批申请详情响应参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91983
|
|||
/// </remarks>
|
|||
public class WeChatWorkGetApprovalDetailResponse : WeChatWorkResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 审批申请详情
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("info")] |
|||
[JsonPropertyName("info")] |
|||
public ApprovalDetailInfo Info { get; set; } |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Response; |
|||
/// <summary>
|
|||
/// 批量获取审批单号响应参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91816
|
|||
/// </remarks>
|
|||
public class WeChatWorkGetApprovalInfoResponse : WeChatWorkResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 审批单号列表,包含满足条件的审批申请
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("sp_no_list")] |
|||
[JsonPropertyName("sp_no_list")] |
|||
public List<string> SpNos { get; set; } |
|||
/// <summary>
|
|||
/// 后续请求查询的游标,当返回结果没有该字段时表示审批单已经拉取完
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("new_next_cursor")] |
|||
[JsonPropertyName("new_next_cursor")] |
|||
public string NewNextCursor { get; set; } |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
using JetBrains.Annotations; |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
using Newtonsoft.Json; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Approvals.Response; |
|||
/// <summary>
|
|||
/// 审批模板响应参数
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 详情见: https://developer.work.weixin.qq.com/document/path/91982
|
|||
/// </remarks>
|
|||
public class WeChatWorkTemplateResponse : WeChatWorkResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 模版名称数组
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_names")] |
|||
[JsonPropertyName("template_names")] |
|||
public List<TemplateName> TemplateNames { get; set; } |
|||
/// <summary>
|
|||
/// 审批模版控件设置,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("template_content")] |
|||
[JsonPropertyName("template_content")] |
|||
public TemplateContent TemplateContent { get; set; } |
|||
public WeChatWorkTemplateResponse() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public WeChatWorkTemplateResponse(List<TemplateName> templateNames, TemplateContent templateContent) |
|||
{ |
|||
TemplateNames = templateNames; |
|||
TemplateContent = templateContent; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
using Newtonsoft.Json.Linq; |
|||
using System; |
|||
|
|||
namespace Newtonsoft.Json; |
|||
internal class ControlNewtonsoftJsonConverter : JsonConverter<Control> |
|||
{ |
|||
public override bool CanWrite => true; |
|||
|
|||
public override void WriteJson(JsonWriter writer, Control value, JsonSerializer serializer) |
|||
{ |
|||
writer.WriteStartObject(); |
|||
|
|||
if (value.Property != null) |
|||
{ |
|||
writer.WritePropertyName("property"); |
|||
serializer.Serialize(writer, value.Property); |
|||
} |
|||
|
|||
if (value.Config != null) |
|||
{ |
|||
writer.WritePropertyName("config"); |
|||
serializer.Serialize(writer, value.Config, value.Config.GetType()); |
|||
} |
|||
|
|||
writer.WriteEndObject(); |
|||
} |
|||
|
|||
public override Control ReadJson(JsonReader reader, Type objectType, Control existingValue, bool hasExistingValue, JsonSerializer serializer) |
|||
{ |
|||
var jObject = JObject.Load(reader); |
|||
|
|||
var control = new Control(); |
|||
|
|||
if (jObject.TryGetValue("property", out var propertyToken)) |
|||
{ |
|||
control.Property = propertyToken.ToObject<ControlInfo>(serializer); |
|||
} |
|||
// 根据 Control 类型动态反序列化 Config
|
|||
if (jObject.TryGetValue("config", out var configToken) && configToken.Type != JTokenType.Null) |
|||
{ |
|||
control.Config = ControlConfigFactory.CreateConfig(control.Property.Control, configToken); |
|||
} |
|||
|
|||
return control; |
|||
} |
|||
} |
|||
@ -0,0 +1,128 @@ |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Request; |
|||
using System.Text; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace System.Net.Http; |
|||
internal static partial class HttpClientWeChatWorkRequestExtensions |
|||
{ |
|||
public async static Task<HttpResponseMessage> ApplyEventAsync( |
|||
this HttpMessageInvoker client, |
|||
string accessToken, |
|||
WeChatWorkApplyEventRequest request, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var urlBuilder = new StringBuilder(); |
|||
urlBuilder.Append("/cgi-bin/oa/applyevent"); |
|||
urlBuilder.AppendFormat("?access_token={0}", accessToken); |
|||
|
|||
var httpRequest = new HttpRequestMessage( |
|||
HttpMethod.Post, |
|||
urlBuilder.ToString()) |
|||
{ |
|||
Content = new StringContent(request.SerializeToJson()) |
|||
}; |
|||
|
|||
return await client.SendAsync(httpRequest, cancellationToken); |
|||
} |
|||
|
|||
public async static Task<HttpResponseMessage> CreateTemplateAsync( |
|||
this HttpMessageInvoker client, |
|||
string accessToken, |
|||
WeChatWorkCreateTemplateRequest request, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var urlBuilder = new StringBuilder(); |
|||
urlBuilder.Append("/cgi-bin/oa/approval/create_template"); |
|||
urlBuilder.AppendFormat("?access_token={0}", accessToken); |
|||
|
|||
var httpRequest = new HttpRequestMessage( |
|||
HttpMethod.Post, |
|||
urlBuilder.ToString()) |
|||
{ |
|||
Content = new StringContent(request.SerializeToJson()) |
|||
}; |
|||
|
|||
return await client.SendAsync(httpRequest, cancellationToken); |
|||
} |
|||
|
|||
public async static Task<HttpResponseMessage> GetApprovalDetailAsync( |
|||
this HttpMessageInvoker client, |
|||
string accessToken, |
|||
WeChatWorkGetApprovalDetailRequest request, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var urlBuilder = new StringBuilder(); |
|||
urlBuilder.Append("/cgi-bin/oa/getapprovaldetail"); |
|||
urlBuilder.AppendFormat("?access_token={0}", accessToken); |
|||
|
|||
var httpRequest = new HttpRequestMessage( |
|||
HttpMethod.Post, |
|||
urlBuilder.ToString()) |
|||
{ |
|||
Content = new StringContent(request.SerializeToJson()) |
|||
}; |
|||
|
|||
return await client.SendAsync(httpRequest, cancellationToken); |
|||
} |
|||
|
|||
public async static Task<HttpResponseMessage> GetApprovalInfoAsync( |
|||
this HttpMessageInvoker client, |
|||
string accessToken, |
|||
WeChatWorkGetApprovalInfoRequest request, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var urlBuilder = new StringBuilder(); |
|||
urlBuilder.Append("/cgi-bin/oa/getapprovalinfo"); |
|||
urlBuilder.AppendFormat("?access_token={0}", accessToken); |
|||
|
|||
var httpRequest = new HttpRequestMessage( |
|||
HttpMethod.Post, |
|||
urlBuilder.ToString()) |
|||
{ |
|||
Content = new StringContent(request.SerializeToJson()) |
|||
}; |
|||
|
|||
return await client.SendAsync(httpRequest, cancellationToken); |
|||
} |
|||
|
|||
public async static Task<HttpResponseMessage> GetTemplateAsync( |
|||
this HttpMessageInvoker client, |
|||
string accessToken, |
|||
WeChatWorkGetTemplateRequest request, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var urlBuilder = new StringBuilder(); |
|||
urlBuilder.Append("/cgi-bin/oa/gettemplatedetail"); |
|||
urlBuilder.AppendFormat("?access_token={0}", accessToken); |
|||
|
|||
var httpRequest = new HttpRequestMessage( |
|||
HttpMethod.Post, |
|||
urlBuilder.ToString()) |
|||
{ |
|||
Content = new StringContent(request.SerializeToJson()) |
|||
}; |
|||
|
|||
return await client.SendAsync(httpRequest, cancellationToken); |
|||
} |
|||
|
|||
public async static Task<HttpResponseMessage> UpdateTemplateAsync( |
|||
this HttpMessageInvoker client, |
|||
string accessToken, |
|||
WeChatWorkCreateTemplateRequest request, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var urlBuilder = new StringBuilder(); |
|||
urlBuilder.Append("/cgi-bin/oa/approval/update_template"); |
|||
urlBuilder.AppendFormat("?access_token={0}", accessToken); |
|||
|
|||
var httpRequest = new HttpRequestMessage( |
|||
HttpMethod.Post, |
|||
urlBuilder.ToString()) |
|||
{ |
|||
Content = new StringContent(request.SerializeToJson()) |
|||
}; |
|||
|
|||
return await client.SendAsync(httpRequest, cancellationToken); |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace System.Net.Http; |
|||
internal static partial class HttpClientWeChatWorkRequestExtensions |
|||
{ |
|||
public async static Task<HttpResponseMessage> GetServerDomainIpAsync( |
|||
this HttpMessageInvoker client, |
|||
string accessToken, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, |
|||
$"/cgi-bin/security/get_server_domain_ip?access_token={accessToken}"); ; |
|||
|
|||
return await client.SendAsync(httpRequest, cancellationToken); |
|||
} |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
using LINGYUN.Abp.WeChat.Work.Approvals.Models; |
|||
|
|||
namespace System.Text.Json.Serialization; |
|||
internal class ControlSystemTextJsonConverter : JsonConverter<Control> |
|||
{ |
|||
public override Control Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) |
|||
{ |
|||
using var doc = JsonDocument.ParseValue(ref reader); |
|||
var root = doc.RootElement; |
|||
|
|||
var control = new Control(); |
|||
|
|||
// 反序列化基本字段
|
|||
if (root.TryGetProperty("property", out var propertyElement)) |
|||
{ |
|||
control.Property = JsonSerializer.Deserialize<ControlInfo>(propertyElement.GetRawText(), options); |
|||
} |
|||
// 根据 Control 类型动态反序列化 Config
|
|||
if (root.TryGetProperty("config", out var configElement) && configElement.ValueKind != JsonValueKind.Null) |
|||
{ |
|||
control.Config = ControlConfigFactory.CreateConfig(control.Property.Control, configElement); |
|||
} |
|||
|
|||
return control; |
|||
} |
|||
|
|||
public override void Write(Utf8JsonWriter writer, Control value, JsonSerializerOptions options) |
|||
{ |
|||
writer.WriteStartObject(); |
|||
|
|||
writer.WritePropertyName("property"); |
|||
JsonSerializer.Serialize(writer, value.Property, options); |
|||
|
|||
if (value.Config != null) |
|||
{ |
|||
writer.WritePropertyName("config"); |
|||
JsonSerializer.Serialize(writer, value.Config, value.Config.GetType(), options); |
|||
} |
|||
|
|||
writer.WriteEndObject(); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue