diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java index ad29c7118..eaa6291e2 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java @@ -3,6 +3,7 @@ package com.jsowell.api.uniapp.business; import com.alibaba.fastjson2.JSONObject; import com.google.common.collect.ImmutableMap; import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.dto.StationBusinessAnalyzeInfoDTO; import com.jsowell.pile.dto.StationStatisticsInfoDTO; @@ -82,7 +83,11 @@ public class BusinessStationInfoController extends BaseController { try { StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationMonthlyBusinessAnalyzeInfo(dto); 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); response = new RestApiResponse<>(e); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index 30262647a..68f439bb9 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -797,26 +797,27 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { } } // 日期区间 - String startTime = null; - String endTime = null; - if (dateTime == null) { - // 用户未选中某天时 - Date date = null; - if (StringUtils.equals(Constants.ONE, type)) { - // 7天 - date = DateUtils.addDays(new Date(), -7); - }else if (StringUtils.equals(Constants.TWO, type)) { - // 30天 - date = DateUtils.addDays(new Date(), -30); - } - startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date); - endTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD); - - } else { - // 用户选中某天的数据时↓ - startTime = dateTime; - endTime = dateTime; + // String startTime = null; + // String endTime = null; + // 用户未选中某天时 + Date date = null; + if (StringUtils.equals(Constants.ONE, type)) { + // 7天 + date = DateUtils.addDays(new Date(), -7); + }else if (StringUtils.equals(Constants.TWO, type)) { + // 30天 + date = DateUtils.addDays(new Date(), -30); } + String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date); + String endTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD); + // if (dateTime == null) { + // + // + // } else { + // // 用户选中某天的数据时↓ + // startTime = dateTime; + // endTime = dateTime; + // } // 根据站点ids和日期区间查询订单详情 List orderDetails = orderBasicInfoService.getOrderDetailByStationIds(stationIds, startTime, endTime); @@ -966,6 +967,9 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { // 查询订单日报表过去一年的数据 List list = settleOrderReportService.queryOrderReport(stationIds, startTime, endTime); + if (CollectionUtils.isEmpty(list)) { + throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); + } // 按照日期汇总数据 Map collect = list.stream() .peek(report -> {