正在显示
8 个修改的文件
包含
136 行增加
和
11 行删除
@@ -10,9 +10,9 @@ type MessagePersonal struct { | @@ -10,9 +10,9 @@ type MessagePersonal struct { | ||
10 | ReadFlag MessageReadFlag `json:"readFlag"` //1:已读、2:未读 | 10 | ReadFlag MessageReadFlag `json:"readFlag"` //1:已读、2:未读 |
11 | Title string `json:"title"` //消息的标题 | 11 | Title string `json:"title"` //消息的标题 |
12 | Content string `json:"content"` //消息的内容 | 12 | Content string `json:"content"` //消息的内容 |
13 | - CreatedAt time.Time `json:"createdAt"` | ||
14 | - UpdatedAt time.Time `json:"updatedAt"` | ||
15 | - Payload string `json:"payload"` //消息的额外承载的数据 | 13 | + CreatedAt time.Time `json:"createdAt"` // |
14 | + UpdatedAt time.Time `json:"updatedAt"` // | ||
15 | + Payload string `json:"payload"` //消息的额外承载的数据 | ||
16 | } | 16 | } |
17 | 17 | ||
18 | type MessageTypes string | 18 | type MessageTypes string |
@@ -2,16 +2,52 @@ package domain | @@ -2,16 +2,52 @@ package domain | ||
2 | 2 | ||
3 | import "time" | 3 | import "time" |
4 | 4 | ||
5 | +type TaskState int | ||
6 | + | ||
7 | +const ( | ||
8 | + TaskRunning TaskState = 1 //任务启动中 | ||
9 | + TaskStop TaskState = 2 //任务停止 | ||
10 | +) | ||
11 | + | ||
5 | // 任务 | 12 | // 任务 |
6 | type Task struct { | 13 | type Task struct { |
7 | - Id int | ||
8 | - Name string | ||
9 | - StageList []TaskStage | 14 | + Id int `json:"id"` |
15 | + CreatedAt time.Time `json:"createdAt"` | ||
16 | + UpdatedAt time.Time `json:"updatedAt"` | ||
17 | + DeletedAt time.Time `json:"deletedAt"` | ||
18 | + Name string `json:"name"` // 任务名称 | ||
19 | + Leader TaskLeader `json:"leader"` // 任务负责人 | ||
20 | + Status TaskState `json:"status"` // 任务的状态 | ||
21 | + StageList []TaskStage `json:"stageList"` // 里程碑 | ||
22 | + Level int `json:"level"` // 优先级,值越小优先级越高 | ||
23 | + LevalName string `json:"levalName"` // 优先级名称 | ||
24 | +} | ||
25 | + | ||
26 | +type TaskLeader struct { | ||
27 | + Id int64 `json:"id,string"` // 用户Id | ||
28 | + Account string `json:"account"` // 用户账号 | ||
29 | + Name string `json:"name"` // 用户姓名 | ||
30 | +} | ||
31 | + | ||
32 | +// 设置任务的优先级 | ||
33 | +func (t *Task) ApplyLevelName(name string) { | ||
34 | + t.LevalName = name | ||
35 | + switch name { | ||
36 | + case "战略任务": | ||
37 | + t.Level = 1 | ||
38 | + case "重点任务": | ||
39 | + t.Level = 2 | ||
40 | + case "常规任务": | ||
41 | + t.Level = 3 | ||
42 | + default: | ||
43 | + t.Level = 999 | ||
44 | + } | ||
10 | } | 45 | } |
11 | 46 | ||
12 | -// 任务阶段 | ||
13 | -type TaskStage struct { | ||
14 | - Id int | ||
15 | - Name string | ||
16 | - PlanCompleteAt time.Time | 47 | +type TaskRepository interface { |
48 | + Save(param *Task) error | ||
49 | + Remove(id int) error | ||
50 | + FindOne(queryOptions map[string]interface{}) (*Task, error) | ||
51 | + Find(queryOptions map[string]interface{}) (int, []*Task, error) | ||
52 | + RemoveStage(stageData TaskStage) | ||
17 | } | 53 | } |
pkg/domain/task_ignore.go
0 → 100644
1 | package domain | 1 | package domain |
2 | + | ||
3 | +import "time" | ||
4 | + | ||
5 | +type TaskStageState int | ||
6 | + | ||
7 | +const ( | ||
8 | + TaskStageComplated TaskStageState = 1 //里程碑未完成 | ||
9 | + TaskStageUncompleted TaskStageState = 2 //里程碑完成 | ||
10 | +) | ||
11 | + | ||
12 | +// 任务阶段 | ||
13 | +type TaskStage struct { | ||
14 | + Id int `json:"id"` | ||
15 | + TaskId int `json:"taskId"` | ||
16 | + CreatedAt time.Time `json:"createdAt"` | ||
17 | + UpdatedAt time.Time `json:"updatedAt"` | ||
18 | + DeletedAt time.Time `json:"deletedAt"` | ||
19 | + Name string `json:"name"` //里程碑名称 | ||
20 | + SortBy int `json:"sortBy"` //排序 | ||
21 | + Status TaskStageState `json:"status"` //里程碑完成情况 | ||
22 | + PlanCompletedAt time.Time `json:"planCompletedAt"` //计划完成时间 | ||
23 | + RealCompletedAt time.Time `json:"realCompletedAt"` //时间完成时间 | ||
24 | +} |
pkg/infrastructure/pg/models/task.go
0 → 100644
1 | +package models | ||
2 | + | ||
3 | +import ( | ||
4 | + "time" | ||
5 | + | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
7 | +) | ||
8 | + | ||
9 | +// 任务 | ||
10 | +type Task struct { | ||
11 | + tableName struct{} `comment:"任务" pg:"task"` | ||
12 | + Id int `pg:"id,pk"` | ||
13 | + CreatedAt time.Time `pg:"created_at"` | ||
14 | + UpdatedAt time.Time `pg:"updated_at"` | ||
15 | + DeletedAt time.Time `pg:"deleted_at"` | ||
16 | + Name string `pg:"name"` // 任务名称 | ||
17 | + Leader domain.TaskLeader `pg:"leader"` // 任务负责人 | ||
18 | + Status int `pg:"status"` // 任务的状态 | ||
19 | + StageList []domain.TaskStage `pg:"stage_list"` // 里程碑 | ||
20 | + Level int `pg:"level"` // 优先级,值越小优先级越高 | ||
21 | + LevalName string `pg:"leval_name"` // 优先级名称 | ||
22 | +} |
pkg/infrastructure/pg/models/task_ignore.go
0 → 100644
pkg/infrastructure/pg/models/task_stage.go
0 → 100644
1 | +package models | ||
2 | + | ||
3 | +import "time" | ||
4 | + | ||
5 | +// 任务阶段 | ||
6 | +type TaskStage struct { | ||
7 | + tableName struct{} `comment:"任务阶段" pg:"task_stage"` | ||
8 | + Id int `pg:"id"` | ||
9 | + TaskId int `pg:"task_id"` | ||
10 | + CreatedAt time.Time `pg:"created_at"` | ||
11 | + UpdatedAt time.Time `pg:"updated_at"` | ||
12 | + DeletedAt time.Time `pg:"deleted_at"` | ||
13 | + Name string `pg:"name"` //里程碑名称 | ||
14 | + SortBy int `pg:"sort_by"` //排序 | ||
15 | + Status int `pg:"status"` //里程碑完成情况 | ||
16 | + PlanCompletedAt time.Time `pg:"plan_completed_at"` //计划完成时间 | ||
17 | + RealCompletedAt time.Time `pg:"real_completed_at"` //时间完成时间 | ||
18 | +} |
-
请 注册 或 登录 后发表评论