You've already forked FrameTour-BE
refactor(coupon): 移除优惠券相关模块代码
- 删除优惠券控制器相关类,包括 AppCouponController 和 CouponController - 移除优惠券记录控制器 CouponRecordController - 删除优惠券数据访问层接口及实现类 - 移除优惠券相关的实体类、请求响应对象 - 清理业务逻辑层中与优惠券相关的服务接口及实现 - 从 PriceBiz 中移除优惠券相关导入依赖 - 从任务类 DownloadNotificationTasker 中移除优惠券相关导入 - 删除优惠券相关的 MyBatis 映射文件
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.ycwl.basic.biz;
|
||||
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.order.entity.OrderEntity;
|
||||
import com.ycwl.basic.model.pc.price.entity.PriceConfigEntity;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.ycwl.basic.controller.mobile;
|
||||
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.model.mobile.coupon.req.ClaimCouponReq;
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.couponRecord.entity.CouponRecordEntity;
|
||||
import com.ycwl.basic.service.mobile.AppCouponRecordService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/mobile/coupon/v1")
|
||||
public class AppCouponController {
|
||||
|
||||
@Autowired
|
||||
private AppCouponRecordService appCouponRecordService;
|
||||
|
||||
/**
|
||||
* 根据memberId、faceId和type查找优惠券记录
|
||||
*/
|
||||
@GetMapping("/record")
|
||||
public ApiResponse<CouponRecordEntity> getCouponRecords(
|
||||
@RequestParam Long faceId,
|
||||
@RequestParam Integer type) {
|
||||
CouponRecordEntity record = appCouponRecordService.queryByMemberIdAndFaceIdAndType(Long.valueOf(BaseContextHandler.getUserId()), faceId, type);
|
||||
return ApiResponse.success(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取优惠券
|
||||
*/
|
||||
@PostMapping("/claim")
|
||||
public ApiResponse<CouponEntity> claimCoupon(@RequestBody ClaimCouponReq request) {
|
||||
request.setMemberId(Long.valueOf(BaseContextHandler.getUserId()));
|
||||
try {
|
||||
CouponEntity coupon = appCouponRecordService.claimCoupon(
|
||||
request.getMemberId(),
|
||||
request.getFaceId(),
|
||||
request.getType()
|
||||
);
|
||||
return ApiResponse.success(coupon);
|
||||
} catch (RuntimeException e) {
|
||||
return ApiResponse.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.biz.PriceBiz;
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.coupon.req.CouponQueryReq;
|
||||
import com.ycwl.basic.model.pc.coupon.resp.CouponRespVO;
|
||||
import com.ycwl.basic.model.pc.price.resp.GoodsListRespVO;
|
||||
import com.ycwl.basic.service.pc.CouponService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/coupon/v1")
|
||||
// 优惠券管理
|
||||
public class CouponController {
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@Autowired
|
||||
private PriceBiz priceBiz;
|
||||
|
||||
@GetMapping("/{scenicId}/goodsList")
|
||||
public ApiResponse<List<GoodsListRespVO>> scenicGoodsList(@PathVariable Long scenicId) {
|
||||
List<GoodsListRespVO> data = priceBiz.listGoodsByScenic(scenicId);
|
||||
data.add(new GoodsListRespVO(-1L, "一口价", -1));
|
||||
return ApiResponse.success(data);
|
||||
}
|
||||
|
||||
// 新增优惠券
|
||||
@PostMapping("/add")
|
||||
public ApiResponse<Integer> add(@RequestBody CouponEntity coupon) {
|
||||
return ApiResponse.success(couponService.add(coupon));
|
||||
}
|
||||
|
||||
// 更新优惠券
|
||||
@PostMapping("/update/{id}")
|
||||
public ApiResponse<Boolean> update(@PathVariable Integer id, @RequestBody CouponEntity coupon) {
|
||||
coupon.setId(id);
|
||||
return ApiResponse.success(couponService.update(coupon));
|
||||
}
|
||||
|
||||
@PutMapping("/updateStatus/{id}")
|
||||
public ApiResponse<Boolean> updateStatus(@PathVariable Integer id) {
|
||||
return ApiResponse.success(couponService.updateStatus(id));
|
||||
}
|
||||
|
||||
// 删除优惠券
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ApiResponse<Boolean> delete(@PathVariable Integer id) {
|
||||
return ApiResponse.success(couponService.delete(id));
|
||||
}
|
||||
|
||||
// 根据ID查询优惠券
|
||||
@GetMapping("/get/{id}")
|
||||
public ApiResponse<CouponEntity> getById(@PathVariable Integer id) {
|
||||
return ApiResponse.success(couponService.getById(id));
|
||||
}
|
||||
|
||||
// 分页查询优惠券列表
|
||||
@PostMapping("/page")
|
||||
public ApiResponse<PageInfo<CouponRespVO>> list(@RequestBody CouponQueryReq couponQuery) {
|
||||
PageHelper.startPage(couponQuery.getPageNum(), couponQuery.getPageSize());
|
||||
List<CouponRespVO> list = couponService.list(couponQuery);
|
||||
PageInfo<CouponRespVO> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.couponRecord.req.CouponRecordPageQueryReq;
|
||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordPageResp;
|
||||
import com.ycwl.basic.service.pc.CouponRecordService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/coupon/record/v1")
|
||||
public class CouponRecordController {
|
||||
|
||||
@Autowired
|
||||
private CouponRecordService couponRecordService;
|
||||
|
||||
@PostMapping("/page")
|
||||
public ApiResponse<PageInfo<CouponRecordPageResp>> pageQuery(@RequestBody CouponRecordPageQueryReq query) {
|
||||
return couponRecordService.pageQuery(query);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.ycwl.basic.mapper;
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.coupon.req.CouponQueryReq;
|
||||
import com.ycwl.basic.model.pc.coupon.resp.CouponRespVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponMapper {
|
||||
List<CouponRespVO> selectByQuery(CouponQueryReq query);
|
||||
|
||||
int updateStatus(Integer id);
|
||||
|
||||
CouponEntity getById(Integer couponId);
|
||||
|
||||
int insert(CouponEntity coupon);
|
||||
|
||||
int updateById(CouponEntity coupon);
|
||||
|
||||
int deleteById(Integer id);
|
||||
|
||||
List<CouponEntity> selectList();
|
||||
|
||||
CouponEntity selectById(Integer id);
|
||||
|
||||
CouponEntity selectByScenicIdAndTypeAndStatus(Long scenicId, Integer type, Integer status);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.ycwl.basic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ycwl.basic.model.pc.couponRecord.entity.CouponRecordEntity;
|
||||
import com.ycwl.basic.model.pc.couponRecord.req.CouponRecordPageQueryReq;
|
||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordPageResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponRecordMapper extends BaseMapper<CouponRecordEntity> {
|
||||
List<CouponRecordEntity> queryByUserWithGoodsId(Long scenicId, Long memberId, String goodsId);
|
||||
|
||||
List<CouponRecordEntity> queryByMemberIdAndFaceId(Long memberId, Long faceId);
|
||||
|
||||
CouponRecordEntity queryByMemberIdAndFaceIdAndType(Long memberId, Long faceId, Integer type);
|
||||
|
||||
List<CouponRecordPageResp> selectByPageQuery(CouponRecordPageQueryReq query);
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.coupon.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("coupon")
|
||||
public class CouponEntity {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
private Long scenicId;
|
||||
|
||||
// 新增优惠券名称字段
|
||||
private String name;
|
||||
|
||||
// 优惠券描述
|
||||
private String description;
|
||||
|
||||
// 倒计时字段(仅用于展示)
|
||||
private String countdown;
|
||||
|
||||
// 广播字段,仅用于展示
|
||||
private String broadcast;
|
||||
|
||||
/**
|
||||
* 优惠券类别,0:普通优惠券;1:第一次推送;2:第二次;3:第三次
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 价格配置ID,逗号分隔字符串
|
||||
*/
|
||||
private String configIds;
|
||||
/**
|
||||
* 0降价,1打折
|
||||
*/
|
||||
private Integer discountType;
|
||||
private BigDecimal discountPrice;
|
||||
/**
|
||||
* 状态:0不开启;1开启
|
||||
*/
|
||||
private Integer status;
|
||||
private Date createAt;
|
||||
|
||||
private Integer deleted;
|
||||
private Date deletedAt;
|
||||
|
||||
public BigDecimal calculateDiscountPrice(BigDecimal originalPrice) {
|
||||
if (originalPrice == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (discountType == 0) {
|
||||
return discountPrice;
|
||||
} else {
|
||||
return originalPrice.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN).multiply(discountPrice);
|
||||
}
|
||||
}
|
||||
public BigDecimal calculateDiscountPrice(String originalPrice) {
|
||||
if (originalPrice == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal priceObj = new BigDecimal(originalPrice);
|
||||
if (discountType == 0) {
|
||||
return discountPrice;
|
||||
} else {
|
||||
return priceObj.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN).multiply(discountPrice);
|
||||
}
|
||||
}
|
||||
public String calculateDiscountedPrice(String originalPrice) {
|
||||
if (originalPrice == null) {
|
||||
return "0.00";
|
||||
}
|
||||
BigDecimal priceObj = new BigDecimal(originalPrice);
|
||||
if (discountType == 0) {
|
||||
return priceObj.subtract(discountPrice).setScale(2, RoundingMode.HALF_DOWN).toString();
|
||||
} else {
|
||||
return priceObj.subtract(priceObj.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN).multiply(discountPrice)).setScale(2, RoundingMode.HALF_DOWN).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.coupon.req;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
// 优惠券查询请求参数
|
||||
public class CouponQueryReq extends BaseQueryParameterReq {
|
||||
// 景区ID
|
||||
private Long scenicId;
|
||||
private String name;
|
||||
|
||||
// 优惠券类型:0普通/1首次推送/2二次/3三次
|
||||
private Integer type;
|
||||
|
||||
// 折扣类型:0降价/1打折
|
||||
private Integer discountType;
|
||||
|
||||
// 状态:0关闭/1开启
|
||||
private Integer status;
|
||||
|
||||
// 创建时间起始
|
||||
private Date createAtStart;
|
||||
|
||||
// 创建时间结束
|
||||
private Date createAtEnd;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.coupon.resp;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CouponRespVO {
|
||||
private Integer id;
|
||||
private Long scenicId;
|
||||
private String scenicName;
|
||||
|
||||
// 新增优惠券名称字段
|
||||
private String name;
|
||||
|
||||
// 优惠券描述
|
||||
private String description;
|
||||
|
||||
// 倒计时字段(仅用于展示)
|
||||
private String countdown;
|
||||
|
||||
// 通知展示字段,仅用于展示
|
||||
private String broadcast;
|
||||
|
||||
/**
|
||||
* 优惠券类别,0:普通优惠券;1:第一次推送;2:第二次;3:第三次
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 价格配置ID,逗号分隔字符串
|
||||
*/
|
||||
private String configIds;
|
||||
/**
|
||||
* 0降价,1打折
|
||||
*/
|
||||
private Integer discountType;
|
||||
private BigDecimal discountPrice;
|
||||
/**
|
||||
* 状态:0不开启;1开启
|
||||
*/
|
||||
private Integer status;
|
||||
private Date createAt;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.couponRecord.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("coupon_record")
|
||||
public class CouponRecordEntity {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
private Integer couponId;
|
||||
private Long memberId;
|
||||
private Long faceId;
|
||||
private Integer status;
|
||||
private Date createTime;
|
||||
private Date usedTime;
|
||||
private Long usedOrderId;
|
||||
|
||||
private Integer deleted;
|
||||
private Date deletedAt;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.couponRecord.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CouponRecordPageQueryReq {
|
||||
private Integer pageNum = 1;
|
||||
private Integer pageSize = 10;
|
||||
private Long scenicId;
|
||||
private String couponName;
|
||||
private Integer couponType;
|
||||
private Integer status;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.couponRecord.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CouponRecordUserQueryReq {
|
||||
private Long scenicId;
|
||||
private Long memberId;
|
||||
private Long faceId;
|
||||
private Integer couponType;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.couponRecord.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CouponRecordPageResp {
|
||||
private Integer id;
|
||||
private Integer couponId;
|
||||
private String couponName;
|
||||
private Integer couponType;
|
||||
private String couponTypeName;
|
||||
private Long scenicId;
|
||||
private String scenicName;
|
||||
private Long memberId;
|
||||
private Long faceId;
|
||||
private Integer status;
|
||||
private String statusName;
|
||||
private Date createTime;
|
||||
private Date usedTime;
|
||||
private Long usedOrderId;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.ycwl.basic.model.pc.couponRecord.resp;
|
||||
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CouponRecordQueryResp {
|
||||
private boolean exist = false;
|
||||
private Integer id;
|
||||
private Long scenicId;
|
||||
private Integer couponId;
|
||||
private Long memberId;
|
||||
private Long faceId;
|
||||
private Integer status;
|
||||
private Date createTime;
|
||||
private Date usedTime;
|
||||
private Long usedOrderId;
|
||||
private CouponEntity coupon;
|
||||
|
||||
public boolean isUsable() {
|
||||
return Integer.valueOf(0).equals(status);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.ycwl.basic.service.mobile;
|
||||
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.couponRecord.entity.CouponRecordEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AppCouponRecordService {
|
||||
|
||||
List<CouponRecordEntity> queryByMemberIdAndFaceId(Long memberId, Long faceId);
|
||||
|
||||
CouponRecordEntity queryByMemberIdAndFaceIdAndType(Long memberId, Long faceId, Integer type);
|
||||
|
||||
CouponEntity claimCoupon(Long memberId, Long faceId, Integer type);
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.ycwl.basic.service.mobile.impl;
|
||||
|
||||
import com.ycwl.basic.mapper.CouponMapper;
|
||||
import com.ycwl.basic.mapper.CouponRecordMapper;
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.couponRecord.entity.CouponRecordEntity;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.repository.FaceRepository;
|
||||
import com.ycwl.basic.service.mobile.AppCouponRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AppCouponRecordServiceImpl implements AppCouponRecordService {
|
||||
|
||||
@Autowired
|
||||
private CouponRecordMapper couponRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private CouponMapper couponMapper;
|
||||
@Autowired
|
||||
private FaceRepository faceRepository;
|
||||
|
||||
@Override
|
||||
public List<CouponRecordEntity> queryByMemberIdAndFaceId(Long memberId, Long faceId) {
|
||||
return couponRecordMapper.queryByMemberIdAndFaceId(memberId, faceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponRecordEntity queryByMemberIdAndFaceIdAndType(Long memberId, Long faceId, Integer type) {
|
||||
return couponRecordMapper.queryByMemberIdAndFaceIdAndType(memberId, faceId, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CouponEntity claimCoupon(Long memberId, Long faceId, Integer type) {
|
||||
// 检查是否已经领取过该类型的优惠券
|
||||
CouponRecordEntity existingRecord = couponRecordMapper.queryByMemberIdAndFaceIdAndType(memberId, faceId, type);
|
||||
if (existingRecord != null) {
|
||||
throw new RuntimeException("该用户已经领取过此类型的优惠券");
|
||||
}
|
||||
FaceEntity face = faceRepository.getFace(faceId);
|
||||
if (face == null) {
|
||||
throw new RuntimeException("人脸数据不存在");
|
||||
}
|
||||
// 查找可用的优惠券
|
||||
Long scenicId = face.getScenicId();
|
||||
CouponEntity coupon = couponMapper.selectByScenicIdAndTypeAndStatus(scenicId, type, 1);
|
||||
|
||||
if (coupon == null) {
|
||||
throw new RuntimeException("未找到可领取的优惠券");
|
||||
}
|
||||
|
||||
// 创建优惠券记录
|
||||
CouponRecordEntity record = new CouponRecordEntity();
|
||||
record.setCouponId(coupon.getId());
|
||||
record.setMemberId(memberId);
|
||||
record.setFaceId(faceId);
|
||||
record.setStatus(0); // 有效状态
|
||||
record.setCreateTime(new Date());
|
||||
|
||||
couponRecordMapper.insert(record);
|
||||
return coupon;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import com.ycwl.basic.mapper.*;
|
||||
import com.ycwl.basic.model.mobile.goods.*;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.ycwl.basic.service.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.couponRecord.req.CouponRecordPageQueryReq;
|
||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordPageResp;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
|
||||
public interface CouponRecordService {
|
||||
ApiResponse<PageInfo<CouponRecordPageResp>> pageQuery(CouponRecordPageQueryReq query);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.ycwl.basic.service.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.coupon.req.CouponQueryReq;
|
||||
import com.ycwl.basic.model.pc.coupon.resp.CouponRespVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CouponService {
|
||||
Integer add(CouponEntity coupon);
|
||||
Boolean update(CouponEntity coupon);
|
||||
Boolean delete(Integer id);
|
||||
CouponEntity getById(Integer id);
|
||||
List<CouponRespVO> list(CouponQueryReq query);
|
||||
|
||||
Boolean updateStatus(Integer id);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.ycwl.basic.service.pc.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.mapper.CouponRecordMapper;
|
||||
import com.ycwl.basic.model.pc.couponRecord.entity.CouponRecordEntity;
|
||||
import com.ycwl.basic.model.pc.couponRecord.req.CouponRecordPageQueryReq;
|
||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordPageResp;
|
||||
import com.ycwl.basic.service.pc.CouponRecordService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CouponRecordServiceImpl extends ServiceImpl<CouponRecordMapper, CouponRecordEntity> implements CouponRecordService {
|
||||
|
||||
@Autowired
|
||||
private CouponRecordMapper couponRecordMapper;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<CouponRecordPageResp>> pageQuery(CouponRecordPageQueryReq query) {
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize());
|
||||
List<CouponRecordPageResp> list = couponRecordMapper.selectByPageQuery(query);
|
||||
PageInfo<CouponRecordPageResp> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.ycwl.basic.service.pc.impl;
|
||||
import com.ycwl.basic.mapper.CouponMapper;
|
||||
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
|
||||
import com.ycwl.basic.model.pc.coupon.req.CouponQueryReq;
|
||||
import com.ycwl.basic.model.pc.coupon.resp.CouponRespVO;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.service.pc.CouponService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CouponServiceImpl implements CouponService {
|
||||
|
||||
@Autowired
|
||||
private CouponMapper couponMapper;
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
|
||||
@Override
|
||||
public Integer add(CouponEntity coupon) {
|
||||
return couponMapper.insert(coupon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(CouponEntity coupon) {
|
||||
return couponMapper.updateById(coupon) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delete(Integer id) {
|
||||
return couponMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponEntity getById(Integer id) {
|
||||
return couponMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CouponRespVO> list(CouponQueryReq query) {
|
||||
List<CouponRespVO> list = couponMapper.selectByQuery(query);
|
||||
|
||||
// 批量获取景区名称
|
||||
List<Long> scenicIds = list.stream()
|
||||
.map(CouponRespVO::getScenicId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, String> scenicNames = scenicRepository.batchGetScenicNames(scenicIds);
|
||||
|
||||
// 设置景区名称
|
||||
list.forEach(item -> {
|
||||
if (item.getScenicId() != null) {
|
||||
item.setScenicName(scenicNames.get(item.getScenicId()));
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateStatus(Integer id) {
|
||||
return couponMapper.updateStatus(id) > 0;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.order.OrderAppPageReq;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.mobile.order.RefundOrderReq;
|
||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
import com.ycwl.basic.model.pc.order.entity.OrderEntity;
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
package com.ycwl.basic.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.ycwl.basic.integration.message.dto.ZtMessage;
|
||||
import com.ycwl.basic.integration.message.service.ZtMessageProducerService;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2DTO;
|
||||
import com.ycwl.basic.mapper.CouponMapper;
|
||||
import com.ycwl.basic.mapper.MemberMapper;
|
||||
import com.ycwl.basic.mapper.VideoMapper;
|
||||
import com.ycwl.basic.model.pc.coupon.req.CouponQueryReq;
|
||||
import com.ycwl.basic.model.pc.coupon.resp.CouponRespVO;
|
||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||
import com.ycwl.basic.model.pc.notify.req.WechatSubscribeNotifyTriggerRequest;
|
||||
import com.ycwl.basic.model.pc.notify.resp.WechatSubscribeNotifyTriggerResult;
|
||||
|
||||
Reference in New Issue
Block a user