作者 tangxvhui

添加 综合评估的查询条件

@@ -97,39 +97,90 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -97,39 +97,90 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
97 if err != nil { 97 if err != nil {
98 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 98 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
99 } 99 }
  100 +
  101 + var cntAll360 int
  102 + var cntUncompleted360 int
100 //查找360评估,统计未完成的 103 //查找360评估,统计未完成的
101 - cnt360, _, err := evaluationRepo.Find(map[string]interface{}{ 104 + cntAll360, _, err = evaluationRepo.Find(map[string]interface{}{
102 "types": int(domain.Evaluation360), 105 "types": int(domain.Evaluation360),
103 "executorId": param.UserId, 106 "executorId": param.UserId,
104 "limit": 1, 107 "limit": 1,
105 "cycleId": param.CycleId, 108 "cycleId": param.CycleId,
106 - "status": string(domain.EvaluationUncompleted), 109 + "beginTime": time.Now(),
107 }) 110 })
108 if err != nil { 111 if err != nil {
109 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 112 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
110 } 113 }
  114 + if cntAll360 > 0 {
  115 + //查找360评估,统计未完成的
  116 + cntUncompleted360, _, err = evaluationRepo.Find(map[string]interface{}{
  117 + "types": int(domain.Evaluation360),
  118 + "executorId": param.UserId,
  119 + "limit": 1,
  120 + "cycleId": param.CycleId,
  121 + "status": string(domain.EvaluationUncompleted),
  122 + "beginTime": time.Now(),
  123 + })
  124 + if err != nil {
  125 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  126 + }
  127 + }
  128 +
  129 + var cntAllSuper int
  130 + var cntUncompletedSuper int
  131 +
111 //查询需要执行上级评估,统计未完成 132 //查询需要执行上级评估,统计未完成
112 - cntSuper, _, err := evaluationRepo.Find(map[string]interface{}{ 133 + cntAllSuper, _, err = evaluationRepo.Find(map[string]interface{}{
113 "types": int(domain.EvaluationSuper), 134 "types": int(domain.EvaluationSuper),
114 "executorId": param.UserId, 135 "executorId": param.UserId,
115 "limit": 1, 136 "limit": 1,
116 "cycleId": param.CycleId, 137 "cycleId": param.CycleId,
117 - "status": string(domain.EvaluationUncompleted), 138 + "beginTime": time.Now(),
118 }) 139 })
119 if err != nil { 140 if err != nil {
120 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 141 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
121 } 142 }
  143 + if cntAllSuper > 0 {
  144 + //查询需要执行上级评估,统计未完成
  145 + cntUncompletedSuper, _, err = evaluationRepo.Find(map[string]interface{}{
  146 + "types": int(domain.EvaluationSuper),
  147 + "executorId": param.UserId,
  148 + "limit": 1,
  149 + "cycleId": param.CycleId,
  150 + "status": string(domain.EvaluationUncompleted),
  151 + "beginTime": time.Now(),
  152 + })
  153 + if err != nil {
  154 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  155 + }
  156 + }
  157 +
  158 + var cntAllHrbp int
  159 + var cntUncompletedHrbp int
  160 +
122 //查询需要执行人资评估,统计未完成 161 //查询需要执行人资评估,统计未完成
123 - cntHrbp, _, err := evaluationRepo.Find(map[string]interface{}{  
124 - "types": int(domain.EvaluationHrbp),  
125 - "limit": 1,  
126 - "cycleId": param.CycleId,  
127 - "status": string(domain.EvaluationUncompleted), 162 + cntAllHrbp, _, err = evaluationRepo.Find(map[string]interface{}{
  163 + "types": int(domain.EvaluationHrbp),
  164 + "limit": 1,
  165 + "cycleId": param.CycleId,
  166 + "beginTime": time.Now(),
128 }) 167 })
129 if err != nil { 168 if err != nil {
130 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 169 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
131 } 170 }
132 - 171 + if cntAllHrbp > 0 {
  172 + // 查询需要执行人资评估,统计未完成
  173 + cntUncompletedHrbp, _, err = evaluationRepo.Find(map[string]interface{}{
  174 + "types": int(domain.EvaluationHrbp),
  175 + "limit": 1,
  176 + "cycleId": param.CycleId,
  177 + "status": string(domain.EvaluationUncompleted),
  178 + "beginTime": time.Now(),
  179 + })
  180 + if err != nil {
  181 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  182 + }
  183 + }
133 isHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId) 184 isHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
134 if err != nil { 185 if err != nil {
135 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 186 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -177,7 +228,6 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -177,7 +228,6 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
177 } else { 228 } else {
178 menu1_1.StatusName = "未完成" 229 menu1_1.StatusName = "未完成"
179 } 230 }
180 -  
181 } 231 }
182 if len(myEvaluationSuper) > 0 { 232 if len(myEvaluationSuper) > 0 {
183 if myEvaluationSuper[0].CheckResult == domain.EvaluationCheckCompleted { 233 if myEvaluationSuper[0].CheckResult == domain.EvaluationCheckCompleted {
@@ -201,12 +251,11 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -201,12 +251,11 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
201 StatusName: "", 251 StatusName: "",
202 Types: "360综评", 252 Types: "360综评",
203 } 253 }
204 - if cnt360 > 0 { 254 + if cntUncompleted360 > 0 {
205 menu2_1.StatusName = "未完成" 255 menu2_1.StatusName = "未完成"
206 - } else { 256 + } else if cntAll360 > 0 {
207 menu2_1.StatusName = "已完成" 257 menu2_1.StatusName = "已完成"
208 } 258 }
209 - menu2.Child = append(menu2.Child, menu2_1)  
210 menuList = append(menuList, menu2) 259 menuList = append(menuList, menu2)
211 menu3 := adapter.MenuListAdapter{ 260 menu3 := adapter.MenuListAdapter{
212 CycleId: 0, 261 CycleId: 0,
@@ -221,12 +270,11 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -221,12 +270,11 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
221 StatusName: "", 270 StatusName: "",
222 Types: "人资综评", 271 Types: "人资综评",
223 } 272 }
224 - if cntHrbp > 0 { 273 + if cntUncompletedHrbp > 0 {
225 menu3_1.StatusName = "未完成" 274 menu3_1.StatusName = "未完成"
226 - } else { 275 + } else if cntAllHrbp > 0 {
227 menu3_1.StatusName = "已完成" 276 menu3_1.StatusName = "已完成"
228 } 277 }
229 - menu3.Child = append(menu3.Child, menu3_1)  
230 //hrbp 才有这个菜单 278 //hrbp 才有这个菜单
231 if isHrbp > 0 { 279 if isHrbp > 0 {
232 menuList = append(menuList, menu3) 280 menuList = append(menuList, menu3)
@@ -244,9 +292,9 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri @@ -244,9 +292,9 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
244 StatusName: "", 292 StatusName: "",
245 Types: "上级综评", 293 Types: "上级综评",
246 } 294 }
247 - if cntSuper > 0 { 295 + if cntUncompletedSuper > 0 {
248 menu4_1.StatusName = "未完成" 296 menu4_1.StatusName = "未完成"
249 - } else { 297 + } else if cntAllSuper > 0 {
250 menu4_1.StatusName = "已完成" 298 menu4_1.StatusName = "已完成"
251 } 299 }
252 menu4.Child = append(menu4.Child, menu4_1) 300 menu4.Child = append(menu4.Child, menu4_1)
@@ -512,14 +560,14 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu @@ -512,14 +560,14 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
512 560
513 // 员工提交自评内容后, 561 // 员工提交自评内容后,
514 // 员工作为被评估人, 562 // 员工作为被评估人,
515 -// 变更360评估/人资评估/上级评估的开始时间 563 +// 变更360评估/人资评估/的开始时间
516 func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionContext application.TransactionContext, param *domain.SummaryEvaluation) error { 564 func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionContext application.TransactionContext, param *domain.SummaryEvaluation) error {
517 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ 565 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
518 "transactionContext": transactionContext, 566 "transactionContext": transactionContext,
519 }) 567 })
520 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ 568 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
521 "targetUserId": param.TargetUser.UserId, 569 "targetUserId": param.TargetUser.UserId,
522 - "typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp), int(domain.EvaluationSuper)}, 570 + "typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
523 "cycleId": param.CycleId, 571 "cycleId": param.CycleId,
524 "limit": 1000, 572 "limit": 1000,
525 }) 573 })
@@ -571,7 +619,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transaction @@ -571,7 +619,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transaction
571 if err != nil { 619 if err != nil {
572 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 620 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
573 } 621 }
574 - // 变更360评估/人资评估/上级评估的开始时间 622 + // 变更上级评估的开始时间
575 for _, v := range evaluationList { 623 for _, v := range evaluationList {
576 v.BeginTime = time.Now() 624 v.BeginTime = time.Now()
577 err = evaluationRepo.Save(v) 625 err = evaluationRepo.Save(v)
@@ -1027,6 +1075,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command. @@ -1027,6 +1075,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command.
1027 "executorId": param.ExecutorId, 1075 "executorId": param.ExecutorId,
1028 "types": int(domain.EvaluationSuper), 1076 "types": int(domain.EvaluationSuper),
1029 "limit": limit, 1077 "limit": limit,
  1078 + "beginTime": time.Now(),
1030 } 1079 }
1031 if offset > 0 { 1080 if offset > 0 {
1032 condition1["offset"] = offset 1081 condition1["offset"] = offset
@@ -1046,6 +1095,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command. @@ -1046,6 +1095,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command.
1046 "types": int(domain.EvaluationSuper), 1095 "types": int(domain.EvaluationSuper),
1047 "status": domain.EvaluationUncompleted, 1096 "status": domain.EvaluationUncompleted,
1048 "limit": 1, 1097 "limit": 1,
  1098 + "beginTime": time.Now(),
1049 }) 1099 })
1050 if err != nil { 1100 if err != nil {
1051 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1101 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -1339,9 +1389,10 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query @@ -1339,9 +1389,10 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query
1339 1389
1340 //获取评估列表信息 1390 //获取评估列表信息
1341 condition1 := map[string]interface{}{ 1391 condition1 := map[string]interface{}{
1342 - "cycleId": param.CycleId,  
1343 - "types": int(domain.EvaluationSuper),  
1344 - "limit": limit, 1392 + "cycleId": param.CycleId,
  1393 + "types": int(domain.EvaluationSuper),
  1394 + "limit": limit,
  1395 + "beginTime": time.Now(),
1345 } 1396 }
1346 if offset > 0 { 1397 if offset > 0 {
1347 condition1["offset"] = offset 1398 condition1["offset"] = offset
@@ -48,6 +48,7 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu @@ -48,6 +48,7 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu
48 "targetUserName": searchTargetName, 48 "targetUserName": searchTargetName,
49 "limit": limit, 49 "limit": limit,
50 "offset": offset, 50 "offset": offset,
  51 + "beginTime": time.Now(),
51 }) 52 })
52 if err != nil { 53 if err != nil {
53 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 54 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -457,6 +458,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval @@ -457,6 +458,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval
457 "types": domain.EvaluationHrbp, 458 "types": domain.EvaluationHrbp,
458 "limit": limit, 459 "limit": limit,
459 "offset": offset, 460 "offset": offset,
  461 + "beginTime": time.Now(),
460 } 462 }
461 if len(param.SearchName) > 0 { 463 if len(param.SearchName) > 0 {
462 condition["targetUserName"] = "%" + param.SearchName + "%" 464 condition["targetUserName"] = "%" + param.SearchName + "%"
@@ -162,6 +162,15 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{ @@ -162,6 +162,15 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{
162 query.Where(`summary_evaluation.executor->>'userId'='?'`, v) 162 query.Where(`summary_evaluation.executor->>'userId'='?'`, v)
163 } 163 }
164 164
  165 + if v, ok := queryOptions["beginTime"]; ok {
  166 + t := v.(time.Time)
  167 + query.Where(`summary_evaluation.begin_time<=?`, t)
  168 + }
  169 + if v, ok := queryOptions["endTime"]; ok {
  170 + t := v.(time.Time)
  171 + query.Where(`summary_evaluation.end_time>=?`, t)
  172 + }
  173 +
165 query.Order("id desc") 174 query.Order("id desc")
166 count, err := query.SelectAndCount() 175 count, err := query.SelectAndCount()
167 if err != nil { 176 if err != nil {