From 5ea375a2cc169f9f767e79dbffc78beb5223464f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Sun, 21 Aug 2022 22:29:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(report):=E5=AE=8C=E6=88=90=E6=AD=A5?= =?UTF-8?q?=E8=BF=9B=E6=8A=A5=E8=A1=A8=E4=B8=AD=E5=BE=85=E6=91=8A=E8=96=84?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E7=BC=96=E8=BE=91=E6=AD=A5=E9=AA=A4=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/report.go | 20 ++++++++++++++++++++ service/report.go | 6 ++++++ 2 files changed, 26 insertions(+) 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 +}