Commit cc784ee5 by 吕明尚

修改计算订单价格

parent 40953b95
......@@ -159,13 +159,14 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
consumerWallet.setRemainingDuration(duration);
BigDecimal Integral = consumerWallet.getRemainingIntegral().add(rechargeConf.getGiveRatio().multiply(recharge.getRechargeAmount()));
consumerWallet.setRemainingIntegral(Integral);
int i = baseMapper.updateConsumerWallet(consumerWallet);
int i = updateConsumerWallet(consumerWallet);
BalanceLog balanceLog = new BalanceLog();
balanceLog.setConsumerId(consumerWallet.getConsumerId());
balanceLog.setCurrentBalance(consumerWallet.getBalance());
balanceLog.setVariableAmount(recharge.getRechargeAmount().add(rechargeConf.getGiveAmount()));
balanceLog.setOperationType(YesNoEnum.yes.getIndex());
balanceLog.setOperationTime(new Date());
balanceLog.setCreateTime(new Date());
balanceLogService.save(balanceLog);
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(consumerWallet.getConsumerId());
......@@ -173,6 +174,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
durationLog.setVariableDuration(rechargeConf.getGiveDuration());
durationLog.setOperationTime(new Date());
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setCreateTime(new Date());
durationLogService.save(durationLog);
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(consumerWallet.getConsumerId());
......@@ -180,6 +182,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
integralLog.setVariableIntegral(rechargeConf.getGiveRatio().multiply(recharge.getRechargeAmount()));
integralLog.setOperationTime(new Date());
integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setCreateTime(new Date());
integralLogService.save(integralLog);
return i == 1;
}
......
......@@ -158,6 +158,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
newConsumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
equityMembersOrderConfig.getValidityPeriod().intValue()));
newConsumerMember.setMembershipProgress(0L);
newConsumerMember.setCreateTime(new Date());
consumerMemberService.save(newConsumerMember);
Map<String, String> map = new HashMap<>();
map.put("consumerId", String.valueOf(newConsumerMember.getConsumerId()));
......@@ -191,7 +192,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
JSONObject json = new JSONObject(map);
redisUtil.set(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + equityMembersOrder.getConsumerId(), json.toString());
}
equityMembersOrderMapper.updateEquityMembersOrder(equityMembersOrder);
updateEquityMembersOrder(equityMembersOrder);
}
private EquityMembersOrder generatEquityMembersOrder(CreateEquityMembersRequest request, SConsumer user) {
......
......@@ -154,6 +154,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
consumerMember.setMemberConfigId(memberConfig.getId());
consumerMember.setMembershipProgress(0L);
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
consumerMember.setCreateTime(new Date());
consumerMemberService.save(consumerMember);
extracted(recharge);
} else {
......@@ -181,6 +182,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
consumerWallet.setRemainingDuration(rechargeConf.getGiveDuration());
BigDecimal Integral = recharge.getRechargeAmount().multiply(rechargeConf.getGiveRatio());
consumerWallet.setRemainingIntegral(Integral);
consumerWallet.setCreateTime(new Date());
consumerWalletService.addConsumerWallet(consumerWallet);
}
......
......@@ -1953,6 +1953,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(new BigDecimal(0));
}
}
} else {
if (ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getId, consumerMember.getMemberConfigId()));
//总金额乘以折扣比例除以100
priceResponse.setPayFee(priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100)));
priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
priceResponse.setCouponFee(priceResponse.getDiscountFee());
if (ObjectUtil.isNotEmpty(priceResponse.getDiscountFee()) && priceResponse.getTotalFee().compareTo(new BigDecimal(0.00)) > 0) {
priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
} else {
priceResponse.setDiscountRatio(new BigDecimal(0));
}
}
}
} else {
// 判断优惠券是否可以使用
......
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