From 819785667eae4364d25f39863b0c7a6ff30ac05b Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 15 Dec 2025 10:06:15 +0800 Subject: [PATCH] =?UTF-8?q?update=20=20=E7=94=B5=E5=8D=95=E8=BD=A6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=94=B6=E8=B4=B9=E6=A0=87=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/PileBillingTemplateService.java | 2 + .../impl/PileBillingTemplateServiceImpl.java | 67 ++++++++++++------- .../wxpay/service/WxAppletRemoteService.java | 25 ++++++- 3 files changed, 68 insertions(+), 26 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBillingTemplateService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBillingTemplateService.java index 284aca751..96f71ef30 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBillingTemplateService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBillingTemplateService.java @@ -211,4 +211,6 @@ public interface PileBillingTemplateService { * 查询优惠计费模板 */ BillingTemplateVO queryPreferentialBillingTemplate(String stationId); + + CurrentTimePriceDetails getCurrentTimePriceDetailsForEBike(String stationId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java index bdd2ac005..cc16a3b98 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSON; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.primitives.Bytes; -import com.jsowell.common.YouDianUtils; import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; @@ -17,7 +16,6 @@ import com.jsowell.common.util.id.Seq; import com.jsowell.pile.domain.*; import com.jsowell.pile.dto.BillingTimeDTO; import com.jsowell.pile.dto.CreateOrUpdateBillingTemplateDTO; -import com.jsowell.pile.dto.ImportBillingTemplateDTO; import com.jsowell.pile.mapper.PileBillingTemplateMapper; import com.jsowell.pile.service.MemberGroupService; import com.jsowell.pile.service.PileBillingTemplateService; @@ -433,15 +431,36 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic * * @param stationId 站点id */ -// @Override + @Override public CurrentTimePriceDetails getCurrentTimePriceDetailsForEBike(String stationId) { - CurrentTimePriceDetails result = new CurrentTimePriceDetails(); + CurrentTimePriceDetails result = null; + // 查询当前时段电费 + LocalTime localTime = LocalTime.now(); + String now = LocalTime.of(localTime.getHour(), localTime.getMinute(), localTime.getSecond()).toString(); // 通过站点id查询计费模板 BillingTemplateVO billingTemplateVO = queryUsedBillingTemplateForEBike(stationId); - if (billingTemplateVO !=null){ - result.setTotalPrice(String.valueOf(billingTemplateVO.getFlatElectricityPrice())); - } - return result; + if (Objects.nonNull(billingTemplateVO)) { + result = new CurrentTimePriceDetails(); + result.setTemplateCode(billingTemplateVO.getTemplateCode()); + result.setStationId(stationId); + result.setDateTime(localTime.toString()); + result.setFreeTime(billingTemplateVO.getFreeTime()); + result.setOccupyFee(billingTemplateVO.getOccupyFee()); + List billingDetailList = billingTemplateVO.getBillingDetailList(); + for (BillingDetailVO detailVO : billingDetailList) { + List applyTimeList = detailVO.getApplyTime(); + for (String applyTime : applyTimeList) { + boolean b = DateUtils.checkTime(now + "-" + now, applyTime); + if (b) { + // 将桩的费率存入stationVO + BigDecimal electricityPrice = detailVO.getElectricityPrice(); + BigDecimal servicePrice = detailVO.getServicePrice(); + result.setElectricityPrice(electricityPrice.toString()); + result.setServicePrice(servicePrice.toString()); + result.setTotalPrice(electricityPrice.add(servicePrice).toString()); + } + } + } } @@ -451,22 +470,22 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic * @param pileSn * @return */ - @Override - public CurrentTimePriceDetails getCurrentTimePriceDetailsByPileType(String stationId , String pileSn) { - // 使用工具类判断是否为电单车桩 - // boolean isEBike = YouDianUtils.isEBikePileSn(pileSn); - // 判断桩号是否为汽车桩号 - Boolean result = YKCUtils.checkEVPileSn(pileSn); - - if (result) { - log.info("走电动汽车逻辑"); - // 电动汽车:调用电动汽车计费模板查询方法 - return getCurrentTimePriceDetails(stationId); - } else { - log.info("走电单车方法"); - // 电单车:调用电单车计费模板查询方法 - return getCurrentTimePriceDetailsForEBike(stationId); - } + // @Override + // public CurrentTimePriceDetails getCurrentTimePriceDetailsByPileType(String stationId , String pileSn) { + // // 使用工具类判断是否为电单车桩 + // // boolean isEBike = YouDianUtils.isEBikePileSn(pileSn); + // // 判断桩号是否为汽车桩号 + // Boolean result = YKCUtils.checkEVPileSn(pileSn); + // + // if (result) { + // log.info("走电动汽车逻辑"); + // // 电动汽车:调用电动汽车计费模板查询方法 + // return getCurrentTimePriceDetails(stationId); + // } else { + // log.info("走电单车方法"); + // // 电单车:调用电单车计费模板查询方法 + // return getCurrentTimePriceDetailsForEBike(stationId); + // } } diff --git a/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java b/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java index c6fd752bc..3a0fd7dfb 100644 --- a/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java +++ b/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java @@ -13,6 +13,7 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.StringUtils; +import com.jsowell.common.util.YKCUtils; import com.jsowell.common.util.http.HttpUtils; import com.jsowell.pile.domain.MemberBasicInfo; import com.jsowell.pile.domain.OrderBasicInfo; @@ -21,6 +22,7 @@ import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.service.PileBillingTemplateService; import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails; import com.jsowell.pile.vo.uniapp.customer.SendMessageVO; +import com.jsowell.pile.vo.web.BillingTemplateVO; import com.jsowell.wxpay.config.WeixinLoginProperties; import com.jsowell.wxpay.dto.AppletTemplateMessageSendDTO; import com.jsowell.wxpay.dto.WechatSendMsgDTO; @@ -239,9 +241,28 @@ public class WxAppletRemoteService { startChargingMessage.setStationName(sendMessageVO.getStationName()); // 站点名称 // 订单编号 - startChargingMessage.setOrderCode(sendMessageVO.getOrderCode()); + String orderCode = sendMessageVO.getOrderCode(); + startChargingMessage.setOrderCode(orderCode); + + // 查询订单信息 + OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); + if (orderBasicInfo == null) { + return null; + } + String pileSn = orderBasicInfo.getPileSn(); + Boolean result = YKCUtils.checkEVPileSn(pileSn); + // 收费标准 - CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetailsByPileType(sendMessageVO.getStationId(),sendMessageVO.getPileSn()); + CurrentTimePriceDetails currentTimePriceDetails = new CurrentTimePriceDetails(); + if (result) { + // 查询电动汽车收费标准 + currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(sendMessageVO.getStationId()); + }else { + // 查询电单车收费标准 + currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetailsForEBike(sendMessageVO.getStationId()); + } + // 收费标准 + // CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetailsByPileType(sendMessageVO.getStationId(),sendMessageVO.getPileSn()); startChargingMessage.setTotalPrice(currentTimePriceDetails.getTotalPrice() + " 元/度"); // 枪口编号