diff --git a/fuintAdmin/src/api/EventMarketing/activeUserRecharge.js b/fuintAdmin/src/api/EventMarketing/activeUserRecharge.js
new file mode 100644
index 000000000..f29cc0d78
--- /dev/null
+++ b/fuintAdmin/src/api/EventMarketing/activeUserRecharge.js
@@ -0,0 +1,28 @@
+import request from '@/utils/request'
+
+export function getActiveUserRecharge() {
+ return request({
+ url: 'activeUserRecharge/getInfo',
+ method: 'get',
+ })
+}
+export function addActiveUserRecharge(data) {
+ return request({
+ url: 'activeUserRecharge',
+ method: 'post',
+ data:data
+ })
+}
+export function editActiveUserRecharge(data) {
+ return request({
+ url: 'activeUserRecharge',
+ method: 'put',
+ data:data
+ })
+}
+export function deleteActiveUserRecharge(id) {
+ return request({
+ url: 'activeUserRecharge/'+id,
+ method: 'delete',
+ })
+}
diff --git a/fuintAdmin/src/views/EventMarketing/center/index.vue b/fuintAdmin/src/views/EventMarketing/center/index.vue
index 54f89f2e0..c41eb742d 100644
--- a/fuintAdmin/src/views/EventMarketing/center/index.vue
+++ b/fuintAdmin/src/views/EventMarketing/center/index.vue
@@ -90,7 +90,7 @@
推荐会员充值有礼
-
会员充值后,推荐人获得积分、 成长值、优
+
会员充值后,推荐人获得积分、 成长值、优惠券
@@ -104,7 +104,7 @@
推荐会员消费有礼
-
会员消费后,推荐人获得积分、 成长值、优
+
会员消费后,推荐人获得积分、 成长值、优惠券
@@ -153,7 +153,7 @@
限时特价
-
充值后赠送金额、积分、成长值、 优惠券、
+
充值后赠送金额、积分、成长值、 优惠券、锁价优惠
@@ -182,7 +182,7 @@
折扣营销
-
会员折扣营销,限时订单折扣, 引爆店铺流
+
会员折扣营销,限时订单折扣, 引爆店铺流量
diff --git a/fuintAdmin/src/views/EventMarketing/openCardGift/userRecharge.vue b/fuintAdmin/src/views/EventMarketing/openCardGift/userRecharge.vue
index a645eb7b6..35af03d5a 100644
--- a/fuintAdmin/src/views/EventMarketing/openCardGift/userRecharge.vue
+++ b/fuintAdmin/src/views/EventMarketing/openCardGift/userRecharge.vue
@@ -31,9 +31,9 @@
-
-
+
+
每个推荐人最多可获赠的次数限制。0表示每次都可以赠送,不限制次数
@@ -46,8 +46,8 @@
:value="dict.value">
-
-
+
+
{
+ getActiveUserRecharge().then(res => {
if (res.data) {
this.ruleForm = res.data
if (res.data.courtesyReward) this.ruleForm.courtesyReward = res.data.courtesyReward.split(",")
+ if (res.data.paymentType) this.ruleForm.paymentType = res.data.paymentType.split(",")
if (res.data.activeTimeType) this.tindex1 = res.data.activeTimeType
if (res.data.couponList) this.couponList = res.data.couponList
}else {
this.ruleForm = {
activeTimeType:0,
+ paymentType:[],
courtesyReward:[]
}
this.tindex1 = 0
@@ -308,15 +311,16 @@ export default {
}
this.$refs[formName].validate((valid) => {
if (valid) {
+ if (this.ruleForm.paymentType) this.ruleForm.paymentType = this.ruleForm.paymentType.toString()
if (this.ruleForm.courtesyReward) this.ruleForm.courtesyReward = this.ruleForm.courtesyReward.toString()
if (this.couponList) this.ruleForm.couponList = this.couponList
if (this.ruleForm.id) {
- editActiveNewlyweds1(this.ruleForm).then(response => {
+ editActiveUserRecharge(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.getInfo()
});
}else {
- insertActiveNewlyweds(this.ruleForm).then(response => {
+ addActiveUserRecharge(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.getInfo()
});
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/controller/ActiveUserRechargeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/controller/ActiveUserRechargeController.java
new file mode 100644
index 000000000..6633333d3
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/controller/ActiveUserRechargeController.java
@@ -0,0 +1,81 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.controller;
+
+import com.fuint.business.marketingActivity.activeUserRecharge.entity.ActiveUserRecharge;
+import com.fuint.business.marketingActivity.activeUserRecharge.service.ActiveUserRechargeService;
+import com.fuint.framework.web.BaseController;
+import com.fuint.framework.web.ResponseObject;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * 油机汽机配置(ActiveUserRecharge)表控制层
+ *
+ * @author makejava
+ * @since 2024-07-31 14:59:04
+ */
+@RestController
+@RequestMapping("activeUserRecharge")
+public class ActiveUserRechargeController extends BaseController {
+ /**
+ * 服务对象
+ */
+ @Resource
+ private ActiveUserRechargeService activeUserRechargeService;
+
+ /**
+ * 通过主键查询单条数据
+ *
+ * @param id 主键
+ * @return 单条数据
+ */
+ @GetMapping("{id}")
+ public ResponseObject queryById(@PathVariable("id") Integer id) {
+ return getSuccessResult(activeUserRechargeService.queryById(id));
+ }
+
+ /**
+ * 通过主键查询单条数据
+ *
+ * @return 单条数据
+ */
+ @GetMapping("getInfo")
+ public ResponseObject queryByStoreId() {
+ return getSuccessResult(activeUserRechargeService.selectByStoreId());
+ }
+
+ /**
+ * 新增数据
+ *
+ * @param activeUserRecharge 实体
+ * @return 新增结果
+ */
+ @PostMapping
+ public ResponseObject add(@RequestBody ActiveUserRecharge activeUserRecharge) {
+ return getSuccessResult(activeUserRechargeService.insert(activeUserRecharge));
+ }
+
+ /**
+ * 编辑数据
+ *
+ * @param activeUserRecharge 实体
+ * @return 编辑结果
+ */
+ @PutMapping
+ public ResponseObject edit(@RequestBody ActiveUserRecharge activeUserRecharge) {
+ return getSuccessResult(activeUserRechargeService.update(activeUserRecharge));
+ }
+
+ /**
+ * 删除数据
+ *
+ * @param id 主键
+ * @return 删除是否成功
+ */
+ @DeleteMapping("{id}")
+ public ResponseObject deleteById(@PathVariable Integer id) {
+ return getSuccessResult(activeUserRechargeService.deleteById(id));
+ }
+
+}
+
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/entity/ActiveUserRecharge.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/entity/ActiveUserRecharge.java
new file mode 100644
index 000000000..ce565575a
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/entity/ActiveUserRecharge.java
@@ -0,0 +1,104 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.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;
+
+/**
+ * 推荐会员充值有礼(ActiveUserRecharge)实体类
+ *
+ * @author makejava
+ * @since 2024-09-02 17:57:41
+ */
+@Data
+@TableName("active_user_recharge")
+@ApiModel(value = "ActiveUserRecharge", description = "推荐会员充值有礼")
+public class ActiveUserRecharge 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 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/activeUserRecharge/entity/ActiveUserRechargeChild.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/entity/ActiveUserRechargeChild.java
new file mode 100644
index 000000000..b3ea8ca2f
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/entity/ActiveUserRechargeChild.java
@@ -0,0 +1,61 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.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;
+
+/**
+ * 推荐会员充值有礼子表(ActiveUserRechargeChild)实体类
+ *
+ * @author makejava
+ * @since 2024-09-02 17:58:02
+ */
+@Data
+@TableName("active_user_recharge_child")
+@ApiModel(value = "ActiveUserRechargeChild", description = "推荐会员充值有礼子表")
+public class ActiveUserRechargeChild extends BaseEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * 主键
+ */
+ @ApiModelProperty("自增ID")
+ @TableId(value = "ID", type = IdType.AUTO)
+ private Integer id;
+ /**
+ * 生日活动id
+ */
+ private Integer activeUserRechargeId;
+ /**
+ * 券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/activeUserRecharge/mapper/ActiveUserRechargeChildMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/mapper/ActiveUserRechargeChildMapper.java
new file mode 100644
index 000000000..2db9982c1
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/mapper/ActiveUserRechargeChildMapper.java
@@ -0,0 +1,7 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fuint.business.marketingActivity.activeUserRecharge.entity.ActiveUserRechargeChild;
+
+public interface ActiveUserRechargeChildMapper extends BaseMapper {
+}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/mapper/ActiveUserRechargeMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/mapper/ActiveUserRechargeMapper.java
new file mode 100644
index 000000000..6f5c98121
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/mapper/ActiveUserRechargeMapper.java
@@ -0,0 +1,7 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fuint.business.marketingActivity.activeUserRecharge.entity.ActiveUserRecharge;
+
+public interface ActiveUserRechargeMapper extends BaseMapper {
+}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/ActiveUserRechargeChildService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/ActiveUserRechargeChildService.java
new file mode 100644
index 000000000..cdea5959c
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/ActiveUserRechargeChildService.java
@@ -0,0 +1,63 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.service;
+
+import com.fuint.business.marketingActivity.activeUserRecharge.entity.ActiveUserRechargeChild;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+
+import java.util.List;
+
+/**
+ * 推荐会员充值有礼子表(ActiveUserRechargeChild)表服务接口
+ *
+ * @author makejava
+ * @since 2024-09-02 17:58:02
+ */
+public interface ActiveUserRechargeChildService {
+
+ /**
+ * 通过ID查询单条数据
+ *
+ * @param id 主键
+ * @return 实例对象
+ */
+ ActiveUserRechargeChild queryById(Integer id);
+
+ /**
+ * 新增数据
+ *
+ * @param activeUserRechargeChild 实例对象
+ * @return 实例对象
+ */
+ int insert(ActiveUserRechargeChild activeUserRechargeChild);
+
+ /**
+ * 修改数据
+ *
+ * @param activeUserRechargeChild 实例对象
+ * @return 实例对象
+ */
+ int update(ActiveUserRechargeChild activeUserRechargeChild);
+
+ /**
+ * 通过主键删除数据
+ *
+ * @param id 主键
+ * @return 是否成功
+ */
+ int deleteById(Integer id);
+
+ /**
+ * 根据推荐用户充值id查询子表列表信息
+ * @param activeUserRechargeId
+ * @return
+ */
+ List selectByUserRechargeId(Integer activeUserRechargeId);
+
+ /**
+ * 根据推荐用户充值id删除子表信息
+ * @param activeUserRechargeId
+ * @return
+ */
+ int deleteByUserRechargeId(Integer activeUserRechargeId);
+
+}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/ActiveUserRechargeService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/ActiveUserRechargeService.java
new file mode 100644
index 000000000..2f6964160
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/ActiveUserRechargeService.java
@@ -0,0 +1,53 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.service;
+
+import com.fuint.business.marketingActivity.activeUserRecharge.entity.ActiveUserRecharge;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+
+/**
+ * 推荐会员充值有礼(ActiveUserRecharge)表服务接口
+ *
+ * @author makejava
+ * @since 2024-09-02 17:57:42
+ */
+public interface ActiveUserRechargeService {
+
+ /**
+ * 通过ID查询单条数据
+ *
+ * @param id 主键
+ * @return 实例对象
+ */
+ ActiveUserRecharge queryById(Integer id);
+
+ /**
+ * 新增数据
+ *
+ * @param activeUserRecharge 实例对象
+ * @return 实例对象
+ */
+ int insert(ActiveUserRecharge activeUserRecharge);
+
+ /**
+ * 修改数据
+ *
+ * @param activeUserRecharge 实例对象
+ * @return 实例对象
+ */
+ int update(ActiveUserRecharge activeUserRecharge);
+
+ /**
+ * 通过主键删除数据
+ *
+ * @param id 主键
+ * @return 是否成功
+ */
+ int deleteById(Integer id);
+
+ /**
+ * 根据店铺id查询
+ * @return
+ */
+ ActiveUserRecharge selectByStoreId();
+
+}
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeChildServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeChildServiceImpl.java
new file mode 100644
index 000000000..cbe1dea9d
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeChildServiceImpl.java
@@ -0,0 +1,79 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fuint.business.marketingActivity.activeUserRecharge.entity.ActiveUserRechargeChild;
+import com.fuint.business.marketingActivity.activeUserRecharge.mapper.ActiveUserRechargeChildMapper;
+import com.fuint.business.marketingActivity.activeUserRecharge.service.ActiveUserRechargeChildService;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 推荐会员充值有礼子表(ActiveUserRechargeChild)表服务实现类
+ *
+ * @author makejava
+ * @since 2024-09-02 17:58:02
+ */
+@Service("activeUserRechargeChildService")
+public class ActiveUserRechargeChildServiceImpl extends ServiceImpl implements ActiveUserRechargeChildService {
+
+ /**
+ * 通过ID查询单条数据
+ *
+ * @param id 主键
+ * @return 实例对象
+ */
+ @Override
+ public ActiveUserRechargeChild queryById(Integer id) {
+ return baseMapper.selectById(id);
+ }
+
+ /**
+ * 新增数据
+ *
+ * @param activeUserRechargeChild 实例对象
+ * @return 实例对象
+ */
+ @Override
+ public int insert(ActiveUserRechargeChild activeUserRechargeChild) {
+ return baseMapper.insert(activeUserRechargeChild);
+ }
+
+ /**
+ * 修改数据
+ *
+ * @param activeUserRechargeChild 实例对象
+ * @return 实例对象
+ */
+ @Override
+ public int update(ActiveUserRechargeChild activeUserRechargeChild) {
+ return baseMapper.updateById(activeUserRechargeChild);
+ }
+
+ /**
+ * 通过主键删除数据
+ *
+ * @param id 主键
+ * @return 是否成功
+ */
+ @Override
+ public int deleteById(Integer id) {
+ return baseMapper.deleteById(id);
+ }
+
+ @Override
+ public List selectByUserRechargeId(Integer activeUserRechargeId) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("active_user_recharge_id", activeUserRechargeId);
+ return baseMapper.selectList(queryWrapper);
+ }
+
+ @Override
+ public int deleteByUserRechargeId(Integer activeUserRechargeId) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("active_user_recharge_id", activeUserRechargeId);
+ return baseMapper.delete(queryWrapper);
+ }
+}
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
new file mode 100644
index 000000000..1a29a4acb
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge/service/impl/ActiveUserRechargeServiceImpl.java
@@ -0,0 +1,122 @@
+package com.fuint.business.marketingActivity.activeUserRecharge.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.activeUserRecharge.entity.ActiveUserRecharge;
+import com.fuint.business.marketingActivity.activeUserRecharge.entity.ActiveUserRechargeChild;
+import com.fuint.business.marketingActivity.activeUserRecharge.mapper.ActiveUserRechargeMapper;
+import com.fuint.business.marketingActivity.activeUserRecharge.service.ActiveUserRechargeChildService;
+import com.fuint.business.marketingActivity.activeUserRecharge.service.ActiveUserRechargeService;
+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;
+
+/**
+ * 推荐会员充值有礼(ActiveUserRecharge)表服务实现类
+ *
+ * @author makejava
+ * @since 2024-09-02 17:57:43
+ */
+@Service("activeUserRechargeService")
+public class ActiveUserRechargeServiceImpl extends ServiceImpl implements ActiveUserRechargeService {
+
+ @Autowired
+ private ActiveUserRechargeChildService activeUserRechargeChildService;
+
+ /**
+ * 通过ID查询单条数据
+ *
+ * @param id 主键
+ * @return 实例对象
+ */
+ @Override
+ public ActiveUserRecharge queryById(Integer id) {
+ return baseMapper.selectById(id);
+ }
+
+ /**
+ * 新增数据
+ *
+ * @param activeUserRecharge 实例对象
+ * @return 实例对象
+ */
+ @Override
+ public int insert(ActiveUserRecharge activeUserRecharge) {
+ ActiveUserRecharge activeUserRecharge1 = this.selectByStoreId();
+ if (ObjectUtil.isNotEmpty(activeUserRecharge1)) return 0;
+
+ AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
+ activeUserRecharge.setChainStoreId(nowAccountInfo.getChainStoreId());
+ activeUserRecharge.setStoreId(nowAccountInfo.getStoreId());
+ int row = baseMapper.insert(activeUserRecharge);
+ activeUserRecharge1 = this.selectByStoreId();
+ if (ObjectUtil.isNotEmpty(activeUserRecharge.getCouponList())) {
+ for (ActiveUserRechargeChild activeUserRechargeChild : activeUserRecharge.getCouponList()) {
+ activeUserRechargeChild.setActiveUserRechargeId(activeUserRecharge1.getId());
+ activeUserRechargeChildService.insert(activeUserRechargeChild);
+ }
+ }
+ return row;
+ }
+
+ /**
+ * 修改数据
+ *
+ * @param activeUserRecharge 实例对象
+ * @return 实例对象
+ */
+ @Override
+ public int update(ActiveUserRecharge activeUserRecharge) {
+ int row = baseMapper.updateById(activeUserRecharge);
+ activeUserRechargeChildService.deleteByUserRechargeId(activeUserRecharge.getId());
+ if (ObjectUtil.isNotEmpty(activeUserRecharge.getCouponList())) {
+ for (ActiveUserRechargeChild activeUserRechargeChild : activeUserRecharge.getCouponList()) {
+ activeUserRechargeChild.setActiveUserRechargeId(activeUserRecharge.getId());
+ activeUserRechargeChildService.insert(activeUserRechargeChild);
+ }
+ }
+ return row;
+ }
+
+ /**
+ * 通过主键删除数据
+ *
+ * @param id 主键
+ * @return 是否成功
+ */
+ @Override
+ public int deleteById(Integer id) {
+ return baseMapper.deleteById(id);
+ }
+
+ @Override
+ public ActiveUserRecharge selectByStoreId() {
+ AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("store_id", nowAccountInfo.getStoreId());
+ ActiveUserRecharge activeUserRecharge = null;
+ List list = baseMapper.selectList(queryWrapper);
+ for (ActiveUserRecharge userRecharge : list) {
+ if (userRecharge.getActiveTimeType().equals("0")){
+ activeUserRecharge = userRecharge;
+ }else {
+ Date date = new Date();
+ if (userRecharge.getActiveStartTime().before(date) && userRecharge.getActiveEndTime().after(date)){
+ activeUserRecharge = userRecharge;
+ }
+ }
+ }
+ if (ObjectUtil.isNotEmpty(activeUserRecharge)){
+ List activeUserRechargeChildren = activeUserRechargeChildService.selectByUserRechargeId(activeUserRecharge.getId());
+ activeUserRecharge.setCouponList(activeUserRechargeChildren);
+ }
+ return activeUserRecharge;
+ }
+
+
+}