This commit is contained in:
cun-nan 2024-09-03 10:54:01 +08:00
parent a2e5cef113
commit 553639e4b6
11 changed files with 614 additions and 1 deletions

View File

@ -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',
})
}

View File

@ -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));
}
}

View File

@ -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<ActiveUserConsumeChild> couponList;
}

View File

@ -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;
}

View File

@ -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<ActiveUserConsumeChild> {
}

View File

@ -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<ActiveUserConsume> {
}

View File

@ -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<ActiveUserConsumeChild> selectByActiveUserConsumeId(Integer activeUserConsumeId);
/**
* 根据会员消费有礼id删除子表列表信息
* @param activeUserConsumeId
* @return
*/
int deleteByActiveUserConsumeId(Integer activeUserConsumeId);
}

View File

@ -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();
}

View File

@ -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<ActiveUserConsumeChildMapper,ActiveUserConsumeChild> 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<ActiveUserConsumeChild> 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);
}
}

View File

@ -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<ActiveUserConsumeMapper,ActiveUserConsume> 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<ActiveUserConsume> 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<ActiveUserConsumeChild> activeUserConsumeChildren = activeUserConsumeChildService.selectByActiveUserConsumeId(activeUserConsume.getId());
activeUserConsume.setCouponList(activeUserConsumeChildren);
}
return activeUserConsume;
}
}

View File

@ -55,7 +55,7 @@ public class ActiveUserRechargeServiceImpl extends ServiceImpl<ActiveUserRecharg
activeUserRecharge.setStoreId(nowAccountInfo.getStoreId());
int row = baseMapper.insert(activeUserRecharge);
activeUserRecharge1 = this.selectByStoreId();
if (ObjectUtil.isNotEmpty(activeUserRecharge.getCouponList())) {
if (ObjectUtil.isNotEmpty(activeUserRecharge1) && ObjectUtil.isNotEmpty(activeUserRecharge.getCouponList())) {
for (ActiveUserRechargeChild activeUserRechargeChild : activeUserRecharge.getCouponList()) {
activeUserRechargeChild.setActiveUserRechargeId(activeUserRecharge1.getId());
activeUserRechargeChildService.insert(activeUserRechargeChild);