Commit 74f83a3e by YG8429

添加自动添加权益金定时任务

parent 793ec24d
...@@ -74,6 +74,9 @@ public class OrderTask { ...@@ -74,6 +74,9 @@ public class OrderTask {
@Autowired @Autowired
private ISCleanRecordsService isCleanRecordsService; private ISCleanRecordsService isCleanRecordsService;
@Autowired
private EquityFundExcessService equityFundExcessService;
final int ZERO = 0; final int ZERO = 0;
//10分钟的常量 //10分钟的常量
...@@ -341,6 +344,7 @@ public class OrderTask { ...@@ -341,6 +344,7 @@ public class OrderTask {
if (orders != null && orders.size() > 0) { if (orders != null && orders.size() > 0) {
orders.stream().forEach(sOrder -> { orders.stream().forEach(sOrder -> {
logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单异常"); logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单异常");
equityFundExcessService.extracted(sOrder);
//更改订单状态 //更改订单状态
sOrder.setStatus(OrderStatusEnum.USED.getCode()); sOrder.setStatus(OrderStatusEnum.USED.getCode());
sOrder.setUpdateTime(new Date()); sOrder.setUpdateTime(new Date());
......
...@@ -91,9 +91,6 @@ public class RedisTask { ...@@ -91,9 +91,6 @@ public class RedisTask {
private RoomLabelService roomLabelService; private RoomLabelService roomLabelService;
@Autowired @Autowired
private WechatNewService wechatNewService1;
@Autowired
private SConsumerTokenService sConsumerTokenService; private SConsumerTokenService sConsumerTokenService;
@Autowired @Autowired
...@@ -109,19 +106,11 @@ public class RedisTask { ...@@ -109,19 +106,11 @@ public class RedisTask {
private MemberConfigService memberConfigService; private MemberConfigService memberConfigService;
@Autowired @Autowired
private SharingActivitiesService sharingActivitiesService;
@Autowired
private ISysConfigService sysConfigService; private ISysConfigService sysConfigService;
@Autowired @Autowired
private SConsumerService consumerService;
@Autowired
private EquityFundLogService equityFundLogService; private EquityFundLogService equityFundLogService;
@Autowired
private DurationLogService durationLogService;
@Autowired @Autowired
private EquityFundExcessService equityFundExcessService; private EquityFundExcessService equityFundExcessService;
...@@ -344,7 +333,8 @@ public class RedisTask { ...@@ -344,7 +333,8 @@ public class RedisTask {
redisUtil.delete(o); redisUtil.delete(o);
throw new BaseException("订单不存在!"); throw new BaseException("订单不存在!");
} }
extracted(sOrder);
equityFundExcessService.extracted(sOrder);
if (extracted(o, sOrders, sOrder)) return; if (extracted(o, sOrders, sOrder)) return;
//更改订单状态 //更改订单状态
sOrder.setStatus(OrderStatusEnum.USED.getCode()); sOrder.setStatus(OrderStatusEnum.USED.getCode());
...@@ -382,112 +372,6 @@ public class RedisTask { ...@@ -382,112 +372,6 @@ public class RedisTask {
}); });
logger.debug("AutoAddSCleanRecords:自动添加保洁记录结束"); logger.debug("AutoAddSCleanRecords:自动添加保洁记录结束");
} }
private void extracted(SOrder sOrder) {
//查询是否有上级
LambdaQueryWrapper<SharingActivities> sharingActivitiesLambdaQueryWrapper = new LambdaQueryWrapper<>();
sharingActivitiesLambdaQueryWrapper.eq(SharingActivities::getNewUid, sOrder.getConsumerId());
sharingActivitiesLambdaQueryWrapper.eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex());
SharingActivities sharingActivities = sharingActivitiesService.getOne(sharingActivitiesLambdaQueryWrapper);
if (ObjectUtil.isNotEmpty(sharingActivities)) {
//查询当前用户是否只有一个订单
LambdaQueryWrapper<SOrder> sOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
sOrderLambdaQueryWrapper.eq(SOrder::getConsumerId, sOrder.getConsumerId());
sOrderLambdaQueryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
sOrderLambdaQueryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
sOrderLambdaQueryWrapper.in(SOrder::getStatus, OrderStatusEnum.getValidOrderStatus());
sOrderLambdaQueryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex());
List<SOrder> sOrderList = isOrderService.list(sOrderLambdaQueryWrapper);
if (sOrderList.size() == 1) {
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
if (ObjectUtil.isNotEmpty(consumerWallet)) {
//添加时长
BigDecimal anHour = new BigDecimal(1.0);
BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getRemainingDuration()) ? consumerWallet.getRemainingDuration() : BigDecimal.ZERO;
consumerWallet.setRemainingDuration(accumulateEquityFund.add(anHour));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(consumerWallet.getConsumerId());
durationLog.setVariableDuration(anHour);
durationLog.setCurrentDuration(accumulateEquityFund);
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setOperationTime(DateUtils.getNowDate());
durationLogService.insertDurationLog(durationLog);
consumerWalletService.updateConsumerWallet(consumerWallet);
} else {
//新增钱包
ConsumerWallet newConsumerWallet = new ConsumerWallet();
BigDecimal defaultVlue = new BigDecimal(0.0);
newConsumerWallet.setConsumerId(sharingActivities.getUid());
newConsumerWallet.setBalance(defaultVlue);
newConsumerWallet.setRemainingIntegral(defaultVlue);
newConsumerWallet.setEquityFund(defaultVlue);
newConsumerWallet.setAccumulateEquityFund(defaultVlue);
BigDecimal anHour = new BigDecimal(1.0);
newConsumerWallet.setRemainingDuration(defaultVlue.add(anHour));
newConsumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.insertConsumerWallet(newConsumerWallet);
DurationLog newDurationLog = new DurationLog();
newDurationLog.setConsumerId(consumerWallet.getConsumerId());
newDurationLog.setVariableDuration(anHour);
newDurationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
newDurationLog.setOperationType(YesNoEnum.yes.getIndex());
newDurationLog.setOperationTime(DateUtils.getNowDate());
durationLogService.insertDurationLog(newDurationLog);
}
}
//查询会员用户类型
LambdaQueryWrapper<ConsumerMember> consumerMemberWrapper = new LambdaQueryWrapper<>();
consumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberWrapper);
LambdaQueryWrapper<ConsumerMember> newConsumerMemberQueryWrapper = new LambdaQueryWrapper<>();
newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getNewUid());
ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberQueryWrapper);
if (!(ObjectUtils.isEmpty(newConsumerMember)) && !(ObjectUtils.isEmpty(consumerMember))) {
//判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRights())
&& 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 newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getNewUid().toString());
if (aBoolean && (newAboolean || newConsumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()))) {
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
BigDecimal payPrice = sOrder.getPayPrice();
if (payPrice.signum() > 0) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
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 aEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getEquityFund()) ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
// consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getAccumulateEquityFund()) ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
//添加临时权益金日志记录
String equityFundExc = sysConfigService.selectConfigByKey("sys.equityFundExcess.equityFundExcess");
EquityFundExcess equityFundExcess = new EquityFundExcess();
equityFundExcess.setExpireTime(DateUtils.addDays(new Date(), Integer.parseInt(equityFundExc)));
equityFundExcess.setEquityFund(addEquityFund);
equityFundExcess.setOutTradeNo(sOrder.getOrderNo());
equityFundExcess.setUid(sharingActivities.getUid());
equityFundExcess.setNewUid(sharingActivities.getNewUid());
equityFundExcessService.insertEquityFundExcess(equityFundExcess);
}
}
}
}
}
}
@XxlJob("autoRoomExpireTime") @XxlJob("autoRoomExpireTime")
public void autoRoomExpireTime() { public void autoRoomExpireTime() {
logger.debug("autoRoomExpireTime:房间15分钟续单开始"); logger.debug("autoRoomExpireTime:房间15分钟续单开始");
...@@ -775,7 +659,7 @@ public class RedisTask { ...@@ -775,7 +659,7 @@ public class RedisTask {
.in(ConsumerWallet::getConsumerId, consumerIds)).stream().collect(Collectors.toMap(ConsumerWallet::getConsumerId, item -> item)); .in(ConsumerWallet::getConsumerId, consumerIds)).stream().collect(Collectors.toMap(ConsumerWallet::getConsumerId, item -> item));
List<ConsumerWallet> consumerWalletList = new ArrayList<>(); List<ConsumerWallet> consumerWalletList = new ArrayList<>();
List<EquityFundLog> equityFundLogList = new ArrayList<>(); List<EquityFundLog> equityFundLogList = new ArrayList<>();
List<EquityFundExcess> equityFundExcessList = new ArrayList<>(); List<Long> ids = new ArrayList<>();
list.stream().forEach(item->{ list.stream().forEach(item->{
ConsumerWallet consumerWallet = consumerWalletMap.get(item.getUid()); ConsumerWallet consumerWallet = consumerWalletMap.get(item.getUid());
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(item.getEquityFund())); consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(item.getEquityFund()));
...@@ -791,7 +675,7 @@ public class RedisTask { ...@@ -791,7 +675,7 @@ public class RedisTask {
equityFundLogList.add(equityFundLog); equityFundLogList.add(equityFundLog);
item.setIsDelete(YesNoEnum.yes.getIndex()); item.setIsDelete(YesNoEnum.yes.getIndex());
equityFundExcessList.add(item); ids.add(item.getId());
}); });
if (CollectionUtil.isNotEmpty(consumerWalletList)){ if (CollectionUtil.isNotEmpty(consumerWalletList)){
consumerWalletService.updateBatchById(consumerWalletList); consumerWalletService.updateBatchById(consumerWalletList);
...@@ -799,8 +683,8 @@ public class RedisTask { ...@@ -799,8 +683,8 @@ public class RedisTask {
if (CollectionUtil.isNotEmpty(equityFundLogList)){ if (CollectionUtil.isNotEmpty(equityFundLogList)){
equityFundLogService.saveBatch(equityFundLogList); equityFundLogService.saveBatch(equityFundLogList);
} }
if (CollectionUtil.isNotEmpty(equityFundExcessList)){ if (CollectionUtil.isNotEmpty(ids)){
equityFundExcessService.removeByIds(equityFundExcessList); equityFundExcessService.removeByIds(ids);
} }
logger.debug("AutoProgressLog:权益金增加结束"); logger.debug("AutoProgressLog:权益金增加结束");
} }
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.system.domain.EquityFundExcess; import share.system.domain.EquityFundExcess;
import share.system.domain.SOrder;
import share.system.domain.vo.EquityFundExcessVo; import share.system.domain.vo.EquityFundExcessVo;
/** /**
...@@ -65,4 +66,6 @@ public interface EquityFundExcessService extends IService<EquityFundExcess> ...@@ -65,4 +66,6 @@ public interface EquityFundExcessService extends IService<EquityFundExcess>
List<EquityFundExcessVo> selectEquityFundExcessVoList(Long id); List<EquityFundExcessVo> selectEquityFundExcessVoList(Long id);
TableDataInfo pageList(TableDataInfo dataTable, EquityFundExcessVo equityFundExcess); TableDataInfo pageList(TableDataInfo dataTable, EquityFundExcessVo equityFundExcess);
void extracted(SOrder sOrder);
} }
package share.system.service.impl; package share.system.service.impl;
import java.util.ArrayList; import java.math.BigDecimal;
import java.util.List; import java.math.RoundingMode;
import java.util.Map; import java.util.*;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -13,18 +12,23 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -13,18 +12,23 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.ObjectUtils;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil;
import share.common.enums.OrderStatusEnum;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.RefundStatusEnum;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.system.domain.SConsumer; import share.system.domain.*;
import share.system.domain.vo.EquityFundExcessVo; import share.system.domain.vo.EquityFundExcessVo;
import share.system.domain.vo.EquityFundLogVo; import share.system.domain.vo.EquityFundLogVo;
import share.system.mapper.EquityFundExcessMapper; import share.system.mapper.EquityFundExcessMapper;
import share.system.domain.EquityFundExcess;
import share.system.mapper.SConsumerMapper; import share.system.mapper.SConsumerMapper;
import share.system.service.EquityFundExcessService; import share.system.service.*;
import share.system.service.SConsumerService;
/** /**
* 权益金过度Service业务层处理 * 权益金过度Service业务层处理
...@@ -44,6 +48,36 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap ...@@ -44,6 +48,36 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
@Autowired @Autowired
private SConsumerService sConsumerService; private SConsumerService sConsumerService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private ISOrderService isOrderService;
@Autowired
private ConsumerMemberService consumerMemberService;
@Autowired
private ConsumerWalletService consumerWalletService;
@Autowired
private SharingActivitiesService sharingActivitiesService;
@Autowired
private ISysConfigService sysConfigService;
@Autowired
private DurationLogService durationLogService;
@Autowired
private EquityFundExcessService equityFundExcessService;
/** /**
* 查询权益金过度 * 查询权益金过度
* *
...@@ -202,4 +236,111 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap ...@@ -202,4 +236,111 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
dataTable.setRows(voList); dataTable.setRows(voList);
return dataTable; return dataTable;
} }
@Override
public void extracted(SOrder sOrder) {
//查询是否有上级
LambdaQueryWrapper<SharingActivities> sharingActivitiesLambdaQueryWrapper = new LambdaQueryWrapper<>();
sharingActivitiesLambdaQueryWrapper.eq(SharingActivities::getNewUid, sOrder.getConsumerId());
sharingActivitiesLambdaQueryWrapper.eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex());
SharingActivities sharingActivities = sharingActivitiesService.getOne(sharingActivitiesLambdaQueryWrapper);
if (ObjectUtil.isNotEmpty(sharingActivities)) {
//查询当前用户是否只有一个订单
LambdaQueryWrapper<SOrder> sOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
sOrderLambdaQueryWrapper.eq(SOrder::getConsumerId, sOrder.getConsumerId());
sOrderLambdaQueryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
sOrderLambdaQueryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
sOrderLambdaQueryWrapper.in(SOrder::getStatus, OrderStatusEnum.getValidOrderStatus());
sOrderLambdaQueryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex());
List<SOrder> sOrderList = isOrderService.list(sOrderLambdaQueryWrapper);
if (sOrderList.size() == 1) {
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
if (ObjectUtil.isNotEmpty(consumerWallet)) {
//添加时长
BigDecimal anHour = new BigDecimal(1.0);
BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getRemainingDuration()) ? consumerWallet.getRemainingDuration() : BigDecimal.ZERO;
consumerWallet.setRemainingDuration(accumulateEquityFund.add(anHour));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(consumerWallet.getConsumerId());
durationLog.setVariableDuration(anHour);
durationLog.setCurrentDuration(accumulateEquityFund);
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setOperationTime(DateUtils.getNowDate());
durationLogService.insertDurationLog(durationLog);
consumerWalletService.updateConsumerWallet(consumerWallet);
} else {
//新增钱包
ConsumerWallet newConsumerWallet = new ConsumerWallet();
BigDecimal defaultVlue = new BigDecimal(0.0);
newConsumerWallet.setConsumerId(sharingActivities.getUid());
newConsumerWallet.setBalance(defaultVlue);
newConsumerWallet.setRemainingIntegral(defaultVlue);
newConsumerWallet.setEquityFund(defaultVlue);
newConsumerWallet.setAccumulateEquityFund(defaultVlue);
BigDecimal anHour = new BigDecimal(1.0);
newConsumerWallet.setRemainingDuration(defaultVlue.add(anHour));
newConsumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.insertConsumerWallet(newConsumerWallet);
DurationLog newDurationLog = new DurationLog();
newDurationLog.setConsumerId(consumerWallet.getConsumerId());
newDurationLog.setVariableDuration(anHour);
newDurationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
newDurationLog.setOperationType(YesNoEnum.yes.getIndex());
newDurationLog.setOperationTime(DateUtils.getNowDate());
durationLogService.insertDurationLog(newDurationLog);
}
}
//查询会员用户类型
LambdaQueryWrapper<ConsumerMember> consumerMemberWrapper = new LambdaQueryWrapper<>();
consumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberWrapper);
LambdaQueryWrapper<ConsumerMember> newConsumerMemberQueryWrapper = new LambdaQueryWrapper<>();
newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getNewUid());
ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberQueryWrapper);
if (!(ObjectUtils.isEmpty(newConsumerMember)) && !(ObjectUtils.isEmpty(consumerMember))) {
//判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRights())
&& 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 newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getNewUid().toString());
if (aBoolean && (newAboolean || newConsumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()))) {
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
BigDecimal payPrice = sOrder.getPayPrice();
if (payPrice.signum() > 0) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
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 aEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getEquityFund()) ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
// consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getAccumulateEquityFund()) ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
//添加临时权益金日志记录
String equityFundExc = sysConfigService.selectConfigByKey("sys.equityFundExcess.equityFundExcess");
EquityFundExcess equityFundExcess = new EquityFundExcess();
equityFundExcess.setExpireTime(DateUtils.addDays(new Date(), Integer.parseInt(equityFundExc)));
equityFundExcess.setEquityFund(addEquityFund);
equityFundExcess.setOutTradeNo(sOrder.getOrderNo());
equityFundExcess.setUid(sharingActivities.getUid());
equityFundExcess.setNewUid(sharingActivities.getNewUid());
equityFundExcessService.insertEquityFundExcess(equityFundExcess);
}
}
}
}
}
}
} }
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