作者 tangxvhui

修复评估任务数据查询后字段映射错误

... ... @@ -154,13 +154,14 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery)
}
if len(assessInviteData) > 0 {
stepItem.Status = string(domain.StaffAssessCompleted)
} else {
stepItem.Status = string(domain.StaffAssessUncompleted)
}
//待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
if len(assessInviteData) > 5 {
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
} else {
stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
stepItem.Status = string(domain.StaffAssessUncompleted)
}
case domain.LinkNodeAllAssessment:
//我评估别人,被邀请评估
... ... @@ -352,88 +353,6 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
}
nowTime := time.Now()
// _, assassessTaskList, err := assessTaskRepo.Find(map[string]interface{}{
// "evaluationProjectId": param.EvaluationProjectId,
// "beginDay": taskBeginTime.Local().Format("2006-01-02"),
// })
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询同日期同项目已存在的评估任务"+err.Error())
// }
// var assessTaskData *domain.StaffAssessTask
// //更新旧数据或者新建数据
// if len(assassessTaskList) > 0 {
// assessTaskData = assassessTaskList[0]
// assessTaskData.UpdatedAt = nowTime
// } else {
// //建立新的评估任务
// assessTaskData = &domain.StaffAssessTask{
// Id: 0,
// CompanyId: param.CompanyId,
// EvaluationProjectId: param.EvaluationProjectId,
// EvaluationProjectName: param.EvaluationProjectName,
// CycleId: param.CycleId,
// CycleName: param.CycleName,
// BeginTime: taskBeginTime,
// EndTime: taskEndTime,
// StepList: []domain.AssessTaskStep{},
// ExecutorId: []int{},
// CreatedAt: nowTime,
// UpdatedAt: nowTime,
// DeletedAt: nil,
// BeginDay: taskBeginTime.Local().Format("2006-01-02"),
// }
// }
// executorIds := []int{} //提取评估的参与人id
// executorIdMap := map[int]struct{}{} //过滤重复的用户
// //从入参中提取参与人
// for _, v := range param.ExecutorId {
// if _, ok := executorIdMap[v]; ok {
// continue
// }
// executorIdMap[v] = struct{}{}
// executorIds = append(executorIds, v)
// }
// //就数据中提取参与人
// for _, v := range assessTaskData.ExecutorId {
// if _, ok := executorIdMap[v]; ok {
// continue
// }
// executorIdMap[v] = struct{}{}
// executorIds = append(executorIds, v)
// }
// //填入新的参与人id
// assessTaskData.ExecutorId = executorIds
// //填充新的评估环节
// loop:
// for _, v := range param.StepList {
// for _, vv := range assessTaskData.StepList {
// if vv.LinkNodeId == v.LinkNodeId {
// continue loop
// }
// }
// stepBeginTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.BeginTime, time.Local)
// if err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, "评估环节开始时间填写错误,"+param.BeginTime)
// }
// stepEndTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.EndTime, time.Local)
// if err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, "评估环节结束时间填写错误,"+param.EndTime)
// }
// step := domain.AssessTaskStep{
// SortBy: v.SortBy,
// LinkNodeId: v.LinkNodeId,
// LinkNodeName: v.LinkNodeName,
// LinkNodeType: v.LinkNodeType,
// BeginTime: stepBeginTime,
// EndTime: stepEndTime,
// }
// assessTaskData.StepList = append(assessTaskData.StepList, step)
// }
// //排序流程环节
// stepList := domain.SortTaskStep(assessTaskData.StepList)
// sort.Sort(stepList)
// assessTaskData.StepList = stepList
assessTaskData := &domain.StaffAssessTask{
Id: 0,
CompanyId: param.CompanyId,
... ... @@ -1782,12 +1701,14 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
continue
}
v.Value = item.Value
//填入评估值描述
reteResult, err := v.Rule.ScoreOrRating(&v.Value)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
if len(item.Value) > 0 {
//填入评估值描述
reteResult, err := v.Rule.ScoreOrRating(&v.Value)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
v.ReteResult = reteResult
}
v.ReteResult = reteResult
for ii := range v.Remark {
for _, vvv := range item.Remark {
if v.Remark[ii].Title == vvv.Title {
... ...
... ... @@ -39,8 +39,8 @@ func (repo *StaffAssessRepository) TransformToDomain(d *models.StaffAssess) *dom
Status: domain.StaffAssessStatus(d.Status),
BeginTime: d.BeginTime,
EndTime: d.EndTime,
CreatedAt: d.EndTime,
UpdatedAt: d.CreatedAt,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
DeletedAt: d.DeletedAt,
}
}
... ...