...
|
...
|
@@ -37,27 +37,40 @@ func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQue |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
// staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
// })
|
|
|
|
|
|
staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
var limit int = 20
|
|
|
|
|
|
var limit int = 200
|
|
|
var offset int = 0
|
|
|
if param.PageSize > 0 {
|
|
|
limit = param.PageSize
|
|
|
}
|
|
|
offset = (param.PageNumber - 1) * param.PageSize
|
|
|
condition := map[string]interface{}{
|
|
|
"executorId": param.UserId,
|
|
|
"companyId": param.CompanyId,
|
|
|
"limit": limit,
|
|
|
}
|
|
|
if offset > 0 {
|
|
|
condition["offset"] = offset
|
|
|
assessTaskList, err := staffAssessTaskRepo.SearchAssessTaskMe(param.UserId, param.CompanyId, limit, offset)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())
|
|
|
}
|
|
|
cnt, assessTaskList, err := staffAssessTaskRepo.Find(condition)
|
|
|
cnt, err := staffAssessTaskRepo.CountAssessTaskMe(param.UserId, param.CompanyId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询周期"+err.Error())
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())
|
|
|
}
|
|
|
// condition := map[string]interface{}{
|
|
|
// "executorId": param.UserId,
|
|
|
// "companyId": param.CompanyId,
|
|
|
// "limit": limit,
|
|
|
// }
|
|
|
// if offset > 0 {
|
|
|
// condition["offset"] = offset
|
|
|
// }
|
|
|
// cnt, assessTaskList, err := staffAssessTaskRepo.Find(condition)
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询周期"+err.Error())
|
|
|
// }
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -200,6 +213,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
|
|
}
|
|
|
}
|
|
|
if uncompletedNum > 0 {
|
|
|
stepItem.Status = string(domain.StaffAssessUncompleted)
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum)
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -332,15 +346,15 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) |
|
|
// 根据项目评估的配置,创建员工的评估任务
|
|
|
func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext application.TransactionContext, param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// if err := transactionContext.StartTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// defer func() {
|
|
|
// _ = transactionContext.RollbackTransaction()
|
|
|
// }()
|
|
|
log.Logger.Debug("CreateStaffAssessTask 获取参数", map[string]interface{}{
|
|
|
"param": param,
|
|
|
})
|
...
|
...
|
@@ -454,9 +468,9 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
|
|
}
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
// }
|
|
|
return map[string]interface{}{
|
|
|
"assessTaskId": assessTaskData.Id,
|
|
|
}, nil
|
...
|
...
|
|