作者 tangxvhui

暂存

... ... @@ -10,8 +10,8 @@ type MessagePersonal struct {
ReadFlag MessageReadFlag `json:"readFlag"` //1:已读、2:未读
Title string `json:"title"` //消息的标题
Content string `json:"content"` //消息的内容
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"` //
UpdatedAt time.Time `json:"updatedAt"` //
Payload string `json:"payload"` //消息的额外承载的数据
}
... ...
... ... @@ -2,16 +2,52 @@ package domain
import "time"
type TaskState int
const (
TaskRunning TaskState = 1 //任务启动中
TaskStop TaskState = 2 //任务停止
)
// 任务
type Task struct {
Id int
Name string
StageList []TaskStage
Id int `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt time.Time `json:"deletedAt"`
Name string `json:"name"` // 任务名称
Leader TaskLeader `json:"leader"` // 任务负责人
Status TaskState `json:"status"` // 任务的状态
StageList []TaskStage `json:"stageList"` // 里程碑
Level int `json:"level"` // 优先级,值越小优先级越高
LevalName string `json:"levalName"` // 优先级名称
}
type TaskLeader struct {
Id int64 `json:"id,string"` // 用户Id
Account string `json:"account"` // 用户账号
Name string `json:"name"` // 用户姓名
}
// 设置任务的优先级
func (t *Task) ApplyLevelName(name string) {
t.LevalName = name
switch name {
case "战略任务":
t.Level = 1
case "重点任务":
t.Level = 2
case "常规任务":
t.Level = 3
default:
t.Level = 999
}
}
// 任务阶段
type TaskStage struct {
Id int
Name string
PlanCompleteAt time.Time
type TaskRepository interface {
Save(param *Task) error
Remove(id int) error
FindOne(queryOptions map[string]interface{}) (*Task, error)
Find(queryOptions map[string]interface{}) (int, []*Task, error)
RemoveStage(stageData TaskStage)
}
... ...
package domain
import "time"
// 不关注的任务列表
type TaskIgnore struct {
Id int `json:"id"`
TaskId int `json:"taskId"`
UserId int `json:"userId"`
CreatedAt time.Time `json:"-"`
}
... ...
package domain
import "time"
type TaskStageState int
const (
TaskStageComplated TaskStageState = 1 //里程碑未完成
TaskStageUncompleted TaskStageState = 2 //里程碑完成
)
// 任务阶段
type TaskStage struct {
Id int `json:"id"`
TaskId int `json:"taskId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt time.Time `json:"deletedAt"`
Name string `json:"name"` //里程碑名称
SortBy int `json:"sortBy"` //排序
Status TaskStageState `json:"status"` //里程碑完成情况
PlanCompletedAt time.Time `json:"planCompletedAt"` //计划完成时间
RealCompletedAt time.Time `json:"realCompletedAt"` //时间完成时间
}
... ...
package models
import (
"time"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
// 任务
type Task struct {
tableName struct{} `comment:"任务" pg:"task"`
Id int `pg:"id,pk"`
CreatedAt time.Time `pg:"created_at"`
UpdatedAt time.Time `pg:"updated_at"`
DeletedAt time.Time `pg:"deleted_at"`
Name string `pg:"name"` // 任务名称
Leader domain.TaskLeader `pg:"leader"` // 任务负责人
Status int `pg:"status"` // 任务的状态
StageList []domain.TaskStage `pg:"stage_list"` // 里程碑
Level int `pg:"level"` // 优先级,值越小优先级越高
LevalName string `pg:"leval_name"` // 优先级名称
}
... ...
package models
import "time"
// 不关注的任务列表
type TaskIgnore struct {
tableName struct{} `comment:"不关注的任务列表" pg:"task_ignore"`
Id int `pg:"id"`
TaskId int `pg:"task_id"`
UserId int `pg:"user_id"`
CreatedAt time.Time `pg:"created_at"`
}
... ...
package models
import "time"
// 任务阶段
type TaskStage struct {
tableName struct{} `comment:"任务阶段" pg:"task_stage"`
Id int `pg:"id"`
TaskId int `pg:"task_id"`
CreatedAt time.Time `pg:"created_at"`
UpdatedAt time.Time `pg:"updated_at"`
DeletedAt time.Time `pg:"deleted_at"`
Name string `pg:"name"` //里程碑名称
SortBy int `pg:"sort_by"` //排序
Status int `pg:"status"` //里程碑完成情况
PlanCompletedAt time.Time `pg:"plan_completed_at"` //计划完成时间
RealCompletedAt time.Time `pg:"real_completed_at"` //时间完成时间
}
... ...