|
@@ -37,27 +37,40 @@ func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQue |
|
@@ -37,27 +37,40 @@ func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQue |
37
|
defer func() {
|
37
|
defer func() {
|
38
|
_ = transactionContext.RollbackTransaction()
|
38
|
_ = transactionContext.RollbackTransaction()
|
39
|
}()
|
39
|
}()
|
40
|
- staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
40
|
+ // staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
41
|
+ // "transactionContext": transactionContext,
|
|
|
42
|
+ // })
|
|
|
43
|
+
|
|
|
44
|
+ staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{
|
41
|
"transactionContext": transactionContext,
|
45
|
"transactionContext": transactionContext,
|
42
|
})
|
46
|
})
|
43
|
- var limit int = 20
|
47
|
+
|
|
|
48
|
+ var limit int = 200
|
44
|
var offset int = 0
|
49
|
var offset int = 0
|
45
|
if param.PageSize > 0 {
|
50
|
if param.PageSize > 0 {
|
46
|
limit = param.PageSize
|
51
|
limit = param.PageSize
|
47
|
}
|
52
|
}
|
48
|
offset = (param.PageNumber - 1) * param.PageSize
|
53
|
offset = (param.PageNumber - 1) * param.PageSize
|
49
|
- condition := map[string]interface{}{
|
|
|
50
|
- "executorId": param.UserId,
|
|
|
51
|
- "companyId": param.CompanyId,
|
|
|
52
|
- "limit": limit,
|
|
|
53
|
- }
|
|
|
54
|
- if offset > 0 {
|
|
|
55
|
- condition["offset"] = offset
|
54
|
+ assessTaskList, err := staffAssessTaskRepo.SearchAssessTaskMe(param.UserId, param.CompanyId, limit, offset)
|
|
|
55
|
+ if err != nil {
|
|
|
56
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())
|
56
|
}
|
57
|
}
|
57
|
- cnt, assessTaskList, err := staffAssessTaskRepo.Find(condition)
|
58
|
+ cnt, err := staffAssessTaskRepo.CountAssessTaskMe(param.UserId, param.CompanyId)
|
58
|
if err != nil {
|
59
|
if err != nil {
|
59
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询周期"+err.Error())
|
60
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())
|
60
|
}
|
61
|
}
|
|
|
62
|
+ // condition := map[string]interface{}{
|
|
|
63
|
+ // "executorId": param.UserId,
|
|
|
64
|
+ // "companyId": param.CompanyId,
|
|
|
65
|
+ // "limit": limit,
|
|
|
66
|
+ // }
|
|
|
67
|
+ // if offset > 0 {
|
|
|
68
|
+ // condition["offset"] = offset
|
|
|
69
|
+ // }
|
|
|
70
|
+ // cnt, assessTaskList, err := staffAssessTaskRepo.Find(condition)
|
|
|
71
|
+ // if err != nil {
|
|
|
72
|
+ // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询周期"+err.Error())
|
|
|
73
|
+ // }
|
61
|
if err := transactionContext.CommitTransaction(); err != nil {
|
74
|
if err := transactionContext.CommitTransaction(); err != nil {
|
62
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
75
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
63
|
}
|
76
|
}
|
|
@@ -200,6 +213,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
|
@@ -200,6 +213,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
200
|
}
|
213
|
}
|
201
|
}
|
214
|
}
|
202
|
if uncompletedNum > 0 {
|
215
|
if uncompletedNum > 0 {
|
|
|
216
|
+ stepItem.Status = string(domain.StaffAssessUncompleted)
|
203
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum)
|
217
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum)
|
204
|
}
|
218
|
}
|
205
|
}
|
219
|
}
|
|
@@ -332,15 +346,15 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) |
|
@@ -332,15 +346,15 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) |
332
|
// 根据项目评估的配置,创建员工的评估任务
|
346
|
// 根据项目评估的配置,创建员工的评估任务
|
333
|
func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext application.TransactionContext, param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
|
347
|
func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext application.TransactionContext, param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
|
334
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
348
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
335
|
- if err != nil {
|
|
|
336
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
337
|
- }
|
|
|
338
|
- if err := transactionContext.StartTransaction(); err != nil {
|
|
|
339
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
340
|
- }
|
|
|
341
|
- defer func() {
|
|
|
342
|
- _ = transactionContext.RollbackTransaction()
|
|
|
343
|
- }()
|
349
|
+ // if err != nil {
|
|
|
350
|
+ // return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
351
|
+ // }
|
|
|
352
|
+ // if err := transactionContext.StartTransaction(); err != nil {
|
|
|
353
|
+ // return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
354
|
+ // }
|
|
|
355
|
+ // defer func() {
|
|
|
356
|
+ // _ = transactionContext.RollbackTransaction()
|
|
|
357
|
+ // }()
|
344
|
log.Logger.Debug("CreateStaffAssessTask 获取参数", map[string]interface{}{
|
358
|
log.Logger.Debug("CreateStaffAssessTask 获取参数", map[string]interface{}{
|
345
|
"param": param,
|
359
|
"param": param,
|
346
|
})
|
360
|
})
|
|
@@ -454,9 +468,9 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
|
@@ -454,9 +468,9 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
454
|
}
|
468
|
}
|
455
|
}
|
469
|
}
|
456
|
|
470
|
|
457
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
458
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
459
|
- }
|
471
|
+ // if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
472
|
+ // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
473
|
+ // }
|
460
|
return map[string]interface{}{
|
474
|
return map[string]interface{}{
|
461
|
"assessTaskId": assessTaskData.Id,
|
475
|
"assessTaskId": assessTaskData.Id,
|
462
|
}, nil
|
476
|
}, nil
|