注释废弃代码

This commit is contained in:
2024-02-19 17:11:14 +08:00
parent d5b8ae5f10
commit b29f5189c8

View File

@@ -709,74 +709,74 @@ public abstract class AbstractProgramLogic implements InitializingBean {
* @param orderBasicInfo 订单主表 * @param orderBasicInfo 订单主表
* @param orderDetail 订单详情 * @param orderDetail 订单详情
*/ */
protected void calculateOrderDiscounts(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) { // protected void calculateOrderDiscounts(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) {
String memberId = orderBasicInfo.getMemberId(); // 会员id // String memberId = orderBasicInfo.getMemberId(); // 会员id
String merchantId = orderBasicInfo.getMerchantId(); // 运营商id // String merchantId = orderBasicInfo.getMerchantId(); // 运营商id
String stationId = orderBasicInfo.getStationId(); // 站点id // String stationId = orderBasicInfo.getStationId(); // 站点id
//
// 电费折扣金额 // // 电费折扣金额
BigDecimal discountElectricityAmount = BigDecimal.ZERO; // BigDecimal discountElectricityAmount = BigDecimal.ZERO;
// 服务费折扣金额 // // 服务费折扣金额
BigDecimal discountServiceAmount = BigDecimal.ZERO; // BigDecimal discountServiceAmount = BigDecimal.ZERO;
// 优惠后服务费金额 初始值为优惠前金额 // // 优惠后服务费金额 初始值为优惠前金额
BigDecimal afterServiceAmountDiscount = orderDetail.getTotalServiceAmount(); // BigDecimal afterServiceAmountDiscount = orderDetail.getTotalServiceAmount();
// 优惠后电费金额 初始值为优惠前金额 // // 优惠后电费金额 初始值为优惠前金额
BigDecimal afterElectricityAmountDiscount = orderDetail.getTotalElectricityAmount(); // BigDecimal afterElectricityAmountDiscount = orderDetail.getTotalElectricityAmount();
//
// 查询会员在此站点会员折扣 // // 查询会员在此站点会员折扣
MemberDiscountVO memberDiscountVO = memberGroupService.queryMemberDiscount(merchantId, stationId, memberId); // MemberDiscountVO memberDiscountVO = memberGroupService.queryMemberDiscount(merchantId, stationId, memberId);
if (memberDiscountVO != null) { // if (memberDiscountVO != null) {
BigDecimal discount = memberDiscountVO.getDiscount(); // 折扣率 // BigDecimal discount = memberDiscountVO.getDiscount(); // 折扣率
String groupType = memberDiscountVO.getGroupType(); // 类型1-服务费折扣2-电费折扣 3-电费和服务费一起折扣) // String groupType = memberDiscountVO.getGroupType(); // 类型1-服务费折扣2-电费折扣 3-电费和服务费一起折扣)
BigDecimal totalElectricityAmount = orderDetail.getTotalElectricityAmount(); // 电费 // BigDecimal totalElectricityAmount = orderDetail.getTotalElectricityAmount(); // 电费
BigDecimal totalServiceAmount = orderDetail.getTotalServiceAmount(); // 服务费 // BigDecimal totalServiceAmount = orderDetail.getTotalServiceAmount(); // 服务费
//
// 未进行打折前 // // 未进行打折前
afterServiceAmountDiscount = totalServiceAmount; // afterServiceAmountDiscount = totalServiceAmount;
afterElectricityAmountDiscount = totalElectricityAmount; // afterElectricityAmountDiscount = totalElectricityAmount;
if (Constants.ONE.equals(groupType)) { // if (Constants.ONE.equals(groupType)) {
// 服务费折扣 // // 服务费折扣
afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN); // afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
} else if (Constants.TWO.equals(groupType)) {
// 电费折扣
afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
} else {
// BigDecimal afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(2, RoundingMode.DOWN);
// discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount); // discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
// BigDecimal afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(2, RoundingMode.DOWN); // } else if (Constants.TWO.equals(groupType)) {
// // 电费折扣
// afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
// discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount); // discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
// } else {
// 电费和服务费一起折扣 // // BigDecimal afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(2, RoundingMode.DOWN);
afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN); // // discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN); // // BigDecimal afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(2, RoundingMode.DOWN);
// // discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount); //
discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount); // // 电费和服务费一起折扣
} // afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
orderBasicInfo.setGroupCode(memberDiscountVO.getGroupCode()); // afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
} //
// 订单折扣金额 // discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
BigDecimal discountAmount = discountServiceAmount.add(discountElectricityAmount); // discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
orderBasicInfo.setDiscountAmount(discountAmount); // }
// orderBasicInfo.setGroupCode(memberDiscountVO.getGroupCode());
// 更新结算金额 结算金额 = 消费金额 - 虚拟金额 - 优惠金额 // }
BigDecimal newSettleAmount = orderBasicInfo.getSettleAmount().subtract(discountAmount); // // 订单折扣金额
orderBasicInfo.setSettleAmount(newSettleAmount); // BigDecimal discountAmount = discountServiceAmount.add(discountElectricityAmount);
// orderBasicInfo.setDiscountAmount(discountAmount);
// 总消费金额 = 折扣后电费 + 折扣后服务费 //
BigDecimal totalConsumeAmount = afterServiceAmountDiscount.add(afterElectricityAmountDiscount); // // 更新结算金额 结算金额 = 消费金额 - 虚拟金额 - 优惠金额
// BigDecimal newSettleAmount = orderBasicInfo.getSettleAmount().subtract(discountAmount);
// 更新退款金额 // orderBasicInfo.setSettleAmount(newSettleAmount);
BigDecimal refundAmount = orderBasicInfo.getPayAmount().subtract(totalConsumeAmount).setScale(2, RoundingMode.DOWN); //
orderBasicInfo.setRefundAmount(refundAmount); // // 总消费金额 = 折扣后电费 + 折扣后服务费
// BigDecimal totalConsumeAmount = afterServiceAmountDiscount.add(afterElectricityAmountDiscount);
orderDetail.setDiscountElectricityAmount(discountElectricityAmount); //
orderDetail.setDiscountServiceAmount(discountServiceAmount); // // 更新退款金额
logger.info("计算订单折扣, orderCode:{}, memberId:{}, discountAmount:{}, discountElectricityAmount:{}, discountServiceAmount:{}, totalConsumeAmount:{}", // BigDecimal refundAmount = orderBasicInfo.getPayAmount().subtract(totalConsumeAmount).setScale(2, RoundingMode.DOWN);
orderBasicInfo.getOrderCode(), memberId, discountAmount, discountElectricityAmount, discountServiceAmount, totalConsumeAmount); // orderBasicInfo.setRefundAmount(refundAmount);
} //
// orderDetail.setDiscountElectricityAmount(discountElectricityAmount);
// orderDetail.setDiscountServiceAmount(discountServiceAmount);
// logger.info("计算订单折扣, orderCode:{}, memberId:{}, discountAmount:{}, discountElectricityAmount:{}, discountServiceAmount:{}, totalConsumeAmount:{}",
// orderBasicInfo.getOrderCode(), memberId, discountAmount, discountElectricityAmount, discountServiceAmount, totalConsumeAmount);
// }
/** /**
* 计算订单折扣V2 * 计算订单折扣V2
@@ -809,7 +809,10 @@ public abstract class AbstractProgramLogic implements InitializingBean {
afterDiscountServiceAmount = orderDetail.getTotalServiceAmount(); afterDiscountServiceAmount = orderDetail.getTotalServiceAmount();
afterDiscountElectricityAmount = orderDetail.getTotalElectricityAmount(); afterDiscountElectricityAmount = orderDetail.getTotalElectricityAmount();
} else { } else {
// 集团会员的订单,记录集团编号
orderBasicInfo.setGroupCode(memberDiscountVO.getGroupCode()); orderBasicInfo.setGroupCode(memberDiscountVO.getGroupCode());
// 集团会员的优惠计费模板
BillingTemplateVO billingTemplateVO = memberDiscountVO.getBillingTemplateVO(); BillingTemplateVO billingTemplateVO = memberDiscountVO.getBillingTemplateVO();
// 尖时段用电量 // 尖时段用电量