Commit 9f7181c3 by 吕明尚

Merge branch 'dev' into test

parents bdc5fc9e e5d6e325
package share.web.controller.system; package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log; import share.common.annotation.Log;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.vo.SConsumerVo; import share.system.domain.vo.SConsumerVo;
import share.system.service.SConsumerService; import share.system.service.SConsumerService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* 会员用户Controller * 会员用户Controller
...@@ -121,4 +115,12 @@ public class SConsumerController extends BaseController ...@@ -121,4 +115,12 @@ public class SConsumerController extends BaseController
{ {
return toAjax(sConsumerService.deleteSConsumerByIds(ids)); return toAjax(sConsumerService.deleteSConsumerByIds(ids));
} }
/**
* 赠送时长
*/
@PostMapping("/giveNumber")
public AjaxResult giveNumber(@RequestBody SConsumer sConsumer) {
return toAjax(sConsumerService.giveNumber(sConsumer));
}
} }
...@@ -60,9 +60,15 @@ public class PointActivities extends BaseEntity { ...@@ -60,9 +60,15 @@ public class PointActivities extends BaseEntity {
private Date lastConsumptionTime; private Date lastConsumptionTime;
/** /**
* 当前活动月份 * 当前活动
*/ */
@Excel(name = "当前活动月份") @Excel(name = "当前活动年")
private Integer currentYear;
/**
* 当前活动月
*/
@Excel(name = "当前活动月")
private Integer currentMonth; private Integer currentMonth;
/** /**
......
...@@ -62,6 +62,9 @@ public class SConsumer implements Serializable ...@@ -62,6 +62,9 @@ public class SConsumer implements Serializable
@ApiModelProperty(value = "详细地址") @ApiModelProperty(value = "详细地址")
private String addres; private String addres;
@ApiModelProperty(value = "抽奖次数")
private Integer prizeDrawNumbr;
/** 充值余额 */ /** 充值余额 */
@ApiModelProperty(value = "充值余额") @ApiModelProperty(value = "充值余额")
private BigDecimal amount; private BigDecimal amount;
......
...@@ -63,9 +63,15 @@ public class PointActivitiesVo extends BaseEntity { ...@@ -63,9 +63,15 @@ public class PointActivitiesVo extends BaseEntity {
private Date lastConsumptionTime; private Date lastConsumptionTime;
/** /**
* 当前活动月份 * 当前活动
*/ */
@Excel(name = "当前活动月份") @Excel(name = "当前活动年")
private Integer currentYear;
/**
* 当前活动月
*/
@Excel(name = "当前活动月")
private Integer currentMonth; private Integer currentMonth;
/** /**
......
...@@ -132,4 +132,5 @@ public interface SConsumerService extends IService<SConsumer> ...@@ -132,4 +132,5 @@ public interface SConsumerService extends IService<SConsumer>
TableDataInfo selectConsumernotById(SConsumerVo sConsumer); TableDataInfo selectConsumernotById(SConsumerVo sConsumer);
int giveNumber(SConsumer sConsumer);
} }
...@@ -107,8 +107,9 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe ...@@ -107,8 +107,9 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
pointActivities.setLastConsumptionTime(sOrder.getPayTime()); pointActivities.setLastConsumptionTime(sOrder.getPayTime());
pointActivities.setIsReceive(YesNoEnum.no.getIndex()); pointActivities.setIsReceive(YesNoEnum.no.getIndex());
pointActivities.setCouponReceived(YesNoEnum.no.getIndex()); pointActivities.setCouponReceived(YesNoEnum.no.getIndex());
LocalDate currentDate = LocalDate.now(); //获取当前年月
pointActivities.setCurrentMonth(currentDate.getMonthValue()); pointActivities.setCurrentYear(LocalDate.now().getYear());
pointActivities.setCurrentMonth(LocalDate.now().getMonthValue());
save(pointActivities); save(pointActivities);
} }
} }
...@@ -121,7 +122,7 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe ...@@ -121,7 +122,7 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
//领取的时间小于领取期限(最后的时间加领取的期限) //领取的时间小于领取期限(最后的时间加领取的期限)
if (DateUtils.addDays(pointActivities.getLastConsumptionTime(), activitiesConf.getCollectionDeadline()).compareTo(new Date()) < 0 if (DateUtils.addDays(pointActivities.getLastConsumptionTime(), activitiesConf.getCollectionDeadline()).compareTo(new Date()) < 0
&& pointActivities.getPoints().equals(activitiesConf.getPointsRequired())) { && pointActivities.getPoints().equals(activitiesConf.getPointsRequired())) {
if (pointActivities.getCurrentMonth().compareTo(LocalDate.now().getMonthValue()) == 0) { if (pointActivities.getCurrentMonth().compareTo(LocalDate.now().getMonthValue()) == 0 && pointActivities.getCurrentYear().compareTo(LocalDate.now().getYear()) == 0) {
pointActivities.setCouponReceived(YesNoEnum.yes.getIndex()); pointActivities.setCouponReceived(YesNoEnum.yes.getIndex());
pointActivities.setReceivedDate(new Date()); pointActivities.setReceivedDate(new Date());
sConsumerCouponService.give(pointActivities.getConsumerId(), activitiesConf.getCouponId(), activitiesConf.getCouponDuration()); sConsumerCouponService.give(pointActivities.getConsumerId(), activitiesConf.getCouponId(), activitiesConf.getCouponDuration());
...@@ -134,6 +135,7 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe ...@@ -134,6 +135,7 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
newPointActivities.setCouponId(activitiesConf.getCouponId()); newPointActivities.setCouponId(activitiesConf.getCouponId());
newPointActivities.setPoints(YesNoEnum.no.getIndex()); newPointActivities.setPoints(YesNoEnum.no.getIndex());
newPointActivities.setCurrentMonth(LocalDate.now().getMonthValue()); newPointActivities.setCurrentMonth(LocalDate.now().getMonthValue());
newPointActivities.setCurrentYear(LocalDate.now().getYear());
pointActivitiesMapper.insert(newPointActivities); pointActivitiesMapper.insert(newPointActivities);
} }
} else { } else {
......
...@@ -387,6 +387,16 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -387,6 +387,16 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
return tableDataInfo; return tableDataInfo;
} }
@Override
public int giveNumber(SConsumer sConsumer) {
SConsumer byId = sConsumerService.getById(sConsumer.getId());
byId.setPrizeDrawNumbr(byId.getPrizeDrawNumbr() + sConsumer.getPrizeDrawNumbr());
if (sConsumerService.updateById(byId)) {
return 1;
}
return 0;
}
@Override @Override
public int addCleanConsumer(SConsumer sConsumer) { public int addCleanConsumer(SConsumer sConsumer) {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result property="couponId" column="coupon_id"/> <result property="couponId" column="coupon_id"/>
<result property="couponName" column="coupon_name"/> <result property="couponName" column="coupon_name"/>
<result property="points" column="points"/> <result property="points" column="points"/>
<result property="currentYear" column="current_year"/>
<result property="currentMonth" column="current_month"/> <result property="currentMonth" column="current_month"/>
<result property="lastConsumptionTime" column="last_consumption_time"/> <result property="lastConsumptionTime" column="last_consumption_time"/>
<result property="isReceive" column="is_receive"/> <result property="isReceive" column="is_receive"/>
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
conf_id, conf_id,
coupon_id, coupon_id,
points, points,
current_year,
current_month, current_month,
last_consumption_time, last_consumption_time,
is_receive, is_receive,
...@@ -62,6 +64,7 @@ ...@@ -62,6 +64,7 @@
p.coupon_id, p.coupon_id,
c1.name as 'coupon_name', c1.name as 'coupon_name',
p.points, p.points,
p.current_year,
p.current_month, p.current_month,
p.last_consumption_time, p.last_consumption_time,
p.is_receive, p.is_receive,
...@@ -85,6 +88,7 @@ ...@@ -85,6 +88,7 @@
<if test="confId != null ">and p.conf_id = #{confId}</if> <if test="confId != null ">and p.conf_id = #{confId}</if>
<if test="couponId != null ">and p.coupon_id = #{couponId}</if> <if test="couponId != null ">and p.coupon_id = #{couponId}</if>
<if test="points != null ">and p.points = #{points}</if> <if test="points != null ">and p.points = #{points}</if>
<if test="currentYear != null">and p.current_year = #{currentYear}</if>
<if test="currentMonth != null">and p.current_month = #{currentMonth}</if> <if test="currentMonth != null">and p.current_month = #{currentMonth}</if>
<if test="lastConsumptionTime != null ">and p.last_consumption_time = #{lastConsumptionTime}</if> <if test="lastConsumptionTime != null ">and p.last_consumption_time = #{lastConsumptionTime}</if>
<if test="isReceive != null ">and p.is_receive = #{isReceive}</if> <if test="isReceive != null ">and p.is_receive = #{isReceive}</if>
...@@ -108,6 +112,7 @@ ...@@ -108,6 +112,7 @@
<if test="confId != null">conf_id,</if> <if test="confId != null">conf_id,</if>
<if test="couponId != null">coupon_id,</if> <if test="couponId != null">coupon_id,</if>
<if test="points != null">points,</if> <if test="points != null">points,</if>
<if test="currentYear != null">current_year,</if>
<if test="currentMonth != null">current_month,</if> <if test="currentMonth != null">current_month,</if>
<if test="lastConsumptionTime != null">last_consumption_time,</if> <if test="lastConsumptionTime != null">last_consumption_time,</if>
<if test="isReceive != null">is_receive,</if> <if test="isReceive != null">is_receive,</if>
...@@ -126,6 +131,7 @@ ...@@ -126,6 +131,7 @@
<if test="confId != null">#{confId},</if> <if test="confId != null">#{confId},</if>
<if test="couponId != null">#{couponId},</if> <if test="couponId != null">#{couponId},</if>
<if test="points != null">#{points},</if> <if test="points != null">#{points},</if>
<if test="currentYear != null">#{currentYear},</if>
<if test="currentMonth != null">#{currentMonth},</if> <if test="currentMonth != null">#{currentMonth},</if>
<if test="lastConsumptionTime != null">#{lastConsumptionTime},</if> <if test="lastConsumptionTime != null">#{lastConsumptionTime},</if>
<if test="isReceive != null">#{isReceive},</if> <if test="isReceive != null">#{isReceive},</if>
...@@ -148,6 +154,7 @@ ...@@ -148,6 +154,7 @@
<if test="confId != null">conf_id = #{confId},</if> <if test="confId != null">conf_id = #{confId},</if>
<if test="couponId != null">coupon_id = #{couponId},</if> <if test="couponId != null">coupon_id = #{couponId},</if>
<if test="points != null">points = #{points},</if> <if test="points != null">points = #{points},</if>
<if test="currentYear != null">current_year = #{currentYear},</if>
<if test="currentMonth != null">current_month = #{currentMonth},</if> <if test="currentMonth != null">current_month = #{currentMonth},</if>
<if test="lastConsumptionTime != null">last_consumption_time = #{lastConsumptionTime},</if> <if test="lastConsumptionTime != null">last_consumption_time = #{lastConsumptionTime},</if>
<if test="isReceive != null">is_receive = #{isReceive},</if> <if test="isReceive != null">is_receive = #{isReceive},</if>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<result property="level" column="level" /> <result property="level" column="level" />
<result property="roleType" column="role_type" /> <result property="roleType" column="role_type" />
<result property="sex" column="sex" /> <result property="sex" column="sex" />
<result property="prizeDrawNumbr" column="prize_draw_numbr"/>
<result property="addres" column="addres" /> <result property="addres" column="addres" />
<result property="amount" column="amount" /> <result property="amount" column="amount" />
<result property="freeAmount" column="free_amount" /> <result property="freeAmount" column="free_amount" />
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
level, level,
role_type, role_type,
sex, sex,
prize_draw_numbr,
addres, addres,
amount, amount,
free_amount, free_amount,
...@@ -62,6 +64,7 @@ ...@@ -62,6 +64,7 @@
<if test="level != null "> and level = #{level}</if> <if test="level != null "> and level = #{level}</if>
<if test="roleType != null "> and role_type = #{roleType}</if> <if test="roleType != null "> and role_type = #{roleType}</if>
<if test="sex != null "> and sex = #{sex}</if> <if test="sex != null "> and sex = #{sex}</if>
<if test="prizeDrawNumbr != null">and prize_draw_numbr = #{prizeDrawNumbr}</if>
<if test="addres != null and addres != ''"> and addres = #{addres}</if> <if test="addres != null and addres != ''"> and addres = #{addres}</if>
<if test="amount != null "> and amount = #{amount}</if> <if test="amount != null "> and amount = #{amount}</if>
<if test="freeAmount != null "> and free_amount = #{freeAmount}</if> <if test="freeAmount != null "> and free_amount = #{freeAmount}</if>
...@@ -112,6 +115,7 @@ ...@@ -112,6 +115,7 @@
t1.level, t1.level,
t1.role_type, t1.role_type,
t1.sex, t1.sex,
t1.prize_draw_numbr,
t1.addres, t1.addres,
t1.amount, t1.amount,
t1.free_amount, t1.free_amount,
...@@ -147,6 +151,7 @@ ...@@ -147,6 +151,7 @@
<if test="level != null">level,</if> <if test="level != null">level,</if>
<if test="roleType != null">role_type,</if> <if test="roleType != null">role_type,</if>
<if test="sex != null">sex,</if> <if test="sex != null">sex,</if>
<if test="prizeDrawNumbr !=null">prize_draw_numbr,</if>
<if test="addres != null">addres,</if> <if test="addres != null">addres,</if>
<if test="amount != null">amount,</if> <if test="amount != null">amount,</if>
<if test="freeAmount != null">free_amount,</if> <if test="freeAmount != null">free_amount,</if>
...@@ -166,6 +171,7 @@ ...@@ -166,6 +171,7 @@
<if test="level != null">#{level},</if> <if test="level != null">#{level},</if>
<if test="roleType != null">#{roleType},</if> <if test="roleType != null">#{roleType},</if>
<if test="sex != null">#{sex},</if> <if test="sex != null">#{sex},</if>
<if test="prizeDrawNumbr != null">#{prizeDrawNumbr},</if>
<if test="addres != null">#{addres},</if> <if test="addres != null">#{addres},</if>
<if test="amount != null">#{amount},</if> <if test="amount != null">#{amount},</if>
<if test="freeAmount != null">#{freeAmount},</if> <if test="freeAmount != null">#{freeAmount},</if>
...@@ -189,6 +195,7 @@ ...@@ -189,6 +195,7 @@
<if test="level != null">level = #{level},</if> <if test="level != null">level = #{level},</if>
<if test="roleType != null">role_type = #{roleType},</if> <if test="roleType != null">role_type = #{roleType},</if>
<if test="sex != null">sex = #{sex},</if> <if test="sex != null">sex = #{sex},</if>
<if test="prizeDrawNumbr != null">prize_draw_numbr = #{prizeDrawNumbr},</if>
<if test="addres != null">addres = #{addres},</if> <if test="addres != null">addres = #{addres},</if>
<if test="amount != null">amount = #{amount},</if> <if test="amount != null">amount = #{amount},</if>
<if test="freeAmount != null">free_amount = #{freeAmount},</if> <if test="freeAmount != null">free_amount = #{freeAmount},</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