作者 tangxvhui

日常保存

... ... @@ -9,7 +9,6 @@ type EvaluationInfoAdapter struct {
EvaluationProjectId int `json:"evaluationProjectId"` //项目id
EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
LinkNodeId int `json:"linkNodeId,string"` //评估环节id
LinkNodeName string `json:"linkNodeName"` //评估环节名称
BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
Status string `json:"status"` //完成状态
... ...
package command
type EditEvaluationValue struct {
SummaryEvaluationId int `json:"summaryEvaluationId,string"`
ExecutorId int `json:"-"` //执行人id
CompanyId int `json:"-"` //公司id
EvaluationItems []struct {
Value string `json:"value"`
Remark string `json:"remark"`
EvaluationItemId string `json:"evaluationItemId"`
} `json:"evaluationItems"`
}
... ...
... ... @@ -294,7 +294,7 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
itemValueRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
... ... @@ -313,20 +313,42 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
"evaluationProjectId": evaluationData.EvaluationProjectId,
"nodeType": int(domain.LinkNodeSelfAssessment),
"limit": 300,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{
"summaryEvaluationId": evaluationData.Id,
})
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())
}
_ = itemList
_ = itemValueRepo
return nil, nil
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
result := adapter.EvaluationInfoAdapter{
SummaryEvaluationId: evaluationData.Id,
CycleId: int(evaluationData.CycleId),
CycleName: evaluationData.CycleName,
EvaluationProjectId: evaluationData.EvaluationProjectId,
EvaluationProjectName: evaluationData.EvaluationProjectName,
LinkNodeId: evaluationData.NodeId,
BeginTime: evaluationData.BeginTime.Format("2006-01-02 15:04:05"),
EndTime: evaluationData.EndTime.Format("2006-01-02 15:04:05"),
Status: string(evaluationData.Status),
EvaluationItems: itemValuesAdapter,
}
return &result, nil
}
// 编辑综合自评详情
func (srv *SummaryEvaluationServeice) EditEvaluationSelf() (map[string][]adapter.EvaluationItemAdapter, error) {
func (srv *SummaryEvaluationServeice) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -337,7 +359,33 @@ func (srv *SummaryEvaluationServeice) EditEvaluationSelf() (map[string][]adapter
defer func() {
_ = transactionContext.RollbackTransaction()
}()
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
"id": param.SummaryEvaluationId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
"evaluationProjectId": int(domain.LinkNodeSelfAssessment),
"limit": 300,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
_ = itemValueRepo
_ = evaluationData
_ = itemList
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ...
... ... @@ -10,6 +10,7 @@ type SummaryEvaluation struct {
EvaluationProjectName string //对应的项目名称
CycleId int64 //对应的周期id
CycleName string //对应的周期名称
NodeId int
TargetUser StaffDesc //被评估的目标用户,被执行的
TargetDepartment []StaffDepartment //被评估的目标用户所在的部门
Executor StaffDesc //填写评估的用户,执行人
... ...