车辆详情新增车辆运营区
This commit is contained in:
parent
ceff4a5805
commit
a0bec22567
@ -5,6 +5,7 @@ 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;
|
||||||
@ -51,7 +52,7 @@ public class EbikeOrderController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("queryBikeInfo")
|
@GetMapping("queryBikeInfo")
|
||||||
public JsonResult<?> queryBikeInfo(@RequestParam("bikeCode") String bikeCode) {
|
public JsonResult<?> queryBikeInfo(@RequestParam("bikeCode") String bikeCode) {
|
||||||
FeignEbikeUserBikeInfo result = ebikeOrderService.queryBikeInfo(bikeCode);
|
EbikeBikeInfoVo result = ebikeOrderService.queryBikeInfo(bikeCode);
|
||||||
return JsonResult.success(result);
|
return JsonResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,108 @@
|
|||||||
|
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.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆详情 信息
|
||||||
|
*
|
||||||
|
* @author yanglei
|
||||||
|
* @since 2025-12-12 09:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class EbikeBikeInfoVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商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,6 +4,7 @@ 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;
|
||||||
@ -95,7 +96,7 @@ public interface EbikeOrderService extends IService<EbikeOrder> {
|
|||||||
* @param bikeCode 车辆编码
|
* @param bikeCode 车辆编码
|
||||||
* @return 车辆基本信息
|
* @return 车辆基本信息
|
||||||
*/
|
*/
|
||||||
FeignEbikeUserBikeInfo queryBikeInfo(String bikeCode);
|
EbikeBikeInfoVo queryBikeInfo(String bikeCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束骑行
|
* 结束骑行
|
||||||
|
|||||||
@ -12,6 +12,7 @@ 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;
|
||||||
@ -82,7 +83,7 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
|||||||
throw new EbikeException("请完成未支付订单后再试");
|
throw new EbikeException("请完成未支付订单后再试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FeignEbikeUserBikeInfo bikeInfo = queryBikeInfo(orderDto.getBikeCode());
|
EbikeBikeInfoVo bikeInfo = queryBikeInfo(orderDto.getBikeCode());
|
||||||
// 创建订单
|
// 创建订单
|
||||||
EbikeOrder order = EbikeOrder.builder()
|
EbikeOrder order = EbikeOrder.builder()
|
||||||
.userId(userId)
|
.userId(userId)
|
||||||
@ -193,12 +194,29 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FeignEbikeUserBikeInfo queryBikeInfo(String bikeCode) {
|
public EbikeBikeInfoVo 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("获取车辆详情");
|
||||||
}
|
}
|
||||||
return jsonResult.getData();
|
FeignEbikeUserBikeInfo source = 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
|
||||||
@ -207,7 +225,7 @@ public class EbikeOrderImpl extends ServiceImpl<EbikeOrderMapper, EbikeOrder> im
|
|||||||
// 先校验是否有当前订单
|
// 先校验是否有当前订单
|
||||||
EbikeOrder order = getOrder(endDto);
|
EbikeOrder order = getOrder(endDto);
|
||||||
// 获取车辆信息,计算费用
|
// 获取车辆信息,计算费用
|
||||||
FeignEbikeUserBikeInfo bikeInfo = queryBikeInfo(endDto.getBikeCode());
|
EbikeBikeInfoVo 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());
|
||||||
@ -391,7 +409,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,
|
||||||
FeignEbikeUserBikeInfo bikeInfo, FeignEbikeUserLockDto data) {
|
EbikeBikeInfoVo 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