From 7d8c2fcb18a460a30d4e179c243c036062ad0d0f Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 1 Aug 2024 09:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=AB=99=E7=82=B9=E8=BF=90=E8=90=A5=E5=88=86=E6=9E=90=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessStationInfoController.java | 22 +++++++++- .../test/java/SpringBootTestController.java | 14 ++++++ .../pile/service/OrderBasicInfoService.java | 2 + .../pile/service/PileStationInfoService.java | 8 +++- .../impl/PileStationInfoServiceImpl.java | 43 ++++++++++++++++++- 5 files changed, 86 insertions(+), 3 deletions(-) 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 65dc53c3e..7cbee4356 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 @@ -48,7 +48,7 @@ public class BusinessStationInfoController extends BaseController { /** - * 获取站点运营分析信息 + * 获取站点运营分析信息(7天、30天) * @param dto * @return */ @@ -65,4 +65,24 @@ public class BusinessStationInfoController extends BaseController { logger.info("获取站点运营分析信息 params:{}, result:{}", JSONObject.toJSONString(dto), response); return response; } + + + /** + * 获取站点运营分析信息(12个月) + * @param dto + * @return + */ + @PostMapping("/getStationMonthlyBusinessAnalyzeInfo") + public RestApiResponse getStationMonthlyBusinessAnalyzeInfo(@RequestBody StationBusinessAnalyzeInfoDTO dto){ + RestApiResponse response = null; + try { + StationBusinessAnalyzeInfoVO vo = pileStationInfoService.getStationMonthlyBusinessAnalyzeInfo(dto); + response = new RestApiResponse<>(ImmutableMap.of("stationBusinessAnalyzeInfoVO", vo)); + } catch (Exception e) { + logger.error("获取站点运营分析信息 error", e); + response = new RestApiResponse<>(e); + } + logger.info("获取站点运营分析信息 params:{}, result:{}", JSONObject.toJSONString(dto), response); + return response; + } } diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index 71a3f4076..f2865f3d0 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -34,6 +34,7 @@ import com.jsowell.common.core.domain.ykc.TransactionRecordsData; import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.AcquirerEnum; import com.jsowell.common.enums.DelFlagEnum; +import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.ykc.*; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; @@ -81,6 +82,7 @@ import com.jsowell.thirdparty.lutongyunting.service.LTYTService; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.util.GBSignUtils; +import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import com.jsowell.wxpay.common.WeChatPayParameter; import com.jsowell.wxpay.dto.AppletTemplateMessageSendDTO; import com.jsowell.wxpay.response.WechatPayRefundRequest; @@ -260,6 +262,18 @@ public class SpringBootTestController { @Autowired private PileReservationInfoService pileReservationInfoService; + @Autowired + private ZDLService zdlService; + + @Test + public void thirdPartyTest() { + QueryStationInfoDTO dto = new QueryStationInfoDTO(); + dto.setOperatorId("14405899X"); + dto.setThirdPlatformType(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode()); + zdlService.queryStationsInfo(dto); + } + + @Test public void personPileStopChargingTest() { String memberId = "84085683"; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java index 4b3c75194..b41f3aa4b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java @@ -462,6 +462,8 @@ public interface OrderBasicInfoService{ */ List queryOrderByOccupyTime(QueryOrderDTO dto); + + //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 后管小程序 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ /** * 通过站点idList,创建时间查询订单数据详情 * @param stationIds diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java index 4c01b5851..1e2d1d05b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java @@ -160,8 +160,14 @@ public interface PileStationInfoService { List getStationStatisticsInfos(StationStatisticsInfoDTO dto); /** - * 获取站点运营分析信息 + * 获取站点运营分析信息(7天、30天) * @param dto */ StationBusinessAnalyzeInfoVO getStationBusinessAnalyzeInfo(StationBusinessAnalyzeInfoDTO dto); + + /** + * 获取站点运营分析信息(12个月) + * @param dto + */ + StationBusinessAnalyzeInfoVO getStationMonthlyBusinessAnalyzeInfo(StationBusinessAnalyzeInfoDTO dto); } 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 2d4f2774f..c562be474 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 @@ -744,7 +744,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { } /** - * 获取站点运营分析信息 + * 获取站点运营分析信息(7天、30天) * @param dto */ @Override @@ -926,5 +926,46 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { return vo; } + /** + * 获取站点运营分析信息(12个月) + * @param dto + */ + @Override + public StationBusinessAnalyzeInfoVO getStationMonthlyBusinessAnalyzeInfo(StationBusinessAnalyzeInfoDTO dto) { + String stationId = dto.getStationId(); + Calendar instance = Calendar.getInstance(); + instance.add(Calendar.YEAR, -1); + String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, instance.getTime()); + String endTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD); + // 查询订单日报表过去一年的数据 + List list = settleOrderReportService.queryOrderReport(Lists.newArrayList(stationId), startTime, endTime); + + // 按照日期汇总数据 + Map collect = list.stream() + .sorted(Comparator.comparing(SettleOrderReport::getTradeDate)) + .collect(Collectors.toMap(SettleOrderReport::getTradeDate, Function.identity(), + (a, b) -> { + a.setUseElectricity(a.getUseElectricity().add(b.getUseElectricity())); + a.setTotalAmount(a.getTotalAmount().add(b.getTotalAmount())); + a.setElectricityAmount(a.getElectricityAmount().add(b.getElectricityAmount())); + a.setServiceAmount(a.getServiceAmount().add(b.getServiceAmount())); + return a; + })); + // 通过TreeMap排序 + TreeMap map = new TreeMap<>(collect); + List settleOrderReports = new ArrayList<>(map.values()); + + // StationBusinessAnalyzeInfoVO vo = StationBusinessAnalyzeInfoVO.builder() + // .electricityGrowthRate() + // .orderAmountGrowthRate() + // .serviceAmountGrowthRate() + // + // .businessOrderDetailInfoVOList() + // .build(); + + + + return null; + } }