...
|
...
|
@@ -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)
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -356,10 +370,6 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
|
|
return nil, application.ThrowError(application.ARG_ERROR, "任务结束时间填写错误,"+param.EndTime)
|
|
|
}
|
|
|
nowTime := time.Now()
|
|
|
// if len(assassessTaskList) > 0 {
|
|
|
// assessTaskData = assassessTaskList[0]
|
|
|
// assessTaskData.UpdatedAt = nowTime
|
|
|
// } else {
|
|
|
//建立评估任务
|
|
|
assessTaskData := &domain.StaffAssessTask{
|
|
|
Id: 0,
|
...
|
...
|
@@ -551,11 +561,11 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application. |
|
|
stepSelfTemp.LinkNodeId = v.LinkNodeId
|
|
|
stepSelfTemp.LinkNodeName = v.LinkNodeName
|
|
|
stepSelfTemp.Types = domain.AssessSuper
|
|
|
assessListTemp, err := srv.createStaffAssessSupper(transactionContext, stepSelfTemp, userList, userDepartmentMap)
|
|
|
assessListTemp2, err := srv.createStaffAssessSupper(transactionContext, stepSelfTemp, userList, userDepartmentMap)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
assessList = append(assessList, assessListTemp...)
|
|
|
assessList = append(assessList, assessListTemp2...)
|
|
|
}
|
|
|
}
|
|
|
return assessList, nil
|
...
|
...
|
@@ -1655,6 +1665,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//保存信息
|
|
|
for i := range assessContentList {
|
|
|
_, err = assessContentRepo.Save(assessContentList[i])
|
...
|
...
|
@@ -1662,6 +1673,12 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估填写内容"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
assessData.Status = domain.StaffAssessCompleted
|
|
|
assessData.UpdatedAt = time.Now()
|
|
|
_, err = assessReps.Save(assessData)
|
|
|
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())
|
|
|
}
|
...
|
...
|
|