Commit 81cbfd14 by 吕明尚

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

# Conflicts:
#	share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
parents ea1ee91f 7af58467
......@@ -12,8 +12,6 @@ import share.system.domain.vo.SaobeiNotifyResponseVo;
import share.system.domain.vo.SaobeiNotifyVo;
import share.system.service.CallbackService;
import javax.servlet.http.HttpServletRequest;
/**
* 支付回调
......
......@@ -10,6 +10,9 @@ 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.domain.SConsumer;
import share.system.domain.vo.DurationLogVo;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.EquityFundLogService;
import javax.servlet.http.HttpServletResponse;
......@@ -28,22 +31,18 @@ public class EquityFundLogController extends BaseController {
private EquityFundLogService equityFundLogService;
/**
* 查询权益金记录列表
* 查询本人权益金记录列表
*/
@PreAuthorize("@ss.hasPermi('system:equityFundLog:list')")
@GetMapping("/list")
public TableDataInfo list(EquityFundLog equityFundLog) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
equityFundLog.setUid(user.getId());
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));
}
}
......@@ -10,6 +10,7 @@ import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil;
import share.common.enums.YesNoEnum;
import share.common.utils.JsonConvertUtil;
import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent;
......@@ -43,6 +44,7 @@ public class MonthlyCardOrderController extends BaseController {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
monthlyCardOrder.setConsumerId(user.getId());
monthlyCardOrder.setPayStatus(YesNoEnum.yes.getIndex());
List<MonthlyCardOrderVo> list = monthlyCardOrderService.selectMonthlyCardOrderList(monthlyCardOrder);
return getDataTable(list);
}
......@@ -51,6 +53,7 @@ public class MonthlyCardOrderController extends BaseController {
public AjaxResult query(MonthlyCardOrderVo monthlyCardOrder) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
monthlyCardOrder.setConsumerId(user.getId());
monthlyCardOrder.setPayStatus(YesNoEnum.yes.getIndex());
List<MonthlyCardOrderVo> list = monthlyCardOrderService.selectMonthlyCardOrderList(monthlyCardOrder);
return success(list);
}
......
......@@ -5,7 +5,10 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SecondaryCardLogVo;
import share.system.service.SecondaryCardLogService;
......@@ -29,8 +32,17 @@ public class SecondaryCardLogController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(SecondaryCardLogVo secondaryCardLog) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
secondaryCardLog.setConsumerId(user.getId());
List<SecondaryCardLogVo> list = secondaryCardLogService.selectSecondaryCardLogList(secondaryCardLog);
return getDataTable(list);
}
@GetMapping("/query")
public AjaxResult query(SecondaryCardLogVo secondaryCardLog) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
secondaryCardLog.setConsumerId(user.getId());
return success(secondaryCardLogService.selectSecondaryCardLogList(secondaryCardLog));
}
}
......@@ -9,7 +9,10 @@ import share.common.core.controller.BaseController;
import share.common.core.domain.R;
import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil;
import share.common.enums.YesNoEnum;
import share.common.utils.JsonConvertUtil;
import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SecondaryCardOrderVo;
import share.system.request.SecondaryCardOrderRequest;
import share.system.response.SecondaryCardOrderPayResultResponse;
......@@ -38,6 +41,9 @@ public class SecondaryCardOrderController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(SecondaryCardOrderVo secondaryCardOrder) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
secondaryCardOrder.setConsumerId(user.getId());
secondaryCardOrder.setPayStatus(YesNoEnum.yes.getIndex());
List<SecondaryCardOrderVo> list = secondaryCardOrderService.selectSecondaryCardOrderList(secondaryCardOrder);
return getDataTable(list);
}
......
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.domain.SConsumer;
import share.system.domain.SharingActivities;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.SharingActivitiesService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 分享活动绑定关系Controller
*
* @author wuwenlong
* @date 2024-09-02
*/
@RestController
@RequestMapping("/activities")
public class SharingActivitiesController extends BaseController {
@Autowired
private SharingActivitiesService sharingActivitiesService;
/**
* 查询分享活动绑定关系列表
*/
@GetMapping("/list")
public TableDataInfo list(SharingActivities sharingActivities) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setUid(user.getId());
List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return getDataTable(list);
}
@GetMapping("/query")
public AjaxResult query(SharingActivities sharingActivities) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setNewUid(user.getId());
List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return success(list);
}
}
......@@ -355,7 +355,7 @@ public class RedisTask {
sOrderLambdaQueryWrapper.eq(SOrder::getConsumerId, sOrder.getConsumerId());
sOrderLambdaQueryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
sOrderLambdaQueryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
sOrderLambdaQueryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
sOrderLambdaQueryWrapper.in(SOrder::getStatus, OrderStatusEnum.getValidOrderStatus());
sOrderLambdaQueryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex());
List<SOrder> sOrderList = isOrderService.list(sOrderLambdaQueryWrapper);
if (sOrderList.size() == 1) {
......@@ -365,7 +365,8 @@ public class RedisTask {
if (ObjectUtil.isNotEmpty(consumerWallet)) {
//添加时长
BigDecimal anHour = new BigDecimal(1.0);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(anHour));
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setRemainingDuration(accumulateEquityFund.add(anHour));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
DurationLog durationLog = new DurationLog();
......@@ -385,7 +386,7 @@ public class RedisTask {
newConsumerWallet.setEquityFund(defaultVlue);
newConsumerWallet.setAccumulateEquityFund(defaultVlue);
BigDecimal anHour = new BigDecimal(1.0);
newConsumerWallet.setRemainingDuration(newConsumerWallet.getRemainingDuration().add(anHour));
newConsumerWallet.setRemainingDuration(defaultVlue.add(anHour));
newConsumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.insertConsumerWallet(newConsumerWallet);
DurationLog newDurationLog = new DurationLog();
......@@ -402,23 +403,28 @@ public class RedisTask {
consumerMemberWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberWrapper);
LambdaQueryWrapper<ConsumerMember> newConsumerMemberQueryWrapper = new LambdaQueryWrapper<>();
newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getUid());
newConsumerMemberQueryWrapper.eq(ConsumerMember::getConsumerId, sharingActivities.getNewUid());
ConsumerMember newConsumerMember = consumerMemberService.getOne(newConsumerMemberQueryWrapper);
//判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRecharge()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()
&& YesNoEnum.yes.getIndex().equals(newConsumerMember.getIsRecharge()) && new Date().getTime() < newConsumerMember.getExpirationDate().getTime()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getNewUid().toString());
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()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getUid().toString());
Boolean newAboolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getNewUid().toString());
if (aBoolean && newAboolean) {
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
BigDecimal payPrice = sOrder.getPayPrice();
if (payPrice.signum() > 0) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund().
add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
BigDecimal addEquityFund = payPrice.multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP);
// BigDecimal addEquityFund = new BigDecimal(99).multiply(new BigDecimal(equityFund)).setScale(2, RoundingMode.HALF_UP);
BigDecimal aEquityFund = consumerWallet.getEquityFund() != null ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
//添加权益金日志记录
......@@ -427,7 +433,7 @@ public class RedisTask {
//上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType("1");
equityFundLog.setOutTradeNo(sOrder.getOutTradeNo());
equityFundLog.setTerminalTrace(sOrder.getOutTradeNo());
......@@ -436,6 +442,8 @@ public class RedisTask {
equityFundLog.setPhone(consumer.getPhone());
equityFundLog.setAccount(consumer.getAccount());
equityFundLog.setNickName(consumer.getNickName());
equityFundLog.setAvatar(consumer.getAvatar());
equityFundLog.setNewAvatar(newConsumer.getAvatar());
equityFundLog.setNewPhone(newConsumer.getPhone());
equityFundLog.setNewAccount(newConsumer.getAccount());
equityFundLog.setNewNickName(newConsumer.getNickName());
......@@ -592,7 +600,7 @@ public class RedisTask {
@XxlJob("AutoOrderCancelPay")
public void AutoOrderCancelPay() {
logger.debug("AutoOrderCancelPay:延时订单取消支付开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_CANCEL_PAY + "*");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.ORDER_CANCEL_PAY.getValue() + "*");
if (keys.size() == 0) {
return;
}
......@@ -623,7 +631,7 @@ public class RedisTask {
@XxlJob("AutoEquityMembersSms")
public void AutoEquityMembersSms() {
logger.debug("AutoEquityMembersSms:自动发送权益会员过期短信开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + "*");
if (keys.size() == 0) {
return;
}
......@@ -649,7 +657,7 @@ public class RedisTask {
@XxlJob("AutoUpdateEquityMembers")
public void AutoUpdateEquityMembers() {
logger.debug("AutoUpdateEquityMembers:权益会员降级开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + "*");
if (keys.size() == 0) {
return;
}
......@@ -662,10 +670,11 @@ public class RedisTask {
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, consumerId));
consumerMember.setIsRights(YesNoEnum.no.getIndex());
if (ObjectUtil.isNotEmpty(consumerMember)) {
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), 100));
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
} else {
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), 100));
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
}
// MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
//// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
......
......@@ -10,9 +10,9 @@ import share.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 权益金记录对象 s_equity_fund_log
*
*
* @author wuwenlong
* @date 2024-09-10
* @date 2024-09-13
*/
@Data
@TableName(value = "s_equity_fund_log")
......@@ -54,8 +54,8 @@ public class EquityFundLog extends BaseEntity
@TableField(select = false)
private Long isDelete;
/** 上级手机号 */
@Excel(name = "上级手机号")
/** 上级电话 */
@Excel(name = "上级电话")
private String phone;
/** 上级账号 */
......@@ -66,34 +66,51 @@ public class EquityFundLog extends BaseEntity
@Excel(name = "上级用户昵称")
private String nickName;
/** 下级手机号 */
@Excel(name = "下级手机号")
/** 下级电话 */
@Excel(name = "下级电话")
private String newPhone;
/** 下级账号 */
@Excel(name = "级账号")
@Excel(name = "级账号")
private String newAccount;
/** 下级用户昵称 */
@Excel(name = "下级用户昵称")
private String newNickName;
/** 上级用户头像 */
@Excel(name = "上级用户头像")
private String avatar;
/** 下级用户头像 */
@Excel(name = "下级用户头像")
private String newAvatar;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equityFundType", getEquityFundType())
.append("equityFund", getEquityFund())
.append("uid", getUid())
.append("newUid", getNewUid())
.append("terminalTrace", getTerminalTrace())
.append("outTradeNo", getOutTradeNo())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
.append("id", getId())
.append("equityFundType", getEquityFundType())
.append("equityFund", getEquityFund())
.append("uid", getUid())
.append("newUid", getNewUid())
.append("terminalTrace", getTerminalTrace())
.append("outTradeNo", getOutTradeNo())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("phone", getPhone())
.append("account", getAccount())
.append("nickName", getNickName())
.append("newPhone", getNewPhone())
.append("newAccount", getNewAccount())
.append("newNickName", getNewNickName())
.append("avatar", getAvatar())
.append("newAvatar", getNewAvatar())
.toString();
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
/**
* 分享活动绑定关系对象 s_sharing_activities
*
*
* @author wuwenlong
* @date 2024-09-02
* @date 2024-09-14
*/
@Data
@TableName("s_sharing_activities")
public class SharingActivities extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type = IdType.AUTO)
private Long id;
/** 活动类型(0-新用户注册,1-权益金会员分享) */
......@@ -40,20 +39,50 @@ public class SharingActivities extends BaseEntity
@TableField(select = false)
private Long isDelete;
/** 上级用户头像 */
@Excel(name = "上级用户头像")
private String avatar;
/** 下级用户头像 */
@Excel(name = "下级用户头像")
private String newAvatar;
/** 上级用户昵称 */
@Excel(name = "上级用户昵称")
private String nickName;
/** 下级用户昵称 */
@Excel(name = "下级用户昵称")
private String newNickName;
/** 上级电话 */
@Excel(name = "上级电话")
private String phone;
/** 下级电话 */
@Excel(name = "下级电话")
private String newPhone;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("activityType", getActivityType())
.append("uid", getUid())
.append("newUid", getNewUid())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
.append("id", getId())
.append("activityType", getActivityType())
.append("uid", getUid())
.append("newUid", getNewUid())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("avatar", getAvatar())
.append("newAvatar", getNewAvatar())
.append("nickName", getNickName())
.append("newNickName", getNewNickName())
.append("phone", getPhone())
.append("newPhone", getNewPhone())
.toString();
}
}
......@@ -59,4 +59,6 @@ public interface SharingActivitiesMapper extends BaseMapper<SharingActivities>
* @return 结果
*/
public int deleteSharingActivitiesByIds(Long[] ids);
}
......@@ -59,4 +59,8 @@ public interface EquityFundLogService extends IService<EquityFundLog>
* @return 结果
*/
public int deleteEquityFundLogById(Long id);
List<EquityFundLog> selectEquityFundLogByUid(Long uid);
List<EquityFundLog> selectEquityFundLogByNewUid(Long newUid);
}
......@@ -14,7 +14,6 @@ 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;
import share.system.domain.Activity;
import share.system.domain.ConsumerMember;
import share.system.domain.SConsumer;
......@@ -136,17 +135,24 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> i
for (int i = 0; i <= 4; i++) {
days.add(DateUtils.addDays(new Date(), 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());
LambdaQueryWrapper<Activity> queryWrapper = new LambdaQueryWrapper<>();
// Activity activity = new Activity();
// BeanUtils.copyProperties(dto, activity);
// activity.setMemberType(MemberTypeEnum.NORMAL.getIndex());
if (consumerMember.getIsRecharge().equals(YesNoEnum.no.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.no.getIndex())) {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.NORMAL.getIndex());
} else if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
queryWrapper.in(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex(), MemberTypeEnum.RIGHTS.getIndex());
} else if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.no.getIndex())) {
// activity.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex());
} else if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRecharge().equals(YesNoEnum.no.getIndex())) {
// activity.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RIGHTS.getIndex());
}
List<Activity> activities = selectActivityList(activity);
// List<Activity> activities = selectActivityList(activity);
List<Activity> activities = list(queryWrapper);
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
Map<Date, List<Activity>> map = new HashMap<>();
days.stream().forEach(day -> {
......
......@@ -777,29 +777,35 @@ public class CallbackServiceImpl implements CallbackService {
ConsumerMember consumerMember = consumerMemberService.getOne(consumerMemberLambdaQueryWrapper);
//判断是否为权益会员和会员是否有效
if (YesNoEnum.yes.getIndex().equals(consumerMember.getIsRights()) && new Date().getTime() < consumerMember.getExpirationDate().getTime()) {
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + sharingActivities.getUid().toString());
Boolean aBoolean = redisTemplate.hasKey(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME.getValue() + sharingActivities.getUid().toString());
if (aBoolean) {
String equityFund = sysConfigService.selectConfigByKey("sys.equityFundLog.equityFund");
//计算返佣额度 写死 99 测试
// BigDecimal addEquityFund = new BigDecimal(99).multiply(new BigDecimal(equityFund)).setScale(2,RoundingMode.HALF_UP);
BigDecimal addEquityFund = payPrice.multiply(new BigDecimal(equityFund)).setScale(2,RoundingMode.HALF_UP);
//查询上级用户是否有钱包
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>()
.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid()));
if (ObjectUtil.isNotEmpty(consumerWallet)) {
consumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund))));
consumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund().
add(payPrice.multiply(new BigDecimal(equityFund))));
BigDecimal aEquityFund = consumerWallet.getEquityFund() != null ? consumerWallet.getEquityFund() : BigDecimal.ZERO;
consumerWallet.setEquityFund(aEquityFund.add(addEquityFund));
BigDecimal accumulateEquityFund = consumerWallet.getAccumulateEquityFund() != null ? consumerWallet.getAccumulateEquityFund() : BigDecimal.ZERO;
consumerWallet.setAccumulateEquityFund(accumulateEquityFund.
add(addEquityFund));
consumerWallet.setUpdateTime(DateUtils.getNowDate());
consumerWalletService.updateConsumerWallet(consumerWallet);
} else {
//新增钱包
ConsumerWallet newConsumerWallet = new ConsumerWallet();
BigDecimal defaultVlue = new BigDecimal(0.0);
BigDecimal defaultVlue = new BigDecimal(0);
newConsumerWallet.setConsumerId(sharingActivities.getUid());
newConsumerWallet.setBalance(defaultVlue);
newConsumerWallet.setRemainingIntegral(defaultVlue);
newConsumerWallet.setRemainingDuration(defaultVlue);
newConsumerWallet.setEquityFund(consumerWallet.getEquityFund().add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
newConsumerWallet.setAccumulateEquityFund(consumerWallet.getAccumulateEquityFund()
.add(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP))));
newConsumerWallet.setEquityFund(defaultVlue
.add(addEquityFund));
newConsumerWallet.setAccumulateEquityFund(defaultVlue.add(addEquityFund));
consumerWalletService.insertConsumerWallet(newConsumerWallet);
}
//添加权益金日志记录
......@@ -808,7 +814,7 @@ public class CallbackServiceImpl implements CallbackService {
//上级用户
SConsumer consumer = consumerService.getById(sharingActivities.getUid());
EquityFundLog equityFundLog = new EquityFundLog();
equityFundLog.setEquityFund(payPrice.multiply(new BigDecimal(equityFund).setScale(2, RoundingMode.HALF_UP)));
equityFundLog.setEquityFund(addEquityFund);
equityFundLog.setEquityFundType(type);
equityFundLog.setOutTradeNo(equityOrderNo);
equityFundLog.setTerminalTrace(terminalTrace);
......@@ -817,6 +823,8 @@ public class CallbackServiceImpl implements CallbackService {
equityFundLog.setPhone(consumer.getPhone());
equityFundLog.setAccount(consumer.getAccount());
equityFundLog.setNickName(consumer.getNickName());
equityFundLog.setAvatar(consumer.getAvatar());
equityFundLog.setNewAvatar(newConsumer.getAvatar());
equityFundLog.setNewPhone(newConsumer.getPhone());
equityFundLog.setNewAccount(newConsumer.getAccount());
equityFundLog.setNewNickName(newConsumer.getNickName());
......
......@@ -57,6 +57,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
private ISCouponService sCouponService;
@Autowired
private ISConsumerCouponService consumerCouponService;
@Autowired
private ISysConfigService sysConfigService;
/**
* 查询会员钱包
......@@ -136,6 +138,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
@Override
public boolean addConsumerWallet(ConsumerWallet consumerWallet) {
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
int i = consumerWalletMapper.insertConsumerWallet(consumerWallet);
ConsumerMember one = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, consumerWallet.getConsumerId()));
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, one.getMembershipLevel()));
......@@ -176,10 +180,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setCreateTime(new Date());
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
}
if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
}
memberProgressLogService.save(memberProgressLog);
......@@ -203,14 +207,16 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
BigDecimal oldBalance = consumerWallet.getBalance();
BigDecimal oldDuration = consumerWallet.getRemainingDuration();
BigDecimal oldIntegral = consumerWallet.getRemainingIntegral();
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
RechargeConf rechargeConf = rechargeConfService.selectRechargeConfById(recharge.getRechargeConfId());
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex()) && one.getIsRights().equals(YesNoEnum.no.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));
one.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
}
logger.debug("修改会员用户");
......@@ -268,11 +274,9 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setCreateTime(new Date());
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
}
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
}
memberProgressLogService.save(memberProgressLog);
......@@ -297,6 +301,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
private void accumulatedConsumptionStatistics(ConsumerWallet consumerWallet, ConsumerMember one, MemberConfig memberConfig) {
logger.debug("统计累计积分开始");
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
final BigDecimal[] consumption = {BigDecimal.ZERO};
//查询含当天23:59:59以及往前90天的00:00:00整天的订单
Calendar calendar = Calendar.getInstance();
......@@ -367,10 +373,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setCreateTime(new Date());
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
}
if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
}
if (memberProgressLogService.save(memberProgressLog) && integralLogService.save(integralLog)) {
......
package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -94,4 +96,16 @@ public class EquityFundLogServiceImpl extends ServiceImpl<EquityFundLogMapper, E
{
return equityFundLogMapper.deleteEquityFundLogById(id);
}
@Override
public List<EquityFundLog> selectEquityFundLogByUid(Long id) {
return equityFundLogMapper.selectList(new LambdaQueryWrapper<EquityFundLog>().eq(EquityFundLog::getUid,id));
}
@Override
public List<EquityFundLog> selectEquityFundLogByNewUid(Long newUid) {
return equityFundLogMapper.selectList(new LambdaQueryWrapper<EquityFundLog>().eq(EquityFundLog::getNewUid,newUid));
}
}
......@@ -57,6 +57,8 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
private IntegralLogService integralLogService;
@Autowired
private MemberProgressLogService memberProgressLogService;
@Autowired
private ISysConfigService sysConfigService;
/**
* 查询权益会员订单
......@@ -146,7 +148,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
Date expirationDate = consumerMember.getExpirationDate();
//减去当前时间
int i = DateUtils.differentDaysByMillisecond(new Date(), expirationDate);
if (i > 365) {
if (i > 365 && consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
throw new BaseException("目前只能购买两年权益会员");
}
}
......@@ -168,6 +170,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, equityMembersOrder.getConsumerId()));
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, equityMembersOrder.getConsumerId()));
EquityMembersOrderConfig equityMembersOrderConfig = equityMembersOrderConfigService.selectEquityMembersOrderConfigById(equityMembersOrder.getEquityMembersConfigId());
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
if (ObjectUtil.isEmpty(consumerMember)) {
ConsumerMember newConsumerMember = new ConsumerMember();
newConsumerMember.setConsumerId(equityMembersOrder.getConsumerId());
......@@ -188,7 +191,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(), 1));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
memberProgressLogService.save(memberProgressLog);
}
newConsumerMember.setCreateTime(new Date());
......@@ -207,10 +210,12 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
// .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())),
1));
Integer.parseInt(expirationDateEquityMembership)));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember, consumerWallet, memberConfigServiceOne);
consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("权益会员原来的基础上增加有效期");
......@@ -220,7 +225,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
// 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())),
1));
Integer.parseInt(expirationDateEquityMembership)));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember, consumerWallet, memberConfigServiceOne);
consumerMemberService.updateConsumerMember(consumerMember);
logger.debug("修改会员类型为权益会员");
......@@ -258,6 +263,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
private void extracted(EquityMembersOrder equityMembersOrder, EquityMembersOrderConfig equityMembersOrderConfig,
ConsumerMember consumerMember, ConsumerWallet consumerWallet, MemberConfig memberConfigServiceOne) {
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.ZERO) > 0) {
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(equityMembersOrder.getConsumerId());
......@@ -267,7 +273,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(), 1));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(equityMembersOrder.getConsumerId());
......
......@@ -54,6 +54,8 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
private ConsumerWalletService consumerWalletService;
@Autowired
private MemberConfigService memberConfigService;
@Autowired
private ISysConfigService sysConfigService;
/**
* 查询充值记录
......@@ -164,7 +166,8 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
);
// consumerMember.setMemberConfigId(memberConfig.getId());
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), 100));
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
consumerMember.setCreateTime(new Date());
consumerMember.setIsRecharge(YesNoEnum.yes.getIndex());
consumerMemberService.save(consumerMember);
......
......@@ -312,8 +312,16 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
//判断是否为分享新用户
if (uid != null){
//添加绑定关系
SConsumer consumer = sConsumerService.selectSConsumerById(uid);
SConsumer newConsumer = sConsumerService.selectSConsumerById(id);
SharingActivities sharingActivities = new SharingActivities();
sharingActivities.setUid(uid);
sharingActivities.setPhone(consumer.getPhone());
sharingActivities.setAvatar(consumer.getAvatar());
sharingActivities.setNickName(consumer.getNickName());
sharingActivities.setNewPhone(newConsumer.getPhone());
sharingActivities.setNewAvatar(newConsumer.getAvatar());
sharingActivities.setNewNickName(newConsumer.getNickName());
sharingActivities.setNewUid(id);
sharingActivities.setCreateTime(DateUtils.getNowDate());
sharingActivitiesService.insertSharingActivities(sharingActivities);
......
......@@ -167,6 +167,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired
private MemberProgressLogService memberProgressLogService;
@Autowired
private ISysConfigService sysConfigService;
@Autowired
private RechargeService rechargeService;
......@@ -1235,11 +1237,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setCreateTime(new Date());
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex()) || consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLogService.save(memberProgressLog);
......@@ -1422,11 +1426,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
memberProgressLog.setOperationType(YesNoEnum.no.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setCreateTime(new Date());
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 100));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
}
if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), 1));
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
}
if ((consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) || consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex()))
......@@ -2504,6 +2510,33 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// priceResponse.setAvailableBalance(consumerWallet.getBalance());
// priceResponse.setAvailableDuration(consumerWallet.getRemainingDuration());
// }
consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId()));
consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
if (ObjectUtil.isNotEmpty(consumerMember)) {
queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex());
// if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
// queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RIGHTS.getIndex());
// } else if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.no.getIndex())) {
// queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex());
// } else {
// queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.NORMAL.getIndex());
// }
if (consumerMember.getIsRecharge().equals(YesNoEnum.no.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.no.getIndex())) {
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.NORMAL.getIndex());
} else if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
queryWrapper.in(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex(), MemberTypeEnum.RIGHTS.getIndex());
} else if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRights().equals(YesNoEnum.no.getIndex())) {
// activity.setMemberType(MemberTypeEnum.RECHARGE.getIndex());
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RECHARGE.getIndex());
} else if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex()) && consumerMember.getIsRecharge().equals(YesNoEnum.no.getIndex())) {
// activity.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
queryWrapper.eq(Activity::getMemberType, MemberTypeEnum.RIGHTS.getIndex());
}
}
if (ObjectUtil.isNotEmpty(consumerWallet)) {
priceResponse.setAvailableBalance(consumerWallet.getBalance());
priceResponse.setAvailableDuration(consumerWallet.getRemainingDuration());
}
}
SRoom room = roomService.getById(request.getRoomId());
BigDecimal totalPrice = computeTotalPrice(room.getPrice(), request.getPreStartDate(), request.getPreEndDate());
......
......@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.SConsumer;
import share.system.domain.SecondaryCardLog;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SecondaryCardLogVo;
import share.system.mapper.SecondaryCardLogMapper;
import share.system.service.SecondaryCardLogService;
......@@ -41,6 +43,8 @@ public class SecondaryCardLogServiceImpl extends ServiceImpl<SecondaryCardLogMap
*/
@Override
public List<SecondaryCardLogVo> selectSecondaryCardLogList(SecondaryCardLogVo secondaryCardLog) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
secondaryCardLog.setConsumerId(user.getId());
return secondaryCardLogMapper.selectSecondaryCardLogList(secondaryCardLog);
}
......
......@@ -15,8 +15,10 @@ import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SConsumer;
import share.system.mapper.SharingActivitiesMapper;
import share.system.domain.SharingActivities;
import share.system.service.SConsumerService;
import share.system.service.SharingActivitiesService;
/**
......@@ -32,6 +34,9 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
private SharingActivitiesMapper sharingActivitiesMapper;
@Autowired
private SConsumerService consumerService;
@Autowired
private RedisTemplate redisTemplate;
/**
......@@ -81,7 +86,11 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
@Override
public int updateSharingActivities(SharingActivities sharingActivities)
{
SConsumer consumer = consumerService.selectSConsumerById(sharingActivities.getUid());
sharingActivities.setUpdateTime(DateUtils.getNowDate());
sharingActivities.setAvatar(consumer.getAvatar());
sharingActivities.setPhone(consumer.getPhone());
sharingActivities.setNickName(consumer.getNickName());
return sharingActivitiesMapper.updateSharingActivities(sharingActivities);
}
......@@ -109,4 +118,6 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
return sharingActivitiesMapper.deleteSharingActivitiesById(id);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.EquityFundLogMapper">
<resultMap type="EquityFundLog" id="EquityFundLogResult">
<result property="id" column="id" />
<result property="equityFundType" column="equity_fund_type" />
......@@ -18,25 +18,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="account" column="account" />
<result property="nickName" column="nick_name" />
<result property="phone" column="phone" />
<result property="newAccount" column="new_account" />
<result property="newNickName" column="new_nick_name" />
<result property="account" column="account" />
<result property="nickName" column="nick_name" />
<result property="newPhone" column="new_phone" />
<result property="newAccount" column="new_account" />
<result property="newNickName" column="new_nick_name" />
<result property="avatar" column="avatar" />
<result property="newAvatar" column="new_avatar" />
</resultMap>
<sql id="selectEquityFundLogVo">
select id, equity_fund_type, equity_fund,
, new_uid, terminal_trace, out_trade_no, is_delete,
create_by, create_time, update_by, update_time, remark,
account,nick_name,phone,new_account,new_nick_name,new_phone
from s_equity_fund_log
select id, equity_fund_type, equity_fund, uid, new_uid, terminal_trace, out_trade_no, is_delete, create_by, create_time, update_by, update_time, remark, phone, account, nick_name, new_phone, new_account, new_nick_name, avatar, new_avatar from s_equity_fund_log
</sql>
<select id="selectEquityFundLogList" parameterType="EquityFundLog" resultMap="EquityFundLogResult">
<include refid="selectEquityFundLogVo"/>
<where>
<where>
<if test="equityFundType != null and equityFundType != ''"> and equity_fund_type = #{equityFundType}</if>
<if test="equityFund != null "> and equity_fund = #{equityFund}</if>
<if test="uid != null "> and uid = #{uid}</if>
......@@ -44,14 +42,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="terminalTrace != null and terminalTrace != ''"> and terminal_trace = #{terminalTrace}</if>
<if test="outTradeNo != null and outTradeNo != ''"> and out_trade_no = #{outTradeNo}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="account != null and account != ''"> and account = #{account}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="newPhone != null and newPhone != ''"> and new_phone = #{newPhone}</if>
<if test="newAccount != null and newAccount != ''"> and new_account = #{newAccount}</if>
<if test="newNickName != null and newNickName != ''"> and new_nick_name like concat('%', #{newNickName}, '%')</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="newAvatar != null and newAvatar != ''"> and new_avatar = #{newAvatar}</if>
</where>
</select>
<select id="selectEquityFundLogById" parameterType="Long" resultMap="EquityFundLogResult">
<include refid="selectEquityFundLogVo"/>
where id = #{id}
</select>
<insert id="insertEquityFundLog" parameterType="EquityFundLog" useGeneratedKeys="true" keyProperty="id">
insert into s_equity_fund_log
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -67,13 +73,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="account != null">account,</if>
<if test="nickName != null">nickName,</if>
<if test="phone != null">phone,</if>
<if test="newAccount != null">new_account,</if>
<if test="newNickName != null">new_nickName,</if>
<if test="account != null">account,</if>
<if test="nickName != null">nick_name,</if>
<if test="newPhone != null">new_phone,</if>
</trim>
<if test="newAccount != null">new_account,</if>
<if test="newNickName != null">new_nick_name,</if>
<if test="avatar != null">avatar,</if>
<if test="newAvatar != null">new_avatar,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equityFundType != null and equityFundType != ''">#{equityFundType},</if>
<if test="equityFund != null">#{equityFund},</if>
......@@ -87,13 +95,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="phone != null">#{phone},</if>
<if test="account != null">#{account},</if>
<if test="nickName != null">#{nickName},</if>
<if test="phone != null">#{phone},</if>
<if test="newAccount != null">#{new_account},</if>
<if test="newNickName != null">#{new_nickName},</if>
<if test="newPhone != null">#{new_phone},</if>
</trim>
<if test="newPhone != null">#{newPhone},</if>
<if test="newAccount != null">#{newAccount},</if>
<if test="newNickName != null">#{newNickName},</if>
<if test="avatar != null">#{avatar},</if>
<if test="newAvatar != null">#{newAvatar},</if>
</trim>
</insert>
<update id="updateEquityFundLog" parameterType="EquityFundLog">
......@@ -111,6 +121,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="account != null">account = #{account},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="newPhone != null">new_phone = #{newPhone},</if>
<if test="newAccount != null">new_account = #{newAccount},</if>
<if test="newNickName != null">new_nick_name = #{newNickName},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="newAvatar != null">new_avatar = #{newAvatar},</if>
</trim>
where id = #{id}
</update>
......@@ -120,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteEquityFundLogByIds" parameterType="String">
delete from s_equity_fund_log where id in
delete from s_equity_fund_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.SharingActivitiesMapper">
<resultMap type="SharingActivities" id="SharingActivitiesResult">
<result property="id" column="id" />
<result property="activityType" column="activity_type" />
......@@ -15,27 +15,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="avatar" column="avatar" />
<result property="newAvatar" column="new_avatar" />
<result property="nickName" column="nick_name" />
<result property="newNickName" column="new_nick_name" />
<result property="phone" column="phone" />
<result property="newPhone" column="new_phone" />
</resultMap>
<sql id="selectSharingActivitiesVo">
select id, activity_type, uid, new_uid, is_delete, create_by, create_time, update_by, update_time, remark from s_sharing_activities
select id, activity_type, uid, new_uid, is_delete, create_by, create_time, update_by, update_time, remark, avatar, new_avatar, nick_name, new_nick_name, phone, new_phone from s_sharing_activities
</sql>
<select id="selectSharingActivitiesList" parameterType="SharingActivities" resultMap="SharingActivitiesResult">
<include refid="selectSharingActivitiesVo"/>
<where>
<where>
<if test="activityType != null and activityType != ''"> and activity_type = #{activityType}</if>
<if test="uid != null "> and uid = #{uid}</if>
<if test="newUid != null "> and new_uid = #{newUid}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="newAvatar != null and newAvatar != ''"> and new_avatar = #{newAvatar}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="newNickName != null and newNickName != ''"> and new_nick_name like concat('%', #{newNickName}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="newPhone != null and newPhone != ''"> and new_phone = #{newPhone}</if>
</where>
</select>
<select id="selectSharingActivitiesById" parameterType="Long" resultMap="SharingActivitiesResult">
<include refid="selectSharingActivitiesVo"/>
where id = #{id}
</select>
<insert id="insertSharingActivities" parameterType="SharingActivities" useGeneratedKeys="true" keyProperty="id">
insert into s_sharing_activities
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -48,7 +60,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<if test="avatar != null">avatar,</if>
<if test="newAvatar != null">new_avatar,</if>
<if test="nickName != null">nick_name,</if>
<if test="newNickName != null">new_nick_name,</if>
<if test="phone != null">phone,</if>
<if test="newPhone != null">new_phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="activityType != null and activityType != ''">#{activityType},</if>
<if test="uid != null">#{uid},</if>
......@@ -59,7 +77,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
<if test="avatar != null">#{avatar},</if>
<if test="newAvatar != null">#{newAvatar},</if>
<if test="nickName != null">#{nickName},</if>
<if test="newNickName != null">#{newNickName},</if>
<if test="phone != null">#{phone},</if>
<if test="newPhone != null">#{newPhone},</if>
</trim>
</insert>
<update id="updateSharingActivities" parameterType="SharingActivities">
......@@ -74,6 +98,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="newAvatar != null">new_avatar = #{newAvatar},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="newNickName != null">new_nick_name = #{newNickName},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="newPhone != null">new_phone = #{newPhone},</if>
</trim>
where id = #{id}
</update>
......@@ -83,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteSharingActivitiesByIds" parameterType="String">
delete from s_sharing_activities where id in
delete from s_sharing_activities where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
......
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