作者 tangxvhui

添加 被评估人的周期列表

@@ -522,6 +522,11 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) @@ -522,6 +522,11 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
522 } 522 }
523 } 523 }
524 524
  525 + err = rs.generateEvaluationItemUsed(transactionContext, project)
  526 + if err != nil {
  527 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  528 + }
  529 +
525 if err := transactionContext.CommitTransaction(); err != nil { 530 if err := transactionContext.CommitTransaction(); err != nil {
526 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 531 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
527 } 532 }
@@ -53,197 +53,6 @@ func (srv StaffAssessServeice) getHRBP(transactionContext application.Transactio @@ -53,197 +53,6 @@ func (srv StaffAssessServeice) getHRBP(transactionContext application.Transactio
53 return hrbp, nil 53 return hrbp, nil
54 } 54 }
55 55
56 -// 获取我参与过的评估任务列表  
57 -// func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQuery) (map[string]interface{}, error) {  
58 -// transactionContext, err := factory.CreateTransactionContext(nil)  
59 -// if err != nil {  
60 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
61 -// }  
62 -// if err := transactionContext.StartTransaction(); err != nil {  
63 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
64 -// }  
65 -// defer func() {  
66 -// _ = transactionContext.RollbackTransaction()  
67 -// }()  
68 -  
69 -// staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{  
70 -// "transactionContext": transactionContext,  
71 -// })  
72 -  
73 -// var limit int = 200  
74 -// var offset int = 0  
75 -// if param.PageSize > 0 {  
76 -// limit = param.PageSize  
77 -// }  
78 -// offset = (param.PageNumber - 1) * param.PageSize  
79 -// assessTaskList, err := staffAssessTaskRepo.SearchAssessTaskMe(param.UserId, param.CompanyId, limit, offset)  
80 -// if err != nil {  
81 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())  
82 -// }  
83 -// cnt, err := staffAssessTaskRepo.CountAssessTaskMe(param.UserId, param.CompanyId)  
84 -// if err != nil {  
85 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())  
86 -// }  
87 -  
88 -// if err := transactionContext.CommitTransaction(); err != nil {  
89 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
90 -// }  
91 -// listData := make([]adapter.SearchAssessMeResp, 0, len(assessTaskList))  
92 -// var temp adapter.SearchAssessMeResp  
93 -// for _, v := range assessTaskList {  
94 -// temp = adapter.SearchAssessMeResp{  
95 -// AssessTaskId: v.Id,  
96 -// BeginTime: v.BeginTime.Local().Format("2006-01-02 15:04:05"),  
97 -// EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),  
98 -// CycleId: v.CycleId,  
99 -// CycleName: v.CycleName,  
100 -// EvaluationProjectId: v.EvaluationProjectId,  
101 -// EvaluationProjectName: v.EvaluationProjectName,  
102 -// }  
103 -// listData = append(listData, temp)  
104 -// }  
105 -// return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil  
106 -// }  
107 -  
108 -// 获取项目评估进度描述  
109 -// func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) (*adapter.AssessTaskDescResp, error) {  
110 -// transactionContext, err := factory.CreateTransactionContext(nil)  
111 -// if err != nil {  
112 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
113 -// }  
114 -// if err := transactionContext.StartTransaction(); err != nil {  
115 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
116 -// }  
117 -// defer func() {  
118 -// _ = transactionContext.RollbackTransaction()  
119 -// }()  
120 -// // 获取评估任务  
121 -// staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
122 -// "transactionContext": transactionContext,  
123 -// })  
124 -// //获取个人参与的评估流程  
125 -// staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{  
126 -// "transactionContext": transactionContext,  
127 -// })  
128 -// assessTaskData, err := staffAssessTaskRepo.FindOne(map[string]interface{}{  
129 -// "id": param.AssessTaskId,  
130 -// })  
131 -// if err != nil {  
132 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "评估任务不存在,"+err.Error())  
133 -// }  
134 -// //返回的数据结果  
135 -// result := adapter.AssessTaskDescResp{  
136 -// AssessTaskId: assessTaskData.Id,  
137 -// EvaluationProjectId: assessTaskData.EvaluationProjectId,  
138 -// EvaluationProjectName: assessTaskData.EvaluationProjectName,  
139 -// CycleName: assessTaskData.CycleName,  
140 -// BeginTime: assessTaskData.BeginTime.Local().Format("2006-01-02 15:04-05"),  
141 -// EndTime: assessTaskData.EndTime.Local().Format("2006-01-02 15:04-05"),  
142 -// StepList: []adapter.AssessTaskStep{},  
143 -// }  
144 -  
145 -// for _, v := range assessTaskData.StepList {  
146 -// stepItem := adapter.AssessTaskStep{  
147 -// SortBy: v.SortBy,  
148 -// LinkNodeName: v.LinkNodeName,  
149 -// LinkNodeId: v.LinkNodeId,  
150 -// BeginTime: v.BeginTime.Local().Format("2006-01-02 15:04:05"),  
151 -// EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),  
152 -// LinkNodeType: v.LinkNodeType,  
153 -// Desc: fmt.Sprintf("截止日期:%s", v.EndTime.Local().Format("2006-01-02 15:04:05")),  
154 -// Status: "",  
155 -// }  
156 -// switch v.LinkNodeType {  
157 -// case domain.LinkNodeSelfAssessment:  
158 -// //个人自评完成情况  
159 -// _, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{  
160 -// "staffAssessTaskId": assessTaskData.Id,  
161 -// "executorId": param.UserId,  
162 -// "typesList": []string{string(domain.AssessSelf)},  
163 -// })  
164 -// if err != nil {  
165 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
166 -// }  
167 -// if len(assessSelfData) > 0 {  
168 -// stepItem.Status = string(assessSelfData[0].Status)  
169 -// }  
170 -// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
171 -// case domain.LinkNodeAllInvite:  
172 -// //邀请别人评估自己  
173 -// _, assessInviteData, err := staffAssessRepo.Find(map[string]interface{}{  
174 -// "staffAssessTaskId": assessTaskData.Id,  
175 -// "targetUserId": param.UserId,  
176 -// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
177 -// "limit": 5,  
178 -// })  
179 -// if err != nil {  
180 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
181 -// }  
182 -// if len(assessInviteData) > 0 {  
183 -// stepItem.Status = string(domain.StaffAssessCompleted)  
184 -// } else {  
185 -// stepItem.Status = string(domain.StaffAssessUncompleted)  
186 -// }  
187 -// //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可  
188 -// if len(assessInviteData) > 5 {  
189 -// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
190 -// } else {  
191 -// stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))  
192 -// }  
193 -// case domain.LinkNodeAllAssessment:  
194 -// //我评估别人,被邀请评估  
195 -// _, assessInviteList, err := staffAssessRepo.Find(map[string]interface{}{  
196 -// "staffAssessTaskId": assessTaskData.Id,  
197 -// "executorId": param.UserId,  
198 -// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
199 -// })  
200 -// if err != nil {  
201 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
202 -// }  
203 -  
204 -// if len(assessInviteList) > 0 {  
205 -// stepItem.Status = string(domain.StaffAssessCompleted)  
206 -// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
207 -// for _, v := range assessInviteList {  
208 -// if v.Status == domain.StaffAssessUncompleted {  
209 -// stepItem.Status = string(domain.StaffAssessUncompleted)  
210 -// break  
211 -// }  
212 -// }  
213 -// }  
214 -// case domain.LinkNodeSuperiorAssessment:  
215 -// //我评估别人,上级评估  
216 -// _, assessSupperList, err := staffAssessRepo.Find(map[string]interface{}{  
217 -// "staffAssessTaskId": assessTaskData.Id,  
218 -// "executorId": param.UserId,  
219 -// "typesList": []string{string(domain.AssessSuper)},  
220 -// })  
221 -// if err != nil {  
222 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
223 -// }  
224 -// if len(assessSupperList) > 0 {  
225 -// stepItem.Status = string(domain.StaffAssessCompleted)  
226 -// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
227 -// uncompletedNum := 0  
228 -// for _, v := range assessSupperList {  
229 -// if v.Status == domain.StaffAssessUncompleted {  
230 -// uncompletedNum += 1  
231 -// }  
232 -// }  
233 -// if uncompletedNum > 0 {  
234 -// stepItem.Status = string(domain.StaffAssessUncompleted)  
235 -// stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum)  
236 -// }  
237 -// }  
238 -// }  
239 -// result.StepList = append(result.StepList, stepItem)  
240 -// }  
241 -// if err := transactionContext.CommitTransaction(); err != nil {  
242 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
243 -// }  
244 -// return &result, nil  
245 -// }  
246 -  
247 // 获取个人的自评反馈历史记录列表 56 // 获取个人的自评反馈历史记录列表
248 func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) (map[string]interface{}, error) { 57 func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) (map[string]interface{}, error) {
249 transactionContext, err := factory.CreateTransactionContext(nil) 58 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -925,93 +734,6 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv @@ -925,93 +734,6 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv
925 return result, nil 734 return result, nil
926 } 735 }
927 736
928 -// 获取员工自评的评估内容详情  
929 -// func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuery) (*adapter.AssessInfoResp, error) {  
930 -// transactionContext, err := factory.CreateTransactionContext(nil)  
931 -// if err != nil {  
932 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
933 -// }  
934 -// if err := transactionContext.StartTransaction(); err != nil {  
935 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
936 -// }  
937 -// defer func() {  
938 -// _ = transactionContext.RollbackTransaction()  
939 -// }()  
940 -// assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{  
941 -// "transactionContext": transactionContext,  
942 -// })  
943 -// //获取员工的评估  
944 -// _, assessList, err := assessReps.Find(map[string]interface{}{  
945 -// "companyId": param.CompanyId,  
946 -// "staffAssessTaskId": param.AssessTaskId,  
947 -// "targetUserId": param.TargetUserId,  
948 -// "typesList": []string{string(domain.AssessSelf)},  
949 -// })  
950 -// if err != nil {  
951 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())  
952 -// }  
953 -// if len(assessList) == 0 {  
954 -// return &adapter.AssessInfoResp{}, nil  
955 -// }  
956 -// assessData := assessList[0]  
957 -  
958 -// assessContentList := []*domain.StaffAssessContent{}  
959 -// if assessData.Status == domain.StaffAssessCompleted {  
960 -// //已完成  
961 -// assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{  
962 -// "transactionContext": transactionContext,  
963 -// })  
964 -// _, assessContentList, err = assessContentRepo.Find(map[string]interface{}{  
965 -// "staffAssessId": assessData.Id,  
966 -// })  
967 -// if err != nil {  
968 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())  
969 -// }  
970 -// } else if assessData.Status == domain.StaffAssessUncompleted {  
971 -// //未完成  
972 -// assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessData)  
973 -// if err != nil {  
974 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())  
975 -// }  
976 -// }  
977 -  
978 -// // 恢复缓存数据  
979 -// if param.AcquireCache != 0 {  
980 -// srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)  
981 -// }  
982 -  
983 -// //获取员工描述  
984 -// staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId))  
985 -// if err := transactionContext.CommitTransaction(); err != nil {  
986 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
987 -// }  
988 -// result := adapter.AssessInfoResp{  
989 -// AssessId: assessData.Id,  
990 -// CycleId: assessData.CycleId,  
991 -// CycleName: assessData.CycleName,  
992 -// LinkNodeId: assessData.LinkNodeId,  
993 -// LinkNodeName: assessData.LinkNodeName,  
994 -// EvaluationProjectId: assessData.EvaluationProjectId,  
995 -// EvaluationProjectName: assessData.EvaluationProjectName,  
996 -// BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),  
997 -// EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),  
998 -// Status: string(assessData.Status),  
999 -// TargetUserId: assessData.TargetUser.UserId,  
1000 -// TargetUserName: assessData.TargetUser.UserName,  
1001 -// CompanyId: assessData.CompanyId,  
1002 -// CompanyName: "",  
1003 -// SupperUser: "",  
1004 -// DutyTime: "",  
1005 -// AssessContent: assessContentList,  
1006 -// }  
1007 -// if staffDesc != nil {  
1008 -// result.CompanyName = staffDesc.CompanyName  
1009 -// result.SupperUser = staffDesc.SupperUserName  
1010 -// result.DutyTime = staffDesc.DutyTime  
1011 -// }  
1012 -// return &result, nil  
1013 -// }  
1014 -  
1015 // 获取未完成的员工评估内容 737 // 获取未完成的员工评估内容
1016 func (srv StaffAssessServeice) getAssessSelfInfoUncompleted(transactionContext application.TransactionContext, 738 func (srv StaffAssessServeice) getAssessSelfInfoUncompleted(transactionContext application.TransactionContext,
1017 assess *domain.StaffAssess) ([]*domain.StaffAssessContent, error) { 739 assess *domain.StaffAssess) ([]*domain.StaffAssessContent, error) {
@@ -1207,324 +929,6 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI @@ -1207,324 +929,6 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI
1207 return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil 929 return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil
1208 } 930 }
1209 931
1210 -// 获取我要执行的的360评估,用户列表和评估填写的值  
1211 -// func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteUserAssessQuery) (  
1212 -// *adapter.ListInviteUserAssessResp, error) {  
1213 -// transactionContext, err := factory.CreateTransactionContext(nil)  
1214 -// if err != nil {  
1215 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1216 -// }  
1217 -// if err := transactionContext.StartTransaction(); err != nil {  
1218 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1219 -// }  
1220 -// defer func() {  
1221 -// _ = transactionContext.RollbackTransaction()  
1222 -// }()  
1223 -// //获取对应的评估任务  
1224 -// assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{  
1225 -// "transactionContext": transactionContext,  
1226 -// })  
1227 -// assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
1228 -// "transactionContext": transactionContext,  
1229 -// })  
1230 -  
1231 -// //获取 executorId 对应的360评估任务 用户  
1232 -// condition := map[string]interface{}{  
1233 -// "staffAssessTaskId": param.AssessTaskId,  
1234 -// "executorId": param.ExecutorId,  
1235 -// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
1236 -// "limit": 20,  
1237 -// }  
1238 -// if param.PageSize > 0 {  
1239 -// condition["limit"] = param.PageSize  
1240 -// }  
1241 -// offset := (param.PageNumber - 1) * param.PageSize  
1242 -// if offset > 0 {  
1243 -// condition["offset"] = offset  
1244 -// }  
1245 -  
1246 -// cnt, assessList, err := assessRepo.Find(condition)  
1247 -// if err != nil {  
1248 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1249 -// }  
1250 -// var assessContentList []*domain.StaffAssessContent  
1251 -// if len(assessList) > 0 {  
1252 -// //获取评估用的所有评估项  
1253 -// assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessList[0])  
1254 -// if err != nil {  
1255 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估任务"+err.Error())  
1256 -// }  
1257 -// }  
1258 -// //可变的表格列  
1259 -// changeableHeader := []adapter.ListTableHeader{}  
1260 -// //列名与字段对应  
1261 -// keyMap := map[string]string{}  
1262 -// for i, v := range assessContentList {  
1263 -// name := fmt.Sprintf("%s-%s", v.Category, v.Name)  
1264 -// key := fmt.Sprintf("k%d", i)  
1265 -// keyMap[name] = key  
1266 -// changeableHeader = append(changeableHeader, adapter.ListTableHeader{  
1267 -// Key: key,  
1268 -// Name: name,  
1269 -// })  
1270 -// }  
1271 -// assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{  
1272 -// "transactionContext": transactionContext,  
1273 -// })  
1274 -// // 获取已经填报的内容  
1275 -// changeableRows := map[int]map[string]string{}  
1276 -// for _, v := range assessList {  
1277 -// _, contentList, err := assessContentRepo.Find(map[string]interface{}{  
1278 -// "staffAssessId": v.Id,  
1279 -// })  
1280 -// if err != nil {  
1281 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估内容"+err.Error())  
1282 -// }  
1283 -// row := map[string]string{}  
1284 -// for _, vv := range contentList {  
1285 -// name := fmt.Sprintf("%s-%s", vv.Category, vv.Name)  
1286 -// if kk, ok := keyMap[name]; ok {  
1287 -// row[kk] = vv.Value  
1288 -// }  
1289 -// }  
1290 -// changeableRows[v.TargetUser.UserId] = row  
1291 -// }  
1292 -  
1293 -// //获取360邀请评估完成情况  
1294 -// //我评估别人,被邀请评估  
1295 -// cnnt, _, err := assessRepo.Find(map[string]interface{}{  
1296 -// "staffAssessTaskId": param.AssessTaskId,  
1297 -// "executorId": param.ExecutorId,  
1298 -// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
1299 -// "status": domain.StaffAssessUncompleted,  
1300 -// })  
1301 -// if err != nil {  
1302 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
1303 -// }  
1304 -  
1305 -// assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{  
1306 -// "id": param.AssessTaskId,  
1307 -// })  
1308 -// if err != nil {  
1309 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())  
1310 -// }  
1311 -// if err := transactionContext.CommitTransaction(); err != nil {  
1312 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1313 -// }  
1314 -  
1315 -// //评估填写数据行转列  
1316 -// tableHeader := []adapter.ListTableHeader{  
1317 -// {Key: "userName", Name: "姓名"},  
1318 -// {Key: "status", Name: "状态"},  
1319 -// {Key: "types", Name: "360°评估关系"},  
1320 -// {Key: "endTime", Name: "360°评估截止日期"},  
1321 -// }  
1322 -// tableHeader = append(tableHeader, changeableHeader...)  
1323 -// listData := []map[string]interface{}{}  
1324 -// for _, v := range assessList {  
1325 -// m := map[string]interface{}{  
1326 -// "userName": v.TargetUser.UserName,  
1327 -// "userId": strconv.Itoa(v.TargetUser.UserId),  
1328 -// "status": string(v.Status),  
1329 -// "types": string(v.Types),  
1330 -// "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),  
1331 -// "assessId": strconv.Itoa(v.Id),  
1332 -// }  
1333 -// switch v.Status {  
1334 -// case domain.StaffAssessCompleted:  
1335 -// m["status"] = "已经完成"  
1336 -// case domain.StaffAssessUncompleted:  
1337 -// m["status"] = "未完成"  
1338 -// }  
1339 -  
1340 -// switch v.Types {  
1341 -// case domain.AssessInviteDiffSuper:  
1342 -// m["types"] = "不同上级同事"  
1343 -// case domain.AssessInviteSameSuper:  
1344 -// m["types"] = "相同上级同事"  
1345 -// }  
1346 -// if row, ok := changeableRows[v.TargetUser.UserId]; ok {  
1347 -// for k, v := range row {  
1348 -// m[k] = v  
1349 -// }  
1350 -// } else {  
1351 -// for _, v := range changeableHeader {  
1352 -// m[v.Key] = ""  
1353 -// }  
1354 -// }  
1355 -// listData = append(listData, m)  
1356 -// }  
1357 -// result := adapter.ListInviteUserAssessResp{  
1358 -// TableHeader: tableHeader,  
1359 -// List: listData,  
1360 -// Total: cnt,  
1361 -// }  
1362 -// for _, v := range assessTaskData.StepList {  
1363 -// if v.LinkNodeType == domain.LinkNodeAllAssessment {  
1364 -// result.LinkNodeId = v.LinkNodeId  
1365 -// result.LinkNodeName = v.LinkNodeName  
1366 -// result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)  
1367 -// }  
1368 -// }  
1369 -// return &result, nil  
1370 -// }  
1371 -  
1372 -// 获取我需要执行的上级评估成员列表  
1373 -// func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperAssessQuery) (map[string]interface{}, error) {  
1374 -// transactionContext, err := factory.CreateTransactionContext(nil)  
1375 -// if err != nil {  
1376 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1377 -// }  
1378 -// if err := transactionContext.StartTransaction(); err != nil {  
1379 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1380 -// }  
1381 -// defer func() {  
1382 -// _ = transactionContext.RollbackTransaction()  
1383 -// }()  
1384 -// //获取对应的评估任务  
1385 -// assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{  
1386 -// "transactionContext": transactionContext,  
1387 -// })  
1388 -  
1389 -// limit := 20  
1390 -// if param.PageSize > 0 {  
1391 -// limit = param.PageSize  
1392 -// }  
1393 -// condition := map[string]interface{}{  
1394 -// "staffAssessTaskId": param.AssessTaskId,  
1395 -// "executorId": param.ExecutorId,  
1396 -// "typesList": []string{string(domain.AssessSuper)},  
1397 -// "limit": limit,  
1398 -// "targetUserName": param.UserName,  
1399 -// }  
1400 -// offset := (param.PageNumber - 1) * param.PageSize  
1401 -// if offset > 0 {  
1402 -// condition["offset"] = offset  
1403 -// }  
1404 -// //获取 executorId 对应的上级评估列表  
1405 -// cnt, assessList, err := assessRepo.Find(condition)  
1406 -// if err != nil {  
1407 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1408 -// }  
1409 -  
1410 -// userIds := []int{}  
1411 -// for _, v := range assessList {  
1412 -// userIds = append(userIds, v.TargetUser.UserId)  
1413 -// }  
1414 -// //获取员工信息  
1415 -// userRepo := factory.CreateUserRepository(map[string]interface{}{  
1416 -// "transactionContext": transactionContext,  
1417 -// })  
1418 -// var targetUserList []*domain.User  
1419 -// if len(userIds) > 0 {  
1420 -// _, targetUserList, _ = userRepo.Find(map[string]interface{}{  
1421 -// "ids": userIds,  
1422 -// })  
1423 -// }  
1424 -// //获取职位信息  
1425 -// positionRepo := factory.CreatePositionRepository(map[string]interface{}{  
1426 -// "transactionContext": transactionContext,  
1427 -// })  
1428 -// //获取员工的职位  
1429 -// userPositionMap := map[int64][]*domain.Position{}  
1430 -// for _, v := range targetUserList {  
1431 -// if len(v.PositionId) == 0 {  
1432 -// continue  
1433 -// }  
1434 -// _, positionList, _ := positionRepo.Find(map[string]interface{}{  
1435 -// "ids": v.PositionId,  
1436 -// })  
1437 -// userPositionMap[v.Id] = positionList  
1438 -// }  
1439 -  
1440 -// //获取员工邀请的人完成360评估的数量  
1441 -// var inviteCompletedCount []dao.CountData  
1442 -// if len(userIds) > 0 {  
1443 -// d := dao.NewStaffAssessDao(map[string]interface{}{  
1444 -// "transactionContext": transactionContext,  
1445 -// })  
1446 -// inviteCompletedCount, err = d.CountInviteAssessByTargetUser(userIds, param.AssessTaskId)  
1447 -// if err != nil {  
1448 -// log.Logger.Error("获取员工邀请的人完成情况" + err.Error())  
1449 -// }  
1450 -// }  
1451 -// assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
1452 -// "transactionContext": transactionContext,  
1453 -// })  
1454 -// assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{  
1455 -// "id": param.AssessTaskId,  
1456 -// })  
1457 -// if err != nil {  
1458 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())  
1459 -// }  
1460 -// //我评估别人,被邀请评估  
1461 -// cnnt, _, err := assessRepo.Find(map[string]interface{}{  
1462 -// "staffAssessTaskId": param.AssessTaskId,  
1463 -// "executorId": param.ExecutorId,  
1464 -// "typesList": []string{string(domain.AssessSuper)},  
1465 -// "status": string(domain.StaffAssessUncompleted),  
1466 -// })  
1467 -// if err != nil {  
1468 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
1469 -// }  
1470 -// if err := transactionContext.CommitTransaction(); err != nil {  
1471 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1472 -// }  
1473 -  
1474 -// resultList := []adapter.ListSupperAssessResp{}  
1475 -// for _, v := range assessList {  
1476 -// item := adapter.ListSupperAssessResp{  
1477 -// AssessId: v.Id,  
1478 -// UserId: v.TargetUser.UserId,  
1479 -// UserName: v.TargetUser.UserName,  
1480 -// EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),  
1481 -// InviteCompleted: 0,  
1482 -// Status: string(v.Status),  
1483 -// InviteTotal: 5,  
1484 -// Department: "",  
1485 -// Position: "",  
1486 -// DutyTime: "",  
1487 -// }  
1488 -// //填入部门  
1489 -// for _, vv := range v.TargetDepartment {  
1490 -// item.Department += vv.DepartmentName + " "  
1491 -// }  
1492 -// for _, vv := range targetUserList {  
1493 -// if vv.Id != int64(v.TargetUser.UserId) {  
1494 -// continue  
1495 -// }  
1496 -// //填入入职时间  
1497 -// item.DutyTime = vv.CreatedAt.Local().Format("2006-01-02 15:04:05")  
1498 -// //填入职位  
1499 -// for _, vvv := range userPositionMap[vv.Id] {  
1500 -// item.Position += vvv.Name + " "  
1501 -// }  
1502 -// break  
1503 -// }  
1504 -// //  
1505 -// for _, vv := range inviteCompletedCount {  
1506 -// if v.TargetUser.UserId == vv.TargetUserId {  
1507 -// item.InviteCompleted = vv.InviteCompleted  
1508 -// item.InviteTotal = vv.InviteTotal  
1509 -// break  
1510 -// }  
1511 -// }  
1512 -// resultList = append(resultList, item)  
1513 -// }  
1514 -// result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)  
1515 -// result["linkNodeName"] = ""  
1516 -// result["linkNodeId"] = ""  
1517 -// result["lintNodeDesc"] = ""  
1518 -// for _, v := range assessTaskData.StepList {  
1519 -// if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {  
1520 -// result["linkNodeName"] = v.LinkNodeName  
1521 -// result["linkNodeId"] = fmt.Sprintf("%d", v.LinkNodeId)  
1522 -// result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)  
1523 -// }  
1524 -// }  
1525 -// return result, nil  
1526 -// }  
1527 -  
1528 // 根据staffAssessId 获取评估的填写信息 932 // 根据staffAssessId 获取评估的填写信息
1529 func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) { 933 func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
1530 transactionContext, err := factory.CreateTransactionContext(nil) 934 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -1777,38 +1181,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1777,38 +1181,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1777 }, nil 1181 }, nil
1778 } 1182 }
1779 1183
1780 -// 获取员工被评估的列表  
1781 -// func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserAssessQuery) (map[string]interface{}, error) {  
1782 -// transactionContext, err := factory.CreateTransactionContext(nil)  
1783 -// if err != nil {  
1784 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1785 -// }  
1786 -// if err := transactionContext.StartTransaction(); err != nil {  
1787 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1788 -// }  
1789 -// defer func() {  
1790 -// _ = transactionContext.RollbackTransaction()  
1791 -// }()  
1792 -// assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{  
1793 -// "transactionContext": transactionContext,  
1794 -// })  
1795 -// //获取员工的评估  
1796 -// cnt, assessList, err := assessReps.Find(map[string]interface{}{  
1797 -// "staffAssessTaskId": param.AssessTaskId,  
1798 -// "companyId": param.CompanyId,  
1799 -// "targetUserId": param.TargetUserId,  
1800 -// "typesList": param.Types,  
1801 -// })  
1802 -// if err != nil {  
1803 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())  
1804 -// }  
1805 -// if err := transactionContext.CommitTransaction(); err != nil {  
1806 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1807 -// }  
1808 -  
1809 -// return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil  
1810 -// }  
1811 -  
1812 // 获取员工的上级是谁 1184 // 获取员工的上级是谁
1813 func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) { 1185 func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) {
1814 departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ 1186 departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
@@ -91,38 +91,6 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs @@ -91,38 +91,6 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs
91 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 91 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
92 } 92 }
93 93
94 - //roleRepo := factory.CreateRoleRepository(map[string]interface{}{  
95 - // "transactionContext": transactionContext,  
96 - //})  
97 - //roleUserRepo := factory.CreateRoleUserRepository(map[string]interface{}{  
98 - // "transactionContext": transactionContext,  
99 - //})  
100 - //_, roleList, err := roleRepo.Find(map[string]interface{}{  
101 - // "type": domain.RoleTypeSystem,  
102 - // "companyId": param.CompanyId,  
103 - //})  
104 - //if err != nil {  
105 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取角色信息列表"+err.Error())  
106 - //}  
107 - //_, userRoleList, err := roleUserRepo.Find(map[string]interface{}{  
108 - // "companyId": param.CompanyId,  
109 - // "userId": param.OperaterId,  
110 - //})  
111 - //if err != nil {  
112 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息列表"+err.Error())  
113 - //}  
114 - //hrbp := -1  
115 - //for _, v := range userRoleList {  
116 - // for _, v2 := range roleList {  
117 - // if v.RoleId == v2.Id {  
118 - // hrbp = 1  
119 - // break  
120 - // }  
121 - // }  
122 - // if hrbp == 1 {  
123 - // break  
124 - // }  
125 - //}  
126 assessDao := dao.NewStaffAssessDao(map[string]interface{}{ 94 assessDao := dao.NewStaffAssessDao(map[string]interface{}{
127 "transactionContext": transactionContext, 95 "transactionContext": transactionContext,
128 }) 96 })
@@ -209,224 +177,6 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs @@ -209,224 +177,6 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs
209 return &result, nil 177 return &result, nil
210 } 178 }
211 179
212 -// func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {  
213 -// transactionContext, err := factory.CreateTransactionContext(nil)  
214 -// if err != nil {  
215 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
216 -// }  
217 -// if err := transactionContext.StartTransaction(); err != nil {  
218 -// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
219 -// }  
220 -// defer func() {  
221 -// _ = transactionContext.RollbackTransaction()  
222 -// }()  
223 -  
224 -// hrbp, err := srv.getHRBP(transactionContext, param.CompanyId, param.OperaterId)  
225 -// if err != nil {  
226 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
227 -// }  
228 -  
229 -// assessDao := dao.NewStaffAssessDao(map[string]interface{}{  
230 -// "transactionContext": transactionContext,  
231 -// })  
232 -// contentList, err := assessDao.ExportDataUserAssess(dao.SearchConditin1{  
233 -// CompanyId: param.CompanyId,  
234 -// CycleId: param.CycleId,  
235 -// BeginDay: param.BeginDay,  
236 -// TargetUserName: param.TargetUserName,  
237 -// TargetUserId: param.TargetUserId,  
238 -// Limit: 5000,  
239 -// Offset: 0,  
240 -// OperaterId: param.OperaterId,  
241 -// Hrbp: hrbp,  
242 -// })  
243 -// if err != nil {  
244 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取数据列表"+err.Error())  
245 -// }  
246 -  
247 -// if err := transactionContext.CommitTransaction(); err != nil {  
248 -// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
249 -// }  
250 -// //选择导出的评估项  
251 -// includeCol := map[string]struct{}{}  
252 -// for _, v := range param.ExportItems {  
253 -// includeCol[v.Category+"+"+v.Name] = struct{}{}  
254 -// }  
255 -  
256 -// //处理查询到的数据  
257 -// //汇总 Excel表格的表头描述  
258 -// level1 := []string{} //分类  
259 -// level3 := map[string][]string{} //key=分类+得分项类型 val=名称  
260 -// level4 := map[string]string{} //key=分类+名称 val=评估标准  
261 -// for _, v := range contentList {  
262 -// if v.ContentId == 0 {  
263 -// continue  
264 -// }  
265 -// if len(includeCol) > 0 {  
266 -// if _, ok := includeCol[v.Category+"+"+v.ContentName]; !ok {  
267 -// continue  
268 -// }  
269 -// }  
270 -// level1Item := ""  
271 -// for _, v1 := range level1 {  
272 -// if v.Category == v1 {  
273 -// level1Item = v1  
274 -// }  
275 -// }  
276 -// if len(level1Item) == 0 {  
277 -// level1 = append(level1, v.Category)  
278 -// }  
279 -// if v.Weight == 0 {  
280 -// level3Key := v.Category + "-加分项"  
281 -// if _, ok := level3[level3Key]; !ok {  
282 -// level3[level3Key] = []string{}  
283 -// }  
284 -// level3Item := ""  
285 -// for _, v3 := range level3[level3Key] {  
286 -// if v3 == v.ContentName {  
287 -// level3Item = v.ContentName  
288 -// }  
289 -// }  
290 -// if len(level3Item) == 0 {  
291 -// level3[level3Key] = append(level3[level3Key], v.ContentName)  
292 -// }  
293 -// }  
294 -// if v.Weight > 0 {  
295 -// level3Key := v.Category + "-得分项"  
296 -// if _, ok := level3[level3Key]; !ok {  
297 -// level3[level3Key] = []string{}  
298 -// }  
299 -// level3Item := ""  
300 -// for _, v3 := range level3[level3Key] {  
301 -// if v3 == v.ContentName {  
302 -// level3Item = v.ContentName  
303 -// }  
304 -// }  
305 -// if len(level3Item) == 0 {  
306 -// level3[level3Key] = append(level3[level3Key], v.ContentName)  
307 -// }  
308 -// }  
309 -  
310 -// level4Key := v.Category + "+" + v.ContentName  
311 -// if _, ok := level4[level4Key]; !ok {  
312 -// level4[level4Key] = v.PromptText  
313 -// }  
314 -// }  
315 -// //汇总表头,按列  
316 -// headerList := []excelTableHeader{  
317 -// {  
318 -// Level1: "日期",  
319 -// Level2: "",  
320 -// Level3: "",  
321 -// Level4: "评估标准",  
322 -// }, {  
323 -// Level1: "姓名",  
324 -// Level2: "",  
325 -// Level3: "",  
326 -// Level4: "",  
327 -// },  
328 -// }  
329 -// for _, v := range level1 {  
330 -// item := excelTableHeader{  
331 -// Level1: v,  
332 -// }  
333 -// level3Key := v + "-加分项"  
334 -// if _, ok := level3[level3Key]; ok {  
335 -// for _, v2 := range level3[level3Key] {  
336 -// item.Level2 = "加分项"  
337 -// item.Level3 = v2  
338 -// level4Key := v + "+" + v2  
339 -// item.Level4 = level4[level4Key]  
340 -// headerList = append(headerList, item)  
341 -// }  
342 -// }  
343 -// level3Key = v + "-得分项"  
344 -// if _, ok := level3[level3Key]; ok {  
345 -// for _, v2 := range level3[level3Key] {  
346 -// item.Level2 = "得分项"  
347 -// item.Level3 = v2  
348 -// level4Key := v + "+" + v2  
349 -// item.Level4 = level4[level4Key]  
350 -// headerList = append(headerList, item)  
351 -// }  
352 -// }  
353 -// }  
354 -// //数据形式 进行 行列转换  
355 -// tableRows := map[string]map[string]string{}  
356 -// tableRowSort := []string{}  
357 -// for _, v := range contentList {  
358 -// if _, ok := tableRows[v.TargetUserId]; !ok {  
359 -// tableRows[v.TargetUserId] = map[string]string{}  
360 -// tableRowSort = append(tableRowSort, v.TargetUserId)  
361 -// }  
362 -// tableRows[v.TargetUserId]["TargetUserName"] = v.TargetUserName  
363 -// tableRows[v.TargetUserId]["BeginDay"] = v.BeginDay  
364 -// if v.ContentId > 0 {  
365 -// if len(includeCol) > 0 {  
366 -// if _, ok := includeCol[v.Category+"+"+v.ContentName]; !ok {  
367 -// continue  
368 -// }  
369 -// }  
370 -// value := []string{v.Value}  
371 -// for _, v2 := range v.Remark {  
372 -// value = append(value, v2.RemarkText)  
373 -// }  
374 -// key := v.Category + "+" + v.ContentName  
375 -// tableRows[v.TargetUserId][key] = strings.Join(value, "\n")  
376 -// }  
377 -// }  
378 -// //将数据写入xlsx  
379 -// xlsxFile := excelize.NewFile()  
380 -// sheetIndex := xlsxFile.GetActiveSheetIndex()  
381 -// sheetName := xlsxFile.GetSheetName(sheetIndex)  
382 -// //写入第一行  
383 -// xlsxFile.SetCellStr(sheetName, "A1", "每日绩效汇总")  
384 -// //写入二到五行  
385 -// for k, v := range headerList {  
386 -// colName, _ := excelize.ColumnNumberToName(k + 1)  
387 -// xlsxFile.SetCellStr(sheetName, colName+"2", v.Level1)  
388 -// xlsxFile.SetCellStr(sheetName, colName+"3", v.Level2)  
389 -// xlsxFile.SetCellStr(sheetName, colName+"4", v.Level3)  
390 -// xlsxFile.SetCellStr(sheetName, colName+"5", v.Level4)  
391 -// }  
392 -// //从第六行开始写入用户填写的评估数据  
393 -// for k, v := range tableRowSort {  
394 -// rowNum := strconv.Itoa(k + 6)  
395 -// row := tableRows[v]  
396 -// for k2, v2 := range headerList {  
397 -// if k2 == 0 {  
398 -// xlsxFile.SetCellStr(sheetName, "A"+rowNum, row["BeginDay"])  
399 -// continue  
400 -// }  
401 -// if k2 == 1 {  
402 -// xlsxFile.SetCellStr(sheetName, "B"+rowNum, row["TargetUserName"])  
403 -// continue  
404 -// }  
405 -// colName, _ := excelize.ColumnNumberToName(k2 + 1)  
406 -// key := v2.Level1 + "+" + v2.Level3  
407 -// if mVal, ok := row[key]; ok {  
408 -// xlsxFile.SetCellStr(sheetName, colName+rowNum, mVal)  
409 -// }  
410 -// }  
411 -// }  
412 -// //TODO 调整样式  
413 -// xlsxFile.MergeCell(sheetName, "A2", "A4")  
414 -// xlsxFile.MergeCell(sheetName, "B2", "B4")  
415 -// xlsxFile.MergeCell(sheetName, "B5", "B5")  
416 -// //设置行高  
417 -// for i := range tableRowSort {  
418 -// xlsxFile.SetRowHeight(sheetName, i+5, 50)  
419 -// }  
420 -// //设置列宽  
421 -// for i := range headerList {  
422 -// colName, _ := excelize.ColumnNumberToName(i + 1)  
423 -// if i == 0 {  
424 -// xlsxFile.SetColWidth(sheetName, colName, colName, 30)  
425 -// }  
426 -// }  
427 -// return xlsxFile, nil  
428 -// }  
429 -  
430 //员工绩效-项目管理-矩阵分析 180 //员工绩效-项目管理-矩阵分析
431 181
432 func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleDay) (*adapter.AssessAnalysisResp, error) { 182 func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleDay) (*adapter.AssessAnalysisResp, error) {
@@ -708,7 +458,7 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess @@ -708,7 +458,7 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess
708 458
709 // 员工绩效-项目管理-成员列表导出 459 // 员工绩效-项目管理-成员列表导出
710 460
711 -func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) { 461 +func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {
712 transactionContext, err := factory.CreateTransactionContext(nil) 462 transactionContext, err := factory.CreateTransactionContext(nil)
713 if err != nil { 463 if err != nil {
714 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 464 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -846,3 +596,8 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent @@ -846,3 +596,8 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent
846 xlsxFile.MergeCell(sheetName, "A1", colName+"1") 596 xlsxFile.MergeCell(sheetName, "A1", colName+"1")
847 return xlsxFile, nil 597 return xlsxFile, nil
848 } 598 }
  599 +
  600 +// 自评小结统计
  601 +func (srv *StaffAssessServeice) AssessSelfSummary() {
  602 +
  603 +}
@@ -3,7 +3,6 @@ package adapter @@ -3,7 +3,6 @@ package adapter
3 //综合评估的周期列表 3 //综合评估的周期列表
4 4
5 type CycleListAdapter struct { 5 type CycleListAdapter struct {
6 - CycleId string `json:"cycleId"` //周期id  
7 - CycleName string `json:"cycleName"` //  
8 - ExecutorId string `json:"executorId "` 6 + CycleId string `json:"cycleId"` //周期id
  7 + CycleName string `json:"cycleName"` //
9 } 8 }
@@ -11,6 +11,8 @@ type EvaluationInfoAdapter struct { @@ -11,6 +11,8 @@ type EvaluationInfoAdapter struct {
11 LinkNodeId int `json:"linkNodeId,string"` //评估环节id 11 LinkNodeId int `json:"linkNodeId,string"` //评估环节id
12 BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 12 BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
13 EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 13 EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
  14 + TargetUserId int `json:"targetUserId"` //被评估的目标用户,被执行的
  15 + TargetUserName string `json:"targetUserName"` //
14 Status string `json:"status"` //完成状态 16 Status string `json:"status"` //完成状态
15 EvaluationItems []EvaluationItemAdapter `json:"evaluationItems"` 17 EvaluationItems []EvaluationItemAdapter `json:"evaluationItems"`
16 } 18 }
@@ -2,7 +2,8 @@ package command @@ -2,7 +2,8 @@ package command
2 2
3 // 获取周期列表 3 // 获取周期列表
4 type QueryCycleList struct { 4 type QueryCycleList struct {
5 - UserId int `json:"-"` //当前操作人id 5 + UserId int `json:"userId"`
  6 + Types int `json:"types"`
6 PageSize int `json:"pageSize"` 7 PageSize int `json:"pageSize"`
7 PageNumber int `json:"pageNumber"` 8 PageNumber int `json:"pageNumber"`
8 } 9 }
@@ -21,9 +21,9 @@ func NewSummaryEvaluationServeice() *SummaryEvaluationServeice { @@ -21,9 +21,9 @@ func NewSummaryEvaluationServeice() *SummaryEvaluationServeice {
21 return newService 21 return newService
22 } 22 }
23 23
24 -// GetCycleList  
25 -// 获取周期列表  
26 -func (srv *SummaryEvaluationServeice) GetCycleList(param *command.QueryCycleList) (map[string]interface{}, error) { 24 +// GetExecutorCycleList
  25 +// 获取评估执行人可用的周期列表
  26 +func (srv *SummaryEvaluationServeice) GetExecutorCycleList(param *command.QueryCycleList) (map[string]interface{}, error) {
27 transactionContext, err := factory.CreateTransactionContext(nil) 27 transactionContext, err := factory.CreateTransactionContext(nil)
28 if err != nil { 28 if err != nil {
29 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 29 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -46,12 +46,12 @@ func (srv *SummaryEvaluationServeice) GetCycleList(param *command.QueryCycleList @@ -46,12 +46,12 @@ func (srv *SummaryEvaluationServeice) GetCycleList(param *command.QueryCycleList
46 offset = (param.PageNumber - 1) * param.PageSize 46 offset = (param.PageNumber - 1) * param.PageSize
47 } 47 }
48 48
49 - cycleData, err := evaluationDao.GetPersonalCycleList(param.UserId, offset, limit) 49 + cycleData, err := evaluationDao.GetExecutorCycleList(param.UserId, offset, limit, 0)
50 if err != nil { 50 if err != nil {
51 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error()) 51 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
52 } 52 }
53 53
54 - cnt, err := evaluationDao.CountPersonalCycleList(param.UserId) 54 + cnt, err := evaluationDao.CountExecutorCycleList(param.UserId, 0)
55 if err != nil { 55 if err != nil {
56 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 56 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
57 } 57 }
@@ -61,9 +61,8 @@ func (srv *SummaryEvaluationServeice) GetCycleList(param *command.QueryCycleList @@ -61,9 +61,8 @@ func (srv *SummaryEvaluationServeice) GetCycleList(param *command.QueryCycleList
61 cycleList := []adapter.CycleListAdapter{} 61 cycleList := []adapter.CycleListAdapter{}
62 for _, v := range cycleData { 62 for _, v := range cycleData {
63 m := adapter.CycleListAdapter{ 63 m := adapter.CycleListAdapter{
64 - CycleId: v.CycleId,  
65 - CycleName: v.CycleName,  
66 - ExecutorId: v.ExecutorId, 64 + CycleId: v.CycleId,
  65 + CycleName: v.CycleName,
67 } 66 }
68 cycleList = append(cycleList, m) 67 cycleList = append(cycleList, m)
69 } 68 }
@@ -342,6 +341,8 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval @@ -342,6 +341,8 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval
342 LinkNodeId: evaluationData.NodeId, 341 LinkNodeId: evaluationData.NodeId,
343 BeginTime: evaluationData.BeginTime.Format("2006-01-02 15:04:05"), 342 BeginTime: evaluationData.BeginTime.Format("2006-01-02 15:04:05"),
344 EndTime: evaluationData.EndTime.Format("2006-01-02 15:04:05"), 343 EndTime: evaluationData.EndTime.Format("2006-01-02 15:04:05"),
  344 + TargetUserId: evaluationData.TargetUser.UserId,
  345 + TargetUserName: evaluationData.TargetUser.UserName,
345 Status: string(evaluationData.Status), 346 Status: string(evaluationData.Status),
346 EvaluationItems: itemValuesAdapter, 347 EvaluationItems: itemValuesAdapter,
347 } 348 }
@@ -437,4 +438,50 @@ func (srv *SummaryEvaluationServeice) EditEvaluationSelf(param *command.EditEval @@ -437,4 +438,50 @@ func (srv *SummaryEvaluationServeice) EditEvaluationSelf(param *command.EditEval
437 }, nil 438 }, nil
438 } 439 }
439 440
440 -// 441 +// GetTargetUserCycleList
  442 +// 获取周期列表,被评估的周期列表
  443 +func (srv *SummaryEvaluationServeice) GetTargetUserCycleList(param *command.QueryCycleList) (map[string]interface{}, error) {
  444 + transactionContext, err := factory.CreateTransactionContext(nil)
  445 + if err != nil {
  446 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  447 + }
  448 + if err := transactionContext.StartTransaction(); err != nil {
  449 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  450 + }
  451 + defer func() {
  452 + _ = transactionContext.RollbackTransaction()
  453 + }()
  454 + evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{
  455 + "transactionContext": transactionContext,
  456 + })
  457 + limit := 300
  458 + offset := 0
  459 + if param.PageSize > 0 {
  460 + limit = param.PageSize
  461 + }
  462 + if param.PageNumber > 0 {
  463 + offset = (param.PageNumber - 1) * param.PageSize
  464 + }
  465 +
  466 + cycleData, err := evaluationDao.GetTargetUserCycleList(param.UserId, offset, limit, param.Types)
  467 + if err != nil {
  468 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
  469 + }
  470 +
  471 + cnt, err := evaluationDao.CountTargetUserCycleList(param.UserId, param.Types)
  472 + if err != nil {
  473 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  474 + }
  475 + if err := transactionContext.CommitTransaction(); err != nil {
  476 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  477 + }
  478 + cycleList := []adapter.CycleListAdapter{}
  479 + for _, v := range cycleData {
  480 + m := adapter.CycleListAdapter{
  481 + CycleId: v.CycleId,
  482 + CycleName: v.CycleName,
  483 + }
  484 + cycleList = append(cycleList, m)
  485 + }
  486 + return tool_funs.SimpleWrapGridMap(int64(cnt), cycleList), nil
  487 +}
@@ -8,12 +8,12 @@ import ( @@ -8,12 +8,12 @@ import (
8 // 周综合评估 8 // 周综合评估
9 type SummaryEvaluation struct { 9 type SummaryEvaluation struct {
10 Id int 10 Id int
11 - CompanyId int //公司id  
12 - EvaluationProjectId int //对应的项目id  
13 - EvaluationProjectName string //对应的项目名称  
14 - CycleId int64 //对应的周期id  
15 - CycleName string //对应的周期名称  
16 - NodeId int 11 + CompanyId int //公司id
  12 + EvaluationProjectId int //对应的项目id
  13 + EvaluationProjectName string //对应的项目名称
  14 + CycleId int64 //对应的周期id
  15 + CycleName string //对应的周期名称
  16 + NodeId int //
17 TargetUser StaffDesc //被评估的目标用户,被执行的 17 TargetUser StaffDesc //被评估的目标用户,被执行的
18 TargetDepartment []StaffDepartment //被评估的目标用户所在的部门 18 TargetDepartment []StaffDepartment //被评估的目标用户所在的部门
19 Executor StaffDesc //填写评估的用户,执行人 19 Executor StaffDesc //填写评估的用户,执行人
@@ -20,33 +20,41 @@ func NewSummaryEvaluationDao(options map[string]interface{}) *SummaryEvaluationD @@ -20,33 +20,41 @@ func NewSummaryEvaluationDao(options map[string]interface{}) *SummaryEvaluationD
20 } 20 }
21 21
22 type PersonalCycle struct { 22 type PersonalCycle struct {
23 - ExecutorId string `pg:"executor_id" ` //  
24 - CycleId string `pg:"cycle_id" ` //  
25 - CycleName string `pg:"cycle_name"` // 23 + CycleId string `pg:"cycle_id" ` //
  24 + CycleName string `pg:"cycle_name"` //
26 } 25 }
27 26
28 -// GetPersonalCycleList 获取执行人拥有的周期列表  
29 -func (d *SummaryEvaluationDao) GetPersonalCycleList(executorId int, offset int, limit int) ([]PersonalCycle, error) { 27 +// GetExecutorCycleList 获取执行人拥有的周期列表
  28 +// executorId 执行人id
  29 +// offset,limit 分页
  30 +func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, evaluationType int) ([]PersonalCycle, error) {
30 sqlStr := `select 31 sqlStr := `select
31 distinct 32 distinct
32 summary_evaluation.cycle_id , 33 summary_evaluation.cycle_id ,
33 - summary_evaluation.cycle_name ,  
34 - summary_evaluation.executor ->>'userId' as executor_id  
35 - from summary_evaluation 34 + summary_evaluation.cycle_name
  35 + from summary_evaluation
36 where summary_evaluation.executor ->>'userId'='?' 36 where summary_evaluation.executor ->>'userId'='?'
37 - offset ? limit ?` 37 + `
38 38
39 tx := d.transactionContext.PgTx 39 tx := d.transactionContext.PgTx
40 condition := []interface{}{ 40 condition := []interface{}{
41 - executorId, offset, limit, 41 + executorId,
42 } 42 }
  43 +
  44 + if evaluationType > 0 {
  45 + sqlStr += ` and summary_evaluation."types"=? `
  46 + condition = append(condition, evaluationType)
  47 + }
  48 +
  49 + condition = append(condition, offset, limit)
  50 + sqlStr += ` offset ? limit ? `
43 result := []PersonalCycle{} 51 result := []PersonalCycle{}
44 _, err := tx.Query(&result, sqlStr, condition...) 52 _, err := tx.Query(&result, sqlStr, condition...)
45 return result, err 53 return result, err
46 } 54 }
47 55
48 -// CountPersonalCycleList 统计执行人拥有的周期列表  
49 -func (d *SummaryEvaluationDao) CountPersonalCycleList(executorId int) (int, error) { 56 +// CountExecutorCycleList 统计执行人拥有的周期列表
  57 +func (d *SummaryEvaluationDao) CountExecutorCycleList(executorId int, evaluationType int) (int, error) {
50 sqlStr := `select count( 58 sqlStr := `select count(
51 distinct summary_evaluation.cycle_id 59 distinct summary_evaluation.cycle_id
52 ) as cnt 60 ) as cnt
@@ -57,6 +65,60 @@ func (d *SummaryEvaluationDao) CountPersonalCycleList(executorId int) (int, erro @@ -57,6 +65,60 @@ func (d *SummaryEvaluationDao) CountPersonalCycleList(executorId int) (int, erro
57 condition := []interface{}{ 65 condition := []interface{}{
58 executorId, 66 executorId,
59 } 67 }
  68 + if evaluationType > 0 {
  69 + sqlStr += ` and summary_evaluation."types"=? `
  70 + condition = append(condition, evaluationType)
  71 + }
  72 +
  73 + var cnt int
  74 + _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...)
  75 + return cnt, err
  76 +}
  77 +
  78 +// GetExecutorCycleList 获取被评估目标人拥有的周期列表
  79 +// executorId 执行人id
  80 +// offset,limit 分页
  81 +func (d *SummaryEvaluationDao) GetTargetUserCycleList(executorId int, offset int, limit int, evaluationType int) ([]PersonalCycle, error) {
  82 + sqlStr := `select
  83 + distinct
  84 + summary_evaluation.cycle_id ,
  85 + summary_evaluation.cycle_name
  86 + from summary_evaluation
  87 + where summary_evaluation.target_user ->>'userId'='?'
  88 + `
  89 + tx := d.transactionContext.PgTx
  90 + condition := []interface{}{
  91 + executorId,
  92 + }
  93 +
  94 + if evaluationType > 0 {
  95 + sqlStr += ` and summary_evaluation."types"=? `
  96 + condition = append(condition, evaluationType)
  97 + }
  98 +
  99 + condition = append(condition, offset, limit)
  100 + sqlStr += ` offset ? limit ? `
  101 + result := []PersonalCycle{}
  102 + _, err := tx.Query(&result, sqlStr, condition...)
  103 + return result, err
  104 +}
  105 +
  106 +// CountExecutorCycleList 统计 被评估目标人拥有的周期列表
  107 +func (d *SummaryEvaluationDao) CountTargetUserCycleList(executorId int, evaluationType int) (int, error) {
  108 + sqlStr := `select count(
  109 + distinct summary_evaluation.cycle_id
  110 + ) as cnt
  111 + from summary_evaluation
  112 + where summary_evaluation.target_user ->>'userId'='?' `
  113 +
  114 + condition := []interface{}{
  115 + executorId,
  116 + }
  117 + if evaluationType > 0 {
  118 + sqlStr += ` and summary_evaluation."types"=? `
  119 + condition = append(condition, evaluationType)
  120 + }
  121 + tx := d.transactionContext.PgTx
60 var cnt int 122 var cnt int
61 _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...) 123 _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...)
62 return cnt, err 124 return cnt, err
@@ -12,7 +12,7 @@ type SummaryEvaluationController struct { @@ -12,7 +12,7 @@ type SummaryEvaluationController struct {
12 beego.BaseController 12 beego.BaseController
13 } 13 }
14 14
15 -func (c *SummaryEvaluationController) GetCycleList() { 15 +func (c *SummaryEvaluationController) GetExecutorCycleList() {
16 srv := service.NewSummaryEvaluationServeice() 16 srv := service.NewSummaryEvaluationServeice()
17 paramReq := &command.QueryCycleList{} 17 paramReq := &command.QueryCycleList{}
18 err := c.BindJSON(paramReq) 18 err := c.BindJSON(paramReq)
@@ -22,9 +22,8 @@ func (c *SummaryEvaluationController) GetCycleList() { @@ -22,9 +22,8 @@ func (c *SummaryEvaluationController) GetCycleList() {
22 return 22 return
23 } 23 }
24 userReq := middlewares.GetUser(c.Ctx) 24 userReq := middlewares.GetUser(c.Ctx)
25 -  
26 paramReq.UserId = int(userReq.UserId) 25 paramReq.UserId = int(userReq.UserId)
27 - data, err := srv.GetCycleList(paramReq) 26 + data, err := srv.GetExecutorCycleList(paramReq)
28 c.Response(data, err) 27 c.Response(data, err)
29 } 28 }
30 29
@@ -78,3 +77,18 @@ func (c *SummaryEvaluationController) EditEvaluationSelf() { @@ -78,3 +77,18 @@ func (c *SummaryEvaluationController) EditEvaluationSelf() {
78 c.Response(data, err) 77 c.Response(data, err)
79 78
80 } 79 }
  80 +
  81 +func (c *SummaryEvaluationController) GetTargetUserCycleList() {
  82 + srv := service.NewSummaryEvaluationServeice()
  83 + paramReq := &command.QueryCycleList{}
  84 + err := c.BindJSON(paramReq)
  85 + if err != nil {
  86 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  87 + c.Response(nil, e)
  88 + return
  89 + }
  90 + userReq := middlewares.GetUser(c.Ctx)
  91 + paramReq.UserId = int(userReq.UserId)
  92 + data, err := srv.GetTargetUserCycleList(paramReq)
  93 + c.Response(data, err)
  94 +}
@@ -10,7 +10,8 @@ import ( @@ -10,7 +10,8 @@ import (
10 func init() { 10 func init() {
11 summaryNS := web.NewNamespace("/v1/summary-evaluation", 11 summaryNS := web.NewNamespace("/v1/summary-evaluation",
12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), 12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
13 - web.NSCtrlPost("/cycle/list", (*controllers.SummaryEvaluationController).GetCycleList), 13 + web.NSCtrlPost("/executor/cycle/list", (*controllers.SummaryEvaluationController).GetExecutorCycleList),
  14 + web.NSCtrlPost("/target_user/cycle/list", (*controllers.SummaryEvaluationController).GetTargetUserCycleList),
14 web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu), 15 web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu),
15 web.NSCtrlPost("/self", (*controllers.SummaryEvaluationController).GetEvaluationSelf), 16 web.NSCtrlPost("/self", (*controllers.SummaryEvaluationController).GetEvaluationSelf),
16 web.NSCtrlPost("/self/edit", (*controllers.SummaryEvaluationController).EditEvaluationSelf), 17 web.NSCtrlPost("/self/edit", (*controllers.SummaryEvaluationController).EditEvaluationSelf),