正在显示
6 个修改的文件
包含
87 行增加
和
3 行删除
@@ -414,5 +414,4 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. | @@ -414,5 +414,4 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. | ||
414 | resp["needNotify"] = false | 414 | resp["needNotify"] = false |
415 | } | 415 | } |
416 | return resp, nil | 416 | return resp, nil |
417 | - | ||
418 | } | 417 | } |
1 | +package adapter | ||
2 | + | ||
3 | +type TaskRecordAdapter struct { | ||
4 | + Id int `json:"id,string" ` //comment:"记录ID" | ||
5 | + StaffAssessId int `json:"staffAssessId,string" ` //comment:"每日评估的ID" | ||
6 | + TaskId int `json:"taskId,string" ` //comment:"任务ID" | ||
7 | + TaskCategory string `json:"taskCategory" ` //comment:"任务类别" | ||
8 | + TaskName string `json:"taskName" ` //comment:"任务名称" | ||
9 | + TaskAlias string `json:"taskAlias" ` //comment:"任务别名" | ||
10 | + TaskLeader string `json:"taskLeader"` //comment:"任务负责人" | ||
11 | + AssistLevel int `json:"assistLevel" ` //comment:"上级辅导情况" | ||
12 | + AssistContent string `json:"assistContent" ` //comment:"上级辅导内容" | ||
13 | + TaskStageCheck TaskStage `json:"taskStageCheck" ` //comment:"提交的里程碑" | ||
14 | + CreatedAt string `json:"createdAt" ` //格式2006-01-02comment:"创建时间" | ||
15 | +} |
@@ -704,7 +704,7 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i | @@ -704,7 +704,7 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i | ||
704 | } | 704 | } |
705 | 705 | ||
706 | // 以hrbp角色权限获取任务列表 | 706 | // 以hrbp角色权限获取任务列表 |
707 | -// TODO 统计里程碑异常数,反馈异常数 | 707 | +// 统计里程碑异常数,反馈异常数 |
708 | func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[string]interface{}, error) { | 708 | func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[string]interface{}, error) { |
709 | var limit = 20 | 709 | var limit = 20 |
710 | var offset = 0 | 710 | var offset = 0 |
@@ -848,3 +848,62 @@ func (srv TaskService) ReplyTaskStage(transactionContext application.Transaction | @@ -848,3 +848,62 @@ func (srv TaskService) ReplyTaskStage(transactionContext application.Transaction | ||
848 | } | 848 | } |
849 | return nil | 849 | return nil |
850 | } | 850 | } |
851 | + | ||
852 | +// 获取任务的反馈 | ||
853 | +func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map[string]interface{}, error) { | ||
854 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
855 | + if err != nil { | ||
856 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
857 | + } | ||
858 | + if err := transactionContext.StartTransaction(); err != nil { | ||
859 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
860 | + } | ||
861 | + defer func() { | ||
862 | + _ = transactionContext.RollbackTransaction() | ||
863 | + }() | ||
864 | + taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{ | ||
865 | + "transactionContext": transactionContext, | ||
866 | + }) | ||
867 | + cnt, taskRecordList, err := taskRecordRepo.Find(map[string]interface{}{ | ||
868 | + "companyId": param.CompanyId, | ||
869 | + "taskId": param.TaskId, | ||
870 | + }) | ||
871 | + if err != nil { | ||
872 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务反馈数据"+err.Error()) | ||
873 | + } | ||
874 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
875 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
876 | + } | ||
877 | + resultList := []adapter.TaskRecordAdapter{} | ||
878 | + for _, val := range taskRecordList { | ||
879 | + item := adapter.TaskRecordAdapter{ | ||
880 | + Id: val.Id, | ||
881 | + StaffAssessId: val.StaffAssessId, | ||
882 | + TaskId: val.TaskId, | ||
883 | + TaskCategory: val.TaskCategory, | ||
884 | + TaskName: val.TaskName, | ||
885 | + TaskAlias: val.TaskAlias, | ||
886 | + TaskLeader: val.TaskLeader.Name, | ||
887 | + AssistLevel: val.AssistLevel, | ||
888 | + AssistContent: val.AssistContent, | ||
889 | + TaskStageCheck: adapter.TaskStage{ | ||
890 | + Id: val.Id, | ||
891 | + Name: val.TaskStageCheck.Name, | ||
892 | + StatusDescription: val.TaskStageCheck.StatusDescription(), | ||
893 | + SortBy: val.TaskStageCheck.SortBy, | ||
894 | + PlanCompletedAt: "", | ||
895 | + RealCompletedAt: "", | ||
896 | + }, | ||
897 | + CreatedAt: val.CreatedAt.Local().Format("2006-01-02"), | ||
898 | + } | ||
899 | + t1 := time.Unix(val.TaskStageCheck.PlanCompletedAt, 0).Local().Format("2006-01-02") | ||
900 | + item.TaskStageCheck.PlanCompletedAt = t1 | ||
901 | + if val.TaskStageCheck.RealCompletedAt > 0 { | ||
902 | + t2 := time.Unix(val.TaskStageCheck.RealCompletedAt, 0).Local().Format("2006-01-02") | ||
903 | + item.TaskStageCheck.RealCompletedAt = t2 | ||
904 | + } | ||
905 | + resultList = append(resultList, item) | ||
906 | + } | ||
907 | + result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList) | ||
908 | + return result, nil | ||
909 | +} |
@@ -22,6 +22,7 @@ const ( | @@ -22,6 +22,7 @@ const ( | ||
22 | MessageTypesOther MessageTypes = "other" //综合自评开启时,消息通知 | 22 | MessageTypesOther MessageTypes = "other" //综合自评开启时,消息通知 |
23 | MessageTypesTaskStage MessageTypes = "task_stage" //任务里程碑未按时完成 | 23 | MessageTypesTaskStage MessageTypes = "task_stage" //任务里程碑未按时完成 |
24 | MessageTypesTaskRecord MessageTypes = "task_record" //任务每日反馈异常 | 24 | MessageTypesTaskRecord MessageTypes = "task_record" //任务每日反馈异常 |
25 | + MessageTypesTaskModify MessageTypes = "task_modify" //修改任务 | ||
25 | ) | 26 | ) |
26 | 27 | ||
27 | type MessageReadFlag string | 28 | type MessageReadFlag string |
@@ -3,12 +3,13 @@ package repository | @@ -3,12 +3,13 @@ package repository | ||
3 | import ( | 3 | import ( |
4 | "errors" | 4 | "errors" |
5 | "fmt" | 5 | "fmt" |
6 | + "time" | ||
7 | + | ||
6 | "github.com/go-pg/pg/v10" | 8 | "github.com/go-pg/pg/v10" |
7 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 9 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 10 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" | 11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" |
10 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" | 12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" |
11 | - "time" | ||
12 | ) | 13 | ) |
13 | 14 | ||
14 | type TaskRecordRepository struct { | 15 | type TaskRecordRepository struct { |
@@ -146,6 +147,9 @@ func (repo *TaskRecordRepository) Find(queryOptions map[string]interface{}) (int | @@ -146,6 +147,9 @@ func (repo *TaskRecordRepository) Find(queryOptions map[string]interface{}) (int | ||
146 | query.Where("staff_assess_id = ?", v) | 147 | query.Where("staff_assess_id = ?", v) |
147 | } | 148 | } |
148 | 149 | ||
150 | + if v, ok := queryOptions["taskId"]; ok { | ||
151 | + query.Where("task_id = ?", v) | ||
152 | + } | ||
149 | if v, ok := queryOptions["limit"].(int64); ok { | 153 | if v, ok := queryOptions["limit"].(int64); ok { |
150 | query.Limit(int(v)) | 154 | query.Limit(int(v)) |
151 | } | 155 | } |
-
请 注册 或 登录 后发表评论