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

Commit 596c94a6 authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev' into dev

parents 0c3a4d8d f7049fa9
......@@ -93,10 +93,12 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
String orderTicketsId = refundApplyParam.getOrderTicketsId();
List<String> ticketEntityIds = refundApplyParam.getTicketEntityIds();
List<Double> entitiesPrice = refundApplyParam.getEntitiesPrice();
Double RefundPriceExpress = refundApplyParam.getRefundPriceExpress();
if (null == RefundPriceExpress) {
RefundPriceExpress = 0.0;
Double RefundPriceExpressDouble = refundApplyParam.getRefundPriceExpress();
if (null == RefundPriceExpressDouble) {
RefundPriceExpressDouble = 0.0;
}
BigDecimal RefundPriceExpress = BigDecimal.valueOf(RefundPriceExpressDouble);
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId)
......@@ -106,7 +108,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
);
int thisOrderStatus = orderStatus.getStatus();
int thisPayStatus = orderStatus.getPayStatus();
double priceExpress = orderInfo.getPriceExpress().doubleValue();
BigDecimal priceExpress = orderInfo.getPriceExpress();
// todo 转增是否能退
// 订单状态需已付款
......@@ -127,11 +129,11 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
refundPriceExpressSum = 0.0;
}
if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款
if (RefundPriceExpress > (priceExpress - refundPriceExpressSum)) {
if (RefundPriceExpress.compareTo(priceExpress.subtract(BigDecimal.valueOf(refundPriceExpressSum))) > 0) {
return ResponseDto.failure("快递费不能大于实际减去已退的快递费");
}
} else {
RefundPriceExpress = priceExpress - refundPriceExpressSum;
RefundPriceExpress = priceExpress.subtract(BigDecimal.valueOf(refundPriceExpressSum));
}
// todo 出票未出票
......@@ -148,18 +150,18 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
}
// 该订单正在退款或已有退款 因支持填入价格所有取消判断
// 各个入场人订单填写的退款金额是否正确
double priceActual = orderInfo.getPriceActual().doubleValue();
BigDecimal priceActual = orderInfo.getPriceActual();
int allEntitiesCount = kylinOrderTicketEntitiesMapper.selectCount(// 总入场人数量 排出未付款的 用来计算单入场人的价格
new QueryWrapper<KylinOrderTicketEntities>()
.eq("order_id", orderTicketsId)
.ne("is_payment", KylinTableStatusConst.ENTITIES_IS_PAYMENT0)
);
double onePrice = (priceActual - priceExpress) / allEntitiesCount;//单价
BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价
List<Double> realRefundPriceList = new ArrayList<>();
if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款
for (int i = 0; i <= ticketEntityIds.size() - 1; i++) {
Double price = entitiesPrice.get(i);
if (price < 0) {
BigDecimal price = BigDecimal.valueOf(entitiesPrice.get(i));
if (price.compareTo(BigDecimal.ZERO) <= 0) {
return ResponseDto.failure(ErrorMapping.get("20021"));
} else {
Double refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退
......@@ -170,7 +172,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
if (null == refundedPrice) {
refundedPrice = 0.0;
}
if (price > (onePrice - refundedPrice)) {
if (price.compareTo(onePrice.subtract(BigDecimal.valueOf(refundedPrice))) > 0) {
return ResponseDto.failure("超过可退款金额");
}
}
......@@ -187,9 +189,9 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
if (null == refundedPrice) {
refundedPrice = 0.0;
}
Double price = onePrice - refundedPrice; // 计算可退金额
if (price > 0) {
realRefundPriceList.add(price);
BigDecimal price = onePrice.subtract(BigDecimal.valueOf(refundedPrice)); // 计算可退金额
if (price.compareTo(BigDecimal.ZERO) > 0) {
realRefundPriceList.add(price.doubleValue());
ticketEntityIdsNew.add(ticketEntityIds.get(i));
}
}
......@@ -199,7 +201,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefunding(
refundApplyParam, orderInfo, orderTicketsId,
RefundPriceExpress,
RefundPriceExpress.doubleValue(),
ticketEntityIds, realRefundPriceList
);
......
......@@ -481,14 +481,14 @@ public class KylinRefundsStatusServiceImpl {
);
// 入场人
double priceActual = orderInfo.getPriceActual().doubleValue();
double priceExpress = orderInfo.getPriceExpress().doubleValue();
BigDecimal priceActual = orderInfo.getPriceActual();
BigDecimal priceExpress = orderInfo.getPriceExpress();
int allEntitiesCount = kylinOrderTicketEntitiesMapper.selectCount(// 总入场人数量 排出未付款的 用来计算单入场人的价格
new QueryWrapper<KylinOrderTicketEntities>()
.eq("order_id", orderTicketsId)
.ne("is_payment", KylinTableStatusConst.ENTITIES_IS_PAYMENT0)
);
double onePrice = (priceActual - priceExpress) / allEntitiesCount;//单价
BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价
int refundNumber = 0;
for (String entitiesId : orderTicketEntitiesIdsArr) {
KylinOrderTicketEntities EntitiesInfo = kylinOrderTicketEntitiesMapper.selectOne(//已退完成的
......@@ -504,9 +504,9 @@ public class KylinRefundsStatusServiceImpl {
);
KylinOrderTicketEntities entitiesTable = new KylinOrderTicketEntities();
double priceNew = refundEntitiesInfo.getRefundPrice().doubleValue() + refundedPrice.doubleValue();
BigDecimal priceNew = refundEntitiesInfo.getRefundPrice().add(refundedPrice);
int isPayment = 0;
if (priceNew == onePrice) {
if (priceNew.compareTo(onePrice) == 0) {
isPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT3;
refundNumber++;
} else {
......@@ -514,7 +514,7 @@ public class KylinRefundsStatusServiceImpl {
}
entitiesTable.setIsPayment(isPayment);
entitiesTable.setUpdatedAt(LocalDateTime.now());
entitiesTable.setRefundPrice(BigDecimal.valueOf(priceNew));
entitiesTable.setRefundPrice(priceNew);
Integer[] entitiesTableIsPayment = {KylinTableStatusConst.ENTITIES_IS_PAYMENT2, KylinTableStatusConst.ENTITIES_IS_PAYMENT4};
kylinOrderTicketEntitiesMapper.update(entitiesTable, new UpdateWrapper<KylinOrderTicketEntities>()
.eq("order_ticket_entities_id", entitiesId)
......@@ -523,7 +523,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap<String, Object> EntitiesVo = new HashMap<>();
EntitiesVo.put("updatedAt", DateUtil.getNowTime());
EntitiesVo.put("refundPrice", BigDecimal.valueOf(priceNew));
EntitiesVo.put("refundPrice", priceNew);
EntitiesVo.put("isPayment", isPayment);
BasicDBObject EntitiesVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(EntitiesVo));
UpdateResult updateResult = mongoTemplate.getCollection(KylinOrderTicketEntitiesVo.class.getSimpleName()).updateOne(
......
......@@ -105,14 +105,14 @@ public class KylinRefundsStatusServiceImpl {
);
// 入场人
double priceActual = orderInfo.getPriceActual().doubleValue();
double priceExpress = orderInfo.getPriceExpress().doubleValue();
BigDecimal priceActual = orderInfo.getPriceActual();
BigDecimal priceExpress = orderInfo.getPriceExpress();
int allEntitiesCount = kylinOrderTicketEntitiesMapper.selectCount(// 总入场人数量 排出未付款的 用来计算单入场人的价格
new QueryWrapper<KylinOrderTicketEntities>()
.eq("order_id", orderTicketsId)
.ne("is_payment", KylinTableStatusConst.ENTITIES_IS_PAYMENT0)
);
double onePrice = (priceActual - priceExpress) / allEntitiesCount;//单价
BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价
int refundNumber = 0;
for (String entitiesId : orderTicketEntitiesIdsArr) {
KylinOrderTicketEntities EntitiesInfo = kylinOrderTicketEntitiesMapper.selectOne(//已退完成的
......@@ -128,9 +128,9 @@ public class KylinRefundsStatusServiceImpl {
);
KylinOrderTicketEntities entitiesTable = new KylinOrderTicketEntities();
double priceNew = refundEntitiesInfo.getRefundPrice().doubleValue() + refundedPrice.doubleValue();
BigDecimal priceNew = refundEntitiesInfo.getRefundPrice().add(refundedPrice);
int isPayment = 0;
if (priceNew == onePrice) {
if (priceNew.compareTo(onePrice) == 0) {
isPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT3;
refundNumber++;
} else {
......@@ -138,7 +138,7 @@ public class KylinRefundsStatusServiceImpl {
}
entitiesTable.setIsPayment(isPayment);
entitiesTable.setUpdatedAt(LocalDateTime.now());
entitiesTable.setRefundPrice(BigDecimal.valueOf(priceNew));
entitiesTable.setRefundPrice(priceNew);
Integer[] entitiesTableIsPayment = {KylinTableStatusConst.ENTITIES_IS_PAYMENT2, KylinTableStatusConst.ENTITIES_IS_PAYMENT4};
kylinOrderTicketEntitiesMapper.update(entitiesTable, new UpdateWrapper<KylinOrderTicketEntities>()
.eq("order_ticket_entities_id", entitiesId)
......@@ -147,7 +147,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap<String, Object> EntitiesVo = new HashMap<>();
EntitiesVo.put("updatedAt", DateUtil.getNowTime());
EntitiesVo.put("refundPrice", BigDecimal.valueOf(priceNew));
EntitiesVo.put("refundPrice", priceNew);
EntitiesVo.put("isPayment", isPayment);
BasicDBObject EntitiesVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(EntitiesVo));
UpdateResult updateResult = mongoTemplate.getCollection(KylinOrderTicketEntitiesVo.class.getSimpleName()).updateOne(
......
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