正在显示
14 个修改的文件
包含
295 行增加
和
21 行删除
@@ -23,3 +23,41 @@ type AssessInfoResp struct { | @@ -23,3 +23,41 @@ type AssessInfoResp struct { | ||
23 | DutyTime string `json:"dutyTime"` //入职时间 // | 23 | DutyTime string `json:"dutyTime"` //入职时间 // |
24 | AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容 | 24 | AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容 |
25 | } | 25 | } |
26 | + | ||
27 | +// 周期内的每日自评小结 | ||
28 | +type AssessCountLevelResp struct { | ||
29 | + CycleId int64 `json:"cycleId,string"` //周期id | ||
30 | + CycleName string `json:"cycleName"` //周期名称 | ||
31 | + EvaluationProjectId int `json:"evaluationProjectId,string"` //项目id | ||
32 | + EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | ||
33 | + TargetUserId int `json:"targetUserId,string"` //被评估的目标用户,被执行的 | ||
34 | + TargetUserName string `json:"targetUserName"` // | ||
35 | + CompanyLogo string `json:"companyLogo,"` //公司logo | ||
36 | + CompanyName string `json:"companyName"` //公司名称 | ||
37 | + SupperUser string `json:"superUser"` //目标用户的上级 | ||
38 | + DutyTime string `json:"dutyTime"` //入职时间 | ||
39 | + EvaluationItems []AssessCountLeveltItem `json:"evaluationItems"` | ||
40 | +} | ||
41 | + | ||
42 | +type AssessCountLeveltItem struct { | ||
43 | + EvaluationItemId int `json:"evaluationItemId,string"` //评估条目的id | ||
44 | + SortBy int `json:"sortBy"` //排序 | ||
45 | + Category string `json:"category"` //类别 | ||
46 | + Name string `json:"name"` //名称 | ||
47 | + PromptTitle string `json:"promptTitle"` //提示项标题 | ||
48 | + PromptText string `json:"promptText"` //提示项正文 | ||
49 | + EntryItems []*domain.EntryItem `json:"entryItems"` //填写的反馈 | ||
50 | + RuleType int `json:"ruleType"` //评估方式(0评级、1评分) | ||
51 | + Rule domain.EvaluationRule `json:"rule"` //评估的选项规则 | ||
52 | + Weight float64 `json:"weight"` //"权重" | ||
53 | + Remark string `json:"remark"` //填写的内容反馈 | ||
54 | + EvaluatorId int `json:"evaluatorId"` //评估人id | ||
55 | + LevelCount []LevalCodeCount `json:"levelCount"` //周期内每次评估的等级数量统计 | ||
56 | +} | ||
57 | + | ||
58 | +// 评级数量 | ||
59 | +type LevalCodeCount struct { | ||
60 | + Code string `json:"code"` //评级代码 | ||
61 | + Number int `json:"number"` //数量 | ||
62 | + ItemList []string `json:"itemList"` //对应的评估项名称 | ||
63 | +} |
@@ -14,3 +14,10 @@ type ExportUserAssess2Commad struct { | @@ -14,3 +14,10 @@ type ExportUserAssess2Commad struct { | ||
14 | OperatorId int `cname:"操作人ID" json:"operatorId"` | 14 | OperatorId int `cname:"操作人ID" json:"operatorId"` |
15 | ExportUserId []string `cname:"指定员工数据导出" json:"exportUserId"` | 15 | ExportUserId []string `cname:"指定员工数据导出" json:"exportUserId"` |
16 | } | 16 | } |
17 | + | ||
18 | +type StaffAsessSelfCountLevel struct { | ||
19 | + CompanyId int `cname:"公司ID" json:"-"` | ||
20 | + TargetUserId int `json:"targetUserId"` | ||
21 | + ProjectId int `json:"projectId,string"` | ||
22 | + CycleId int `cname:"周期ID" json:"cycleId,string"` | ||
23 | +} |
@@ -63,7 +63,7 @@ func (srv *StaffAssessServeice) ExportUserAssess2V2(param *query.ExportUserAsses | @@ -63,7 +63,7 @@ func (srv *StaffAssessServeice) ExportUserAssess2V2(param *query.ExportUserAsses | ||
63 | if len(uname) == 0 { | 63 | if len(uname) == 0 { |
64 | continue | 64 | continue |
65 | } | 65 | } |
66 | - tableHeader, ok := eData.tableHeader[k1+val2] | 66 | + tableHeader, ok := eData.tableHeader[eData.tableHeaderKey(k1, val2)] |
67 | if !ok { | 67 | if !ok { |
68 | continue | 68 | continue |
69 | } | 69 | } |
@@ -180,7 +180,7 @@ func (e *exportData3) FormatTableHead(param []dao.DataEvaluationItemUsed2) { | @@ -180,7 +180,7 @@ func (e *exportData3) FormatTableHead(param []dao.DataEvaluationItemUsed2) { | ||
180 | } | 180 | } |
181 | } | 181 | } |
182 | //每个员工对应的日期列表 | 182 | //每个员工对应的日期列表 |
183 | - key1 := val.TargetUserId + "+" + val.EvaluationProjectId | 183 | + key1 := e.tableHeaderKey(val.TargetUserId, val.EvaluationProjectId) |
184 | if _, ok := e.tableHeader[key1]; !ok { | 184 | if _, ok := e.tableHeader[key1]; !ok { |
185 | e.tableHeader[key1] = &HeaderLevel{ | 185 | e.tableHeader[key1] = &HeaderLevel{ |
186 | Name: "个人绩效评估等级统计表", | 186 | Name: "个人绩效评估等级统计表", |
@@ -243,3 +243,7 @@ func (e *exportData3) data23Key(userId string, category string, weight string, c | @@ -243,3 +243,7 @@ func (e *exportData3) data23Key(userId string, category string, weight string, c | ||
243 | func (e *exportData3) userDayKey(userId string, projectId string) string { | 243 | func (e *exportData3) userDayKey(userId string, projectId string) string { |
244 | return fmt.Sprintf("%s-%s", userId, projectId) | 244 | return fmt.Sprintf("%s-%s", userId, projectId) |
245 | } | 245 | } |
246 | + | ||
247 | +func (e *exportData3) tableHeaderKey(targetUserId, evaluationProjectId string) string { | ||
248 | + return targetUserId + "-" + evaluationProjectId | ||
249 | +} |
@@ -14,6 +14,7 @@ import ( | @@ -14,6 +14,7 @@ import ( | ||
14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" | 14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" |
15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" | 15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" |
16 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 16 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
17 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" | ||
17 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log" | 18 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log" |
18 | ) | 19 | ) |
19 | 20 | ||
@@ -1124,3 +1125,167 @@ func (srv StaffAssessServeice) recoverAssessCache(context application.Transactio | @@ -1124,3 +1125,167 @@ func (srv StaffAssessServeice) recoverAssessCache(context application.Transactio | ||
1124 | } | 1125 | } |
1125 | } | 1126 | } |
1126 | } | 1127 | } |
1128 | + | ||
1129 | +// 获取目标员工自评周期列表 | ||
1130 | +func (srv StaffAssessServeice) ListTargetUserSelfCycle(param *query.ListTargetUserCycleQuery) (map[string]interface{}, error) { | ||
1131 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
1132 | + if err != nil { | ||
1133 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1134 | + } | ||
1135 | + if err := transactionContext.StartTransaction(); err != nil { | ||
1136 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1137 | + } | ||
1138 | + defer func() { | ||
1139 | + _ = transactionContext.RollbackTransaction() | ||
1140 | + }() | ||
1141 | + staffAssessDao := dao.NewStaffAssessDao(map[string]interface{}{ | ||
1142 | + "transactionContext": transactionContext, | ||
1143 | + }) | ||
1144 | + var limit int = 360 | ||
1145 | + var offset int = 0 | ||
1146 | + if param.PageSize > 0 { | ||
1147 | + limit = param.PageSize | ||
1148 | + } | ||
1149 | + offset = (param.PageNumber - 1) * param.PageSize | ||
1150 | + | ||
1151 | + cycleList, err := staffAssessDao.SearchTargetUserCycleProject(param.CompanyId, param.TargetUserId, limit, offset) | ||
1152 | + if err != nil { | ||
1153 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1154 | + } | ||
1155 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
1156 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1157 | + } | ||
1158 | + | ||
1159 | + return tool_funs.SimpleWrapGridMap(int64(len(cycleList)), cycleList), nil | ||
1160 | +} | ||
1161 | + | ||
1162 | +// 按照周期获取员工的每日自评小结 | ||
1163 | +func (srv StaffAssessServeice) GetStaffAsessSelfCountLevel(param *query.StaffAsessSelfCountLevel) (*adapter.AssessCountLevelResp, error) { | ||
1164 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
1165 | + if err != nil { | ||
1166 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1167 | + } | ||
1168 | + if err := transactionContext.StartTransaction(); err != nil { | ||
1169 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1170 | + } | ||
1171 | + defer func() { | ||
1172 | + _ = transactionContext.RollbackTransaction() | ||
1173 | + }() | ||
1174 | + // 统计周期内,评估项等级的数量 | ||
1175 | + assessDao := dao.NewStaffAssessDao(map[string]interface{}{ | ||
1176 | + "transactionContext": transactionContext, | ||
1177 | + }) | ||
1178 | + evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
1179 | + "transactionContext": transactionContext, | ||
1180 | + }) | ||
1181 | + assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ | ||
1182 | + "transactionContext": transactionContext, | ||
1183 | + }) | ||
1184 | + | ||
1185 | + levelCodeCountList, err := assessDao.CountAssessContentLevelCode(param.ProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId) | ||
1186 | + if err != nil { | ||
1187 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1188 | + } | ||
1189 | + _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{ | ||
1190 | + "evaluationProjectId": param.ProjectId, | ||
1191 | + "nodeType": int(domain.LinkNodeSelfAssessment), | ||
1192 | + }) | ||
1193 | + if err != nil { | ||
1194 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1195 | + } | ||
1196 | + //获取员工的评估 | ||
1197 | + _, assessList, err := assessReps.Find(map[string]interface{}{ | ||
1198 | + "companyId": param.CompanyId, | ||
1199 | + "limit": 1, | ||
1200 | + "cycleId": param.CycleId, | ||
1201 | + "targetUserId": param.TargetUserId, | ||
1202 | + "evaluationProjectId": param.ProjectId, | ||
1203 | + }) | ||
1204 | + if err != nil { | ||
1205 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1206 | + } | ||
1207 | + | ||
1208 | + if len(assessList) == 0 { | ||
1209 | + return &adapter.AssessCountLevelResp{ | ||
1210 | + EvaluationProjectId: param.ProjectId, | ||
1211 | + CycleId: int64(param.CycleId), | ||
1212 | + TargetUserId: param.TargetUserId, | ||
1213 | + }, nil | ||
1214 | + } | ||
1215 | + assessData := assessList[0] | ||
1216 | + targetUserDesc, err := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId)) | ||
1217 | + if err != nil { | ||
1218 | + log.Logger.Error("获取员工描述" + err.Error()) | ||
1219 | + } | ||
1220 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
1221 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1222 | + } | ||
1223 | + result := adapter.AssessCountLevelResp{ | ||
1224 | + CycleId: assessData.CycleId, | ||
1225 | + CycleName: assessData.CycleName, | ||
1226 | + EvaluationProjectId: assessData.EvaluationProjectId, | ||
1227 | + EvaluationProjectName: assessData.EvaluationProjectName, | ||
1228 | + TargetUserId: assessData.TargetUser.UserId, | ||
1229 | + TargetUserName: assessData.TargetUser.UserName, | ||
1230 | + CompanyLogo: "", | ||
1231 | + CompanyName: "", | ||
1232 | + SupperUser: "", | ||
1233 | + DutyTime: "", | ||
1234 | + EvaluationItems: []adapter.AssessCountLeveltItem{}, | ||
1235 | + } | ||
1236 | + if targetUserDesc != nil { | ||
1237 | + result.CompanyName = targetUserDesc.CompanyName | ||
1238 | + result.SupperUser = targetUserDesc.SupperUserName | ||
1239 | + result.CompanyLogo = targetUserDesc.CompanyLogo | ||
1240 | + result.DutyTime = targetUserDesc.DutyTime | ||
1241 | + } | ||
1242 | + | ||
1243 | + levelCodeMap := map[int][]adapter.LevalCodeCount{} | ||
1244 | + for _, v := range itemList { | ||
1245 | + codes := v.Rule.GetLevelCodes() | ||
1246 | + levelCode := []adapter.LevalCodeCount{} | ||
1247 | + for _, v2 := range codes { | ||
1248 | + levelCode = append(levelCode, adapter.LevalCodeCount{ | ||
1249 | + Code: v2, | ||
1250 | + Number: 0, | ||
1251 | + }) | ||
1252 | + } | ||
1253 | + levelCodeMap[v.Id] = levelCode | ||
1254 | + } | ||
1255 | + levelCodeCountMap := map[string]int{} | ||
1256 | + for _, v := range levelCodeCountList { | ||
1257 | + key := fmt.Sprintf("%s-%s-%s", v.Category, v.Name, v.LevelValue) | ||
1258 | + levelCodeCountMap[key] = v.Cnt | ||
1259 | + } | ||
1260 | + for _, v := range itemList { | ||
1261 | + itemCount := adapter.AssessCountLeveltItem{ | ||
1262 | + EvaluationItemId: v.Id, | ||
1263 | + SortBy: v.SortBy, | ||
1264 | + Category: v.Category, | ||
1265 | + Name: v.Name, | ||
1266 | + PromptTitle: v.PromptTitle, | ||
1267 | + PromptText: v.PromptText, | ||
1268 | + EntryItems: v.EntryItems, | ||
1269 | + RuleType: v.RuleType, | ||
1270 | + Rule: v.Rule, | ||
1271 | + Weight: v.Weight, | ||
1272 | + EvaluatorId: v.EvaluatorId, | ||
1273 | + LevelCount: []adapter.LevalCodeCount{}, | ||
1274 | + } | ||
1275 | + levelCodes := levelCodeMap[v.Id] | ||
1276 | + for i2 := range levelCodes { | ||
1277 | + key := fmt.Sprintf("%s-%s-%s", | ||
1278 | + itemCount.Category, | ||
1279 | + itemCount.Name, | ||
1280 | + levelCodes[i2].Code, | ||
1281 | + ) | ||
1282 | + if mVal, ok := levelCodeCountMap[key]; ok { | ||
1283 | + levelCodes[i2].Number = mVal | ||
1284 | + } | ||
1285 | + } | ||
1286 | + itemCount.LevelCount = levelCodes | ||
1287 | + result.EvaluationItems = append(result.EvaluationItems, itemCount) | ||
1288 | + } | ||
1289 | + | ||
1290 | + return &result, nil | ||
1291 | +} |
@@ -435,7 +435,7 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess | @@ -435,7 +435,7 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess | ||
435 | Hrbp: hrbp, | 435 | Hrbp: hrbp, |
436 | }) | 436 | }) |
437 | if err != nil { | 437 | if err != nil { |
438 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计总数"+err.Error()) | 438 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取所有的评估的指标"+err.Error()) |
439 | } | 439 | } |
440 | if err := transactionContext.CommitTransaction(); err != nil { | 440 | if err := transactionContext.CommitTransaction(); err != nil { |
441 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 441 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -875,7 +875,7 @@ func (srv *SummaryEvaluationService) GetTargetUserCycleList(param *command.Query | @@ -875,7 +875,7 @@ func (srv *SummaryEvaluationService) GetTargetUserCycleList(param *command.Query | ||
875 | return tool_funs.SimpleWrapGridMap(int64(cnt), cycleList), nil | 875 | return tool_funs.SimpleWrapGridMap(int64(cnt), cycleList), nil |
876 | } | 876 | } |
877 | 877 | ||
878 | -// 自评小结详情 | 878 | +// 周期综合自评小结详情 |
879 | func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.QueryEvaluation) (*adapter.EvaluationInfoCountCodeAdapter, error) { | 879 | func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.QueryEvaluation) (*adapter.EvaluationInfoCountCodeAdapter, error) { |
880 | transactionContext, err := factory.CreateTransactionContext(nil) | 880 | transactionContext, err := factory.CreateTransactionContext(nil) |
881 | if err != nil { | 881 | if err != nil { |
@@ -887,16 +887,10 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que | @@ -887,16 +887,10 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que | ||
887 | defer func() { | 887 | defer func() { |
888 | _ = transactionContext.RollbackTransaction() | 888 | _ = transactionContext.RollbackTransaction() |
889 | }() | 889 | }() |
890 | - | ||
891 | //统计周期内,评估项等级的数量 | 890 | //统计周期内,评估项等级的数量 |
892 | assessDao := dao.NewStaffAssessDao(map[string]interface{}{ | 891 | assessDao := dao.NewStaffAssessDao(map[string]interface{}{ |
893 | "transactionContext": transactionContext, | 892 | "transactionContext": transactionContext, |
894 | }) | 893 | }) |
895 | - levelCodeCountList, err := assessDao.CountAssessContentLevelCode(param.TargetUserId, domain.AssessSelf, param.CycleId) | ||
896 | - if err != nil { | ||
897 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
898 | - } | ||
899 | - | ||
900 | evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | 894 | evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ |
901 | "transactionContext": transactionContext, | 895 | "transactionContext": transactionContext, |
902 | }) | 896 | }) |
@@ -919,6 +913,10 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que | @@ -919,6 +913,10 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que | ||
919 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 913 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
920 | } | 914 | } |
921 | evaluationData := evaluationList[0] | 915 | evaluationData := evaluationList[0] |
916 | + levelCodeCountList, err := assessDao.CountAssessContentLevelCode(evaluationData.EvaluationProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId) | ||
917 | + if err != nil { | ||
918 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
919 | + } | ||
922 | _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{ | 920 | _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{ |
923 | "evaluationProjectId": evaluationData.EvaluationProjectId, | 921 | "evaluationProjectId": evaluationData.EvaluationProjectId, |
924 | "nodeType": int(domain.LinkNodeSelfAssessment), | 922 | "nodeType": int(domain.LinkNodeSelfAssessment), |
@@ -9,8 +9,8 @@ import ( | @@ -9,8 +9,8 @@ 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: 3422052542754304, | ||
13 | - Phone: "13678998765", | 12 | + UserId: 3422174102828544, |
13 | + Phone: "17708397664", | ||
14 | PlatformId: 29, | 14 | PlatformId: 29, |
15 | AdminType: 1, | 15 | AdminType: 1, |
16 | } | 16 | } |
@@ -1199,7 +1199,7 @@ type AssessContentLevelCode struct { | @@ -1199,7 +1199,7 @@ type AssessContentLevelCode struct { | ||
1199 | Name string `pg:"name"` //名称 | 1199 | Name string `pg:"name"` //名称 |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | -func (d *StaffAssessDao) CountAssessContentLevelCode(targetUserId int, assessType domain.StaffAssessType, cycleId int) ([]AssessContentLevelCode, error) { | 1202 | +func (d *StaffAssessDao) CountAssessContentLevelCode(projectId int, targetUserId int, assessType domain.StaffAssessType, cycleId int) ([]AssessContentLevelCode, error) { |
1203 | sqlStr := ` | 1203 | sqlStr := ` |
1204 | select | 1204 | select |
1205 | count(staff_assess_content.level_value) as cnt , | 1205 | count(staff_assess_content.level_value) as cnt , |
@@ -1208,16 +1208,18 @@ staff_assess_content.category , | @@ -1208,16 +1208,18 @@ staff_assess_content.category , | ||
1208 | staff_assess_content."name" | 1208 | staff_assess_content."name" |
1209 | from staff_assess_content | 1209 | from staff_assess_content |
1210 | join staff_assess on staff_assess_content.staff_assess_id = staff_assess.id | 1210 | join staff_assess on staff_assess_content.staff_assess_id = staff_assess.id |
1211 | -where 1=1 and staff_assess.deleted_at isnull | 1211 | +where 1=1 |
1212 | +and staff_assess.deleted_at isnull | ||
1212 | and target_user ->>'userId'='?' | 1213 | and target_user ->>'userId'='?' |
1213 | and staff_assess."types" = ? | 1214 | and staff_assess."types" = ? |
1214 | and staff_assess_content.level_value notnull | 1215 | and staff_assess_content.level_value notnull |
1215 | and staff_assess.cycle_id =? | 1216 | and staff_assess.cycle_id =? |
1217 | +and staff_assess.evaluation_project_id=? | ||
1216 | group by level_value,category,"name" ` | 1218 | group by level_value,category,"name" ` |
1217 | 1219 | ||
1218 | var result []AssessContentLevelCode | 1220 | var result []AssessContentLevelCode |
1219 | condition := []interface{}{ | 1221 | condition := []interface{}{ |
1220 | - targetUserId, string(assessType), cycleId, | 1222 | + projectId, targetUserId, string(assessType), cycleId, |
1221 | } | 1223 | } |
1222 | tx := d.transactionContext.PgTx | 1224 | tx := d.transactionContext.PgTx |
1223 | _, err := tx.Query(&result, sqlStr, condition...) | 1225 | _, err := tx.Query(&result, sqlStr, condition...) |
@@ -42,7 +42,7 @@ func (d *StaffAssessDao) SearchStaffAssessContent2(companyId int, cycleId int, o | @@ -42,7 +42,7 @@ func (d *StaffAssessDao) SearchStaffAssessContent2(companyId int, cycleId int, o | ||
42 | staff_assess_content.category , | 42 | staff_assess_content.category , |
43 | staff_assess_content."name" as content_name , | 43 | staff_assess_content."name" as content_name , |
44 | staff_assess_content.weight, | 44 | staff_assess_content.weight, |
45 | - staff_assess_content.prompt_text , | 45 | + staff_assess_content.prompt_text, |
46 | staff_assess_content.remark | 46 | staff_assess_content.remark |
47 | from staff_assess | 47 | from staff_assess |
48 | join staff_assess_content on staff_assess.id = staff_assess_content.staff_assess_id | 48 | join staff_assess_content on staff_assess.id = staff_assess_content.staff_assess_id |
@@ -58,7 +58,7 @@ and staff_assess.evaluation_project_id in ( | @@ -58,7 +58,7 @@ and staff_assess.evaluation_project_id in ( | ||
58 | condition = append(condition, pg.In(exportUserIds)) | 58 | condition = append(condition, pg.In(exportUserIds)) |
59 | } | 59 | } |
60 | 60 | ||
61 | - sqlStr = withSql + sqlStr | 61 | + sqlStr = withSql + sqlStr + ` order by staff_assess.begin_time ` |
62 | result := []DataStaffAssessContent2{} | 62 | result := []DataStaffAssessContent2{} |
63 | tx := d.transactionContext.PgTx | 63 | tx := d.transactionContext.PgTx |
64 | _, err := tx.Query(&result, sqlStr, condition...) | 64 | _, err := tx.Query(&result, sqlStr, condition...) |
@@ -103,7 +103,7 @@ join evaluation_item_used on evaluation_item_used.evaluation_project_id = staf | @@ -103,7 +103,7 @@ join evaluation_item_used on evaluation_item_used.evaluation_project_id = staf | ||
103 | where 1=1 | 103 | where 1=1 |
104 | and staff_assess.cycle_id =? and "types" ='self' | 104 | and staff_assess.cycle_id =? and "types" ='self' |
105 | and staff_assess.evaluation_project_id in ( | 105 | and staff_assess.evaluation_project_id in ( |
106 | - select evaluation_project.id from evaluation_project limit 10 | 106 | + select t_project_4.project_id from t_project_4 |
107 | ) ` | 107 | ) ` |
108 | condition := []interface{}{cycleId} | 108 | condition := []interface{}{cycleId} |
109 | if len(exportUserIds) > 0 { | 109 | if len(exportUserIds) > 0 { |
@@ -172,3 +172,37 @@ func (d *StaffAssessDao) catchProjectIdByPermission(companyId int, cycleId int, | @@ -172,3 +172,37 @@ func (d *StaffAssessDao) catchProjectIdByPermission(companyId int, cycleId int, | ||
172 | 172 | ||
173 | return fmt.Sprintf(withSql, params...) | 173 | return fmt.Sprintf(withSql, params...) |
174 | } | 174 | } |
175 | + | ||
176 | +type TargetUserCycleProject struct { | ||
177 | + CycleId string `pg:"cycle_id" json:"cycleId"` //周期id | ||
178 | + CycleName string `pg:"cycle_name" json:"cycleName"` //周期名称 | ||
179 | + EvaluationProjectIds []string `pg:"evaluation_project_ids" json:"evaluationProjectIds"` | ||
180 | +} | ||
181 | + | ||
182 | +// 获取目标员工的自评周期和项目 | ||
183 | +func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserId int, limit int, offset int) ([]TargetUserCycleProject, error) { | ||
184 | + sqlStr := ` with t_staff_assess as ( | ||
185 | + select distinct staff_assess.cycle_id , | ||
186 | + staff_assess.cycle_name, | ||
187 | + staff_assess.evaluation_project_id | ||
188 | + from staff_assess | ||
189 | + where 1=1 | ||
190 | + and staff_assess."types" ='self' | ||
191 | + and staff_assess.deleted_at isnull | ||
192 | + and staff_assess.target_user ->>'userId'='?' | ||
193 | + and staff_assess.company_id=? | ||
194 | + ) | ||
195 | + select | ||
196 | + t_staff_assess.cycle_id, | ||
197 | + t_staff_assess.cycle_name, | ||
198 | + array_agg(to_char(t_staff_assess.evaluation_project_id,'9999999999999999999')) as evaluation_project_ids | ||
199 | + from t_staff_assess | ||
200 | + group by cycle_id,cycle_name | ||
201 | + limit ? offset ? | ||
202 | + ` | ||
203 | + condition := []interface{}{companyId, targetUserId, limit, offset} | ||
204 | + result := []TargetUserCycleProject{} | ||
205 | + tx := d.transactionContext.PgTx | ||
206 | + _, err := tx.Query(&result, sqlStr, condition...) | ||
207 | + return result, err | ||
208 | +} |
@@ -161,6 +161,9 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | @@ -161,6 +161,9 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | ||
161 | if v, ok := queryOptions["beginDay"]; ok { | 161 | if v, ok := queryOptions["beginDay"]; ok { |
162 | query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v) | 162 | query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v) |
163 | } | 163 | } |
164 | + if v, ok := queryOptions["evaluationProjectId"]; ok { | ||
165 | + query.Where("staff_assess.evaluation_project_id=?", v) | ||
166 | + } | ||
164 | query.Order("staff_assess.id DESC") | 167 | query.Order("staff_assess.id DESC") |
165 | count, err := query.SelectAndCount() | 168 | count, err := query.SelectAndCount() |
166 | if err != nil { | 169 | if err != nil { |
@@ -324,3 +324,20 @@ func (c *StaffAssessController) ExportUserAssess2() { | @@ -324,3 +324,20 @@ func (c *StaffAssessController) ExportUserAssess2() { | ||
324 | c.Ctx.Output.Header("Expires", "0") | 324 | c.Ctx.Output.Header("Expires", "0") |
325 | data.Write(c.Ctx.ResponseWriter) | 325 | data.Write(c.Ctx.ResponseWriter) |
326 | } | 326 | } |
327 | + | ||
328 | +// ListTargetUserSelfCycle 获取目标员工自评周期列表 | ||
329 | +func (c *StaffAssessController) ListTargetUserSelfCycle() { | ||
330 | + srv := service.NewStaffAssessServeice() | ||
331 | + paramReq := &query.ListTargetUserCycleQuery{} | ||
332 | + err := c.BindJSON(paramReq) | ||
333 | + if err != nil { | ||
334 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
335 | + c.Response(nil, e) | ||
336 | + return | ||
337 | + } | ||
338 | + userReq := middlewares.GetUser(c.Ctx) | ||
339 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
340 | + paramReq.TargetUserId = int(userReq.UserId) | ||
341 | + data, err := srv.ListTargetUserSelfCycle(paramReq) | ||
342 | + c.Response(data, err) | ||
343 | +} |
@@ -90,8 +90,6 @@ func (c *SummaryEvaluationController) GetTargetUserCycleList() { | @@ -90,8 +90,6 @@ func (c *SummaryEvaluationController) GetTargetUserCycleList() { | ||
90 | c.Response(nil, e) | 90 | c.Response(nil, e) |
91 | return | 91 | return |
92 | } | 92 | } |
93 | - // userReq := middlewares.GetUser(c.Ctx) | ||
94 | - // paramReq.UserId = int(userReq.UserId) | ||
95 | data, err := srv.GetTargetUserCycleList(paramReq) | 93 | data, err := srv.GetTargetUserCycleList(paramReq) |
96 | c.Response(data, err) | 94 | c.Response(data, err) |
97 | } | 95 | } |
@@ -110,7 +108,6 @@ func (c *SummaryEvaluationController) CountEvaluationSelfLevel() { | @@ -110,7 +108,6 @@ func (c *SummaryEvaluationController) CountEvaluationSelfLevel() { | ||
110 | paramReq.CompanyId = int(userReq.CompanyId) | 108 | paramReq.CompanyId = int(userReq.CompanyId) |
111 | data, err := srv.CountEvaluationSelfLevel(paramReq) | 109 | data, err := srv.CountEvaluationSelfLevel(paramReq) |
112 | c.Response(data, err) | 110 | c.Response(data, err) |
113 | - | ||
114 | } | 111 | } |
115 | 112 | ||
116 | func (c *SummaryEvaluationController) Evaluation360List() { | 113 | func (c *SummaryEvaluationController) Evaluation360List() { |
@@ -35,6 +35,7 @@ func init() { | @@ -35,6 +35,7 @@ func init() { | ||
35 | web.NSCtrlPost("/summary/users", (*controllers.StaffAssessController).QueryMemberSummary), //员工绩效-综合管理-成员列表 | 35 | web.NSCtrlPost("/summary/users", (*controllers.StaffAssessController).QueryMemberSummary), //员工绩效-综合管理-成员列表 |
36 | web.NSCtrlPost("/summary/users-indicator", (*controllers.StaffAssessController).QueryMemberPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 | 36 | web.NSCtrlPost("/summary/users-indicator", (*controllers.StaffAssessController).QueryMemberPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 |
37 | web.NSCtrlPost("/summary/export-indicator", (*controllers.StaffAssessController).ExportPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 | 37 | web.NSCtrlPost("/summary/export-indicator", (*controllers.StaffAssessController).ExportPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 |
38 | + web.NSCtrlPost("/target_user/self/cycle", (*controllers.StaffAssessController).ListTargetUserSelfCycle), //获取员工自评的周期下拉列表 | ||
38 | ) | 39 | ) |
39 | //v2 改版 | 40 | //v2 改版 |
40 | assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task", | 41 | assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task", |
-
请 注册 或 登录 后发表评论