作者 郑周

1. 里程碑日志,状态优化

... ... @@ -1255,11 +1255,19 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
it.AssistLevel = v.AssistLevel // 更新上级辅导情况
it.AssistContent = v.AssistContent // 更新上级辅导内容
if v.TaskStageId == it.TaskStageCheck.Id { // 更新里程碑状态
it.TaskStageCheck.Status = v.Status
if v.Check == domain.TaskStageUncompleted {
it.TaskStageCheck.RealCompletedAt = 0
} else {
it.TaskStageCheck.RealCompletedAt = time.Now().Unix()
}
}
for j := range it.TaskStages {
if v.TaskStageId == it.TaskStages[j].Id { // 更新里程碑状态
it.TaskStages[j].Status = v.Status
if v.Check == domain.TaskStageUncompleted {
it.TaskStages[j].RealCompletedAt = 0
} else {
it.TaskStages[j].RealCompletedAt = time.Now().Unix()
}
}
}
_, err := taskRecordRepository.Insert(it)
... ...
... ... @@ -2,6 +2,13 @@ package domain
import "time"
type TaskStageCheck int
const (
TaskStageUncompleted TaskStageCheck = 0 // 里程碑未完成
TaskStageCompleted TaskStageCheck = 1 // 里程碑完成
)
// StaffAssessCache 填写评估数据(缓存暂未提交)
type StaffAssessCache struct {
Id int64 `json:"id,string" comment:"ID"`
... ... @@ -30,7 +37,7 @@ type AssessTaskStage struct {
Name string `json:"name"`
TaskRecordId int `json:"taskRecordId" comment:"任务记录ID"`
TaskStageId int `json:"taskStageId" comment:"里程碑ID"`
Status TaskStageState `json:"status" comment:"里程碑完成情况"`
Check TaskStageCheck `json:"check" comment:"里程碑完成情况"`
AssistLevel int `json:"assistLevel" comment:"上级辅导情况"`
AssistContent string `json:"assistContent" comment:"上级辅导内容"`
}
... ...
... ... @@ -2,26 +2,25 @@ package domain
import "time"
type TaskStageState int
const (
TaskStageUncompleted TaskStageState = 1 //里程碑未完成
TaskStageCompleted TaskStageState = 2 //里程碑完成
)
//type TaskStageState int
//
//const (
// TaskStageUncompleted TaskStageState = 1 //里程碑未完成
// TaskStageCompleted 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 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"` // 排序
PlanCompletedAt int64 `json:"planCompletedAt"` // 计划完成时间戳,秒
RealCompletedAt int64 `json:"realCompletedAt"` // 实际完成时间戳,秒
}
type TaskStageRepository interface {
Save(param []*TaskStage) error
... ...