注释废弃代码

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