Commit eb238729 by 吕明尚

修改集点活动和活动配置表

parent 31320231
......@@ -50,7 +50,7 @@ public class PointActivities extends BaseEntity {
* 已累计点数
*/
@Excel(name = "已累计点数")
private Long points;
private Integer points;
/**
* 上次消费时间
......@@ -63,13 +63,13 @@ public class PointActivities extends BaseEntity {
* 是否可领取
*/
@Excel(name = "是否可领取")
private Long isReceive;
private Integer isReceive;
/**
* 是否已领取优惠券
*/
@Excel(name = "是否已领取优惠券")
private Long couponReceived;
private Integer couponReceived;
/**
* 优惠券领取日期
......
......@@ -35,13 +35,13 @@ public class PointActivitiesConf extends BaseEntity {
* 集点所需的消费次数
*/
@Excel(name = "集点所需的消费次数")
private Long pointsRequired;
private Integer pointsRequired;
/**
* 每次消费的时间间隔(小时)
*/
@Excel(name = "每次消费的时间间隔(小时)")
private Long timeInterval;
private Integer timeInterval;
/**
* 优惠券Id
......@@ -53,19 +53,19 @@ public class PointActivitiesConf extends BaseEntity {
* 优惠券的领取期限 (天)
*/
@Excel(name = "优惠券的领取期限 (天)")
private Long collectionDeadline;
private Integer collectionDeadline;
/**
* 优惠券的使用期限 (天)
*/
@Excel(name = "优惠券的使用期限 (天)")
private Long couponDuration;
private Integer couponDuration;
/**
* 集点活动的重置周期 (月)
*/
@Excel(name = "集点活动的重置周期 (月)")
private Long collectionResetPeriod;
private Integer collectionResetPeriod;
/**
* 是否开启
......
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import share.system.domain.PointActivities;
import share.system.domain.PointActivitiesConf;
import share.system.domain.SConsumer;
import share.system.domain.SOrder;
import share.system.domain.vo.PointActivitiesVo;
import share.system.mapper.PointActivitiesMapper;
import share.system.service.PointActivitiesConfService;
import share.system.service.PointActivitiesService;
import share.system.service.SConsumerService;
import java.util.List;
......@@ -21,6 +29,10 @@ import java.util.List;
public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMapper, PointActivities> implements PointActivitiesService {
@Autowired
private PointActivitiesMapper pointActivitiesMapper;
@Autowired
private SConsumerService sConsumerService;
@Autowired
private PointActivitiesConfService pointActivitiesConfService;
/**
* 查询用户集点活动
......@@ -68,6 +80,30 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
return pointActivitiesMapper.updatePointActivities(pointActivities);
}
//参与集点活动
public void joinPointActivities(SOrder sOrder) {
SConsumer user = sConsumerService.getInfo();
PointActivitiesConf pointActivitiesConf = pointActivitiesConfService.list().get(0);
PointActivities oldPointActivities = pointActivitiesMapper.selectOne(new LambdaQueryWrapper<PointActivities>().eq(PointActivities::getConsumerId, user.getId()));
if (ObjectUtil.isNotEmpty(oldPointActivities)) {
oldPointActivities.setPoints(oldPointActivities.getPoints() + YesNoEnum.yes.getIndex());
oldPointActivities.setLastConsumptionTime(sOrder.getPayTime());
if (oldPointActivities.getPoints().equals(pointActivitiesConf.getPointsRequired())) {
oldPointActivities.setIsReceive(YesNoEnum.yes.getIndex());
}
} else {
PointActivities pointActivities = new PointActivities();
pointActivities.setConsumerId(user.getId());
pointActivities.setConfId(pointActivitiesConf.getId());
pointActivities.setCouponId(pointActivitiesConf.getCouponId());
pointActivities.setPoints(YesNoEnum.yes.getIndex());
pointActivities.setLastConsumptionTime(sOrder.getPayTime());
pointActivities.setIsReceive(YesNoEnum.no.getIndex());
pointActivities.setCouponReceived(YesNoEnum.no.getIndex());
save(pointActivities);
}
}
/**
* 批量删除用户集点活动
*
......
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