Commit 08291522 by 吕明尚

首页的用户信息添加优惠卷数量

parent 538f83d0
package share.web.controller.system; package share.web.controller.system;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
...@@ -28,9 +28,13 @@ public class SConsumerCouponController extends BaseController { ...@@ -28,9 +28,13 @@ public class SConsumerCouponController extends BaseController {
/** /**
* 查询优惠券领取记录列表 * 查询优惠券领取记录列表
*/ */
@PreAuthorize("@ss.hasPermi('system:coupon:list')") // @PreAuthorize("@ss.hasPermi('system:coupon:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SConsumerCoupon sConsumerCoupon) { public TableDataInfo list( String useStatus) {
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
if(StringUtils.isNotBlank(useStatus)){
sConsumerCoupon.setUseStatus(useStatus);
}
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sConsumerCoupon.setConsumerId(user.getId()); sConsumerCoupon.setConsumerId(user.getId());
startPage(); startPage();
...@@ -41,17 +45,19 @@ public class SConsumerCouponController extends BaseController { ...@@ -41,17 +45,19 @@ public class SConsumerCouponController extends BaseController {
/** /**
* 获取优惠券领取记录详细信息 * 获取优惠券领取记录详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:coupon:query')") // @PreAuthorize("@ss.hasPermi('system:coupon:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(sConsumerCouponService.selectSConsumerCouponById(id)); return success(sConsumerCouponService.selectSConsumerCouponById(id));
} }
@PreAuthorize("@ss.hasPermi('system:coupon:list')") // @PreAuthorize("@ss.hasPermi('system:coupon:list')")
@GetMapping("/query") @PostMapping("/query")
public List<SConsumerCoupon> query(SConsumerCoupon sConsumerCoupon) { public List<SConsumerCoupon> query(@RequestBody SConsumerCoupon sConsumerCoupon) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sConsumerCoupon.setUseStatus("0");
sConsumerCoupon.setConsumerId(user.getId()); sConsumerCoupon.setConsumerId(user.getId());
return sConsumerCouponService.selectSConsumerCouponList(sConsumerCoupon); return sConsumerCouponService.selectSConsumerCouponList(sConsumerCoupon);
} }
......
...@@ -18,7 +18,7 @@ import share.common.core.domain.BaseEntity; ...@@ -18,7 +18,7 @@ import share.common.core.domain.BaseEntity;
* @date 2023-09-27 * @date 2023-09-27
*/ */
@Data @Data
public class SConsumer extends BaseEntity public class SConsumer
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -88,4 +88,7 @@ public class SConsumer extends BaseEntity ...@@ -88,4 +88,7 @@ public class SConsumer extends BaseEntity
@ApiModelProperty(value = "最后一次登录时间") @ApiModelProperty(value = "最后一次登录时间")
private Date lastLoginTime; private Date lastLoginTime;
@ApiModelProperty(value = "优惠卷数量")
private Integer number;
} }
...@@ -59,4 +59,6 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon> ...@@ -59,4 +59,6 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon>
* @return 结果 * @return 结果
*/ */
public int deleteSConsumerCouponByIds(Long[] ids); public int deleteSConsumerCouponByIds(Long[] ids);
int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon);
} }
...@@ -59,4 +59,6 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon> ...@@ -59,4 +59,6 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
* @return 结果 * @return 结果
*/ */
public int deleteSConsumerCouponById(Long id); public int deleteSConsumerCouponById(Long id);
int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon);
} }
...@@ -94,4 +94,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -94,4 +94,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
{ {
return sConsumerCouponMapper.deleteSConsumerCouponById(id); return sConsumerCouponMapper.deleteSConsumerCouponById(id);
} }
@Override
public int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon) {
return sConsumerCouponMapper.selectSConsumerCouponConut(sConsumerCoupon);
}
} }
...@@ -15,11 +15,13 @@ import share.common.constant.SmsConstants; ...@@ -15,11 +15,13 @@ import share.common.constant.SmsConstants;
import share.common.exception.base.BaseException; import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil; import share.common.utils.BaseUtil;
import share.common.utils.DateUtil; import share.common.utils.DateUtil;
import share.system.domain.SConsumerCoupon;
import share.system.domain.vo.FrontTokenComponent; import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SConsumerVo; import share.system.domain.vo.SConsumerVo;
import share.system.mapper.SConsumerMapper; import share.system.mapper.SConsumerMapper;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.request.RegisterThirdSConsumerRequest; import share.system.request.RegisterThirdSConsumerRequest;
import share.system.service.ISConsumerCouponService;
import share.system.service.SConsumerService; import share.system.service.SConsumerService;
/** /**
...@@ -37,6 +39,9 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -37,6 +39,9 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Autowired @Autowired
private FrontTokenComponent tokenComponet; private FrontTokenComponent tokenComponet;
@Autowired
private ISConsumerCouponService sConsumerCouponService;
/** /**
* 查询会员用户 * 查询会员用户
* *
...@@ -153,6 +158,13 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -153,6 +158,13 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Override @Override
public SConsumer getSConsumer() { public SConsumer getSConsumer() {
SConsumer currentUser = getInfo(); SConsumer currentUser = getInfo();
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(currentUser.getId());
sConsumerCoupon.setUseStatus("0");
int count = sConsumerCouponService.selectSConsumerCouponConut(sConsumerCoupon);
if(count>0){
currentUser.setNumber(count);
}
if (ObjectUtil.isNull(currentUser)) { if (ObjectUtil.isNull(currentUser)) {
throw new BaseException("您的登录已过期,请先登录"); throw new BaseException("您的登录已过期,请先登录");
} }
......
...@@ -67,6 +67,9 @@ ...@@ -67,6 +67,9 @@
<include refid="selectSConsumerCouponVo"/> <include refid="selectSConsumerCouponVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="selectSConsumerCouponConut" resultType="java.lang.Integer">
select count(1) from s_consumer_coupon where consumer_id = #{consumerId} and use_status = 0
</select>
<insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id">
insert into s_consumer_coupon insert into s_consumer_coupon
......
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