This commit is contained in:
Guoqs
2024-08-12 13:38:29 +08:00
2 changed files with 29 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ package com.jsowell.api.uniapp.business;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.response.RestApiResponse;
import com.jsowell.pile.dto.StationBusinessAnalyzeInfoDTO; import com.jsowell.pile.dto.StationBusinessAnalyzeInfoDTO;
import com.jsowell.pile.dto.StationStatisticsInfoDTO; import com.jsowell.pile.dto.StationStatisticsInfoDTO;
@@ -82,7 +83,11 @@ public class BusinessStationInfoController extends BaseController {
try { try {
StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationMonthlyBusinessAnalyzeInfo(dto); StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationMonthlyBusinessAnalyzeInfo(dto);
response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo)); response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo));
} catch (Exception e) { }catch (BusinessException e){
logger.error("获取站点运营分析信息 error:{}", e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
}
catch (Exception e) {
logger.error("获取站点运营分析信息 error", e); logger.error("获取站点运营分析信息 error", e);
response = new RestApiResponse<>(e); response = new RestApiResponse<>(e);
} }

View File

@@ -797,9 +797,8 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
} }
} }
// 日期区间 // 日期区间
String startTime = null; // String startTime = null;
String endTime = null; // String endTime = null;
if (dateTime == null) {
// 用户未选中某天时 // 用户未选中某天时
Date date = null; Date date = null;
if (StringUtils.equals(Constants.ONE, type)) { if (StringUtils.equals(Constants.ONE, type)) {
@@ -809,14 +808,16 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
// 30天 // 30天
date = DateUtils.addDays(new Date(), -30); date = DateUtils.addDays(new Date(), -30);
} }
startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date); String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date);
endTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD); String endTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
// if (dateTime == null) {
} else { //
// 用户选中某天的数据时↓ //
startTime = dateTime; // } else {
endTime = dateTime; // // 用户选中某天的数据时↓
} // startTime = dateTime;
// endTime = dateTime;
// }
// 根据站点ids和日期区间查询订单详情 // 根据站点ids和日期区间查询订单详情
List<BusinessOrderDetailInfoVO> orderDetails = orderBasicInfoService.getOrderDetailByStationIds(stationIds, startTime, endTime); List<BusinessOrderDetailInfoVO> orderDetails = orderBasicInfoService.getOrderDetailByStationIds(stationIds, startTime, endTime);
@@ -966,6 +967,9 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
// 查询订单日报表过去一年的数据 // 查询订单日报表过去一年的数据
List<SettleOrderReport> list = settleOrderReportService.queryOrderReport(stationIds, startTime, endTime); List<SettleOrderReport> list = settleOrderReportService.queryOrderReport(stationIds, startTime, endTime);
if (CollectionUtils.isEmpty(list)) {
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
}
// 按照日期汇总数据 // 按照日期汇总数据
Map<String, SettleOrderReport> collect = list.stream() Map<String, SettleOrderReport> collect = list.stream()
.peek(report -> { .peek(report -> {