Commit e084d814 by 吕明尚

Merge branch 'refs/heads/dev' into test

parents 36557988 34be0465
package share.common.enums;
public enum EquityFundTypeEnum {
RECHARGE("0", "充值"),
RIGHTS("1", "权益购买"),
ORDER("2","订单消费"),
ORDER_REFUND("3","订单消费退款"),
WITHDRAW_BALANCE("4","权益金提现到余额"),
WITHDRAW_WX("5","权益金提现到微信"),
;
EquityFundTypeEnum() {
}
EquityFundTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private String code;
private String name;
}
...@@ -50,4 +50,18 @@ public class SharingActivitiesController extends BaseController { ...@@ -50,4 +50,18 @@ public class SharingActivitiesController extends BaseController {
return success(list); return success(list);
} }
/**
* 查询下级数量
* @param sharingActivities
* @return
*/
@GetMapping("/countNum")
public AjaxResult countNum(SharingActivities sharingActivities){
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setUid(user.getId());
return success(sharingActivitiesService.selectSharingActivitiesCount(sharingActivities));
}
} }
...@@ -361,7 +361,7 @@ public class RedisTask { ...@@ -361,7 +361,7 @@ public class RedisTask {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
//添加时长 //添加时长
BigDecimal anHour = new BigDecimal(1.0); BigDecimal anHour = new BigDecimal(1.0);
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO; BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getAccumulateEquityFund()) ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setRemainingDuration(accumulateEquityFund.add(anHour)); consumerWallet.setRemainingDuration(accumulateEquityFund.add(anHour));
consumerWallet.setUpdateTime(DateUtils.getNowDate()); consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet); consumerWalletService.updateConsumerWallet(consumerWallet);
...@@ -402,11 +402,15 @@ public class RedisTask { ...@@ -402,11 +402,15 @@ public class RedisTask {
newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getNewUid()); newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getNewUid());
ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberQueryWrapper); ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberQueryWrapper);
//判断是否为权益会员和会员是否有效 //判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRights()) && new Date().getTime() < consumerMember.getExpirationDate().getTime() if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRights())
&& YesNoEnum.yes.getIndex().equals(newConsumerMember.getIsRights()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) { && new Date().getTime() < consumerMember.getExpirationDate().getTime()
&& ((YesNoEnum.yes.getIndex().equals(newConsumerMember.getIsRights())
&& new Date().getTime() < newConsumerMember.getExpirationDate().getTime())
|| (newConsumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())))
) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getUid().toString()); Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getUid().toString());
Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getNewUid().toString()); Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getNewUid().toString());
if (aBoolean && newAboolean) { if (aBoolean && (newAboolean || newConsumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()))) {
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()); consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper); ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
...@@ -414,11 +418,11 @@ public class RedisTask { ...@@ -414,11 +418,11 @@ public class RedisTask {
if (payPrice.signum() > 0) { if (payPrice.signum() > 0) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund"); String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
BigDecimal addEquityFund = payPrice.multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP); BigDecimal addEquityFund = payPrice.multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP);
// BigDecimal addEquityFund = new BigDecimal(99).multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP); // BigDecimal addEquityFund = new BigDecimal(99).multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP);
BigDecimal aEquityFund = consumerWallet.getEquityFund() != null ? consumerWallet.getEquityFund() : BigDecimal.ZERO; BigDecimal aEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getEquityFund()) ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
consumerWallet.setEquityFund(aEquityFund.add(addEquityFund)); consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO; BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getAccumulateEquityFund()) ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund. consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund)); add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate()); consumerWallet.setUpdateTime(DateUtils.getNowDate());
...@@ -430,7 +434,7 @@ public class RedisTask { ...@@ -430,7 +434,7 @@ public class RedisTask {
SConsumer consumer = consumerService.getById(sharingActivities.getUid()); SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog(); EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(addEquityFund); equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType("1"); equityFundLog.setEquityFundType(EquityFundTypeEnum.ORDER.getCode());
equityFundLog.setOutTradeNo(sOrder.getOrderNo()); equityFundLog.setOutTradeNo(sOrder.getOrderNo());
equityFundLog.setTerminalTrace(sOrder.getOutTradeNo()); equityFundLog.setTerminalTrace(sOrder.getOutTradeNo());
equityFundLog.setUid(sharingActivities.getUid()); equityFundLog.setUid(sharingActivities.getUid());
......
...@@ -62,4 +62,5 @@ public interface SharingActivitiesService extends IService<SharingActivities> ...@@ -62,4 +62,5 @@ public interface SharingActivitiesService extends IService<SharingActivities>
public int deleteSharingActivitiesById(Long id); public int deleteSharingActivitiesById(Long id);
int selectSharingActivitiesCount(SharingActivities sharingActivities);
} }
...@@ -471,7 +471,7 @@ public class CallbackServiceImpl implements CallbackService { ...@@ -471,7 +471,7 @@ public class CallbackServiceImpl implements CallbackService {
wechatPayInfoService.updateById(wechatInfo); wechatPayInfoService.updateById(wechatInfo);
//新增权益金日志 //新增权益金日志
addEquityFundLog(recharge.getConsumerId(), addEquityFundLog(recharge.getConsumerId(),
recharge.getRechargeAmount(),recharge.getRechargeNo(),recharge.getTerminalTrace(),"0"); recharge.getRechargeAmount(),recharge.getRechargeNo(),recharge.getTerminalTrace(),EquityFundTypeEnum.RECHARGE.getCode());
aFalse = Boolean.TRUE; aFalse = Boolean.TRUE;
} catch (Exception e) { } catch (Exception e) {
logger.error("微信支付回调出错"); logger.error("微信支付回调出错");
...@@ -553,7 +553,7 @@ public class CallbackServiceImpl implements CallbackService { ...@@ -553,7 +553,7 @@ public class CallbackServiceImpl implements CallbackService {
wechatPayInfoService.updateById(equityPayInfo); wechatPayInfoService.updateById(equityPayInfo);
//新增权益金日志 //新增权益金日志
addEquityFundLog(equityMembersOrder.getConsumerId(), addEquityFundLog(equityMembersOrder.getConsumerId(),
equityMembersOrder.getPayPrice(),equityMembersOrder.getEquityOrderNo(),equityMembersOrder.getTerminalTrace(),"1"); equityMembersOrder.getPayPrice(),equityMembersOrder.getEquityOrderNo(),equityMembersOrder.getTerminalTrace(),EquityFundTypeEnum.RIGHTS.getCode());
aBoolean = Boolean.TRUE; aBoolean = Boolean.TRUE;
} catch (Exception e) { } catch (Exception e) {
logger.error("微信支付回调出错"); logger.error("微信支付回调出错");
...@@ -788,9 +788,9 @@ public class CallbackServiceImpl implements CallbackService { ...@@ -788,9 +788,9 @@ public class CallbackServiceImpl implements CallbackService {
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>() ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>()
.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid())); .eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()));
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
BigDecimal aEquityFund = consumerWallet.getEquityFund() != null ? consumerWallet.getEquityFund() : BigDecimal.ZERO; BigDecimal aEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getEquityFund()) ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
consumerWallet.setEquityFund(aEquityFund.add(addEquityFund)); consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO; BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getAccumulateEquityFund()) ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund. consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund)); add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate()); consumerWallet.setUpdateTime(DateUtils.getNowDate());
......
...@@ -254,6 +254,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -254,6 +254,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
vo.setIsManage(true); vo.setIsManage(true);
} }
if (ObjectUtil.isNull(currentUser)) { if (ObjectUtil.isNull(currentUser)) {
throw new BaseException("您的登录已过期,请先登录"); throw new BaseException("您的登录已过期,请先登录");
} }
......
...@@ -501,6 +501,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -501,6 +501,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
aConsumerWallet.setEquityFund(aConsumerWallet.getEquityFund().subtract(equityFundLog.getEquityFund())); aConsumerWallet.setEquityFund(aConsumerWallet.getEquityFund().subtract(equityFundLog.getEquityFund()));
aConsumerWallet.setAccumulateEquityFund(aConsumerWallet.getAccumulateEquityFund().subtract(equityFundLog.getEquityFund())); aConsumerWallet.setAccumulateEquityFund(aConsumerWallet.getAccumulateEquityFund().subtract(equityFundLog.getEquityFund()));
consumerWalletService.updateConsumerWallet(aConsumerWallet); consumerWalletService.updateConsumerWallet(aConsumerWallet);
equityFundLog.setEquityFundType(EquityFundTypeEnum.ORDER_REFUND.getCode());
equityFundLog.setEquityFund(equityFundLog.getEquityFund().negate()); equityFundLog.setEquityFund(equityFundLog.getEquityFund().negate());
equityFundLogService.insertEquityFundLog(equityFundLog); equityFundLogService.insertEquityFundLog(equityFundLog);
} }
...@@ -2525,6 +2526,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2525,6 +2526,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setMemberDiscount(payPrice.subtract(totalFee)); priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
// priceResponse.setTotalFeeNow(totalFee); // priceResponse.setTotalFeeNow(totalFee);
priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100))); priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember);
} }
} else { } else {
...@@ -2541,6 +2543,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2541,6 +2543,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setTotalFeeNow(totalFee); priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(payPrice.subtract(totalFee)); priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100))); priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
} }
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId); // totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
...@@ -2557,6 +2560,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2557,6 +2560,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setTotalFeeNow(totalFee); priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(payPrice.subtract(totalFee)); priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100))); priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember);
} }
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room); // totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
...@@ -2576,6 +2580,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2576,6 +2580,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setTotalFeeNow(totalFee); priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(payPrice.subtract(totalFee)); priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100))); priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
} }
...@@ -2596,11 +2601,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2596,11 +2601,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// } else { // } else {
// priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100))); // priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
// } // }
if (ObjectUtil.isNotEmpty(priceResponse.getDiscountFee()) && priceResponse.getTotalFee().compareTo(new BigDecimal(0.00)) > 0) { // 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))); // priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
} else { // } else {
priceResponse.setDiscountRatio(new BigDecimal(0)); // priceResponse.setDiscountRatio(new BigDecimal(0));
} // }
} else { } else {
// 判断优惠券是否可以使用 // 判断优惠券是否可以使用
if (Objects.nonNull(user) && Objects.nonNull(request.getCouponId())) { if (Objects.nonNull(user) && Objects.nonNull(request.getCouponId())) {
...@@ -2615,28 +2620,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2615,28 +2620,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setRemainingBalance(new BigDecimal(0)); priceResponse.setRemainingBalance(new BigDecimal(0));
priceResponse.setRemainingDuration(new BigDecimal(0)); priceResponse.setRemainingDuration(new BigDecimal(0));
if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) { if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) {
if (ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())); MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
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()));
priceResponse.setTotalFeeNow(divide);
priceResponse.setMemberDiscount(payFee.subtract(divide));
// 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));
}
}
if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (consumerWallet.getBalance().compareTo(priceResponse.getPayFee()) >= 0) { if (consumerWallet.getBalance().compareTo(priceResponse.getPayFee()) >= 0) {
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()));
priceResponse.setTotalFeeNow(divide);
priceResponse.setMemberDiscount(payFee.subtract(divide));
priceResponse.setBalance(priceResponse.getPayFee()); priceResponse.setBalance(priceResponse.getPayFee());
priceResponse.setRemainingBalance(consumerWallet.getBalance().subtract(priceResponse.getPayFee())); priceResponse.setRemainingBalance(consumerWallet.getBalance().subtract(priceResponse.getPayFee()));
totalFee = new BigDecimal(0); totalFee = new BigDecimal(0);
...@@ -2645,7 +2642,28 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2645,7 +2642,28 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
totalFee = priceResponse.getPayFee().subtract(consumerWallet.getBalance()); totalFee = priceResponse.getPayFee().subtract(consumerWallet.getBalance());
} }
priceResponse.setPayFee(totalFee); priceResponse.setPayFee(totalFee);
priceResponse.setTotalFeeNow(totalFee);
if (priceResponse.getPayFee().compareTo(BigDecimal.ZERO) > 0) {
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()));
priceResponse.setTotalFeeNow(divide);
priceResponse.setMemberDiscount(payFee.subtract(divide));
// 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));
// }
}
} }
// priceResponse.setDiscount(priceResponse.getPayFee().divide(priceResponse.getTotalFeeNow(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
if (ObjectUtil.isEmpty(consumerWallet) && ObjectUtil.isEmpty(consumerMember)) { if (ObjectUtil.isEmpty(consumerWallet) && ObjectUtil.isEmpty(consumerMember)) {
priceResponse.setTotalFeeNow(priceResponse.getPayFee()); priceResponse.setTotalFeeNow(priceResponse.getPayFee());
priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(priceResponse.getPayFee())); priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
...@@ -2656,11 +2674,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2656,11 +2674,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee())); priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
if (ObjectUtil.isNotEmpty(priceResponse.getDiscountFee()) && priceResponse.getTotalFee().compareTo(new BigDecimal(0.00)) > 0) { // 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))); // priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
} else { // } else {
priceResponse.setDiscountRatio(new BigDecimal(0)); // priceResponse.setDiscountRatio(new BigDecimal(0));
} // }
} }
return priceResponse; return priceResponse;
} }
......
...@@ -60,6 +60,7 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM ...@@ -60,6 +60,7 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
@Override @Override
public List<SharingActivities> selectSharingActivitiesList(SharingActivities sharingActivities) public List<SharingActivities> selectSharingActivitiesList(SharingActivities sharingActivities)
{ {
return sharingActivitiesMapper.selectSharingActivitiesList(sharingActivities); return sharingActivitiesMapper.selectSharingActivitiesList(sharingActivities);
} }
...@@ -118,6 +119,13 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM ...@@ -118,6 +119,13 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
return sharingActivitiesMapper.deleteSharingActivitiesById(id); return sharingActivitiesMapper.deleteSharingActivitiesById(id);
} }
@Override
public int selectSharingActivitiesCount(SharingActivities sharingActivities) {
return sharingActivitiesMapper.selectCount(new LambdaQueryWrapper<SharingActivities>()
.eq(SharingActivities::getUid,sharingActivities.getUid())
.eq(SharingActivities::getIsDelete,YesNoEnum.no.getIndex()));
}
} }
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