作者 yangfu

登录优化

@@ -668,20 +668,25 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs @@ -668,20 +668,25 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs
668 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 668 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
669 } 669 }
670 var ( 670 var (
671 - companys []dto.CompanyItem  
672 - orgs []dto.OrgItem 671 + companys []dto.CompanyItem
  672 + orgs []dto.OrgItem
  673 + mapCompany = make(map[int]interface{})
673 ) 674 )
674 675
675 - for _, v := range result.Users {  
676 - companys = append(companys, dto.CompanyItem{  
677 - CompanyId: v.Company.CompanyId,  
678 - CompanyName: v.Company.CompanyName,  
679 - })  
680 - for _, vv := range v.UserOrg { 676 + for i := range result.Users {
  677 + user := result.Users[i]
  678 + if _, ok := mapCompany[user.Company.CompanyId]; !ok {
  679 + companys = append(companys, dto.CompanyItem{
  680 + CompanyId: user.Company.CompanyId,
  681 + CompanyName: user.Company.CompanyName,
  682 + })
  683 + }
  684 + for j := range user.UserOrg {
  685 + org := user.UserOrg[j]
681 orgs = append(orgs, dto.OrgItem{ 686 orgs = append(orgs, dto.OrgItem{
682 - OrganizationId: vv.OrgID,  
683 - OrganizationName: vv.OrgName,  
684 - CompanyId: v.Company.CompanyId, 687 + OrganizationId: org.OrgID,
  688 + OrganizationName: org.OrgName,
  689 + CompanyId: user.Company.CompanyId,
685 }) 690 })
686 } 691 }
687 } 692 }
@@ -56,7 +56,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -56,7 +56,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
56 var cooperationModes = make([]interface{}, 0) 56 var cooperationModes = make([]interface{}, 0)
57 if len(modeNumbers) > 0 { 57 if len(modeNumbers) > 0 {
58 models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{ 58 models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{
59 - PageSize: 20, 59 + PageSize: domain.NormalQueryRowCount,
60 PageNumber: 1, 60 PageNumber: 1,
61 //CompanyId: cmd.Operator.CompanyId, 61 //CompanyId: cmd.Operator.CompanyId,
62 //OrgId: cmd.Operator.OrgId, 62 //OrgId: cmd.Operator.OrgId,
@@ -88,8 +88,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -88,8 +88,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
88 projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 88 projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
89 PageNumber: 1, 89 PageNumber: 1,
90 PageSize: 1, 90 PageSize: 1,
91 - //CompanyId: cmd.Operator.CompanyId,  
92 - OrgId: cmd.Operator.OrgId, 91 + CompanyId: cmd.Operator.CompanyId,
  92 + OrgId: cmd.Operator.OrgId,
93 }) 93 })
94 if err != nil { 94 if err != nil {
95 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 95 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -43,3 +43,8 @@ const ( @@ -43,3 +43,8 @@ const (
43 OrgStatusEnable = 1 43 OrgStatusEnable = 1
44 OrgStatusDisable = 2 44 OrgStatusDisable = 2
45 ) 45 )
  46 +
  47 +const (
  48 + MaxQueryRowCount = 1000
  49 + NormalQueryRowCount = 100
  50 +)