更新
This commit is contained in:
1 parent
b6b528490c
commit
4ab63e77ed
28 files changed
+1858
-695
No files matched your search
@@ -10,6 +10,7 @@ import (
|
||||
"server/models"
|
||||
"server/pkg/identity"
|
||||
"server/pkg/jwtutil"
|
||||
"server/services"
|
||||
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
@@ -39,15 +40,15 @@ func (c *BackendErpContactController) contactTenantID() (uint64, error) {
|
||||
}
|
||||
|
||||
type erpContactDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
Tid uint64 `json:"tid"`
|
||||
EmployeeID uint64 `json:"employee_id"`
|
||||
OrgID uint64 `json:"org_id"`
|
||||
OrgName string `json:"org_name"`
|
||||
ContactType int8 `json:"contact_type"`
|
||||
ContactName string `json:"contact_name"`
|
||||
Gender int8 `json:"gender"`
|
||||
Phone string `json:"phone"`
|
||||
ID uint64 `json:"id"`
|
||||
Tid uint64 `json:"tid"`
|
||||
EmployeeID uint64 `json:"employee_id"`
|
||||
OrgID uint64 `json:"org_id"`
|
||||
OrgName string `json:"org_name"`
|
||||
ContactType int8 `json:"contact_type"`
|
||||
ContactName string `json:"contact_name"`
|
||||
Gender int8 `json:"gender"`
|
||||
Phone string `json:"phone"`
|
||||
// 手机号可登记多个(有的人有多个号码):JSON 数组,最多 5 个;phone 保留为第一个
|
||||
Mobiles string `json:"mobiles"`
|
||||
WorkPhone string `json:"work_phone"`
|
||||
@@ -585,6 +586,10 @@ func (c *BackendErpContactController) contactDTO(row models.BackendErpContact) e
|
||||
|
||||
// --- Sync from Employee ---
|
||||
|
||||
func init() {
|
||||
services.OnEmployeeCreatedHook = SyncContactOnEmployeeCreate
|
||||
}
|
||||
|
||||
// SyncContactOnEmployeeCreate 员工创建后同步到通讯录(由组织架构控制器调用)
|
||||
func SyncContactOnEmployeeCreate(tid uint64, employeeID uint64, emp *models.BackendEmployee) {
|
||||
syncContactFromEmployee(tid, employeeID, emp)
|
||||
@@ -765,13 +770,13 @@ func syncContactFromEmployee(tid uint64, employeeID uint64, emp *models.BackendE
|
||||
// getEmployeeFileForContact 获取员工人事档案数据(用于通讯录同步)
|
||||
// 返回档案中与通讯录相关的字段
|
||||
func getEmployeeFileForContact(employeeID uint64) struct {
|
||||
WorkEmail string
|
||||
HouseholdAddress string
|
||||
CurrentAddress string
|
||||
EmergencyContact string
|
||||
EmergencyPhone string
|
||||
WorkEmail string
|
||||
HouseholdAddress string
|
||||
CurrentAddress string
|
||||
EmergencyContact string
|
||||
EmergencyPhone string
|
||||
EmergencyRelation string
|
||||
EmploymentStatus int8
|
||||
EmploymentStatus int8
|
||||
} {
|
||||
var file models.BackendEmployeeFile
|
||||
err := models.Orm.QueryTable(new(models.BackendEmployeeFile)).
|
||||
@@ -782,32 +787,32 @@ func getEmployeeFileForContact(employeeID uint64) struct {
|
||||
if err != nil {
|
||||
// 档案不存在,返回空值
|
||||
return struct {
|
||||
WorkEmail string
|
||||
HouseholdAddress string
|
||||
CurrentAddress string
|
||||
EmergencyContact string
|
||||
EmergencyPhone string
|
||||
WorkEmail string
|
||||
HouseholdAddress string
|
||||
CurrentAddress string
|
||||
EmergencyContact string
|
||||
EmergencyPhone string
|
||||
EmergencyRelation string
|
||||
EmploymentStatus int8
|
||||
EmploymentStatus int8
|
||||
}{}
|
||||
}
|
||||
|
||||
return struct {
|
||||
WorkEmail string
|
||||
HouseholdAddress string
|
||||
CurrentAddress string
|
||||
EmergencyContact string
|
||||
EmergencyPhone string
|
||||
WorkEmail string
|
||||
HouseholdAddress string
|
||||
CurrentAddress string
|
||||
EmergencyContact string
|
||||
EmergencyPhone string
|
||||
EmergencyRelation string
|
||||
EmploymentStatus int8
|
||||
EmploymentStatus int8
|
||||
}{
|
||||
WorkEmail: file.WorkEmail,
|
||||
HouseholdAddress: file.HouseholdAddress,
|
||||
CurrentAddress: file.CurrentAddress,
|
||||
EmergencyContact: file.EmergencyContact,
|
||||
EmergencyPhone: file.EmergencyPhone,
|
||||
WorkEmail: file.WorkEmail,
|
||||
HouseholdAddress: file.HouseholdAddress,
|
||||
CurrentAddress: file.CurrentAddress,
|
||||
EmergencyContact: file.EmergencyContact,
|
||||
EmergencyPhone: file.EmergencyPhone,
|
||||
EmergencyRelation: file.EmergencyRelation,
|
||||
EmploymentStatus: file.EmploymentStatus,
|
||||
EmploymentStatus: file.EmploymentStatus,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -982,4 +987,4 @@ func contactFirstNonEmptyPtr(values ...*string) *string {
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user