作者 tangxvhui

修复一些bug

... ... @@ -623,30 +623,28 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m
if err != nil {
return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(taskList) == 0 {
return map[string]interface{}{"have": false}, nil
}
taskData := taskList[0]
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{"transactionContext": transactionContext})
// 获取员工的评估
today := time.Now().Format("2006-01-02")
_, assessList, err := assessReps.Find(map[string]interface{}{
"companyId": param.CompanyId,
"executorId": taskData.Leader.Id,
"beginDay": today,
"typesList": []string{string(domain.AssessSelf)},
"limit": 1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
var assessList []*domain.StaffAssess
if len(taskList) > 0 {
_, assessList, err = assessReps.Find(map[string]interface{}{
"companyId": param.CompanyId,
"executorId": taskList[0].Leader.Id,
"beginDay": today,
"typesList": []string{string(domain.AssessSelf)},
"limit": 1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
}
}
taskRecordReps := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
var taskRecordId int
var cycleId int
var executorId int
if len(assessList) > 0 {
_, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": taskData.Id})
_, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": anomalyData.TaskId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的评估"+err.Error())
}
... ... @@ -1029,15 +1027,6 @@ func (srv TaskService) MarkTaskAnomalyByTask(param *command.MarkTaskAnomalyComma
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(anomalyList) == 0 {
return map[string]interface{}{
"have": false,
"cycleId": "0",
"beginDay": "",
"taskRecordId": "0",
"userId": "0",
}, nil
}
for _, val := range anomalyList {
switch param.MarkType {
case "a":
... ...