作者 tangxvhui

日常保存

@@ -122,7 +122,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont @@ -122,7 +122,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
122 TaskId: newTask.Id, 122 TaskId: newTask.Id,
123 Name: "里程碑1", 123 Name: "里程碑1",
124 SortBy: 1, 124 SortBy: 1,
125 - Status: domain.TaskStageUncompleted,  
126 PlanCompletedAt: nowEndTime.Add(30 * 24 * time.Hour).Unix(), 125 PlanCompletedAt: nowEndTime.Add(30 * 24 * time.Hour).Unix(),
127 RealCompletedAt: 0, 126 RealCompletedAt: 0,
128 }, 127 },
@@ -131,7 +130,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont @@ -131,7 +130,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
131 TaskId: newTask.Id, 130 TaskId: newTask.Id,
132 Name: "里程碑2", 131 Name: "里程碑2",
133 SortBy: 2, 132 SortBy: 2,
134 - Status: domain.TaskStageUncompleted,  
135 PlanCompletedAt: nowEndTime.Add(60 * 24 * time.Hour).Unix(), 133 PlanCompletedAt: nowEndTime.Add(60 * 24 * time.Hour).Unix(),
136 RealCompletedAt: 0, 134 RealCompletedAt: 0,
137 }, 135 },
@@ -140,7 +138,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont @@ -140,7 +138,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
140 TaskId: newTask.Id, 138 TaskId: newTask.Id,
141 Name: "里程碑3", 139 Name: "里程碑3",
142 SortBy: 3, 140 SortBy: 3,
143 - Status: domain.TaskStageUncompleted,  
144 PlanCompletedAt: nowEndTime.Add(90 * 24 * time.Hour).Unix(), 141 PlanCompletedAt: nowEndTime.Add(90 * 24 * time.Hour).Unix(),
145 RealCompletedAt: 0, 142 RealCompletedAt: 0,
146 }, 143 },
@@ -251,7 +248,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] @@ -251,7 +248,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]
251 TaskId: taskData.Id, 248 TaskId: taskData.Id,
252 Name: val2.Name, 249 Name: val2.Name,
253 SortBy: i + 1, 250 SortBy: i + 1,
254 - Status: domain.TaskStageUncompleted,  
255 PlanCompletedAt: t.Unix(), 251 PlanCompletedAt: t.Unix(),
256 RealCompletedAt: 0, 252 RealCompletedAt: 0,
257 } 253 }
@@ -378,7 +374,6 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task @@ -378,7 +374,6 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task
378 RealCompletedAt: t2, 374 RealCompletedAt: t2,
379 SortBy: val.SortBy, 375 SortBy: val.SortBy,
380 StatusDescription: val.StatusDescription(), 376 StatusDescription: val.StatusDescription(),
381 - Status: int(val.Status),  
382 }) 377 })
383 } 378 }
384 return &result, nil 379 return &result, nil
@@ -540,7 +535,6 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte @@ -540,7 +535,6 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
540 Id: val.Id, 535 Id: val.Id,
541 Name: val.Name, 536 Name: val.Name,
542 StatusDescription: val.StatusDescription(), 537 StatusDescription: val.StatusDescription(),
543 - Status: int(val.Status),  
544 SortBy: val.SortBy, 538 SortBy: val.SortBy,
545 } 539 }
546 switch val.SortBy { 540 switch val.SortBy {
@@ -817,7 +811,6 @@ func (t TaskService) ReplyTaskStage(transactionContext application.TransactionCo @@ -817,7 +811,6 @@ func (t TaskService) ReplyTaskStage(transactionContext application.TransactionCo
817 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务里程碑数据"+err.Error()) 811 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务里程碑数据"+err.Error())
818 } 812 }
819 if len(stageList) > 0 { 813 if len(stageList) > 0 {
820 - stageList[0].Status = val.TaskStageCheck.Status  
821 stageList[0].RealCompletedAt = val.TaskStageCheck.RealCompletedAt 814 stageList[0].RealCompletedAt = val.TaskStageCheck.RealCompletedAt
822 taskStages = append(taskStages, stageList[0]) 815 taskStages = append(taskStages, stageList[0])
823 } 816 }
@@ -15,10 +15,13 @@ type MessagePersonal struct { @@ -15,10 +15,13 @@ type MessagePersonal struct {
15 Payload string `json:"payload"` //消息的额外承载的数据 15 Payload string `json:"payload"` //消息的额外承载的数据
16 } 16 }
17 17
  18 +// 个人的消息提示类型
18 type MessageTypes string 19 type MessageTypes string
19 20
20 const ( 21 const (
21 - MessageTypesOther MessageTypes = "other" 22 + MessageTypesOther MessageTypes = "other" //综合自评开启时,消息通知
  23 + MessageTypesTaskStage MessageTypes = "task_stage" //任务里程碑未按时完成
  24 + MessageTypesTaskRecord MessageTypes = "task_record" //任务每日反馈异常
22 ) 25 )
23 26
24 type MessageReadFlag string 27 type MessageReadFlag string
@@ -12,16 +12,16 @@ const ( @@ -12,16 +12,16 @@ const (
12 12
13 // 任务阶段 13 // 任务阶段
14 type TaskStage struct { 14 type TaskStage struct {
15 - Id int `json:"id"`  
16 - TaskId int `json:"taskId"`  
17 - CreatedAt time.Time `json:"createdAt"`  
18 - UpdatedAt time.Time `json:"updatedAt"`  
19 - DeletedAt *time.Time `json:"deletedAt"`  
20 - Name string `json:"name"` //里程碑名称  
21 - SortBy int `json:"sortBy"` //排序  
22 - Status TaskStageState `json:"status"` //里程碑完成情况  
23 - PlanCompletedAt int64 `json:"planCompletedAt"` //计划完成时间戳,秒  
24 - RealCompletedAt int64 `json:"realCompletedAt"` //时间完成时间戳,秒 15 + Id int `json:"id"`
  16 + TaskId int `json:"taskId"`
  17 + CreatedAt time.Time `json:"createdAt"`
  18 + UpdatedAt time.Time `json:"updatedAt"`
  19 + DeletedAt *time.Time `json:"deletedAt"`
  20 + Name string `json:"name"` //里程碑名称
  21 + SortBy int `json:"sortBy"` //排序
  22 + // Status TaskStageState `json:"status"` //里程碑完成情况
  23 + PlanCompletedAt int64 `json:"planCompletedAt"` //计划完成时间戳,秒
  24 + RealCompletedAt int64 `json:"realCompletedAt"` //时间完成时间戳,秒
25 } 25 }
26 type TaskStageRepository interface { 26 type TaskStageRepository interface {
27 Save(param []*TaskStage) error 27 Save(param []*TaskStage) error
@@ -36,14 +36,14 @@ func (t TaskStage) StatusDescription() string { @@ -36,14 +36,14 @@ func (t TaskStage) StatusDescription() string {
36 nowTime, _ := time.ParseInLocation("2006-01-02", nowDay, time.Local) 36 nowTime, _ := time.ParseInLocation("2006-01-02", nowDay, time.Local)
37 37
38 str := "" 38 str := ""
39 - switch t.Status {  
40 - case TaskStageUncompleted: 39 + switch t.RealCompletedAt {
  40 + case 0:
41 if nowTime.Unix() > t.PlanCompletedAt { 41 if nowTime.Unix() > t.PlanCompletedAt {
42 str = "已逾期" 42 str = "已逾期"
43 } else { 43 } else {
44 str = "未完成" 44 str = "未完成"
45 } 45 }
46 - case TaskStageCompleted: 46 + default:
47 if t.PlanCompletedAt >= t.RealCompletedAt { 47 if t.PlanCompletedAt >= t.RealCompletedAt {
48 str = "已完成" 48 str = "已完成"
49 } else { 49 } else {
@@ -12,7 +12,6 @@ type TaskStage struct { @@ -12,7 +12,6 @@ type TaskStage struct {
12 DeletedAt *time.Time `pg:"deleted_at"` 12 DeletedAt *time.Time `pg:"deleted_at"`
13 Name string `pg:"name"` //里程碑名称 13 Name string `pg:"name"` //里程碑名称
14 SortBy int `pg:"sort_by"` //排序 14 SortBy int `pg:"sort_by"` //排序
15 - Status int `pg:"status"` //里程碑完成情况  
16 PlanCompletedAt int64 `pg:"plan_completed_at,use_zero"` //计划完成时间 15 PlanCompletedAt int64 `pg:"plan_completed_at,use_zero"` //计划完成时间
17 RealCompletedAt int64 `pg:"real_completed_at,use_zero"` //时间完成时间 16 RealCompletedAt int64 `pg:"real_completed_at,use_zero"` //时间完成时间
18 } 17 }
@@ -28,9 +28,9 @@ func (repo *MessagePersonalRepository) TransformToDomain(param *models.MessagePe @@ -28,9 +28,9 @@ func (repo *MessagePersonalRepository) TransformToDomain(param *models.MessagePe
28 ReadFlag: domain.MessageReadFlag(param.ReadFlag), 28 ReadFlag: domain.MessageReadFlag(param.ReadFlag),
29 Title: param.Title, 29 Title: param.Title,
30 Content: param.Content, 30 Content: param.Content,
31 - Payload: param.Payload,  
32 - UpdatedAt: param.UpdatedAt,  
33 CreatedAt: param.CreatedAt, 31 CreatedAt: param.CreatedAt,
  32 + UpdatedAt: param.UpdatedAt,
  33 + Payload: param.Payload,
34 } 34 }
35 } 35 }
36 36
@@ -32,7 +32,6 @@ func (repo *TaskStageRepository) TransformToDomain(d *models.TaskStage) *domain. @@ -32,7 +32,6 @@ func (repo *TaskStageRepository) TransformToDomain(d *models.TaskStage) *domain.
32 DeletedAt: d.DeletedAt, 32 DeletedAt: d.DeletedAt,
33 Name: d.Name, 33 Name: d.Name,
34 SortBy: d.SortBy, 34 SortBy: d.SortBy,
35 - Status: domain.TaskStageState(d.Status),  
36 PlanCompletedAt: d.PlanCompletedAt, 35 PlanCompletedAt: d.PlanCompletedAt,
37 RealCompletedAt: d.RealCompletedAt, 36 RealCompletedAt: d.RealCompletedAt,
38 } 37 }
@@ -50,7 +49,6 @@ func (repo *TaskStageRepository) Save(param []*domain.TaskStage) error { @@ -50,7 +49,6 @@ func (repo *TaskStageRepository) Save(param []*domain.TaskStage) error {
50 DeletedAt: val.DeletedAt, 49 DeletedAt: val.DeletedAt,
51 Name: val.Name, 50 Name: val.Name,
52 SortBy: val.SortBy, 51 SortBy: val.SortBy,
53 - Status: int(val.Status),  
54 PlanCompletedAt: val.PlanCompletedAt, 52 PlanCompletedAt: val.PlanCompletedAt,
55 RealCompletedAt: val.RealCompletedAt, 53 RealCompletedAt: val.RealCompletedAt,
56 } 54 }