...
|
...
|
@@ -20,7 +20,7 @@ type SyncDataUserService struct{} |
|
|
// // add:添加,edit:编辑,batchDelete:批量删除,batchForbid:批量禁用用户,batchRemove:批量更改用户部门,import:导入用户
|
|
|
// Action string `json:"action"`
|
|
|
// // 具体的对象JSON数据
|
|
|
// Datas json.RawMessage `json:"data"`
|
|
|
// Data json.RawMessage `json:"data"`
|
|
|
// }
|
|
|
|
|
|
func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) error {
|
...
|
...
|
@@ -29,35 +29,35 @@ func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) erro |
|
|
switch action {
|
|
|
case "employee/add":
|
|
|
var param1 command.SaveUserCommand
|
|
|
err = json.Unmarshal(param.Datas, ¶m1)
|
|
|
err = json.Unmarshal(param.Data, ¶m1)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
err = srv.AddUser(¶m1)
|
|
|
case "employee/edit":
|
|
|
var param2 command.SaveUserCommand
|
|
|
err = json.Unmarshal(param.Datas, ¶m2)
|
|
|
err = json.Unmarshal(param.Data, ¶m2)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
err = srv.UpdateUser(¶m2)
|
|
|
case "employee/batchDelete":
|
|
|
var param3 command.BatchDeleteCommand
|
|
|
err = json.Unmarshal(param.Datas, ¶m3)
|
|
|
err = json.Unmarshal(param.Data, ¶m3)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
err = srv.batchDelete(¶m3)
|
|
|
case "company/batchForbid":
|
|
|
case "employee/batchForbid":
|
|
|
var param4 command.BatchForbidCommand
|
|
|
err = json.Unmarshal(param.Datas, ¶m4)
|
|
|
err = json.Unmarshal(param.Data, ¶m4)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
err = srv.batchForbid(¶m4)
|
|
|
case "company/import":
|
|
|
case "employee/import":
|
|
|
var param4 command.ImportUserCommand
|
|
|
err = json.Unmarshal(param.Datas, ¶m4)
|
|
|
err = json.Unmarshal(param.Data, ¶m4)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -69,9 +69,9 @@ func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) erro |
|
|
return err
|
|
|
}
|
|
|
|
|
|
//AddUser
|
|
|
//从BusinessAdmins 接收消息 添加用户
|
|
|
//module="employee" action="add"
|
|
|
// AddUser
|
|
|
// 从BusinessAdmins 接收消息 添加用户
|
|
|
// module="employee" action="add"
|
|
|
func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -114,9 +114,9 @@ func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error { |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//UpdateUser
|
|
|
//从BusinessAdmins 接收消息 更新用户
|
|
|
//module="employee" action="edit"
|
|
|
// UpdateUser
|
|
|
// 从BusinessAdmins 接收消息 更新用户
|
|
|
// module="employee" action="edit"
|
|
|
func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -174,9 +174,9 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//batchDelete
|
|
|
//从BusinessAdmins 接收消息 删除用户
|
|
|
//module="employee" action="batchDelete"
|
|
|
// batchDelete
|
|
|
// 从BusinessAdmins 接收消息 删除用户
|
|
|
// module="employee" action="batchDelete"
|
|
|
func (srv SyncDataUserService) batchDelete(param *command.BatchDeleteCommand) error {
|
|
|
if len(param.Uids) == 0 {
|
|
|
return nil
|
...
|
...
|
@@ -205,9 +205,9 @@ func (srv SyncDataUserService) batchDelete(param *command.BatchDeleteCommand) er |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//batchForbid
|
|
|
//从BusinessAdmins 接收消息 禁用,启用用户
|
|
|
//module="employee" action="batchForbid"
|
|
|
// batchForbid
|
|
|
// 从BusinessAdmins 接收消息 禁用,启用用户
|
|
|
// module="employee" action="batchForbid"
|
|
|
func (srv SyncDataUserService) batchForbid(param *command.BatchForbidCommand) error {
|
|
|
if len(param.Uids) == 0 {
|
|
|
return nil
|
...
|
...
|
@@ -245,9 +245,9 @@ func (srv SyncDataUserService) batchForbid(param *command.BatchForbidCommand) er |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//importUser
|
|
|
//从BusinessAdmins 接收消息 导入用户数据
|
|
|
//module="employee" action="import"
|
|
|
// importUser
|
|
|
// 从BusinessAdmins 接收消息 导入用户数据
|
|
|
// module="employee" action="import"
|
|
|
func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) error {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
|