优惠券
This commit is contained in:
parent
673b6ad10a
commit
630f95dfb0
@ -5,7 +5,6 @@ import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -22,6 +21,10 @@ public class CardExchangeRecord extends Model<CardExchangeRecord> {
|
||||
private Integer id;
|
||||
//兑换券id
|
||||
private Integer cardExchangeId;
|
||||
//所属连锁店id
|
||||
private Integer chainStorId;
|
||||
//所属店铺id
|
||||
private Integer storeId;
|
||||
//员工id
|
||||
private Integer mtStaffId;
|
||||
//员工姓名
|
||||
@ -32,6 +35,8 @@ public class CardExchangeRecord extends Model<CardExchangeRecord> {
|
||||
private Integer mtUserId;
|
||||
//会员手机号码
|
||||
private String mobile;
|
||||
//会员名字
|
||||
private String name;
|
||||
//会员头像
|
||||
private String photo;
|
||||
//券名称
|
||||
@ -55,10 +60,10 @@ public class CardExchangeRecord extends Model<CardExchangeRecord> {
|
||||
//核销时间
|
||||
private Date cancelTime;
|
||||
|
||||
//创建时间
|
||||
//开始时间
|
||||
private Date startTime;
|
||||
|
||||
//创建时间
|
||||
//结束时间
|
||||
private Date endTime;
|
||||
|
||||
|
||||
@ -78,6 +83,22 @@ public class CardExchangeRecord extends Model<CardExchangeRecord> {
|
||||
this.cardExchangeId = cardExchangeId;
|
||||
}
|
||||
|
||||
public Integer getChainStorId() {
|
||||
return chainStorId;
|
||||
}
|
||||
|
||||
public void setChainStorId(Integer chainStorId) {
|
||||
this.chainStorId = chainStorId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public Integer getMtStaffId() {
|
||||
return mtStaffId;
|
||||
}
|
||||
@ -110,6 +131,14 @@ public class CardExchangeRecord extends Model<CardExchangeRecord> {
|
||||
this.mtUserId = mtUserId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.controller;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (CardFavorable)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("business/marketingActivity/cardFavorable")
|
||||
public class CardFavorableController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private CardFavorableService cardFavorableService;
|
||||
|
||||
/**分页查询所有数据
|
||||
*
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardFavorable
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardFavorable cardFavorable) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardFavorableService.select(page,cardFavorable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject selectOne(@PathVariable Serializable id) {
|
||||
return getSuccessResult(this.cardFavorableService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param cardFavorable 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardFavorable cardFavorable) {
|
||||
return getSuccessResult(this.cardFavorableService.add(cardFavorable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param cardFavorable 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardFavorable cardFavorable) {
|
||||
return getSuccessResult(this.cardFavorableService.updateById(cardFavorable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||
return getSuccessResult(this.cardFavorableService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,100 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (CardFavorableRecord)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:58
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("business/marketingActivity/cardFavorableRecord")
|
||||
public class CardFavorableRecordController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private CardFavorableRecordService cardFavorableRecordService;
|
||||
|
||||
/**分页查询所有数据
|
||||
*
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardFavorableRecord
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardFavorableRecord cardFavorableRecord) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardFavorableRecordService.select(page,cardFavorableRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject selectOne(@PathVariable Serializable id) {
|
||||
return getSuccessResult(this.cardFavorableRecordService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param cardFavorableRecord 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardFavorableRecord cardFavorableRecord) {
|
||||
return getSuccessResult(this.cardFavorableRecordService.save(cardFavorableRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param cardFavorableRecord 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardFavorableRecord cardFavorableRecord) {
|
||||
return getSuccessResult(this.cardFavorableRecordService.updateById(cardFavorableRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||
return getSuccessResult(this.cardFavorableRecordService.removeByIds(idList));
|
||||
}
|
||||
|
||||
/**统计优惠券数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("count")
|
||||
public ResponseObject selectCount() {
|
||||
return getSuccessResult(this.cardFavorableRecordService.selectCount());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,321 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* (CardFavorable)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:06
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CardFavorable extends Model<CardFavorable> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//所属连锁店id
|
||||
private Integer chainStorId;
|
||||
//所属店铺id
|
||||
private Integer storeId;
|
||||
//是否在线 0:在线 1: 下线
|
||||
private String isonline;
|
||||
//优惠券名称
|
||||
private String name;
|
||||
//卡券类型 0:油品券 1:商品券 2:通用券
|
||||
private String type;
|
||||
//优惠类型 0:满减券 1:折扣券
|
||||
private String discountType;
|
||||
//可用油品 0:92# 1: 95# 2:98# 3:0# 4:-10# 5: LNG 6;CNG 7:京92# 8:京95# 9:京0#
|
||||
private String oilType;
|
||||
//满减金额
|
||||
private Double fullDeduction;
|
||||
//优惠金额
|
||||
private Double discountAmount;
|
||||
//满足金额
|
||||
private Double satisfiedAmount;
|
||||
//优惠折扣
|
||||
private Double specialDiscount;
|
||||
//折扣抵消
|
||||
private Double discountOffset;
|
||||
//有效期
|
||||
private Integer validity;
|
||||
//生效日期
|
||||
private String effectiveDate;
|
||||
//生效时间
|
||||
private String effectiveTime;
|
||||
//可用时段
|
||||
private String availablePeriod;
|
||||
//可用周期类型 day:每天可用 week:周可用 month:月可用
|
||||
private String checkDateType;
|
||||
//可用日期
|
||||
private String checkTime;
|
||||
//排除日期
|
||||
private Date checkOutTime;
|
||||
//互斥功能 0:满减活动 1:储值卡付款
|
||||
private String exclusiveFunction;
|
||||
//领取规则 0:每人限领一张 1:每人每日限领一张
|
||||
private String claimRule;
|
||||
//发放数量
|
||||
private Integer count;
|
||||
//二维码链接
|
||||
private String qrCodeLink;
|
||||
//优惠券状态 0:启用 1: 禁用
|
||||
private String status;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getChainStorId() {
|
||||
return chainStorId;
|
||||
}
|
||||
|
||||
public void setChainStorId(Integer chainStorId) {
|
||||
this.chainStorId = chainStorId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getIsonline() {
|
||||
return isonline;
|
||||
}
|
||||
|
||||
public void setIsonline(String isonline) {
|
||||
this.isonline = isonline;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDiscountType() {
|
||||
return discountType;
|
||||
}
|
||||
|
||||
public void setDiscountType(String discountType) {
|
||||
this.discountType = discountType;
|
||||
}
|
||||
|
||||
public String getOilType() {
|
||||
return oilType;
|
||||
}
|
||||
|
||||
public void setOilType(String oilType) {
|
||||
this.oilType = oilType;
|
||||
}
|
||||
|
||||
public Double getFullDeduction() {
|
||||
return fullDeduction;
|
||||
}
|
||||
|
||||
public void setFullDeduction(Double fullDeduction) {
|
||||
this.fullDeduction = fullDeduction;
|
||||
}
|
||||
|
||||
public Double getDiscountAmount() {
|
||||
return discountAmount;
|
||||
}
|
||||
|
||||
public void setDiscountAmount(Double discountAmount) {
|
||||
this.discountAmount = discountAmount;
|
||||
}
|
||||
|
||||
public Double getSatisfiedAmount() {
|
||||
return satisfiedAmount;
|
||||
}
|
||||
|
||||
public void setSatisfiedAmount(Double satisfiedAmount) {
|
||||
this.satisfiedAmount = satisfiedAmount;
|
||||
}
|
||||
|
||||
public Double getSpecialDiscount() {
|
||||
return specialDiscount;
|
||||
}
|
||||
|
||||
public void setSpecialDiscount(Double specialDiscount) {
|
||||
this.specialDiscount = specialDiscount;
|
||||
}
|
||||
|
||||
public Double getDiscountOffset() {
|
||||
return discountOffset;
|
||||
}
|
||||
|
||||
public void setDiscountOffset(Double discountOffset) {
|
||||
this.discountOffset = discountOffset;
|
||||
}
|
||||
|
||||
public Integer getValidity() {
|
||||
return validity;
|
||||
}
|
||||
|
||||
public void setValidity(Integer validity) {
|
||||
this.validity = validity;
|
||||
}
|
||||
|
||||
public String getEffectiveDate() {
|
||||
return effectiveDate;
|
||||
}
|
||||
|
||||
public void setEffectiveDate(String effectiveDate) {
|
||||
this.effectiveDate = effectiveDate;
|
||||
}
|
||||
|
||||
public String getEffectiveTime() {
|
||||
return effectiveTime;
|
||||
}
|
||||
|
||||
public void setEffectiveTime(String effectiveTime) {
|
||||
this.effectiveTime = effectiveTime;
|
||||
}
|
||||
|
||||
public String getAvailablePeriod() {
|
||||
return availablePeriod;
|
||||
}
|
||||
|
||||
public void setAvailablePeriod(String availablePeriod) {
|
||||
this.availablePeriod = availablePeriod;
|
||||
}
|
||||
|
||||
public String getCheckDateType() {
|
||||
return checkDateType;
|
||||
}
|
||||
|
||||
public void setCheckDateType(String checkDateType) {
|
||||
this.checkDateType = checkDateType;
|
||||
}
|
||||
|
||||
public String getCheckTime() {
|
||||
return checkTime;
|
||||
}
|
||||
|
||||
public void setCheckTime(String checkTime) {
|
||||
this.checkTime = checkTime;
|
||||
}
|
||||
|
||||
public Date getCheckOutTime() {
|
||||
return checkOutTime;
|
||||
}
|
||||
|
||||
public void setCheckOutTime(Date checkOutTime) {
|
||||
this.checkOutTime = checkOutTime;
|
||||
}
|
||||
|
||||
public String getExclusiveFunction() {
|
||||
return exclusiveFunction;
|
||||
}
|
||||
|
||||
public void setExclusiveFunction(String exclusiveFunction) {
|
||||
this.exclusiveFunction = exclusiveFunction;
|
||||
}
|
||||
|
||||
public String getClaimRule() {
|
||||
return claimRule;
|
||||
}
|
||||
|
||||
public void setClaimRule(String claimRule) {
|
||||
this.claimRule = claimRule;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getQrCodeLink() {
|
||||
return qrCodeLink;
|
||||
}
|
||||
|
||||
public void setQrCodeLink(String qrCodeLink) {
|
||||
this.qrCodeLink = qrCodeLink;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,181 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* (CardFavorableRecord)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:58
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CardFavorableRecord extends Model<CardFavorableRecord> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//会员id store_id
|
||||
private Integer mtUserId;
|
||||
//所属连锁店id
|
||||
private Integer chainStorId;
|
||||
//所属店铺id
|
||||
private Integer storeId;
|
||||
//会员名字
|
||||
private String name;
|
||||
//会员手机号码
|
||||
private String mobile;
|
||||
//卡号
|
||||
private String ticketCode;
|
||||
//券状态 0:未使用 1:已使用
|
||||
private String status;
|
||||
//有效期开始时间
|
||||
private Date startTime;
|
||||
//有效期结束时间
|
||||
private Date endTime;
|
||||
//描述信息
|
||||
private String exchangeFrom;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getMtUserId() {
|
||||
return mtUserId;
|
||||
}
|
||||
|
||||
public void setMtUserId(Integer mtUserId) {
|
||||
this.mtUserId = mtUserId;
|
||||
}
|
||||
|
||||
public Integer getChainStorId() {
|
||||
return chainStorId;
|
||||
}
|
||||
|
||||
public void setChainStorId(Integer chainStorId) {
|
||||
this.chainStorId = chainStorId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getTicketCode() {
|
||||
return ticketCode;
|
||||
}
|
||||
|
||||
public void setTicketCode(String ticketCode) {
|
||||
this.ticketCode = ticketCode;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getExchangeFrom() {
|
||||
return exchangeFrom;
|
||||
}
|
||||
|
||||
public void setExchangeFrom(String exchangeFrom) {
|
||||
this.exchangeFrom = exchangeFrom;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
|
||||
/**
|
||||
* (CardFavorable)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:06
|
||||
*/
|
||||
public interface CardFavorableMapper extends BaseMapper<CardFavorable> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* (CardFavorableRecord)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:58
|
||||
*/
|
||||
public interface CardFavorableRecordMapper extends BaseMapper<CardFavorableRecord> {
|
||||
|
||||
/**
|
||||
* 统计优惠券使用数量
|
||||
*/
|
||||
HashMap<String,Integer> selectTotal(Integer storeId);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper">
|
||||
|
||||
<select id="selectTotal" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
count( id ) tatol,
|
||||
( SELECT count( id ) FROM card_favorable_record
|
||||
WHERE store_id = #{store_id}
|
||||
and status = "0" ) unTatal,
|
||||
( SELECT count( id ) FROM card_favorable_record
|
||||
WHERE store_id = #{store_id}
|
||||
and status = "1" ) usedTatal,
|
||||
( SELECT count( id ) FROM card_favorable_record
|
||||
WHERE store_id = #{store_id}
|
||||
and status = "2" ) outTatal
|
||||
FROM
|
||||
card_favorable_record
|
||||
where store_id = #{store_id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (CardFavorableRecord)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:58
|
||||
*/
|
||||
public interface CardFavorableRecordService extends IService<CardFavorableRecord> {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param page
|
||||
* @param cardFavorableRecord
|
||||
* @return
|
||||
*/
|
||||
IPage select(Page page, CardFavorableRecord cardFavorableRecord);
|
||||
|
||||
/**
|
||||
* 统计优惠券数量
|
||||
* @return
|
||||
*/
|
||||
Map<String,Integer> selectCount();
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
|
||||
/**
|
||||
* (CardFavorable)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:06
|
||||
*/
|
||||
public interface CardFavorableService extends IService<CardFavorable> {
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param cardFavorable
|
||||
* @return
|
||||
*/
|
||||
Boolean add(CardFavorable cardFavorable);
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param page
|
||||
* @param cardFavorable
|
||||
* @return
|
||||
*/
|
||||
IPage select(Page page, CardFavorable cardFavorable);
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (CardFavorableRecord)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:58
|
||||
*/
|
||||
@Service("cardFavorableRecordService")
|
||||
public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRecordMapper, CardFavorableRecord> implements CardFavorableRecordService {
|
||||
|
||||
@Resource
|
||||
private CardFavorableRecordMapper cardFavorableRecordMapper;
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param page
|
||||
* @param cardFavorableRecord
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage select(Page page, CardFavorableRecord cardFavorableRecord) {
|
||||
|
||||
//构建查询条件
|
||||
LambdaQueryWrapper<CardFavorableRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ObjectUtils.isNotEmpty(cardFavorableRecord.getMobile())){
|
||||
queryWrapper.eq(CardFavorableRecord::getMobile,cardFavorableRecord.getMobile());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardFavorableRecord.getStatus())) {
|
||||
queryWrapper.eq(CardFavorableRecord::getStatus,cardFavorableRecord.getStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardFavorableRecord.getStartTime()) &&
|
||||
ObjectUtils.isNotEmpty(cardFavorableRecord.getEndTime())) {
|
||||
queryWrapper.between(CardFavorableRecord::getCreateTime,cardFavorableRecord.getStartTime(),cardFavorableRecord.getEndTime());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardFavorableRecord::getCreateTime);
|
||||
IPage page1 = page(page, queryWrapper);
|
||||
//更新优惠券的状态
|
||||
List<CardFavorableRecord> records = page1.getRecords();
|
||||
for (CardFavorableRecord record : records) {
|
||||
if (ObjectUtils.isNotEmpty(record.getEndTime()) && record.getEndTime().getTime() < new Date().getTime()){
|
||||
record.setStatus("2");
|
||||
updateById(record);
|
||||
}
|
||||
}
|
||||
return page1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计优惠券使用数量
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Integer> selectCount() {
|
||||
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
|
||||
return cardFavorableRecordMapper.selectTotal(storeId);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package com.fuint.business.marketingActivity.cardFavorable.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* (CardFavorable)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 11:02:06
|
||||
*/
|
||||
@Service("cardFavorableService")
|
||||
public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, CardFavorable> implements CardFavorableService {
|
||||
|
||||
@Resource
|
||||
private StoreService storeService;
|
||||
/**
|
||||
* 新增数据
|
||||
* @param cardFavorable
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean add(CardFavorable cardFavorable) {
|
||||
//获取当前店铺的id和连锁店id
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
cardFavorable.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
cardFavorable.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
return save(cardFavorable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param page
|
||||
* @param cardFavorable
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage select(Page page, CardFavorable cardFavorable) {
|
||||
//构建查询条件
|
||||
LambdaQueryWrapper<CardFavorable> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(ObjectUtils.isNotEmpty(cardFavorable.getName())){
|
||||
queryWrapper.like(CardFavorable::getName,cardFavorable.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cardFavorable.getType())){
|
||||
queryWrapper.eq(CardFavorable::getType,cardFavorable.getType());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cardFavorable.getDiscountType())){
|
||||
queryWrapper.eq(CardFavorable::getDiscountType,cardFavorable.getDiscountType());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardFavorable.getStatus())) {
|
||||
queryWrapper.eq(CardFavorable::getStatus,cardFavorable.getStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardFavorable.getIsonline())) {
|
||||
queryWrapper.eq(CardFavorable::getIsonline,cardFavorable.getIsonline());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardFavorable::getCreateTime);
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user