- 添加部门新增、编辑、删除接口及逻辑实现 - 添加员工新增、编辑、启用、禁用、删除接口及逻辑实现 - 更新配置文件支持组织ID配置 - 初始化金蝶客户端连接配置 - 优化部门与员工数据查询结构 - 增加提交、审核、反审等业务流程处理 - 完善错误处理与日志记录机制
73 lines
1.7 KiB
Go
73 lines
1.7 KiB
Go
package ik3cloud
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/deep-project/kingdee"
|
|
"github.com/deep-project/kingdee/adapters"
|
|
client2 "github.com/deep-project/kingdee/pkg/client"
|
|
)
|
|
|
|
var Client = &client{}
|
|
|
|
type client struct {
|
|
config *Config
|
|
*client2.Client
|
|
}
|
|
|
|
type Config struct {
|
|
Host string // 接口地址
|
|
AccountId string // 账套ID
|
|
Username string // 用户名
|
|
AppId string // 应用ID
|
|
AppSecret string // 应用秘钥
|
|
LanguageId string // 语言ID
|
|
}
|
|
|
|
// InitClient @TITLE 初始化
|
|
func InitClient(config *Config) (*client, error) {
|
|
var err error
|
|
Client.Client, err = kingdee.New(config.Host, &adapters.LoginBySign{
|
|
AccountID: config.AccountId,
|
|
Username: config.Username,
|
|
AppID: config.AppId,
|
|
AppSecret: config.AppSecret,
|
|
LanguageID: config.LanguageId,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
Client.config = config
|
|
return Client, nil
|
|
}
|
|
|
|
// GetResult @TITLE 获取结果
|
|
func (c *client) GetResult(raw []byte) (res result, err error) {
|
|
err = json.Unmarshal(raw, &res)
|
|
return
|
|
}
|
|
|
|
type result struct {
|
|
Result struct {
|
|
ResponseStatus struct {
|
|
ErrorCode int `json:"ErrorCode"`
|
|
IsSuccess bool `json:"IsSuccess"`
|
|
Errors []struct {
|
|
FieldName string `json:"FieldName"`
|
|
Message string `json:"Message"`
|
|
DIndex int `json:"DIndex"`
|
|
} `json:"Errors"`
|
|
SuccessEntitys []struct {
|
|
Id int `json:"Id"`
|
|
Number string `json:"Number"`
|
|
DIndex int `json:"DIndex"`
|
|
} `json:"SuccessEntitys"`
|
|
SuccessMessages []interface{} `json:"SuccessMessages"`
|
|
MsgCode int `json:"MsgCode"`
|
|
} `json:"ResponseStatus"`
|
|
Id int64 `json:"Id"`
|
|
Number string `json:"Number"`
|
|
NeedReturnData []any `json:"NeedReturnData"`
|
|
} `json:"Result"`
|
|
}
|