作者 唐旭辉

修复错误

@@ -200,6 +200,7 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error { @@ -200,6 +200,7 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error {
200 "Remarks": data.User.Remarks, 200 "Remarks": data.User.Remarks,
201 "ChargeStatus": data.User.ChargeStatus, 201 "ChargeStatus": data.User.ChargeStatus,
202 "EntryTime": entryTime, 202 "EntryTime": entryTime,
  203 + "AdminType": data.User.AdminType,
203 }) 204 })
204 err = companyRespository.Edit(&oldCompany) 205 err = companyRespository.Edit(&oldCompany)
205 if err != nil { 206 if err != nil {
@@ -240,7 +241,7 @@ func (service SyncCompanyService) updateCompanyCharge(data CompanyCharge) error @@ -240,7 +241,7 @@ func (service SyncCompanyService) updateCompanyCharge(data CompanyCharge) error
240 }) 241 })
241 for i := range oldUsers { 242 for i := range oldUsers {
242 _ = oldUsers[i].Update(map[string]interface{}{ 243 _ = oldUsers[i].Update(map[string]interface{}{
243 - "charge_status": domain.UserIsNotCompanyCharge, 244 + "ChargeStatus": domain.UserIsNotCompanyCharge,
244 }) 245 })
245 err = userRespository.Edit(&oldUsers[i]) 246 err = userRespository.Edit(&oldUsers[i])
246 if err != nil { 247 if err != nil {
@@ -256,7 +257,7 @@ func (service SyncCompanyService) updateCompanyCharge(data CompanyCharge) error @@ -256,7 +257,7 @@ func (service SyncCompanyService) updateCompanyCharge(data CompanyCharge) error
256 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("获取用户(id=%d)的数据失败:%s", v, err.Error())) 257 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("获取用户(id=%d)的数据失败:%s", v, err.Error()))
257 } 258 }
258 _ = userToUpdate.Update(map[string]interface{}{ 259 _ = userToUpdate.Update(map[string]interface{}{
259 - "charge_status": domain.UserIsCompanyCharge, 260 + "ChargeStatus": domain.UserIsCompanyCharge,
260 }) 261 })
261 err = userRespository.Edit(&userToUpdate) 262 err = userRespository.Edit(&userToUpdate)
262 if err != nil { 263 if err != nil {
@@ -192,6 +192,7 @@ func (service SyncEmployeeService) addEmployeeData(datas []EmployeeData) error { @@ -192,6 +192,7 @@ func (service SyncEmployeeService) addEmployeeData(datas []EmployeeData) error {
192 ChargeStatus: data.ChargeStatus, 192 ChargeStatus: data.ChargeStatus,
193 Permission: []domain.AdminPermissionBase{}, //初始化权限 193 Permission: []domain.AdminPermissionBase{}, //初始化权限
194 AccessPartners: []domain.Partner{}, //默认初始化 194 AccessPartners: []domain.Partner{}, //默认初始化
  195 + AdminType: data.AdminType,
195 } 196 }
196 newUser.EntryTime, _ = time.Parse("2006-01-02", data.EntryTime) 197 newUser.EntryTime, _ = time.Parse("2006-01-02", data.EntryTime)
197 if err = usersRepository.Add(&newUser); err != nil { 198 if err = usersRepository.Add(&newUser); err != nil {
@@ -244,6 +245,7 @@ func (service SyncEmployeeService) updateEmployeeData(datas []EmployeeData) erro @@ -244,6 +245,7 @@ func (service SyncEmployeeService) updateEmployeeData(datas []EmployeeData) erro
244 "Remarks": data.Remarks, 245 "Remarks": data.Remarks,
245 "ChargeStatus": data.ChargeStatus, 246 "ChargeStatus": data.ChargeStatus,
246 "EntryTime": entryTime, 247 "EntryTime": entryTime,
  248 + "AdminType": data.AdminType,
247 }) 249 })
248 if err = usersRepository.Edit(&oldUser); err != nil { 250 if err = usersRepository.Edit(&oldUser); err != nil {
249 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 251 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
@@ -369,14 +371,14 @@ func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdmin @@ -369,14 +371,14 @@ func (service SyncEmployeeService) ChangeSuperAdmin(cmd command.ChanceSuperAdmin
369 } 371 }
370 err = usersRepository.Edit(&oldSuperUser) 372 err = usersRepository.Edit(&oldSuperUser)
371 if err != nil { 373 if err != nil {
372 - e := fmt.Sprintf("更新公司主管user数据(id=%d)",  
373 - oldSuperUser.Id) 374 + e := fmt.Sprintf("更新公司主管user数据(id=%d)失败:%s",
  375 + oldSuperUser.Id, err)
374 return lib.ThrowError(lib.BUSINESS_ERROR, e) 376 return lib.ThrowError(lib.BUSINESS_ERROR, e)
375 } 377 }
376 err = usersRepository.Edit(&newSuperUser) 378 err = usersRepository.Edit(&newSuperUser)
377 if err != nil { 379 if err != nil {
378 - e := fmt.Sprintf("更新公司主管user数据(id=%d)",  
379 - newSuperUser.Id) 380 + e := fmt.Sprintf("更新公司主管user数据(id=%d)失败:%s",
  381 + newSuperUser.Id, err)
380 return lib.ThrowError(lib.BUSINESS_ERROR, e) 382 return lib.ThrowError(lib.BUSINESS_ERROR, e)
381 } 383 }
382 err = transactionContext.CommitTransaction() 384 err = transactionContext.CommitTransaction()
@@ -12,6 +12,7 @@ type SyncAction interface { @@ -12,6 +12,7 @@ type SyncAction interface {
12 } 12 }
13 13
14 //actionMap 数据同步需要的动作集合,静态不要在运行时变更这里的数据 14 //actionMap 数据同步需要的动作集合,静态不要在运行时变更这里的数据
  15 +//position:职位,department:部门,employee:员工,company:公司
15 var actionMap = map[string]SyncAction{ 16 var actionMap = map[string]SyncAction{
16 // "department": 17 // "department":
17 // "position": 18 // "position":
@@ -35,7 +35,7 @@ func (dao *AdminUserDao) UpdatePassword(id int64, pwd string) error { @@ -35,7 +35,7 @@ func (dao *AdminUserDao) UpdatePassword(id int64, pwd string) error {
35 return err 35 return err
36 } 36 }
37 37
38 -//UpdatePassword .... 38 +//UpdateIsUsable ....
39 func (dao *AdminUserDao) UpdateIsUsable(id int64, isUsable bool) error { 39 func (dao *AdminUserDao) UpdateIsUsable(id int64, isUsable bool) error {
40 tx := dao.transactionContext.PgDd 40 tx := dao.transactionContext.PgDd
41 m := &models.AdminUser{} 41 m := &models.AdminUser{}