作者 tangxvhui

调整一些功能

@@ -5,24 +5,26 @@ import ( @@ -5,24 +5,26 @@ import (
5 ) 5 )
6 6
7 type TaskItem struct { 7 type TaskItem struct {
8 - Id int `json:"id,string"`  
9 - Name string `json:"name"` // 任务名称  
10 - Alias string `json:"alias"` // 任务别名  
11 - Leader string `json:"leader"` // 任务负责人  
12 - Status int `json:"status"` // 任务的状态  
13 - StatusDescript string `json:"statusDescript"` //任务的整体状态描述  
14 - SortBy int `json:"level"` // 优先级,值越小优先级越高  
15 - LevelName string `json:"levelName"` // 任务分类名称  
16 - StageA TaskStage `json:"stageA"` // 里程碑1  
17 - StageB TaskStage `json:"stageB"` // 里程碑2  
18 - StageC TaskStage `json:"stageC"` // 里程碑3  
19 - StageD TaskStage `json:"stageD"` // 里程碑4  
20 - StageE TaskStage `json:"stageE"` // 里程碑5  
21 - LastStage TaskStage `json:"lastStage"` //  
22 - CurrentStage TaskStage `json:"currentStage"` //  
23 - UpdatedAt string `json:"updatedAt"` //  
24 - Anomaly int `json:"anomaly"` //异常反馈情况  
25 - WarnFlag int `json:"warnFlag"` //里程碑完成时间异常标记 0:正常 1标记为异常 8 + Id int `json:"id,string"`
  9 + Name string `json:"name"` // 任务名称
  10 + Alias string `json:"alias"` // 任务别名
  11 + Leader string `json:"leader"` // 任务负责人
  12 + Status int `json:"status"` // 任务的状态
  13 + StatusDescript string `json:"statusDescript"` // 任务的整体状态描述
  14 + SortBy int `json:"level"` // 优先级,值越小优先级越高
  15 + LevelName string `json:"levelName"` // 任务分类名称
  16 + StageA TaskStage `json:"stageA"` // 里程碑1
  17 + StageB TaskStage `json:"stageB"` // 里程碑2
  18 + StageC TaskStage `json:"stageC"` // 里程碑3
  19 + StageD TaskStage `json:"stageD"` // 里程碑4
  20 + StageE TaskStage `json:"stageE"` // 里程碑5
  21 + LastStage TaskStage `json:"lastStage"` //
  22 + CurrentStage TaskStage `json:"currentStage"` //
  23 + UpdatedAt string `json:"updatedAt"` //
  24 + Anomaly int `json:"anomaly"` // 异常反馈情况
  25 + WarnFlag int `json:"warnFlag"` // 里程碑完成时间异常标记 0:正常 1标记为异常
  26 + AnomalyDesc []string `json:"anomalyDesc"` // 异常状态
  27 + Marks map[string]string `json:"marks"` // 标记
26 } 28 }
27 29
28 func (t *TaskItem) GenStatusDescript() { 30 func (t *TaskItem) GenStatusDescript() {
@@ -95,7 +95,7 @@ func isNotWarnFlag(transactionContext application.TransactionContext, taskData * @@ -95,7 +95,7 @@ func isNotWarnFlag(transactionContext application.TransactionContext, taskData *
95 }) 95 })
96 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{ 96 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
97 "isLast": 1, 97 "isLast": 1,
98 - "category": 1, 98 + "category": domain.AnomalyCategoryType1,
99 "limit": 1, 99 "limit": 1,
100 "taskId": taskData.Id, 100 "taskId": taskData.Id,
101 "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id), 101 "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
@@ -126,7 +126,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom @@ -126,7 +126,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom
126 126
127 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{ 127 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
128 "isLast": 1, 128 "isLast": 1,
129 - "category": 1, 129 + "category": domain.AnomalyCategoryType1,
130 "limit": 1, 130 "limit": 1,
131 "taskId": taskData.Id, 131 "taskId": taskData.Id,
132 "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id), 132 "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
@@ -142,7 +142,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom @@ -142,7 +142,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom
142 CompanyId: taskData.CompanyId, 142 CompanyId: taskData.CompanyId,
143 TaskId: taskData.Id, 143 TaskId: taskData.Id,
144 TaskRecordId: taskRecord.Id, 144 TaskRecordId: taskRecord.Id,
145 - Category: 1, 145 + Category: domain.AnomalyCategoryType1,
146 CurrentStage: taskData.CurrentStage, 146 CurrentStage: taskData.CurrentStage,
147 LastStage: taskData.LastStage, 147 LastStage: taskData.LastStage,
148 TaskStageCheck: taskRecord.TaskStageCheck, 148 TaskStageCheck: taskRecord.TaskStageCheck,
@@ -153,7 +153,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom @@ -153,7 +153,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom
153 RecordBegin: taskRecord.CreatedAt.Unix(), 153 RecordBegin: taskRecord.CreatedAt.Unix(),
154 NoticeWho: []map[string]string{}, 154 NoticeWho: []map[string]string{},
155 Marks: map[string]string{ 155 Marks: map[string]string{
156 - "a": "", "b": "", "c": "", "d": "", 156 + "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
157 }, 157 },
158 } 158 }
159 if len(oldAnomaly) > 0 { 159 if len(oldAnomaly) > 0 {
@@ -203,7 +203,7 @@ func isNotAssistFlag(transactionContext application.TransactionContext, taskData @@ -203,7 +203,7 @@ func isNotAssistFlag(transactionContext application.TransactionContext, taskData
203 203
204 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{ 204 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
205 "isLast": 1, 205 "isLast": 1,
206 - "category": 3, 206 + "category": domain.AnomalyCategoryType3,
207 "limit": 1, 207 "limit": 1,
208 "taskId": taskData.Id, 208 "taskId": taskData.Id,
209 }) 209 })
@@ -233,7 +233,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d @@ -233,7 +233,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d
233 233
234 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{ 234 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
235 "isLast": 1, 235 "isLast": 1,
236 - "category": 3, 236 + "category": domain.AnomalyCategoryType3,
237 "limit": 1, 237 "limit": 1,
238 "taskId": taskData.Id, 238 "taskId": taskData.Id,
239 }) 239 })
@@ -247,7 +247,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d @@ -247,7 +247,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d
247 UpdatedAt: time.Now(), 247 UpdatedAt: time.Now(),
248 CompanyId: taskData.CompanyId, 248 CompanyId: taskData.CompanyId,
249 TaskId: taskData.Id, 249 TaskId: taskData.Id,
250 - Category: 3, 250 + Category: domain.AnomalyCategoryType3,
251 CurrentStage: taskData.CurrentStage, 251 CurrentStage: taskData.CurrentStage,
252 LastStage: taskData.LastStage, 252 LastStage: taskData.LastStage,
253 TaskStageCheck: taskRecord.TaskStageCheck, 253 TaskStageCheck: taskRecord.TaskStageCheck,
@@ -258,7 +258,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d @@ -258,7 +258,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d
258 RecordBegin: taskRecord.CreatedAt.Unix(), 258 RecordBegin: taskRecord.CreatedAt.Unix(),
259 NoticeWho: []map[string]string{}, 259 NoticeWho: []map[string]string{},
260 Marks: map[string]string{ 260 Marks: map[string]string{
261 - "a": "", "b": "", "c": "", "d": "", 261 + "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
262 }, 262 },
263 } 263 }
264 264
@@ -319,7 +319,7 @@ func isNotAssessFlag(transactionContext application.TransactionContext, taskData @@ -319,7 +319,7 @@ func isNotAssessFlag(transactionContext application.TransactionContext, taskData
319 319
320 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{ 320 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
321 "isLast": 1, 321 "isLast": 1,
322 - "category": 2, 322 + "category": domain.AnomalyCategoryType2,
323 "limit": 1, 323 "limit": 1,
324 "taskId": taskData.Id, 324 "taskId": taskData.Id,
325 }) 325 })
@@ -347,7 +347,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d @@ -347,7 +347,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d
347 }) 347 })
348 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{ 348 _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
349 "isLast": 1, 349 "isLast": 1,
350 - "category": 2, 350 + "category": domain.AnomalyCategoryType2,
351 "limit": 1, 351 "limit": 1,
352 "taskId": taskData.Id, 352 "taskId": taskData.Id,
353 }) 353 })
@@ -361,7 +361,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d @@ -361,7 +361,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d
361 UpdatedAt: time.Now(), 361 UpdatedAt: time.Now(),
362 CompanyId: taskData.CompanyId, 362 CompanyId: taskData.CompanyId,
363 TaskId: taskData.Id, 363 TaskId: taskData.Id,
364 - Category: 2, 364 + Category: domain.AnomalyCategoryType2,
365 CurrentStage: taskData.CurrentStage, 365 CurrentStage: taskData.CurrentStage,
366 LastStage: taskData.LastStage, 366 LastStage: taskData.LastStage,
367 TaskStageCheck: taskRecord.TaskStageCheck, 367 TaskStageCheck: taskRecord.TaskStageCheck,
@@ -372,7 +372,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d @@ -372,7 +372,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d
372 RecordBegin: taskRecord.CreatedAt.Unix(), 372 RecordBegin: taskRecord.CreatedAt.Unix(),
373 NoticeWho: []map[string]string{}, 373 NoticeWho: []map[string]string{},
374 Marks: map[string]string{ 374 Marks: map[string]string{
375 - "a": "", "b": "", "c": "", "d": "", 375 + "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
376 }, 376 },
377 } 377 }
378 if len(oldAnomaly) > 0 { 378 if len(oldAnomaly) > 0 {
@@ -1141,8 +1141,20 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1141,8 +1141,20 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1141 if err != nil { 1141 if err != nil {
1142 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务反馈异常总数"+err.Error()) 1142 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务反馈异常总数"+err.Error())
1143 } 1143 }
1144 - //TODO 获取异常的任务反馈记录  
1145 - 1144 + var taskAnomalyList []*domain.TaskAnomaly
  1145 + //获取异常的任务反馈记录
  1146 + taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
  1147 + "transactionContext": transactionContext,
  1148 + })
  1149 + for _, val := range taskListData {
  1150 + _, listData, err := taskAnomalyRepo.Find(map[string]interface{}{
  1151 + "taskId": val.TaskId,
  1152 + "is_last": 1,
  1153 + })
  1154 + if err == nil {
  1155 + taskAnomalyList = append(taskAnomalyList, listData...)
  1156 + }
  1157 + }
1146 taskResult := []*adapter.TaskItem{} 1158 taskResult := []*adapter.TaskItem{}
1147 taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{ 1159 taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
1148 "transactionContext": transactionContext, 1160 "transactionContext": transactionContext,
@@ -1178,6 +1190,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1178,6 +1190,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1178 RealCompletedAt: "", 1190 RealCompletedAt: "",
1179 IsRef: false, 1191 IsRef: false,
1180 }, 1192 },
  1193 + AnomalyDesc: []string{},
  1194 + Marks: map[string]string{},
1181 } 1195 }
1182 if val.LastStage.RealCompletedAt > 0 { 1196 if val.LastStage.RealCompletedAt > 0 {
1183 tk.LastStage.RealCompletedAt = time.Unix(int64(val.LastStage.RealCompletedAt), 0).Local().Format("2006-01-02") 1197 tk.LastStage.RealCompletedAt = time.Unix(int64(val.LastStage.RealCompletedAt), 0).Local().Format("2006-01-02")
@@ -1222,6 +1236,28 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1222,6 +1236,28 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1222 } 1236 }
1223 } 1237 }
1224 tk.GenStatusDescript() 1238 tk.GenStatusDescript()
  1239 + for _, val := range taskAnomalyList {
  1240 + if tk.Id != val.TaskId {
  1241 + continue
  1242 + }
  1243 + if val.Marks == nil {
  1244 + val.Marks = map[string]string{}
  1245 + }
  1246 + r := val.Remark + ",该条异常已通知"
  1247 + for _, val2 := range val.NoticeWho {
  1248 + r += val2["name"] + " "
  1249 + }
  1250 + tk.AnomalyDesc = append(tk.AnomalyDesc, r)
  1251 + switch val.Category {
  1252 + case domain.AnomalyCategoryType1:
  1253 + tk.Marks["a"] = val.Marks["a"]
  1254 + tk.Marks["c"] = val.Marks["c"]
  1255 + case domain.AnomalyCategoryType2:
  1256 + tk.Marks["b"] = val.Marks["b"]
  1257 + case domain.AnomalyCategoryType3:
  1258 + tk.Marks["d"] = val.Marks["d"]
  1259 + }
  1260 + }
1225 taskResult = append(taskResult, &tk) 1261 taskResult = append(taskResult, &tk)
1226 } 1262 }
1227 result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult) 1263 result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
@@ -8,6 +8,12 @@ import ( @@ -8,6 +8,12 @@ import (
8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime" 8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime"
9 ) 9 )
10 10
  11 +const (
  12 + AnomalyCategoryType1 int = 1 //里程碑异常
  13 + AnomalyCategoryType2 int = 2 //反馈异常
  14 + AnomalyCategoryType3 int = 3 //辅导异常
  15 +)
  16 +
11 // 任务的异常记录 17 // 任务的异常记录
12 type TaskAnomaly struct { 18 type TaskAnomaly struct {
13 Id int 19 Id int
@@ -16,7 +22,7 @@ type TaskAnomaly struct { @@ -16,7 +22,7 @@ type TaskAnomaly struct {
16 CompanyId int `json:"companyId,string"` 22 CompanyId int `json:"companyId,string"`
17 TaskId int `json:"taskId,string"` // 任务id 23 TaskId int `json:"taskId,string"` // 任务id
18 TaskRecordId int `json:"taskRecordId,string"` // 任务反馈的进度 24 TaskRecordId int `json:"taskRecordId,string"` // 任务反馈的进度
19 - Category int `json:"category"` // 异常记录的分类 1 里程碑异常;2反馈异常 ;3 辅导异常 25 + Category int `json:"category"` // 异常记录的分类 1里程碑异常;2反馈异常;3 辅导异常
20 CurrentStage TaskStage `json:"currentStage"` // 计划进度的里程碑 26 CurrentStage TaskStage `json:"currentStage"` // 计划进度的里程碑
21 LastStage TaskStage `json:"lastStage"` // 实际进度完成的里程碑 27 LastStage TaskStage `json:"lastStage"` // 实际进度完成的里程碑
22 TaskStageCheck TaskStage `json:"taskStageCheck"` // 当天任务反馈操作里程碑记录 28 TaskStageCheck TaskStage `json:"taskStageCheck"` // 当天任务反馈操作里程碑记录
@@ -14,6 +14,7 @@ type TaskAnomaly struct { @@ -14,6 +14,7 @@ type TaskAnomaly struct {
14 UpdatedAt time.Time `pg:"updated_at"` // 14 UpdatedAt time.Time `pg:"updated_at"` //
15 CompanyId int `pg:"company_id"` // 15 CompanyId int `pg:"company_id"` //
16 TaskId int `pg:"task_id"` // 任务id 16 TaskId int `pg:"task_id"` // 任务id
  17 + TaskRecordId int `pg:"task_record_id"` //
17 Category int `pg:"category"` // 异常任务的分类 18 Category int `pg:"category"` // 异常任务的分类
18 CurrentStage domain.TaskStage `pg:"current_stage"` // 计划完成的里程碑 19 CurrentStage domain.TaskStage `pg:"current_stage"` // 计划完成的里程碑
19 LastStage domain.TaskStage `pg:"last_stage"` // 实际完成的里程碑 20 LastStage domain.TaskStage `pg:"last_stage"` // 实际完成的里程碑
@@ -30,6 +30,7 @@ func (repo *TaskAnomalyRepository) TransformToDomain(d *models.TaskAnomaly) *dom @@ -30,6 +30,7 @@ func (repo *TaskAnomalyRepository) TransformToDomain(d *models.TaskAnomaly) *dom
30 UpdatedAt: d.UpdatedAt, 30 UpdatedAt: d.UpdatedAt,
31 CompanyId: d.CompanyId, 31 CompanyId: d.CompanyId,
32 TaskId: d.TaskId, 32 TaskId: d.TaskId,
  33 + TaskRecordId: d.TaskRecordId,
33 Category: d.Category, 34 Category: d.Category,
34 CurrentStage: d.CurrentStage, 35 CurrentStage: d.CurrentStage,
35 LastStage: d.LastStage, 36 LastStage: d.LastStage,
@@ -41,6 +42,7 @@ func (repo *TaskAnomalyRepository) TransformToDomain(d *models.TaskAnomaly) *dom @@ -41,6 +42,7 @@ func (repo *TaskAnomalyRepository) TransformToDomain(d *models.TaskAnomaly) *dom
41 RecordBegin: d.RecordBegin, 42 RecordBegin: d.RecordBegin,
42 NoticeWho: d.NoticeWho, 43 NoticeWho: d.NoticeWho,
43 Marks: d.Marks, 44 Marks: d.Marks,
  45 + Remark: d.Remark,
44 } 46 }
45 } 47 }
46 48
@@ -51,6 +53,7 @@ func (repo *TaskAnomalyRepository) Save(param *domain.TaskAnomaly) error { @@ -51,6 +53,7 @@ func (repo *TaskAnomalyRepository) Save(param *domain.TaskAnomaly) error {
51 UpdatedAt: param.UpdatedAt, 53 UpdatedAt: param.UpdatedAt,
52 CompanyId: param.CompanyId, 54 CompanyId: param.CompanyId,
53 TaskId: param.TaskId, 55 TaskId: param.TaskId,
  56 + TaskRecordId: param.TaskRecordId,
54 Category: param.Category, 57 Category: param.Category,
55 CurrentStage: param.CurrentStage, 58 CurrentStage: param.CurrentStage,
56 LastStage: param.LastStage, 59 LastStage: param.LastStage,
@@ -302,6 +302,7 @@ func (c *TaskController) TaskAnomalyList2() { @@ -302,6 +302,7 @@ func (c *TaskController) TaskAnomalyList2() {
302 c.Response(resp, err) 302 c.Response(resp, err)
303 } 303 }
304 304
  305 +// UserSelect 人员下拉选择
305 func (c *TaskController) UserSelect() { 306 func (c *TaskController) UserSelect() {
306 srv := service.NewTaskService() 307 srv := service.NewTaskService()
307 paramReq := &command.UserSelectCommand{} 308 paramReq := &command.UserSelectCommand{}
@@ -316,7 +317,6 @@ func (c *TaskController) UserSelect() { @@ -316,7 +317,6 @@ func (c *TaskController) UserSelect() {
316 paramReq.UserId = int(userReq.UserId) 317 paramReq.UserId = int(userReq.UserId)
317 resp := srv.UserSelect(paramReq) 318 resp := srv.UserSelect(paramReq)
318 c.Response(resp, nil) 319 c.Response(resp, nil)
319 -  
320 } 320 }
321 321
322 // 点击操作 322 // 点击操作