...
|
...
|
@@ -2,11 +2,13 @@ package service |
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/log_opt"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/log_opt"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
...
|
...
|
@@ -1212,6 +1214,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i |
|
|
IsRef: false,
|
|
|
},
|
|
|
AnomalyDesc: []string{},
|
|
|
AnomalyDesc2: []map[string]string{},
|
|
|
Marks: map[string]string{},
|
|
|
}
|
|
|
if val.LastStage.RealCompletedAt > 0 {
|
...
|
...
|
@@ -1257,26 +1260,94 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i |
|
|
}
|
|
|
}
|
|
|
tk.GenStatusDescript()
|
|
|
for _, val := range taskAnomalyList {
|
|
|
if tk.Id != val.TaskId {
|
|
|
for _, val3 := range taskAnomalyList {
|
|
|
if tk.Id != val3.TaskId {
|
|
|
continue
|
|
|
}
|
|
|
if val.Marks == nil {
|
|
|
val.Marks = map[string]string{}
|
|
|
if val3.Marks == nil {
|
|
|
val3.Marks = map[string]string{}
|
|
|
}
|
|
|
noticeWho := []string{}
|
|
|
for _, val2 := range val3.NoticeWho {
|
|
|
noticeWho = append(noticeWho, val2["name"])
|
|
|
}
|
|
|
switch val3.Category {
|
|
|
case domain.AnomalyCategoryType1:
|
|
|
{
|
|
|
//里程碑异常
|
|
|
if val3.TaskStageCheck.RealCompletedAt == 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
//逾期未完成
|
|
|
planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
subDay := xtime.SubDayAbs(val3.CreatedAt, planCompletedAt)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s已逾期%d天", val3.TaskStageCheck.Name, subDay))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "10",
|
|
|
"stageName": val3.TaskStageCheck.Name,
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
} else if val3.TaskStageCheck.RealCompletedAt > 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
//逾期完成
|
|
|
planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
realCompletedAt := time.Unix(val3.TaskStageCheck.RealCompletedAt, 0)
|
|
|
subDay := xtime.SubDayAbs(realCompletedAt, planCompletedAt)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s逾期%d天完成", val3.TaskStageCheck.Name, subDay))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "11",
|
|
|
"stageName": val3.TaskStageCheck.Name,
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
r := val.Remark + ",该条异常已通知"
|
|
|
for _, val2 := range val.NoticeWho {
|
|
|
r += val2["name"] + " "
|
|
|
case domain.AnomalyCategoryType2:
|
|
|
//反馈异常
|
|
|
{
|
|
|
recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
"本任务自%s未正常反馈项目进度,已异常%d天",
|
|
|
recordBegin.Local().Format("2006-01-02"),
|
|
|
subDay,
|
|
|
))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "2",
|
|
|
"dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
}
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, r)
|
|
|
switch val.Category {
|
|
|
case domain.AnomalyCategoryType3:
|
|
|
//辅导异常
|
|
|
{
|
|
|
recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
"本任务计划于%s完成辅导,已逾期%d天",
|
|
|
recordBegin.Local().Format("2006-01-02"),
|
|
|
subDay,
|
|
|
))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "3",
|
|
|
"dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
userId := strconv.Itoa(param.UserId)
|
|
|
switch val3.Category {
|
|
|
case domain.AnomalyCategoryType1:
|
|
|
tk.Marks["a"] = val.Marks["a"]
|
|
|
tk.Marks["c"] = val.Marks["c"]
|
|
|
if userId == val.LeaderId {
|
|
|
tk.Marks["a"] = val3.Marks["a"]
|
|
|
tk.Marks["c"] = val3.Marks["c"]
|
|
|
} else {
|
|
|
tk.Marks["d"] = val3.Marks["d"]
|
|
|
}
|
|
|
case domain.AnomalyCategoryType2:
|
|
|
tk.Marks["b"] = val.Marks["b"]
|
|
|
tk.Marks["b"] = val3.Marks["b"]
|
|
|
case domain.AnomalyCategoryType3:
|
|
|
tk.Marks["d"] = val.Marks["d"]
|
|
|
tk.Marks["d"] = val3.Marks["d"]
|
|
|
}
|
|
|
}
|
|
|
taskResult = append(taskResult, &tk)
|
...
|
...
|
@@ -1394,6 +1465,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s |
|
|
PlanCompletedAt: time.Unix(int64(val.CurrentStage.PlanCompletedAt), 0).Local().Format("2006-01-02"),
|
|
|
RealCompletedAt: "",
|
|
|
},
|
|
|
Marks: map[string]string{},
|
|
|
}
|
|
|
if val.LastStage.RealCompletedAt > 0 {
|
|
|
tk.LastStage.RealCompletedAt = time.Unix(int64(val.LastStage.RealCompletedAt), 0).Local().Format("2006-01-02")
|
...
|
...
|
@@ -1439,27 +1511,97 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s |
|
|
}
|
|
|
}
|
|
|
tk.GenStatusDescript()
|
|
|
for _, val := range taskAnomalyList {
|
|
|
if tk.Id != val.TaskId {
|
|
|
for _, val3 := range taskAnomalyList {
|
|
|
if tk.Id != val3.TaskId {
|
|
|
continue
|
|
|
}
|
|
|
if len(val.Marks) == 0 {
|
|
|
val.Marks = map[string]string{}
|
|
|
if val3.Marks == nil {
|
|
|
val3.Marks = map[string]string{}
|
|
|
}
|
|
|
r := val.Remark + ",该条异常已通知"
|
|
|
for _, val2 := range val.NoticeWho {
|
|
|
r += val2["name"] + " "
|
|
|
noticeWho := []string{}
|
|
|
for _, val2 := range val3.NoticeWho {
|
|
|
noticeWho = append(noticeWho, val2["name"])
|
|
|
}
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, r)
|
|
|
tk.Marks = map[string]string{}
|
|
|
switch val.Category {
|
|
|
switch val3.Category {
|
|
|
case domain.AnomalyCategoryType1:
|
|
|
tk.Marks["a"] = val.Marks["a"]
|
|
|
tk.Marks["c"] = val.Marks["c"]
|
|
|
{
|
|
|
//里程碑异常
|
|
|
if val3.TaskStageCheck.RealCompletedAt == 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
//逾期未完成
|
|
|
planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
subDay := xtime.SubDayAbs(val3.CreatedAt, planCompletedAt)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s已逾期%d天", val3.TaskStageCheck.Name, subDay))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "10",
|
|
|
"stageName": val3.TaskStageCheck.Name,
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
} else if val3.TaskStageCheck.RealCompletedAt > 0 && val3.TaskStageCheck.Id > 0 {
|
|
|
//逾期完成
|
|
|
planCompletedAt := time.Unix(val3.TaskStageCheck.PlanCompletedAt, 0)
|
|
|
realCompletedAt := time.Unix(val3.TaskStageCheck.RealCompletedAt, 0)
|
|
|
subDay := xtime.SubDayAbs(realCompletedAt, planCompletedAt)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf("里程碑%s逾期%d天完成", val3.TaskStageCheck.Name, subDay))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "11",
|
|
|
"stageName": val3.TaskStageCheck.Name,
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
case domain.AnomalyCategoryType2:
|
|
|
//反馈异常
|
|
|
{
|
|
|
recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
"本任务自%s未正常反馈项目进度,已异常%d天",
|
|
|
recordBegin.Local().Format("2006-01-02"),
|
|
|
subDay,
|
|
|
))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "2",
|
|
|
"dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
}
|
|
|
case domain.AnomalyCategoryType3:
|
|
|
//辅导异常
|
|
|
{
|
|
|
recordBegin := time.Unix(val3.RecordBegin, 0)
|
|
|
subDay := xtime.SubDayAbs(val3.CreatedAt, recordBegin)
|
|
|
tk.AnomalyDesc = append(tk.AnomalyDesc, fmt.Sprintf(
|
|
|
"本任务计划于%s完成辅导,已逾期%d天",
|
|
|
recordBegin.Local().Format("2006-01-02"),
|
|
|
subDay,
|
|
|
))
|
|
|
tk.AnomalyDesc2 = append(tk.AnomalyDesc2, map[string]string{
|
|
|
"types": "3",
|
|
|
"dayTime": recordBegin.Local().Format("2006-01-02"),
|
|
|
"interval": strconv.Itoa(subDay),
|
|
|
"noticeWho": strings.Join(noticeWho, ","),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
if len(val3.Marks) == 0 {
|
|
|
val3.Marks = map[string]string{}
|
|
|
}
|
|
|
userId := strconv.Itoa(param.UserId)
|
|
|
switch val3.Category {
|
|
|
case domain.AnomalyCategoryType1:
|
|
|
if userId == val.LeaderId {
|
|
|
tk.Marks["a"] = val3.Marks["a"]
|
|
|
tk.Marks["c"] = val3.Marks["c"]
|
|
|
} else {
|
|
|
tk.Marks["d"] = val3.Marks["d"]
|
|
|
}
|
|
|
case domain.AnomalyCategoryType2:
|
|
|
tk.Marks["b"] = val.Marks["b"]
|
|
|
tk.Marks["b"] = val3.Marks["b"]
|
|
|
case domain.AnomalyCategoryType3:
|
|
|
tk.Marks["d"] = val.Marks["d"]
|
|
|
tk.Marks["d"] = val3.Marks["d"]
|
|
|
}
|
|
|
}
|
|
|
taskResult = append(taskResult, &tk)
|
...
|
...
|
|