作者 唐旭辉

修复错误

... ... @@ -200,6 +200,7 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error {
"Remarks": data.User.Remarks,
"ChargeStatus": data.User.ChargeStatus,
"EntryTime": entryTime,
"AdminType": data.User.AdminType,
})
err = companyRespository.Edit(&oldCompany)
if err != nil {
... ... @@ -240,7 +241,7 @@ func (service SyncCompanyService) updateCompanyCharge(data CompanyCharge) error
})
for i := range oldUsers {
_ = oldUsers[i].Update(map[string]interface{}{
"charge_status": domain.UserIsNotCompanyCharge,
"ChargeStatus": domain.UserIsNotCompanyCharge,
})
err = userRespository.Edit(&oldUsers[i])
if err != nil {
... ... @@ -256,7 +257,7 @@ func (service SyncCompanyService) updateCompanyCharge(data CompanyCharge) error
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("获取用户(id=%d)的数据失败:%s", v, err.Error()))
}
_ = userToUpdate.Update(map[string]interface{}{
"charge_status": domain.UserIsCompanyCharge,
"ChargeStatus": domain.UserIsCompanyCharge,
})
err = userRespository.Edit(&userToUpdate)
if err != nil {
... ...
... ... @@ -192,6 +192,7 @@ func (service SyncEmployeeService) addEmployeeData(datas []EmployeeData) error {
ChargeStatus: data.ChargeStatus,
Permission: []domain.AdminPermissionBase{}, //初始化权限
AccessPartners: []domain.Partner{}, //默认初始化
AdminType: data.AdminType,
}
newUser.EntryTime, _ = time.Parse("2006-01-02", data.EntryTime)
if err = usersRepository.Add(&newUser); err != nil {
... ... @@ -244,6 +245,7 @@ func (service SyncEmployeeService) updateEmployeeData(datas []EmployeeData) erro
"Remarks": data.Remarks,
"ChargeStatus": data.ChargeStatus,
"EntryTime": entryTime,
"AdminType": data.AdminType,
})
if err = usersRepository.Edit(&oldUser); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -369,14 +371,14 @@ func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdmin
}
err = usersRepository.Edit(&oldSuperUser)
if err != nil {
e := fmt.Sprintf("更新公司主管user数据(id=%d)",
oldSuperUser.Id)
e := fmt.Sprintf("更新公司主管user数据(id=%d)失败:%s",
oldSuperUser.Id, err)
return lib.ThrowError(lib.BUSINESS_ERROR, e)
}
err = usersRepository.Edit(&newSuperUser)
if err != nil {
e := fmt.Sprintf("更新公司主管user数据(id=%d)",
newSuperUser.Id)
e := fmt.Sprintf("更新公司主管user数据(id=%d)失败:%s",
newSuperUser.Id, err)
return lib.ThrowError(lib.BUSINESS_ERROR, e)
}
err = transactionContext.CommitTransaction()
... ...
... ... @@ -12,6 +12,7 @@ type SyncAction interface {
}
//actionMap 数据同步需要的动作集合,静态不要在运行时变更这里的数据
//position:职位,department:部门,employee:员工,company:公司
var actionMap = map[string]SyncAction{
// "department":
// "position":
... ...
... ... @@ -35,7 +35,7 @@ func (dao *AdminUserDao) UpdatePassword(id int64, pwd string) error {
return err
}
//UpdatePassword ....
//UpdateIsUsable ....
func (dao *AdminUserDao) UpdateIsUsable(id int64, isUsable bool) error {
tx := dao.transactionContext.PgDd
m := &models.AdminUser{}
... ...