Commit b4bd8db2 by 吕明尚

Merge branch 'refs/heads/dev' into test

parents 9d98926c b6c98ee5
......@@ -30,8 +30,7 @@ public class EquityFundLogController extends BaseController {
/**
* 查询权益金记录列表
*/
@PreAuthorize("@ss.hasPermi('system:equityFundLog:list')")
@GetMapping("/list")
@PostMapping("/list")
public TableDataInfo list(EquityFundLog equityFundLog) {
startPage();
List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
......@@ -46,4 +45,15 @@ public class EquityFundLogController extends BaseController {
public AjaxResult getInfo(@PathVariable("id") Long 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 {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
//添加时长
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());
consumerWalletService.updateConsumerWallet(consumerWallet);
DurationLog durationLog = new DurationLog();
......@@ -381,7 +382,7 @@ public class RedisTask {
newConsumerWallet.setEquityFund(defaultVlue);
newConsumerWallet.setAccumulateEquityFund(defaultVlue);
BigDecimal anHour = new BigDecimal(1.0);
newConsumerWallet.setRemainingDuration(newConsumerWallet.getRemainingDuration().add(anHour));
newConsumerWallet.setRemainingDuration(defaultVlue.add(anHour));
newConsumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.insertConsumerWallet(newConsumerWallet);
DurationLog newDurationLog = new DurationLog();
......@@ -403,18 +404,23 @@ public class RedisTask {
//判断是否为权益会员和会员是否有效
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()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getNewUid().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());
if (aBoolean && newAboolean) {
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");
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund().
add(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 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());
consumerWalletService.updateConsumerWallet(consumerWallet);
//添加权益金日志记录
......@@ -423,7 +429,7 @@ public class RedisTask {
//上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType("1");
equityFundLog.setOutTradeNo(sOrder.getOutTradeNo());
equityFundLog.setTerminalTrace(sOrder.getOutTradeNo());
......@@ -588,7 +594,7 @@ public class RedisTask {
@XxlJob("AutoOrderCancelPay")
public void 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) {
return;
}
......@@ -619,7 +625,7 @@ public class RedisTask {
@XxlJob("AutoEquityMembersSms")
public void 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) {
return;
}
......@@ -645,7 +651,7 @@ public class RedisTask {
@XxlJob("AutoUpdateEquityMembers")
public void 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) {
return;
}
......
......@@ -59,4 +59,6 @@ public interface EquityFundLogService extends IService<EquityFundLog>
* @return 结果
*/
public int deleteEquityFundLogById(Long id);
List<EquityFundLog> selectEquityFundLogByUid(Long uid);
}
......@@ -777,29 +777,35 @@ public class CallbackServiceImpl implements CallbackService {
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper);
//判断是否为权益会员和会员是否有效
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) {
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>()
.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()));
if (ObjectUtil.isNotEmpty(consumerWallet)) {
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund))));
consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund().
add(payPrice.multiply(new BigDecimal(equityFund))));
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());
consumerWalletService.updateConsumerWallet(consumerWallet);
} else {
//新增钱包
ConsumerWallet newConsumerWallet = new ConsumerWallet();
BigDecimal defaultVlue = new BigDecimal(0.0);
BigDecimal defaultVlue = new BigDecimal(0);
newConsumerWallet.setConsumerId(sharingActivities.getUid());
newConsumerWallet.setBalance(defaultVlue);
newConsumerWallet.setRemainingIntegral(defaultVlue);
newConsumerWallet.setRemainingDuration(defaultVlue);
newConsumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
newConsumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund()
.add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
newConsumerWallet.setEquityFund(defaultVlue
.add(addEquityFund));
newConsumerWallet.setAccumulateEquityFund(defaultVlue.add(addEquityFund));
consumerWalletService.insertConsumerWallet(newConsumerWallet);
}
//添加权益金日志记录
......@@ -808,7 +814,7 @@ public class CallbackServiceImpl implements CallbackService {
//上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType(type);
equityFundLog.setOutTradeNo(equityOrderNo);
equityFundLog.setTerminalTrace(terminalTrace);
......
package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -94,4 +96,10 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
{
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