作者 tangxvhui

调整 TaskStageState 的值

package adapter
type TaskInfoAdapter struct {
Id int `json:"id,string"`
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
LeaderId int64 `json:"leaderId,string"` //
Leader UserData `json:"leader"` // 任务负责人
Status int `json:"status"` // 任务的状态
StatusDescript string `json:"statusDescript"` //
Level int `json:"level"` // 优先级,值越小优先级越高
LevalName string `json:"levalName"` // 优先级名称
RelatedUserId []string `json:"relatedUserId"` // 相关的员工id
RelatedUser []UserData `json:"relatedUser"` // 相关的员工id
StageList []TaskStage `json:"stageList"`
Id int `json:"id,string"`
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
LeaderId int64 `json:"leaderId,string"` //
Leader UserData `json:"leader"` // 任务负责人
Status int `json:"status"` // 任务的状态
StatusDescription string `json:"statusDescription"` //
Level int `json:"level"` // 优先级,值越小优先级越高
LevalName string `json:"levalName"` // 优先级名称
RelatedUserId []string `json:"relatedUserId"` // 相关的员工id
RelatedUser []UserData `json:"relatedUser"` // 相关的员工id
StageList []TaskStage `json:"stageList"`
}
type UserData struct {
... ... @@ -22,11 +22,11 @@ type UserData struct {
}
type TaskStage struct {
Id int `json:"id,string"`
Name string `json:"name"` //里程碑名称
StatusDescript string `json:"statusDescript"` //里程碑的完成情况
Status int `json:"status"` //里程碑状态
SortBy int `json:"sortBy"`
PlanCompletedAt string `json:"planCompletedAt"` //计划完成时间, 例:2006-01-02
RealCompletedAt string `json:"realCompletedAt"` //实际完成时间, 例:2006-01-02
Id int `json:"id,string"`
Name string `json:"name"` //里程碑名称
StatusDescription string `json:"statusDescription"` //里程碑的完成情况
Status int `json:"status"` //里程碑状态
SortBy int `json:"sortBy"`
PlanCompletedAt string `json:"planCompletedAt"` //计划完成时间, 例:2006-01-02
RealCompletedAt string `json:"realCompletedAt"` //实际完成时间, 例:2006-01-02
}
... ...
... ... @@ -338,13 +338,13 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task
Account: taskData.Leader.Account,
Name: taskData.Leader.Name,
},
Status: int(taskData.Status),
StatusDescript: taskData.StatusDescript(),
Level: taskData.Level,
LevalName: taskData.LevelName,
RelatedUserId: []string{},
RelatedUser: []adapter.UserData{},
StageList: []adapter.TaskStage{},
Status: int(taskData.Status),
StatusDescription: taskData.StatusDescription(),
Level: taskData.Level,
LevalName: taskData.LevelName,
RelatedUserId: []string{},
RelatedUser: []adapter.UserData{},
StageList: []adapter.TaskStage{},
}
for _, val := range relatedUserList {
idStr := strconv.Itoa(int(val.Id))
... ... @@ -366,13 +366,13 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task
t2 = time.Unix(val.RealCompletedAt, 0).Local().Format("2006-01-02")
}
result.StageList = append(result.StageList, adapter.TaskStage{
Id: val.Id,
Name: val.Name,
PlanCompletedAt: t1,
RealCompletedAt: t2,
SortBy: val.SortBy,
StatusDescript: val.StatusDescript(),
Status: int(val.Status),
Id: val.Id,
Name: val.Name,
PlanCompletedAt: t1,
RealCompletedAt: t2,
SortBy: val.SortBy,
StatusDescription: val.StatusDescription(),
Status: int(val.Status),
})
}
return &result, nil
... ... @@ -531,11 +531,11 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
continue
}
stage := adapter.TaskStage{
Id: val.Id,
Name: val.Name,
StatusDescript: val.StatusDescript(),
Status: int(val.Status),
SortBy: val.SortBy,
Id: val.Id,
Name: val.Name,
StatusDescription: val.StatusDescription(),
Status: int(val.Status),
SortBy: val.SortBy,
}
switch val.SortBy {
case 1:
... ... @@ -638,6 +638,7 @@ func (t TaskService) ListTask2(param command.SearchTaskCommand) (map[string]inte
return nil, nil
}
// 以hrbp角色权限获取任务列表
func (t TaskService) ListTask2ForHrbp(param command.SearchTaskCommand) (map[string]interface{}, error) {
return nil, nil
}
... ...
... ... @@ -36,6 +36,7 @@ type TaskLeader struct {
}
// 设置任务的优先级
// 值越小优先级越高,不是预定义的任务优先级,排在最后
func (t *Task) ApplyLevelName(name string) {
t.LevelName = name
switch name {
... ... @@ -51,7 +52,7 @@ func (t *Task) ApplyLevelName(name string) {
}
// StatusDescript
func (t *Task) StatusDescript() string {
func (t *Task) StatusDescription() string {
switch t.Status {
case TaskWait:
return "待启动"
... ...
... ... @@ -5,9 +5,9 @@ import "time"
type TaskStageState int
const (
TaskStageUncompleted TaskStageState = 1 //里程碑未完成
TaskStageCompletedOverdue TaskStageState = 2 //里程碑逾期完成
TaskStageCompleted TaskStageState = 3 //里程碑完成
TaskStageUncompleted TaskStageState = 1 //里程碑未完成
// TaskStageCompletedOverdue TaskStageState = 2 //里程碑逾期完成
TaskStageCompleted TaskStageState = 2 //里程碑完成
)
... ... @@ -32,7 +32,7 @@ type TaskStageRepository interface {
}
// 描述里程碑完成情况
func (t TaskStage) StatusDescript() string {
func (t TaskStage) StatusDescription() string {
nowDay := time.Now().Format("2006-01-02")
nowTime, _ := time.ParseInLocation("2006-01-02", nowDay, time.Local)
... ... @@ -45,10 +45,11 @@ func (t TaskStage) StatusDescript() string {
str = "未完成"
}
case TaskStageCompleted:
str = "已完成"
case TaskStageCompletedOverdue:
str = "逾期完成"
if t.PlanCompletedAt >= t.RealCompletedAt {
str = "已完成"
} else {
str = "逾期完成"
}
}
return str
}
... ...