All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m41s
- wecom/scenes/{business_type} 与 scenes/{business_type}/fields 的 business_type
路径参数描述补齐第三个业务类型,避免管理员按文档无法配置核销审批场景
- 同步补机读 enum 标签,与既有可枚举参数约定一致
OpenSpec Change: add-employee-collection-bills
103 lines
6.9 KiB
Go
103 lines
6.9 KiB
Go
package dto
|
||
|
||
import "time"
|
||
|
||
// WeComControlMappingItem 描述一个业务字段到企微模板控件的显式映射。
|
||
type WeComControlMappingItem struct {
|
||
BusinessField string `json:"business_field" validate:"required,min=1,max=64" description:"系统业务字段编码;按 business_type 调用 GET /api/admin/wecom/scenes/{business_type}/fields 获取可选值"`
|
||
ControlID string `json:"control_id" validate:"required,min=1,max=128" description:"企微模板控件 ID"`
|
||
ControlType string `json:"control_type" validate:"required,min=1,max=64" description:"企微模板控件类型,必须与模板详情一致"`
|
||
OptionMapping map[string]string `json:"option_mapping" description:"业务枚举值到企微选择项 key 的映射;非选择控件传空对象"`
|
||
}
|
||
|
||
// InspectWeComTemplateRequest 检查企业微信审批模板请求。
|
||
type InspectWeComTemplateRequest struct {
|
||
TemplateID string `json:"template_id" validate:"required,min=1,max=128" description:"企微后台已创建模板 ID"`
|
||
}
|
||
|
||
// InspectWeComTemplateParams 检查企业微信审批模板路径与请求参数。
|
||
type InspectWeComTemplateParams struct {
|
||
IDReq
|
||
InspectWeComTemplateRequest
|
||
}
|
||
|
||
// WeComBusinessFieldListParams 查询企业微信审批场景可映射字段路径参数。
|
||
type WeComBusinessFieldListParams struct {
|
||
BusinessType string `path:"business_type" required:"true" enum:"refund_approval,offline_recharge_approval,employee_collection_approval" description:"业务类型 (refund_approval:退款审批, offline_recharge_approval:员工线下代充值审批, employee_collection_approval:员工代收款核销审批)"`
|
||
}
|
||
|
||
// WeComBusinessFieldResponse 企业微信审批场景可映射业务字段响应。
|
||
type WeComBusinessFieldResponse struct {
|
||
Code string `json:"code" description:"control_mapping.business_field 应填写的稳定字段编码"`
|
||
Name string `json:"name" description:"字段中文名称"`
|
||
ValueType string `json:"value_type" description:"字段值类型 (string:字符串, integer:整数, money:两位小数的元金额字符串, file_list:对象存储文件引用列表)"`
|
||
Description string `json:"description" description:"字段取值说明"`
|
||
}
|
||
|
||
// WeComBusinessFieldListResponse 企业微信审批场景可映射业务字段列表响应。
|
||
type WeComBusinessFieldListResponse struct {
|
||
BusinessType string `json:"business_type" description:"业务类型"`
|
||
BusinessTypeName string `json:"business_type_name" description:"业务类型名称(中文)"`
|
||
Items []WeComBusinessFieldResponse `json:"items" description:"当前业务类型允许写入 control_mapping.business_field 的字段"`
|
||
}
|
||
|
||
// WeComTemplateControlResponse 企业微信审批模板控件响应。
|
||
type WeComTemplateControlResponse struct {
|
||
ID string `json:"id" description:"企微模板控件 ID"`
|
||
Type string `json:"type" description:"企微模板控件类型"`
|
||
Title string `json:"title" description:"企微模板控件标题"`
|
||
Required bool `json:"required" description:"是否必填"`
|
||
OptionKeys []string `json:"option_keys" description:"选择控件可用选项 key"`
|
||
}
|
||
|
||
// WeComTemplateDetailResponse 企业微信审批模板详情响应。
|
||
type WeComTemplateDetailResponse struct {
|
||
TemplateID string `json:"template_id" description:"企微模板 ID"`
|
||
Name string `json:"name" description:"企微模板名称"`
|
||
Controls []WeComTemplateControlResponse `json:"controls" description:"可用于业务字段映射的模板控件"`
|
||
}
|
||
|
||
// SaveWeComApprovalSceneRequest 保存企业微信审批场景请求。
|
||
type SaveWeComApprovalSceneRequest struct {
|
||
ApplicationID uint `json:"application_id" validate:"required,gt=0" description:"企业微信应用配置 ID"`
|
||
TemplateID string `json:"template_id" validate:"required,min=1,max=128" description:"企微后台已创建模板 ID"`
|
||
ControlMapping []WeComControlMappingItem `json:"control_mapping" validate:"required,min=1,dive" description:"业务字段与模板控件映射"`
|
||
Status int `json:"status" validate:"oneof=0 1" enum:"0,1" description:"状态 (0:禁用, 1:启用)"`
|
||
}
|
||
|
||
// SaveWeComApprovalSceneParams 保存企业微信审批场景路径与请求参数。
|
||
type SaveWeComApprovalSceneParams struct {
|
||
BusinessType string `path:"business_type" required:"true" enum:"refund_approval,offline_recharge_approval,employee_collection_approval" description:"业务类型 (refund_approval:退款审批, offline_recharge_approval:员工线下代充值审批, employee_collection_approval:员工代收款核销审批);可先调用 GET /api/admin/wecom/scenes/{business_type}/fields 查询允许映射的业务字段"`
|
||
SaveWeComApprovalSceneRequest
|
||
}
|
||
|
||
// WeComApprovalSceneListRequest 查询企业微信审批场景请求。
|
||
type WeComApprovalSceneListRequest struct {
|
||
Page int `query:"page" validate:"omitempty,min=1" default:"1" description:"页码,默认 1"`
|
||
PageSize int `query:"page_size" validate:"omitempty,min=1,max=100" default:"20" description:"每页数量,默认 20,最大 100"`
|
||
}
|
||
|
||
// WeComApprovalSceneResponse 企业微信审批场景响应。
|
||
type WeComApprovalSceneResponse struct {
|
||
ID uint `json:"id" description:"场景配置 ID"`
|
||
BusinessType string `json:"business_type" description:"业务类型"`
|
||
BusinessTypeName string `json:"business_type_name" description:"业务类型名称(中文)"`
|
||
ApplicationID uint `json:"application_id" description:"企业微信应用配置 ID"`
|
||
TemplateID string `json:"template_id" description:"企微模板 ID"`
|
||
TemplateName string `json:"template_name" description:"企微模板名称"`
|
||
TemplateFingerprint string `json:"template_fingerprint" description:"模板控件最小快照 SHA-256 指纹"`
|
||
ControlMapping []WeComControlMappingItem `json:"control_mapping" description:"已验证控件映射"`
|
||
Status int `json:"status" description:"状态 (0:禁用, 1:启用)"`
|
||
StatusName string `json:"status_name" description:"状态名称(中文)"`
|
||
LastVerifiedAt time.Time `json:"last_verified_at" description:"最近模板校验时间"`
|
||
UpdatedAt time.Time `json:"updated_at" description:"更新时间"`
|
||
}
|
||
|
||
// WeComApprovalSceneListResponse 企业微信审批场景分页响应。
|
||
type WeComApprovalSceneListResponse struct {
|
||
Items []WeComApprovalSceneResponse `json:"items" description:"审批场景列表"`
|
||
Total int64 `json:"total" description:"总数量"`
|
||
Page int `json:"page" description:"当前页码"`
|
||
PageSize int `json:"page_size" description:"每页数量"`
|
||
}
|