正在显示
9 个修改的文件
包含
199 行增加
和
2 行删除
@@ -120,3 +120,27 @@ func CreateEvaluationProjectRepository(options map[string]interface{}) domain.Ev | @@ -120,3 +120,27 @@ func CreateEvaluationProjectRepository(options map[string]interface{}) domain.Ev | ||
120 | } | 120 | } |
121 | return repository.NewEvaluationProjectRepository(transactionContext) | 121 | return repository.NewEvaluationProjectRepository(transactionContext) |
122 | } | 122 | } |
123 | + | ||
124 | +func CreateStaffAssessRepository(options map[string]interface{}) domain.StaffAssessRepository { | ||
125 | + var transactionContext *pg.TransactionContext | ||
126 | + if value, ok := options["transactionContext"]; ok { | ||
127 | + transactionContext = value.(*pg.TransactionContext) | ||
128 | + } | ||
129 | + return repository.NewStaffAssessRepository(transactionContext) | ||
130 | +} | ||
131 | + | ||
132 | +func CreateStaffAssessContentRepository(options map[string]interface{}) domain.StaffAssessContentRepository { | ||
133 | + var transactionContext *pg.TransactionContext | ||
134 | + if value, ok := options["transactionContext"]; ok { | ||
135 | + transactionContext = value.(*pg.TransactionContext) | ||
136 | + } | ||
137 | + return repository.NewStaffAssessContentRepository(transactionContext) | ||
138 | +} | ||
139 | + | ||
140 | +func CreateStaffAssessTaskRepository(options map[string]interface{}) domain.StaffAssessContentRepository { | ||
141 | + var transactionContext *pg.TransactionContext | ||
142 | + if value, ok := options["transactionContext"]; ok { | ||
143 | + transactionContext = value.(*pg.TransactionContext) | ||
144 | + } | ||
145 | + return repository.NewStaffAssessContentRepository(transactionContext) | ||
146 | +} |
1 | +package adapter | ||
2 | + | ||
3 | +type AssessSelfList struct { | ||
4 | + AssessId int `json:"assessId"` //用户执行的评估项id | ||
5 | + BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 | ||
6 | + EndTime string `json:"endTime"` //开始时间 2006-01-02 15:04:05 | ||
7 | + CycleId int `json:"cycleId"` //周期id | ||
8 | + CycleName string `json:"cycleName"` //周期名称 | ||
9 | + EvaluationProjectId int `json:"evaluationProjectId"` //项目id | ||
10 | + EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | ||
11 | +} | ||
12 | + | ||
13 | +type StaffInfo struct { | ||
14 | + UserName string `json:"userName"` //员工名称 | ||
15 | + CompanyName string `json:"companyName"` //公司名称 | ||
16 | + SupperUserName string `json:"supperUserName"` //上级名称 | ||
17 | + DutyTime string `json:"dutyTime"` //上岗时间 | ||
18 | +} |
1 | +package adapter | ||
2 | + | ||
3 | +type AssessTaskDescResp struct { | ||
4 | + AssessTaskId int `json:"assessTaskId"` // | ||
5 | + EvaluationProjectId int `json:"evaluationProjectId"` //项目id | ||
6 | + EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | ||
7 | + CycleName string `json:"cycleName"` //周期名称 | ||
8 | + BeginTime string `json:"beginTime"` //开始时间 2006-01-02 | ||
9 | + EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 | ||
10 | + StepList []AssessTaskStep `json:"stepList"` // 考评流程 | ||
11 | +} | ||
12 | + | ||
13 | +type AssessTaskStep struct { | ||
14 | + SortBy int `json:"sortBy"` //排序 | ||
15 | + LinkNodeName string `json:"linkNodeName"` //流程名称 | ||
16 | + BeginTime string `json:"beginTime"` //开始时间时间 | ||
17 | + EndTime string `json:"endTime"` //结束时间 | ||
18 | + LinkNodeType string `json:"linkNodeType"` //流程类型 | ||
19 | + Desc string `json:"desc"` //情况描述 | ||
20 | + Status int `json:"status"` //流程是否完成 | ||
21 | +} |
1 | +package adapter | ||
2 | + | ||
3 | +type SearchAssessMeResp struct { | ||
4 | + AssessTaskId int `json:"assessTaskId"` | ||
5 | + BeginTime string `json:"beginTime"` | ||
6 | + EndTime string `json:"endTime"` | ||
7 | + CycleId int `json:"cycleId"` | ||
8 | + CycleName string `json:"cycleName"` | ||
9 | + EvaluationProjectId int `json:"evaluationProjectId"` | ||
10 | + EvaluationProjectName string `json:"evaluationProjectName"` | ||
11 | +} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "time" | ||
5 | + | ||
6 | + "github.com/linmadan/egglib-go/core/application" | ||
7 | + "github.com/linmadan/egglib-go/utils/tool_funs" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/adapter" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" | ||
11 | +) | ||
12 | + | ||
13 | +type StaffAssessServeice struct { | ||
14 | +} | ||
15 | + | ||
16 | +// 获取我参与过的评估项目列表 | ||
17 | +func (srv StaffAssessServeice) SearchAssessMe(param *query.SearchAssessMeQuery) (map[string]interface{}, error) { | ||
18 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
19 | + if err != nil { | ||
20 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
21 | + } | ||
22 | + if err := transactionContext.StartTransaction(); err != nil { | ||
23 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
24 | + } | ||
25 | + defer func() { | ||
26 | + _ = transactionContext.RollbackTransaction() | ||
27 | + }() | ||
28 | + cycleRepo := factory.CreateEvaluationCycleRepository(map[string]interface{}{ | ||
29 | + "transactionContext": transactionContext, | ||
30 | + }) | ||
31 | + currentTime, err := time.ParseInLocation("2006-01-02", param.CurrentTime, time.Local) | ||
32 | + if err != nil { | ||
33 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "时间条件填写错误") | ||
34 | + } | ||
35 | + //获取param.CurrentTime 对应的周期 | ||
36 | + _, cycleList, err := cycleRepo.Find(map[string]interface{}{ | ||
37 | + "companyId": param.CompanyId, | ||
38 | + "timeStart": currentTime, | ||
39 | + "timeEnd": currentTime, | ||
40 | + "limit": 1, | ||
41 | + }) | ||
42 | + if err != nil { | ||
43 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询周期"+err.Error()) | ||
44 | + } | ||
45 | + if len(cycleList) == 0 { | ||
46 | + listData := []adapter.SearchAssessMeResp{} | ||
47 | + return tool_funs.SimpleWrapGridMap(0, listData), nil | ||
48 | + } | ||
49 | + | ||
50 | + //更具周期和param.UserId 获取评估项目列表 | ||
51 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
52 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
53 | + } | ||
54 | + var cnt int64 | ||
55 | + var listData []adapter.SearchAssessMeResp | ||
56 | + return tool_funs.SimpleWrapGridMap(cnt, listData), nil | ||
57 | +} | ||
58 | + | ||
59 | +// 获取项目评估进度描述 | ||
60 | +func (srv StaffAssessServeice) AssessTaskDesc(param query.AssessTaskDescQuery) (*adapter.AssessTaskDescResp, error) { | ||
61 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
62 | + if err != nil { | ||
63 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
64 | + } | ||
65 | + if err := transactionContext.StartTransaction(); err != nil { | ||
66 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
67 | + } | ||
68 | + defer func() { | ||
69 | + _ = transactionContext.RollbackTransaction() | ||
70 | + }() | ||
71 | + | ||
72 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
73 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
74 | + } | ||
75 | + return nil, nil | ||
76 | +} | ||
77 | + | ||
78 | +// 获取自评反馈列表 | ||
79 | +func (srv StaffAssessServeice) AssessSelfList(param query.AssessTaskDescQuery) (map[string]interface{}, error) { | ||
80 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
81 | + if err != nil { | ||
82 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
83 | + } | ||
84 | + if err := transactionContext.StartTransaction(); err != nil { | ||
85 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
86 | + } | ||
87 | + defer func() { | ||
88 | + _ = transactionContext.RollbackTransaction() | ||
89 | + }() | ||
90 | + | ||
91 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
92 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
93 | + } | ||
94 | + var cnt int64 | ||
95 | + var listData []adapter.AssessSelfList | ||
96 | + var userInfo adapter.StaffInfo | ||
97 | + result := tool_funs.SimpleWrapGridMap(cnt, listData) | ||
98 | + result["userInfo"] = userInfo | ||
99 | + return result, nil | ||
100 | +} |
@@ -3,13 +3,14 @@ package repository | @@ -3,13 +3,14 @@ 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 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" | 9 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" |
8 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 10 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" | 12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" |
11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" | 13 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" |
12 | - "time" | ||
13 | ) | 14 | ) |
14 | 15 | ||
15 | type EvaluationCycleRepository struct { | 16 | type EvaluationCycleRepository struct { |
@@ -133,6 +134,16 @@ func (repo *EvaluationCycleRepository) Find(queryOptions map[string]interface{}) | @@ -133,6 +134,16 @@ func (repo *EvaluationCycleRepository) Find(queryOptions map[string]interface{}) | ||
133 | query.Offset(v) | 134 | query.Offset(v) |
134 | } | 135 | } |
135 | 136 | ||
137 | + if v, ok := queryOptions["timeStart"]; ok { | ||
138 | + t := v.(time.Time) | ||
139 | + query.Where("time_start<=?", t) | ||
140 | + } | ||
141 | + | ||
142 | + if v, ok := queryOptions["timeEnd"]; ok { | ||
143 | + t := v.(time.Time) | ||
144 | + query.Where("time_end>=?", t) | ||
145 | + } | ||
146 | + | ||
136 | count, err := query.SelectAndCount() | 147 | count, err := query.SelectAndCount() |
137 | if err != nil { | 148 | if err != nil { |
138 | return 0, nil, err | 149 | return 0, nil, err |
@@ -17,7 +17,7 @@ type StaffAssessContentRepository struct { | @@ -17,7 +17,7 @@ type StaffAssessContentRepository struct { | ||
17 | 17 | ||
18 | var _ domain.StaffAssessContentRepository = (*StaffAssessContentRepository)(nil) | 18 | var _ domain.StaffAssessContentRepository = (*StaffAssessContentRepository)(nil) |
19 | 19 | ||
20 | -func NewStaffEvaluationRepository(transactionContext *pgTransaction.TransactionContext) *StaffAssessContentRepository { | 20 | +func NewStaffAssessContentRepository(transactionContext *pgTransaction.TransactionContext) *StaffAssessContentRepository { |
21 | return &StaffAssessContentRepository{transactionContext: transactionContext} | 21 | return &StaffAssessContentRepository{transactionContext: transactionContext} |
22 | } | 22 | } |
23 | 23 |
-
请 注册 或 登录 后发表评论