diff --git a/controller/end_user.go b/controller/end_user.go index 25bab71..d9d61d8 100644 --- a/controller/end_user.go +++ b/controller/end_user.go @@ -16,7 +16,7 @@ import ( func InitializeEndUserController(router *gin.Engine) { router.GET("/report/:rid/submeter", security.EnterpriseAuthorize, fetchEndUserInReport) - router.GET("/report/:rid/meter/template", security.EnterpriseAuthorize, downloadEndUserRegisterTemplate) + router.GET("/report/:rid/meter/template", downloadEndUserRegisterTemplate) router.POST("/report/:rid/meter/batch", security.EnterpriseAuthorize, uploadEndUserRegisterTemplate) router.PUT("/report/:rid/submeter/:pid/:mid", security.EnterpriseAuthorize, modifyEndUserRegisterRecord) } @@ -49,9 +49,6 @@ func fetchEndUserInReport(c *gin.Context) { func downloadEndUserRegisterTemplate(c *gin.Context) { result := response.NewResult(c) requestReportId := c.Param("rid") - if !ensureReportBelongs(c, result, requestReportId) { - return - } users, err := service.EndUserService.AllEndUserRecord(requestReportId) if err != nil { result.NotFound(err.Error()) diff --git a/excel/meter_non_pv_template.go b/excel/meter_non_pv_template.go index 4a7d9dc..752c256 100644 --- a/excel/meter_non_pv_template.go +++ b/excel/meter_non_pv_template.go @@ -75,8 +75,8 @@ func (t *MeterNonPVExcelTemplateGenerator) WriteMeterData(meters []model.EndUser meter.MeterId, meter.Ratio, meter.LastPeriodOverall, - nil, - nil, + "0", + "0", }, excelize.RowOpts{Height: 15}, ); err != nil { diff --git a/excel/meter_pv_template.go b/excel/meter_pv_template.go index c26a812..5c1c18e 100644 --- a/excel/meter_pv_template.go +++ b/excel/meter_pv_template.go @@ -84,17 +84,17 @@ func (t *MeterPVExcelTemplateGenerator) WriteMeterData(meters []model.EndUserDet meter.MeterId, meter.Ratio, meter.LastPeriodOverall, - nil, + "0", meter.LastPeriodCritical, - nil, + "0", meter.LastPeriodPeak, - nil, + "0", meter.LastPeriodValley, - nil, - nil, - nil, - nil, - nil, + "0", + "0", + "0", + "0", + "0", }, excelize.RowOpts{Height: 15}, ); err != nil { diff --git a/service/end_user.go b/service/end_user.go index 86ba060..ee3c46d 100644 --- a/service/end_user.go +++ b/service/end_user.go @@ -61,7 +61,7 @@ func (_EndUserService) SearchEndUserRecord(reportId, keyword string, page int) ( Limit(config.ServiceSettings.ItemsPageSize, startItem). Asc("seq"). Find(&endUsers) - cache.CacheSearch(endUsers, []string{"end_user", "report", "park"}, "end_user_detail", conditions...) + cache.CacheSearch(endUsers, []string{"end_user_detail", "report", "park"}, "end_user_detail", conditions...) return endUsers, total, err }