Merge branch 'master' into test
正在显示
3 个修改的文件
包含
41 行增加
和
0 行删除
| @@ -959,3 +959,31 @@ outerLoop: | @@ -959,3 +959,31 @@ outerLoop: | ||
| 959 | 959 | ||
| 960 | return map[string]interface{}{"indicatorTypeTask": indicatorTypeTask}, nil | 960 | return map[string]interface{}{"indicatorTypeTask": indicatorTypeTask}, nil |
| 961 | } | 961 | } |
| 962 | + | ||
| 963 | +// 修复数据用 | ||
| 964 | +func (rs *EvaluationProjectService) FixEvaluationItemUsed(id int) error { | ||
| 965 | + | ||
| 966 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 967 | + if err != nil { | ||
| 968 | + return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 969 | + } | ||
| 970 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 971 | + return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 972 | + } | ||
| 973 | + defer func() { | ||
| 974 | + _ = transactionContext.RollbackTransaction() | ||
| 975 | + }() | ||
| 976 | + projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
| 977 | + project, err := projectRepository.FindOne(map[string]interface{}{"id": id}) | ||
| 978 | + if err != nil { | ||
| 979 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 980 | + } | ||
| 981 | + err = rs.generateEvaluationItemUsed(transactionContext, project) | ||
| 982 | + if err != nil { | ||
| 983 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 984 | + } | ||
| 985 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 986 | + return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 987 | + } | ||
| 988 | + return nil | ||
| 989 | +} |
| @@ -149,3 +149,14 @@ func (controller *ProjectController) CheckTaskTemplate() { | @@ -149,3 +149,14 @@ func (controller *ProjectController) CheckTaskTemplate() { | ||
| 149 | controller.Response(ruService.CheckTaskTemplate(in)) | 149 | controller.Response(ruService.CheckTaskTemplate(in)) |
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | + | ||
| 153 | +func (controller *ProjectController) FixEvaluationItemUsed() { | ||
| 154 | + ruService := service.NewEvaluationProjectService() | ||
| 155 | + id, err := controller.GetInt("project_id") | ||
| 156 | + if err != nil { | ||
| 157 | + controller.Response(nil, application.ThrowError(application.ARG_ERROR, "id err")) | ||
| 158 | + } | ||
| 159 | + err = ruService.FixEvaluationItemUsed(id) | ||
| 160 | + controller.Response(nil, err) | ||
| 161 | + | ||
| 162 | +} |
| @@ -22,6 +22,8 @@ func init() { | @@ -22,6 +22,8 @@ func init() { | ||
| 22 | web.NSRouter("/activate", &controllers.ProjectController{}, "Post:ActivateProject"), | 22 | web.NSRouter("/activate", &controllers.ProjectController{}, "Post:ActivateProject"), |
| 23 | web.NSRouter("/pause", &controllers.ProjectController{}, "Post:PauseProject"), | 23 | web.NSRouter("/pause", &controllers.ProjectController{}, "Post:PauseProject"), |
| 24 | web.NSRouter("/resume", &controllers.ProjectController{}, "Post:ResumeProject"), | 24 | web.NSRouter("/resume", &controllers.ProjectController{}, "Post:ResumeProject"), |
| 25 | + web.NSCtrlGet("/fix/evaluation_item_used", (*controllers.ProjectController).FixEvaluationItemUsed), | ||
| 25 | ) | 26 | ) |
| 27 | + | ||
| 26 | web.AddNamespace(ns) | 28 | web.AddNamespace(ns) |
| 27 | } | 29 | } |
-
请 注册 或 登录 后发表评论