This commit is contained in:
cun-nan 2024-09-03 16:32:30 +08:00
parent 8bd63ea9f3
commit d20bf1c47a
20 changed files with 768 additions and 61 deletions

View File

@ -0,0 +1,28 @@
import request from '@/utils/request'
export function getActivePopUp() {
return request({
url: 'activePopUp/getInfo',
method: 'get',
})
}
export function addActivePopUp(data) {
return request({
url: 'activePopUp',
method: 'post',
data:data
})
}
export function editActivePopUp(data) {
return request({
url: 'activePopUp',
method: 'put',
data:data
})
}
export function deleteActivePopUp(id) {
return request({
url: 'activePopUp/'+id,
method: 'delete',
})
}

View File

@ -1148,9 +1148,18 @@ export default {
this.weekDay = []
this.monthDay = []
}
if (res.data.pointList) this.pointList = res.data.pointList
if (res.data.growthValueList) this.growthValueList = res.data.growthValueList
if (res.data.couponList) this.couponList = res.data.couponList
if (res.data.pointList) {
this.pointList = res.data.pointList
this.pointOrderType = res.data.pointList[0].orderType
}
if (res.data.growthValueList) {
this.growthValueList = res.data.growthValueList
this.growthValueOrderType = res.data.growthValueList[0].orderType
}
if (res.data.couponList) {
this.couponList = res.data.couponList
this.couponOrderType = res.data.couponList[0].orderType
}
}else {
this.ruleForm = {
paymentType:[],
@ -1163,6 +1172,9 @@ export default {
this.pointList = []
this.growthValueList = []
this.couponList = []
this.pointOrderType = ''
this.growthValueOrderType = ''
this.couponOrderType = ''
}
console.log( '1147', this.ruleForm.activeGift)
})

View File

@ -140,11 +140,8 @@
{{ item }}
</div>
<el-select v-model="ruleForm.dieselUserLevel" multiple clearable placeholder="请选择油品油号(多选)">
<el-option
v-for="(item,index) in userGradeList"
:label="item.name"
:value="item.id.toString()"
:key="index"></el-option>
<el-option v-for="(item,index) in oilNumberList" :key="index"
:label="getOilNamess(oilNameList,item.oilName)" :value="item.oilName"></el-option>
</el-select>
</div>
</el-form-item>
@ -217,6 +214,7 @@
<script>
import {listUserLabel} from "@/api/staff/user/userlabel";
import {listUserGrade} from "@/api/staff/user/usergrade";
import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun";
export default {
name: "LiJianMarketing",
@ -231,6 +229,9 @@ export default {
},
userGradeList:[],
userLabelList:[],
oilNameList: [],
//
oilNumberList: [],
activityTimeTypeList: ["永久有效", "自定义"],
tindex1: 0,
@ -288,8 +289,28 @@ export default {
this.getInfo()
this.listUserGrade()
this.getUserLabelList()
this.getOilList()
},
methods:{
getOilList(){
getOilNameList().then(response => {
this.oilNameList = response.data;
})
oilNumberList().then(response => {
this.oilNumberList = response.data.records;
})
},
getOilNamess(list, id) {
let name = ""
if (list != null && list != "") {
list.forEach(item => {
if (item.id == id) {
name = item.oilName;
}
})
}
return name;
},
//
listUserGrade() {
listUserGrade({page:1,pageSize:1000}).then(res => {

View File

@ -2,7 +2,7 @@
<div class="app-container">
<div class="cot-box">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" style="width: 70%;margin: 0 auto">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="135px" style="width: 70%;margin: 0 auto">
<el-form-item label="活动名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
@ -50,7 +50,7 @@
v-for="item in 31"
:key="item.value"
:label="item+'日'"
:value="item">
:value="item.toString()">
</el-option>
</el-select>
</div>
@ -73,8 +73,8 @@
</el-form-item>
</div>
</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"
@ -115,7 +115,7 @@
</div>
</div>
</el-form-item>
<el-form-item label="适用模块" prop="everyDayCeiling">
<el-form-item label="适用模块" prop="suitModule">
<div class="d-s">
<div class="icon-type" v-for="(item,index) in suitModuleList" :key="index"
:class="{ 'acvtive' : index === tindex2 }" @click="Typeindex2(index)">
@ -125,13 +125,13 @@
</div>
</div>
</el-form-item>
<el-form-item label="每人每日参与上限" prop="everyDayCeiling">
<el-input v-model="ruleForm.everyDayCeiling"></el-input>
<span style="color: grey;font-size: 12px">每日可参与次数默认为1</span>
<el-form-item label="每人每日参与上限" prop="everyDayNum">
<el-input v-model="ruleForm.everyDayNum"></el-input>
<span style="color: grey;font-size: 12px">每日可参与次数默认为1</span>
</el-form-item>
<el-form-item label="总参与次数" prop="everyDayCeiling">
<el-input v-model="ruleForm.everyDayCeiling"></el-input>
<span style="color: grey;font-size: 12px">总参与次数默认为0不限制</span>
<el-form-item label="总参与次数" prop="assembleNum">
<el-input v-model="ruleForm.assembleNum"></el-input>
<span style="color: grey;font-size: 12px">总参与次数默认为0不限制</span>
</el-form-item>
<el-form-item style="text-align: center">
<el-button @click="resetForm('ruleForm')">取消</el-button>
@ -150,19 +150,13 @@ 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 {addActivePopUp, editActivePopUp, getActivePopUp} from "@/api/EventMarketing/activePopUp";
export default {
name: "ActiveNewlyweds",
@ -271,21 +265,30 @@ export default {
activeTimeType: [
{required: true, message: '活动时间不能为空', trigger: 'blur'},
],
noticeContent: [
{required: true, message: '通知内容不能为空', trigger: 'blur'},
suitTimeSlotFront: [
{required: true, message: '时间段不能为空', trigger: 'blur'},
],
activityDetails: [
{required: true, message: '活动详情不能为空', trigger: 'blur'},
userGradeIds: [
{required: true, message: '适用会员等级不能为空', trigger: 'blur'},
],
courtesyReward: [
{required: true, message: '活动奖品不能为空', trigger: 'blur'},
],
suitModule: [
{required: true, message: '适用模块不能为空', trigger: 'blur'},
],
everyDayNum: [
{required: true, message: '每人每日参与次数不能为空', trigger: 'blur'},
],
assembleNum: [
{required: true, message: '总参与次数不能为空', trigger: 'blur'},
],
}
};
},
created() {
// this.getList()
// this.getInfo()
this.getInfo()
this.getCardCoupon()
this.listUserGrade()
},
@ -293,12 +296,15 @@ export default {
Typeindex3(index) {
this.tindex3 = index
this.ruleForm.suitTimeSlotType = index
this.weekDay = []
this.monthDay = []
},
Typeindex4(index) {
this.tindex4 = index
},
Typeindex2(index) {
this.tindex2 = index
this.ruleForm.suitModule = index
},
listUserGrade() {
listUserGrade({page:1,pageSize:1000}).then(res => {
@ -313,18 +319,33 @@ export default {
})
},
getInfo(){
getInfoActiveNewlyweds().then(res => {
getActivePopUp().then(res => {
if (res.data) {
this.ruleForm = res.data
if (res.data.courtesyReward) this.ruleForm.courtesyReward = res.data.courtesyReward.split(",")
if (res.data.activeTimeType) this.tindex1 = res.data.activeTimeType
if (res.data.suitModule) this.tindex2 = res.data.suitModule
if (res.data.suitTimeSlotType) this.tindex3 = res.data.suitTimeSlotType
if (res.data.couponList) this.couponList = res.data.couponList
if (res.data.suitDate){
if (res.data.suitTimeSlotType == 0){
this.weekDay = res.data.suitDate.split(",")
}else {
this.monthDay = res.data.suitDate.split(",")
}
}
}else {
this.ruleForm = {
activeTimeType:0,
suitModule:0,
suitTimeSlotType:0,
courtesyReward:[]
}
this.tindex1 = 0
this.tindex2 = 0
this.tindex3 = 0
this.weekDay = []
this.monthDay = []
}
})
},
@ -352,15 +373,20 @@ export default {
}
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.ruleForm.suitTimeSlotType==0){
this.ruleForm.suitDate = this.weekDay.toString()
}else if (this.ruleForm.suitTimeSlotType==1){
this.ruleForm.suitDate = this.monthDay.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 => {
editActivePopUp(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.getInfo()
});
}else {
insertActiveNewlyweds(this.ruleForm).then(response => {
addActivePopUp(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.getInfo()
});

View File

@ -31,12 +31,12 @@
</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="activityTimeType">
<el-form-item label="适用油品油号" prop="suitOilType">
<div class="d-s">
<div class="icon-type" v-for="(item,index) in oilTypeList" :key="index"
:class="{ 'acvtive' : index === tindex4 }" @click="Typeindex4(index)">
@ -44,7 +44,7 @@
<img src="@/assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex4">
{{ item }}
</div>
<el-select v-model="ruleForm.dieselUserLevel" multiple clearable placeholder="请选择油品油号(多选)">
<el-select v-model="ruleForm.suitOilIds" multiple clearable placeholder="请选择油品油号(多选)">
<el-option v-for="(item,index) in oilNumberList" :key="index"
:label="getOilNamess(oilNameList,item.oilName)" :value="item.oilName"></el-option>
</el-select>
@ -60,8 +60,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"
@ -139,20 +139,18 @@ 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 {getOilNameList, oilNumberList} from "@/api/order/oilnumgun";
import {
addActiveUserConsume,
editActiveUserConsume,
getActiveUserConsume
} from "@/api/EventMarketing/activeUserConsume";
export default {
name: "ActiveNewlyweds",
@ -232,6 +230,7 @@ export default {
},
ruleForm: {
suitOilType:0,
paymentType:[],
courtesyReward:[]
},
@ -257,11 +256,17 @@ 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'},
suitOilType: [
{required: true, message: '适用油品油号不能为空', trigger: 'blur'},
],
paymentType: [
{required: true, message: '可使用支付方式不能为空', trigger: 'blur'},
],
userGradeIds: [
{required: true, message: '适用会员等级不能为空', trigger: 'blur'},
],
courtesyReward: [
{required: true, message: '活动奖品不能为空', trigger: 'blur'},
@ -298,6 +303,7 @@ export default {
},
Typeindex4(index) {
this.tindex4 = index
this.ruleForm.suitOilType = index
},
listUserGrade() {
listUserGrade({page:1,pageSize:1000}).then(res => {
@ -312,20 +318,24 @@ export default {
})
},
getInfo(){
getInfoActiveNewlyweds().then(res => {
getActiveUserConsume().then(res => {
if (res.data) {
this.ruleForm = res.data
if (res.data.paymentType) this.ruleForm.paymentType = res.data.paymentType.split(",")
if (res.data.suitOilIds) this.ruleForm.suitOilIds = res.data.suitOilIds.split(",")
if (res.data.courtesyReward) this.ruleForm.courtesyReward = res.data.courtesyReward.split(",")
if (res.data.activeTimeType) this.tindex1 = res.data.activeTimeType
if (res.data.suitOilType) this.tindex4 = res.data.suitOilType
if (res.data.couponList) this.couponList = res.data.couponList
}else {
this.ruleForm = {
activeTimeType:0,
suitOilType:0,
paymentType:[],
courtesyReward:[]
}
this.tindex1 = 0
this.tindex4 = 0
}
})
},
@ -353,15 +363,17 @@ export default {
}
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.ruleForm.paymentType) this.ruleForm.paymentType = this.ruleForm.paymentType.toString()
if (this.ruleForm.suitOilIds) this.ruleForm.suitOilIds = this.ruleForm.suitOilIds.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 => {
editActiveUserConsume(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.getInfo()
});
}else {
insertActiveNewlyweds(this.ruleForm).then(response => {
addActiveUserConsume(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.getInfo()
});

View File

@ -0,0 +1,81 @@
package com.fuint.business.marketingActivity.activePopUp.controller;
import com.fuint.business.marketingActivity.activePopUp.entity.ActivePopUp;
import com.fuint.business.marketingActivity.activePopUp.service.ActivePopUpService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 弹窗营销信息(ActivePopUp)表控制层
*
* @author makejava
* @since 2024-07-31 14:59:04
*/
@RestController
@RequestMapping("activePopUp")
public class ActivePopUpController extends BaseController {
/**
* 服务对象
*/
@Resource
private ActivePopUpService activePopUpService;
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(activePopUpService.queryById(id));
}
/**
* 通过主键查询单条数据
*
* @return 单条数据
*/
@GetMapping("getInfo")
public ResponseObject queryByStoreId() {
return getSuccessResult(activePopUpService.selectByStoreId());
}
/**
* 新增数据
*
* @param activePopUp 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(@RequestBody ActivePopUp activePopUp) {
return getSuccessResult(activePopUpService.insert(activePopUp));
}
/**
* 编辑数据
*
* @param activePopUp 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(@RequestBody ActivePopUp activePopUp) {
return getSuccessResult(activePopUpService.update(activePopUp));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping("{id}")
public ResponseObject deleteById(@PathVariable Integer id) {
return getSuccessResult(activePopUpService.deleteById(id));
}
}

View File

@ -0,0 +1,119 @@
package com.fuint.business.marketingActivity.activePopUp.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.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 弹窗营销信息(ActivePopUp)实体类
*
* @author makejava
* @since 2024-09-03 11:35:50
*/
@Data
@TableName("active_pop_up")
@ApiModel(value = "ActivePopUp", description = "弹窗营销信息")
public class ActivePopUp 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;
/**
* 适用时间段类型0每周1每月
*/
private String suitTimeSlotType;
/**
* 适用时间段/
*/
private String suitDate;
/**
* 适用时间段前
*/
@JsonFormat(pattern = "HH:mm" , timezone = "GMT+8")
private Date suitTimeSlotFront;
/**
* 适用时间段后
*/
@JsonFormat(pattern = "HH:mm" , timezone = "GMT+8")
private Date suitTimeSlotAfter;
/**
* 适用会员等级
*/
private String userGradeIds;
/**
* 活动奖品 0优惠券 2成长值 3积分
*/
private String courtesyReward;
/**
* 适用模块0一键加油1扫码买单
*/
private String suitModule;
/**
* 每人每日参与次数
*/
private Integer everyDayNum;
/**
* 总参与次数
*/
private Integer assembleNum;
/**
* 创建者
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新者
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 优惠券子表信息
*/
@TableField(exist = false)
private List<ActivePopUpChild> couponList;
}

View File

@ -0,0 +1,61 @@
package com.fuint.business.marketingActivity.activePopUp.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;
/**
* 弹窗营销子表(ActivePopUpChild)实体类
*
* @author makejava
* @since 2024-09-03 11:36:09
*/
@Data
@TableName("active_pop_up_child")
@ApiModel(value = "ActivePopUpChild", description = "弹窗营销子表")
public class ActivePopUpChild extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 弹窗营销id
*/
private Integer activePopUpId;
/**
* 券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.activePopUp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.activePopUp.entity.ActivePopUpChild;
public interface ActivePopUpChildMapper extends BaseMapper<ActivePopUpChild> {
}

View File

@ -0,0 +1,7 @@
package com.fuint.business.marketingActivity.activePopUp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.activePopUp.entity.ActivePopUp;
public interface ActivePopUpMapper extends BaseMapper<ActivePopUp> {
}

View File

@ -0,0 +1,63 @@
package com.fuint.business.marketingActivity.activePopUp.service;
import com.fuint.business.marketingActivity.activePopUp.entity.ActivePopUpChild;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
/**
* 弹窗营销子表(ActivePopUpChild)表服务接口
*
* @author makejava
* @since 2024-09-03 11:36:09
*/
public interface ActivePopUpChildService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
ActivePopUpChild queryById(Integer id);
/**
* 新增数据
*
* @param activePopUpChild 实例对象
* @return 实例对象
*/
int insert(ActivePopUpChild activePopUpChild);
/**
* 修改数据
*
* @param activePopUpChild 实例对象
* @return 实例对象
*/
int update(ActivePopUpChild activePopUpChild);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
int deleteById(Integer id);
/**
* 根据弹窗营销id查询子表信息
* @param activePopUpId
* @return
*/
List<ActivePopUpChild> selectByActivePopUpId(Integer activePopUpId);
/**
* 根据弹窗营销id删除子表信息
* @param activePopUpId
* @return
*/
int deleteByActivePopUpId(Integer activePopUpId);
}

View File

@ -0,0 +1,49 @@
package com.fuint.business.marketingActivity.activePopUp.service;
import com.fuint.business.marketingActivity.activePopUp.entity.ActivePopUp;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
/**
* 弹窗营销信息(ActivePopUp)表服务接口
*
* @author makejava
* @since 2024-09-03 11:35:51
*/
public interface ActivePopUpService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
ActivePopUp queryById(Integer id);
/**
* 新增数据
*
* @param activePopUp 实例对象
* @return 实例对象
*/
int insert(ActivePopUp activePopUp);
/**
* 修改数据
*
* @param activePopUp 实例对象
* @return 实例对象
*/
int update(ActivePopUp activePopUp);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
int deleteById(Integer id);
ActivePopUp selectByStoreId();
}

View File

@ -0,0 +1,79 @@
package com.fuint.business.marketingActivity.activePopUp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activePopUp.entity.ActivePopUpChild;
import com.fuint.business.marketingActivity.activePopUp.mapper.ActivePopUpChildMapper;
import com.fuint.business.marketingActivity.activePopUp.service.ActivePopUpChildService;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* 弹窗营销子表(ActivePopUpChild)表服务实现类
*
* @author makejava
* @since 2024-09-03 11:36:09
*/
@Service("activePopUpChildService")
public class ActivePopUpChildServiceImpl extends ServiceImpl<ActivePopUpChildMapper,ActivePopUpChild> implements ActivePopUpChildService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public ActivePopUpChild queryById(Integer id) {
return baseMapper.selectById(id);
}
/**
* 新增数据
*
* @param activePopUpChild 实例对象
* @return 实例对象
*/
@Override
public int insert(ActivePopUpChild activePopUpChild) {
return baseMapper.insert(activePopUpChild);
}
/**
* 修改数据
*
* @param activePopUpChild 实例对象
* @return 实例对象
*/
@Override
public int update(ActivePopUpChild activePopUpChild) {
return baseMapper.updateById(activePopUpChild);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public int deleteById(Integer id) {
return baseMapper.deleteById(id);
}
@Override
public List<ActivePopUpChild> selectByActivePopUpId(Integer activePopUpId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("active_pop_up_id", activePopUpId);
return baseMapper.selectList(queryWrapper);
}
@Override
public int deleteByActivePopUpId(Integer activePopUpId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("active_pop_up_id", activePopUpId);
return baseMapper.delete(queryWrapper);
}
}

View File

@ -0,0 +1,120 @@
package com.fuint.business.marketingActivity.activePopUp.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.activePopUp.entity.ActivePopUp;
import com.fuint.business.marketingActivity.activePopUp.entity.ActivePopUpChild;
import com.fuint.business.marketingActivity.activePopUp.mapper.ActivePopUpMapper;
import com.fuint.business.marketingActivity.activePopUp.service.ActivePopUpChildService;
import com.fuint.business.marketingActivity.activePopUp.service.ActivePopUpService;
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;
/**
* 弹窗营销信息(ActivePopUp)表服务实现类
*
* @author makejava
* @since 2024-09-03 11:35:52
*/
@Service("activePopUpService")
public class ActivePopUpServiceImpl extends ServiceImpl<ActivePopUpMapper,ActivePopUp> implements ActivePopUpService {
@Autowired
private ActivePopUpChildService activePopUpChildService;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public ActivePopUp queryById(Integer id) {
return baseMapper.selectById(id);
}
/**
* 新增数据
*
* @param activePopUp 实例对象
* @return 实例对象
*/
@Override
public int insert(ActivePopUp activePopUp) {
ActivePopUp activePopUp1 = this.selectByStoreId();
if (ObjectUtil.isNotEmpty(activePopUp1)) return 0;
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
activePopUp.setChainStoreId(nowAccountInfo.getChainStoreId());
activePopUp.setStoreId(nowAccountInfo.getStoreId());
int row = baseMapper.insert(activePopUp);
activePopUp1 = this.selectByStoreId();
if (ObjectUtil.isNotEmpty(activePopUp1) && ObjectUtil.isNotEmpty(activePopUp.getCouponList())){
for (ActivePopUpChild activePopUpChild : activePopUp.getCouponList()) {
activePopUpChild.setActivePopUpId(activePopUp1.getId());
activePopUpChildService.insert(activePopUpChild);
}
}
return row;
}
/**
* 修改数据
*
* @param activePopUp 实例对象
* @return 实例对象
*/
@Override
public int update(ActivePopUp activePopUp) {
int row = baseMapper.updateById(activePopUp);
activePopUpChildService.deleteByActivePopUpId(activePopUp.getId());
if (ObjectUtil.isNotEmpty(activePopUp.getCouponList())){
for (ActivePopUpChild activePopUpChild : activePopUp.getCouponList()) {
activePopUpChild.setActivePopUpId(activePopUp.getId());
activePopUpChildService.insert(activePopUpChild);
}
}
return row;
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public int deleteById(Integer id) {
return baseMapper.deleteById(id);
}
@Override
public ActivePopUp selectByStoreId() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("store_id", nowAccountInfo.getStoreId());
ActivePopUp activePopUp = null;
List<ActivePopUp> list = baseMapper.selectList(queryWrapper);
for (ActivePopUp popUp : list) {
if (popUp.getActiveTimeType().equals("0")){
activePopUp = popUp;
}else {
Date date = new Date();
if (popUp.getActiveStartTime().before(date) && popUp.getActiveEndTime().after(date)){
activePopUp = popUp;
}
}
}
if (ObjectUtil.isNotEmpty(activePopUp)){
List<ActivePopUpChild> activePopUpChildren = activePopUpChildService.selectByActivePopUpId(activePopUp.getId());
activePopUp.setCouponList(activePopUpChildren);
}
return activePopUp;
}
}

View File

@ -23,14 +23,18 @@ public class ActivePriceOil extends Model<ActivePriceOil> {
@TableId(type = IdType.AUTO)
private Integer id ;
/** 所属连锁店id */
private Integer chainStorId ;
private Integer chainStoreId ;
/** 所属店铺id */
private Integer storeId ;
/** 价格营销活动主表id */
private Integer activeId ;
/** 油品油号id */
private Integer oilId ;
/** 固定价格 */
/** 是否删除0未1删 */
private String type ;
/** 挂牌价 */
private Double oilPrice ;
/** 优惠价 */
private Double price ;
/** 创建人 */
private String createBy ;

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceOil;
import com.fuint.business.marketingActivity.activePrice.mapper.ActivePriceOilMapper;
import com.fuint.business.marketingActivity.activePrice.service.ActivePriceOilService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import java.util.List;
@ -52,6 +54,10 @@ public class ActivePriceOilServiceImpl extends ServiceImpl<ActivePriceOilMapper,
oilList.forEach(item -> {
//为每一条油品数据绑定营销活动id
item.setActiveId(actId);
// 插入店铺信息id
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
item.setChainStoreId(nowAccountInfo.getChainStoreId());
item.setStoreId(nowAccountInfo.getStoreId());
});
saveBatch(oilList);
}

View File

@ -13,7 +13,9 @@ import com.fuint.business.marketingActivity.activePrice.util.ActPriceUtil;
import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceReqVO;
import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRespVO;
import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceSaveVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.quartz.util.BeanUtils;
import org.springframework.stereotype.Service;
@ -77,6 +79,10 @@ public class ActivePriceServiceImpl extends ServiceImpl<ActivePriceMapper, Activ
//实体类转换
ActivePrice activePrice = new ActivePrice();
BeanUtils.copyProperties(saveVO, activePrice);
// 插入店铺信息id
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
activePrice.setChainStorId(nowAccountInfo.getChainStoreId());
activePrice.setStoreId(nowAccountInfo.getStoreId());
/*3、数据保存*/
//保存营销活动
saveOrUpdate(activePrice);

View File

@ -8,6 +8,8 @@ import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceSe
import com.fuint.business.marketingActivity.activePrice.util.ActPriceUtil;
import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceRespVO;
import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceSaveVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.quartz.util.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -56,6 +58,10 @@ public class ActiveSubPriceServiceImpl extends ServiceImpl<ActiveSubPriceMapper,
public void saveActiveSubPrice(boolean isAdd, ActiveSubPriceSaveVO saveVO) {
ActiveSubPrice activeSubPrice = new ActiveSubPrice();
BeanUtils.copyProperties(saveVO, activeSubPrice);
// 插入店铺id信息
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
activeSubPrice.setChainStorId(nowAccountInfo.getChainStoreId());
activeSubPrice.setStoreId(nowAccountInfo.getStoreId());
//保存主表信息
saveOrUpdate(activeSubPrice);
//保存子表信息

View File

@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 油机汽机配置(ActiveUserConsume)表控制层
* 推荐会员消费有礼(ActiveUserConsume)表控制层
*
* @author makejava
* @since 2024-07-31 14:59:04

View File

@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 油机汽机配置(ActiveUserRecharge)表控制层
* 推荐会员充值有礼(ActiveUserRecharge)表控制层
*
* @author makejava
* @since 2024-07-31 14:59:04