diff --git a/controller/report.go b/controller/report.go index 912c5cd..38a27c6 100644 --- a/controller/report.go +++ b/controller/report.go @@ -31,6 +31,7 @@ func InitializeReportController(router *gin.Engine) { router.POST("/report/:rid/maintenance/import", security.EnterpriseAuthorize, importPredefinedMaintenanceFees) router.PUT("/report/:rid/maintenance/:mid", security.EnterpriseAuthorize, modifyWillDilutedFee) router.DELETE("/report/:rid/maintenance/:mid", security.EnterpriseAuthorize, deleteTemporaryWillDilutedFee) + router.PUT("/report/:rid/step/diluted/fees", security.EnterpriseAuthorize, progressReportWillDilutedFee) } func ensureReportBelongs(c *gin.Context, result *response.Result, requestReportId string) bool { @@ -338,3 +339,22 @@ func deleteTemporaryWillDilutedFee(c *gin.Context) { } result.Deleted("指定待摊薄费用信息已经删除。") } + +func progressReportWillDilutedFee(c *gin.Context) { + result := response.NewResult(c) + requestReportId := c.Param("rid") + if !ensureReportBelongs(c, result, requestReportId) { + return + } + report, err := service.ReportService.RetreiveReportIndex(requestReportId) + if err != nil { + result.NotFound(err.Error()) + return + } + err = service.ReportService.ProgressReportWillDilutedFee(*report) + if err != nil { + result.Error(http.StatusInternalServerError, err.Error()) + return + } + result.Success("待摊薄费用编辑步骤已经完成。") +} diff --git a/service/report.go b/service/report.go index 1005185..f19a825 100644 --- a/service/report.go +++ b/service/report.go @@ -255,3 +255,9 @@ func (_ReportService) DeleteWillDilutedFee(fee string) (err error) { _, err = global.DBConn.ID(fee).NoAutoCondition().Delete(new(model.WillDilutedFee)) return } + +func (_ReportService) ProgressReportWillDilutedFee(report model.Report) (err error) { + report.StepState.WillDiluted = true + _, err = global.DBConn.ID(report.Id).Cols("step_state").Update(report) + return +}