This commit is contained in:
cun-nan 2024-09-03 10:14:14 +08:00
parent 8d693455dc
commit a2e5cef113
13 changed files with 843 additions and 25 deletions

View File

@ -190,6 +190,215 @@
</TableInfoDTO>
</value>
</entry>
<entry key="oilsystem.active_user_recharge">
<value>
<TableInfoDTO>
<option name="comment" value="推荐会员充值有礼" />
<option name="fullColumn">
<list>
<ColumnInfoDTO>
<option name="comment" value="主键" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="id" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="所属连锁店id" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="chainStoreId" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="所属店铺id" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="storeId" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="活动名称" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="name" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="活动时间类型0永久有效1自定义" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="activeTimeType" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="活动开始时间" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="activeStartTime" />
<option name="type" value="java.util.Date" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="活动结束时间" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="activeEndTime" />
<option name="type" value="java.util.Date" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="获赠次数限制" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="frequencyLimit" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="可使用支付方式" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="paymentType" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="适用会员等级" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="userGradeIds" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="活动奖品 0优惠券 2成长值 3积分" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="courtesyReward" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="赠送积分" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="points" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="赠送成长值" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="growthValue" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="创建者" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="createBy" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="创建时间" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="createTime" />
<option name="type" value="java.util.Date" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="更新者" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="updateBy" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="更新时间" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="updateTime" />
<option name="type" value="java.util.Date" />
</ColumnInfoDTO>
</list>
</option>
<option name="name" value="ActiveUserRecharge" />
<option name="preName" value="" />
<option name="saveModelName" value="fuint-application" />
<option name="savePackageName" value="com.fuint.business.marketingActivity.activeUserRecharge" />
<option name="savePath" value="./fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge" />
<option name="templateGroupName" value="Default" />
</TableInfoDTO>
</value>
</entry>
<entry key="oilsystem.active_user_recharge_child">
<value>
<TableInfoDTO>
<option name="comment" value="推荐会员充值有礼子表" />
<option name="fullColumn">
<list>
<ColumnInfoDTO>
<option name="comment" value="主键" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="id" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="生日活动id" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="activeUserRechargeId" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="券id" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="vouchersId" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="券数量" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="giftCardTotal" />
<option name="type" value="java.lang.Integer" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="创建者" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="createBy" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="创建时间" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="createTime" />
<option name="type" value="java.util.Date" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="更新者" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="updateBy" />
<option name="type" value="java.lang.String" />
</ColumnInfoDTO>
<ColumnInfoDTO>
<option name="comment" value="更新时间" />
<option name="custom" value="false" />
<option name="ext" value="{}" />
<option name="name" value="updateTime" />
<option name="type" value="java.util.Date" />
</ColumnInfoDTO>
</list>
</option>
<option name="name" value="ActiveUserRechargeChild" />
<option name="preName" value="" />
<option name="saveModelName" value="fuint-application" />
<option name="savePackageName" value="com.fuint.business.marketingActivity.activeUserRecharge" />
<option name="savePath" value="./fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeUserRecharge" />
<option name="templateGroupName" value="Default" />
</TableInfoDTO>
</value>
</entry>
<entry key="oilsystem.open_card_gift">
<value>
<TableInfoDTO>

View File

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

View File

@ -90,7 +90,7 @@
<img src="./imgs/充值@2x.png">
<div>
<div class="size_title">推荐会员充值有礼</div>
<div class="size_text">会员充值后推荐人获得积分 成长值</div>
<div class="size_text">会员充值后推荐人获得积分 成长值惠券</div>
</div>
</div>
<div class="nr-bottom">
@ -104,7 +104,7 @@
<img src="./imgs/消费卡@2x.png" style="width: 59px;height: 42px">
<div>
<div class="size_title">推荐会员消费有礼</div>
<div class="size_text">会员消费后推荐人获得积分 成长值</div>
<div class="size_text">会员消费后推荐人获得积分 成长值惠券</div>
</div>
</div>
<div class="nr-bottom">
@ -153,7 +153,7 @@
<img src="./imgs/特价申请单@2x.png">
<div>
<div class="size_title">限时特价</div>
<div class="size_text">充值后赠送金额积分成长值 优惠券</div>
<div class="size_text">充值后赠送金额积分成长值 优惠券锁价优惠</div>
</div>
</div>
<div class="nr-bottom">
@ -182,7 +182,7 @@
<img src="./imgs/折扣@2x.png">
<div>
<div class="size_title">折扣营销</div>
<div class="size_text">会员折扣营销限时订单折扣 引爆店铺流</div>
<div class="size_text">会员折扣营销限时订单折扣 引爆店铺流</div>
</div>
</div>
<div class="nr-bottom">

View File

@ -31,9 +31,9 @@
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="获赠次数限制" prop="noticeContent">
<el-input v-model="ruleForm.noticeContent"
placeholder="请输入通知内容"></el-input>
<el-form-item label="获赠次数限制" prop="frequencyLimit">
<el-input v-model="ruleForm.frequencyLimit"
placeholder="请输入获赠次数限制"></el-input>
<span style="font-size: 12px;color: grey">每个推荐人最多可获赠的次数限制0表示每次都可以赠送不限制次数</span>
</el-form-item>
<el-form-item label="可使用支付方式" prop="paymentType">
@ -46,8 +46,8 @@
:value="dict.value"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="适用会员等级" prop="dieselUserLevel">
<el-select v-model="ruleForm.dieselUserLevel" clearable placeholder="请选择会员等级" style="width: 100%">
<el-form-item label="适用会员等级" prop="userGradeIds">
<el-select v-model="ruleForm.userGradeIds" clearable placeholder="请选择会员等级" style="width: 100%">
<el-option
v-for="(item,index) in userGradeList"
:label="item.name"
@ -125,19 +125,17 @@ import {
delActiveNewlyweds,
addActiveNewlyweds,
updateActiveNewlyweds,
huiActiveNewlyweds,
editActiveNewlyweds, getInfoActiveNewlyweds, insertActiveNewlyweds, editActiveNewlyweds1
editActiveNewlyweds
} from "@/api/EventMarketing/activeNewlyweds";
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
import QRCode from "qrcodejs2";
import {
delActiveFullminus,
editActiveFullminus,
getActiveFullminus,
updateActiveFullminus
} from "@/api/EventMarketing/activeFullminus";
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
import {listUserGrade} from "@/api/staff/user/usergrade";
import {
addActiveUserRecharge,
editActiveUserRecharge,
getActiveUserRecharge
} from "@/api/EventMarketing/activeUserRecharge";
export default {
name: "ActiveNewlyweds",
@ -237,11 +235,14 @@ export default {
activeTimeType: [
{required: true, message: '活动时间不能为空', trigger: 'blur'},
],
noticeContent: [
{required: true, message: '通知内容不能为空', trigger: 'blur'},
frequencyLimit: [
{required: true, message: '获赠次数限制不能为空', trigger: 'blur'},
],
activityDetails: [
{required: true, message: '活动详情不能为空', trigger: 'blur'},
paymentType: [
{required: true, message: '可使用支付方式不能为空', trigger: 'blur'},
],
userGradeIds: [
{required: true, message: '适用会员等级不能为空', trigger: 'blur'},
],
courtesyReward: [
{required: true, message: '活动奖品不能为空', trigger: 'blur'},
@ -251,7 +252,7 @@ export default {
},
created() {
// this.getList()
// this.getInfo()
this.getInfo()
this.getCardCoupon()
this.listUserGrade()
},
@ -269,15 +270,17 @@ export default {
})
},
getInfo(){
getInfoActiveNewlyweds().then(res => {
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()
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<ActiveUserRechargeChild> selectByUserRechargeId(Integer activeUserRechargeId);
/**
* 根据推荐用户充值id删除子表信息
* @param activeUserRechargeId
* @return
*/
int deleteByUserRechargeId(Integer activeUserRechargeId);
}

View File

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

View File

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

View File

@ -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<ActiveUserRechargeMapper,ActiveUserRecharge> 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<ActiveUserRecharge> 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<ActiveUserRechargeChild> activeUserRechargeChildren = activeUserRechargeChildService.selectByUserRechargeId(activeUserRecharge.getId());
activeUserRecharge.setCouponList(activeUserRechargeChildren);
}
return activeUserRecharge;
}
}