forked from free-lancers/electricity_bill_calc_service
feat(report):增加推进报表抄表步骤和发布报表功能。
This commit is contained in:
@@ -32,6 +32,8 @@ func InitializeReportController(router *gin.Engine) {
|
||||
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)
|
||||
router.PUT("/report/:rid/step/meter/register", security.EnterpriseAuthorize, progressEndUserRegister)
|
||||
router.POST("/report/:rid/publish", security.EnterpriseAuthorize, publishReport)
|
||||
}
|
||||
|
||||
func ensureReportBelongs(c *gin.Context, result *response.Result, requestReportId string) bool {
|
||||
@@ -358,3 +360,41 @@ func progressReportWillDilutedFee(c *gin.Context) {
|
||||
}
|
||||
result.Success("待摊薄费用编辑步骤已经完成。")
|
||||
}
|
||||
|
||||
func progressEndUserRegister(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.ProgressReportRegisterEndUser(*report)
|
||||
if err != nil {
|
||||
result.Error(http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
result.Success("终端用户抄表编辑步骤已经完成。")
|
||||
}
|
||||
|
||||
func publishReport(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.PublishReport(*report)
|
||||
if err != nil {
|
||||
result.Error(http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
result.Success("指定的公示报表已经发布。")
|
||||
}
|
||||
|
Reference in New Issue
Block a user