作者 tangxvhui

日常保存

@@ -9,7 +9,6 @@ type EvaluationInfoAdapter struct { @@ -9,7 +9,6 @@ type EvaluationInfoAdapter struct {
9 EvaluationProjectId int `json:"evaluationProjectId"` //项目id 9 EvaluationProjectId int `json:"evaluationProjectId"` //项目id
10 EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 10 EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
11 LinkNodeId int `json:"linkNodeId,string"` //评估环节id 11 LinkNodeId int `json:"linkNodeId,string"` //评估环节id
12 - LinkNodeName string `json:"linkNodeName"` //评估环节名称  
13 BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 12 BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
14 EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 13 EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
15 Status string `json:"status"` //完成状态 14 Status string `json:"status"` //完成状态
  1 +package command
  2 +
  3 +type EditEvaluationValue struct {
  4 + SummaryEvaluationId int `json:"summaryEvaluationId,string"`
  5 + ExecutorId int `json:"-"` //执行人id
  6 + CompanyId int `json:"-"` //公司id
  7 + EvaluationItems []struct {
  8 + Value string `json:"value"`
  9 + Remark string `json:"remark"`
  10 + EvaluationItemId string `json:"evaluationItemId"`
  11 + } `json:"evaluationItems"`
  12 +}
@@ -294,7 +294,7 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval @@ -294,7 +294,7 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval
294 evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ 294 evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
295 "transactionContext": transactionContext, 295 "transactionContext": transactionContext,
296 }) 296 })
297 - itemValueRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ 297 + itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
298 "transactionContext": transactionContext, 298 "transactionContext": transactionContext,
299 }) 299 })
300 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ 300 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
@@ -313,20 +313,42 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval @@ -313,20 +313,42 @@ func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEval
313 _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{ 313 _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
314 "evaluationProjectId": evaluationData.EvaluationProjectId, 314 "evaluationProjectId": evaluationData.EvaluationProjectId,
315 "nodeType": int(domain.LinkNodeSelfAssessment), 315 "nodeType": int(domain.LinkNodeSelfAssessment),
  316 + "limit": 300,
316 }) 317 })
317 if err != nil { 318 if err != nil {
318 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 319 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
319 } 320 }
  321 +
  322 + _, itemValues, err := itemValueRepo.Find(map[string]interface{}{
  323 + "summaryEvaluationId": evaluationData.Id,
  324 + })
  325 +
  326 + if err != nil {
  327 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  328 + }
  329 +
320 if err := transactionContext.CommitTransaction(); err != nil { 330 if err := transactionContext.CommitTransaction(); err != nil {
321 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 331 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
322 } 332 }
323 - _ = itemList  
324 - _ = itemValueRepo  
325 - return nil, nil 333 +
  334 + itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
  335 + result := adapter.EvaluationInfoAdapter{
  336 + SummaryEvaluationId: evaluationData.Id,
  337 + CycleId: int(evaluationData.CycleId),
  338 + CycleName: evaluationData.CycleName,
  339 + EvaluationProjectId: evaluationData.EvaluationProjectId,
  340 + EvaluationProjectName: evaluationData.EvaluationProjectName,
  341 + LinkNodeId: evaluationData.NodeId,
  342 + BeginTime: evaluationData.BeginTime.Format("2006-01-02 15:04:05"),
  343 + EndTime: evaluationData.EndTime.Format("2006-01-02 15:04:05"),
  344 + Status: string(evaluationData.Status),
  345 + EvaluationItems: itemValuesAdapter,
  346 + }
  347 + return &result, nil
326 } 348 }
327 349
328 // 编辑综合自评详情 350 // 编辑综合自评详情
329 -func (srv *SummaryEvaluationServeice) EditEvaluationSelf() (map[string][]adapter.EvaluationItemAdapter, error) { 351 +func (srv *SummaryEvaluationServeice) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
330 transactionContext, err := factory.CreateTransactionContext(nil) 352 transactionContext, err := factory.CreateTransactionContext(nil)
331 if err != nil { 353 if err != nil {
332 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 354 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -337,7 +359,33 @@ func (srv *SummaryEvaluationServeice) EditEvaluationSelf() (map[string][]adapter @@ -337,7 +359,33 @@ func (srv *SummaryEvaluationServeice) EditEvaluationSelf() (map[string][]adapter
337 defer func() { 359 defer func() {
338 _ = transactionContext.RollbackTransaction() 360 _ = transactionContext.RollbackTransaction()
339 }() 361 }()
  362 + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
  363 + "transactionContext": transactionContext,
  364 + })
  365 + itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
  366 + "transactionContext": transactionContext,
  367 + })
  368 +
  369 + itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
  370 + "transactionContext": transactionContext,
  371 + })
  372 + evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
  373 + "id": param.SummaryEvaluationId,
  374 + })
  375 + if err != nil {
  376 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  377 + }
340 378
  379 + _, itemList, err := itemUsedRepo.Find(map[string]interface{}{
  380 + "evaluationProjectId": int(domain.LinkNodeSelfAssessment),
  381 + "limit": 300,
  382 + })
  383 + if err != nil {
  384 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  385 + }
  386 + _ = itemValueRepo
  387 + _ = evaluationData
  388 + _ = itemList
341 if err := transactionContext.CommitTransaction(); err != nil { 389 if err := transactionContext.CommitTransaction(); err != nil {
342 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 390 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
343 } 391 }
@@ -10,6 +10,7 @@ type SummaryEvaluation struct { @@ -10,6 +10,7 @@ type SummaryEvaluation struct {
10 EvaluationProjectName string //对应的项目名称 10 EvaluationProjectName string //对应的项目名称
11 CycleId int64 //对应的周期id 11 CycleId int64 //对应的周期id
12 CycleName string //对应的周期名称 12 CycleName string //对应的周期名称
  13 + NodeId int
13 TargetUser StaffDesc //被评估的目标用户,被执行的 14 TargetUser StaffDesc //被评估的目标用户,被执行的
14 TargetDepartment []StaffDepartment //被评估的目标用户所在的部门 15 TargetDepartment []StaffDepartment //被评估的目标用户所在的部门
15 Executor StaffDesc //填写评估的用户,执行人 16 Executor StaffDesc //填写评估的用户,执行人