|
@@ -59,8 +59,8 @@ type EmployeeData struct { |
|
@@ -59,8 +59,8 @@ type EmployeeData struct { |
59
|
|
59
|
|
60
|
//DeleteUserData 批量删除用户
|
60
|
//DeleteUserData 批量删除用户
|
61
|
type DeleteUserData struct {
|
61
|
type DeleteUserData struct {
|
62
|
- CompanyId int64 `json:"companyId"`
|
|
|
63
|
- Ids []int64 `json:"ids"`
|
62
|
+ //CompanyId int64 `json:"companyId"`
|
|
|
63
|
+ Ids []int64 `json:"ids"`
|
64
|
}
|
64
|
}
|
65
|
|
65
|
|
66
|
//ForbidAllowUserData 禁用启用用户
|
66
|
//ForbidAllowUserData 禁用启用用户
|
|
@@ -76,6 +76,12 @@ type ImportEmployeeData struct { |
|
@@ -76,6 +76,12 @@ type ImportEmployeeData struct { |
76
|
Edit []EmployeeData `json:"edit"`
|
76
|
Edit []EmployeeData `json:"edit"`
|
77
|
}
|
77
|
}
|
78
|
|
78
|
|
|
|
79
|
+// ChangePhoneData 修改手机号
|
|
|
80
|
+type ChangePhoneData struct {
|
|
|
81
|
+ OldPhone string `json:"old_phone"`
|
|
|
82
|
+ NewPhone string `json:"new_phone"`
|
|
|
83
|
+}
|
|
|
84
|
+
|
79
|
//SyncEmployeeService 同步用户数据
|
85
|
//SyncEmployeeService 同步用户数据
|
80
|
type SyncEmployeeService struct{}
|
86
|
type SyncEmployeeService struct{}
|
81
|
|
87
|
|
|
@@ -144,6 +150,17 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro |
|
@@ -144,6 +150,17 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro |
144
|
// case "batchRemove":
|
150
|
// case "batchRemove":
|
145
|
// //移动通讯录用户部门 暂时不需要
|
151
|
// //移动通讯录用户部门 暂时不需要
|
146
|
// return nil
|
152
|
// return nil
|
|
|
153
|
+ case "changePhoneAllCompany": // TODO 修改手机号
|
|
|
154
|
+ // 修改手机号
|
|
|
155
|
+ var (
|
|
|
156
|
+ err error
|
|
|
157
|
+ data ChangePhoneData
|
|
|
158
|
+ )
|
|
|
159
|
+ err = json.Unmarshal(byteData, &data)
|
|
|
160
|
+ if err != nil {
|
|
|
161
|
+ return fmt.Errorf("数据解析失败:%s", err)
|
|
|
162
|
+ }
|
|
|
163
|
+ return service.changePhone(data)
|
147
|
case "import":
|
164
|
case "import":
|
148
|
//批量导入
|
165
|
//批量导入
|
149
|
var (
|
166
|
var (
|
|
@@ -387,8 +404,8 @@ func (service SyncEmployeeService) deleteEmployeeData(data DeleteUserData) error |
|
@@ -387,8 +404,8 @@ func (service SyncEmployeeService) deleteEmployeeData(data DeleteUserData) error |
387
|
ids = append(ids, d)
|
404
|
ids = append(ids, d)
|
388
|
}
|
405
|
}
|
389
|
_, columnSettingsFound, err := columnSettingRepository.Find(domain.ColumnSettingFindQuery{
|
406
|
_, columnSettingsFound, err := columnSettingRepository.Find(domain.ColumnSettingFindQuery{
|
390
|
- Ids: ids,
|
|
|
391
|
- CompanyId: int(data.CompanyId),
|
407
|
+ Ids: ids,
|
|
|
408
|
+ //CompanyId: int(data.CompanyId),
|
392
|
})
|
409
|
})
|
393
|
if err != nil {
|
410
|
if err != nil {
|
394
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
411
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -428,6 +445,47 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e |
|
@@ -428,6 +445,47 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e |
428
|
return err
|
445
|
return err
|
429
|
}
|
446
|
}
|
430
|
|
447
|
|
|
|
448
|
+// ChangePhone TODO 修改手机号
|
|
|
449
|
+func (service SyncEmployeeService) changePhone(data ChangePhoneData) error {
|
|
|
450
|
+ var (
|
|
|
451
|
+ transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
452
|
+ err error
|
|
|
453
|
+ )
|
|
|
454
|
+ if err = transactionContext.StartTransaction(); err != nil {
|
|
|
455
|
+ return err
|
|
|
456
|
+ }
|
|
|
457
|
+ defer func() {
|
|
|
458
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
459
|
+ }()
|
|
|
460
|
+
|
|
|
461
|
+ var uDao *dao.UsersDao
|
|
|
462
|
+ if uDao, err = factory.CreateUsersDao(map[string]interface{}{
|
|
|
463
|
+ "transactionContext": transactionContext,
|
|
|
464
|
+ }); err != nil {
|
|
|
465
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
466
|
+ }
|
|
|
467
|
+
|
|
|
468
|
+ var pDao *dao.PartnerInfoDao
|
|
|
469
|
+ if pDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
470
|
+ "transactionContext": transactionContext,
|
|
|
471
|
+ }); err != nil {
|
|
|
472
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
473
|
+ }
|
|
|
474
|
+
|
|
|
475
|
+ // TODO 更新合伙人手机号
|
|
|
476
|
+ if err = pDao.UpdatePartnerPhone(data.OldPhone, data.NewPhone); err != nil {
|
|
|
477
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
478
|
+ }
|
|
|
479
|
+
|
|
|
480
|
+ // 更新高管手机号
|
|
|
481
|
+ if err = uDao.UpdateUserPhone(data.OldPhone, data.NewPhone); err != nil {
|
|
|
482
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
483
|
+ }
|
|
|
484
|
+
|
|
|
485
|
+ err = transactionContext.CommitTransaction()
|
|
|
486
|
+ return err
|
|
|
487
|
+}
|
|
|
488
|
+
|
431
|
//ChangeAdmin 变更公司负责人,超级管理员
|
489
|
//ChangeAdmin 变更公司负责人,超级管理员
|
432
|
func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error {
|
490
|
func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error {
|
433
|
var (
|
491
|
var (
|