...
|
...
|
@@ -307,6 +307,19 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
//检查leaderid
|
|
|
|
|
|
_, leaderList, err := userRepo.Find(map[string]interface{}{"id": param.LeaderId, "limit": 1})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(leaderList) == 0 {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "负责人数据验证不通过")
|
|
|
}
|
|
|
if leaderList[0].CompanyId != int64(param.CompanyId) {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "负责人数据验证不通过")
|
|
|
}
|
|
|
//更新任务的相关人员
|
|
|
relatedUserIds := []int{}
|
|
|
for _, val := range param.RelatedUserId {
|
...
|
...
|
@@ -374,17 +387,12 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
oldStage.SortBy = i + 1
|
|
|
oldStage.Name = val2.Name
|
|
|
oldStage.SetPlanCompleted(t)
|
|
|
//if ok := oldStage.SetPlanCompleted(t); ok {
|
|
|
//markStage = append(markStage, *oldStage)
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
stageList = append(stageList, newStageList...)
|
|
|
//查询是否已经有每日评估
|
|
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
for _, v := range stageList {
|
|
|
if v.DeletedAt != nil {
|
|
|
cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
...
|
...
|
@@ -405,6 +413,13 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if taskData.CreatedBy == 1 {
|
|
|
taskData.Leader = domain.TaskLeader{
|
|
|
Id: leaderList[0].Id,
|
|
|
Account: leaderList[0].Account,
|
|
|
Name: leaderList[0].Name,
|
|
|
}
|
|
|
}
|
|
|
taskData.SetCurrentStage(stageList)
|
|
|
taskData.SetSortBy(param.SortBy)
|
|
|
//处理endTime
|
...
|
...
|
@@ -413,7 +428,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
} else {
|
|
|
taskData.EndTime = dayEndTime(time.Unix(param.EndTime, 10)).Unix()
|
|
|
}
|
|
|
|
|
|
taskData.UseEndTime = param.UseEndtime
|
|
|
taskData.AssistFlagMax = param.AssistFlagMax
|
|
|
err = taskRepo.Save(taskData)
|
...
|
...
|
@@ -575,7 +589,6 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
},
|
|
|
Status: int(taskData.Status),
|
|
|
StatusDescription: taskData.Status.Named(),
|
|
|
// Level: taskData.Level,
|
|
|
LevelName: taskData.LevelName,
|
|
|
SortBy: int(taskData.SortBy),
|
|
|
EndTime: taskData.EndTime,
|
...
|
...
|
@@ -584,6 +597,7 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
RelatedUser: []adapter.UserData{},
|
|
|
StageList: []adapter.TaskStage{},
|
|
|
AssistFlagMax: taskData.AssistFlagMax,
|
|
|
CreatedBy: taskData.CreatedBy,
|
|
|
}
|
|
|
for _, val := range relatedUserList {
|
|
|
idStr := strconv.Itoa(int(val.Id))
|
...
|
...
|
|