删除优惠卷
新版优惠卷
This commit is contained in:
@@ -56,10 +56,6 @@ public class BuyOrderController {
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private CouponHistoryService couponHistoryService;
|
||||
@Autowired
|
||||
private OrderCartService orderCartService;
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
@@ -241,7 +237,7 @@ public class BuyOrderController {
|
||||
totalPrice = totalPrice.add(price.multiply(BigDecimal.valueOf(quantity)));
|
||||
}
|
||||
//商品价格减去优惠券的优惠金额
|
||||
totalPrice = totalPrice.subtract(useCouponAmount(buyOrder));
|
||||
// totalPrice = totalPrice.subtract(0);
|
||||
|
||||
//加上运费金额
|
||||
totalPrice = totalPrice.add(getShoppingAmount(buyOrder));
|
||||
@@ -467,12 +463,6 @@ public class BuyOrderController {
|
||||
if (buyOrder == null) {
|
||||
return R.error("订单不存在");
|
||||
}
|
||||
if (buyOrder.getCouponId() != null) {
|
||||
Integer couponId = buyOrder.getCouponId();
|
||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(couponId);
|
||||
couponHistory.setUseStatus(0);
|
||||
couponHistoryService.updateById(couponHistory);
|
||||
}
|
||||
// 库存回滚
|
||||
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderProductQueryWrapper.eq("order_id", buyOrder.getOrderId());
|
||||
@@ -519,14 +509,6 @@ public class BuyOrderController {
|
||||
//1. 判断订单状态
|
||||
BuyOrder byId = buyOrderService.getById(orderId);
|
||||
if (byId != null) {
|
||||
//2. 判断当前订单是否存在优惠券 进行 回显
|
||||
Integer couponId = byId.getCouponId();
|
||||
if (couponId != null) {
|
||||
|
||||
CouponHistoryEntity byId1 = couponHistoryService.getById(couponId);
|
||||
byId1.setUseStatus(0);
|
||||
couponHistoryService.updateById(byId1);
|
||||
}
|
||||
// 库存回滚
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", byId.getOrderId()));
|
||||
@@ -832,26 +814,6 @@ public class BuyOrderController {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用优惠券
|
||||
*
|
||||
* @param buyOrder
|
||||
* @return
|
||||
*/
|
||||
private BigDecimal useCouponAmount(BuyOrder buyOrder) {
|
||||
Integer couponId = buyOrder.getCouponId();
|
||||
if (couponId != null&&couponId!=0) {
|
||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(couponId);
|
||||
couponHistory.setUseStatus(1);
|
||||
couponHistory.setUseTime(new Date());
|
||||
couponHistory.setOrderId(Long.valueOf(buyOrder.getOrderId()));
|
||||
couponHistory.setOrderSn(buyOrder.getOrderSn());
|
||||
CouponEntity coupon = couponService.getById(couponHistory.getCouponId());
|
||||
|
||||
return coupon.getCouponAmount();
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.peanut.modules.book.service.CouponProductCategoryRelationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
import com.peanut.modules.book.service.CouponService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/coupon")
|
||||
public class CouponController {
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private CouponProductCategoryRelationService couponProductCategoryRelationService;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:coupon:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = couponService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
// @RequiresPermissions("book:coupon:info")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
CouponEntity coupon = couponService.getById(id);
|
||||
|
||||
return R.ok().put("coupon", coupon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
// @RequiresPermissions("book:coupon:save")
|
||||
public R save(@RequestBody CouponEntity coupon){
|
||||
|
||||
if(0 == coupon.getTakeEffectType()){
|
||||
coupon.setTakeEffectDate(new Date());
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DATE,Integer.valueOf(coupon.getValidity()).intValue());
|
||||
coupon.setExpirationDate(cal.getTime());
|
||||
}else{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(coupon.getTakeEffectDate());
|
||||
cal.add(Calendar.DATE,Integer.valueOf(coupon.getValidity()).intValue());
|
||||
coupon.setExpirationDate(cal.getTime());
|
||||
}
|
||||
couponService.save(coupon);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:coupon:update")
|
||||
public R update(@RequestBody CouponEntity coupon){
|
||||
|
||||
if(0 == coupon.getTakeEffectType()){
|
||||
coupon.setTakeEffectDate(new Date());
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DATE,Integer.valueOf(coupon.getValidity()).intValue());
|
||||
coupon.setExpirationDate(cal.getTime());
|
||||
}else{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(coupon.getTakeEffectDate());
|
||||
cal.add(Calendar.DATE,Integer.valueOf(coupon.getValidity()).intValue());
|
||||
coupon.setExpirationDate(cal.getTime());
|
||||
}
|
||||
couponService.updateById(coupon);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:coupon:delete")
|
||||
public R delete(@RequestBody Long[] ids){
|
||||
couponService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
import com.peanut.modules.book.service.CouponService;
|
||||
import com.peanut.modules.book.vo.UserCouponVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.peanut.modules.common.entity.CouponHistoryEntity;
|
||||
import com.peanut.modules.book.service.CouponHistoryService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/couponhistory")
|
||||
public class CouponHistoryController {
|
||||
@Autowired
|
||||
private CouponHistoryService couponHistoryService;
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:couponhistory:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = couponHistoryService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
// @RequiresPermissions("book:couponhistory:info")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(id);
|
||||
|
||||
return R.ok().put("couponHistory", couponHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
// @RequiresPermissions("book:couponhistory:save")
|
||||
public R save(@RequestBody CouponHistoryEntity couponHistory){
|
||||
|
||||
List<CouponHistoryEntity> ch = this.couponHistoryService.list(new QueryWrapper<CouponHistoryEntity>().eq("coupon_id", couponHistory.getCouponId()));
|
||||
|
||||
CouponEntity coupon = this.couponService.getById(couponHistory.getCouponId());
|
||||
|
||||
// 查询该用户领取几张该优惠券
|
||||
List<CouponHistoryEntity> historyList = this.couponHistoryService.list(new QueryWrapper<CouponHistoryEntity>()
|
||||
.eq("coupon_id", couponHistory.getCouponId())
|
||||
.eq("member_id",couponHistory.getMemberId())
|
||||
);
|
||||
// 领取次数小于等于限领
|
||||
if(historyList.size() >= coupon.getLimitedCollar()){
|
||||
return R.ok("每人限领" + coupon.getLimitedCollar() + "张,查看后操作!");
|
||||
}
|
||||
// 优惠券发行数量大于该优惠券领用次数
|
||||
if(ch.size() <= coupon.getTotalCirculation()){
|
||||
couponHistory.setCouponProType(coupon.getCouponProType());
|
||||
couponHistoryService.save(couponHistory);
|
||||
return R.ok("添加成功!");
|
||||
}
|
||||
return R.ok("购物券数量已超过发行总量,请查看后操作!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:couponhistory:update")
|
||||
public R update(@RequestBody CouponHistoryEntity couponHistory){
|
||||
couponHistoryService.updateById(couponHistory);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:couponhistory:delete")
|
||||
public R delete(@RequestBody Long[] ids){
|
||||
couponHistoryService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* app端获取优惠券
|
||||
*/
|
||||
@RequestMapping("/appGetCoupon")
|
||||
public R appGetCoupon(){
|
||||
List<CouponEntity> list = couponHistoryService.appGetCoupon();
|
||||
|
||||
return R.ok().put("list",list);
|
||||
}
|
||||
|
||||
/**
|
||||
* app端下单获取用户个人优惠券
|
||||
*/
|
||||
@RequestMapping("/appGetUserCoupon")
|
||||
public R appGetUserCoupon(@RequestParam("userId") Integer userId,
|
||||
@RequestParam("amount") String amount,
|
||||
@RequestParam("type")String type){
|
||||
List<UserCouponVo> userCoupons = couponHistoryService.appGetUserCoupon(userId,amount,type);
|
||||
|
||||
return R.ok().put("userCoupons",userCoupons);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* app端个人中心-用户个人优惠券
|
||||
*/
|
||||
@RequestMapping("/appGetUserCenterCoupon")
|
||||
public R appGetUserCenterCoupon(@RequestParam("userId") Integer userId,
|
||||
@RequestParam("useStatus") Integer useStatus){
|
||||
List<CouponHistoryEntity> couponHistoryEntities = couponHistoryService.getBaseMapper().selectList(new QueryWrapper<CouponHistoryEntity>()
|
||||
.eq("member_id", userId)
|
||||
.eq("use_status", useStatus));
|
||||
|
||||
List<UserCouponVo> couponVos = new ArrayList<>();
|
||||
for (CouponHistoryEntity couponHistoryEntity : couponHistoryEntities) {
|
||||
UserCouponVo userCouponVo = new UserCouponVo();
|
||||
Long couponId = couponHistoryEntity.getCouponId();
|
||||
CouponEntity couponEntity = couponService.getById(couponId);
|
||||
BeanUtils.copyProperties(couponHistoryEntity, userCouponVo);
|
||||
userCouponVo.setCoupons(couponEntity);
|
||||
couponVos.add(userCouponVo);
|
||||
}
|
||||
|
||||
|
||||
return R.ok().put("couponVos",couponVos).put("count",couponVos.size());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.peanut.modules.common.entity.CouponProductCategoryRelationEntity;
|
||||
import com.peanut.modules.book.service.CouponProductCategoryRelationService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/couponproductcategoryrelation")
|
||||
public class CouponProductCategoryRelationController {
|
||||
@Autowired
|
||||
private CouponProductCategoryRelationService couponProductCategoryRelationService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:couponproductcategoryrelation:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = couponProductCategoryRelationService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
// @RequiresPermissions("book:couponproductcategoryrelation:info")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
CouponProductCategoryRelationEntity couponProductCategoryRelation = couponProductCategoryRelationService.getById(id);
|
||||
|
||||
return R.ok().put("couponProductCategoryRelation", couponProductCategoryRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
// @RequiresPermissions("book:couponproductcategoryrelation:save")
|
||||
public R save(@RequestBody CouponProductCategoryRelationEntity couponProductCategoryRelation){
|
||||
|
||||
Integer integer = couponProductCategoryRelationService.getBaseMapper()
|
||||
.selectCount(new QueryWrapper<CouponProductCategoryRelationEntity>()
|
||||
.eq("coupon_id", couponProductCategoryRelation.getCouponId())
|
||||
.eq("product_category_id", couponProductCategoryRelation.getProductCategoryId()));
|
||||
if (integer != 0) {
|
||||
return R.error("请勿重复添加!");
|
||||
}
|
||||
couponProductCategoryRelationService.save(couponProductCategoryRelation);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:couponproductcategoryrelation:update")
|
||||
public R update(@RequestBody CouponProductCategoryRelationEntity couponProductCategoryRelation){
|
||||
couponProductCategoryRelationService.updateById(couponProductCategoryRelation);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:couponproductcategoryrelation:delete")
|
||||
public R delete(@RequestBody Long[] ids){
|
||||
System.out.println("ids==============>"+ids);
|
||||
couponProductCategoryRelationService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.peanut.modules.common.entity.CouponProductRelationEntity;
|
||||
import com.peanut.modules.book.service.CouponProductRelationService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/couponproductrelation")
|
||||
public class CouponProductRelationController {
|
||||
@Autowired
|
||||
private CouponProductRelationService couponProductRelationService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:couponproductrelation:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = couponProductRelationService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
// @RequiresPermissions("book:couponproductrelation:info")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
CouponProductRelationEntity couponProductRelation = couponProductRelationService.getById(id);
|
||||
|
||||
return R.ok().put("couponProductRelation", couponProductRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
// @RequiresPermissions("book:couponproductrelation:save")
|
||||
public R save(@RequestBody CouponProductRelationEntity couponProductRelation){
|
||||
|
||||
Integer integer = couponProductRelationService.getBaseMapper()
|
||||
.selectCount(new QueryWrapper<CouponProductRelationEntity>()
|
||||
.eq("coupon_id", couponProductRelation.getCouponId())
|
||||
.eq("product_id", couponProductRelation.getProductId()));
|
||||
if (integer != 0) {
|
||||
return R.error("请勿重复添加!");
|
||||
}
|
||||
|
||||
couponProductRelationService.save(couponProductRelation);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:couponproductrelation:update")
|
||||
public R update(@RequestBody CouponProductRelationEntity couponProductRelation){
|
||||
couponProductRelationService.updateById(couponProductRelation);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:couponproductrelation:delete")
|
||||
public R delete(@RequestBody Long[] ids){
|
||||
couponProductRelationService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,8 +53,6 @@ public class MyUserController {
|
||||
@Autowired
|
||||
private SysUserTokenService sysUserTokenService;
|
||||
@Autowired
|
||||
private CouponHistoryService couponHistoryService;
|
||||
@Autowired
|
||||
private BookBuyConfigService bookBuyConfigService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
import com.peanut.modules.common.entity.CouponHistoryEntity;
|
||||
import com.peanut.modules.book.vo.UserCouponVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
public interface CouponHistoryService extends IService<CouponHistoryEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 执行更新 用户已领取券超过有效期后设置状态为过期
|
||||
*/
|
||||
void runCouponsUserStatusTimeOutToExpired();
|
||||
|
||||
List<CouponEntity> appGetCoupon();
|
||||
|
||||
List<UserCouponVo> appGetUserCoupon(Integer userId , String amount,String type);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.common.entity.CouponProductCategoryRelationEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
public interface CouponProductCategoryRelationService extends IService<CouponProductCategoryRelationEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.common.entity.CouponProductRelationEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
public interface CouponProductRelationService extends IService<CouponProductRelationEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-28 17:38:29
|
||||
*/
|
||||
public interface CouponService extends IService<CouponEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
||||
@@ -723,13 +723,6 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
}
|
||||
responseVo.setUserInfo(userResponseVo);
|
||||
}
|
||||
CouponResponseVo couponResponseVo = new CouponResponseVo();
|
||||
if (buyOrder.getCouponId() != null) {
|
||||
couponResponseVo.setCouponName(buyOrder.getCouponName());
|
||||
couponResponseVo.setCouponId(buyOrder.getCouponId());
|
||||
couponResponseVo.setCouponAmount(new BigDecimal(0));
|
||||
}
|
||||
responseVo.setCoupon(couponResponseVo);
|
||||
responseVo.setOrderPrice(buyOrder.getOrderMoney());
|
||||
responseVo.setRealPrice(buyOrder.getRealMoney());
|
||||
responseVo.setShippingPrice(buyOrder.getShippingMoney());
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.peanut.common.utils.DateUtil;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.vo.UserCouponVo;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
|
||||
import com.peanut.modules.common.dao.CouponHistoryDao;
|
||||
|
||||
@Slf4j
|
||||
@Service("couponHistoryService")
|
||||
public class CouponHistoryServiceImpl extends ServiceImpl<CouponHistoryDao, CouponHistoryEntity> implements CouponHistoryService {
|
||||
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private CouponProductCategoryRelationService categoryRelationService;
|
||||
@Autowired
|
||||
private CouponProductRelationService productRelationService;
|
||||
@Autowired
|
||||
private ShopProductServiceImpl shopProductService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
String userId = (String) params.get("userId");
|
||||
IPage<CouponHistoryEntity> page = this.page(
|
||||
new Query<CouponHistoryEntity>().getPage(params),
|
||||
new QueryWrapper<CouponHistoryEntity>()
|
||||
.eq(StringUtils.isNotBlank(userId), "member_id", Integer.parseInt(userId))
|
||||
);
|
||||
List<CouponHistoryEntity> records = page.getRecords();
|
||||
for (CouponHistoryEntity record : records) {
|
||||
Long couponId = record.getCouponId();
|
||||
CouponEntity byId = couponService.getById(couponId);
|
||||
if(byId != null) {
|
||||
record.setCouponName(byId.getCouponName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void runCouponsUserStatusTimeOutToExpired() {
|
||||
log.info("runCouponsUserStatusTimeOutToExpired start.......time={}", System.currentTimeMillis());
|
||||
Long startTime01 = System.currentTimeMillis();
|
||||
//查找到所有用户已领取,但未使用的用户券列表
|
||||
List<CouponHistoryEntity> couponsUserList = findListByUseStatus();
|
||||
log.info("runCouponsUserStatusTimeOutToExpired couponsUserList.size={}", couponsUserList.size());
|
||||
if (couponsUserList.size() > 0) {
|
||||
List<CouponHistoryEntity> needCouponsUserList = new ArrayList<>();
|
||||
Date currentDate = new Date();
|
||||
for (int i = 0; i < couponsUserList.size(); i++) {
|
||||
CouponHistoryEntity couponsUser = couponsUserList.get(i);
|
||||
Long couponId = couponsUser.getCouponId();
|
||||
CouponEntity couponEntity = couponService.getById(couponId);
|
||||
Date effDate = couponEntity.getTakeEffectDate();
|
||||
Date expDate = couponEntity.getExpirationDate();
|
||||
boolean isEffective = DateUtil.isEffectiveDate(currentDate, effDate, expDate);
|
||||
//券已失效 则修改用户券的状态为已过期
|
||||
if (!isEffective) {
|
||||
couponsUser.setUseStatus(2);
|
||||
needCouponsUserList.add(couponsUser); //需要更新状态的券
|
||||
couponEntity.setCurrentState("2");
|
||||
this.couponService.updateById(couponEntity);
|
||||
}
|
||||
}
|
||||
|
||||
if (needCouponsUserList.size() > 0) {
|
||||
log.info("runCouponsUserStatusTimeOutToExpired update needCouponsUserList.size={}", needCouponsUserList.size());
|
||||
saveOrUpdateBatch(needCouponsUserList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Long endTime02 = System.currentTimeMillis();
|
||||
log.info("runCouponsUserStatusTimeOutToExpired end second={},mills={}", (endTime02 - startTime01) / 1000, (endTime02 - startTime01) % 1000);
|
||||
}
|
||||
|
||||
private List<CouponHistoryEntity> findListByUseStatus() {
|
||||
List<CouponHistoryEntity> list = this.getBaseMapper().selectList(new QueryWrapper<CouponHistoryEntity>().eq("use_status", 0));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CouponEntity> appGetCoupon() {
|
||||
|
||||
//获取 当前时间 有效期内的优惠券
|
||||
|
||||
Date date = new Date();
|
||||
|
||||
List<CouponEntity> list = new ArrayList<>();
|
||||
|
||||
List<CouponEntity> couponEntityList = couponService.list(new QueryWrapper<CouponEntity>());
|
||||
|
||||
for (CouponEntity couponEntity : couponEntityList) {
|
||||
Date endTime = couponEntity.getTakeEffectDate();
|
||||
Date enableTime = couponEntity.getTakeEffectDate();
|
||||
// 判断结束日期 是否大于 当前 时间 以及 领取日期 是否 小于当前日期
|
||||
if (endTime.getTime() - date.getTime() > 0 && enableTime.getTime() - date.getTime() <= 0) {
|
||||
list.add(couponEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserCouponVo> appGetUserCoupon(Integer userId, String amount,String type) {
|
||||
|
||||
// 查询用户当前 拥有的优惠券
|
||||
// 商品 :0 ,电子书 :1
|
||||
List<CouponHistoryEntity> couponHistoryEntities = null;
|
||||
if("0".equals(type)){
|
||||
couponHistoryEntities = this.getBaseMapper().selectList(new QueryWrapper<CouponHistoryEntity>()
|
||||
.eq("member_id", userId)
|
||||
.eq("use_status", 0)
|
||||
.eq("coupon_pro_type","0")
|
||||
);
|
||||
}else{
|
||||
couponHistoryEntities = this.getBaseMapper().selectList(new QueryWrapper<CouponHistoryEntity>()
|
||||
.eq("member_id", userId)
|
||||
.eq("use_status", 0)
|
||||
.eq("coupon_pro_type","1")
|
||||
);
|
||||
}
|
||||
|
||||
// 可使用优惠券列表
|
||||
ArrayList<UserCouponVo> list = new ArrayList<>();
|
||||
|
||||
for (CouponHistoryEntity couponHistoryEntity : couponHistoryEntities) {
|
||||
Long couponId = couponHistoryEntity.getCouponId();
|
||||
CouponEntity couponEntity = couponService.getById(couponId);
|
||||
// 判断当前优惠券是否过期
|
||||
Date startTime = couponEntity.getExpirationDate();
|
||||
// 判断结束日期 是否大于 当前 时间
|
||||
if (startTime.after(new Date())){
|
||||
if(Integer.parseInt(amount) >= couponEntity.getUseLevel()){
|
||||
UserCouponVo userCouponVo = new UserCouponVo();
|
||||
BeanUtils.copyProperties(couponHistoryEntity, userCouponVo);
|
||||
userCouponVo.setCoupons(couponEntity);
|
||||
list.add(userCouponVo);
|
||||
}
|
||||
// boolean result = couponCanUseCategory(products, couponId, String.valueOf(couponEntity.getCouponType()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// 判断组合分类 是否 符合优惠券规则
|
||||
private boolean couponCanUseCategory(String products, Long couponId, String userType) {
|
||||
|
||||
List list1 = new ArrayList<>();
|
||||
|
||||
if (!userType.equals("0")) {
|
||||
|
||||
if (userType.equals("1")) {
|
||||
|
||||
List<CouponProductCategoryRelationEntity> couponC = categoryRelationService.getBaseMapper().selectList(new QueryWrapper<CouponProductCategoryRelationEntity>()
|
||||
.eq("coupon_id", couponId));
|
||||
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
String[] split = products.split(",");
|
||||
for (CouponProductCategoryRelationEntity couponProductCategoryRelationEntity : couponC) {
|
||||
// platform 0 1.判断商品 是否为 同一分类下
|
||||
|
||||
for (String s : split) {
|
||||
// 多商品的 判断商品 是否为同一个分类 下
|
||||
ShopProduct spe = shopProductService.getById(Integer.parseInt(s));
|
||||
Integer productPid = spe.getProductPid();
|
||||
Long productCategoryId = couponProductCategoryRelationEntity.getProductCategoryId();
|
||||
if (productCategoryId.intValue() == productPid) {
|
||||
list.add(productCategoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (split.length == list.size()){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (userType.equals("2")) {
|
||||
|
||||
List<CouponProductRelationEntity> couponC = productRelationService.getBaseMapper().selectList(new QueryWrapper<CouponProductRelationEntity>()
|
||||
.eq("coupon_id", couponId));
|
||||
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
String[] split = products.split(",");
|
||||
for (CouponProductRelationEntity couponProductCategoryRelationEntity : couponC) {
|
||||
// platform 0 1.判断商品 是否为 同一分类下
|
||||
for (String s : split) {
|
||||
// 多商品的 判断商品 是否为同一个分类 下
|
||||
// Long productId = couponProductCategoryRelationEntity.getProductId();
|
||||
Long productId = couponProductCategoryRelationEntity.getProductId();
|
||||
if (Long.parseLong(s) == productId) {
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (split.length == list.size()){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
|
||||
import com.peanut.modules.common.dao.CouponProductCategoryRelationDao;
|
||||
import com.peanut.modules.common.entity.CouponProductCategoryRelationEntity;
|
||||
import com.peanut.modules.book.service.CouponProductCategoryRelationService;
|
||||
|
||||
@Slf4j
|
||||
@Service("couponProductCategoryRelationService")
|
||||
public class CouponProductCategoryRelationServiceImpl extends ServiceImpl<CouponProductCategoryRelationDao, CouponProductCategoryRelationEntity> implements CouponProductCategoryRelationService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
String couponId = (String) params.get("couponId");
|
||||
IPage<CouponProductCategoryRelationEntity> page = this.page(
|
||||
new Query<CouponProductCategoryRelationEntity>().getPage(params),
|
||||
new QueryWrapper<CouponProductCategoryRelationEntity>().eq("coupon_id",Integer.valueOf(couponId))
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
|
||||
import com.peanut.modules.common.dao.CouponProductRelationDao;
|
||||
import com.peanut.modules.common.entity.CouponProductRelationEntity;
|
||||
import com.peanut.modules.book.service.CouponProductRelationService;
|
||||
|
||||
@Slf4j
|
||||
@Service("couponProductRelationService")
|
||||
public class CouponProductRelationServiceImpl extends ServiceImpl<CouponProductRelationDao, CouponProductRelationEntity> implements CouponProductRelationService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
String couponId = (String) params.get("couponId");
|
||||
IPage<CouponProductRelationEntity> page = this.page(
|
||||
new Query<CouponProductRelationEntity>().getPage(params),
|
||||
new QueryWrapper<CouponProductRelationEntity>().eq("coupon_id",Integer.valueOf(couponId))
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
|
||||
import com.peanut.modules.common.dao.CouponDao;
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
import com.peanut.modules.book.service.CouponService;
|
||||
|
||||
@Slf4j
|
||||
@Service("couponService")
|
||||
public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> implements CouponService {
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<CouponEntity> page = null;
|
||||
String cu = params.get("currentState").toString();
|
||||
if("0".equals(cu)){
|
||||
page = this.page(
|
||||
new Query<CouponEntity>().getPage(params),
|
||||
new ExcludeEmptyQueryWrapper<CouponEntity>().like("coupon_name",params.get("key"))
|
||||
);
|
||||
}else{
|
||||
page = this.page(
|
||||
new Query<CouponEntity>().getPage(params),
|
||||
new ExcludeEmptyQueryWrapper<CouponEntity>().eq("current_state",cu).like("coupon_name",params.get("key"))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -52,10 +52,6 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
@Autowired
|
||||
private AuthorService authorService;
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private CouponHistoryService couponHistoryService;
|
||||
@Autowired
|
||||
private MyUserDao myUserDao;
|
||||
@Autowired
|
||||
private BookForumArticlesService bookForumArticlesService;
|
||||
@@ -272,7 +268,6 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
return "余额不足,请充值!";
|
||||
}
|
||||
|
||||
CouponEntity coupon = this.couponService.getById(couponId);
|
||||
|
||||
BigDecimal salePrice = new BigDecimal(0);
|
||||
|
||||
@@ -281,21 +276,11 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
BookEntity book = bookService.getById(Integer.valueOf(bookId));
|
||||
|
||||
// 是否为秒杀
|
||||
|
||||
Integer isSale = book.getIsSale();
|
||||
|
||||
if(!ObjectUtils.isEmpty(coupon)){
|
||||
if (isSale == 1) {
|
||||
salePrice = book.getSalePrice().subtract(coupon.getCouponAmount());
|
||||
}else {
|
||||
salePrice = book.getPrice().subtract(coupon.getCouponAmount());
|
||||
}
|
||||
}else{
|
||||
if (isSale == 1) {
|
||||
salePrice = book.getSalePrice();
|
||||
}else {
|
||||
salePrice = book.getPrice();
|
||||
}
|
||||
if (isSale == 1) {
|
||||
salePrice = book.getSalePrice();
|
||||
}else {
|
||||
salePrice = book.getPrice();
|
||||
}
|
||||
|
||||
//查询用户
|
||||
@@ -343,13 +328,6 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
userEbookBuyEntity.setPayType("point");
|
||||
userEbookBuyEntity.setPayTime(new Date());
|
||||
userEbookBuyService.save(userEbookBuyEntity);
|
||||
if(!ObjectUtils.isEmpty(coupon)){
|
||||
CouponHistoryEntity historyEntity = this.couponHistoryService.getOne(new QueryWrapper<CouponHistoryEntity>().eq("member_id", userId).eq("coupon_id", couponId));
|
||||
historyEntity.setUseStatus(1);
|
||||
this.couponHistoryService.updateById(historyEntity);
|
||||
}
|
||||
|
||||
|
||||
return "购买成功!";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.peanut.modules.book.task;
|
||||
|
||||
import com.peanut.modules.book.service.CouponHistoryService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class CouponsUserScheduleTask {
|
||||
|
||||
@Autowired
|
||||
private CouponHistoryService couponsUserService;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(CouponsUserScheduleTask.class);
|
||||
|
||||
// @Scheduled(cron = "0 0/1 * * * ?")//每3分 //crontab -e 动态代替应用命令
|
||||
// public void handlerCouponsUserStatusTimeOutToExpired(){
|
||||
// log.info("handlerCouponsUserStatusTimeOutToExpired start.......time={}",System.currentTimeMillis());
|
||||
// Long startTime01 = System.currentTimeMillis();
|
||||
// couponsUserService.runCouponsUserStatusTimeOutToExpired();
|
||||
// Long endTime02 = System.currentTimeMillis();
|
||||
// log.info("handlerCouponsUserStatusTimeOutToExpired end second={},mills={}",(endTime02-startTime01)/1000,(endTime02-startTime01)%1000);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.peanut.modules.book.vo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.peanut.modules.common.entity.CouponEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class UserCouponVo {
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 优惠券id
|
||||
*/
|
||||
private Long couponId;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Long memberId;
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 优惠券码
|
||||
*/
|
||||
private String couponCode;
|
||||
/**
|
||||
* 领取人昵称
|
||||
*/
|
||||
private String memberNickname;
|
||||
/**
|
||||
* 获取类型:0->后台赠送;1->主动获取
|
||||
*/
|
||||
private Integer getType;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 使用状态:0->未使用;1->已使用;2->已过期
|
||||
*/
|
||||
private Integer useStatus;
|
||||
/**
|
||||
* 使用时间
|
||||
*/
|
||||
private Date useTime;
|
||||
/**
|
||||
* 订单号码
|
||||
*/
|
||||
private String orderSn;
|
||||
|
||||
private CouponEntity coupons;
|
||||
}
|
||||
@@ -71,10 +71,6 @@ public class BuyOrderResponseVo {
|
||||
* 收货人信息
|
||||
*/
|
||||
private ConsigneeVo consignee;
|
||||
/**
|
||||
* 优惠券
|
||||
*/
|
||||
private CouponResponseVo coupon;
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.peanut.modules.book.vo.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description: 优惠券 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/20
|
||||
*/
|
||||
@Data
|
||||
public class CouponResponseVo {
|
||||
/**
|
||||
* 优惠券名称
|
||||
*/
|
||||
String couponName;
|
||||
/**
|
||||
* 优惠券金额
|
||||
*/
|
||||
Integer couponId;
|
||||
|
||||
BigDecimal couponAmount;
|
||||
}
|
||||
Reference in New Issue
Block a user