作者 tangxvhui

更新

@@ -164,6 +164,10 @@ func (srv TaskService) CreateTaskByProject(transactionContext application.Transa @@ -164,6 +164,10 @@ func (srv TaskService) CreateTaskByProject(transactionContext application.Transa
164 164
165 // 创建任务 165 // 创建任务
166 func (srv TaskService) CreateTask(param *command.CreateTaskCommand) (map[string]interface{}, error) { 166 func (srv TaskService) CreateTask(param *command.CreateTaskCommand) (map[string]interface{}, error) {
  167 + sortNamed := domain.TaskSortBy(param.SortBy)
  168 + if sortNamed.Named() == "" {
  169 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "优先级设置错误")
  170 + }
167 transactionContext, err := factory.CreateTransactionContext(nil) 171 transactionContext, err := factory.CreateTransactionContext(nil)
168 if err != nil { 172 if err != nil {
169 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 173 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -43,13 +43,17 @@ const ( @@ -43,13 +43,17 @@ const (
43 ) 43 )
44 44
45 func (t TaskSortBy) Named() string { 45 func (t TaskSortBy) Named() string {
46 - nameMap := map[TaskSortBy]string{  
47 - TaskSortHight: "高",  
48 - TaskSortMiddle: "中",  
49 - TaskSortLow: "低",  
50 - TaskSortNull: "无", 46 + switch t {
  47 + case TaskSortHight:
  48 + return "高"
  49 + case TaskSortMiddle:
  50 + return "中"
  51 + case TaskSortLow:
  52 + return "低"
  53 + case TaskSortNull:
  54 + return "无"
51 } 55 }
52 - return nameMap[t] 56 + return ""
53 } 57 }
54 58
55 // 任务 59 // 任务
@@ -29,12 +29,13 @@ type TaskRecord struct { @@ -29,12 +29,13 @@ type TaskRecord struct {
29 TaskLeader TaskLeader `json:"taskLeader" comment:"任务负责人"` 29 TaskLeader TaskLeader `json:"taskLeader" comment:"任务负责人"`
30 AssistLevel int `json:"assistLevel" comment:"上级辅导情况"` 30 AssistLevel int `json:"assistLevel" comment:"上级辅导情况"`
31 AssistContent string `json:"assistContent" comment:"上级辅导内容"` 31 AssistContent string `json:"assistContent" comment:"上级辅导内容"`
32 - AnomalyState int `json:"anomalyState" comment:"异常是否反馈状态(-1初始状态、0异常、1正常"` 32 + AnomalyState int `json:"anomalyState" comment:"异常是否反馈状态(-1初始状态、0异常、1正常)"`
33 TaskStages []TaskStage `json:"taskStages" comment:"里程碑列表"` 33 TaskStages []TaskStage `json:"taskStages" comment:"里程碑列表"`
34 TaskStageCheck TaskStage `json:"taskStageCheck" comment:"提交的里程碑"` 34 TaskStageCheck TaskStage `json:"taskStageCheck" comment:"提交的里程碑"`
35 CreatedAt time.Time `json:"createdAt" comment:"创建时间"` 35 CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
36 UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` 36 UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
37 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` 37 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
  38 + TaskCreatedBy int `json:"taskCreatedBy" comment:"任务的创建方式"` // 任务的创建方式 0: 根据模板中的任务创建,1:页面主动直接创建
38 } 39 }
39 40
40 type TaskRecordRepository interface { 41 type TaskRecordRepository interface {