Commit 739e74c2 by 吕明尚

修改用户会员字段,修改会员配置字段

parent 6e26c088
......@@ -659,16 +659,16 @@ public class RedisTask {
consumerMember.setIsRights(YesNoEnum.no.getIndex());
if (ObjectUtil.isNotEmpty(consumerMember)) {
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), 100));
} else {
consumerMember.setMemberType(MemberTypeEnum.NORMAL.getIndex());
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), 100));
}
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
);
consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), memberConfigServiceOne.getValidityPeriod().intValue()));
// MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
//// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
// );
// consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
// consumerMember.setExpirationDate(DateUtils.addYears(new Date(), memberConfigServiceOne.getValidityPeriod().intValue()));
consumerMemberService.updateConsumerMember(consumerMember);
}
redisUtil.delete(key);
......@@ -705,7 +705,7 @@ public class RedisTask {
return;
}
//查询会员配置
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
final BigDecimal[] sum = {BigDecimal.ZERO};
//计算扣除进度
memberProgressLogs.stream().forEach(log -> {
......@@ -720,11 +720,6 @@ public class RedisTask {
//设置为0
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setMembershipLevel(0L);
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
);
consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
//判断会员进度是否大于扣除进度
} else if (consumerMember.getMembershipProgress().compareTo(sum[0].abs()) >= 0) {
//会员进度减去扣除进度
......@@ -739,11 +734,6 @@ public class RedisTask {
//等级降一级
if (consumerMember.getMembershipLevel() > 0L) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1);
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
);
consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
}
}
}
......
......@@ -38,17 +38,17 @@ public class ConsumerMember extends BaseEntity {
@Excel(name = "会员等级")
private Long membershipLevel;
/**
* 会员类型
*/
@Excel(name = "会员类型")
private Long memberType;
// /**
// * 会员类型
// */
// @Excel(name = "会员类型")
// private Long memberType;
/**
* 会员配置id
*/
@Excel(name = "会员配置id")
private Long memberConfigId;
// /**
// * 会员配置id
// */
// @Excel(name = "会员配置id")
// private Long memberConfigId;
/**
* 会员有效期
......
......@@ -32,11 +32,11 @@ public class MemberConfig extends BaseEntity {
@Excel(name = "会员等级")
private Long membershipLevel;
/**
* 会员类型
*/
@Excel(name = "会员类型")
private Long memberType;
// /**
// * 会员类型
// */
// @Excel(name = "会员类型")
// private Long memberType;
/**
* 等级名称
......@@ -56,17 +56,17 @@ public class MemberConfig extends BaseEntity {
@Excel(name = "折扣比例")
private BigDecimal discountRatio;
/**
* 会员有效期
*/
@Excel(name = "会员有效期")
private Long validityPeriod;
// /**
// * 会员有效期
// */
// @Excel(name = "会员有效期")
// private Long validityPeriod;
/**
* 会员进度
*/
@Excel(name = "会员进度")
private Long membershipProgress;
// /**
// * 会员进度
// */
// @Excel(name = "会员进度")
// private Long membershipProgress;
/**
* 是否删除
......@@ -82,12 +82,11 @@ public class MemberConfig extends BaseEntity {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("membershipLevel", getMembershipLevel())
.append("memberType", getMemberType())
.append("levelName", getLevelName())
.append("limitRequirements", getLimitRequirements())
.append("discountRatio", getDiscountRatio())
.append("validityPeriod", getValidityPeriod())
.append("membershipProgress", getMembershipProgress())
// .append("validityPeriod", getValidityPeriod())
// .append("membershipProgress", getMembershipProgress())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
......
......@@ -10,6 +10,8 @@ import com.cronutils.model.time.ExecutionTime;
import com.cronutils.parser.CronParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.enums.MemberTypeEnum;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import share.common.utils.StringUtils;
import share.common.utils.bean.BeanUtils;
......@@ -146,8 +148,15 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
Cron cron = cronParser.parse(item.getCronExpression());
ExecutionTime executionTime = ExecutionTime.forCron(cron);
boolean match = executionTime.isMatch(ZonedDateTime.ofInstant(day.toInstant(), ZoneId.systemDefault()));
if (match && consumerMember.getMemberType().equals(item.getMemberType())) {
if (match) {
ActivityVo activityVo = new ActivityVo();
activityVo.setMemberType(MemberTypeEnum.NORMAL.getIndex());
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
activityVo.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
activityVo.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
}
BeanUtils.copyProperties(item, activityVo);
voList.add(activityVo);
}
......
......@@ -776,7 +776,7 @@ public class CallbackServiceImpl implements CallbackService {
consumerMemberLambdaQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper);
//判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRecharge()) && 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());
if (aBoolean) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
......
......@@ -138,7 +138,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
public boolean addConsumerWallet(ConsumerWallet consumerWallet) {
int i = consumerWalletMapper.insertConsumerWallet(consumerWallet);
ConsumerMember one = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, consumerWallet.getConsumerId()));
MemberConfig memberConfig = memberConfigService.getById(one.getMemberConfigId());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, one.getMembershipLevel()));
if (consumerWallet.getBalance().compareTo(new BigDecimal(0)) > 0) {
BalanceLog balanceLog = new BalanceLog();
balanceLog.setConsumerId(consumerWallet.getConsumerId());
......@@ -175,14 +175,20 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
}
if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
}
memberProgressLogService.save(memberProgressLog);
MemberConfig newOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, one.getMemberType())
// .eq(MemberConfig::getMemberType, one.getMemberType())
.eq(MemberConfig::getMembershipLevel, one.getMembershipLevel() + 1L));
if (ObjectUtil.isNotEmpty(newOne) && one.getMembershipProgress().compareTo(BigDecimal.valueOf(newOne.getLimitRequirements())) >= 0) {
one.setMembershipLevel(one.getMembershipLevel() + 1L);
one.setMemberConfigId(newOne.getId());
// one.setMemberConfigId(newOne.getId());
consumerMemberService.updateConsumerMember(one);
}
logger.debug("统计累计积分");
......@@ -199,11 +205,12 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
BigDecimal oldIntegral = consumerWallet.getRemainingIntegral();
RechargeConf rechargeConf = rechargeConfService.selectRechargeConfById(recharge.getRechargeConfId());
if (one.getMemberType().equals(MemberTypeEnum.RECHARGE.getIndex())) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMembershipLevel, one.getMembershipLevel())
.eq(MemberConfig::getMemberType, MemberTypeEnum.RECHARGE.getIndex()));
one.setExpirationDate(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
// MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
// .eq(MemberConfig::getMembershipLevel, one.getMembershipLevel())
// .eq(MemberConfig::getMemberType, MemberTypeEnum.RECHARGE.getIndex())
// );
one.setExpirationDate(DateUtils.addYears(new Date(), 1));
}
logger.debug("修改会员用户");
......@@ -261,20 +268,26 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), memberConfigService.getById(one.getMemberConfigId()).getValidityPeriod().intValue()));
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
}
if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
}
memberProgressLogService.save(memberProgressLog);
one.setMembershipProgress(one.getMembershipProgress().add(divide));
}
//查询当前会员类型和下一级的会员配置
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, one.getMemberType())
// .eq(MemberConfig::getMemberType, one.getMemberType())
.eq(MemberConfig::getMembershipLevel, one.getMembershipLevel() + 1L));
if (ObjectUtil.isNotEmpty(memberConfigServiceOne)) {
//判断是否升级
if (one.getMembershipProgress().compareTo(BigDecimal.valueOf(memberConfigServiceOne.getLimitRequirements())) >= 0) {
one.setMembershipLevel(one.getMembershipLevel() + 1L);
one.setMemberConfigId(memberConfigServiceOne.getId());
// one.setMemberConfigId(memberConfigServiceOne.getId());
}
}
consumerMemberService.updateConsumerMember(one);
......@@ -317,7 +330,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
List<Long> ids = orderList.stream().map(SOrder::getCouponId).filter(Objects::nonNull).collect(Collectors.toList());
if (CollectionUtil.isEmpty(ids)) {
logger.debug("优惠券为空");
if (one.getMemberType().equals(MemberTypeEnum.RECHARGE.getIndex())) {
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
return;
}
} else {
......@@ -332,7 +345,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
});
}
logger.debug("优惠券购买金额:" + consumption[0]);
if (one.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
//orderList累加payPrice
consumption[0] = consumption[0].add(orderList.stream().map(SOrder::getPayPrice).reduce(BigDecimal.ZERO, BigDecimal::add));
logger.debug("订单实付金额:" + consumption[0]);
......@@ -353,10 +366,16 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
}
if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
}
if (memberProgressLogService.save(memberProgressLog) && integralLogService.save(integralLog)) {
List<MemberConfig> list = memberConfigService.list(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, one.getMemberType())
// .eq(MemberConfig::getMemberType, one.getMemberType())
.orderBy(true, false, MemberConfig::getMembershipLevel));
//转Map limitRequirements,MemberConfig
Map<Long, MemberConfig> memberConfigMap = list.stream().collect(Collectors.toMap(MemberConfig::getMembershipLevel, Function.identity()));
......@@ -366,7 +385,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
consumption[0].compareTo(BigDecimal.valueOf(memberConfigMap.get(entry.getKey() + 1).getLimitRequirements())) < 0
&& entry.getKey().compareTo(Collections.max(memberConfigMap.keySet())) < 0) {
one.setMembershipLevel(entry.getKey());
one.setMemberConfigId(entry.getValue().getId());
// one.setMemberConfigId(entry.getValue().getId());
one.setMembershipProgress(consumption[0].add(one.getMembershipProgress()));
consumerMemberService.updateConsumerMember(one);
consumerWallet.setRemainingIntegral(consumerWallet.getRemainingIntegral().add(consumption[0]));
......@@ -374,7 +393,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
return;
} else if (consumption[0].compareTo(BigDecimal.valueOf(memberConfigMap.get(Collections.max(memberConfigMap.keySet())).getLimitRequirements())) >= 0) {
one.setMembershipLevel(Collections.max(memberConfigMap.keySet()));
one.setMemberConfigId(memberConfigMap.get(Collections.max(memberConfigMap.keySet())).getId());
// one.setMemberConfigId(memberConfigMap.get(Collections.max(memberConfigMap.keySet())).getId());
one.setMembershipProgress(consumption[0].add(one.getMembershipProgress()));
consumerMemberService.updateConsumerMember(one);
consumerWallet.setRemainingIntegral(consumerWallet.getRemainingIntegral().add(consumption[0]));
......@@ -391,7 +410,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
public void accumulatedConsumptionStatistics(Long consumerId) {
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, consumerId));
ConsumerMember one = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, consumerId));
MemberConfig memberConfig = memberConfigService.getById(one.getMemberConfigId());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, one.getMembershipLevel()));
accumulatedConsumptionStatistics(consumerWallet, one, memberConfig);
}
}
......@@ -11,7 +11,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.MemberTypeEnum;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
......@@ -141,7 +140,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
}
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>()
.eq(ConsumerMember::getConsumerId, user.getId())
.eq(ConsumerMember::getMemberType, MemberTypeEnum.RIGHTS.getIndex())
// .eq(ConsumerMember::getMemberType, MemberTypeEnum.RIGHTS.getIndex())
);
if (ObjectUtil.isNotEmpty(consumerMember)) {
Date expirationDate = consumerMember.getExpirationDate();
......@@ -173,11 +172,11 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
ConsumerMember newConsumerMember = new ConsumerMember();
newConsumerMember.setConsumerId(equityMembersOrder.getConsumerId());
newConsumerMember.setMembershipLevel(equityMembersOrderConfig.getDefaultLevel());
newConsumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
// newConsumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMembershipLevel, equityMembersOrderConfig.getDefaultLevel())
.eq(MemberConfig::getMemberType, MemberTypeEnum.RIGHTS.getIndex()));
newConsumerMember.setMemberConfigId(memberConfig.getId());
.eq(MemberConfig::getMembershipLevel, equityMembersOrderConfig.getDefaultLevel()));
// .eq(MemberConfig::getMemberType, MemberTypeEnum.RIGHTS.getIndex()));
// newConsumerMember.setMemberConfigId(memberConfig.getId());
newConsumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
equityMembersOrderConfig.getValidityPeriod().intValue()));
newConsumerMember.setMembershipProgress(equityMembersOrderConfig.getGiftPoints());
......@@ -189,7 +188,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Math.toIntExact(memberConfig.getValidityPeriod())));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
memberProgressLogService.save(memberProgressLog);
}
newConsumerMember.setCreateTime(new Date());
......@@ -206,21 +205,22 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
} else {
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
.eq(MemberConfig::getMemberType, MemberTypeEnum.RIGHTS.getIndex()));
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
// .eq(MemberConfig::getMemberType, MemberTypeEnum.RIGHTS.getIndex())
);
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
//在原来的基础上增加有效期
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, consumerMember.getExpirationDate())),
memberConfigServiceOne.getValidityPeriod().intValue()));
1));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember, consumerWallet, memberConfigServiceOne);
consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("权益会员原来的基础上增加有效期");
} else {
consumerMember.setIsRights(YesNoEnum.yes.getIndex());
//修改会员类型为权益会员
consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
// consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
// consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
memberConfigServiceOne.getValidityPeriod().intValue()));
1));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember, consumerWallet, memberConfigServiceOne);
consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("修改会员类型为权益会员");
......@@ -267,7 +267,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Math.toIntExact(memberConfigServiceOne.getValidityPeriod())));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(equityMembersOrder.getConsumerId());
......@@ -283,13 +283,13 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
}
//查询当前会员类型和下一级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel() + 1L));
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
if (ObjectUtil.isNotEmpty(one) && consumerMember.getMembershipProgress().compareTo(BigDecimal.valueOf(one.getLimitRequirements())) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
consumerMember.setMemberConfigId(one.getId());
// consumerMember.setMemberConfigId(one.getId());
}
}
}
......
......@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import share.common.enums.GiveTypeEnum;
import share.common.enums.MemberTypeEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
......@@ -158,13 +157,14 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
ConsumerMember consumerMember = new ConsumerMember();
consumerMember.setConsumerId(recharge.getConsumerId());
consumerMember.setMembershipLevel(0L);
consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
// consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMembershipLevel, 0L)
.eq(MemberConfig::getMemberType, MemberTypeEnum.RECHARGE.getIndex()));
consumerMember.setMemberConfigId(memberConfig.getId());
// .eq(MemberConfig::getMemberType, MemberTypeEnum.RECHARGE.getIndex())
);
// consumerMember.setMemberConfigId(memberConfig.getId());
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), memberConfig.getValidityPeriod().intValue()));
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), 100));
consumerMember.setCreateTime(new Date());
consumerMember.setIsRecharge(YesNoEnum.yes.getIndex());
consumerMemberService.save(consumerMember);
......@@ -172,9 +172,9 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
extracted(recharge);
} else {
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, recharge.getConsumerId()));
if (one.getMemberType().equals(MemberTypeEnum.RECHARGE.getIndex())) {
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
consumerWalletService.editConsumerWallet(consumerWallet, recharge, one);
} else if (one.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
} else if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
if (ObjectUtil.isEmpty(consumerWallet)) {
extracted(recharge);
} else {
......
......@@ -201,11 +201,11 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, currentUser.getId()));
if (ObjectUtil.isNotEmpty(consumerMember)) {
vo.setConsumerMember(consumerMember);
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
MemberConfigVo memberConfigVo = new MemberConfigVo();
BeanUtils.copyProperties(memberConfig, memberConfigVo);
MemberConfig nexMemberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, memberConfig.getMemberType())
// .eq(MemberConfig::getMemberType, memberConfig.getMemberType())
.eq(MemberConfig::getMembershipLevel, memberConfig.getMembershipLevel() + 1)
);
if (ObjectUtil.isNotEmpty(nexMemberConfig)) {
......
......@@ -1138,7 +1138,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance())
.add(coupon.getCouponPayPrice());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
integral = integral.add(sOrder.getPayPrice());
membershipProgress = membershipProgress.add(sOrder.getPayPrice());
}
......@@ -1147,7 +1147,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
integral = consumerWallet.getRemainingIntegral().add(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().add(sOrder.getBalance());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
integral = integral.add(sOrder.getPayPrice());
membershipProgress = membershipProgress.add(sOrder.getPayPrice());
}
......@@ -1169,41 +1169,41 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
//查询当前会员类型和下一级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel() + 1L));
if (consumerMember.getMemberType().equals(MemberTypeEnum.NORMAL.getIndex())) {
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
// consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
consumerMember.setMemberConfigId(one.getId());
// consumerMember.setMemberConfigId(one.getId());
}
} else if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
consumerMember.setMemberConfigId(one.getId());
}
}
} else {
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
// consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
consumerMember.setMemberConfigId(one.getId());
// consumerMember.setMemberConfigId(one.getId());
}
}
}
// if (ObjectUtil.isNotEmpty(one)) {
// //判断是否升级
// if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) >= 0) {
// consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
// consumerMember.setMemberConfigId(one.getId());
// }
//
// }
memberProgressLog.setVariableProgress(membershipProgress.subtract(consumerMember.getMembershipProgress()));
consumerMember.setMembershipProgress(membershipProgress);
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(),
Math.toIntExact(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().
eq(MemberConfig::getId, consumerMember.getMemberConfigId())).getValidityPeriod())));
if (!consumerMember.getMemberType().equals(MemberTypeEnum.NORMAL.getIndex())) {
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex()) || consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLogService.save(memberProgressLog);
consumerMemberService.updateConsumerMember(consumerMember);
}
......@@ -1296,7 +1296,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
membershipProgress = consumerMember.getMembershipProgress()
.subtract(sOrder.getBalance()).subtract(coupon.getCouponPayPrice());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
integral = integral.subtract(sOrder.getPayPrice());
membershipProgress = membershipProgress.subtract(sOrder.getPayPrice());
}
......@@ -1305,7 +1305,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getBalance());
}
membershipProgress = consumerMember.getMembershipProgress().subtract(sOrder.getBalance());
if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
integral = integral.subtract(sOrder.getPayPrice());
membershipProgress = membershipProgress.subtract(sOrder.getPayPrice());
}
......@@ -1328,53 +1328,59 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
//查询当前会员类型和当前等级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
if (consumerMember.getMemberType().equals(MemberTypeEnum.NORMAL.getIndex())) {
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
if (consumerMember.getMembershipLevel().compareTo(0L) > 0) {
consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())).getId());
}
}
} else if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
if (consumerMember.getMembershipLevel().compareTo(0L) > 0) {
consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())).getId());
}
}
}
} else {
// if (consumerMember.getMemberType().equals(MemberTypeEnum.NORMAL.getIndex())) {
// if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
// if (consumerMember.getMembershipLevel().compareTo(0L) > 0) {
// consumerMember.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
// if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
// consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
// consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())).getId());
// }
// }
// } else if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
// if (consumerMember.getMembershipLevel().compareTo(0L) > 0) {
// consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
// if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
// consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
// consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())).getId());
// }
// }
// }
// } else {
if (consumerMember.getMembershipLevel().compareTo(0L) > 0) {
if (ObjectUtil.isNotEmpty(one)) {
//判断是否升级
if (ObjectUtil.isNotEmpty(one) && membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())).getId());
// consumerMember.setMemberConfigId(memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())).getId());
}
}
}
}
memberProgressLog.setVariableProgress(consumerMember.getMembershipProgress().subtract(membershipProgress));
consumerMember.setMembershipProgress(membershipProgress);
memberProgressLog.setOperationType(YesNoEnum.no.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setCreateTime(new Date());
Long validityPeriod = memberConfigService.getById(consumerMember.getMemberConfigId()).getValidityPeriod();
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), validityPeriod.intValue()));
if (!consumerMember.getMemberType().equals(MemberTypeEnum.NORMAL.getIndex()) && membershipProgress.compareTo(BigDecimal.ZERO) >= 0) {
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
}
if ((consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) || consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex()))
&& membershipProgress.compareTo(BigDecimal.ZERO) >= 0) {
memberProgressLogService.save(memberProgressLog);
consumerMemberService.updateConsumerMember(consumerMember);
}
......@@ -2422,7 +2428,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
if (ObjectUtil.isNotEmpty(consumerMember)) {
queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex());
queryWrapper.eq(Activity::getMemberType, consumerMember.getMemberType());
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.NORMAL.getIndex());
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex());
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RIGHTS.getIndex());
}
}
if (ObjectUtil.isNotEmpty(consumerWallet)) {
priceResponse.setAvailableBalance(consumerWallet.getBalance());
......@@ -2539,7 +2552,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setRemainingDuration(new BigDecimal(0));
if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) {
if (ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getId, consumerMember.getMemberConfigId()));
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
BigDecimal payFee = priceResponse.getPayFee();
BigDecimal divide = priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
......@@ -2591,7 +2604,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private BigDecimal getBigDecimal(ConsumerWallet consumerWallet, Activity activity, BigDecimal timeLong,
ComputedOrderPriceResponse priceResponse, BigDecimal totalFee, SRoom room, OrderComputedPriceRequest request, ConsumerMember consumerMember) {
if (ObjectUtil.isNotEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
priceResponse.setDuration(BigDecimal.ZERO);
priceResponse.setRemainingDuration(BigDecimal.ZERO);
......@@ -2756,7 +2769,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private BigDecimal getBigDecimal(OrderComputedPriceRequest request, Activity activity, BigDecimal payPrice, SConsumer user, ConsumerMember consumerMember) {
if (ObjectUtil.isNotEmpty(user)) {
MemberConfig memberConfig = memberConfigService.getById(consumerMember.getMemberConfigId());
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
if (ObjectUtil.isNotEmpty(activity)) {
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
Cron cron = cronParser.parse(activity.getCronExpression());
......
......@@ -11,8 +11,8 @@
<result property="phone" column="phone"/>
<result property="avatar" column="avatar"/>
<result property="membershipLevel" column="membership_level"/>
<result property="memberType" column="member_type"/>
<result property="memberConfigId" column="member_config_id"/>
<!-- <result property="memberType" column="member_type"/>-->
<!-- <result property="memberConfigId" column="member_config_id"/>-->
<result property="expirationDate" column="expiration_date"/>
<result property="membershipProgress" column="membership_progress"/>
<result property="isRecharge" column="is_recharge"/>
......@@ -29,8 +29,6 @@
select id,
consumer_id,
membership_level,
member_type,
member_config_id,
expiration_date,
membership_progress,
is_recharge,
......@@ -51,8 +49,6 @@
c.phone,
c.avatar,
m. membership_level,
m.member_type,
m.member_config_id,
m.expiration_date,
m.membership_progress,
m.is_recharge,
......@@ -71,8 +67,6 @@
</if>
<if test="consumerId != null ">and m.consumer_id = #{consumerId}</if>
<if test="membershipLevel != null ">and m.membership_level = #{membershipLevel}</if>
<if test="memberType != null ">and m.member_type = #{memberType}</if>
<if test="memberConfigId != null ">and m.member_config_id = #{memberConfigId}</if>
<if test="expirationDate != null ">and m.expiration_date = #{expirationDate}</if>
<if test="membershipProgress != null ">and m.membership_progress = #{membershipProgress}</if>
</where>
......@@ -89,8 +83,6 @@
c.phone,
c.avatar,
m.membership_level,
m.member_type,
m.member_config_id,
m.expiration_date,
m.membership_progress,
m.is_recharge,
......@@ -112,8 +104,6 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consumerId != null">consumer_id,</if>
<if test="membershipLevel != null">membership_level,</if>
<if test="memberType != null">member_type,</if>
<if test="memberConfigId != null">member_config_id,</if>
<if test="expirationDate != null">expiration_date,</if>
<if test="membershipProgress != null">membership_progress,</if>
<if test="isRecharge != null">is_recharge,</if>
......@@ -128,8 +118,6 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if>
<if test="membershipLevel != null">#{membershipLevel},</if>
<if test="memberType != null">#{memberType},</if>
<if test="memberConfigId != null">#{memberConfigId},</if>
<if test="expirationDate != null">#{expirationDate},</if>
<if test="membershipProgress != null">#{membershipProgress},</if>
<if test="isRecharge != null">#{isRecharge},</if>
......@@ -148,8 +136,6 @@
<trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="membershipLevel != null">membership_level = #{membershipLevel},</if>
<if test="memberType != null">member_type = #{memberType},</if>
<if test="memberConfigId != null">member_config_id = #{memberConfigId},</if>
<if test="expirationDate != null">expiration_date = #{expirationDate},</if>
<if test="membershipProgress != null">membership_progress = #{membershipProgress},</if>
<if test="isRecharge != null">is_recharge = #{isRecharge},</if>
......
......@@ -7,12 +7,12 @@
<resultMap type="MemberConfig" id="MemberConfigResult">
<result property="id" column="id"/>
<result property="membershipLevel" column="membership_level"/>
<result property="memberType" column="member_type"/>
<!-- <result property="memberType" column="member_type"/>-->
<result property="levelName" column="level_name"/>
<result property="limitRequirements" column="limit_requirements"/>
<result property="discountRatio" column="discount_ratio"/>
<result property="validityPeriod" column="validity_period"/>
<result property="membershipProgress" column="membership_progress"/>
<!-- <result property="validityPeriod" column="validity_period"/>-->
<!-- <result property="membershipProgress" column="membership_progress"/>-->
<result property="isDelete" column="is_delete"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
......@@ -24,12 +24,9 @@
<sql id="selectMemberConfigVo">
select id,
membership_level,
member_type,
level_name,
limit_requirements,
discount_ratio,
validity_period,
membership_progress,
is_delete,
create_by,
create_time,
......@@ -43,12 +40,10 @@
<include refid="selectMemberConfigVo"/>
<where>
<if test="membershipLevel != null ">and membership_level = #{membershipLevel}</if>
<if test="memberType != null ">and member_type = #{memberType}</if>
<if test="levelName != null and levelName != ''">and level_name like concat('%', #{levelName}, '%')</if>
<if test="limitRequirements != null ">and limit_requirements = #{limitRequirements}</if>
<if test="discountRatio != null ">and discount_ratio = #{discountRatio}</if>
<if test="validityPeriod != null ">and validity_period = #{validityPeriod}</if>
<if test="membershipProgress != null ">and membership_progress = #{membershipProgress}</if>
>
<if test="isDelete != null ">and is_delete = #{isDelete}</if>
</where>
</select>
......@@ -62,12 +57,10 @@
insert into s_member_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="membershipLevel != null">membership_level,</if>
<if test="memberType != null">member_type,</if>
<if test="levelName != null">level_name,</if>
<if test="limitRequirements != null">limit_requirements,</if>
<if test="discountRatio != null">discount_ratio,</if>
<if test="validityPeriod != null">validity_period,</if>
<if test="membershipProgress != null">membership_progress,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
......@@ -77,12 +70,10 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="membershipLevel != null">#{membershipLevel},</if>
<if test="memberType != null">#{memberType},</if>
<if test="levelName != null">#{levelName},</if>
<if test="limitRequirements != null">#{limitRequirements},</if>
<if test="discountRatio != null">#{discountRatio},</if>
<if test="validityPeriod != null">#{validityPeriod},</if>
<if test="membershipProgress != null">#{membershipProgress},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
......@@ -96,12 +87,10 @@
update s_member_config
<trim prefix="SET" suffixOverrides=",">
<if test="membershipLevel != null">membership_level = #{membershipLevel},</if>
<if test="memberType != null">member_type = #{memberType},</if>
<if test="levelName != null">level_name = #{levelName},</if>
<if test="limitRequirements != null">limit_requirements = #{limitRequirements},</if>
<if test="discountRatio != null">discount_ratio = #{discountRatio},</if>
<if test="validityPeriod != null">validity_period = #{validityPeriod},</if>
<if test="membershipProgress != null">membership_progress = #{membershipProgress},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
......
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