作者 tangxvhui

调整一些功能

... ... @@ -5,24 +5,26 @@ import (
)
type TaskItem struct {
Id int `json:"id,string"`
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
Leader string `json:"leader"` // 任务负责人
Status int `json:"status"` // 任务的状态
StatusDescript string `json:"statusDescript"` //任务的整体状态描述
SortBy int `json:"level"` // 优先级,值越小优先级越高
LevelName string `json:"levelName"` // 任务分类名称
StageA TaskStage `json:"stageA"` // 里程碑1
StageB TaskStage `json:"stageB"` // 里程碑2
StageC TaskStage `json:"stageC"` // 里程碑3
StageD TaskStage `json:"stageD"` // 里程碑4
StageE TaskStage `json:"stageE"` // 里程碑5
LastStage TaskStage `json:"lastStage"` //
CurrentStage TaskStage `json:"currentStage"` //
UpdatedAt string `json:"updatedAt"` //
Anomaly int `json:"anomaly"` //异常反馈情况
WarnFlag int `json:"warnFlag"` //里程碑完成时间异常标记 0:正常 1标记为异常
Id int `json:"id,string"`
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
Leader string `json:"leader"` // 任务负责人
Status int `json:"status"` // 任务的状态
StatusDescript string `json:"statusDescript"` // 任务的整体状态描述
SortBy int `json:"level"` // 优先级,值越小优先级越高
LevelName string `json:"levelName"` // 任务分类名称
StageA TaskStage `json:"stageA"` // 里程碑1
StageB TaskStage `json:"stageB"` // 里程碑2
StageC TaskStage `json:"stageC"` // 里程碑3
StageD TaskStage `json:"stageD"` // 里程碑4
StageE TaskStage `json:"stageE"` // 里程碑5
LastStage TaskStage `json:"lastStage"` //
CurrentStage TaskStage `json:"currentStage"` //
UpdatedAt string `json:"updatedAt"` //
Anomaly int `json:"anomaly"` // 异常反馈情况
WarnFlag int `json:"warnFlag"` // 里程碑完成时间异常标记 0:正常 1标记为异常
AnomalyDesc []string `json:"anomalyDesc"` // 异常状态
Marks map[string]string `json:"marks"` // 标记
}
func (t *TaskItem) GenStatusDescript() {
... ...
... ... @@ -95,7 +95,7 @@ func isNotWarnFlag(transactionContext application.TransactionContext, taskData *
})
_, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
"isLast": 1,
"category": 1,
"category": domain.AnomalyCategoryType1,
"limit": 1,
"taskId": taskData.Id,
"taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
... ... @@ -126,7 +126,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom
_, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
"isLast": 1,
"category": 1,
"category": domain.AnomalyCategoryType1,
"limit": 1,
"taskId": taskData.Id,
"taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
... ... @@ -142,7 +142,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom
CompanyId: taskData.CompanyId,
TaskId: taskData.Id,
TaskRecordId: taskRecord.Id,
Category: 1,
Category: domain.AnomalyCategoryType1,
CurrentStage: taskData.CurrentStage,
LastStage: taskData.LastStage,
TaskStageCheck: taskRecord.TaskStageCheck,
... ... @@ -153,7 +153,7 @@ func isWarnFlag(transactionContext application.TransactionContext, taskData *dom
RecordBegin: taskRecord.CreatedAt.Unix(),
NoticeWho: []map[string]string{},
Marks: map[string]string{
"a": "", "b": "", "c": "", "d": "",
"a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
},
}
if len(oldAnomaly) > 0 {
... ... @@ -203,7 +203,7 @@ func isNotAssistFlag(transactionContext application.TransactionContext, taskData
_, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
"isLast": 1,
"category": 3,
"category": domain.AnomalyCategoryType3,
"limit": 1,
"taskId": taskData.Id,
})
... ... @@ -233,7 +233,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d
_, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
"isLast": 1,
"category": 3,
"category": domain.AnomalyCategoryType3,
"limit": 1,
"taskId": taskData.Id,
})
... ... @@ -247,7 +247,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d
UpdatedAt: time.Now(),
CompanyId: taskData.CompanyId,
TaskId: taskData.Id,
Category: 3,
Category: domain.AnomalyCategoryType3,
CurrentStage: taskData.CurrentStage,
LastStage: taskData.LastStage,
TaskStageCheck: taskRecord.TaskStageCheck,
... ... @@ -258,7 +258,7 @@ func isAssistFlag(transactionContext application.TransactionContext, taskData *d
RecordBegin: taskRecord.CreatedAt.Unix(),
NoticeWho: []map[string]string{},
Marks: map[string]string{
"a": "", "b": "", "c": "", "d": "",
"a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
},
}
... ... @@ -319,7 +319,7 @@ func isNotAssessFlag(transactionContext application.TransactionContext, taskData
_, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
"isLast": 1,
"category": 2,
"category": domain.AnomalyCategoryType2,
"limit": 1,
"taskId": taskData.Id,
})
... ... @@ -347,7 +347,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d
})
_, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
"isLast": 1,
"category": 2,
"category": domain.AnomalyCategoryType2,
"limit": 1,
"taskId": taskData.Id,
})
... ... @@ -361,7 +361,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d
UpdatedAt: time.Now(),
CompanyId: taskData.CompanyId,
TaskId: taskData.Id,
Category: 2,
Category: domain.AnomalyCategoryType2,
CurrentStage: taskData.CurrentStage,
LastStage: taskData.LastStage,
TaskStageCheck: taskRecord.TaskStageCheck,
... ... @@ -372,7 +372,7 @@ func isAssessFlag(transactionContext application.TransactionContext, taskData *d
RecordBegin: taskRecord.CreatedAt.Unix(),
NoticeWho: []map[string]string{},
Marks: map[string]string{
"a": "", "b": "", "c": "", "d": "",
"a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
},
}
if len(oldAnomaly) > 0 {
... ...
... ... @@ -1141,8 +1141,20 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务反馈异常总数"+err.Error())
}
//TODO 获取异常的任务反馈记录
var taskAnomalyList []*domain.TaskAnomaly
//获取异常的任务反馈记录
taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
for _, val := range taskListData {
_, listData, err := taskAnomalyRepo.Find(map[string]interface{}{
"taskId": val.TaskId,
"is_last": 1,
})
if err == nil {
taskAnomalyList = append(taskAnomalyList, listData...)
}
}
taskResult := []*adapter.TaskItem{}
taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -1178,6 +1190,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
RealCompletedAt: "",
IsRef: false,
},
AnomalyDesc: []string{},
Marks: map[string]string{},
}
if val.LastStage.RealCompletedAt > 0 {
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
}
}
tk.GenStatusDescript()
for _, val := range taskAnomalyList {
if tk.Id != val.TaskId {
continue
}
if val.Marks == nil {
val.Marks = map[string]string{}
}
r := val.Remark + ",该条异常已通知"
for _, val2 := range val.NoticeWho {
r += val2["name"] + " "
}
tk.AnomalyDesc = append(tk.AnomalyDesc, r)
switch val.Category {
case domain.AnomalyCategoryType1:
tk.Marks["a"] = val.Marks["a"]
tk.Marks["c"] = val.Marks["c"]
case domain.AnomalyCategoryType2:
tk.Marks["b"] = val.Marks["b"]
case domain.AnomalyCategoryType3:
tk.Marks["d"] = val.Marks["d"]
}
}
taskResult = append(taskResult, &tk)
}
result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
... ...
... ... @@ -8,6 +8,12 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime"
)
const (
AnomalyCategoryType1 int = 1 //里程碑异常
AnomalyCategoryType2 int = 2 //反馈异常
AnomalyCategoryType3 int = 3 //辅导异常
)
// 任务的异常记录
type TaskAnomaly struct {
Id int
... ... @@ -16,7 +22,7 @@ type TaskAnomaly struct {
CompanyId int `json:"companyId,string"`
TaskId int `json:"taskId,string"` // 任务id
TaskRecordId int `json:"taskRecordId,string"` // 任务反馈的进度
Category int `json:"category"` // 异常记录的分类 1 里程碑异常;2反馈异常 ;3 辅导异常
Category int `json:"category"` // 异常记录的分类 1里程碑异常;2反馈异常;3 辅导异常
CurrentStage TaskStage `json:"currentStage"` // 计划进度的里程碑
LastStage TaskStage `json:"lastStage"` // 实际进度完成的里程碑
TaskStageCheck TaskStage `json:"taskStageCheck"` // 当天任务反馈操作里程碑记录
... ...
... ... @@ -14,6 +14,7 @@ type TaskAnomaly struct {
UpdatedAt time.Time `pg:"updated_at"` //
CompanyId int `pg:"company_id"` //
TaskId int `pg:"task_id"` // 任务id
TaskRecordId int `pg:"task_record_id"` //
Category int `pg:"category"` // 异常任务的分类
CurrentStage domain.TaskStage `pg:"current_stage"` // 计划完成的里程碑
LastStage domain.TaskStage `pg:"last_stage"` // 实际完成的里程碑
... ...
... ... @@ -30,6 +30,7 @@ func (repo *TaskAnomalyRepository) TransformToDomain(d *models.TaskAnomaly) *dom
UpdatedAt: d.UpdatedAt,
CompanyId: d.CompanyId,
TaskId: d.TaskId,
TaskRecordId: d.TaskRecordId,
Category: d.Category,
CurrentStage: d.CurrentStage,
LastStage: d.LastStage,
... ... @@ -41,6 +42,7 @@ func (repo *TaskAnomalyRepository) TransformToDomain(d *models.TaskAnomaly) *dom
RecordBegin: d.RecordBegin,
NoticeWho: d.NoticeWho,
Marks: d.Marks,
Remark: d.Remark,
}
}
... ... @@ -51,6 +53,7 @@ func (repo *TaskAnomalyRepository) Save(param *domain.TaskAnomaly) error {
UpdatedAt: param.UpdatedAt,
CompanyId: param.CompanyId,
TaskId: param.TaskId,
TaskRecordId: param.TaskRecordId,
Category: param.Category,
CurrentStage: param.CurrentStage,
LastStage: param.LastStage,
... ...
... ... @@ -302,6 +302,7 @@ func (c *TaskController) TaskAnomalyList2() {
c.Response(resp, err)
}
// UserSelect 人员下拉选择
func (c *TaskController) UserSelect() {
srv := service.NewTaskService()
paramReq := &command.UserSelectCommand{}
... ... @@ -316,7 +317,6 @@ func (c *TaskController) UserSelect() {
paramReq.UserId = int(userReq.UserId)
resp := srv.UserSelect(paramReq)
c.Response(resp, nil)
}
// 点击操作
... ...