优惠券 记录
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.dto.ShopCouponDTO;
|
||||
import com.czg.account.service.ShopCouponService;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -57,4 +60,16 @@ public class ShopCouponController {
|
||||
couponDTO.setShopId(StpKit.USER.getShopId());
|
||||
return CzgResult.success(couponService.edit(couponDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺优惠券获取记录
|
||||
* 权限标识: coupon:delete
|
||||
*/
|
||||
@SaAdminCheckPermission("coupon:queryReceive")
|
||||
@PostMapping("/queryReceive")
|
||||
public CzgResult<Page<CouponReceiveVo>> queryReceive(@Validated @RequestBody QueryReceiveDto param) {
|
||||
return CzgResult.success(couponService.queryReceive(param));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.czg.account.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
*/
|
||||
@Data
|
||||
public class QueryReceiveDto {
|
||||
@NotBlank(message = "优惠券id 不可为空")
|
||||
private Long couponId;
|
||||
@NotBlank(message = "店铺Id 不可为空")
|
||||
private Long shopId;
|
||||
//用户昵称 手机号 模糊
|
||||
private String value;
|
||||
//状态 0未使用 1已使用 2已过期
|
||||
private Integer status;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
|
||||
@@ -11,4 +14,6 @@ import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
*/
|
||||
public interface ShopActivateCouponRecordService extends IService<ShopActivateCouponRecord> {
|
||||
|
||||
|
||||
Page<CouponReceiveVo> queryReceive(Page<CouponReceiveVo> page, QueryReceiveDto param);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.dto.ShopCouponDTO;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.czg.account.entity.ShopCoupon;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
@@ -28,6 +31,8 @@ public interface ShopCouponService extends IService<ShopCoupon> {
|
||||
|
||||
Boolean edit(ShopCouponDTO couponDTO);
|
||||
|
||||
Page<CouponReceiveVo> queryReceive(QueryReceiveDto param);
|
||||
|
||||
|
||||
List<ShopActivateCouponRecord> find(Long shopUserId, Integer status);
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.czg.account.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 券记录ID
|
||||
* @author ww
|
||||
*/
|
||||
@Data
|
||||
public class CouponReceiveVo {
|
||||
/**
|
||||
* 券记录ID
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* shopUserId
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 券领取时间
|
||||
*/
|
||||
private String receiveTime;
|
||||
/**
|
||||
* 券使用时间
|
||||
*/
|
||||
private String useTime;
|
||||
/**
|
||||
* 券来源
|
||||
*/
|
||||
private String source;
|
||||
/**
|
||||
* 券状态
|
||||
* 未使用 0
|
||||
* 已使用 1
|
||||
* 已过期 2
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -111,4 +111,11 @@ public class OrderInfoAddDTO implements Serializable {
|
||||
public String getDineMode() {
|
||||
return StrUtil.isBlank(dineMode) ? "dine-in" : dineMode;
|
||||
}
|
||||
|
||||
public Integer getPlaceNum() {
|
||||
if (placeNum == null || placeNum == 0) {
|
||||
return 1;
|
||||
}
|
||||
return placeNum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
|
||||
/**
|
||||
* 活动商品赠送记录表 映射层。
|
||||
@@ -11,4 +14,5 @@ import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
*/
|
||||
public interface ShopActivateCouponRecordMapper extends BaseMapper<ShopActivateCouponRecord> {
|
||||
|
||||
Page<CouponReceiveVo> queryReceive(Page<CouponReceiveVo> page, QueryReceiveDto param);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.czg.account.service.ShopActivateCouponRecordService;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.service.account.mapper.ShopActivateCouponRecordMapper;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
@@ -15,4 +18,8 @@ import org.apache.dubbo.config.annotation.DubboService;
|
||||
@DubboService
|
||||
public class ShopActivateCouponRecordServiceImpl extends ServiceImpl<ShopActivateCouponRecordMapper, ShopActivateCouponRecord> implements ShopActivateCouponRecordService{
|
||||
|
||||
@Override
|
||||
public Page<CouponReceiveVo> queryReceive(Page<CouponReceiveVo> page, QueryReceiveDto param) {
|
||||
return getMapper().queryReceive(page, param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.dto.ShopCouponDTO;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.czg.account.entity.ShopCoupon;
|
||||
import com.czg.account.service.ShopActivateCouponRecordService;
|
||||
import com.czg.account.service.ShopCouponService;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.product.entity.Product;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.account.mapper.ShopCouponMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@@ -60,6 +64,11 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
||||
return updateById(shopCoupon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
|
||||
return couponRecordService.queryReceive(PageUtil.buildPage(), param);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ShopActivateCouponRecord> find(Long shopUserId, Integer status) {
|
||||
|
||||
@@ -4,4 +4,34 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopActivateCouponRecordMapper">
|
||||
|
||||
<select id="queryReceive" resultType="com.czg.account.vo.CouponReceiveVo">
|
||||
SELECT
|
||||
record.id,
|
||||
vip.id as userId ,
|
||||
vip.`name`,
|
||||
vip.telephone as phone,
|
||||
record.create_time as receiveTime,
|
||||
record.update_time as useTime,
|
||||
record.source as source
|
||||
FROM
|
||||
tb_shop_activate_coupon_record record
|
||||
LEFT JOIN tb_shop_user vip
|
||||
ON record.shop_user_id = vip.id AND vip.shop_id = #{param.shopId}
|
||||
WHERE
|
||||
record.coupon_id = #{param.couponId}
|
||||
and record.shop_id = #{param.shopId}
|
||||
<if test="param.value != null and param.value != '' ">
|
||||
and (vip.name like concat('%', #{param.value}, '%') or vip.telephone like concat('%', #{param.value}, '%'))
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
and record.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.startTime != null ">
|
||||
and record.create_time > #{param.startTime}
|
||||
</if>
|
||||
<if test="param.endTime != null ">
|
||||
and record.create_time < #{param.endTime}
|
||||
</if>
|
||||
order by record.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user