add 运营端小程序新增 充电时段分布接口

This commit is contained in:
Lemon
2026-06-24 08:41:21 +08:00
parent 710c8fb0fa
commit a92af3ea35

View File

@@ -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<TimeDistributionVO> data = orderBasicInfoService.getTimeDistribution(dto);
response = new RestApiResponse<>(data);
} catch (Exception e) {
logger.error("运营端小程序查询充电时段分布查询错误", e);
response = new RestApiResponse<>("00200009", "充电时段分布查询错误");
}
return response;
}
}