|
@@ -833,7 +833,7 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex |
|
@@ -833,7 +833,7 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex |
833
|
"transactionContext": transactionContext,
|
833
|
"transactionContext": transactionContext,
|
834
|
})
|
834
|
})
|
835
|
var err error
|
835
|
var err error
|
836
|
- cnt, _, err := itemUsedRepo.Find(map[string]interface{}{"projectId": project.Id})
|
836
|
+ cnt, _, err := itemUsedRepo.Find(map[string]interface{}{"evaluationProjectId": project.Id})
|
837
|
if err != nil {
|
837
|
if err != nil {
|
838
|
return application.ThrowError(application.TRANSACTION_ERROR, "检查评估选项"+err.Error())
|
838
|
return application.ThrowError(application.TRANSACTION_ERROR, "检查评估选项"+err.Error())
|
839
|
}
|
839
|
}
|
|
@@ -878,3 +878,31 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex |
|
@@ -878,3 +878,31 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex |
878
|
}
|
878
|
}
|
879
|
return nil
|
879
|
return nil
|
880
|
}
|
880
|
}
|
|
|
881
|
+
|
|
|
882
|
+// 修复数据用
|
|
|
883
|
+func (rs *EvaluationProjectService) FixEvaluationItemUsed(id int) error {
|
|
|
884
|
+
|
|
|
885
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
886
|
+ if err != nil {
|
|
|
887
|
+ return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
888
|
+ }
|
|
|
889
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
890
|
+ return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
891
|
+ }
|
|
|
892
|
+ defer func() {
|
|
|
893
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
894
|
+ }()
|
|
|
895
|
+ projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
896
|
+ project, err := projectRepository.FindOne(map[string]interface{}{"id": id})
|
|
|
897
|
+ if err != nil {
|
|
|
898
|
+ return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
899
|
+ }
|
|
|
900
|
+ err = rs.generateEvaluationItemUsed(transactionContext, project)
|
|
|
901
|
+ if err != nil {
|
|
|
902
|
+ return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
903
|
+ }
|
|
|
904
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
905
|
+ return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
906
|
+ }
|
|
|
907
|
+ return nil
|
|
|
908
|
+} |