记得上下班打卡 | git大法好,push需谨慎

Commit 155d757c authored by jiangxiulong's avatar jiangxiulong

isRefundVoucher chargesRatio chargesPrice

parent 827eaf50
......@@ -49,6 +49,8 @@ public class KylinOrderTicketEntitiesVo implements Serializable, Cloneable {
private LocalDateTime changeDate;
private BigDecimal canRefundedPrice;
private BigDecimal chargesRatio;
private BigDecimal chargesPrice;
public BigDecimal getRefundPrice() {
return refundPrice==null?BigDecimal.valueOf(0.00):refundPrice;
......
package com.liquidnet.service.kylin.dto.vo.returns;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
......@@ -22,6 +23,10 @@ public class KylinOrderTicketEntitiesPreRefundVo implements Serializable, Clonea
private BigDecimal priceCanRefund;
private String ticketTitle;
private Integer isPayment;
@ApiModelProperty(value = "退款手续费比例 *100%")
private BigDecimal chargesRatio;
@ApiModelProperty(value = "退款手续费金额")
private BigDecimal chargesPrice;
private static final KylinOrderTicketEntitiesPreRefundVo obj = new KylinOrderTicketEntitiesPreRefundVo();
public static KylinOrderTicketEntitiesPreRefundVo getNew() {
......
......@@ -83,6 +83,8 @@ public class KylinOrderTicketPreVo implements Serializable, Cloneable {
private String performanceImg;
@ApiModelProperty(value = "是否开启退款手续费 0关闭 1开启")
private Integer isRefundPoundage;
@ApiModelProperty(value = "是否开启是否退优惠券 0关闭 1开启")
private Integer isRefundVoucher;
@ApiModelProperty(value = "手续费规则列表")
private ArrayList<OrderRefundPoundage> refundPoundageList;
......
......@@ -97,9 +97,14 @@ public class KylinOrderTicketsRefundServiceImpl {
if (item.getEnterMobile().length() == 11) {
item.setEnterMobile(item.getEnterMobile().substring(0, 3) + "****" + item.getEnterMobile().substring(7));
}
// setScale(2, BigDecimal.ROUND_HALF_UP)
item.setPriceActual(orderTicketVo.getPriceActual().subtract(orderTicketVo.getPriceExpress()).divide(BigDecimal.valueOf(orderTicketVo.getNumber()), 2, BigDecimal.ROUND_HALF_UP));
item.setPriceCanRefund(dataUtils.getCanRefundOrderEntitiesPrice(orderTicketVo, kylinOrderRefundsVoBaseList, item.getOrderTicketEntitiesId()));
// 手续费处理
BigDecimal chargesRatio = getChargesRatio(item.getUseStart(), performanceVo.getIsRefundPoundage());
BigDecimal chargesPrice = item.getPriceCanRefund().multiply(chargesRatio).setScale(2, BigDecimal.ROUND_HALF_UP);
item.setChargesRatio(chargesRatio);
item.setChargesPrice(chargesPrice);
// 手续费处理
BeanUtils.copyProperties(item, refundVo);
kylinOrderTicketEntitiesPreRefundVos.add(refundVo);
}
......@@ -118,6 +123,7 @@ public class KylinOrderTicketsRefundServiceImpl {
// 整理返回数据
BeanUtils.copyProperties(orderTicketVo, vo);
vo.setIsRefundPoundage(performanceVo.getIsRefundPoundage());
vo.setIsRefundVoucher(performanceVo.getIsRefundVoucher());
vo.setRefundPoundageList(refundPoundage);
vo.setOrderCouponList(orderCoupon);
vo.setRefundAddress(refundAddress);
......@@ -221,52 +227,11 @@ public class KylinOrderTicketsRefundServiceImpl {
}
// 手续费处理
ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(performanceVo.getIsRefundPoundage());
BigDecimal priceCharges = BigDecimal.valueOf(0);
if (!CollectionUtils.isEmpty(refundPoundage)) {
// 手续费比例
BigDecimal chargesNum = BigDecimal.valueOf(0);
// 票种演出开始时间
String useStart = orderTicketVo.getUseStart();
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime useStartD = LocalDateTime.parse(useStart, df);
// 3、15天之前的时间 时间可变
int oneDay = refundPoundage.get(0).getDay();
int twoDay = refundPoundage.get(1).getDay();
LocalDateTime useStartD15Before = useStartD.minusDays(oneDay);
LocalDateTime useStartD3Before = useStartD.minusDays(twoDay);
// 当前时间
LocalDateTime nowTime = LocalDateTime.now();
if (useStartD15Before.isAfter(nowTime)) { // 15天以前的时间大于当前时间 距离演出开始日期>15天
int isCanRefund = refundPoundage.get(0).getIsCanRefund();
if (isCanRefund > 0) {
chargesNum = refundPoundage.get(0).getPresent();
} else {
return ResponseDto.failure("当前日期不支持退票");
}
} else if (useStartD3Before.isAfter(nowTime)) { // 3天以前的时间大于当前时间 距离演出开始日期>3天-15天 含15天
int isCanRefund = refundPoundage.get(1).getIsCanRefund();
if (isCanRefund > 0) {
chargesNum = refundPoundage.get(1).getPresent();
} else {
return ResponseDto.failure("当前日期不支持退票");
}
} else { // 三天以内 <=3
int isCanRefund = refundPoundage.get(2).getIsCanRefund();
if (isCanRefund > 0) {
chargesNum = refundPoundage.get(2).getPresent();
} else {
return ResponseDto.failure("当前日期不支持退票");
}
}
priceCharges = refundSinglePrice.multiply(chargesNum).setScale(2, BigDecimal.ROUND_HALF_UP);
refundSinglePrice = refundSinglePrice.subtract(priceCharges);
if (refundSinglePrice.compareTo(BigDecimal.ZERO) <= 0) {
return ResponseDto.failure("申请金额不得小于0哦~");
}
} else{
log.info("演出id1111 {}", orderTicketVo.getPerformanceId());
BigDecimal chargesRatio = getChargesRatio(orderTicketVo.getUseStart(), performanceVo.getIsRefundPoundage());
BigDecimal priceCharges = refundSinglePrice.multiply(chargesRatio).setScale(2, BigDecimal.ROUND_HALF_UP);
refundSinglePrice = refundSinglePrice.subtract(priceCharges);
if (refundSinglePrice.compareTo(BigDecimal.ZERO) <= 0) {
return ResponseDto.failure("申请金额不得小于0哦~");
}
// 快递费 现在只有到付 不作处理
......@@ -294,6 +259,52 @@ public class KylinOrderTicketsRefundServiceImpl {
}
}
// 返回手续费比例
private BigDecimal getChargesRatio(String useStart, Integer isRefundPoundage) {
ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(isRefundPoundage);
// 手续费比例
BigDecimal chargesRatio = BigDecimal.valueOf(0);
if (!CollectionUtils.isEmpty(refundPoundage)) {
// 票种演出开始时间
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime useStartD = LocalDateTime.parse(useStart, df);
// 3、15天之前的时间 时间可变
int oneDay = refundPoundage.get(0).getDay();
int twoDay = refundPoundage.get(1).getDay();
LocalDateTime useStartD15Before = useStartD.minusDays(oneDay);
LocalDateTime useStartD3Before = useStartD.minusDays(twoDay);
// 当前时间
LocalDateTime nowTime = LocalDateTime.now();
if (useStartD15Before.isAfter(nowTime)) { // 15天以前的时间大于当前时间 距离演出开始日期>15天
int isCanRefund = refundPoundage.get(0).getIsCanRefund();
if (isCanRefund > 0) {
chargesRatio = refundPoundage.get(0).getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
}
} else if (useStartD3Before.isAfter(nowTime)) { // 3天以前的时间大于当前时间 距离演出开始日期>3天-15天 含15天
int isCanRefund = refundPoundage.get(1).getIsCanRefund();
if (isCanRefund > 0) {
chargesRatio = refundPoundage.get(1).getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
}
} else { // 三天以内 <=3
int isCanRefund = refundPoundage.get(2).getIsCanRefund();
if (isCanRefund > 0) {
chargesRatio = refundPoundage.get(2).getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
// return ResponseDto.failure("当前日期不支持退票");
}
}
return chargesRatio;
} else{ // 无手续费
return chargesRatio;
}
}
@Async
public void expressPlace(Integer sendExpressType, String expressNumber, String expressContacts, String expressPhone, String sendExpressAddress, String appointmentTime, KylinOrderTicketVo orderTicketVo, KylinPerformanceVo performanceVo) {
if (sendExpressType == 1) { // 上门取件
......
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