作者 庄敏学

kafka

不能预览此文件类型
... ... @@ -131,10 +131,13 @@ func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmen
if departmentList[i].Id == param.Id {
departmentList[i].CompanyId = param.CompanyId
departmentList[i].Name = param.Name
departmentList[i].Name = param.Path
departmentList[i].ChargeUserIds = param.ChargeUserIds
departmentList[i].Path = param.Path
departmentList[i].ChargeUserIds = make([]int64, 0)
departmentList[i].Level = param.Level
departmentList[i].ParentId = param.ParentId
if len(param.ChargeUserIds) > 0 {
departmentList[i].ChargeUserIds = param.ChargeUserIds
}
continue
}
... ...
... ... @@ -156,6 +156,9 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error
newUser.AdminType = param.AdminType
newUser.Name = param.Name
newUser.Status = param.Status
newUser.PositionId = make([]int, 0)
newUser.DepartmentId = make([]int, 0)
newUser.UpdateAt = nowTime
if len(userList) > 0 {
_, err = userRepo.Update(newUser)
... ...
... ... @@ -11,5 +11,5 @@ type Company struct {
Status int //公司状态,1正常 2禁用
UpdateAt time.Time //更新时间
CreateAt time.Time //创建时间
DeleteAt *time.Time `bun:",soft_delete"` //删除时间
DeleteAt *time.Time `pg:",soft_delete"` //删除时间
}
... ...
... ... @@ -8,12 +8,12 @@ type Department struct {
tableName struct{} `pg:"department"`
Id int64 `pg:"pk:id"` // 组织id
CompanyId int64 // 公司编号
Level int // 组织级别
Level int `pg:",use_zero"` // 组织级别
Name string // 组织名称
ParentId int64 // 组织父级id
ParentId int64 `pg:",use_zero"` // 组织父级id
ChargeUserIds []int64 // 主管uids
Path string // 组织路径
CreateAt time.Time // 创建时间
UpdateAt time.Time // 更新时间
DeleteAt *time.Time `bun:",soft_delete"` // 删除时间
DeleteAt *time.Time `pg:",soft_delete"` // 删除时间
}
... ...
... ... @@ -6,11 +6,11 @@ type Positions struct {
Id int64 //ID
CompanyId int64 //公司ID
Name string //职位名称
ParentId int64 //父级职位
ParentId int64 `pg:",use_zero"` //父级职位
Path string //职位路径
Level int //层级
Level int `pg:",use_zero"` //层级
Remarks string //备注
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time `bun:",soft_delete"`
DeletedAt *time.Time `pg:",soft_delete"`
}
... ...
... ... @@ -16,5 +16,5 @@ type User struct {
PositionId []int // 用户职位
UpdateAt time.Time // 更新时间
CreateAt time.Time // 创建时间
DeleteAt *time.Time `bun:",soft_delete"` // 删除时间
DeleteAt *time.Time `pg:",soft_delete"` // 删除时间
}
... ...
... ... @@ -97,7 +97,7 @@ func (repo *UserRepository) FindOne(queryOptions map[string]interface{}) (*domai
func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*domain.User, error) {
tx := repo.transactionContext.PgTx
userModel := []models.User{}
query := tx.Model(&userModel).Where("delete_at isnull").
query := tx.Model(&userModel).Where("delete_at is null").
Limit(20)
if v, ok := queryOptions["id"]; ok {
query.Where("id=?", v)
... ...
... ... @@ -59,7 +59,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error {
err = companySrv.FromBusinessAdmin(&msgBody)
if err != nil {
log.Logger.Error("处理company消息失败"+err.Error(), map[string]interface{}{
"data": msgBody,
"module": msgBody.Module,
"action": msgBody.Action,
"data": string(msgBody.Data),
})
return err
}
... ... @@ -68,7 +70,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error {
err = departmentSrv.FromBusinessAdmin(&msgBody)
if err != nil {
log.Logger.Error("处理department消息失败"+err.Error(), map[string]interface{}{
"data": msgBody,
"module": msgBody.Module,
"action": msgBody.Action,
"data": string(msgBody.Data),
})
return err
}
... ... @@ -77,7 +81,9 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error {
err = employeeSrv.FromBusinessAdmin(&msgBody)
if err != nil {
log.Logger.Error("处理employee消息失败"+err.Error(), map[string]interface{}{
"data": msgBody,
"module": msgBody.Module,
"action": msgBody.Action,
"data": string(msgBody.Data),
})
return err
}
... ...