diff --git a/fuintAdmin/src/api/EventMarketing/activeUserConsume.js b/fuintAdmin/src/api/EventMarketing/activeUserConsume.js new file mode 100644 index 000000000..9e653eff9 --- /dev/null +++ b/fuintAdmin/src/api/EventMarketing/activeUserConsume.js @@ -0,0 +1,28 @@ +import request from '@/utils/request' + +export function getActiveUserConsume() { + return request({ + url: 'activeUserConsume/getInfo', + method: 'get', + }) +} +export function addActiveUserConsume(data) { + return request({ + url: 'activeUserConsume', + method: 'post', + data:data + }) +} +export function editActiveUserConsume(data) { + return request({ + url: 'activeUserConsume', + method: 'put', + data:data + }) +} +export function deleteActiveUserConsume(id) { + return request({ + url: 'activeUserConsume/'+id, + method: 'delete', + }) +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/controller/ActiveUserConsumeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/controller/ActiveUserConsumeController.java new file mode 100644 index 000000000..5d2b25df3 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/controller/ActiveUserConsumeController.java @@ -0,0 +1,81 @@ +package com.fuint.business.marketingActivity.activeUserConsume.controller; + +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsume; +import com.fuint.business.marketingActivity.activeUserConsume.service.ActiveUserConsumeService; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 油机汽机配置(ActiveUserConsume)表控制层 + * + * @author makejava + * @since 2024-07-31 14:59:04 + */ +@RestController +@RequestMapping("activeUserConsume") +public class ActiveUserConsumeController extends BaseController { + /** + * 服务对象 + */ + @Resource + private ActiveUserConsumeService activeUserConsumeService; + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseObject queryById(@PathVariable("id") Integer id) { + return getSuccessResult(activeUserConsumeService.queryById(id)); + } + + /** + * 通过主键查询单条数据 + * + * @return 单条数据 + */ + @GetMapping("getInfo") + public ResponseObject queryByStoreId() { + return getSuccessResult(activeUserConsumeService.selectByStoreId()); + } + + /** + * 新增数据 + * + * @param activeUserConsume 实体 + * @return 新增结果 + */ + @PostMapping + public ResponseObject add(@RequestBody ActiveUserConsume activeUserConsume) { + return getSuccessResult(activeUserConsumeService.insert(activeUserConsume)); + } + + /** + * 编辑数据 + * + * @param activeUserConsume 实体 + * @return 编辑结果 + */ + @PutMapping + public ResponseObject edit(@RequestBody ActiveUserConsume activeUserConsume) { + return getSuccessResult(activeUserConsumeService.update(activeUserConsume)); + } + + /** + * 删除数据 + * + * @param id 主键 + * @return 删除是否成功 + */ + @DeleteMapping("{id}") + public ResponseObject deleteById(@PathVariable Integer id) { + return getSuccessResult(activeUserConsumeService.deleteById(id)); + } + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/entity/ActiveUserConsume.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/entity/ActiveUserConsume.java new file mode 100644 index 000000000..94801638b --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/entity/ActiveUserConsume.java @@ -0,0 +1,113 @@ +package com.fuint.business.marketingActivity.activeUserConsume.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fuint.framework.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +/** + * 推荐会员消费有礼(ActiveUserConsume)实体类 + * + * @author makejava + * @since 2024-09-03 10:27:35 + */ +@Data +@TableName("active_user_consume") +@ApiModel(value = "ActiveUserConsume", description = "推荐会员消费有礼") +public class ActiveUserConsume extends BaseEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 主键 + */ + @ApiModelProperty("自增ID") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + /** + * 所属连锁店id + */ + private Integer chainStoreId; + /** + * 所属店铺id + */ + private Integer storeId; + /** + * 活动名称 + */ + private String name; + /** + * 活动时间类型:0永久有效;1自定义 + */ + private String activeTimeType; + /** + * 活动开始时间 + */ + private Date activeStartTime; + /** + * 活动结束时间 + */ + private Date activeEndTime; + /** + * 获赠次数限制 + */ + private Integer frequencyLimit; + /** + * 适用油品油号类型 + */ + private String suitOilType; + /** + * 适用油品油号 + */ + private String suitOilIds; + /** + * 可使用支付方式 + */ + private String paymentType; + /** + * 适用会员等级 + */ + private String userGradeIds; + /** + * 活动奖品 0:优惠券 2:成长值 3:积分 + */ + private String courtesyReward; + /** + * 赠送积分 + */ + private Integer points; + /** + * 赠送成长值 + */ + private Integer growthValue; + /** + * 创建者 + */ + private String createBy; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新者 + */ + private String updateBy; + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 优惠券子表信息 + */ + @TableField(exist = false) + private List couponList; + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/entity/ActiveUserConsumeChild.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/entity/ActiveUserConsumeChild.java new file mode 100644 index 000000000..212bc8e35 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/entity/ActiveUserConsumeChild.java @@ -0,0 +1,61 @@ +package com.fuint.business.marketingActivity.activeUserConsume.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fuint.framework.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.io.Serializable; + +/** + * 推荐会员消费有礼子表(ActiveUserConsumeChild)实体类 + * + * @author makejava + * @since 2024-09-03 10:27:59 + */ +@Data +@TableName("active_user_consume_child") +@ApiModel(value = "ActiveUserConsumeChild", description = "推荐会员消费有礼子表") +public class ActiveUserConsumeChild extends BaseEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 主键 + */ + @ApiModelProperty("自增ID") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + /** + * 会员消费id + */ + private Integer activeUserConsumeId; + /** + * 券id + */ + private Integer vouchersId; + /** + * 券数量 + */ + private Integer giftCardTotal; + /** + * 创建者 + */ + private String createBy; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新者 + */ + private String updateBy; + /** + * 更新时间 + */ + private Date updateTime; + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/mapper/ActiveUserConsumeChildMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/mapper/ActiveUserConsumeChildMapper.java new file mode 100644 index 000000000..a8beefc10 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/mapper/ActiveUserConsumeChildMapper.java @@ -0,0 +1,7 @@ +package com.fuint.business.marketingActivity.activeUserConsume.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsumeChild; + +public interface ActiveUserConsumeChildMapper extends BaseMapper { +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/mapper/ActiveUserConsumeMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/mapper/ActiveUserConsumeMapper.java new file mode 100644 index 000000000..bd4dd863b --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/mapper/ActiveUserConsumeMapper.java @@ -0,0 +1,7 @@ +package com.fuint.business.marketingActivity.activeUserConsume.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsume; + +public interface ActiveUserConsumeMapper extends BaseMapper { +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/ActiveUserConsumeChildService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/ActiveUserConsumeChildService.java new file mode 100644 index 000000000..c0efcd1ef --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/ActiveUserConsumeChildService.java @@ -0,0 +1,63 @@ +package com.fuint.business.marketingActivity.activeUserConsume.service; + +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsumeChild; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +import java.util.List; + +/** + * 推荐会员消费有礼子表(ActiveUserConsumeChild)表服务接口 + * + * @author makejava + * @since 2024-09-03 10:27:59 + */ +public interface ActiveUserConsumeChildService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + ActiveUserConsumeChild queryById(Integer id); + + /** + * 新增数据 + * + * @param activeUserConsumeChild 实例对象 + * @return 实例对象 + */ + int insert(ActiveUserConsumeChild activeUserConsumeChild); + + /** + * 修改数据 + * + * @param activeUserConsumeChild 实例对象 + * @return 实例对象 + */ + int update(ActiveUserConsumeChild activeUserConsumeChild); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + int deleteById(Integer id); + + /** + * 根据会员消费有礼id查询子表列表信息 + * @param activeUserConsumeId + * @return + */ + List selectByActiveUserConsumeId(Integer activeUserConsumeId); + + /** + * 根据会员消费有礼id删除子表列表信息 + * @param activeUserConsumeId + * @return + */ + int deleteByActiveUserConsumeId(Integer activeUserConsumeId); + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/ActiveUserConsumeService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/ActiveUserConsumeService.java new file mode 100644 index 000000000..800688159 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/ActiveUserConsumeService.java @@ -0,0 +1,53 @@ +package com.fuint.business.marketingActivity.activeUserConsume.service; + +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsume; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +/** + * 推荐会员消费有礼(ActiveUserConsume)表服务接口 + * + * @author makejava + * @since 2024-09-03 10:27:36 + */ +public interface ActiveUserConsumeService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + ActiveUserConsume queryById(Integer id); + + /** + * 新增数据 + * + * @param activeUserConsume 实例对象 + * @return 实例对象 + */ + int insert(ActiveUserConsume activeUserConsume); + + /** + * 修改数据 + * + * @param activeUserConsume 实例对象 + * @return 实例对象 + */ + int update(ActiveUserConsume activeUserConsume); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + int deleteById(Integer id); + + /** + * 根据店铺id查询会员消费有礼信息 + * @return + */ + ActiveUserConsume selectByStoreId(); + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/impl/ActiveUserConsumeChildServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/impl/ActiveUserConsumeChildServiceImpl.java new file mode 100644 index 000000000..26cd3f59c --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/impl/ActiveUserConsumeChildServiceImpl.java @@ -0,0 +1,79 @@ +package com.fuint.business.marketingActivity.activeUserConsume.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsumeChild; +import com.fuint.business.marketingActivity.activeUserConsume.mapper.ActiveUserConsumeChildMapper; +import com.fuint.business.marketingActivity.activeUserConsume.service.ActiveUserConsumeChildService; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; + +/** + * 推荐会员消费有礼子表(ActiveUserConsumeChild)表服务实现类 + * + * @author makejava + * @since 2024-09-03 10:27:59 + */ +@Service("activeUserConsumeChildService") +public class ActiveUserConsumeChildServiceImpl extends ServiceImpl implements ActiveUserConsumeChildService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public ActiveUserConsumeChild queryById(Integer id) { + return baseMapper.selectById(id); + } + + /** + * 新增数据 + * + * @param activeUserConsumeChild 实例对象 + * @return 实例对象 + */ + @Override + public int insert(ActiveUserConsumeChild activeUserConsumeChild) { + return baseMapper.insert(activeUserConsumeChild); + } + + /** + * 修改数据 + * + * @param activeUserConsumeChild 实例对象 + * @return 实例对象 + */ + @Override + public int update(ActiveUserConsumeChild activeUserConsumeChild) { + return baseMapper.updateById(activeUserConsumeChild); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public int deleteById(Integer id) { + return baseMapper.deleteById(id); + } + + @Override + public List selectByActiveUserConsumeId(Integer activeUserConsumeId) { + QueryWrapper queryWrapper = new QueryWrapper();; + queryWrapper.eq("active_user_consume_id", activeUserConsumeId); + return baseMapper.selectList(queryWrapper); + } + + @Override + public int deleteByActiveUserConsumeId(Integer activeUserConsumeId) { + QueryWrapper queryWrapper = new QueryWrapper();; + queryWrapper.eq("active_user_consume_id", activeUserConsumeId); + return baseMapper.delete(queryWrapper); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/impl/ActiveUserConsumeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/impl/ActiveUserConsumeServiceImpl.java new file mode 100644 index 000000000..f27ff2b12 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserConsume/service/impl/ActiveUserConsumeServiceImpl.java @@ -0,0 +1,121 @@ +package com.fuint.business.marketingActivity.activeUserConsume.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsume; +import com.fuint.business.marketingActivity.activeUserConsume.entity.ActiveUserConsumeChild; +import com.fuint.business.marketingActivity.activeUserConsume.mapper.ActiveUserConsumeMapper; +import com.fuint.business.marketingActivity.activeUserConsume.service.ActiveUserConsumeChildService; +import com.fuint.business.marketingActivity.activeUserConsume.service.ActiveUserConsumeService; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 推荐会员消费有礼(ActiveUserConsume)表服务实现类 + * + * @author makejava + * @since 2024-09-03 10:27:37 + */ +@Service("activeUserConsumeService") +public class ActiveUserConsumeServiceImpl extends ServiceImpl implements ActiveUserConsumeService { + + @Autowired + private ActiveUserConsumeChildService activeUserConsumeChildService; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public ActiveUserConsume queryById(Integer id) { + return baseMapper.selectById(id); + } + + /** + * 新增数据 + * + * @param activeUserConsume 实例对象 + * @return 实例对象 + */ + @Override + public int insert(ActiveUserConsume activeUserConsume) { + ActiveUserConsume activeUserConsume1 = this.selectByStoreId(); + if (ObjectUtil.isNotEmpty(activeUserConsume1)) return 0; + + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + activeUserConsume.setChainStoreId(nowAccountInfo.getChainStoreId()); + activeUserConsume.setStoreId(nowAccountInfo.getStoreId()); + int row = baseMapper.insert(activeUserConsume); + activeUserConsume1 = this.selectByStoreId(); + if (ObjectUtil.isNotEmpty(activeUserConsume1) && ObjectUtil.isNotEmpty(activeUserConsume.getCouponList())) { + for (ActiveUserConsumeChild activeUserConsumeChild : activeUserConsume.getCouponList()) { + activeUserConsumeChild.setActiveUserConsumeId(activeUserConsume1.getId()); + activeUserConsumeChildService.insert(activeUserConsumeChild); + } + } + return row; + } + + /** + * 修改数据 + * + * @param activeUserConsume 实例对象 + * @return 实例对象 + */ + @Override + public int update(ActiveUserConsume activeUserConsume) { + int row = baseMapper.updateById(activeUserConsume); + activeUserConsumeChildService.deleteByActiveUserConsumeId(activeUserConsume.getId()); + if (ObjectUtil.isNotEmpty(activeUserConsume) && ObjectUtil.isNotEmpty(activeUserConsume.getCouponList())) { + for (ActiveUserConsumeChild activeUserConsumeChild : activeUserConsume.getCouponList()) { + activeUserConsumeChild.setActiveUserConsumeId(activeUserConsume.getId()); + activeUserConsumeChildService.insert(activeUserConsumeChild); + } + } + return row; + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public int deleteById(Integer id) { + return baseMapper.deleteById(id); + } + + @Override + public ActiveUserConsume selectByStoreId() { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("store_id", nowAccountInfo.getStoreId()); + ActiveUserConsume activeUserConsume = null; + List list = baseMapper.selectList(queryWrapper); + for (ActiveUserConsume userConsume : list) { + if (userConsume.getActiveTimeType().equals("0")){ + activeUserConsume = userConsume; + }else { + Date date = new Date(); + if (activeUserConsume.getActiveStartTime().before(date) && activeUserConsume.getActiveEndTime().after(date)){ + activeUserConsume = userConsume; + } + } + } + + if (ObjectUtil.isNotEmpty(activeUserConsume)){ + List activeUserConsumeChildren = activeUserConsumeChildService.selectByActiveUserConsumeId(activeUserConsume.getId()); + activeUserConsume.setCouponList(activeUserConsumeChildren); + } + return activeUserConsume; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeServiceImpl.java index 1a29a4acb..ea773c326 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeServiceImpl.java @@ -55,7 +55,7 @@ public class ActiveUserRechargeServiceImpl extends ServiceImpl