diff --git a/jsowell-pile/src/main/java/com/jsowell/mq/OrderRabbitListener.java b/jsowell-pile/src/main/java/com/jsowell/mq/OrderRabbitListener.java index f5866871e..334d02cd8 100644 --- a/jsowell-pile/src/main/java/com/jsowell/mq/OrderRabbitListener.java +++ b/jsowell-pile/src/main/java/com/jsowell/mq/OrderRabbitListener.java @@ -3,7 +3,6 @@ package com.jsowell.mq; import com.alibaba.fastjson2.JSON; import com.huifu.adapay.core.exception.BaseAdaPayException; import com.jsowell.common.constant.RabbitConstants; -import com.jsowell.common.util.YKCUtils; import com.jsowell.pile.dto.AfterSettleOrderDTO; import com.jsowell.pile.service.OrderBasicInfoService; import com.rabbitmq.client.Channel; @@ -14,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.IOException; -import java.util.List; /** * 监听RabbitMQ消息 订单 @@ -33,10 +31,11 @@ public class OrderRabbitListener { public void receiveChargeOrderData(AfterSettleOrderDTO afterSettleOrderDTO, Channel channel, Message message) throws IOException { log.info("接收到订单结算数据:{}", JSON.toJSONString(afterSettleOrderDTO)); - List newLogicStationIdList = YKCUtils.getNewLogicStationIdList(); - if (!newLogicStationIdList.contains(afterSettleOrderDTO.getStationId())) { - return; - } + // 2025年2月18日09点18分全部订单改为实时分账 + // List newLogicStationIdList = YKCUtils.getNewLogicStationIdList(); + // if (!newLogicStationIdList.contains(afterSettleOrderDTO.getStationId())) { + // return; + // } log.info("realTimeOrderSplit-订单{}开始执行新分账方法", afterSettleOrderDTO.getOrderCode()); try { diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java index c653bdb88..7123e5bd3 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java @@ -17,6 +17,13 @@ public interface StationSplitConfigService { // 根据站点id查询站点分账配置信息 List queryByStationId(String stationId); + /** + * 根据站点id查询站点分账配置信息, 如果没有配置分账用户, 则执行初始化操作 + * @param stationId + * @return + */ + List queryByStationIdWithInit(String stationId); + List querySplitConfigByStationId(String stationId); /** diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ChargeParkingDiscountServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ChargeParkingDiscountServiceImpl.java index cd62a0719..55abe886f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ChargeParkingDiscountServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ChargeParkingDiscountServiceImpl.java @@ -47,10 +47,12 @@ public class ChargeParkingDiscountServiceImpl implements ChargeParkingDiscountSe } // 查询该站点的停车优惠信息 ChargeParkingDiscountVO discountVO = new ChargeParkingDiscountVO(); + discountVO.setId(chargeParkingDiscount.getId() + ""); discountVO.setStationId(chargeParkingDiscount.getStationId()); - discountVO.setConditionType(chargeParkingDiscount.getConditionType()); + discountVO.setParkingPlatformId(chargeParkingDiscount.getParkingPlatformId()); + discountVO.setConditionType(Integer.valueOf(chargeParkingDiscount.getConditionType())); discountVO.setConditionValue(chargeParkingDiscount.getConditionValue()); - discountVO.setDiscountType(chargeParkingDiscount.getDiscountType()); + discountVO.setDiscountType(Integer.valueOf(chargeParkingDiscount.getDiscountType())); discountVO.setDiscountValue(chargeParkingDiscount.getDiscountValue()); discountVO.setStartTime(chargeParkingDiscount.getStartTime()); discountVO.setEndTime(chargeParkingDiscount.getEndTime()); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index 6e9242837..d8f56b0ae 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -1839,8 +1839,8 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { } // 校验分账 verifyOrderAllAmount(afterSettleOrderDTO); - // 根据站点id查询分账配置 - List stationSplitConfigList = stationSplitConfigService.queryByStationId(afterSettleOrderDTO.getStationId()); + // 根据站点id查询分账配置(如果未配置则初始化) + List stationSplitConfigList = stationSplitConfigService.queryStationSplitConfigByStationId(afterSettleOrderDTO.getStationId()); // 计算每个参与分账的用户, 应分多少钱 List splitDataList = calculationSplitDataList(stationSplitConfigList, afterSettleOrderDTO); List divMemberList = transformDivMemberList(splitDataList); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java index 069f353d6..7f4ba35c1 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java @@ -59,6 +59,19 @@ public class StationSplitConfigServiceImpl implements StationSplitConfigService{ return stationSplitConfigs; } + @Override + public List queryByStationIdWithInit(String stationId) { + // 查询站点分账配置 + List stationSplitConfigs = this.queryByStationId(stationId); + if (CollectionUtils.isEmpty(stationSplitConfigs)) { + // 初始化 + this.initSplitConfig(stationId); + // 再次查询 + stationSplitConfigs = this.queryByStationId(stationId); + } + return stationSplitConfigs; + } + /** * 初始化站点分账配置 * @param stationId 站点id @@ -92,15 +105,7 @@ public class StationSplitConfigServiceImpl implements StationSplitConfigService{ @Override public List querySplitConfigByStationId(String stationId) { - List stationSplitConfigs = this.queryByStationId(stationId); - - if (CollectionUtils.isEmpty(stationSplitConfigs)) { - // 如果查询为空初始化数据 - initSplitConfig(stationId); - // 再次查询 - stationSplitConfigs = this.queryByStationId(stationId); - } - + List stationSplitConfigs = this.queryByStationIdWithInit(stationId); List resultList = Lists.newArrayList(); for (StationSplitConfig stationSplitConfig : stationSplitConfigs) { SplitConfigVO vo = new SplitConfigVO(); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java index cb4b7e487..ecb6f4760 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java @@ -27,7 +27,6 @@ import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.AdapayUtil; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.StringUtils; -import com.jsowell.common.util.YKCUtils; import com.jsowell.common.util.id.SnowflakeIdWorker; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ebike.deviceupload.EBikeMessageCmd03; @@ -480,10 +479,11 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic { transactionService.doUpdateOrder(dto); // 不在新分账逻辑站点列表中的, 可以走退款逻辑 - if (!YKCUtils.getNewLogicStationIdList().contains(orderBasicInfo.getStationId())) { - // 订单退款 - refundOrder(orderBasicInfo); - } + // 2025年2月18日09点17分 全部订单改为实时分账 + // if (!YKCUtils.getNewLogicStationIdList().contains(orderBasicInfo.getStationId())) { + // // 订单退款 + // refundOrder(orderBasicInfo); + // } // 订单退款 // refundOrder(orderBasicInfo); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/ChargeParkingDiscountVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/ChargeParkingDiscountVO.java index 2d4f09f54..9464785b1 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/ChargeParkingDiscountVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/ChargeParkingDiscountVO.java @@ -9,15 +9,25 @@ import java.time.LocalTime; */ @Data public class ChargeParkingDiscountVO { + /** + * 主键 + */ + private String id; + /** * 站点id */ private String stationId; + /** + * 停车平台id + */ + private Integer parkingPlatformId; + /** * 门槛类型 1-固定电量;2-固定时长 */ - private String conditionType; + private Integer conditionType; /** * 门槛值 @@ -29,7 +39,7 @@ public class ChargeParkingDiscountVO { * 1-减时间单位分钟 * 2-减金额单位元 */ - private String discountType; + private Integer discountType; /** * 优惠值 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index 41953f54a..f52d74aa2 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -697,7 +697,7 @@ public class CommonService { // 是否满足发券条件 String sumChargingTime = realTimeMonitorData.getSumChargingTime(); // 充电时长 String chargingDegree = realTimeMonitorData.getChargingDegree(); // 充电度数 - String conditionType = chargeParkingDiscount.getConditionType(); + String conditionType = String.valueOf(chargeParkingDiscount.getConditionType()); // 如果conditionType为1判断充电度数, 如果为2判断充电时长 boolean flag = false; if (StringUtils.equals(conditionType, Constants.ONE)) { diff --git a/jsowell-ui/src/views/pile/station/detail.vue b/jsowell-ui/src/views/pile/station/detail.vue index b4b5c42b6..525f768d4 100644 --- a/jsowell-ui/src/views/pile/station/detail.vue +++ b/jsowell-ui/src/views/pile/station/detail.vue @@ -205,8 +205,8 @@ - 固定电量 - 固定时长 + 固定电量 + 固定时长 @@ -215,7 +215,7 @@ @@ -227,8 +227,8 @@ - 减时间(分钟) - 减金额(元) + 减时间(分钟) + 减金额(元) @@ -237,7 +237,7 @@ @@ -246,7 +246,7 @@ - + + + + + + + @@ -394,10 +405,12 @@ export default { }, parkingInfo: {}, chargeParkingDiscount:{ + id: "", stationId: "", - conditionType: "", + parkingPlatformId: 0, + conditionType: 0, conditionValue: "", - discountType: "", + discountType: 0, discountValue: "", startTime: "", endTime: "" @@ -624,7 +637,13 @@ export default { getChargeParkingDiscount() { getChargeParkingDiscount(this.stationId).then((response) => { console.log("getChargeParkingDiscount.response", response); - this.chargeParkingDiscount = response.data; + // 如果存在数据,则赋值给chargeParkingDiscount + if (response.data !== undefined) { + // 将response.data中的时间转换为分钟数 + this.chargeParkingDiscount = response.data; + // response.data.startTime = this.timeToMinutes(response.data.startTime); + // response.data.endTime = this.timeToMinutes(response.data.endTime); + } }) },