正在显示
8 个修改的文件
包含
47 行增加
和
63 行删除
1 | package adapter | 1 | package adapter |
2 | 2 | ||
3 | type TaskAnomalyItem struct { | 3 | type TaskAnomalyItem struct { |
4 | - Id int `json:"id"` | 4 | + Id int `json:"id,string"` |
5 | TaskId int `json:"taskId,string"` // 任务id | 5 | TaskId int `json:"taskId,string"` // 任务id |
6 | + TaskRecordId int `json:"taskRecordId,string"` // 任务反馈记录id | ||
6 | Category int `json:"category"` // 异常分类 | 7 | Category int `json:"category"` // 异常分类 |
7 | Leader string `json:"leader"` // 任务负责人 | 8 | Leader string `json:"leader"` // 任务负责人 |
8 | CurrentStage TaskStage `json:"currentStage"` // 计划进度的里程碑 | 9 | CurrentStage TaskStage `json:"currentStage"` // 计划进度的里程碑 |
9 | LastStage TaskStage `json:"lastStage"` // 实际进度完成的里程碑 | 10 | LastStage TaskStage `json:"lastStage"` // 实际进度完成的里程碑 |
10 | - TaskStageCheck TaskStage `json:"taskStageCheck"` | ||
11 | - AssessFlag int `json:"anomaly"` // 异常反馈的次数 | 11 | + TaskStageCheck TaskStage `json:"taskStageCheck"` // 实际进度完成的里程碑 |
12 | + AssessFlag int `json:"assessFlag"` // 异常反馈的次数 | ||
12 | WarnFlag int `json:"warnFlag"` // 里程碑异常次数 | 13 | WarnFlag int `json:"warnFlag"` // 里程碑异常次数 |
13 | AssistFlag int `json:"assistFlag"` // 辅导异常次数 | 14 | AssistFlag int `json:"assistFlag"` // 辅导异常次数 |
14 | TaskLevel string `json:"taskLevel"` // 任务类型 | 15 | TaskLevel string `json:"taskLevel"` // 任务类型 |
@@ -23,51 +24,3 @@ type TaskAnomalyItem struct { | @@ -23,51 +24,3 @@ type TaskAnomalyItem struct { | ||
23 | MarkD string `json:"markD"` // 去辅导 | 24 | MarkD string `json:"markD"` // 去辅导 |
24 | AnomalyDesc string `json:"anomalyDesc"` // 异常状况描述 | 25 | AnomalyDesc string `json:"anomalyDesc"` // 异常状况描述 |
25 | } | 26 | } |
26 | - | ||
27 | -// func (t *TaskAnomalyItem) GenAnomalyDesc() { | ||
28 | -// nowTime := time.Now() | ||
29 | -// var str string | ||
30 | -// switch t.Category { | ||
31 | -// case 1: | ||
32 | -// //里程碑异常 | ||
33 | -// { | ||
34 | -// if t.TaskStageCheck.RealCompletedAt == 0 { | ||
35 | -// //逾期未完成 | ||
36 | -// planCompletedAt := time.Unix(t.TaskStageCheck.PlanCompletedAt, 0) | ||
37 | -// subDay := xtime.SubDayAbs(nowTime, planCompletedAt) | ||
38 | -// str = fmt.Sprintf("里程碑%s已逾期%d天", t.TaskStageCheck.Name, subDay) | ||
39 | -// } else { | ||
40 | -// //逾期完成 | ||
41 | -// planCompletedAt := time.Unix(t.TaskStageCheck.PlanCompletedAt, 0) | ||
42 | -// realCompletedAt := time.Unix(t.TaskStageCheck.RealCompletedAt, 0) | ||
43 | -// subDay := xtime.SubDayAbs(realCompletedAt, planCompletedAt) | ||
44 | -// str = fmt.Sprintf("里程碑%s逾期%d天完成", t.TaskStageCheck.Name, subDay) | ||
45 | - | ||
46 | -// } | ||
47 | -// } | ||
48 | -// case 2: | ||
49 | -// //反馈异常 | ||
50 | -// { | ||
51 | -// recordBegin := time.Unix(t.RecordBegin, 0) | ||
52 | -// subDay := xtime.SubDayAbs(nowTime, recordBegin) | ||
53 | -// str = fmt.Sprintf( | ||
54 | -// "本任务自%s未正常反馈项目进度,已异常%d天", | ||
55 | -// recordBegin.Local().Format("2006-01-02"), | ||
56 | -// subDay, | ||
57 | -// ) | ||
58 | - | ||
59 | -// } | ||
60 | -// case 3: | ||
61 | -// // 辅导异常 | ||
62 | -// { | ||
63 | -// recordBegin := time.Unix(t.RecordBegin, 0) | ||
64 | -// subDay := xtime.SubDayAbs(nowTime, recordBegin) | ||
65 | -// str = fmt.Sprintf( | ||
66 | -// "本任务计划于%s完成辅导,已逾期%d天", | ||
67 | -// recordBegin.Local().Format("2006-01-02"), | ||
68 | -// subDay, | ||
69 | -// ) | ||
70 | - | ||
71 | -// } | ||
72 | -// } | ||
73 | -// } |
@@ -8,5 +8,5 @@ type ListTaskAnomalyCommand struct { | @@ -8,5 +8,5 @@ type ListTaskAnomalyCommand struct { | ||
8 | TaskName string `json:"taskName"` | 8 | TaskName string `json:"taskName"` |
9 | DayTime string `json:"dayTime"` //发生异常的日期 | 9 | DayTime string `json:"dayTime"` //发生异常的日期 |
10 | Category int `json:"category"` //异常分类 | 10 | Category int `json:"category"` //异常分类 |
11 | - TaskLeaderId string `json:"taskLeaderId"` //任务负责人id | 11 | + leaderId string `json:"leaderId"` //任务负责人id |
12 | } | 12 | } |
@@ -16,7 +16,7 @@ import ( | @@ -16,7 +16,7 @@ import ( | ||
16 | // 异常中心查看 | 16 | // 异常中心查看 |
17 | 17 | ||
18 | // 我负责的任务,异常列表 | 18 | // 我负责的任务,异常列表 |
19 | -func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (map[string]interface{}, error) { | 19 | +func (srv TaskService) ListTaskAnomaly1(param *command.ListTaskAnomalyCommand) (map[string]interface{}, error) { |
20 | transactionContext, err := factory.CreateTransactionContext(nil) | 20 | transactionContext, err := factory.CreateTransactionContext(nil) |
21 | if err != nil { | 21 | if err != nil { |
22 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 22 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -47,6 +47,7 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | @@ -47,6 +47,7 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | ||
47 | item := adapter.TaskAnomalyItem{ | 47 | item := adapter.TaskAnomalyItem{ |
48 | Id: val.Id, | 48 | Id: val.Id, |
49 | TaskId: val.TaskId, | 49 | TaskId: val.TaskId, |
50 | + TaskRecordId: val.TaskRecordId, | ||
50 | Category: val.Category, | 51 | Category: val.Category, |
51 | Leader: val.LeaderName, | 52 | Leader: val.LeaderName, |
52 | CurrentStage: adapter.TaskStage{ | 53 | CurrentStage: adapter.TaskStage{ |
@@ -85,9 +86,6 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | @@ -85,9 +86,6 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | ||
85 | item.MarkC = val.Marks["c"] | 86 | item.MarkC = val.Marks["c"] |
86 | item.MarkD = val.Marks["d"] | 87 | item.MarkD = val.Marks["d"] |
87 | } | 88 | } |
88 | - if val.TaskStageCheck.RealCompletedAt > 0 { | ||
89 | - item.TaskStageCheck.RealCompletedAt = time.Unix(val.TaskStageCheck.RealCompletedAt, 0).Local().Format("2006-01-02") | ||
90 | - } | ||
91 | if val.CurrentStage.RealCompletedAt > 0 { | 89 | if val.CurrentStage.RealCompletedAt > 0 { |
92 | item.CurrentStage.RealCompletedAt = time.Unix(val.CurrentStage.RealCompletedAt, 0).Local().Format("2006-01-02") | 90 | item.CurrentStage.RealCompletedAt = time.Unix(val.CurrentStage.RealCompletedAt, 0).Local().Format("2006-01-02") |
93 | } | 91 | } |
@@ -98,12 +96,12 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | @@ -98,12 +96,12 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | ||
98 | case 1: | 96 | case 1: |
99 | { | 97 | { |
100 | //里程碑异常 | 98 | //里程碑异常 |
101 | - if val.TaskStageCheck.RealCompletedAt == 0 { | 99 | + if val.TaskStageCheck.RealCompletedAt == 0 && val.TaskStageCheck.Id > 0 { |
102 | //逾期未完成 | 100 | //逾期未完成 |
103 | planCompletedAt := time.Unix(val.TaskStageCheck.PlanCompletedAt, 0) | 101 | planCompletedAt := time.Unix(val.TaskStageCheck.PlanCompletedAt, 0) |
104 | subDay := xtime.SubDayAbs(nowTime, planCompletedAt) | 102 | subDay := xtime.SubDayAbs(nowTime, planCompletedAt) |
105 | item.AnomalyDesc = fmt.Sprintf("里程碑%s已逾期%d天", val.TaskStageCheck.Name, subDay) | 103 | item.AnomalyDesc = fmt.Sprintf("里程碑%s已逾期%d天", val.TaskStageCheck.Name, subDay) |
106 | - } else { | 104 | + } else if val.TaskStageCheck.RealCompletedAt > 0 && val.TaskStageCheck.Id > 0 { |
107 | //逾期完成 | 105 | //逾期完成 |
108 | planCompletedAt := time.Unix(val.TaskStageCheck.PlanCompletedAt, 0) | 106 | planCompletedAt := time.Unix(val.TaskStageCheck.PlanCompletedAt, 0) |
109 | realCompletedAt := time.Unix(val.TaskStageCheck.RealCompletedAt, 0) | 107 | realCompletedAt := time.Unix(val.TaskStageCheck.RealCompletedAt, 0) |
@@ -143,10 +141,16 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | @@ -143,10 +141,16 @@ func (srv TaskService) ListTaskAnomaly1(param command.ListTaskAnomalyCommand) (m | ||
143 | } | 141 | } |
144 | 142 | ||
145 | // 我的下级负责任务,异常列表 | 143 | // 我的下级负责任务,异常列表 |
146 | -func (srv TaskService) ListTaskAnomaly2() {} | 144 | +func (srv TaskService) ListTaskAnomaly2() error { |
145 | + return nil | ||
146 | +} | ||
147 | 147 | ||
148 | // 与我有关的任务,异常列表 | 148 | // 与我有关的任务,异常列表 |
149 | -func (srv TaskService) ListTaskAnomaly3() {} | 149 | +func (srv TaskService) ListTaskAnomaly3() error { |
150 | + return nil | ||
151 | +} | ||
150 | 152 | ||
151 | // 对异常记录的操作标记 | 153 | // 对异常记录的操作标记 |
152 | -func (srv TaskService) MarkTaskAnomaly() {} | 154 | +func (srv TaskService) MarkTaskAnomaly() error { |
155 | + return nil | ||
156 | +} |
@@ -30,7 +30,10 @@ type TaskStageRepository interface { | @@ -30,7 +30,10 @@ type TaskStageRepository interface { | ||
30 | } | 30 | } |
31 | 31 | ||
32 | // 描述里程碑完成情况 | 32 | // 描述里程碑完成情况 |
33 | -func (t TaskStage) StatusDescription() string { | 33 | +func (t *TaskStage) StatusDescription() string { |
34 | + if t.Id == 0 { | ||
35 | + return "" | ||
36 | + } | ||
34 | nowDay := time.Now().Format("2006-01-02") | 37 | nowDay := time.Now().Format("2006-01-02") |
35 | nowTime, _ := time.ParseInLocation("2006-01-02", nowDay, time.Local) | 38 | nowTime, _ := time.ParseInLocation("2006-01-02", nowDay, time.Local) |
36 | 39 |
@@ -9,7 +9,7 @@ import ( | @@ -9,7 +9,7 @@ import ( | ||
9 | func TestGenerateToken(t *testing.T) { | 9 | func TestGenerateToken(t *testing.T) { |
10 | ut := UserAuth{ | 10 | ut := UserAuth{ |
11 | CompanyId: 8, | 11 | CompanyId: 8, |
12 | - UserId: 3422185340122624, | 12 | + UserId: 3422174102828544, |
13 | Phone: "13066667710", | 13 | Phone: "13066667710", |
14 | PlatformId: 29, | 14 | PlatformId: 29, |
15 | AdminType: 1, | 15 | AdminType: 1, |
@@ -26,6 +26,7 @@ func NewTaskAnomalyDao(options map[string]interface{}) *TaskAnomalyDao { | @@ -26,6 +26,7 @@ func NewTaskAnomalyDao(options map[string]interface{}) *TaskAnomalyDao { | ||
26 | type ListTaskAnomaly struct { | 26 | type ListTaskAnomaly struct { |
27 | Id int `pg:"id"` | 27 | Id int `pg:"id"` |
28 | TaskId int `pg:"task_id"` | 28 | TaskId int `pg:"task_id"` |
29 | + TaskRecordId int `pg:"task_record_id"` | ||
29 | Category int `pg:"category"` | 30 | Category int `pg:"category"` |
30 | CurrentStage domain.TaskStage `pg:"current_stage"` // 计划执行的里程碑 | 31 | CurrentStage domain.TaskStage `pg:"current_stage"` // 计划执行的里程碑 |
31 | LastStage domain.TaskStage `pg:"last_stage"` // 上一个完成的里程碑 | 32 | LastStage domain.TaskStage `pg:"last_stage"` // 上一个完成的里程碑 |
@@ -58,6 +59,7 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ | @@ -58,6 +59,7 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ | ||
58 | )select | 59 | )select |
59 | task_anomaly.id, | 60 | task_anomaly.id, |
60 | task_anomaly.task_id, | 61 | task_anomaly.task_id, |
62 | + task_anomaly.task_record_id, | ||
61 | task_anomaly.category, | 63 | task_anomaly.category, |
62 | task_anomaly.current_stage, | 64 | task_anomaly.current_stage, |
63 | task_anomaly.last_stage, | 65 | task_anomaly.last_stage, |
@@ -148,6 +150,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ | @@ -148,6 +150,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ | ||
148 | )select | 150 | )select |
149 | task_anomaly.id, | 151 | task_anomaly.id, |
150 | task_anomaly.task_id, | 152 | task_anomaly.task_id, |
153 | + task_anomaly.task_record_id, | ||
151 | task_anomaly.category, | 154 | task_anomaly.category, |
152 | task_anomaly.current_stage, | 155 | task_anomaly.current_stage, |
153 | task_anomaly.last_stage, | 156 | task_anomaly.last_stage, |
@@ -250,3 +250,19 @@ func (c *TaskController) CancelIgnore() { | @@ -250,3 +250,19 @@ func (c *TaskController) CancelIgnore() { | ||
250 | c.Response(nil, err) | 250 | c.Response(nil, err) |
251 | 251 | ||
252 | } | 252 | } |
253 | + | ||
254 | +func (c *TaskController) TaskAnomalyList1() { | ||
255 | + srv := service.NewTaskService() | ||
256 | + paramReq := &command.ListTaskAnomalyCommand{} | ||
257 | + err := c.BindJSON(paramReq) | ||
258 | + if err != nil { | ||
259 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
260 | + c.Response(nil, e) | ||
261 | + return | ||
262 | + } | ||
263 | + userReq := middlewares.GetUser(c.Ctx) | ||
264 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
265 | + paramReq.UserId = int(userReq.UserId) | ||
266 | + resp, err := srv.ListTaskAnomaly1(paramReq) | ||
267 | + c.Response(resp, err) | ||
268 | +} |
@@ -34,4 +34,9 @@ func init() { | @@ -34,4 +34,9 @@ func init() { | ||
34 | web.NSCtrlPost("/ignore/cancel", (*controllers.TaskController).CancelIgnore), | 34 | web.NSCtrlPost("/ignore/cancel", (*controllers.TaskController).CancelIgnore), |
35 | ) | 35 | ) |
36 | web.AddNamespace(taskFontNS) | 36 | web.AddNamespace(taskFontNS) |
37 | + taskAnomalyNS := web.NewNamespace("/v1/font", | ||
38 | + web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
39 | + web.NSCtrlPost("/task_anomaly/my_task", (*controllers.TaskController).TaskAnomalyList1), | ||
40 | + ) | ||
41 | + web.AddNamespace(taskAnomalyNS) | ||
37 | } | 42 | } |
-
请 注册 或 登录 后发表评论