- 修改部门服务中 Ik3cloudInfo 方法的返回结构体为 ReplyDepartmentIk3cloudInfo - 新增 ReplyDepartmentIk3cloudInfo 结构体定义,包含金蝶相关字段 - 修改员工服务中 Ik3cloudInfo 方法的返回结构体为 ReplyStaffIk3cloudInfo - 新增 ReplyStaffIk3cloudInfo 结构体定义,扩展更多金蝶相关信息字段 - 调整工厂保存参数结构体 ArgsFactorySave,增加部门编号和员工编号字段 - 移除部门和员工服务对 ik3cloud 包的直接依赖引用
125 lines
3.2 KiB
Go
125 lines
3.2 KiB
Go
package oa
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.kumo.work/shama/service/client"
|
|
)
|
|
|
|
type department struct {
|
|
}
|
|
type DepartmentItem struct {
|
|
Id int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Code string `json:"code"`
|
|
ParentId int64 `json:"parentId"`
|
|
ManageStaffId int64 `json:"manageStaffId"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
Children []*DepartmentItem `json:"children"`
|
|
}
|
|
|
|
// All @TITLE 获取部门
|
|
func (d *department) All(ctx context.Context) (reply []DepartmentItem, err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "All", 0, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsDepartmentAdd struct {
|
|
Name string // 部门名称
|
|
Code string // 部门编号
|
|
ParentId int64 // 上级部门id
|
|
ManageStaffId int64 // 部门负责人
|
|
}
|
|
|
|
// Add @TITLE 添加部门
|
|
func (d *department) Add(ctx context.Context, args ArgsDepartmentAdd) (err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "Add", args, &reply)
|
|
}
|
|
|
|
// Info @TITLE 部门详情
|
|
func (d *department) Info(ctx context.Context, departmentId int64) (reply DepartmentItem, err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Info", departmentId, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsDepartmentEdit struct {
|
|
DepartmentId int64 // 部门id
|
|
ArgsDepartmentAdd
|
|
}
|
|
|
|
// Edit @TITLE 编辑部门
|
|
func (d *department) Edit(ctx context.Context, args ArgsDepartmentEdit) (err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
}
|
|
|
|
// Delete @TITLE 删除部门
|
|
func (d *department) Delete(ctx context.Context, departmentIds []int64) (err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "Delete", departmentIds, &reply)
|
|
}
|
|
|
|
type ArgsDepartmentSetStaff struct {
|
|
DepartmentId int64
|
|
StaffIds []int64
|
|
}
|
|
|
|
// SetStaff @TITLE 配置部门员工
|
|
func (d *department) SetStaff(ctx context.Context, args ArgsDepartmentSetStaff) (err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "SetStaff", args, &reply)
|
|
}
|
|
|
|
type ReplyDepartmentIk3cloudInfo struct {
|
|
Id int64 `json:"id"` // 金蝶员工id
|
|
Number string `json:"number"` // 金蝶员工编码
|
|
PositionID int64 `json:"positionID"` // 金蝶部门职位id
|
|
PositionNumber string `json:"positionNumber"` // 金蝶部门职位编码
|
|
}
|
|
|
|
// Ik3cloudInfo @TITLE 金蝶同步信息
|
|
func (d *department) Ik3cloudInfo(ctx context.Context, departmentId int64) (reply ReplyDepartmentIk3cloudInfo, err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Ik3cloudInfo", departmentId, &reply)
|
|
return
|
|
}
|
|
|
|
// Ik3cloud @TITLE 金蝶集成
|
|
func (d *department) Ik3cloud(ctx context.Context, departmentId int64) (err error) {
|
|
xClient, err := client.GetClient(d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "Ik3cloud", departmentId, &reply)
|
|
}
|