Commit 78a18488 by 吕明尚

修改订单金额计算

parent 7d0976b0
......@@ -44,7 +44,6 @@ public class CreateOrderRequest {
private String preOrderNo;
@ApiModelProperty(value = "购买方式(1:小时,2:套餐)", required = true)
@NotNull(message = "购买方式不能为空")
private Integer buyType;
@ApiModelProperty(value = "支付类型(1:微信,2:支付宝)", required = true)
......
......@@ -220,7 +220,12 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
if (ObjectUtils.isEmpty(roomLabel.getPackId())) {
couponRequest.setOrderMode(BuyTypeEnum.TIME.getCode());
} else {
couponRequest.setOrderMode(BuyTypeEnum.PACK.getCode());
SPack byId = packService.getById(roomLabel.getPackId());
if (!ObjectUtils.isEmpty(byId) && byId.getIsOpen().equals(YesNoEnum.yes.getIndex())) {
couponRequest.setOrderMode(BuyTypeEnum.PACK.getCode());
} else {
couponRequest.setOrderMode(BuyTypeEnum.TIME.getCode());
}
}
} else if (!ObjectUtils.isEmpty(couponRequest.getPackageId())) {
couponRequest.setOrderMode(BuyTypeEnum.PACK.getCode());
......
......@@ -1133,9 +1133,28 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sOrder.setRefundStatus(RefundStatusEnum.UNREFUND.getCode());
//计算订单时长
sOrder.setTimeLong(DateUtils.differentHour(sOrder.getPreStartDate(), sOrder.getPreEndDate()).toString());
if (!ObjectUtils.isEmpty(request.getRoomLabelId())) {
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(request.getRoomLabelId());
if (ObjectUtils.isEmpty(roomLabel.getPackId())) {
request.setBuyType(BuyTypeEnum.TIME.getCode());
} else {
SPack pack = packService.getById(roomLabel.getPackId());
if (pack.getIsOpen().equals(YesNoEnum.yes.getIndex())) {
sOrder.setPackId(roomLabel.getPackId());
request.setBuyType(BuyTypeEnum.PACK.getCode());
} else {
request.setBuyType(BuyTypeEnum.TIME.getCode());
}
}
} else if (!ObjectUtils.isEmpty(request.getPackId())) {
sOrder.setPackId(request.getPackId());
request.setBuyType(BuyTypeEnum.PACK.getCode());
} else {
throw new RuntimeException("参数异常");
}
if (Objects.nonNull(sOrder.getPackId()) && sOrder.getPackId() != 0) {
// 套餐订单,设置套餐金额
SPack pack = packService.getById(request.getPackId());
SPack pack = packService.getById(sOrder.getPackId());
sOrder.setPackPrice(pack.getPrice());
}
sOrder.setCreateTime(DateUtils.getNowDate());
......@@ -1753,7 +1772,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtils.isEmpty(roomLabel.getPackId())) {
payPrice = totalPrice;
} else {
payPrice = computeTotalPrice(roomLabel.getPackId(), totalPrice);
SPack byId = packService.getById(roomLabel.getPackId());
if (!ObjectUtils.isEmpty(byId) && byId.getIsOpen().equals(YesNoEnum.yes.getIndex())) {
payPrice = computeTotalPrice(roomLabel.getPackId(), totalPrice);
} else {
payPrice = totalPrice;
}
}
} else if (!ObjectUtils.isEmpty(request.getPackId())) {
payPrice = computeTotalPrice(request.getPackId(), totalPrice);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment