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 {
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 {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
//添加时长
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.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
......@@ -402,11 +402,15 @@ public class RedisTask {
newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getNewUid());
ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberQueryWrapper);
//判断是否为权益会员和会员是否有效
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()) {
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) {
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);
......@@ -416,9 +420,9 @@ public class RedisTask {
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 = consumerWallet.getEquityFund() != null ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
BigDecimal aEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getEquityFund()) ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
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.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
......@@ -430,7 +434,7 @@ public class RedisTask {
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType("1");
equityFundLog.setEquityFundType(EquityFundTypeEnum.ORDER.getCode());
equityFundLog.setOutTradeNo(sOrder.getOrderNo());
equityFundLog.setTerminalTrace(sOrder.getOutTradeNo());
equityFundLog.setUid(sharingActivities.getUid());
......
......@@ -62,4 +62,5 @@ public interface SharingActivitiesService extends IService<SharingActivities>
public int deleteSharingActivitiesById(Long id);
int selectSharingActivitiesCount(SharingActivities sharingActivities);
}
......@@ -471,7 +471,7 @@ public class CallbackServiceImpl implements CallbackService {
wechatPayInfoService.updateById(wechatInfo);
//新增权益金日志
addEquityFundLog(recharge.getConsumerId(),
recharge.getRechargeAmount(),recharge.getRechargeNo(),recharge.getTerminalTrace(),"0");
recharge.getRechargeAmount(),recharge.getRechargeNo(),recharge.getTerminalTrace(),EquityFundTypeEnum.RECHARGE.getCode());
aFalse = Boolean.TRUE;
} catch (Exception e) {
logger.error("微信支付回调出错");
......@@ -553,7 +553,7 @@ public class CallbackServiceImpl implements CallbackService {
wechatPayInfoService.updateById(equityPayInfo);
//新增权益金日志
addEquityFundLog(equityMembersOrder.getConsumerId(),
equityMembersOrder.getPayPrice(),equityMembersOrder.getEquityOrderNo(),equityMembersOrder.getTerminalTrace(),"1");
equityMembersOrder.getPayPrice(),equityMembersOrder.getEquityOrderNo(),equityMembersOrder.getTerminalTrace(),EquityFundTypeEnum.RIGHTS.getCode());
aBoolean = Boolean.TRUE;
} catch (Exception e) {
logger.error("微信支付回调出错");
......@@ -788,9 +788,9 @@ public class CallbackServiceImpl implements CallbackService {
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>()
.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()));
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));
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
BigDecimal accumulateEquityFund = ObjectUtil.isNotEmpty(consumerWallet.getAccumulateEquityFund()) ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
......
......@@ -254,6 +254,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
vo.setIsManage(true);
}
if (ObjectUtil.isNull(currentUser)) {
throw new BaseException("您的登录已过期,请先登录");
}
......
......@@ -60,6 +60,7 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
@Override
public List<SharingActivities> selectSharingActivitiesList(SharingActivities sharingActivities)
{
return sharingActivitiesMapper.selectSharingActivitiesList(sharingActivities);
}
......@@ -118,6 +119,13 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
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