|
@@ -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:"oldPhone"`
|
|
|
82
|
+ NewPhone string `json:"newPhone"`
|
|
|
83
|
+}
|
|
|
84
|
+
|
79
|
//SyncEmployeeService 同步用户数据
|
85
|
//SyncEmployeeService 同步用户数据
|
80
|
type SyncEmployeeService struct{}
|
86
|
type SyncEmployeeService struct{}
|
81
|
|
87
|
|
|
@@ -144,6 +150,18 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro |
|
@@ -144,6 +150,18 @@ 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 "changePhone": // 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
|
+
|
|
|
164
|
+ return nil
|
147
|
case "import":
|
165
|
case "import":
|
148
|
//批量导入
|
166
|
//批量导入
|
149
|
var (
|
167
|
var (
|
|
@@ -428,6 +446,31 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e |
|
@@ -428,6 +446,31 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e |
428
|
return err
|
446
|
return err
|
429
|
}
|
447
|
}
|
430
|
|
448
|
|
|
|
449
|
+// ChangePhone 修改手机号
|
|
|
450
|
+func (service SyncEmployeeService) changePhone(data ChangePhoneData) error {
|
|
|
451
|
+ var (
|
|
|
452
|
+ transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
453
|
+ err error
|
|
|
454
|
+ )
|
|
|
455
|
+ if err = transactionContext.StartTransaction(); err != nil {
|
|
|
456
|
+ return err
|
|
|
457
|
+ }
|
|
|
458
|
+ defer func() {
|
|
|
459
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
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
|
+ if err = uDao.UpdateUserPhone(data.OldPhone, data.NewPhone); err != nil {
|
|
|
468
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
469
|
+ }
|
|
|
470
|
+ err = transactionContext.CommitTransaction()
|
|
|
471
|
+ return err
|
|
|
472
|
+}
|
|
|
473
|
+
|
431
|
//ChangeAdmin 变更公司负责人,超级管理员
|
474
|
//ChangeAdmin 变更公司负责人,超级管理员
|
432
|
func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error {
|
475
|
func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error {
|
433
|
var (
|
476
|
var (
|