Commit 042e8a9c by 吕明尚

Merge branch 'refs/heads/test' into test-lms

# Conflicts:
#	share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
parents d8b12a0a 04476972
......@@ -77,18 +77,6 @@ public class SharingActivitiesController extends BaseController {
return toAjax(sharingActivitiesService.insertSharingActivities(sharingActivities));
}
/**
* 新增分享活动绑定关系
*/
// @PreAuthorize("@ss.hasPermi('system:activities:addSharingActivities')")
@Log(title = "分享活动绑定关系", businessType = BusinessType.INSERT)
@PostMapping("/addSharingActivities")
public AjaxResult addSharingActivities(@RequestBody SharingActivities sharingActivities) {
AjaxResult ajaxResult = sharingActivitiesService.addSharingActivities(sharingActivities);
return ajaxResult;
}
/**
* 修改分享活动绑定关系
......
......@@ -11,7 +11,6 @@ import share.common.core.page.TableDataInfo;
import share.common.enums.YesNoEnum;
import share.system.domain.Activity;
import share.system.domain.vo.ActivityDto;
import share.system.domain.vo.ActivityVo;
import share.system.service.ActivityService;
import java.util.Date;
......@@ -43,7 +42,7 @@ public class ActivityController extends BaseController {
@GetMapping("/query")
public AjaxResult query(ActivityDto dto) {
dto.setIsOpen(Long.valueOf(YesNoEnum.yes.getIndex()));
Map<Date, List<ActivityVo>> map = activityService.queryList(dto);
Map<Date, List<Activity>> map = activityService.queryList(dto);
return success(map);
}
......
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.EquityFundLog;
import share.system.service.EquityFundLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 权益金记录Controller
*
* @author wuwenlong
* @date 2024-09-10
*/
@RestController
@RequestMapping("/equityFundLog")
public class EquityFundLogController extends BaseController {
@Autowired
private EquityFundLogService equityFundLogService;
/**
* 查询权益金记录列表
*/
@PreAuthorize("@ss.hasPermi('system:equityFundLog:list')")
@GetMapping("/list")
public TableDataInfo list(EquityFundLog equityFundLog) {
startPage();
List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
return getDataTable(list);
}
/**
* 获取权益金记录详细信息
*/
@PreAuthorize("@ss.hasPermi('system:equityFundLog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(equityFundLogService.selectEquityFundLogById(id));
}
}
......@@ -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())
......
......@@ -49,7 +49,4 @@ public class WxRegisterPhoneRequest implements Serializable {
@ApiModelProperty(value = "上级id")
private Long uid;
@ApiModelProperty(value = "活动类型")
private String activityType;
}
......@@ -3,7 +3,6 @@ package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Activity;
import share.system.domain.vo.ActivityDto;
import share.system.domain.vo.ActivityVo;
import java.util.Date;
import java.util.List;
......@@ -64,5 +63,5 @@ public interface ActivityService extends IService<Activity> {
*/
public int deleteActivityById(Long id);
Map<Date, List<ActivityVo>> queryList(ActivityDto dto);
Map<Date, List<Activity>> queryList(ActivityDto dto);
}
......@@ -61,5 +61,5 @@ public interface SharingActivitiesService extends IService<SharingActivities>
*/
public int deleteSharingActivitiesById(Long id);
AjaxResult addSharingActivities(SharingActivities sharingActivities);
}
......@@ -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;
......@@ -18,7 +20,6 @@ import share.system.domain.ConsumerMember;
import share.system.domain.SConsumer;
import share.system.domain.SStore;
import share.system.domain.vo.ActivityDto;
import share.system.domain.vo.ActivityVo;
import share.system.mapper.ActivityMapper;
import share.system.service.ActivityService;
import share.system.service.ConsumerMemberService;
......@@ -119,7 +120,7 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
}
@Override
public Map<Date, List<ActivityVo>> queryList(ActivityDto dto) {
public Map<Date, List<Activity>> queryList(ActivityDto dto) {
SConsumer user = sConsumerService.getInfo();
if (ObjectUtil.isEmpty(user)) {
return new HashMap<>();
......@@ -137,19 +138,25 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
}
Activity activity = new Activity();
BeanUtils.copyProperties(dto, activity);
activity.setMemberType(MemberTypeEnum.NORMAL.getIndex());
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
activity.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
activity.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
}
List<Activity> activities = selectActivityList(activity);
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
Map<Date, List<ActivityVo>> map = new HashMap<>();
Map<Date, List<Activity>> map = new HashMap<>();
days.stream().forEach(day -> {
List<ActivityVo> voList = new ArrayList<>();
List<Activity> voList = new ArrayList<>();
activities.stream().forEach(item -> {
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())) {
ActivityVo activityVo = new ActivityVo();
BeanUtils.copyProperties(item, activityVo);
voList.add(activityVo);
if (match) {
voList.add(item);
}
});
if (voList.size() > 0) {
......
......@@ -769,17 +769,16 @@ public class CallbackServiceImpl implements CallbackService {
//查询是否有上级
SharingActivities sharingActivities = sharingActivitiesService.getOne(new LambdaQueryWrapper<SharingActivities>()
.eq(SharingActivities::getNewUid, consumerId)
.eq(SharingActivities::getActivityType, "1")
.eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex()));
if (ObjectUtil.isNotEmpty(sharingActivities)) {
//查询会员用户类型
LambdaQueryWrapper<ConsumerMember> consumerMemberLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerMemberLambdaQueryWrapper.eq(ConsumerMember::getConsumerId,sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper);
consumerMemberLambdaQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper);
//判断是否为权益会员和会员是否有效
if ("2".equals(consumerMember.getMemberType()) && 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){
if (aBoolean) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
//查询上级用户是否有钱包
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>()
......@@ -826,6 +825,81 @@ public class CallbackServiceImpl implements CallbackService {
}
}
}
// /**
// * 新增权益金日志
// * @param consumerId 用户ID
// * @param payPrice 消费金额
// * @param equityOrderNo 订单编号
// * @param terminalTrace 终端流水号
// * @param type 权益类型
// */
// private void addEquityFundLogRights(Long consumerId, BigDecimal payPrice, String equityOrderNo, String terminalTrace, String type) {
// //查询是否有上级
// SharingActivities sharingActivities = sharingActivitiesService.getOne(new LambdaQueryWrapper<SharingActivities>()
// .eq(SharingActivities::getNewUid, consumerId)
// .eq(SharingActivities::getIsDelete, YesNoEnum.no.getIndex()));
// if (ObjectUtil.isNotEmpty(sharingActivities)) {
// //查询会员用户类型
// LambdaQueryWrapper<ConsumerMember> consumerMemberWrapper = new LambdaQueryWrapper<>();
// consumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
// ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberWrapper);
// LambdaQueryWrapper<ConsumerMember> newConsumerMemberWrapper = new LambdaQueryWrapper<>();
// newConsumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
// ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberWrapper);
// //判断是否为权益会员和会员是否有效
// if ("2".equals(consumerMember.getMemberType()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
// && "2".equals(newConsumerMember.getMemberType()) && 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());
// if (aBoolean && newAboolean) {
// String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
// //查询上级用户是否有钱包
// 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))));
// consumerWallet.setUpdateTime(DateUtils.getNowDate());
// consumerWalletService.updateConsumerWallet(consumerWallet);
// } else {
// //新增钱包
// ConsumerWallet newConsumerWallet = new ConsumerWallet();
// BigDecimal defaultVlue = new BigDecimal(0.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))));
// consumerWalletService.insertConsumerWallet(newConsumerWallet);
// }
// //添加权益金日志记录
// //下级用户
// SConsumer newConsumer = consumerService.getById(consumerId);
// //上级用户
// SConsumer consumer = consumerService.getById(sharingActivities.getUid());
// EquityFundLog equityFundLog = new EquityFundLog();
// equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
// equityFundLog.setEquityFundType(type);
// equityFundLog.setOutTradeNo(equityOrderNo);
// equityFundLog.setTerminalTrace(terminalTrace);
// equityFundLog.setUid(sharingActivities.getUid());
// equityFundLog.setNewUid(sharingActivities.getNewUid());
// equityFundLog.setPhone(consumer.getPhone());
// equityFundLog.setAccount(consumer.getAccount());
// equityFundLog.setNickName(consumer.getNickName());
// equityFundLog.setNewPhone(newConsumer.getPhone());
// equityFundLog.setNewAccount(newConsumer.getAccount());
// equityFundLog.setNewNickName(newConsumer.getNickName());
// equityFundLogService.insertEquityFundLog(equityFundLog);
// }
// }
// }
// }
/**
* 支付订单回调通知
......
......@@ -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 {
......
......@@ -313,7 +313,6 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
if (uid != null){
//添加绑定关系
SharingActivities sharingActivities = new SharingActivities();
sharingActivities.setActivityType(request.getActivityType());
sharingActivities.setUid(uid);
sharingActivities.setNewUid(id);
sharingActivities.setCreateTime(DateUtils.getNowDate());
......
......@@ -208,11 +208,11 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
List<ConsumerMonthlyCardVo> consumerMonthlyCardVo = consumerMonthlyCardService.selectByConsumerId();
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)) {
......
package share.system.service.impl;
import java.time.YearMonth;
import java.util.List;
import java.util.Set;
......@@ -10,6 +11,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import share.common.core.domain.AjaxResult;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -107,28 +109,4 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
return sharingActivitiesMapper.deleteSharingActivitiesById(id);
}
/**
* 新增分享活动绑定关系
* @param sharingActivities
* @return
*/
@Override
public AjaxResult addSharingActivities(SharingActivities sharingActivities) {
sharingActivities.setCreateTime(DateUtils.getNowDate());
Long newUid = sharingActivities.getNewUid();
SharingActivities sharingActivities1 = sharingActivitiesMapper.selectOne(new LambdaQueryWrapper<SharingActivities>().eq(SharingActivities::getNewUid, newUid));
if (ObjectUtil.isNotEmpty(sharingActivities1)){
return AjaxResult.success("此用户以绑定其他权益会员");
}
Boolean B = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
if (!B){
return AjaxResult.success("分享用户权益过期");
}
sharingActivitiesMapper.insertSharingActivities(sharingActivities);
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
if (!aBoolean){
sharingActivitiesMapper.deleteSharingActivitiesById(sharingActivities.getId());
}
return AjaxResult.success();
}
}
......@@ -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