|
@@ -307,6 +307,19 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
@@ -307,6 +307,19 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
307
|
if err != nil {
|
307
|
if err != nil {
|
308
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
308
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
309
|
}
|
309
|
}
|
|
|
310
|
+
|
|
|
311
|
+ //检查leaderid
|
|
|
312
|
+
|
|
|
313
|
+ _, leaderList, err := userRepo.Find(map[string]interface{}{"id": param.LeaderId, "limit": 1})
|
|
|
314
|
+ if err != nil {
|
|
|
315
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
316
|
+ }
|
|
|
317
|
+ if len(leaderList) == 0 {
|
|
|
318
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "负责人数据验证不通过")
|
|
|
319
|
+ }
|
|
|
320
|
+ if leaderList[0].CompanyId != int64(param.CompanyId) {
|
|
|
321
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "负责人数据验证不通过")
|
|
|
322
|
+ }
|
310
|
//更新任务的相关人员
|
323
|
//更新任务的相关人员
|
311
|
relatedUserIds := []int{}
|
324
|
relatedUserIds := []int{}
|
312
|
for _, val := range param.RelatedUserId {
|
325
|
for _, val := range param.RelatedUserId {
|
|
@@ -374,17 +387,12 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
@@ -374,17 +387,12 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
374
|
oldStage.SortBy = i + 1
|
387
|
oldStage.SortBy = i + 1
|
375
|
oldStage.Name = val2.Name
|
388
|
oldStage.Name = val2.Name
|
376
|
oldStage.SetPlanCompleted(t)
|
389
|
oldStage.SetPlanCompleted(t)
|
377
|
- //if ok := oldStage.SetPlanCompleted(t); ok {
|
|
|
378
|
- //markStage = append(markStage, *oldStage)
|
|
|
379
|
- // }
|
|
|
380
|
}
|
390
|
}
|
381
|
-
|
|
|
382
|
stageList = append(stageList, newStageList...)
|
391
|
stageList = append(stageList, newStageList...)
|
383
|
//查询是否已经有每日评估
|
392
|
//查询是否已经有每日评估
|
384
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
393
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
385
|
"transactionContext": transactionContext,
|
394
|
"transactionContext": transactionContext,
|
386
|
})
|
395
|
})
|
387
|
-
|
|
|
388
|
for _, v := range stageList {
|
396
|
for _, v := range stageList {
|
389
|
if v.DeletedAt != nil {
|
397
|
if v.DeletedAt != nil {
|
390
|
cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
398
|
cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
@@ -405,6 +413,13 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
@@ -405,6 +413,13 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
405
|
if err != nil {
|
413
|
if err != nil {
|
406
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
414
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
407
|
}
|
415
|
}
|
|
|
416
|
+ if taskData.CreatedBy == 1 {
|
|
|
417
|
+ taskData.Leader = domain.TaskLeader{
|
|
|
418
|
+ Id: leaderList[0].Id,
|
|
|
419
|
+ Account: leaderList[0].Account,
|
|
|
420
|
+ Name: leaderList[0].Name,
|
|
|
421
|
+ }
|
|
|
422
|
+ }
|
408
|
taskData.SetCurrentStage(stageList)
|
423
|
taskData.SetCurrentStage(stageList)
|
409
|
taskData.SetSortBy(param.SortBy)
|
424
|
taskData.SetSortBy(param.SortBy)
|
410
|
//处理endTime
|
425
|
//处理endTime
|
|
@@ -413,7 +428,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
@@ -413,7 +428,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
413
|
} else {
|
428
|
} else {
|
414
|
taskData.EndTime = dayEndTime(time.Unix(param.EndTime, 10)).Unix()
|
429
|
taskData.EndTime = dayEndTime(time.Unix(param.EndTime, 10)).Unix()
|
415
|
}
|
430
|
}
|
416
|
-
|
|
|
417
|
taskData.UseEndTime = param.UseEndtime
|
431
|
taskData.UseEndTime = param.UseEndtime
|
418
|
taskData.AssistFlagMax = param.AssistFlagMax
|
432
|
taskData.AssistFlagMax = param.AssistFlagMax
|
419
|
err = taskRepo.Save(taskData)
|
433
|
err = taskRepo.Save(taskData)
|
|
@@ -575,15 +589,15 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
@@ -575,15 +589,15 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
575
|
},
|
589
|
},
|
576
|
Status: int(taskData.Status),
|
590
|
Status: int(taskData.Status),
|
577
|
StatusDescription: taskData.Status.Named(),
|
591
|
StatusDescription: taskData.Status.Named(),
|
578
|
- // Level: taskData.Level,
|
|
|
579
|
- LevelName: taskData.LevelName,
|
|
|
580
|
- SortBy: int(taskData.SortBy),
|
|
|
581
|
- EndTime: taskData.EndTime,
|
|
|
582
|
- UseEndtime: taskData.UseEndTime,
|
|
|
583
|
- RelatedUserId: []string{},
|
|
|
584
|
- RelatedUser: []adapter.UserData{},
|
|
|
585
|
- StageList: []adapter.TaskStage{},
|
|
|
586
|
- AssistFlagMax: taskData.AssistFlagMax,
|
592
|
+ LevelName: taskData.LevelName,
|
|
|
593
|
+ SortBy: int(taskData.SortBy),
|
|
|
594
|
+ EndTime: taskData.EndTime,
|
|
|
595
|
+ UseEndtime: taskData.UseEndTime,
|
|
|
596
|
+ RelatedUserId: []string{},
|
|
|
597
|
+ RelatedUser: []adapter.UserData{},
|
|
|
598
|
+ StageList: []adapter.TaskStage{},
|
|
|
599
|
+ AssistFlagMax: taskData.AssistFlagMax,
|
|
|
600
|
+ CreatedBy: taskData.CreatedBy,
|
587
|
}
|
601
|
}
|
588
|
for _, val := range relatedUserList {
|
602
|
for _, val := range relatedUserList {
|
589
|
idStr := strconv.Itoa(int(val.Id))
|
603
|
idStr := strconv.Itoa(int(val.Id))
|