Commit cbd79471 by 吕明尚

修改用户信息

parent fc5eb1a1
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.MemberConfig;
@Data
public class MemberConfigVo extends MemberConfig {
//下一级的额度要求
private Long nextLimitRequirements;
//下一级的会员等级
private Long nextMembershipLevel;
//下一级的会员名称
private String nextMembershipName;
}
......@@ -3,7 +3,6 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerMember;
import share.system.domain.ConsumerWallet;
import share.system.domain.MemberConfig;
import share.system.domain.SConsumer;
/**
......@@ -33,6 +32,6 @@ public class SConsumerVo extends SConsumer {
private ConsumerWallet consumerWallet;
private MemberConfig memberConfig;
private MemberConfigVo memberConfig;
}
......@@ -381,6 +381,7 @@ public class CallbackServiceImpl implements CallbackService {
}
break;
case RECHARGE:
logger.debug("开始充值订单支付回调");
Recharge rechargeParam = new Recharge();
rechargeParam.setTerminalTrace(param.getTerminal_trace());
rechargeParam.setConsumerId(attachVo.getUserId());
......@@ -443,6 +444,7 @@ public class CallbackServiceImpl implements CallbackService {
logger.error("微信支付回调出错");
logger.error(e.toString());
}
logger.debug("结束充值订单支付回调");
if (!aFalse) {
logger.error("saobei wechat pay error : 订单更新失败==》" + param.getTerminal_trace());
......@@ -458,6 +460,7 @@ public class CallbackServiceImpl implements CallbackService {
}
break;
case RIGHTS:
logger.debug("开始权益会员订单回调");
EquityMembersOrder equityMembersOrderParam = new EquityMembersOrder();
equityMembersOrderParam.setTerminalTrace(param.getTerminal_trace());
equityMembersOrderParam.setConsumerId(attachVo.getUserId());
......@@ -520,7 +523,7 @@ public class CallbackServiceImpl implements CallbackService {
logger.error("微信支付回调出错");
logger.error(e.toString());
}
logger.debug("结束权益会员订单回调");
if (!aBoolean) {
logger.error("saobei wechat pay error : 订单更新失败==》" + param.getTerminal_trace());
responseVo.setReturn_code(SaobeiStatusEnum.FAIL.getCode());
......
......@@ -2,6 +2,8 @@ package share.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.enums.GiveTypeEnum;
......@@ -26,6 +28,7 @@ import java.util.List;
*/
@Service
public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ConsumerWallet> implements ConsumerWalletService {
private static final Logger logger = LoggerFactory.getLogger(ConsumerWalletServiceImpl.class);
@Autowired
private ConsumerWalletMapper consumerWalletMapper;
......@@ -162,6 +165,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
.eq(MemberConfig::getMemberType, MemberTypeEnum.RECHARGE.getIndex()));
one.setExpirationDate(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
consumerMemberService.updateConsumerMember(one);
logger.debug("修改会员用户");
if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) {
BigDecimal balance = consumerWallet.getBalance().add(recharge.getRechargeAmount()).add(rechargeConf.getGiveAmount());
consumerWallet.setBalance(balance);
......@@ -186,6 +190,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
balanceLog.setOperationTime(new Date());
balanceLog.setCreateTime(new Date());
balanceLogService.save(balanceLog);
logger.debug("新增余额日志");
}
if (consumerWallet.getRemainingDuration().compareTo(new BigDecimal(0)) > 0) {
DurationLog durationLog = new DurationLog();
......@@ -196,6 +201,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setCreateTime(new Date());
durationLogService.save(durationLog);
logger.debug("新增时长日志");
}
if (consumerWallet.getRemainingIntegral().compareTo(new BigDecimal(0)) > 0) {
IntegralLog integralLog = new IntegralLog();
......@@ -206,6 +212,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setCreateTime(new Date());
integralLogService.save(integralLog);
logger.debug("新增积分日志");
}
return i == 1;
}
......
......@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
......@@ -34,6 +36,7 @@ import java.util.*;
*/
@Service
public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrderMapper, EquityMembersOrder> implements EquityMembersOrderService {
private static final Logger logger = LoggerFactory.getLogger(EquityMembersOrderServiceImpl.class);
@Autowired
private EquityMembersOrderMapper equityMembersOrderMapper;
@Autowired
......@@ -158,18 +161,21 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
newConsumerMember.setMembershipProgress(0L);
newConsumerMember.setCreateTime(new Date());
consumerMemberService.save(newConsumerMember);
logger.debug("新增权益会员");
Map<String, String> map = new HashMap<>();
map.put("consumerId", String.valueOf(newConsumerMember.getConsumerId()));
//当前时间加15分钟
map.put("expirationTime", newConsumerMember.getExpirationDate().toString());
JSONObject json = new JSONObject(map);
redisUtil.set(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + equityMembersOrder.getConsumerId(), json.toString());
logger.debug("redis新增权益会员有效期");
} else {
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
//在原来的基础上增加有效期
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, consumerMember.getExpirationDate())),
equityMembersOrderConfig.getValidityPeriod().intValue()));
consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("权益会员原来的基础上增加有效期");
} else {
//修改会员类型为权益会员
consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
......@@ -179,6 +185,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
equityMembersOrderConfig.getValidityPeriod().intValue()));
consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("修改会员类型为权益会员");
}
Map<String, String> map = new HashMap<>();
map.put("consumerId", String.valueOf(consumerMember.getConsumerId()));
......
......@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -37,6 +39,8 @@ import java.util.Objects;
*/
@Service
public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> implements RechargeService {
private static final Logger logger = LoggerFactory.getLogger(RechargeServiceImpl.class);
@Autowired
private RechargeMapper rechargeMapper;
@Autowired
......@@ -161,6 +165,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
consumerMember.setCreateTime(new Date());
consumerMemberService.save(consumerMember);
logger.debug("新增充值会员");
extracted(recharge);
} else {
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, recharge.getConsumerId()));
......@@ -226,6 +231,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
consumerWallet.setRemainingIntegral(new BigDecimal(0));
}
consumerWallet.setCreateTime(new Date());
logger.debug("新增会员钱包");
consumerWalletService.addConsumerWallet(consumerWallet);
}
......
......@@ -20,6 +20,7 @@ import share.common.utils.BaseUtil;
import share.common.utils.DateUtil;
import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.MemberConfigVo;
import share.system.domain.vo.SConsumerVo;
import share.system.mapper.SConsumerMapper;
import share.system.mapper.SStoreConsumerMapper;
......@@ -194,7 +195,18 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
if (ObjectUtil.isNotEmpty(consumerMember)) {
vo.setConsumerMember(consumerMember);
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
vo.setMemberConfig(memberConfig);
MemberConfigVo memberConfigVo = new MemberConfigVo();
BeanUtils.copyProperties(memberConfig, memberConfigVo);
MemberConfig nexMemberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, memberConfig.getMemberType())
.eq(MemberConfig::getMembershipLevel, memberConfig.getMembershipLevel() + 1)
);
if (ObjectUtil.isNotEmpty(nexMemberConfig)) {
memberConfigVo.setNextLimitRequirements(nexMemberConfig.getLimitRequirements());
memberConfigVo.setNextMembershipLevel(nexMemberConfig.getMembershipLevel());
memberConfigVo.setNextMembershipName(nexMemberConfig.getLevelName());
}
vo.setMemberConfig(memberConfigVo);
}
if (ObjectUtil.isNotEmpty(consumerWallet)) {
vo.setConsumerWallet(consumerWallet);
......
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