Commit b4bd8db2 by 吕明尚

Merge branch 'refs/heads/dev' into test

parents 9d98926c b6c98ee5
...@@ -30,8 +30,7 @@ public class EquityFundLogController extends BaseController { ...@@ -30,8 +30,7 @@ public class EquityFundLogController extends BaseController {
/** /**
* 查询权益金记录列表 * 查询权益金记录列表
*/ */
@PreAuthorize("@ss.hasPermi('system:equityFundLog:list')") @PostMapping("/list")
@GetMapping("/list")
public TableDataInfo list(EquityFundLog equityFundLog) { public TableDataInfo list(EquityFundLog equityFundLog) {
startPage(); startPage();
List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog); List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
...@@ -46,4 +45,15 @@ public class EquityFundLogController extends BaseController { ...@@ -46,4 +45,15 @@ public class EquityFundLogController extends BaseController {
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(equityFundLogService.selectEquityFundLogById(id)); return success(equityFundLogService.selectEquityFundLogById(id));
} }
/**
* 查询权益金记录列表
*/
// @PreAuthorize("@ss.hasPermi('system:equityFundLog:listUid')")
@GetMapping("/listUid/{uid}")
public TableDataInfo equityFundLogListByUid(@PathVariable("uid") Long uid) {
startPage();
List<EquityFundLog> list = equityFundLogService.selectEquityFundLogByUid(uid);
return getDataTable(list);
}
} }
...@@ -361,7 +361,8 @@ public class RedisTask { ...@@ -361,7 +361,8 @@ public class RedisTask {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
//添加时长 //添加时长
BigDecimal anHour = new BigDecimal(1.0); BigDecimal anHour = new BigDecimal(1.0);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(anHour)); BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setRemainingDuration(accumulateEquityFund.add(anHour));
consumerWallet.setUpdateTime(DateUtils.getNowDate()); consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet); consumerWalletService.updateConsumerWallet(consumerWallet);
DurationLog durationLog = new DurationLog(); DurationLog durationLog = new DurationLog();
...@@ -381,7 +382,7 @@ public class RedisTask { ...@@ -381,7 +382,7 @@ public class RedisTask {
newConsumerWallet.setEquityFund(defaultVlue); newConsumerWallet.setEquityFund(defaultVlue);
newConsumerWallet.setAccumulateEquityFund(defaultVlue); newConsumerWallet.setAccumulateEquityFund(defaultVlue);
BigDecimal anHour = new BigDecimal(1.0); BigDecimal anHour = new BigDecimal(1.0);
newConsumerWallet.setRemainingDuration(newConsumerWallet.getRemainingDuration().add(anHour)); newConsumerWallet.setRemainingDuration(defaultVlue.add(anHour));
newConsumerWallet.setUpdateTime(DateUtils.getNowDate()); newConsumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.insertConsumerWallet(newConsumerWallet); consumerWalletService.insertConsumerWallet(newConsumerWallet);
DurationLog newDurationLog = new DurationLog(); DurationLog newDurationLog = new DurationLog();
...@@ -403,18 +404,23 @@ public class RedisTask { ...@@ -403,18 +404,23 @@ public class RedisTask {
//判断是否为权益会员和会员是否有效 //判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRecharge()) && new Date().getTime() < consumerMember.getExpirationDate().getTime() if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRecharge()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
&& YesNoEnum.yes.getIndex().equals(newConsumerMember.getIsRecharge()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) { && YesNoEnum.yes.getIndex().equals(newConsumerMember.getIsRecharge()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString()); Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getUid().toString());
Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getNewUid().toString()); Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getNewUid().toString());
if (aBoolean && newAboolean) { if (aBoolean && newAboolean) {
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);
BigDecimal payPrice = sOrder.getPayPrice(); BigDecimal payPrice = sOrder.getPayPrice();
if (payPrice.signum() > 0) { if (payPrice.signum() > 0) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund"); String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)))); // BigDecimal addEquityFund = payPrice.multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP);
consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund(). BigDecimal addEquityFund = new BigDecimal(99).multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP);
add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)))); BigDecimal aEquityFund = consumerWallet.getEquityFund() != null ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate()); consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet); consumerWalletService.updateConsumerWallet(consumerWallet);
//添加权益金日志记录 //添加权益金日志记录
...@@ -423,7 +429,7 @@ public class RedisTask { ...@@ -423,7 +429,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(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))); equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType("1"); equityFundLog.setEquityFundType("1");
equityFundLog.setOutTradeNo(sOrder.getOutTradeNo()); equityFundLog.setOutTradeNo(sOrder.getOutTradeNo());
equityFundLog.setTerminalTrace(sOrder.getOutTradeNo()); equityFundLog.setTerminalTrace(sOrder.getOutTradeNo());
...@@ -588,7 +594,7 @@ public class RedisTask { ...@@ -588,7 +594,7 @@ public class RedisTask {
@XxlJob("AutoOrderCancelPay") @XxlJob("AutoOrderCancelPay")
public void AutoOrderCancelPay() { public void AutoOrderCancelPay() {
logger.debug("AutoOrderCancelPay:延时订单取消支付开始"); logger.debug("AutoOrderCancelPay:延时订单取消支付开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_CANCEL_PAY + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_CANCEL_PAY.getValue() + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
} }
...@@ -619,7 +625,7 @@ public class RedisTask { ...@@ -619,7 +625,7 @@ public class RedisTask {
@XxlJob("AutoEquityMembersSms") @XxlJob("AutoEquityMembersSms")
public void AutoEquityMembersSms() { public void AutoEquityMembersSms() {
logger.debug("AutoEquityMembersSms:自动发送权益会员过期短信开始"); logger.debug("AutoEquityMembersSms:自动发送权益会员过期短信开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
} }
...@@ -645,7 +651,7 @@ public class RedisTask { ...@@ -645,7 +651,7 @@ public class RedisTask {
@XxlJob("AutoUpdateEquityMembers") @XxlJob("AutoUpdateEquityMembers")
public void AutoUpdateEquityMembers() { public void AutoUpdateEquityMembers() {
logger.debug("AutoUpdateEquityMembers:权益会员降级开始"); logger.debug("AutoUpdateEquityMembers:权益会员降级开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*"); Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + "*");
if (keys.size() == 0) { if (keys.size() == 0) {
return; return;
} }
......
...@@ -59,4 +59,6 @@ public interface EquityFundLogService extends IService<EquityFundLog> ...@@ -59,4 +59,6 @@ public interface EquityFundLogService extends IService<EquityFundLog>
* @return 结果 * @return 结果
*/ */
public int deleteEquityFundLogById(Long id); public int deleteEquityFundLogById(Long id);
List<EquityFundLog> selectEquityFundLogByUid(Long uid);
} }
...@@ -777,29 +777,35 @@ public class CallbackServiceImpl implements CallbackService { ...@@ -777,29 +777,35 @@ public class CallbackServiceImpl implements CallbackService {
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper); ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper);
//判断是否为权益会员和会员是否有效 //判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRights()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()) { if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRights()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString()); Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getUid().toString());
if (aBoolean) { if (aBoolean) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund"); String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
//计算返佣额度 写死 99 测试
BigDecimal addEquityFund = new BigDecimal(99).multiply(new BigDecimal(equityFund)).setScale(2,RoundingMode.HALF_UP);
// BigDecimal addEquityFund = payPrice.multiply(new BigDecimal(equityFund)).setScale(2,RoundingMode.HALF_UP);
//查询上级用户是否有钱包 //查询上级用户是否有钱包
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)) {
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund)))); BigDecimal aEquityFund = consumerWallet.getEquityFund() != null ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund(). consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
add(payPrice.multiply(new BigDecimal(equityFund)))); BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate()); consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet); consumerWalletService.updateConsumerWallet(consumerWallet);
} else { } else {
//新增钱包 //新增钱包
ConsumerWallet newConsumerWallet = new ConsumerWallet(); ConsumerWallet newConsumerWallet = new ConsumerWallet();
BigDecimal defaultVlue = new BigDecimal(0.0); BigDecimal defaultVlue = new BigDecimal(0);
newConsumerWallet.setConsumerId(sharingActivities.getUid()); newConsumerWallet.setConsumerId(sharingActivities.getUid());
newConsumerWallet.setBalance(defaultVlue); newConsumerWallet.setBalance(defaultVlue);
newConsumerWallet.setRemainingIntegral(defaultVlue); newConsumerWallet.setRemainingIntegral(defaultVlue);
newConsumerWallet.setRemainingDuration(defaultVlue); newConsumerWallet.setRemainingDuration(defaultVlue);
newConsumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)))); newConsumerWallet.setEquityFund(defaultVlue
newConsumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund() .add(addEquityFund));
.add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)))); newConsumerWallet.setAccumulateEquityFund(defaultVlue.add(addEquityFund));
consumerWalletService.insertConsumerWallet(newConsumerWallet); consumerWalletService.insertConsumerWallet(newConsumerWallet);
} }
//添加权益金日志记录 //添加权益金日志记录
...@@ -808,7 +814,7 @@ public class CallbackServiceImpl implements CallbackService { ...@@ -808,7 +814,7 @@ public class CallbackServiceImpl implements CallbackService {
//上级用户 //上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid()); SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog(); EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))); equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType(type); equityFundLog.setEquityFundType(type);
equityFundLog.setOutTradeNo(equityOrderNo); equityFundLog.setOutTradeNo(equityOrderNo);
equityFundLog.setTerminalTrace(terminalTrace); equityFundLog.setTerminalTrace(terminalTrace);
......
package share.system.service.impl; package share.system.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -94,4 +96,10 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E ...@@ -94,4 +96,10 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
{ {
return equityFundLogMapper.deleteEquityFundLogById(id); return equityFundLogMapper.deleteEquityFundLogById(id);
} }
@Override
public List<EquityFundLog> selectEquityFundLogByUid(Long id) {
return equityFundLogMapper.selectList(new LambdaQueryWrapper<EquityFundLog>().eq(EquityFundLog::getUid,id));
}
} }
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