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

Commit 9be51f70 authored by jiangxiulong's avatar jiangxiulong

flot -> BigDecimal

parent c33f7fff
......@@ -3,6 +3,8 @@ package com.liquidnet.service.kylin.dto.vo.admin;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @version V1.0
* @class: OrderRefundPoundage
......@@ -14,8 +16,8 @@ public class OrderRefundPoundage implements Cloneable {
private int day;
@ApiModelProperty(value = "距离演出开始日期>15天")
private String content;
@ApiModelProperty(value = "费率 如果手续费是0.1 这里存的是0.9")
private float present;
@ApiModelProperty(value = "费率 如果手续费是0.1")
private BigDecimal present;
@ApiModelProperty(value = "")
private int isCanRefund;
......
......@@ -360,17 +360,17 @@ public class DataUtils {
OrderRefundPoundage vo1 = OrderRefundPoundage.getNew();
vo1.setDay(15);
vo1.setContent("距离演出开始日期>15天");
vo1.setPresent(0.9f);
vo1.setPresent(BigDecimal.valueOf(0.1));
vo1.setIsCanRefund(1);
OrderRefundPoundage vo2 = OrderRefundPoundage.getNew();
vo2.setDay(3);
vo2.setContent("距离演出开始日期>3天-15天(含15天)");
vo2.setPresent(0.5f);
vo2.setPresent(BigDecimal.valueOf(0.5));
vo2.setIsCanRefund(1);
OrderRefundPoundage vo3 = OrderRefundPoundage.getNew();
vo3.setDay(0);
vo3.setContent("距离演出开始日期≤3天(含演出当天)");
vo3.setPresent(1.0f);
vo3.setPresent(BigDecimal.valueOf(0));
vo3.setIsCanRefund(0);
voList.add(vo1);
voList.add(vo2);
......
......@@ -36,6 +36,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDateTime;
......@@ -475,6 +476,76 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
return "申请金额不得小于0";
}
// 手续费处理
ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(performanceVo.getIsRefundPoundage());
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天
log.info("距离演出开始日期>15天");
log.info("票种演出开始时间 {}", useStartD);
log.info("15天之前的时间 {}", useStartD15Before);
log.info("3天之前的时间 {}", useStartD3Before);
log.info("当前时间 {}", nowTime);
log.info("手续费比例 {}", chargesNum);
int isCanRefund = refundPoundage.get(0).getIsCanRefund();
if (isCanRefund > 0) {
chargesNum = refundPoundage.get(0).getPresent();
} else {
return "当前日期不支持退票";
}
} else if (useStartD3Before.isAfter(nowTime)) { // 3天以前的时间大于当前时间 距离演出开始日期>3天-15天 含15天
log.info("距离演出开始日期3-15天");
log.info("票种演出开始时间 {}", useStartD);
log.info("15天之前的时间 {}", useStartD15Before);
log.info("3天之前的时间 {}", useStartD3Before);
log.info("当前时间 {}", nowTime);
log.info("手续费比例 {}", chargesNum);
int isCanRefund = refundPoundage.get(1).getIsCanRefund();
if (isCanRefund > 0) {
chargesNum = refundPoundage.get(1).getPresent();
} else {
return "当前日期不支持退票";
}
} else { // 三天以内 <=3
log.info("距离演出开始日期<=3");
log.info("票种演出开始时间 {}", useStartD);
log.info("15天之前的时间 {}", useStartD15Before);
log.info("3天之前的时间 {}", useStartD3Before);
log.info("当前时间 {}", nowTime);
log.info("手续费比例 {}", chargesNum);
int isCanRefund = refundPoundage.get(2).getIsCanRefund();
if (isCanRefund > 0) {
chargesNum = refundPoundage.get(2).getPresent();
} else {
return "当前日期不支持退票";
}
}
BigDecimal multiply = refundSinglePrice.multiply(chargesNum);
log.info("multiply {}", multiply);
refundSinglePrice = refundSinglePrice.subtract(multiply);
log.info("去除手续费申请金额 {}", refundSinglePrice);
if (refundSinglePrice.compareTo(BigDecimal.ZERO) <= 0) {
return "申请金额不得小于0";
// return "去除手续费申请金额不得小于0";
}
} else{
log.info("演出id1111 {}", orderTicketVo.getPerformanceId());
}
// 临时手续费 end
Map token = CurrentUtil.getTokenClaims();
String username = StringUtils.defaultString(((String) token.get("nickname")), "");
String result = refundsStatusService.userOrderTicketRefunding(orderTicketVo, refundSinglePrice.doubleValue(), orderTicketEntitiesId, reason, picList, uid, username, kylinOrderRefundsVoBaseList.size());
......
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