作者 tangxvhui

日常保存

... ... @@ -122,7 +122,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
TaskId: newTask.Id,
Name: "里程碑1",
SortBy: 1,
Status: domain.TaskStageUncompleted,
PlanCompletedAt: nowEndTime.Add(30 * 24 * time.Hour).Unix(),
RealCompletedAt: 0,
},
... ... @@ -131,7 +130,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
TaskId: newTask.Id,
Name: "里程碑2",
SortBy: 2,
Status: domain.TaskStageUncompleted,
PlanCompletedAt: nowEndTime.Add(60 * 24 * time.Hour).Unix(),
RealCompletedAt: 0,
},
... ... @@ -140,7 +138,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
TaskId: newTask.Id,
Name: "里程碑3",
SortBy: 3,
Status: domain.TaskStageUncompleted,
PlanCompletedAt: nowEndTime.Add(90 * 24 * time.Hour).Unix(),
RealCompletedAt: 0,
},
... ... @@ -251,7 +248,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]
TaskId: taskData.Id,
Name: val2.Name,
SortBy: i + 1,
Status: domain.TaskStageUncompleted,
PlanCompletedAt: t.Unix(),
RealCompletedAt: 0,
}
... ... @@ -378,7 +374,6 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task
RealCompletedAt: t2,
SortBy: val.SortBy,
StatusDescription: val.StatusDescription(),
Status: int(val.Status),
})
}
return &result, nil
... ... @@ -540,7 +535,6 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
Id: val.Id,
Name: val.Name,
StatusDescription: val.StatusDescription(),
Status: int(val.Status),
SortBy: val.SortBy,
}
switch val.SortBy {
... ... @@ -817,7 +811,6 @@ func (t TaskService) ReplyTaskStage(transactionContext application.TransactionCo
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务里程碑数据"+err.Error())
}
if len(stageList) > 0 {
stageList[0].Status = val.TaskStageCheck.Status
stageList[0].RealCompletedAt = val.TaskStageCheck.RealCompletedAt
taskStages = append(taskStages, stageList[0])
}
... ...
... ... @@ -15,10 +15,13 @@ type MessagePersonal struct {
Payload string `json:"payload"` //消息的额外承载的数据
}
// 个人的消息提示类型
type MessageTypes string
const (
MessageTypesOther MessageTypes = "other"
MessageTypesOther MessageTypes = "other" //综合自评开启时,消息通知
MessageTypesTaskStage MessageTypes = "task_stage" //任务里程碑未按时完成
MessageTypesTaskRecord MessageTypes = "task_record" //任务每日反馈异常
)
type MessageReadFlag string
... ...
... ... @@ -12,16 +12,16 @@ const (
// 任务阶段
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 int64 `json:"planCompletedAt"` //计划完成时间戳,秒
RealCompletedAt int64 `json:"realCompletedAt"` //时间完成时间戳,秒
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 int64 `json:"planCompletedAt"` //计划完成时间戳,秒
RealCompletedAt int64 `json:"realCompletedAt"` //时间完成时间戳,秒
}
type TaskStageRepository interface {
Save(param []*TaskStage) error
... ... @@ -36,14 +36,14 @@ func (t TaskStage) StatusDescription() string {
nowTime, _ := time.ParseInLocation("2006-01-02", nowDay, time.Local)
str := ""
switch t.Status {
case TaskStageUncompleted:
switch t.RealCompletedAt {
case 0:
if nowTime.Unix() > t.PlanCompletedAt {
str = "已逾期"
} else {
str = "未完成"
}
case TaskStageCompleted:
default:
if t.PlanCompletedAt >= t.RealCompletedAt {
str = "已完成"
} else {
... ...
... ... @@ -12,7 +12,6 @@ type TaskStage struct {
DeletedAt *time.Time `pg:"deleted_at"`
Name string `pg:"name"` //里程碑名称
SortBy int `pg:"sort_by"` //排序
Status int `pg:"status"` //里程碑完成情况
PlanCompletedAt int64 `pg:"plan_completed_at,use_zero"` //计划完成时间
RealCompletedAt int64 `pg:"real_completed_at,use_zero"` //时间完成时间
}
... ...
... ... @@ -28,9 +28,9 @@ func (repo *MessagePersonalRepository) TransformToDomain(param *models.MessagePe
ReadFlag: domain.MessageReadFlag(param.ReadFlag),
Title: param.Title,
Content: param.Content,
Payload: param.Payload,
UpdatedAt: param.UpdatedAt,
CreatedAt: param.CreatedAt,
UpdatedAt: param.UpdatedAt,
Payload: param.Payload,
}
}
... ...
... ... @@ -32,7 +32,6 @@ func (repo *TaskStageRepository) TransformToDomain(d *models.TaskStage) *domain.
DeletedAt: d.DeletedAt,
Name: d.Name,
SortBy: d.SortBy,
Status: domain.TaskStageState(d.Status),
PlanCompletedAt: d.PlanCompletedAt,
RealCompletedAt: d.RealCompletedAt,
}
... ... @@ -50,7 +49,6 @@ func (repo *TaskStageRepository) Save(param []*domain.TaskStage) error {
DeletedAt: val.DeletedAt,
Name: val.Name,
SortBy: val.SortBy,
Status: int(val.Status),
PlanCompletedAt: val.PlanCompletedAt,
RealCompletedAt: val.RealCompletedAt,
}
... ...