Commit d091fad4 by wuwenlong

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

parents 49963cde 0af5093a
......@@ -52,6 +52,8 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
private MemberConfigService memberConfigService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private ConsumerWalletService consumerWalletService;
/**
* 查询权益会员订单
......@@ -160,6 +162,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
@Override
public void paymentSuccessful(EquityMembersOrder equityMembersOrder) {
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, equityMembersOrder.getConsumerId()));
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, equityMembersOrder.getConsumerId()));
EquityMembersOrderConfig equityMembersOrderConfig = equityMembersOrderConfigService.selectEquityMembersOrderConfigById(equityMembersOrder.getEquityMembersConfigId());
if (ObjectUtil.isEmpty(consumerMember)) {
ConsumerMember newConsumerMember = new ConsumerMember();
......@@ -210,6 +213,15 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
JSONObject json = new JSONObject(map);
redisUtil.set(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + equityMembersOrder.getConsumerId(), json.toString());
}
if (ObjectUtil.isEmpty(consumerWallet)) {
ConsumerWallet consumerWalletOne = new ConsumerWallet();
consumerWalletOne.setConsumerId(equityMembersOrder.getConsumerId());
consumerWalletOne.setBalance(BigDecimal.ZERO);
consumerWalletOne.setRemainingDuration(BigDecimal.ZERO);
consumerWalletOne.setRemainingIntegral(BigDecimal.ZERO);
consumerWalletOne.setCreateTime(new Date());
consumerWalletService.save(consumerWalletOne);
}
updateEquityMembersOrder(equityMembersOrder);
}
......
......@@ -1122,14 +1122,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtil.isNotEmpty(sOrder.getCouponId())) {
coupon = consumerCouponService.getById(sOrder.getCouponId());
}
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral;
BigDecimal membershipProgress;
BigDecimal integral = BigDecimal.ZERO;
BigDecimal membershipProgress = BigDecimal.ZERO;
if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
integral = consumerWallet.getRemainingIntegral().add(coupon.getCouponPayPrice()).add(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance())
.add(coupon.getCouponPayPrice());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
......@@ -1137,13 +1135,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
membershipProgress = membershipProgress.add(sOrder.getPayPrice());
}
} else {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
integral = consumerWallet.getRemainingIntegral().add(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
integral = integral.add(sOrder.getPayPrice());
membershipProgress = membershipProgress.add(sOrder.getPayPrice());
}
}
if (ObjectUtil.isNotEmpty(consumerWallet)) {
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
integralLog.setVariableIntegral(integral.subtract(consumerWallet.getRemainingIntegral()));
consumerWallet.setRemainingIntegral(integral);
integralLog.setOperationType(YesNoEnum.yes.getIndex());
......@@ -1151,6 +1155,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
integralLog.setCreateTime(new Date());
integralLogService.save(integralLog);
consumerWalletService.updateById(consumerWallet);
}
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
......@@ -1271,14 +1276,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtil.isNotEmpty(sOrder.getCouponId())) {
coupon = consumerCouponService.getById(sOrder.getCouponId());
}
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal integral;
BigDecimal membershipProgress;
BigDecimal integral = BigDecimal.ZERO;
BigDecimal membershipProgress = BigDecimal.ZERO;
if (ObjectUtil.isNotEmpty(coupon) && !coupon.getPlatformType().equals(PlatformTypeEnum.SELF.getCode()) && coupon.getCouponType().equals(CouponTypeEnum.CASH.getCode())) {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
integral = consumerWallet.getRemainingIntegral()
.subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice());
}
membershipProgress = consumerMember.getMembershipProgress()
.subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
......@@ -1286,7 +1293,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
membershipProgress = membershipProgress.subtract(sOrder.getPayPrice());
}
} else {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().subtract(sOrder.getBalance());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
integral = integral.subtract(sOrder.getPayPrice());
......@@ -1294,13 +1303,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
if (ObjectUtil.isNotEmpty(consumerWallet)) {
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(sOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
integralLog.setVariableIntegral(consumerWallet.getRemainingIntegral().subtract(integral));
consumerWallet.setRemainingIntegral(integral);
integralLog.setOperationType(YesNoEnum.no.getIndex());
integralLog.setOperationTime(new Date());
integralLog.setCreateTime(new Date());
integralLogService.save(integralLog);
consumerWallet.setRemainingIntegral(integral);
consumerWalletService.updateById(consumerWallet);
}
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(sOrder.getConsumerId());
memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
......@@ -2463,6 +2477,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setMemberDiscount(BigDecimal.ZERO);
priceResponse.setTotalFee(payPrice);
priceResponse.setTotalFeeNow(payPrice);
// priceResponse.setDiscount(BigDecimal.ZERO);
SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId());
computedCouponPrice(request, priceResponse, user, consumerCoupon);
priceResponse.setDuration(new BigDecimal(0));
......@@ -2475,6 +2490,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
BigDecimal payFee = priceResponse.getPayFee();
BigDecimal divide = priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
if (payFee.compareTo(divide) == 0) {
priceResponse.setDiscount(BigDecimal.ZERO);
}
//总金额乘以折扣比例除以100
priceResponse.setPayFee(divide);
priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
......@@ -2498,7 +2516,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
priceResponse.setPayFee(totalFee);
}
if (ObjectUtil.isEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) {
if (ObjectUtil.isEmpty(consumerWallet) && ObjectUtil.isEmpty(consumerMember)) {
priceResponse.setTotalFeeNow(priceResponse.getPayFee());
priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
}
......@@ -2706,7 +2724,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(item.getPreEndDate().toInstant(), ZoneId.systemDefault()));
if (match && match1
&& item.getDuration().compareTo(BigDecimal.ZERO) == 0
&& (item.getPayPrice().add(item.getBalance())).divide(item.getTotalPrice(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).compareTo(activity.getDiscountRatio()) == 0
&& (item.getPayPrice().add(item.getBalance())).divide(item.getTotalPrice(), 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100)).compareTo(activity.getDiscountRatio()) == 0
) {
i.getAndIncrement();
}
......
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