This commit is contained in:
cun-nan 2024-09-04 17:32:58 +08:00
parent b4e9ad4c37
commit d6dbf9aec7
7 changed files with 197 additions and 86 deletions

View File

@ -64,7 +64,7 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="适用会员等级" prop="levelId"> <el-form-item label="适用会员等级" prop="levelId">
<el-select v-model="ruleForm.levelId" multiple clearable placeholder="请选择会员等级(多选)"> <el-select v-model="ruleForm.levelId" clearable placeholder="请选择会员等级">
<el-option <el-option
v-for="(item,index) in userGradeList" v-for="(item,index) in userGradeList"
:label="item.name" :label="item.name"
@ -73,7 +73,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="会员标签" prop="babelIds"> <el-form-item label="会员标签" prop="babelIds">
<el-select v-model="ruleForm.babelIds" multiple clearable placeholder="请选择会员标签(多选)"> <el-select v-model="ruleForm.babelIds" clearable placeholder="请选择会员标签">
<el-option <el-option
v-for="item in userLabelList" v-for="item in userLabelList"
:key="item.id+''" :key="item.id+''"
@ -167,17 +167,17 @@
<el-checkbox label="0" name="type">按订单金额</el-checkbox> <el-checkbox label="0" name="type">按订单金额</el-checkbox>
<img src="@/assets/images/tjb.png" <img src="@/assets/images/tjb.png"
style="width: 20px;height: 20px;cursor: pointer;margin-top: 7px;margin-left: 10px" style="width: 20px;height: 20px;cursor: pointer;margin-top: 7px;margin-left: 10px"
@click="addPoints()"> @click="addPoints(0)">
</div> </div>
<div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 0"> <div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 0">
<div v-for="(item,index) in pointList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in orderList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>订单金额满</span> <span>订单金额满</span>
<el-input placeholder="请输入" style="width: 30%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 30%;margin: 0 10px" v-model="item.full">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>固定优惠</span> <span>固定优惠</span>
<el-input placeholder="请输入" style="width: 30%;margin: 0 10px" v-model="item.givePoints"> <el-input placeholder="请输入" style="width: 30%;margin: 0 10px" v-model="item.sub">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -185,17 +185,17 @@
</div> </div>
</div> </div>
<div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 1"> <div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 1">
<div v-for="(item,index) in pointList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in orderList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>订单金额满</span> <span>订单金额满</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.full">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>随机优惠</span> <span>随机优惠</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.givePoints"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.randomFront">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span></span> <span></span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.givePoints"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.randomAfter">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -203,17 +203,17 @@
</div> </div>
</div> </div>
<div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 2"> <div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 2">
<div v-for="(item,index) in pointList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in orderList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>订单金额每满</span> <span>订单金额每满</span>
<el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.full">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>固定优惠</span> <span>固定优惠</span>
<el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.givePoints"> <el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.sub">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>最大优惠</span> <span>最大优惠</span>
<el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.givePoints"> <el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.maxPreferential">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -221,17 +221,17 @@
</div> </div>
</div> </div>
<div v-if="ruleForm.offerType == 1 && ruleForm.activeType == 0"> <div v-if="ruleForm.offerType == 1 && ruleForm.activeType == 0">
<div v-for="(item,index) in pointList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in orderList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>订单金额满</span> <span>订单金额满</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.full">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>享受折扣</span> <span>享受折扣</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.givePoints"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.enjoyDiscount">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>最大优惠</span> <span>最大优惠</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.givePoints"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.maxPreferential">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -243,18 +243,18 @@
<el-checkbox label="1" name="type">按加油升数</el-checkbox> <el-checkbox label="1" name="type">按加油升数</el-checkbox>
<img src="@/assets/images/tjb.png" <img src="@/assets/images/tjb.png"
style="width: 20px;height: 20px;cursor: pointer;margin-top: 7px;margin-left: 10px" style="width: 20px;height: 20px;cursor: pointer;margin-top: 7px;margin-left: 10px"
@click="addGrowthValues()"> @click="addGrowthValues(1)">
</div> </div>
<div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 0"> <div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 0">
<div v-for="(item,index) in growthValueList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in refuelList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>加油升数满</span> <span>加油升数满</span>
<el-input placeholder="请输入" style="width: 30%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 30%;margin: 0 10px" v-model="item.full">
<template slot="append">L</template> <template slot="append">L</template>
</el-input> </el-input>
<span>固定优惠</span> <span>固定优惠</span>
<el-input placeholder="请输入" style="width: 30%;margin: 0 10px" <el-input placeholder="请输入" style="width: 30%;margin: 0 10px"
v-model="item.giveGrowthValue"> v-model="item.sub">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -262,19 +262,19 @@
</div> </div>
</div> </div>
<div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 1"> <div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 1">
<div v-for="(item,index) in growthValueList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in refuelList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>加油升数满</span> <span>加油升数满</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.full">
<template slot="append">L</template> <template slot="append">L</template>
</el-input> </el-input>
<span>随机优惠</span> <span>随机优惠</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" <el-input placeholder="请输入" style="width: 20%;margin: 0 10px"
v-model="item.giveGrowthValue"> v-model="item.randomFront">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span></span> <span></span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" <el-input placeholder="请输入" style="width: 20%;margin: 0 10px"
v-model="item.giveGrowthValue"> v-model="item.randomAfter">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -282,19 +282,19 @@
</div> </div>
</div> </div>
<div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 2"> <div v-if="ruleForm.offerType == 0 && ruleForm.activeType == 2">
<div v-for="(item,index) in growthValueList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in refuelList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>加油升数每满</span> <span>加油升数每满</span>
<el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 19%;margin: 0 10px" v-model="item.full">
<template slot="append">L</template> <template slot="append">L</template>
</el-input> </el-input>
<span>固定优惠</span> <span>固定优惠</span>
<el-input placeholder="请输入" style="width: 19%;margin: 0 10px" <el-input placeholder="请输入" style="width: 19%;margin: 0 10px"
v-model="item.giveGrowthValue"> v-model="item.sub">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>最大优惠</span> <span>最大优惠</span>
<el-input placeholder="请输入" style="width: 19%;margin: 0 10px" <el-input placeholder="请输入" style="width: 19%;margin: 0 10px"
v-model="item.giveGrowthValue"> v-model="item.maxPreferential">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -302,19 +302,19 @@
</div> </div>
</div> </div>
<div v-if="ruleForm.offerType == 1 && ruleForm.activeType == 0"> <div v-if="ruleForm.offerType == 1 && ruleForm.activeType == 0">
<div v-for="(item,index) in growthValueList" :key="index" style="font-size: 14px;margin: 15px 0"> <div v-for="(item,index) in refuelList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>加油升数满</span> <span>加油升数满</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.consumeAmount"> <el-input placeholder="请输入" style="width: 20%;margin: 0 10px" v-model="item.full">
<template slot="append">L</template> <template slot="append">L</template>
</el-input> </el-input>
<span>享受折扣</span> <span>享受折扣</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" <el-input placeholder="请输入" style="width: 20%;margin: 0 10px"
v-model="item.giveGrowthValue"> v-model="item.enjoyDiscount">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<span>最大优惠</span> <span>最大优惠</span>
<el-input placeholder="请输入" style="width: 20%;margin: 0 10px" <el-input placeholder="请输入" style="width: 20%;margin: 0 10px"
v-model="item.giveGrowthValue"> v-model="item.maxPreferential">
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;" <img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;"
@ -338,6 +338,7 @@
import {listUserLabel} from "@/api/staff/user/userlabel"; import {listUserLabel} from "@/api/staff/user/userlabel";
import {listUserGrade} from "@/api/staff/user/usergrade"; import {listUserGrade} from "@/api/staff/user/usergrade";
import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun"; import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun";
import {addActiveSubPrice, editActiveSubPrice, getActiveSubPrice} from "@/api/EventMarketing/activeSubPrice";
export default { export default {
name: "LiJianMarketing", name: "LiJianMarketing",
@ -345,10 +346,13 @@ export default {
data() { data() {
return { return {
ruleForm: { ruleForm: {
activeTimeType: 0,
paymentType: [], paymentType: [],
activeManner: [], activeManner: [],
offerType:0, offerType: 0,
activeType:0, activeType: 0,
timeType: 0,
applyOilType: 0,
}, },
userGradeList: [], userGradeList: [],
userLabelList: [], userLabelList: [],
@ -370,39 +374,39 @@ export default {
weekList: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"], weekList: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
weekDay: [], weekDay: [],
monthDay: [], monthDay: [],
pointList: [], orderList: [],
growthValueList: [], refuelList: [],
// //
rules: { rules: {
name: [ activeName: [
{required: true, message: '活动名称不能为空', trigger: 'blur'}, {required: true, message: '活动名称不能为空', trigger: 'blur'},
], ],
activityTimeType: [ activeTimeType: [
{required: true, message: '活动时间不能为空', trigger: 'blur'}, {required: true, message: '活动时间不能为空', trigger: 'blur'},
], ],
suitTimeSlotFront: [ offerType: [
{required: true, message: '时间段不能为空', trigger: 'blur'}, {required: true, message: '优惠类型不能为空', trigger: 'blur'},
], ],
dieselUserLevel: [ levelId: [
{required: true, message: '适用会员等级不能为空', trigger: 'blur'}, {required: true, message: '适用会员等级不能为空', trigger: 'blur'},
], ],
dayLimitNum: [
{required: true, message: '每人每天参与上限不能为空', trigger: 'blur'},
],
monthLimitNum: [
{required: true, message: '每人每月参与上限不能为空', trigger: 'blur'},
],
limitNum: [
{required: true, message: '每人累计参与上限不能为空', trigger: 'blur'},
],
applyOilType: [
{required: true, message: '适用油品油号不能为空', trigger: 'blur'},
],
paymentType: [ paymentType: [
{required: true, message: '可使用支付方式不能为空', trigger: 'blur'}, {required: true, message: '可使用支付方式不能为空', trigger: 'blur'},
], ],
everyDayCeiling: [ activeManner: [
{required: true, message: '每人每天参与上限不能为空', trigger: 'blur'}, {required: true, message: '活动方式不能为空', trigger: 'blur'},
],
monthlyCeiling: [
{required: true, message: '每人每月参与上限不能为空', trigger: 'blur'},
],
accumulateCeiling: [
{required: true, message: '每人累计参与上限不能为空', trigger: 'blur'},
],
noticeContent: [
{required: true, message: '通知内容不能为空', trigger: 'blur'},
],
activityDetails: [
{required: true, message: '活动详情不能为空', trigger: 'blur'},
], ],
} }
} }
@ -449,27 +453,68 @@ export default {
}) })
}, },
getInfo() { getInfo() {
getActiveSubPrice().then(res => {
if (res.data) {
this.ruleForm = res.data
if (res.data.timeSlots) {
if (res.data.timeType == 0) {
this.weekDay = this.ruleForm.timeSlots.split(",")
} else if (res.data.timeType == 1) {
this.monthDay = this.ruleForm.timeSlots.split(",")
}
}
if (res.data.applyOil) this.ruleForm.applyOil = res.data.applyOil.split(",")
if (res.data.paymentType) this.ruleForm.paymentType = res.data.paymentType.split(",")
if (res.data.activeManner) this.ruleForm.activeManner = res.data.activeManner.split(",")
if (res.data.orderList) this.orderList = this.ruleForm.orderList
if (res.data.refuelList) this.refuelList = this.ruleForm.refuelList
} else {
this.ruleForm = {
activeTimeType: 0,
paymentType: [],
activeManner: [],
offerType: 0,
activeType: 0,
timeType: 0,
applyOilType: 0,
}
this.tindex1 = 0
this.tindex2 = 0
this.tindex3 = 0
this.tindex4 = 0
this.tindex5 = 0
}
})
}, },
addPoints() { addPoints(activeManner) {
let data = { let data = {
consumeAmount: "", activeManner: activeManner,
givePoints: "", full: "",
sub: "",
randomFront: "",
randomAfter: "",
maxPreferential: "",
enjoyDiscount: "",
} }
this.pointList.push(data) this.orderList.push(data)
}, },
deletePoints(index) { deletePoints(index) {
this.pointList.splice(index, 1); this.orderList.splice(index, 1);
}, },
addGrowthValues() { addGrowthValues(activeManner) {
let data = { let data = {
consumeAmount: "", activeManner: activeManner,
giveGrowthValue: "", full: "",
sub: "",
randomFront: "",
randomAfter: "",
maxPreferential: "",
enjoyDiscount: "",
} }
this.growthValueList.push(data) this.refuelList.push(data)
}, },
deleteGrowthValues(index) { deleteGrowthValues(index) {
this.growthValueList.splice(index, 1); this.refuelList.splice(index, 1);
}, },
Typeindex1(index) { Typeindex1(index) {
this.tindex1 = index this.tindex1 = index
@ -484,8 +529,8 @@ export default {
this.activityTypeList = ['固定满减'] this.activityTypeList = ['固定满减']
} }
this.tindex5 = 0 this.tindex5 = 0
this.pointList = [] this.orderList = []
this.growthValueList = [] this.refuelList = []
}, },
Typeindex3(index) { Typeindex3(index) {
this.tindex3 = index this.tindex3 = index
@ -508,11 +553,33 @@ export default {
} }
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if (this.ruleForm.timeType == 0) {
this.ruleForm.timeSlots = this.weekDay.toString()
} else if (this.ruleForm.timeType == 1) {
this.ruleForm.timeSlots = this.monthDay.toString()
}
if (this.ruleForm.applyOil) this.ruleForm.applyOil = this.ruleForm.applyOil.toString()
if (this.ruleForm.paymentType) this.ruleForm.paymentType = this.ruleForm.paymentType.toString()
if (this.ruleForm.activeManner) this.ruleForm.activeManner = this.ruleForm.activeManner.toString()
if (this.orderList) this.ruleForm.orderList = this.orderList
if (this.refuelList) this.ruleForm.refuelList = this.refuelList
if (this.ruleForm.id) { if (this.ruleForm.id) {
// //
editActiveSubPrice(this.ruleForm).then(res => {
this.$message.success("修改成功")
this.getInfo()
})
} else { } else {
// //
addActiveSubPrice(this.ruleForm).then(res => {
if (res.data) {
this.$message.success("添加成功")
this.getInfo()
} else {
this.$message.error("添加失败")
}
})
} }
} }
}); });

View File

@ -41,12 +41,13 @@ public class ActiveSubPriceController extends BaseController {
**/ **/
@PostMapping("/add") @PostMapping("/add")
public ResponseObject add(@RequestBody ActiveSubPriceSaveVO saveVO) { public ResponseObject add(@RequestBody ActiveSubPriceSaveVO saveVO) {
boolean row = false;
try { try {
activeSubPriceService.saveActiveSubPrice(true, saveVO); row = activeSubPriceService.saveActiveSubPrice(true, saveVO);
} catch (BusinessCheckException businessCheckException) { } catch (BusinessCheckException businessCheckException) {
return getFailureResult(businessCheckException.getMessage()); return getFailureResult(businessCheckException.getMessage());
} }
return getSuccessResult("保存成功", null); return getSuccessResult("保存成功", row);
} }
/** /**
@ -56,14 +57,15 @@ public class ActiveSubPriceController extends BaseController {
* @param saveVO ActiveSubPriceSaveVO实体 * @param saveVO ActiveSubPriceSaveVO实体
* @return com.fuint.framework.web.ResponseObject * @return com.fuint.framework.web.ResponseObject
**/ **/
@PostMapping("/update") @PutMapping("/update")
public ResponseObject update(@RequestBody ActiveSubPriceSaveVO saveVO) { public ResponseObject update(@RequestBody ActiveSubPriceSaveVO saveVO) {
boolean row = false;
try { try {
activeSubPriceService.saveActiveSubPrice(true, saveVO); row = activeSubPriceService.saveActiveSubPrice(false, saveVO);
} catch (BusinessCheckException businessCheckException) { } catch (BusinessCheckException businessCheckException) {
return getFailureResult(businessCheckException.getMessage()); return getFailureResult(businessCheckException.getMessage());
} }
return getSuccessResult("保存成功", null); return getSuccessResult("保存成功", row);
} }

View File

@ -1,13 +1,16 @@
package com.fuint.business.marketingActivity.activePrice.entity; package com.fuint.business.marketingActivity.activePrice.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 立减营销活动规则; * 立减营销活动规则;
@ -32,8 +35,10 @@ public class ActiveSubPrice extends Model<ActiveSubPrice> {
/** 适用时间段(1、2、3、4..31代表周一、周二、周三或者1号、2号、3号)数字之间英文逗号隔开 */ /** 适用时间段(1、2、3、4..31代表周一、周二、周三或者1号、2号、3号)数字之间英文逗号隔开 */
private String timeSlots ; private String timeSlots ;
/** 适用开始时间 */ /** 适用开始时间 */
@JsonFormat(pattern = "HH:mm" , timezone = "GMT+8")
private Date timeApplyStart ; private Date timeApplyStart ;
/** 适用结束时间 */ /** 适用结束时间 */
@JsonFormat(pattern = "HH:mm" , timezone = "GMT+8")
private Date timeApplyEnd ; private Date timeApplyEnd ;
/** 可使用支付方式 0微信支付 1支付宝 2云闪付 3会员卡 4现金 5POS刷卡 以数据字典为准 */ /** 可使用支付方式 0微信支付 1支付宝 2云闪付 3会员卡 4现金 5POS刷卡 以数据字典为准 */
private String paymentType ; private String paymentType ;
@ -71,4 +76,11 @@ public class ActiveSubPrice extends Model<ActiveSubPrice> {
private String updateBy ; private String updateBy ;
/** 更新时间 */ /** 更新时间 */
private Date updateTime ; private Date updateTime ;
/**订单金额列表*/
@TableField(exist = false)
private List<ActiveSubPriceRule> orderList;
/**加油升数列表*/
@TableField(exist = false)
private List<ActiveSubPriceRule> refuelList;
} }

View File

@ -37,5 +37,13 @@ public interface ActiveSubPriceRuleService extends IService<ActiveSubPriceRule>
* @return java.util.List<com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule> * @return java.util.List<com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule>
**/ **/
List<ActiveSubPriceRule> listByActId(Integer actId); List<ActiveSubPriceRule> listByActId(Integer actId);
/**
* 根据活动id和查询活动规则
* @param actId
* @param activeManner
* @return
*/
List<ActiveSubPriceRule> listByActSubId(Integer actId,String activeManner);
} }

View File

@ -31,13 +31,13 @@ public interface ActiveSubPriceService extends IService<ActiveSubPrice> {
* @author PQZ * @author PQZ
* @date 17:16 2024/9/2 * @date 17:16 2024/9/2
**/ **/
void saveActiveSubPrice(boolean isAdd, ActiveSubPriceSaveVO saveVO) throws BusinessCheckException; boolean saveActiveSubPrice(boolean isAdd, ActiveSubPriceSaveVO saveVO) throws BusinessCheckException;
/** /**
* 根据店铺id查询立减营销信息 * 根据店铺id查询立减营销信息
* @return * @return
*/ */
ActiveSubPriceRespVO selectByStoreId(); ActiveSubPrice selectByStoreId();
} }

View File

@ -1,12 +1,14 @@
package com.fuint.business.marketingActivity.activePrice.service.impl; package com.fuint.business.marketingActivity.activePrice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule; import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule;
import com.fuint.business.marketingActivity.activePrice.mapper.ActiveSubPriceRuleMapper; import com.fuint.business.marketingActivity.activePrice.mapper.ActiveSubPriceRuleMapper;
import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceRuleService; import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceRuleService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -44,6 +46,9 @@ public class ActiveSubPriceRuleServiceImpl extends ServiceImpl<ActiveSubPriceRul
@Override @Override
public void saveActiveSubPriceRule(Integer actId,List<ActiveSubPriceRule> list) { public void saveActiveSubPriceRule(Integer actId,List<ActiveSubPriceRule> list) {
removeByActId(actId); removeByActId(actId);
for (ActiveSubPriceRule activeSubPriceRule : list) {
activeSubPriceRule.setActiveId(actId);
}
saveBatch(list); saveBatch(list);
} }
@ -61,5 +66,13 @@ public class ActiveSubPriceRuleServiceImpl extends ServiceImpl<ActiveSubPriceRul
lambdaQueryWrapper.eq(ActiveSubPriceRule::getActiveId,actId); lambdaQueryWrapper.eq(ActiveSubPriceRule::getActiveId,actId);
return list(lambdaQueryWrapper); return list(lambdaQueryWrapper);
} }
@Override
public List<ActiveSubPriceRule> listByActSubId(Integer actId, String activeManner) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("active_id" ,actId);
queryWrapper.eq("active_manner" ,activeManner);
return baseMapper.selectList(queryWrapper);
}
} }

View File

@ -61,7 +61,13 @@ public class ActiveSubPriceServiceImpl extends ServiceImpl<ActiveSubPriceMapper,
* @date 17:16 2024/9/2 * @date 17:16 2024/9/2
**/ **/
@Override @Override
public void saveActiveSubPrice(boolean isAdd, ActiveSubPriceSaveVO saveVO) { public boolean saveActiveSubPrice(boolean isAdd, ActiveSubPriceSaveVO saveVO) {
if (isAdd){
ActiveSubPrice activeSubPrice = this.selectByStoreId();
if (ObjectUtil.isNotEmpty(activeSubPrice)){
return false;
}
}
ActiveSubPrice activeSubPrice = new ActiveSubPrice(); ActiveSubPrice activeSubPrice = new ActiveSubPrice();
BeanUtils.copyProperties(saveVO, activeSubPrice); BeanUtils.copyProperties(saveVO, activeSubPrice);
// 插入店铺id信息 // 插入店铺id信息
@ -69,18 +75,21 @@ public class ActiveSubPriceServiceImpl extends ServiceImpl<ActiveSubPriceMapper,
activeSubPrice.setChainStorId(nowAccountInfo.getChainStoreId()); activeSubPrice.setChainStorId(nowAccountInfo.getChainStoreId());
activeSubPrice.setStoreId(nowAccountInfo.getStoreId()); activeSubPrice.setStoreId(nowAccountInfo.getStoreId());
//保存主表信息 //保存主表信息
saveOrUpdate(activeSubPrice); boolean row = saveOrUpdate(activeSubPrice);
activeSubPrice = this.selectByStoreId();
//保存子表信息 //保存子表信息
activeSubPriceRuleService.saveActiveSubPriceRule(activeSubPrice.getId(),saveVO.getRuleList()); activeSubPriceRuleService.saveActiveSubPriceRule(activeSubPrice.getId(),saveVO.getOrderList());
activeSubPriceRuleService.saveActiveSubPriceRule(activeSubPrice.getId(),saveVO.getRefuelList());
//转换日志保存内容 //转换日志保存内容
String content = actPriceUtil.transActLogContent(isAdd ? LOG_OPERATE_ADD : LOG_OPERATE_UPDATE, String content = actPriceUtil.transActLogContent(isAdd ? LOG_OPERATE_ADD : LOG_OPERATE_UPDATE,
LOG_SYSTEM_MODULE_LJYH, LOG_SYSTEM_MODULE_LJYH,
saveVO.getActiveName()); saveVO.getActiveName());
actPriceUtil.saveActLog(LOG_SYSTEM_NAME_SIGN, LOG_SYSTEM_MODULE_ACTIVE, content); actPriceUtil.saveActLog(LOG_SYSTEM_NAME_SIGN, LOG_SYSTEM_MODULE_ACTIVE, content);
return row;
} }
@Override @Override
public ActiveSubPriceRespVO selectByStoreId() { public ActiveSubPrice selectByStoreId() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("store_id", nowAccountInfo.getStoreId()); queryWrapper.eq("store_id", nowAccountInfo.getStoreId());
@ -96,13 +105,13 @@ public class ActiveSubPriceServiceImpl extends ServiceImpl<ActiveSubPriceMapper,
} }
} }
} }
ActiveSubPriceRespVO result = new ActiveSubPriceRespVO();
BeanUtils.copyProperties(activeSubPrice, result);
if (ObjectUtil.isNotEmpty(activeSubPrice)){ if (ObjectUtil.isNotEmpty(activeSubPrice)){
List<ActiveSubPriceRule> activeSubPriceRules = activeSubPriceRuleService.listByActId(activeSubPrice.getId()); List<ActiveSubPriceRule> activeSubPriceRules = activeSubPriceRuleService.listByActSubId(activeSubPrice.getId(),"0");
result.setRuleList(activeSubPriceRules); activeSubPrice.setOrderList(activeSubPriceRules);
List<ActiveSubPriceRule> activeSubPriceRules1 = activeSubPriceRuleService.listByActSubId(activeSubPrice.getId(),"1");
activeSubPrice.setRefuelList(activeSubPriceRules1);
} }
return result; return activeSubPrice;
} }
} }