...
|
...
|
@@ -76,6 +76,12 @@ type ImportEmployeeData struct { |
|
|
Edit []EmployeeData `json:"edit"`
|
|
|
}
|
|
|
|
|
|
// ChangePhoneData 修改手机号
|
|
|
type ChangePhoneData struct {
|
|
|
OldPhone string `json:"oldPhone"`
|
|
|
NewPhone string `json:"newPhone"`
|
|
|
}
|
|
|
|
|
|
//SyncEmployeeService 同步用户数据
|
|
|
type SyncEmployeeService struct{}
|
|
|
|
...
|
...
|
@@ -144,6 +150,18 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro |
|
|
// case "batchRemove":
|
|
|
// //移动通讯录用户部门 暂时不需要
|
|
|
// return nil
|
|
|
case "changePhone": // TODO 修改手机号
|
|
|
// 修改手机号
|
|
|
var (
|
|
|
err error
|
|
|
data ChangePhoneData
|
|
|
)
|
|
|
err = json.Unmarshal(byteData, &data)
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("数据解析失败:%s", err)
|
|
|
}
|
|
|
|
|
|
return nil
|
|
|
case "import":
|
|
|
//批量导入
|
|
|
var (
|
...
|
...
|
@@ -428,6 +446,31 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e |
|
|
return err
|
|
|
}
|
|
|
|
|
|
// ChangePhone 修改手机号
|
|
|
func (service SyncEmployeeService) changePhone(data ChangePhoneData) error {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
err error
|
|
|
)
|
|
|
if err = transactionContext.StartTransaction(); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
var uDao *dao.UsersDao
|
|
|
if uDao, err = factory.CreateUsersDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err = uDao.UpdateUserPhone(data.OldPhone, data.NewPhone); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
err = transactionContext.CommitTransaction()
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
//ChangeAdmin 变更公司负责人,超级管理员
|
|
|
func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdminCommand) error {
|
|
|
var (
|
...
|
...
|
|