Compare commits
No commits in common. "6ebde6d14a8fb1a8fb15a9bf49e637e80f8e64055c4ccbcab123befa0896fdcf" and "ceff4a5805ac933442edbc528d04236840108591cfccbcf62e4e160216f1adc1" have entirely different histories.
6ebde6d14a
...
ceff4a5805
@ -5,7 +5,6 @@ import com.cdzy.common.model.response.JsonResult;
|
|||||||
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
|
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
|
||||||
import com.cdzy.user.model.dto.EbikeUserCyclingEndDto;
|
import com.cdzy.user.model.dto.EbikeUserCyclingEndDto;
|
||||||
import com.cdzy.user.model.entity.EbikeOrder;
|
import com.cdzy.user.model.entity.EbikeOrder;
|
||||||
import com.cdzy.user.model.vo.EbikeBikeInfoVo;
|
|
||||||
import com.cdzy.user.model.vo.EbikeRevenueStatisticsVo;
|
import com.cdzy.user.model.vo.EbikeRevenueStatisticsVo;
|
||||||
import com.cdzy.user.model.vo.EbikeUserAllOrdersVo;
|
import com.cdzy.user.model.vo.EbikeUserAllOrdersVo;
|
||||||
import com.cdzy.user.service.EbikeOrderService;
|
import com.cdzy.user.service.EbikeOrderService;
|
||||||
@ -52,7 +51,7 @@ public class EbikeOrderController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("queryBikeInfo")
|
@GetMapping("queryBikeInfo")
|
||||||
public JsonResult<?> queryBikeInfo(@RequestParam("bikeCode") String bikeCode) {
|
public JsonResult<?> queryBikeInfo(@RequestParam("bikeCode") String bikeCode) {
|
||||||
EbikeBikeInfoVo result = ebikeOrderService.queryBikeInfo(bikeCode);
|
FeignEbikeUserBikeInfo result = ebikeOrderService.queryBikeInfo(bikeCode);
|
||||||
return JsonResult.success(result);
|
return JsonResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,109 +0,0 @@
|
|||||||
package com.cdzy.user.model.vo;
|
|
||||||
|
|
||||||
import com.cdzy.user.handler.PGpolygonDeserializer;
|
|
||||||
import com.cdzy.user.handler.PGpolygonSerializer;
|
|
||||||
import com.cdzy.user.handler.PGpolygonTypeHandler;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.mybatisflex.annotation.Column;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.postgresql.geometric.PGpolygon;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆详情 信息
|
|
||||||
*
|
|
||||||
* @author yanglei
|
|
||||||
* @since 2025-12-12 09:58
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class EbikeBikeInfoVo implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运营商ID
|
|
||||||
*/
|
|
||||||
private Long operatorId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运营区ID
|
|
||||||
*/
|
|
||||||
private Long regionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆电量
|
|
||||||
*/
|
|
||||||
private Float soc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆编号(与车辆二维码编号相同
|
|
||||||
*/
|
|
||||||
private String bikeCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 免费时长(分钟):使用服务前的免费时间
|
|
||||||
*/
|
|
||||||
private Integer freeDurationMinutes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 起步时长(分钟
|
|
||||||
*/
|
|
||||||
private Integer baseDurationMinutes;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 起步费用(元)
|
|
||||||
*/
|
|
||||||
private BigDecimal baseFee;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时长(分钟)
|
|
||||||
*/
|
|
||||||
private Integer chargeDurationMinutes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时长费用(元)
|
|
||||||
*/
|
|
||||||
private BigDecimal durationFee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运营区域外调度费(元)
|
|
||||||
*/
|
|
||||||
private BigDecimal outOfServiceAreaFee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 停车区外调度费(元)
|
|
||||||
*/
|
|
||||||
private BigDecimal outOfParkingAreaFee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 封顶金额(元)
|
|
||||||
*/
|
|
||||||
private BigDecimal maxFeeAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 禁停区调度费(元)
|
|
||||||
*/
|
|
||||||
private BigDecimal noParkingZoneFee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 头盔管理费(元)
|
|
||||||
*/
|
|
||||||
private BigDecimal helmetManagementFee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆运营区
|
|
||||||
*/
|
|
||||||
@Column(typeHandler = PGpolygonTypeHandler.class)
|
|
||||||
@JsonSerialize(using = PGpolygonSerializer.class)
|
|
||||||
@JsonDeserialize(using = PGpolygonDeserializer.class)
|
|
||||||
private PGpolygon regionPolygon;
|
|
||||||
}
|
|
||||||
@ -4,7 +4,6 @@ import com.cdzy.common.model.request.PageParam;
|
|||||||
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
|
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
|
||||||
import com.cdzy.user.model.dto.EbikeUserCyclingEndDto;
|
import com.cdzy.user.model.dto.EbikeUserCyclingEndDto;
|
||||||
import com.cdzy.user.model.entity.EbikeOrder;
|
import com.cdzy.user.model.entity.EbikeOrder;
|
||||||
import com.cdzy.user.model.vo.EbikeBikeInfoVo;
|
|
||||||
import com.cdzy.user.model.vo.EbikeRevenueStatisticsVo;
|
import com.cdzy.user.model.vo.EbikeRevenueStatisticsVo;
|
||||||
import com.cdzy.user.model.vo.EbikeUserAllOrdersVo;
|
import com.cdzy.user.model.vo.EbikeUserAllOrdersVo;
|
||||||
import com.ebike.feign.model.dto.FeignEbikeDto;
|
import com.ebike.feign.model.dto.FeignEbikeDto;
|
||||||
@ -96,7 +95,7 @@ public interface EbikeOrderService extends IService<EbikeOrder> {
|
|||||||
* @param bikeCode 车辆编码
|
* @param bikeCode 车辆编码
|
||||||
* @return 车辆基本信息
|
* @return 车辆基本信息
|
||||||
*/
|
*/
|
||||||
EbikeBikeInfoVo queryBikeInfo(String bikeCode);
|
FeignEbikeUserBikeInfo queryBikeInfo(String bikeCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束骑行
|
* 结束骑行
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import com.cdzy.user.model.dto.EbikeUserCyclingEndDto;
|
|||||||
import com.cdzy.user.model.entity.EbikeOrder;
|
import com.cdzy.user.model.entity.EbikeOrder;
|
||||||
import com.cdzy.user.model.entity.EbikeOrderDetail;
|
import com.cdzy.user.model.entity.EbikeOrderDetail;
|
||||||
import com.cdzy.user.model.entity.EbikePayment;
|
import com.cdzy.user.model.entity.EbikePayment;
|
||||||
import com.cdzy.user.model.vo.EbikeBikeInfoVo;
|
|
||||||
import com.cdzy.user.model.vo.EbikeRevenueStatisticsVo;
|
import com.cdzy.user.model.vo.EbikeRevenueStatisticsVo;
|
||||||
import com.cdzy.user.model.vo.EbikeUserAllOrdersVo;
|
import com.cdzy.user.model.vo.EbikeUserAllOrdersVo;
|
||||||
import com.cdzy.user.service.EbikeOrderDetailService;
|
import com.cdzy.user.service.EbikeOrderDetailService;
|
||||||
@ -83,7 +82,7 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
|||||||
throw new EbikeException("请完成未支付订单后再试");
|
throw new EbikeException("请完成未支付订单后再试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EbikeBikeInfoVo bikeInfo = queryBikeInfo(orderDto.getBikeCode());
|
FeignEbikeUserBikeInfo bikeInfo = queryBikeInfo(orderDto.getBikeCode());
|
||||||
// 创建订单
|
// 创建订单
|
||||||
EbikeOrder order = EbikeOrder.builder()
|
EbikeOrder order = EbikeOrder.builder()
|
||||||
.userId(userId)
|
.userId(userId)
|
||||||
@ -194,29 +193,12 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EbikeBikeInfoVo queryBikeInfo(String bikeCode) {
|
public FeignEbikeUserBikeInfo queryBikeInfo(String bikeCode) {
|
||||||
JsonResult<FeignEbikeUserBikeInfo> jsonResult = operationsFeignClient.bikeInfo(bikeCode);
|
JsonResult<FeignEbikeUserBikeInfo> jsonResult = operationsFeignClient.bikeInfo(bikeCode);
|
||||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||||
throw new EbikeException("获取车辆详情");
|
throw new EbikeException("获取车辆详情");
|
||||||
}
|
}
|
||||||
FeignEbikeUserBikeInfo source = jsonResult.getData();
|
return jsonResult.getData();
|
||||||
return EbikeBikeInfoVo.builder()
|
|
||||||
.operatorId(source.getOperatorId())
|
|
||||||
.regionId(source.getRegionId())
|
|
||||||
.soc(source.getSoc())
|
|
||||||
.bikeCode(source.getBikeCode())
|
|
||||||
.freeDurationMinutes(source.getFreeDurationMinutes())
|
|
||||||
.baseDurationMinutes(source.getBaseDurationMinutes())
|
|
||||||
.baseFee(source.getBaseFee())
|
|
||||||
.chargeDurationMinutes(source.getChargeDurationMinutes())
|
|
||||||
.durationFee(source.getDurationFee())
|
|
||||||
.outOfServiceAreaFee(source.getOutOfServiceAreaFee())
|
|
||||||
.outOfParkingAreaFee(source.getOutOfParkingAreaFee())
|
|
||||||
.maxFeeAmount(source.getMaxFeeAmount())
|
|
||||||
.noParkingZoneFee(source.getNoParkingZoneFee())
|
|
||||||
.helmetManagementFee(source.getHelmetManagementFee())
|
|
||||||
.regionPolygon(source.getRegionPolygon())
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -225,7 +207,7 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
|||||||
// 先校验是否有当前订单
|
// 先校验是否有当前订单
|
||||||
EbikeOrder order = getOrder(endDto);
|
EbikeOrder order = getOrder(endDto);
|
||||||
// 获取车辆信息,计算费用
|
// 获取车辆信息,计算费用
|
||||||
EbikeBikeInfoVo bikeInfo = queryBikeInfo(endDto.getBikeCode());
|
FeignEbikeUserBikeInfo bikeInfo = queryBikeInfo(endDto.getBikeCode());
|
||||||
order.setEndTime(LocalDateTime.now());
|
order.setEndTime(LocalDateTime.now());
|
||||||
order.setEndLocation(endDto.getEndPoint());
|
order.setEndLocation(endDto.getEndPoint());
|
||||||
order.setOperatorId(bikeInfo.getOperatorId());
|
order.setOperatorId(bikeInfo.getOperatorId());
|
||||||
@ -409,7 +391,7 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
|||||||
* @return 订单费用
|
* @return 订单费用
|
||||||
*/
|
*/
|
||||||
private BigDecimal costCalculation(LocalDateTime startTime, LocalDateTime endTime,
|
private BigDecimal costCalculation(LocalDateTime startTime, LocalDateTime endTime,
|
||||||
EbikeBikeInfoVo bikeInfo, FeignEbikeUserLockDto data) {
|
FeignEbikeUserBikeInfo bikeInfo, FeignEbikeUserLockDto data) {
|
||||||
// 基础费用计算
|
// 基础费用计算
|
||||||
BigDecimal baseFee = bikeInfo.getBaseFee();
|
BigDecimal baseFee = bikeInfo.getBaseFee();
|
||||||
BigDecimal durationFee = bikeInfo.getDurationFee();
|
BigDecimal durationFee = bikeInfo.getDurationFee();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user