...
|
...
|
@@ -59,7 +59,7 @@ type EmployeeData struct { |
|
|
|
|
|
//DeleteUserData 批量删除用户
|
|
|
type DeleteUserData struct {
|
|
|
CompanyId int64 `json:"companyId"`
|
|
|
//CompanyId int64 `json:"companyId"`
|
|
|
Ids []int64 `json:"ids"`
|
|
|
}
|
|
|
|
...
|
...
|
@@ -76,6 +76,12 @@ type ImportEmployeeData struct { |
|
|
Edit []EmployeeData `json:"edit"`
|
|
|
}
|
|
|
|
|
|
// ChangePhoneData 修改手机号
|
|
|
type ChangePhoneData struct {
|
|
|
OldPhone string `json:"old_phone"`
|
|
|
NewPhone string `json:"new_phone"`
|
|
|
}
|
|
|
|
|
|
//SyncEmployeeService 同步用户数据
|
|
|
type SyncEmployeeService struct{}
|
|
|
|
...
|
...
|
@@ -144,6 +150,17 @@ func (service SyncEmployeeService) DoAction(action string, byteData []byte) erro |
|
|
// case "batchRemove":
|
|
|
// //移动通讯录用户部门 暂时不需要
|
|
|
// return nil
|
|
|
case "changePhoneAllCompany": // TODO 修改手机号
|
|
|
// 修改手机号
|
|
|
var (
|
|
|
err error
|
|
|
data ChangePhoneData
|
|
|
)
|
|
|
err = json.Unmarshal(byteData, &data)
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("数据解析失败:%s", err)
|
|
|
}
|
|
|
return service.changePhone(data)
|
|
|
case "import":
|
|
|
//批量导入
|
|
|
var (
|
...
|
...
|
@@ -388,7 +405,7 @@ func (service SyncEmployeeService) deleteEmployeeData(data DeleteUserData) error |
|
|
}
|
|
|
_, columnSettingsFound, err := columnSettingRepository.Find(domain.ColumnSettingFindQuery{
|
|
|
Ids: ids,
|
|
|
CompanyId: int(data.CompanyId),
|
|
|
//CompanyId: int(data.CompanyId),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -428,6 +445,47 @@ func (service SyncEmployeeService) updateUsersStatus(data ForbidAllowUserData) e |
|
|
return err
|
|
|
}
|
|
|
|
|
|
// ChangePhone TODO 修改手机号
|
|
|
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())
|
|
|
}
|
|
|
|
|
|
var pDao *dao.PartnerInfoDao
|
|
|
if pDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// TODO 更新合伙人手机号
|
|
|
if err = pDao.UpdatePartnerPhone(data.OldPhone, data.NewPhone); 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 (
|
...
|
...
|
|