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

Commit f85c7a5c authored by jiangxiulong's avatar jiangxiulong

double 全部使用bigdecimal

parent 7d30602d
......@@ -23,10 +23,10 @@ public class RefundApplyParam implements Serializable {
private String reason;
private Double RefundPriceExpress;
private BigDecimal RefundPriceExpress;
private List<String> ticketEntityIds;
private List<Double> entitiesPrice;
private List<BigDecimal> entitiesPrice;
private List<String> ids;
......
......@@ -3,6 +3,7 @@ package com.liquidnet.service.kylin.dto.param;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
......@@ -45,7 +46,7 @@ public class RefundCallbackParam implements Serializable {
private String refund_code;
private double refund_price;
private BigDecimal refund_price;
private String refund_reason;
......
......@@ -20,7 +20,6 @@ import com.liquidnet.service.kylin.dao.OrderRefundDao;
import com.liquidnet.service.kylin.dto.param.RefundApplyParam;
import com.liquidnet.service.kylin.dto.param.RefundCallbackParam;
import com.liquidnet.service.kylin.dto.param.RefundSearchParam;
import com.liquidnet.service.kylin.dto.param.SysDamaiParam;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo;
......@@ -92,13 +91,11 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
public ResponseDto refundApply(RefundApplyParam refundApplyParam) {
String orderTicketsId = refundApplyParam.getOrderTicketsId();
List<String> ticketEntityIds = refundApplyParam.getTicketEntityIds();
List<Double> entitiesPrice = refundApplyParam.getEntitiesPrice();
Double RefundPriceExpressDouble = refundApplyParam.getRefundPriceExpress();
if (null == RefundPriceExpressDouble) {
RefundPriceExpressDouble = 0.0;
List<BigDecimal> entitiesPrice = refundApplyParam.getEntitiesPrice();
BigDecimal RefundPriceExpress = refundApplyParam.getRefundPriceExpress();
if (null == RefundPriceExpress) {
RefundPriceExpress = new BigDecimal(0);
}
BigDecimal RefundPriceExpress = BigDecimal.valueOf(RefundPriceExpressDouble);
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId)
......@@ -121,19 +118,19 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
}
// TODO: 2021/6/16 是否能单独退快递飞 批量退款是否退快递费 现在做的是自动退剩余快递费
// 传的快递费不能大于实际的快递费=(支付的快递费-已退的快递费)
Double refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费
BigDecimal refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费
orderTicketsId,
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL
);
if (null == refundPriceExpressSum) {
refundPriceExpressSum = 0.0;
refundPriceExpressSum = new BigDecimal(0);
}
if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款
if (RefundPriceExpress.compareTo(priceExpress.subtract(BigDecimal.valueOf(refundPriceExpressSum))) > 0) {
if (RefundPriceExpress.compareTo(priceExpress.subtract(refundPriceExpressSum)) > 0) {
return ResponseDto.failure("快递费不能大于实际减去已退的快递费");
}
} else {
RefundPriceExpress = priceExpress.subtract(BigDecimal.valueOf(refundPriceExpressSum));
RefundPriceExpress = priceExpress.subtract(refundPriceExpressSum);
}
// todo 出票未出票
......@@ -157,22 +154,22 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
.ne("is_payment", KylinTableStatusConst.ENTITIES_IS_PAYMENT0)
);
BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价
List<Double> realRefundPriceList = new ArrayList<>();
List<BigDecimal> realRefundPriceList = new ArrayList<>();
if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款
for (int i = 0; i <= ticketEntityIds.size() - 1; i++) {
BigDecimal price = BigDecimal.valueOf(entitiesPrice.get(i));
BigDecimal price = entitiesPrice.get(i);
if (price.compareTo(BigDecimal.ZERO) <= 0) {
return ResponseDto.failure(ErrorMapping.get("20021"));
} else {
Double refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退
BigDecimal refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退
orderTicketsId,
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL,
ticketEntityIds.get(i)
);
if (null == refundedPrice) {
refundedPrice = 0.0;
refundedPrice = new BigDecimal(0);
}
if (price.compareTo(onePrice.subtract(BigDecimal.valueOf(refundedPrice))) > 0) {
if (price.compareTo(onePrice.subtract(refundedPrice)) > 0) {
return ResponseDto.failure("超过可退款金额");
}
}
......@@ -181,17 +178,17 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
} else { // 批量 计算入场人订单可退金额
List<String> ticketEntityIdsNew = new ArrayList<>();
for (int i = 0; i <= ticketEntityIds.size() - 1; i++) {
Double refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中
BigDecimal refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中
orderTicketsId,
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL,
ticketEntityIds.get(i)
);
if (null == refundedPrice) {
refundedPrice = 0.0;
refundedPrice = new BigDecimal(0);
}
BigDecimal price = onePrice.subtract(BigDecimal.valueOf(refundedPrice)); // 计算可退金额
BigDecimal price = onePrice.subtract(refundedPrice); // 计算可退金额
if (price.compareTo(BigDecimal.ZERO) > 0) {
realRefundPriceList.add(price.doubleValue());
realRefundPriceList.add(price);
ticketEntityIdsNew.add(ticketEntityIds.get(i));
}
}
......@@ -201,7 +198,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefunding(
refundApplyParam, orderInfo, orderTicketsId,
RefundPriceExpress.doubleValue(),
RefundPriceExpress,
ticketEntityIds, realRefundPriceList
);
......@@ -319,7 +316,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
RefundCallbackParam refundCallbackParam = new RefundCallbackParam();
refundCallbackParam.setRefund_code(refundInfo.getRefundCode());
double refundPrice = refundInfo.getPrice().doubleValue() + refundInfo.getPriceExpress().doubleValue();
BigDecimal refundPrice = refundInfo.getPrice().add(refundInfo.getPriceExpress());
refundCallbackParam.setRefund_price(refundPrice);
refundCallbackParam.setRefund_type("UNKNOWN");
refundCallbackParam.setRefund_id(refundInfo.getRefundId());
......@@ -405,15 +402,15 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
new QueryWrapper<KylinOrderTickets>().eq("order_code", orderCode)
);
// 传的快递费不能大于实际的快递费=(支付的快递费-已退的快递费)
Double refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费
BigDecimal refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费
kylinOrderTickets.getOrderTicketsId(),
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL
);
if (null == refundPriceExpressSum) {
refundPriceExpressSum = 0.0;
refundPriceExpressSum = new BigDecimal(0);
}
Double RefundPriceExpress = kylinOrderTickets.getPriceExpress().doubleValue() - refundPriceExpressSum;
kylinOrderTickets.setPriceExpress(BigDecimal.valueOf(RefundPriceExpress));
BigDecimal RefundPriceExpress = kylinOrderTickets.getPriceExpress().subtract(refundPriceExpressSum);
kylinOrderTickets.setPriceExpress(RefundPriceExpress);
// 订单关联 获取演出id
KylinOrderTicketRelations kylinOrderTicketRelations = kylinOrderTicketRelationsMapper.selectOne(
......@@ -437,14 +434,14 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
);
BigDecimal onePrice = (priceActual.subtract(priceExpress)).divide(BigDecimal.valueOf(allEntitiesCount));//单价
for (KylinOrderTicketEntitiesDao entities : entitiesListTemp) {
Double refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中
BigDecimal refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中
kylinOrderTickets.getOrderTicketsId(),
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL,
entities.getOrderTicketEntitiesId()
);
BigDecimal canRefundedPrice;
if (null != refundedPrice) {
canRefundedPrice = onePrice.subtract(BigDecimal.valueOf(refundedPrice));
canRefundedPrice = onePrice.subtract(refundedPrice);
} else {
canRefundedPrice = onePrice;
}
......
......@@ -70,8 +70,8 @@ public class KylinRefundExecuteServiceImpl {
refundApplyParam.setReason(reason);
refundApplyParam.setOrderTicketsId(order.getOrderTicketsId());
refundApplyParam.setTicketEntityIds(ticketEntityIds);
if (order.getPriceExpress() != null) {
refundApplyParam.setRefundPriceExpress(order.getPriceExpress().doubleValue());
if (null != order.getPriceExpress()) {
refundApplyParam.setRefundPriceExpress(order.getPriceExpress());
}
try {
ResponseDto res = kylinOrderRefundsServiceImpl.refundApply(refundApplyParam);
......
......@@ -91,8 +91,8 @@ public class KylinRefundsStatusServiceImpl {
public Boolean orderTicketRefunding(
RefundApplyParam refundApplyParam, KylinOrderTickets orderInfo, String orderTicketsId,
double RefundPriceExpress,
List<String> ticketEntityIds, List<Double> entitiesPrice
BigDecimal RefundPriceExpress,
List<String> ticketEntityIds, List<BigDecimal> entitiesPrice
) {
if (CollectionUtil.isEmpty(ticketEntityIds)) {
return false;
......@@ -103,7 +103,7 @@ public class KylinRefundsStatusServiceImpl {
String reason = refundApplyParam.getReason();
String orderRefundBatchesId = refundApplyParam.getOrderRefundBatchesId();
// 本次退款票总金额
double entitiesPriceSum = entitiesPrice.stream().mapToDouble(Double::doubleValue).sum();
BigDecimal entitiesPriceSum = entitiesPrice.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
// TODO: 2021/5/27 事物 and 部分退款
// 更新数据
......@@ -163,8 +163,8 @@ public class KylinRefundsStatusServiceImpl {
String orderRefundCode = orderInfo.getOrderCode();
String codeNum = StringUtils.leftPad(String.valueOf(refundCount), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum));
kylinOrderRefunds.setPrice(BigDecimal.valueOf(entitiesPriceSum));
kylinOrderRefunds.setPriceExpress(BigDecimal.valueOf(RefundPriceExpress));
kylinOrderRefunds.setPrice(entitiesPriceSum);
kylinOrderRefunds.setPriceExpress(RefundPriceExpress);
kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY);
kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY);
......@@ -172,11 +172,11 @@ public class KylinRefundsStatusServiceImpl {
kylinOrderRefunds.setApplicantName(authName);
kylinOrderRefunds.setApplicantAt(LocalDateTime.now());
kylinOrderRefunds.setReason(reason);
if (RefundPriceExpress > 0 && entitiesPriceSum > 0) {
if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0 && entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE3);
} else if (RefundPriceExpress > 0) {
} else if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE2);
} else if (entitiesPriceSum > 0) {
} else if (entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE1);
}
kylinOrderRefunds.setCreatedAt(LocalDateTime.now());
......@@ -192,7 +192,7 @@ public class KylinRefundsStatusServiceImpl {
String orderRefundsEntitiesId = IDGenerator.nextSnowId();
kylinOrderRefundEntities.setOrderRefundsEntitiesId(orderRefundsEntitiesId);
kylinOrderRefundEntities.setOrderRefundsId(orderRefundsId);
kylinOrderRefundEntities.setRefundPrice(BigDecimal.valueOf(entitiesPrice.get(i)));
kylinOrderRefundEntities.setRefundPrice(entitiesPrice.get(i));
kylinOrderRefundEntities.setOrderTicketEntitiesId(ticketEntityIds.get(i));
kylinOrderRefundEntities.setCreatedAt(LocalDateTime.now());
int rowsR = kylinOrderRefundsEntitiesMapper.insert(kylinOrderRefundEntities);
......@@ -237,7 +237,7 @@ public class KylinRefundsStatusServiceImpl {
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId)
);
if (orderInfo.getPriceRefund().doubleValue() > 0) { // 已经有退完的 那就是部分退款了
if (orderInfo.getPriceRefund().compareTo(BigDecimal.ZERO) > 0) { // 已经有退完的 那就是部分退款了
newStatus = KylinTableStatusConst.ORDER_STATUS6;
} else {
newStatus = KylinTableStatusConst.ORDER_STATUS1;
......@@ -276,7 +276,7 @@ public class KylinRefundsStatusServiceImpl {
KylinOrderTicketEntities entitiesInfo = kylinOrderTicketEntitiesMapper.selectOne(
new QueryWrapper<KylinOrderTicketEntities>().eq("order_ticket_entities_id", entitiesId)
);
if (entitiesInfo.getRefundPrice().doubleValue() > 0) { // 已经有退完的 那就是部分退款了
if (entitiesInfo.getRefundPrice().compareTo(BigDecimal.ZERO) > 0) { // 已经有退完的 那就是部分退款了
newIsPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT4;
} else {
newIsPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT1;
......@@ -406,7 +406,7 @@ public class KylinRefundsStatusServiceImpl {
new QueryWrapper<KylinOrderTickets>()
.eq("order_tickets_id", refund.getOrderTicketsId())
);
double refundPrice = refund.getPrice().doubleValue() + refund.getPriceExpress().doubleValue();
BigDecimal refundPrice = refund.getPrice().add(refund.getPriceExpress());
MultiValueMap<String, String> params = new LinkedMultiValueMap();
params.add("code", oderInfo.getPayCode());
params.add("order_refund_code", refund.getOrderRefundCode());
......@@ -468,7 +468,7 @@ public class KylinRefundsStatusServiceImpl {
);
KylinOrderTicketStatus orderStatusTable = new KylinOrderTicketStatus();
int newStatus = 0;
if (refundCallbackParam.getRefund_price() + orderInfo.getPriceRefund().doubleValue() == orderInfo.getPriceActual().doubleValue()) {
if (refundCallbackParam.getRefund_price().add(orderInfo.getPriceRefund()).compareTo(orderInfo.getPriceActual()) == 0) {
newStatus = KylinTableStatusConst.ORDER_STATUS4;
} else {
newStatus = KylinTableStatusConst.ORDER_STATUS6;
......@@ -535,11 +535,11 @@ public class KylinRefundsStatusServiceImpl {
}
// 订单表
double price = orderInfo.getPriceRefund().doubleValue() + refundCallbackParam.getRefund_price();
BigDecimal price = orderInfo.getPriceRefund().add(refundCallbackParam.getRefund_price());
Integer num = orderInfo.getRefundNumber() + refundNumber;
KylinOrderTickets update = new KylinOrderTickets();
update.setRefundNumber(num);
update.setPriceRefund(BigDecimal.valueOf(price));
update.setPriceRefund(price);
update.setUpdatedAt(LocalDateTime.now());
kylinOrderTicketsMapper.update(
update, new UpdateWrapper<KylinOrderTickets>()
......@@ -548,7 +548,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap<String, Object> orderVo = new HashMap<>();
orderVo.put("updatedAt", DateUtil.getNowTime());
orderVo.put("priceRefund", BigDecimal.valueOf(price));
orderVo.put("priceRefund", price);
orderVo.put("status", newStatus);
orderVo.put("refundNumber", num);
BasicDBObject orderVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(orderVo));
......
......@@ -5,6 +5,7 @@ import com.liquidnet.service.kylin.dao.OrderRefundDao;
import com.liquidnet.service.kylin.entity.KylinOrderRefunds;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
......@@ -35,7 +36,7 @@ public interface KylinOrderRefundsMapper extends BaseMapper<KylinOrderRefunds> {
@Param("ticketEntityIds") List<String> ticketEntityIds
);
Double RefundPriceExpressSum(
BigDecimal RefundPriceExpressSum(
@Param("orderTicketsId") String orderTicketsId,
@Param("orderRefundStatusCancel") Integer orderRefundStatusCancel
);
......
......@@ -6,6 +6,7 @@ import com.liquidnet.service.kylin.entity.KylinOrderTicketEntities;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -22,13 +23,13 @@ public interface KylinOrderTicketEntitiesMapper extends BaseMapper<KylinOrderTic
List<KylinOrderTicketEntitiesDao> getRefundEntitiesList(String orderTicketsId);
Double getRefundEntitiesPrice(
BigDecimal getRefundEntitiesPrice(
@Param("orderTicketsId") String orderTicketsId,
@Param("orderRefundStatusCancel") Integer orderRefundStatusCancel,
@Param("orderTicketEntitiesId") String orderTicketEntitiesId
);
Double getRefundOverEntitiesPrice(
BigDecimal getRefundOverEntitiesPrice(
@Param("orderTicketsId") String orderTicketsId,
@Param("orderRefundStatus") Integer orderRefundStatus,
@Param("entitiesId") String entitiesId
......
......@@ -67,7 +67,7 @@
</foreach>
</where>
</select>
<select id="RefundPriceExpressSum" resultType="java.lang.Double">
<select id="RefundPriceExpressSum" resultType="java.math.BigDecimal">
SELECT SUM(price_express)
FROM kylin_order_refunds
<where>
......
......@@ -26,7 +26,7 @@
AND a.is_payment != 3
</where>
</select>
<select id="getRefundEntitiesPrice" resultType="java.lang.Double">
<select id="getRefundEntitiesPrice" resultType="java.math.BigDecimal">
SELECT SUM(b.refund_price)
FROM kylin_order_refunds AS a
JOIN kylin_order_refund_entities AS b ON a.order_refunds_id = b.order_refunds_id
......@@ -36,7 +36,7 @@
AND b.order_ticket_entities_id = #{orderTicketEntitiesId}
</where>
</select>
<select id="getRefundOverEntitiesPrice" resultType="java.lang.Double">
<select id="getRefundOverEntitiesPrice" resultType="java.math.BigDecimal">
SELECT SUM(b.refund_price)
FROM kylin_order_refunds AS a
JOIN kylin_order_refund_entities AS b ON a.order_refunds_id = b.order_refunds_id
......
......@@ -58,8 +58,8 @@ public class KylinRefundsStatusServiceImpl {
public Boolean orderTicketRefunding(
KylinOrderTicketVo orderInfo, String orderTicketsId,
double RefundPriceExpress,
List<String> ticketEntityIds, List<Double> entitiesPrice
BigDecimal RefundPriceExpress,
List<String> ticketEntityIds, List<BigDecimal> entitiesPrice
) {
if (CollectionUtil.isEmpty(ticketEntityIds)) {
return false;
......@@ -69,7 +69,7 @@ public class KylinRefundsStatusServiceImpl {
String authName = "system_overtime_order_refund";
String reason = "订单支付超时自动退款";
// 本次退款票总金额
double entitiesPriceSum = entitiesPrice.stream().mapToDouble(Double::doubleValue).sum();
BigDecimal entitiesPriceSum = entitiesPrice.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
// 更新数据
// 订单状态表 和 缓存
......@@ -127,19 +127,19 @@ public class KylinRefundsStatusServiceImpl {
String orderRefundCode = orderInfo.getOrderCode();
String codeNum = StringUtils.leftPad(String.valueOf(5), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum));
kylinOrderRefunds.setPrice(BigDecimal.valueOf(entitiesPriceSum));
kylinOrderRefunds.setPriceExpress(BigDecimal.valueOf(RefundPriceExpress));
kylinOrderRefunds.setPrice(entitiesPriceSum);
kylinOrderRefunds.setPriceExpress(RefundPriceExpress);
kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY);
kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_AUTO);
kylinOrderRefunds.setApplicantId(authId);
kylinOrderRefunds.setApplicantName(authName);
kylinOrderRefunds.setApplicantAt(nowTime);
kylinOrderRefunds.setReason(reason);
if (RefundPriceExpress > 0 && entitiesPriceSum > 0) {
if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0 && entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE3);
} else if (RefundPriceExpress > 0) {
} else if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE2);
} else if (entitiesPriceSum > 0) {
} else if (entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE1);
}
kylinOrderRefunds.setCreatedAt(nowTime);
......@@ -158,7 +158,7 @@ public class KylinRefundsStatusServiceImpl {
for (int i = 0; i <= ticketEntityIds.size() - 1; i++) {
String orderRefundsEntitiesId = IDGenerator.nextSnowId();
kylinOrderRefundEntities.setOrderRefundsEntitiesId(orderRefundsEntitiesId);
kylinOrderRefundEntities.setRefundPrice(BigDecimal.valueOf(entitiesPrice.get(i)));
kylinOrderRefundEntities.setRefundPrice(entitiesPrice.get(i));
kylinOrderRefundEntities.setOrderTicketEntitiesId(ticketEntityIds.get(i));
sqlsDataD.add(new Object[]{
......
......@@ -37,22 +37,22 @@ public class OrderRefundOvertimeServiceImpl implements IKylinOrderRefundsService
public Boolean refundApply(String orderTicketsId) {
KylinOrderTicketVo orderInfo = dataUtils.getOrderTicketVo(orderTicketsId);
// 快递费 未进行判断
Double RefundPriceExpress = orderInfo.getPriceExpress().doubleValue();
double priceActual = orderInfo.getPriceActual().doubleValue();
double priceExpress = orderInfo.getPriceExpress().doubleValue();
BigDecimal RefundPriceExpress = orderInfo.getPriceExpress();
BigDecimal priceActual = orderInfo.getPriceActual();
BigDecimal priceExpress = orderInfo.getPriceExpress();
// 查询订单入场人
List<KylinOrderTicketEntitiesVo> entitiesList = orderInfo.getEntitiesVoList();
if (!CollectionUtil.isEmpty(entitiesList)) {
int allEntitiesCount = entitiesList.size();// 总入场人数量 排出未付款的 用来计算单入场人的价格
double onePrice = (priceActual - priceExpress) / allEntitiesCount;//单价
BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价
for (KylinOrderTicketEntitiesVo entities : entitiesList) {
entities.setCanRefundedPrice(BigDecimal.valueOf(onePrice));
entities.setCanRefundedPrice(onePrice);
}
}
List<String> ticketEntityIds = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getOrderTicketEntitiesId()).collect(Collectors.toList());
List<Double> entitiesPrice = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getCanRefundedPrice().doubleValue()).collect(Collectors.toList());
List<BigDecimal> entitiesPrice = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getCanRefundedPrice()).collect(Collectors.toList());
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefunding(
orderInfo, orderTicketsId,
......
......@@ -92,7 +92,7 @@ public class KylinRefundsStatusServiceImpl {
);
KylinOrderTicketStatus orderStatusTable = new KylinOrderTicketStatus();
int newStatus = 0;
if (refundCallbackParam.getRefund_price() + orderInfo.getPriceRefund().doubleValue() == orderInfo.getPriceActual().doubleValue()) {
if (refundCallbackParam.getRefund_price().add(orderInfo.getPriceRefund()).compareTo(orderInfo.getPriceActual()) == 0) {
newStatus = KylinTableStatusConst.ORDER_STATUS4;
} else {
newStatus = KylinTableStatusConst.ORDER_STATUS6;
......@@ -159,11 +159,11 @@ public class KylinRefundsStatusServiceImpl {
}
// 订单表
double price = orderInfo.getPriceRefund().doubleValue() + refundCallbackParam.getRefund_price();
BigDecimal price = orderInfo.getPriceRefund().add(refundCallbackParam.getRefund_price());
Integer num = orderInfo.getRefundNumber() + refundNumber;
KylinOrderTickets update = new KylinOrderTickets();
update.setRefundNumber(num);
update.setPriceRefund(BigDecimal.valueOf(price));
update.setPriceRefund(price);
update.setUpdatedAt(LocalDateTime.now());
kylinOrderTicketsMapper.update(
update, new UpdateWrapper<KylinOrderTickets>()
......@@ -172,7 +172,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap<String, Object> orderVo = new HashMap<>();
orderVo.put("updatedAt", DateUtil.getNowTime());
orderVo.put("priceRefund", BigDecimal.valueOf(price));
orderVo.put("priceRefund", price);
orderVo.put("status", newStatus);
orderVo.put("refundNumber", num);
BasicDBObject orderVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(orderVo));
......
......@@ -21,8 +21,6 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
......
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