作者 tangxvhui

处理掉一些逻辑错误

... ... @@ -4,21 +4,21 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
// 评估信息详情
type EvaluationInfoAdapter struct {
SummaryEvaluationId int `json:"summaryEvaluationId"` //
CycleId int `json:"cycleId,string"` //周期id
CycleName string `json:"cycleName"` //周期名称
EvaluationProjectId int `json:"evaluationProjectId"` //项目id
EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
LinkNodeId int `json:"linkNodeId,string"` //评估环节id
BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
TargetUserId int `json:"targetUserId"` //被评估的目标用户,被执行的
TargetUserName string `json:"targetUserName"` //
CompanyLogo string `json:"companyLogo,string,"` //公司logo
CompanyName string `json:"companyName"` //公司名称
SupperUser string `json:"superUser"` //目标用户的上级
DutyTime string `json:"dutyTime"` //入职时间
Status string `json:"status"` //完成状态
SummaryEvaluationId int `json:"summaryEvaluationId,string"` //
CycleId int `json:"cycleId,string"` //周期id
CycleName string `json:"cycleName"` //周期名称
EvaluationProjectId int `json:"evaluationProjectId"` //项目id
EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
LinkNodeId int `json:"linkNodeId,string"` //评估环节id
BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
TargetUserId int `json:"targetUserId"` //被评估的目标用户,被执行的
TargetUserName string `json:"targetUserName"` //
CompanyLogo string `json:"companyLogo,string,"` //公司logo
CompanyName string `json:"companyName"` //公司名称
SupperUser string `json:"superUser"` //目标用户的上级
DutyTime string `json:"dutyTime"` //入职时间
Status string `json:"status"` //完成状态
EvaluationItems []EvaluationItemAdapter `json:"evaluationItems"`
}
... ... @@ -51,21 +51,21 @@ type LevalCodeCount struct {
// 评估任务的基本信息
type EvaluationBaseAdapter struct {
SummaryEvaluationId int `json:"summaryEvaluationId"` //
CycleId int `json:"cycleId,string"` //周期id
CycleName string `json:"cycleName"` //周期名称
EvaluationProjectId int `json:"evaluationProjectId"` //项目id
EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
LinkNodeId int `json:"linkNodeId,string"` //评估环节id
BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
TargetUserId int `json:"targetUserId"` //被评估的目标用户,被执行的
TargetUserName string `json:"targetUserName"` //
CompanyLogo string `json:"companyLogo,string,"` //公司logo
CompanyName string `json:"companyName"` //公司名称
SupperUser string `json:"superUser"` //目标用户的上级
DutyTime string `json:"dutyTime"` //入职时间
Status string `json:"status"` //完成状态
SummaryEvaluationId int `json:"summaryEvaluationId,string"` //
CycleId int `json:"cycleId,string"` //周期id
CycleName string `json:"cycleName"` //周期名称
EvaluationProjectId int `json:"evaluationProjectId"` //项目id
EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
LinkNodeId int `json:"linkNodeId,string"` //评估环节id
BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
TargetUserId int `json:"targetUserId"` //被评估的目标用户,被执行的
TargetUserName string `json:"targetUserName"` //
CompanyLogo string `json:"companyLogo,"` //公司logo
CompanyName string `json:"companyName"` //公司名称
SupperUser string `json:"superUser"` //目标用户的上级
DutyTime string `json:"dutyTime"` //入职时间
Status string `json:"status"` //完成状态
}
// 自评估内容详情
... ...
... ... @@ -90,6 +90,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
//查找我的绩效
_, selfEvaluation, err := evaluationRepo.Find(map[string]interface{}{
"types": int(domain.EvaluationSelf),
"cycleId": param.CycleId,
"executorId": param.UserId,
"limit": 1,
})
... ... @@ -101,6 +102,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
"types": int(domain.Evaluation360),
"executorId": param.UserId,
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
})
if err != nil {
... ... @@ -108,9 +110,10 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
}
//查询上级评估,统计未完成
cntSuper, _, err := evaluationRepo.Find(map[string]interface{}{
"types": int(domain.EvaluationSelf),
"types": int(domain.EvaluationSuper),
"executorId": param.UserId,
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
})
if err != nil {
... ... @@ -121,6 +124,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
"types": int(domain.EvaluationHrbp),
"executorId": param.UserId,
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
})
if err != nil {
... ...
... ... @@ -42,6 +42,9 @@ func (itemValue *SummaryEvaluationValue) SummaryEvaluationScore() error {
}
func (itemValue *SummaryEvaluationValue) SumScore() (float64, error) {
if len(itemValue.Value) == 0 {
return 0, nil
}
if itemValue.Types == EvaluationHrbp {
valueFloat, err := strconv.ParseFloat(itemValue.Value, 64)
if err != nil {
... ...
... ... @@ -4,9 +4,9 @@ import "testing"
func TestGenerateToken(t *testing.T) {
ut := UserAuth{
CompanyId: 526,
UserId: 3330346066045952,
Phone: "15980201153",
CompanyId: 8,
UserId: 3422174102828544,
Phone: "17708397664",
PlatformId: 29,
AdminType: 1,
}
... ...
... ... @@ -47,7 +47,7 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int,
}
condition = append(condition, offset, limit)
sqlStr += ` offset ? limit ? `
sqlStr += ` order by summary_evaluation.cycle_id desc offset ? limit ? `
result := []PersonalCycle{}
_, err := tx.Query(&result, sqlStr, condition...)
return result, err
... ...
... ... @@ -75,7 +75,7 @@ func (repo *SummaryEvaluationRepository) Save(param *domain.SummaryEvaluation) e
}
} else {
m.UpdatedAt = time.Now()
_, err := db.Model(&m).Update()
_, err := db.Model(&m).WherePK().Update()
if err != nil {
return err
}
... ...
... ... @@ -59,7 +59,7 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
}
} else {
m.UpdatedAt = time.Now()
_, err := db.Model(&m).Update()
_, err := db.Model(&m).WherePK().Update()
if err != nil {
return err
}
... ...