feat(ik3cloud): 初始化项目基础配置与部门模块
- 添加 .gitignore 忽略规则 - 实现应用配置加载与管理逻辑 - 添加默认配置文件 app.ini - 配置 Gitea CI/CD 工作流用于构建和部署 - 实现金蝶云客户端初始化功能 - 添加 RPC 插件支持 Consul 注册中心 - 实现部门数据获取及树形结构处理逻辑 - 添加通用工具函数库 - 初始化 Go 模块依赖管理 - 创建 Dockerfile 用于服务容器化部署
This commit is contained in:
101
app/logic/staff.go
Normal file
101
app/logic/staff.go
Normal file
@@ -0,0 +1,101 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"ik3cloud/app/common"
|
||||
"ik3cloud/app/config"
|
||||
"ik3cloud/app/lib/ik3cloud"
|
||||
|
||||
ik3cloud2 "git.kumo.work/shama/service/ik3cloud"
|
||||
"git.kumo.work/shama/service/lib/bean"
|
||||
)
|
||||
|
||||
var StaffLogic = &staffLogic{}
|
||||
|
||||
type staffLogic struct {
|
||||
}
|
||||
|
||||
// List @TITLE 员工列表
|
||||
func (s *staffLogic) List(page bean.Page, search ik3cloud2.StaffSearch) (list []ik3cloud2.StaffItem, total int64, err error) {
|
||||
where := []map[string]interface{}{
|
||||
{
|
||||
"FieldName": "FCreateOrgId.FNumber",
|
||||
"Compare": "67",
|
||||
"Value": config.Config.Ik3cloud.OrganizationNumber,
|
||||
"Left": "",
|
||||
"Right": "",
|
||||
"Logic": 0,
|
||||
},
|
||||
}
|
||||
{
|
||||
// 搜索
|
||||
// 状态
|
||||
if search.Status > 0 {
|
||||
status := "B"
|
||||
if search.Status == 1 {
|
||||
status = "A"
|
||||
}
|
||||
where = append(where, map[string]interface{}{
|
||||
"FieldName": "FForbidStatus",
|
||||
"Compare": "105",
|
||||
"Value": status,
|
||||
"Left": "",
|
||||
"Right": "",
|
||||
"Logic": 0,
|
||||
})
|
||||
}
|
||||
|
||||
// 姓名
|
||||
if search.Name != "" {
|
||||
where = append(where, map[string]interface{}{
|
||||
"FieldName": "FName",
|
||||
"Compare": "17",
|
||||
"Value": search.Name,
|
||||
"Left": "",
|
||||
"Right": "",
|
||||
"Logic": 0,
|
||||
})
|
||||
}
|
||||
|
||||
// 手机号
|
||||
if search.Phone != "" {
|
||||
where = append(where, map[string]interface{}{
|
||||
"FieldName": "FBaseProperty",
|
||||
"Compare": "17",
|
||||
"Value": search.Phone,
|
||||
"Left": "",
|
||||
"Right": "",
|
||||
"Logic": 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
raw, err := ik3cloud.Client.ExecuteBillQuery(map[string]interface{}{
|
||||
"FormId": "BD_Empinfo",
|
||||
"FieldKeys": "FNumber,FName,FParentID.FNumber,FParentID.FName",
|
||||
"FilterString": where,
|
||||
"StartRow": page.GetStart(),
|
||||
"Limit": page.GetLimit(),
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var data [][]*string
|
||||
if err = json.Unmarshal(raw, &data); err != nil {
|
||||
return
|
||||
}
|
||||
for _, item := range data {
|
||||
status := "禁用"
|
||||
if common.PtrCmp(item[5], common.Ptr("A")) {
|
||||
status = "启用"
|
||||
}
|
||||
list = append(list, ik3cloud2.StaffItem{
|
||||
Number: item[0],
|
||||
Name: item[1],
|
||||
Position: item[2],
|
||||
Phone: item[3],
|
||||
Mobile: item[4],
|
||||
Status: common.Ptr(status),
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user