forked from free-lancers/electricity_bill_calc_service
		
	feat(report):完成步进报表中待摊薄费用编辑步骤的功能。
This commit is contained in:
		| @@ -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("待摊薄费用编辑步骤已经完成。") | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user