修改优惠券

This commit is contained in:
齐天大圣 2023-11-08 17:08:06 +08:00
parent 94f072b247
commit 243041ced9
12 changed files with 916 additions and 33 deletions

View File

@ -4,6 +4,7 @@ package com.fuint.business.marketingActivity.cardFavorable.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
@ -53,7 +54,7 @@ public class CardFavorableController extends BaseController {
*/ */
@GetMapping("{id}") @GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Serializable id) { public ResponseObject selectOne(@PathVariable Serializable id) {
return getSuccessResult(this.cardFavorableService.getById(id)); return getSuccessResult(this.cardFavorableService.selectOneById(id));
} }
/** /**
@ -63,8 +64,8 @@ public class CardFavorableController extends BaseController {
* @return 新增结果 * @return 新增结果
*/ */
@PostMapping @PostMapping
public ResponseObject insert(@RequestBody CardFavorable cardFavorable) { public ResponseObject insert(@RequestBody CardFavorableDTO cardFavorableDTO) {
return getSuccessResult(this.cardFavorableService.add(cardFavorable)); return getSuccessResult(this.cardFavorableService.add(cardFavorableDTO));
} }
/** /**

View File

@ -93,8 +93,8 @@ public class CardFavorableRecordController extends BaseController {
* @return * @return
*/ */
@GetMapping("count") @GetMapping("count")
public ResponseObject selectCount() { public ResponseObject selectCount(@Param("cardFuelDiesel") CardFavorableRecord cardFavorableRecord) {
return getSuccessResult(this.cardFavorableRecordService.selectCount()); return getSuccessResult(this.cardFavorableRecordService.selectCount(cardFavorableRecord));
} }
} }

View File

@ -0,0 +1,381 @@
package com.fuint.business.marketingActivity.cardFavorable.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.util.Date;
/**
* (CardFavorable)表实体类
*
* @author makejava
* @since 2023-11-07 11:02:06
*/
@SuppressWarnings("serial")
public class CardFavorableDTO extends Model<CardFavorableDTO> {
//主键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;
//可用油品 092# 1: 95# 298# 30# 4-10# 5 LNG 6CNG 7京92# 8京95# 9京0#
private String[] oilType;
private String oilTypes;
//满减金额
private Double fullDeduction;
//优惠金额
private Double discountAmount;
//满足金额
private Double satisfiedAmount;
//优惠折扣
private Double specialDiscount;
//折扣抵消
private Double discountOffset;
//生效日期类型 0 12
private String timeType;
//有效期0
private Integer validityZero;
//有效期1
private Integer validityOne;
//有效期2
private Integer validityTwo;
//固定有效期开始日期
private Date effectiveDate;
//领券后第几天生效
private String validityDay;
//生效时间类型 0领取时间 1指定时间
private String effectiveDateType;
//生效时间
private Date effectiveDateStart;
//可用时段
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 String[] getOilType() {
return oilType;
}
public void setOilType(String[] oilType) {
this.oilType = oilType;
}
public String getOilTypes() {
return oilTypes;
}
public void setOilTypes(String oilTypes) {
this.oilTypes = oilTypes;
}
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 getEffectiveDateType() {
return effectiveDateType;
}
public void setEffectiveDateType(String effectiveDateType) {
this.effectiveDateType = effectiveDateType;
}
public Date getEffectiveDateStart() {
return effectiveDateStart;
}
public void setEffectiveDateStart(Date effectiveDateStart) {
this.effectiveDateStart = effectiveDateStart;
}
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 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 String getTimeType() {
return timeType;
}
public void setTimeType(String timeType) {
this.timeType = timeType;
}
public Integer getValidityZero() {
return validityZero;
}
public void setValidityZero(Integer validityZero) {
this.validityZero = validityZero;
}
public Integer getValidityOne() {
return validityOne;
}
public void setValidityOne(Integer validityOne) {
this.validityOne = validityOne;
}
public Integer getValidityTwo() {
return validityTwo;
}
public void setValidityTwo(Integer validityTwo) {
this.validityTwo = validityTwo;
}
public Date getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate;
}
public String getValidityDay() {
return validityDay;
}
public void setValidityDay(String validityDay) {
this.validityDay = validityDay;
}
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;
}
}

View File

@ -42,12 +42,22 @@ public class CardFavorable extends Model<CardFavorable> {
private Double specialDiscount; private Double specialDiscount;
//折扣抵消 //折扣抵消
private Double discountOffset; private Double discountOffset;
//有效期 //生效日期类型 0 12
private Integer validity; private String timeType;
//生效日期 //有效期0
private String effectiveDate; private Integer validityZero;
//有效期1
private Integer validityOne;
//有效期2
private Integer validityTwo;
//固定有效期开始日期
private Date effectiveDate;
//领券后第几天生效
private String validityDay;
//生效时间类型 0领取时间 1指定时间
private String effectiveDateType;
//生效时间 //生效时间
private String effectiveTime; private Date effectiveDateStart;
//可用时段 //可用时段
private String availablePeriod; private String availablePeriod;
//可用周期类型 day每天可用 week周可用 month月可用 //可用周期类型 day每天可用 week周可用 month月可用
@ -100,6 +110,22 @@ public class CardFavorable extends Model<CardFavorable> {
this.storeId = storeId; this.storeId = storeId;
} }
public String getEffectiveDateType() {
return effectiveDateType;
}
public void setEffectiveDateType(String effectiveDateType) {
this.effectiveDateType = effectiveDateType;
}
public Date getEffectiveDateStart() {
return effectiveDateStart;
}
public void setEffectiveDateStart(Date effectiveDateStart) {
this.effectiveDateStart = effectiveDateStart;
}
public String getIsonline() { public String getIsonline() {
return isonline; return isonline;
} }
@ -132,6 +158,7 @@ public class CardFavorable extends Model<CardFavorable> {
this.discountType = discountType; this.discountType = discountType;
} }
public String getOilType() { public String getOilType() {
return oilType; return oilType;
} }
@ -180,28 +207,52 @@ public class CardFavorable extends Model<CardFavorable> {
this.discountOffset = discountOffset; this.discountOffset = discountOffset;
} }
public Integer getValidity() { public String getTimeType() {
return validity; return timeType;
} }
public void setValidity(Integer validity) { public void setTimeType(String timeType) {
this.validity = validity; this.timeType = timeType;
} }
public String getEffectiveDate() { public Integer getValidityZero() {
return validityZero;
}
public void setValidityZero(Integer validityZero) {
this.validityZero = validityZero;
}
public Integer getValidityOne() {
return validityOne;
}
public void setValidityOne(Integer validityOne) {
this.validityOne = validityOne;
}
public Integer getValidityTwo() {
return validityTwo;
}
public void setValidityTwo(Integer validityTwo) {
this.validityTwo = validityTwo;
}
public Date getEffectiveDate() {
return effectiveDate; return effectiveDate;
} }
public void setEffectiveDate(String effectiveDate) { public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate; this.effectiveDate = effectiveDate;
} }
public String getEffectiveTime() { public String getValidityDay() {
return effectiveTime; return validityDay;
} }
public void setEffectiveTime(String effectiveTime) { public void setValidityDay(String validityDay) {
this.effectiveTime = effectiveTime; this.validityDay = validityDay;
} }
public String getAvailablePeriod() { public String getAvailablePeriod() {

View File

@ -5,6 +5,8 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -22,6 +24,8 @@ public class CardFavorableRecord extends Model<CardFavorableRecord> {
private Integer mtUserId; private Integer mtUserId;
//所属连锁店id //所属连锁店id
private Integer chainStorId; private Integer chainStorId;
//优惠券id
private Integer cardFavorableId;
//所属店铺id //所属店铺id
private Integer storeId; private Integer storeId;
//会员名字 //会员名字
@ -33,14 +37,17 @@ public class CardFavorableRecord extends Model<CardFavorableRecord> {
//券状态 0未使用 1已使用 //券状态 0未使用 1已使用
private String status; private String status;
//有效期开始时间 //有效期开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime; private Date startTime;
//有效期结束时间 //有效期结束时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime; private Date endTime;
//描述信息 //描述信息
private String exchangeFrom; private String exchangeFrom;
//创建者 //创建者
private String createBy; private String createBy;
//创建时间 //创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
//更新者 //更新者
private String updateBy; private String updateBy;
@ -72,6 +79,14 @@ public class CardFavorableRecord extends Model<CardFavorableRecord> {
this.chainStorId = chainStorId; this.chainStorId = chainStorId;
} }
public Integer getCardFavorableId() {
return cardFavorableId;
}
public void setCardFavorableId(Integer cardFavorableId) {
this.cardFavorableId = cardFavorableId;
}
public Integer getStoreId() { public Integer getStoreId() {
return storeId; return storeId;
} }

View File

@ -2,7 +2,7 @@ package com.fuint.business.marketingActivity.cardFavorable.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap; import java.util.HashMap;
/** /**
@ -16,7 +16,7 @@ public interface CardFavorableRecordMapper extends BaseMapper<CardFavorableRecor
/** /**
* 统计优惠券使用数量 * 统计优惠券使用数量
*/ */
HashMap<String,Integer> selectTotal(Integer storeId); HashMap<String,Integer> selectTotal(@Param("storeId")Integer storeId,@Param("id")Integer id);
} }

View File

@ -6,17 +6,18 @@
SELECT SELECT
count( id ) tatol, count( id ) tatol,
( SELECT count( id ) FROM card_favorable_record ( SELECT count( id ) FROM card_favorable_record
WHERE store_id = #{store_id} WHERE store_id = #{storeId}
and status = "0" ) unTatal, and status = "0" ) unTatal,
( SELECT count( id ) FROM card_favorable_record ( SELECT count( id ) FROM card_favorable_record
WHERE store_id = #{store_id} WHERE store_id = #{storeId}
and status = "1" ) usedTatal, and status = "1" ) usedTatal,
( SELECT count( id ) FROM card_favorable_record ( SELECT count( id ) FROM card_favorable_record
WHERE store_id = #{store_id} WHERE store_id = #{storeId}
and status = "2" ) outTatal and status = "2" ) outTatal
FROM FROM
card_favorable_record card_favorable_record
where store_id = #{store_id} where store_id = #{storeId}
and card_favorable_id = #{id}
</select> </select>
</mapper> </mapper>

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import java.io.Serializable;
import java.util.Map; import java.util.Map;
/** /**
@ -27,6 +28,7 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
* 统计优惠券数量 * 统计优惠券数量
* @return * @return
*/ */
Map<String,Integer> selectCount(); Map<String,Integer> selectCount(CardFavorableRecord cardFavorableRecord);
} }

View File

@ -3,7 +3,11 @@ package com.fuint.business.marketingActivity.cardFavorable.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
import java.io.Serializable;
/** /**
* (CardFavorable)表服务接口 * (CardFavorable)表服务接口
@ -18,7 +22,7 @@ public interface CardFavorableService extends IService<CardFavorable> {
* @param cardFavorable * @param cardFavorable
* @return * @return
*/ */
Boolean add(CardFavorable cardFavorable); Boolean add(CardFavorableDTO cardFavorableDTO);
/** /**
* 分页查询所有数据 * 分页查询所有数据
@ -27,5 +31,12 @@ public interface CardFavorableService extends IService<CardFavorable> {
* @return * @return
*/ */
IPage select(Page page, CardFavorable cardFavorable); IPage select(Page page, CardFavorable cardFavorable);
/**
* 通过主键查询单条数据
* @param id
* @return
*/
CardFavorableVO selectOneById(Serializable id);
} }

View File

@ -13,6 +13,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -45,6 +46,9 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
if(ObjectUtils.isNotEmpty(cardFavorableRecord.getStatus())) { if(ObjectUtils.isNotEmpty(cardFavorableRecord.getStatus())) {
queryWrapper.eq(CardFavorableRecord::getStatus,cardFavorableRecord.getStatus()); queryWrapper.eq(CardFavorableRecord::getStatus,cardFavorableRecord.getStatus());
} }
if(ObjectUtils.isNotEmpty(cardFavorableRecord.getId())) {
queryWrapper.eq(CardFavorableRecord::getCardFavorableId,cardFavorableRecord.getId());
}
if(ObjectUtils.isNotEmpty(cardFavorableRecord.getStartTime()) && if(ObjectUtils.isNotEmpty(cardFavorableRecord.getStartTime()) &&
ObjectUtils.isNotEmpty(cardFavorableRecord.getEndTime())) { ObjectUtils.isNotEmpty(cardFavorableRecord.getEndTime())) {
queryWrapper.between(CardFavorableRecord::getCreateTime,cardFavorableRecord.getStartTime(),cardFavorableRecord.getEndTime()); queryWrapper.between(CardFavorableRecord::getCreateTime,cardFavorableRecord.getStartTime(),cardFavorableRecord.getEndTime());
@ -70,9 +74,9 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
* @return * @return
*/ */
@Override @Override
public Map<String, Integer> selectCount() { public Map<String, Integer> selectCount(CardFavorableRecord cardFavorableRecord) {
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId(); Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
return cardFavorableRecordMapper.selectTotal(storeId); return cardFavorableRecordMapper.selectTotal(storeId,cardFavorableRecord.getId());
} }
} }

View File

@ -4,15 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper; import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
import com.fuint.business.store.service.StoreService; import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.Serializable;
/** /**
* (CardFavorable)表服务实现类 * (CardFavorable)表服务实现类
@ -27,16 +31,31 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
private StoreService storeService; private StoreService storeService;
/** /**
* 新增数据 * 新增数据
* @param cardFavorable * @param cardFavorableDTO
* @return * @return
*/ */
@Override @Override
public Boolean add(CardFavorable cardFavorable) { public Boolean add(CardFavorableDTO cardFavorableDTO) {
CardFavorable cardFavorable = new CardFavorable();
BeanUtils.copyProperties(cardFavorableDTO,cardFavorable);
//获取当前店铺的id和连锁店id //获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
cardFavorable.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); cardFavorable.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardFavorable.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId()); cardFavorable.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
} }
//转换油品类型格式
String oil = "";
String period = "";
for (String s : cardFavorableDTO.getOilType()) {
oil += s + ",";
}
cardFavorable.setOilType(oil);
//转换可用时段类型
for (String s : cardFavorableDTO.getAvailablePeriod()) {
period += s + ",";
}
cardFavorable.setAvailablePeriod(period);
return save(cardFavorable); return save(cardFavorable);
} }
@ -68,5 +87,22 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
queryWrapper.orderByDesc(CardFavorable::getCreateTime); queryWrapper.orderByDesc(CardFavorable::getCreateTime);
return page(page, queryWrapper); return page(page, queryWrapper);
} }
/**
* 通过主键查询单条数据
* @param id
* @return
*/
@Override
public CardFavorableVO selectOneById(Serializable id) {
CardFavorableVO cardFavorableVO = new CardFavorableVO();
CardFavorable favorable = getById(id);
BeanUtils.copyProperties(favorable,cardFavorableVO);
//获取油号
cardFavorableVO.setOilType(favorable.getOilType().split(","));
//获取时间段
cardFavorableVO.setAvailablePeriod(favorable.getAvailablePeriod().split(","));
return cardFavorableVO;
}
} }

View File

@ -0,0 +1,381 @@
package com.fuint.business.marketingActivity.cardFavorable.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.util.Date;
/**
* (CardFavorable)表实体类
*
* @author makejava
* @since 2023-11-07 11:02:06
*/
@SuppressWarnings("serial")
public class CardFavorableVO extends Model<CardFavorableVO> {
//主键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;
//可用油品 092# 1: 95# 298# 30# 4-10# 5 LNG 6CNG 7京92# 8京95# 9京0#
private String[] oilType;
private String oilTypes;
//满减金额
private Double fullDeduction;
//优惠金额
private Double discountAmount;
//满足金额
private Double satisfiedAmount;
//优惠折扣
private Double specialDiscount;
//折扣抵消
private Double discountOffset;
//生效日期类型 0 12
private String timeType;
//有效期0
private Integer validityZero;
//有效期1
private Integer validityOne;
//有效期2
private Integer validityTwo;
//固定有效期开始日期
private Date effectiveDate;
//领券后第几天生效
private String validityDay;
//生效时间类型 0领取时间 1指定时间
private String effectiveDateType;
//生效时间
private Date effectiveDateStart;
//可用时段
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 String[] getOilType() {
return oilType;
}
public void setOilType(String[] oilType) {
this.oilType = oilType;
}
public String getOilTypes() {
return oilTypes;
}
public void setOilTypes(String oilTypes) {
this.oilTypes = oilTypes;
}
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 getEffectiveDateType() {
return effectiveDateType;
}
public void setEffectiveDateType(String effectiveDateType) {
this.effectiveDateType = effectiveDateType;
}
public Date getEffectiveDateStart() {
return effectiveDateStart;
}
public void setEffectiveDateStart(Date effectiveDateStart) {
this.effectiveDateStart = effectiveDateStart;
}
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 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 String getTimeType() {
return timeType;
}
public void setTimeType(String timeType) {
this.timeType = timeType;
}
public Integer getValidityZero() {
return validityZero;
}
public void setValidityZero(Integer validityZero) {
this.validityZero = validityZero;
}
public Integer getValidityOne() {
return validityOne;
}
public void setValidityOne(Integer validityOne) {
this.validityOne = validityOne;
}
public Integer getValidityTwo() {
return validityTwo;
}
public void setValidityTwo(Integer validityTwo) {
this.validityTwo = validityTwo;
}
public Date getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate;
}
public String getValidityDay() {
return validityDay;
}
public void setValidityDay(String validityDay) {
this.validityDay = validityDay;
}
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;
}
}