作者 tangxvhui

处理掉一些逻辑错误

@@ -4,7 +4,7 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" @@ -4,7 +4,7 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
4 4
5 // 评估信息详情 5 // 评估信息详情
6 type EvaluationInfoAdapter struct { 6 type EvaluationInfoAdapter struct {
7 - SummaryEvaluationId int `json:"summaryEvaluationId"` // 7 + SummaryEvaluationId int `json:"summaryEvaluationId,string"` //
8 CycleId int `json:"cycleId,string"` //周期id 8 CycleId int `json:"cycleId,string"` //周期id
9 CycleName string `json:"cycleName"` //周期名称 9 CycleName string `json:"cycleName"` //周期名称
10 EvaluationProjectId int `json:"evaluationProjectId"` //项目id 10 EvaluationProjectId int `json:"evaluationProjectId"` //项目id
@@ -51,7 +51,7 @@ type LevalCodeCount struct { @@ -51,7 +51,7 @@ type LevalCodeCount struct {
51 51
52 // 评估任务的基本信息 52 // 评估任务的基本信息
53 type EvaluationBaseAdapter struct { 53 type EvaluationBaseAdapter struct {
54 - SummaryEvaluationId int `json:"summaryEvaluationId"` // 54 + SummaryEvaluationId int `json:"summaryEvaluationId,string"` //
55 CycleId int `json:"cycleId,string"` //周期id 55 CycleId int `json:"cycleId,string"` //周期id
56 CycleName string `json:"cycleName"` //周期名称 56 CycleName string `json:"cycleName"` //周期名称
57 EvaluationProjectId int `json:"evaluationProjectId"` //项目id 57 EvaluationProjectId int `json:"evaluationProjectId"` //项目id
@@ -61,7 +61,7 @@ type EvaluationBaseAdapter struct { @@ -61,7 +61,7 @@ type EvaluationBaseAdapter struct {
61 EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 61 EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
62 TargetUserId int `json:"targetUserId"` //被评估的目标用户,被执行的 62 TargetUserId int `json:"targetUserId"` //被评估的目标用户,被执行的
63 TargetUserName string `json:"targetUserName"` // 63 TargetUserName string `json:"targetUserName"` //
64 - CompanyLogo string `json:"companyLogo,string,"` //公司logo 64 + CompanyLogo string `json:"companyLogo,"` //公司logo
65 CompanyName string `json:"companyName"` //公司名称 65 CompanyName string `json:"companyName"` //公司名称
66 SupperUser string `json:"superUser"` //目标用户的上级 66 SupperUser string `json:"superUser"` //目标用户的上级
67 DutyTime string `json:"dutyTime"` //入职时间 67 DutyTime string `json:"dutyTime"` //入职时间
@@ -90,6 +90,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -90,6 +90,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
90 //查找我的绩效 90 //查找我的绩效
91 _, selfEvaluation, err := evaluationRepo.Find(map[string]interface{}{ 91 _, selfEvaluation, err := evaluationRepo.Find(map[string]interface{}{
92 "types": int(domain.EvaluationSelf), 92 "types": int(domain.EvaluationSelf),
  93 + "cycleId": param.CycleId,
93 "executorId": param.UserId, 94 "executorId": param.UserId,
94 "limit": 1, 95 "limit": 1,
95 }) 96 })
@@ -101,6 +102,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -101,6 +102,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
101 "types": int(domain.Evaluation360), 102 "types": int(domain.Evaluation360),
102 "executorId": param.UserId, 103 "executorId": param.UserId,
103 "limit": 1, 104 "limit": 1,
  105 + "cycleId": param.CycleId,
104 "status": string(domain.EvaluationUncompleted), 106 "status": string(domain.EvaluationUncompleted),
105 }) 107 })
106 if err != nil { 108 if err != nil {
@@ -108,9 +110,10 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -108,9 +110,10 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
108 } 110 }
109 //查询上级评估,统计未完成 111 //查询上级评估,统计未完成
110 cntSuper, _, err := evaluationRepo.Find(map[string]interface{}{ 112 cntSuper, _, err := evaluationRepo.Find(map[string]interface{}{
111 - "types": int(domain.EvaluationSelf), 113 + "types": int(domain.EvaluationSuper),
112 "executorId": param.UserId, 114 "executorId": param.UserId,
113 "limit": 1, 115 "limit": 1,
  116 + "cycleId": param.CycleId,
114 "status": string(domain.EvaluationUncompleted), 117 "status": string(domain.EvaluationUncompleted),
115 }) 118 })
116 if err != nil { 119 if err != nil {
@@ -121,6 +124,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -121,6 +124,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
121 "types": int(domain.EvaluationHrbp), 124 "types": int(domain.EvaluationHrbp),
122 "executorId": param.UserId, 125 "executorId": param.UserId,
123 "limit": 1, 126 "limit": 1,
  127 + "cycleId": param.CycleId,
124 "status": string(domain.EvaluationUncompleted), 128 "status": string(domain.EvaluationUncompleted),
125 }) 129 })
126 if err != nil { 130 if err != nil {
@@ -42,6 +42,9 @@ func (itemValue *SummaryEvaluationValue) SummaryEvaluationScore() error { @@ -42,6 +42,9 @@ func (itemValue *SummaryEvaluationValue) SummaryEvaluationScore() error {
42 } 42 }
43 43
44 func (itemValue *SummaryEvaluationValue) SumScore() (float64, error) { 44 func (itemValue *SummaryEvaluationValue) SumScore() (float64, error) {
  45 + if len(itemValue.Value) == 0 {
  46 + return 0, nil
  47 + }
45 if itemValue.Types == EvaluationHrbp { 48 if itemValue.Types == EvaluationHrbp {
46 valueFloat, err := strconv.ParseFloat(itemValue.Value, 64) 49 valueFloat, err := strconv.ParseFloat(itemValue.Value, 64)
47 if err != nil { 50 if err != nil {
@@ -4,9 +4,9 @@ import "testing" @@ -4,9 +4,9 @@ import "testing"
4 4
5 func TestGenerateToken(t *testing.T) { 5 func TestGenerateToken(t *testing.T) {
6 ut := UserAuth{ 6 ut := UserAuth{
7 - CompanyId: 526,  
8 - UserId: 3330346066045952,  
9 - Phone: "15980201153", 7 + CompanyId: 8,
  8 + UserId: 3422174102828544,
  9 + Phone: "17708397664",
10 PlatformId: 29, 10 PlatformId: 29,
11 AdminType: 1, 11 AdminType: 1,
12 } 12 }
@@ -47,7 +47,7 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, @@ -47,7 +47,7 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int,
47 } 47 }
48 48
49 condition = append(condition, offset, limit) 49 condition = append(condition, offset, limit)
50 - sqlStr += ` offset ? limit ? ` 50 + sqlStr += ` order by summary_evaluation.cycle_id desc offset ? limit ? `
51 result := []PersonalCycle{} 51 result := []PersonalCycle{}
52 _, err := tx.Query(&result, sqlStr, condition...) 52 _, err := tx.Query(&result, sqlStr, condition...)
53 return result, err 53 return result, err
@@ -75,7 +75,7 @@ func (repo *SummaryEvaluationRepository) Save(param *domain.SummaryEvaluation) e @@ -75,7 +75,7 @@ func (repo *SummaryEvaluationRepository) Save(param *domain.SummaryEvaluation) e
75 } 75 }
76 } else { 76 } else {
77 m.UpdatedAt = time.Now() 77 m.UpdatedAt = time.Now()
78 - _, err := db.Model(&m).Update() 78 + _, err := db.Model(&m).WherePK().Update()
79 if err != nil { 79 if err != nil {
80 return err 80 return err
81 } 81 }
@@ -59,7 +59,7 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati @@ -59,7 +59,7 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
59 } 59 }
60 } else { 60 } else {
61 m.UpdatedAt = time.Now() 61 m.UpdatedAt = time.Now()
62 - _, err := db.Model(&m).Update() 62 + _, err := db.Model(&m).WherePK().Update()
63 if err != nil { 63 if err != nil {
64 return err 64 return err
65 } 65 }