bugfix 修复小程序首页电单车计费模板为0

This commit is contained in:
Lemon
2025-12-15 11:02:10 +08:00
parent 8d1011df28
commit 68f7e75538
2 changed files with 17 additions and 26 deletions

View File

@@ -433,34 +433,12 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
*/
@Override
public CurrentTimePriceDetails getCurrentTimePriceDetailsForEBike(String stationId) {
CurrentTimePriceDetails result = null;
// 查询当前时段电费
LocalTime localTime = LocalTime.now();
String now = LocalTime.of(localTime.getHour(), localTime.getMinute(), localTime.getSecond()).toString();
CurrentTimePriceDetails result = new CurrentTimePriceDetails();
// 通过站点id查询计费模板
BillingTemplateVO billingTemplateVO = queryUsedBillingTemplateForEBike(stationId);
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<BillingDetailVO> billingDetailList = billingTemplateVO.getBillingDetailList();
for (BillingDetailVO detailVO : billingDetailList) {
List<String> 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());
}
}
}
// 电单车直接取平时段费用
result.setTotalPrice(billingTemplateVO.getFlatElectricityPrice().toString());
}
return result;
}

View File

@@ -36,6 +36,7 @@ import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
import com.jsowell.pile.vo.web.BillingTemplateVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.pile.vo.web.StationSelectVO;
import com.jsowell.system.service.SysDeptService;
@@ -611,6 +612,12 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
stationVO.setVipElectricityPrice(currentTimePriceDetails.getVipElectricityPrice());
stationVO.setVipServicePrice(currentTimePriceDetails.getVipServicePrice());
stationVO.setVipTotalPrice(currentTimePriceDetails.getVipTotalPrice());
}else {
// 如果为空,查询一下电动车计费
currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetailsForEBike(stationVO.getStationId());
if (currentTimePriceDetails != null) {
stationVO.setTotalPrice(currentTimePriceDetails.getTotalPrice());
}
}
//根据站点id查询订单最后一次交易时间
@@ -737,7 +744,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
stationVO.setSlowFree(map.get("slowFree"));
stationVO.setTotalFree(stationVO.getFastFree() + stationVO.getSlowFree());
// 查询当前时段电费
// 查询当前时段电动汽车电
CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(stationVO.getStationId());
if (currentTimePriceDetails != null) {
stationVO.setElectricityPrice(currentTimePriceDetails.getElectricityPrice());
@@ -749,6 +756,12 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
stationVO.setVipElectricityPrice(currentTimePriceDetails.getVipElectricityPrice());
stationVO.setVipServicePrice(currentTimePriceDetails.getVipServicePrice());
stationVO.setVipTotalPrice(currentTimePriceDetails.getVipTotalPrice());
}else {
// 如果为空,查询一下电动车计费
currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetailsForEBike(stationVO.getStationId());
if (currentTimePriceDetails != null) {
stationVO.setTotalPrice(currentTimePriceDetails.getTotalPrice());
}
}
// 站点基础设施
stationVO.setParkFree(pileStationVO.getParkFree());