From a92af3ea358d34d4a32f9436e09dfff1b1c50dab Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 24 Jun 2026 08:41:21 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E8=BF=90=E8=90=A5=E7=AB=AF=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=96=B0=E5=A2=9E=20=E5=85=85=E7=94=B5?= =?UTF-8?q?=E6=97=B6=E6=AE=B5=E5=88=86=E5=B8=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/BusinessFinancialController.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java index c3dbf5f90..a005a14a0 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessFinancialController.java @@ -1,5 +1,6 @@ package com.jsowell.api.uniapp.business; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.page.PageResponse; @@ -7,18 +8,21 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; import com.google.common.collect.ImmutableMap; +import com.jsowell.pile.dto.IndexQueryDTO; import com.jsowell.pile.dto.MerchantOrderReportDTO; import com.jsowell.pile.dto.ParkingCouponRecordQueryDTO; import com.jsowell.pile.dto.business.BusinessEfficiencyQueryDTO; import com.jsowell.pile.dto.business.BusinessOperationAnalysisQueryDTO; import com.jsowell.pile.dto.business.BusinessScaleQueryDTO; import com.jsowell.pile.service.BusinessFinancialService; +import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.vo.uniapp.business.BusinessEfficiencyAnalysisVO; import com.jsowell.pile.vo.uniapp.business.BusinessEfficiencyVO; import com.jsowell.pile.vo.uniapp.business.BusinessGunEfficiencyAnalysisVO; import com.jsowell.pile.vo.uniapp.business.BusinessOperationAnalysisVO; import com.jsowell.pile.vo.uniapp.business.BusinessScaleVO; import com.jsowell.pile.vo.web.MerchantOrderReportVO; +import com.jsowell.pile.vo.web.TimeDistributionVO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -26,6 +30,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 运营端财务信息相关Controller * @@ -38,6 +44,9 @@ public class BusinessFinancialController extends BaseController { @Autowired private BusinessFinancialService businessFinancialService; + @Autowired + private OrderBasicInfoService orderBasicInfoService; + /** * 我的钱包界面查询接口 * @@ -236,4 +245,30 @@ public class BusinessFinancialController extends BaseController { } return response; } + + /** + * 大数据平台-充电时段分布 + */ + @PostMapping("/getTimeDistribution") + public RestApiResponse getTimeDistribution(@RequestBody(required = false) IndexQueryDTO dto) { + if (dto == null) dto = new IndexQueryDTO(); + // 默认查询最近30天,避免全表扫描超时 + if (com.jsowell.common.util.StringUtils.isEmpty(dto.getStartTime()) || com.jsowell.common.util.StringUtils.isEmpty(dto.getEndTime())) { + java.time.LocalDate endDate = java.time.LocalDate.now(); + java.time.LocalDate startDate = endDate.minusDays(29); + java.time.format.DateTimeFormatter fmt = java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"); + dto.setStartTime(startDate.format(fmt) + " 00:00:00"); + dto.setEndTime(endDate.format(fmt) + " 23:59:59"); + } + logger.info("运营端小程序查询充电时段分布查询 param:{}", JSON.toJSONString(dto)); + RestApiResponse response; + try { + List data = orderBasicInfoService.getTimeDistribution(dto); + response = new RestApiResponse<>(data); + } catch (Exception e) { + logger.error("运营端小程序查询充电时段分布查询错误", e); + response = new RestApiResponse<>("00200009", "充电时段分布查询错误"); + } + return response; + } }