作者 tangxvhui

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

@@ -154,13 +154,14 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) @@ -154,13 +154,14 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery)
154 } 154 }
155 if len(assessInviteData) > 0 { 155 if len(assessInviteData) > 0 {
156 stepItem.Status = string(domain.StaffAssessCompleted) 156 stepItem.Status = string(domain.StaffAssessCompleted)
  157 + } else {
  158 + stepItem.Status = string(domain.StaffAssessUncompleted)
157 } 159 }
158 //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可 160 //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
159 if len(assessInviteData) > 5 { 161 if len(assessInviteData) > 5 {
160 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) 162 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
161 } else { 163 } else {
162 stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData)) 164 stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
163 - stepItem.Status = string(domain.StaffAssessUncompleted)  
164 } 165 }
165 case domain.LinkNodeAllAssessment: 166 case domain.LinkNodeAllAssessment:
166 //我评估别人,被邀请评估 167 //我评估别人,被邀请评估
@@ -352,88 +353,6 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat @@ -352,88 +353,6 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
352 } 353 }
353 nowTime := time.Now() 354 nowTime := time.Now()
354 355
355 - // _, assassessTaskList, err := assessTaskRepo.Find(map[string]interface{}{  
356 - // "evaluationProjectId": param.EvaluationProjectId,  
357 - // "beginDay": taskBeginTime.Local().Format("2006-01-02"),  
358 - // })  
359 - // if err != nil {  
360 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询同日期同项目已存在的评估任务"+err.Error())  
361 - // }  
362 - // var assessTaskData *domain.StaffAssessTask  
363 - // //更新旧数据或者新建数据  
364 - // if len(assassessTaskList) > 0 {  
365 - // assessTaskData = assassessTaskList[0]  
366 - // assessTaskData.UpdatedAt = nowTime  
367 - // } else {  
368 - // //建立新的评估任务  
369 - // assessTaskData = &domain.StaffAssessTask{  
370 - // Id: 0,  
371 - // CompanyId: param.CompanyId,  
372 - // EvaluationProjectId: param.EvaluationProjectId,  
373 - // EvaluationProjectName: param.EvaluationProjectName,  
374 - // CycleId: param.CycleId,  
375 - // CycleName: param.CycleName,  
376 - // BeginTime: taskBeginTime,  
377 - // EndTime: taskEndTime,  
378 - // StepList: []domain.AssessTaskStep{},  
379 - // ExecutorId: []int{},  
380 - // CreatedAt: nowTime,  
381 - // UpdatedAt: nowTime,  
382 - // DeletedAt: nil,  
383 - // BeginDay: taskBeginTime.Local().Format("2006-01-02"),  
384 - // }  
385 - // }  
386 - // executorIds := []int{} //提取评估的参与人id  
387 - // executorIdMap := map[int]struct{}{} //过滤重复的用户  
388 - // //从入参中提取参与人  
389 - // for _, v := range param.ExecutorId {  
390 - // if _, ok := executorIdMap[v]; ok {  
391 - // continue  
392 - // }  
393 - // executorIdMap[v] = struct{}{}  
394 - // executorIds = append(executorIds, v)  
395 - // }  
396 - // //就数据中提取参与人  
397 - // for _, v := range assessTaskData.ExecutorId {  
398 - // if _, ok := executorIdMap[v]; ok {  
399 - // continue  
400 - // }  
401 - // executorIdMap[v] = struct{}{}  
402 - // executorIds = append(executorIds, v)  
403 - // }  
404 - // //填入新的参与人id  
405 - // assessTaskData.ExecutorId = executorIds  
406 - // //填充新的评估环节  
407 - // loop:  
408 - // for _, v := range param.StepList {  
409 - // for _, vv := range assessTaskData.StepList {  
410 - // if vv.LinkNodeId == v.LinkNodeId {  
411 - // continue loop  
412 - // }  
413 - // }  
414 - // stepBeginTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.BeginTime, time.Local)  
415 - // if err != nil {  
416 - // return nil, application.ThrowError(application.ARG_ERROR, "评估环节开始时间填写错误,"+param.BeginTime)  
417 - // }  
418 - // stepEndTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.EndTime, time.Local)  
419 - // if err != nil {  
420 - // return nil, application.ThrowError(application.ARG_ERROR, "评估环节结束时间填写错误,"+param.EndTime)  
421 - // }  
422 - // step := domain.AssessTaskStep{  
423 - // SortBy: v.SortBy,  
424 - // LinkNodeId: v.LinkNodeId,  
425 - // LinkNodeName: v.LinkNodeName,  
426 - // LinkNodeType: v.LinkNodeType,  
427 - // BeginTime: stepBeginTime,  
428 - // EndTime: stepEndTime,  
429 - // }  
430 - // assessTaskData.StepList = append(assessTaskData.StepList, step)  
431 - // }  
432 - // //排序流程环节  
433 - // stepList := domain.SortTaskStep(assessTaskData.StepList)  
434 - // sort.Sort(stepList)  
435 - // assessTaskData.StepList = stepList  
436 -  
437 assessTaskData := &domain.StaffAssessTask{ 356 assessTaskData := &domain.StaffAssessTask{
438 Id: 0, 357 Id: 0,
439 CompanyId: param.CompanyId, 358 CompanyId: param.CompanyId,
@@ -1782,12 +1701,14 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1782,12 +1701,14 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1782 continue 1701 continue
1783 } 1702 }
1784 v.Value = item.Value 1703 v.Value = item.Value
1785 - //填入评估值描述  
1786 - reteResult, err := v.Rule.ScoreOrRating(&v.Value)  
1787 - if err != nil {  
1788 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 1704 + if len(item.Value) > 0 {
  1705 + //填入评估值描述
  1706 + reteResult, err := v.Rule.ScoreOrRating(&v.Value)
  1707 + if err != nil {
  1708 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  1709 + }
  1710 + v.ReteResult = reteResult
1789 } 1711 }
1790 - v.ReteResult = reteResult  
1791 for ii := range v.Remark { 1712 for ii := range v.Remark {
1792 for _, vvv := range item.Remark { 1713 for _, vvv := range item.Remark {
1793 if v.Remark[ii].Title == vvv.Title { 1714 if v.Remark[ii].Title == vvv.Title {
@@ -39,8 +39,8 @@ func (repo *StaffAssessRepository) TransformToDomain(d *models.StaffAssess) *dom @@ -39,8 +39,8 @@ func (repo *StaffAssessRepository) TransformToDomain(d *models.StaffAssess) *dom
39 Status: domain.StaffAssessStatus(d.Status), 39 Status: domain.StaffAssessStatus(d.Status),
40 BeginTime: d.BeginTime, 40 BeginTime: d.BeginTime,
41 EndTime: d.EndTime, 41 EndTime: d.EndTime,
42 - CreatedAt: d.EndTime,  
43 - UpdatedAt: d.CreatedAt, 42 + CreatedAt: d.CreatedAt,
  43 + UpdatedAt: d.UpdatedAt,
44 DeletedAt: d.DeletedAt, 44 DeletedAt: d.DeletedAt,
45 } 45 }
46 } 46 }