营销
This commit is contained in:
parent
e5e0fa1fbd
commit
c9ab6b7f3f
@ -79,7 +79,7 @@ export function editPriceRule(data) {
|
||||
// 删除活动规则
|
||||
export function deletePriceRule(id) {
|
||||
return request({
|
||||
url: '/business/activePriceRule/del'+id,
|
||||
url: '/business/activePriceRule/del/'+id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
@ -101,7 +101,7 @@
|
||||
<div class="gang"></div>
|
||||
<div class="g-title">活动规则</div>
|
||||
</div>
|
||||
<el-button type="primary" @click="showDialogVisible =! showDialogVisible">新增活动规则</el-button>
|
||||
<el-button type="primary" @click="addActiveRule">新增活动规则</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
:data="ruleList"
|
||||
@ -115,7 +115,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="activeId"
|
||||
prop="activeTitle"
|
||||
label="分时优惠名称"
|
||||
>
|
||||
</el-table-column>
|
||||
@ -127,7 +127,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="levelId"
|
||||
prop="levelText"
|
||||
label="会员等级"
|
||||
>
|
||||
</el-table-column>
|
||||
@ -139,7 +139,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="babelIds"
|
||||
prop="labelText"
|
||||
label="会员标签"
|
||||
>
|
||||
</el-table-column>
|
||||
@ -173,12 +173,12 @@
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status==0" style="color:#FF9655;">未生效</span>
|
||||
<span v-if="scope.row.status==1" style="color:#409EFF;">使用中</span>
|
||||
<span v-if="scope.row.status==2" style="color:#F44522;">已生效</span>
|
||||
<span v-if="scope.row.status==2" style="color:#F44522;">已失效</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="createBy"
|
||||
prop="createName"
|
||||
label="创建人"
|
||||
>
|
||||
</el-table-column>
|
||||
@ -194,13 +194,14 @@
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="showDialogVisible =! showDialogVisible"
|
||||
@click="editRule(scope.row)"
|
||||
>修改
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="deleteRule(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
@ -210,8 +211,7 @@
|
||||
<el-dialog
|
||||
title="新增/修改分时优惠"
|
||||
:visible.sync="centerDialogVisible"
|
||||
width="48%"
|
||||
center>
|
||||
width="48%">
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
|
||||
<el-form-item label="分时优惠名称" prop="title">
|
||||
<el-input v-model="ruleForm.title" style="width: 217px"></el-input>
|
||||
@ -295,19 +295,21 @@
|
||||
<el-dialog
|
||||
title="新增/修改活动规则"
|
||||
:visible.sync="showDialogVisible"
|
||||
width="60%"
|
||||
center>
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
|
||||
<div style="display: flex;width: 100%">
|
||||
<div style="width: 40%">
|
||||
<el-form-item label="分时优惠名称" prop="region">
|
||||
<el-select v-model="ruleForm.region" placeholder="请选择优惠名称">
|
||||
<el-option label="区域一" value="shanghai"></el-option>
|
||||
<el-option label="区域二" value="beijing"></el-option>
|
||||
width="60%">
|
||||
<el-form :model="ruleForm1" :rules="rules" ref="ruleForm1" label-width="120px" class="demo-ruleForm">
|
||||
<div style="display: flex;width: 100%;margin: 20px 0;">
|
||||
<div style="width: 50%">
|
||||
<el-form-item label="分时优惠名称" prop="activeId">
|
||||
<el-select v-model="ruleForm1.activeId" placeholder="请选择优惠名称">
|
||||
<el-option
|
||||
v-for="(item,index) in timeShareList"
|
||||
:key="index"
|
||||
:label="item.title"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="可使用支付方式" prop="type">
|
||||
<el-checkbox-group v-model="ruleForm.paymentType">
|
||||
<el-form-item label="可使用支付方式" prop="paymentType">
|
||||
<el-checkbox-group v-model="ruleForm1.paymentType">
|
||||
<el-checkbox
|
||||
v-for="dict in dict.type.payment_type"
|
||||
v-if="dict.value!='APPLET_CODE'"
|
||||
@ -316,8 +318,8 @@
|
||||
:value="dict.value"></el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label=" 会员标签" prop="region">
|
||||
<el-select v-model="ruleForm.region" placeholder="请选择会员标签">
|
||||
<el-form-item label=" 会员标签" prop="babelIds">
|
||||
<el-select v-model="ruleForm1.babelIds" multiple placeholder="请选择会员标签">
|
||||
<el-option
|
||||
v-for="item in userLabelList"
|
||||
:key="item.id+''"
|
||||
@ -327,47 +329,47 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="适用实收金额" required>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<el-form-item prop="moneyMin">
|
||||
<el-input v-model="ruleForm1.moneyMin"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div style="margin-left: 5px">到</div>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<el-form-item prop="moneyMax">
|
||||
<el-input v-model="ruleForm1.moneyMax"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="适用加油升数" required>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<el-form-item prop="literMin">
|
||||
<el-input v-model="ruleForm1.literMin"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div style="margin-left: 5px">到</div>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<el-form-item prop="literMax">
|
||||
<el-input v-model="ruleForm1.literMax"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="最大优惠金额" prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<el-form-item label="最大优惠金额" prop="disMax">
|
||||
<el-input v-model="ruleForm1.disMax"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="每人每日参与限制" label-width="140px" prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<el-form-item label="每人每日参与限制" label-width="140px" prop="dayLimitNum">
|
||||
<el-input v-model="ruleForm1.dayLimitNum"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div style="width: 60%">
|
||||
<el-form-item label="活动规则名称" prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<div style="width:50%">
|
||||
<el-form-item label="活动规则名称" prop="ruleName">
|
||||
<el-input v-model="ruleForm1.ruleName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="适用会员等级" prop="region">
|
||||
<el-select v-model="ruleForm.levelId" clearable placeholder="请选择会员等级">
|
||||
<el-form-item label="适用会员等级" prop="levelId">
|
||||
<el-select v-model="ruleForm1.levelId" clearable placeholder="请选择会员等级">
|
||||
<el-option
|
||||
v-for="(item,index) in userGradeList"
|
||||
:label="item.name"
|
||||
@ -376,12 +378,23 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生效时间" required>
|
||||
|
||||
<el-form-item prop="date1">
|
||||
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1"
|
||||
style="width: 100%;"></el-date-picker>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="activeStartTime">
|
||||
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm1.activeStartTime"
|
||||
style="width: 100%"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<div style="margin-left: 5px">至</div>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="activeEndTime">
|
||||
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm1.activeEndTime"
|
||||
style="width: 100%"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-form-item>
|
||||
|
||||
@ -418,31 +431,33 @@
|
||||
<div style="margin-top: 20px">
|
||||
<el-form-item label="时间段" prop="timeApplyStart">
|
||||
<el-time-picker
|
||||
v-model="ruleForm.timeApplyStart"
|
||||
v-model="ruleForm1.dayStartTime"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
style="width: 45%"
|
||||
placeholder="请选择开始时间点">
|
||||
</el-time-picker>
|
||||
至
|
||||
<el-time-picker
|
||||
v-model="ruleForm.timeApplyEnd"
|
||||
v-model="ruleForm1.dayEndTime"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm"
|
||||
style="width: 45%"
|
||||
placeholder="请选择结束时间点">
|
||||
</el-time-picker>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="每人累计参与限制" label-width="140px" prop="name">
|
||||
<el-input v-model="ruleForm.name"></el-input>
|
||||
<el-form-item label="每人累计参与限制" label-width="140px" prop="limitNum">
|
||||
<el-input v-model="ruleForm1.limitNum"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
|
||||
<el-form-item>
|
||||
<el-button>取消</el-button>
|
||||
<el-button type="primary">保存</el-button>
|
||||
<el-form-item style="text-align: center">
|
||||
<el-button @click="showDialogVisible = !showDialogVisible">取消</el-button>
|
||||
<el-button type="primary" @click="submitRuleForm()">保存</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@ -457,7 +472,7 @@ import {
|
||||
getID,
|
||||
updateActivePrice,
|
||||
deleteList,
|
||||
getPriceRuleList
|
||||
getPriceRuleList, addPriceRule, editPriceRule, getPriceRule, deletePriceRule
|
||||
} from "./api/separate";
|
||||
import {oilNumberList1} from "@/api/order/oilnumgun";
|
||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||
@ -510,22 +525,110 @@ export default {
|
||||
weekDay: [],
|
||||
monthDay: [],
|
||||
userLabelList: [],
|
||||
userGradeList:[]
|
||||
userGradeList: [],
|
||||
timeShareList: [],
|
||||
ruleForm1: {
|
||||
activeType: 1,
|
||||
timeType: 0,
|
||||
paymentType: []
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getRuleList()
|
||||
this.listUserGrade()
|
||||
this.getUserLabelList()
|
||||
},
|
||||
methods: {
|
||||
// 重置活动规则
|
||||
resetRule(){
|
||||
this.ruleForm1 = {
|
||||
activeType: 1,
|
||||
timeType: 0,
|
||||
paymentType: []
|
||||
}
|
||||
this.tindex3 = 0
|
||||
this.weekDay = []
|
||||
this.monthDay = []
|
||||
},
|
||||
// 删除活动规则
|
||||
deleteRule(data){
|
||||
deletePriceRule(data.id).then(res => {
|
||||
this.$message.success("删除成功")
|
||||
this.getRuleList()
|
||||
})
|
||||
},
|
||||
// 修改活动规则
|
||||
editRule(data) {
|
||||
this.resetRule()
|
||||
getPriceRule(data.id).then(res => {
|
||||
|
||||
this.getTimeShareList()
|
||||
this.listUserGrade()
|
||||
this.getUserLabelList()
|
||||
this.showDialogVisible = true
|
||||
|
||||
if (res.data){
|
||||
this.ruleForm1 = res.data
|
||||
if (res.data.paymentType) this.ruleForm1.paymentType = res.data.paymentType.split(",")
|
||||
if (res.data.babelIds) this.ruleForm1.babelIds = res.data.babelIds.split(",")
|
||||
|
||||
if (res.data.timeSlots){
|
||||
if (res.data.timeType == "0") {
|
||||
this.weekDay = this.ruleForm1.timeSlots.split(",")
|
||||
} else if (this.ruleForm1.timeType == "1") {
|
||||
this.monthDay = this.ruleForm1.timeSlots.split(",")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提交活动规则
|
||||
submitRuleForm() {
|
||||
this.$refs["ruleForm1"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.ruleForm1.paymentType) this.ruleForm1.paymentType = this.ruleForm1.paymentType.toString()
|
||||
if (this.ruleForm1.babelIds) this.ruleForm1.babelIds = this.ruleForm1.babelIds.toString()
|
||||
if (this.ruleForm1.timeType == "0") {
|
||||
this.ruleForm1.timeSlots = this.weekDay.toString()
|
||||
} else if (this.ruleForm1.timeType == "1") {
|
||||
this.ruleForm1.timeSlots = this.monthDay.toString()
|
||||
}
|
||||
|
||||
if (this.ruleForm1.id) {
|
||||
editPriceRule(this.ruleForm1).then(res => {
|
||||
this.$message.success("修改成功")
|
||||
this.getRuleList()
|
||||
this.showDialogVisible = false
|
||||
})
|
||||
} else {
|
||||
addPriceRule(this.ruleForm1).then(res => {
|
||||
this.$message.success("添加成功")
|
||||
this.getRuleList()
|
||||
this.showDialogVisible = false
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 添加活动规则
|
||||
addActiveRule() {
|
||||
this.resetRule()
|
||||
this.getTimeShareList()
|
||||
this.listUserGrade()
|
||||
this.getUserLabelList()
|
||||
this.showDialogVisible = true
|
||||
},
|
||||
// 查询分时优惠列表信息
|
||||
getTimeShareList() {
|
||||
getRequestList({pageNo: 1, pageSize: 10000}).then(res => {
|
||||
this.timeShareList = res.data.records
|
||||
})
|
||||
},
|
||||
// 会员等级
|
||||
listUserGrade() {
|
||||
listUserGrade({page: 1, pageSize: 1000}).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.userGradeList = res.data.records
|
||||
console.log(this.userGradeList)
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -537,7 +640,7 @@ export default {
|
||||
},
|
||||
Typeindex3(index) {
|
||||
this.tindex3 = index
|
||||
this.ruleForm.timeType = index
|
||||
this.ruleForm1.timeType = index
|
||||
this.weekDay = []
|
||||
this.monthDay = []
|
||||
},
|
||||
@ -730,6 +833,7 @@ export default {
|
||||
font-size: 14px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.d-s {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -80,10 +80,10 @@ public class ActivePriceRuleController extends BaseController {
|
||||
* @param saveVO ActivePriceRuleSaveVO实体
|
||||
* @return com.fuint.framework.web.ResponseObject
|
||||
**/
|
||||
@PostMapping("/update")
|
||||
@PutMapping("/update")
|
||||
public ResponseObject update(@RequestBody ActivePriceRuleSaveVO saveVO) {
|
||||
try {
|
||||
activePriceRuleService.saveActivePriceRule(true, saveVO);
|
||||
activePriceRuleService.saveActivePriceRule(false, saveVO);
|
||||
} catch (BusinessCheckException businessCheckException) {
|
||||
return getFailureResult(businessCheckException.getMessage());
|
||||
}
|
||||
|
@ -37,8 +37,10 @@ public class ActivePriceRule extends Model<ActivePriceRule> {
|
||||
/** 会员标签ids,多个以英文逗号隔开 */
|
||||
private String babelIds ;
|
||||
/** 生效起始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
|
||||
private Date activeStartTime ;
|
||||
/** 生效截止时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
|
||||
private Date activeEndTime ;
|
||||
/** 适用实收金额下限 */
|
||||
private Double moneyMin ;
|
||||
@ -62,7 +64,7 @@ public class ActivePriceRule extends Model<ActivePriceRule> {
|
||||
private Integer dayLimitNum ;
|
||||
/** 每人累计参与限制次数 */
|
||||
private Integer limitNum ;
|
||||
/** 状态:0未生效;1使用中;2已生效 */
|
||||
/** 状态:0未生效;1使用中;2已失效 */
|
||||
private String status ;
|
||||
/** 创建人 */
|
||||
private String createBy ;
|
||||
|
@ -14,13 +14,15 @@
|
||||
ofType="com.fuint.business.userManager.entity.UserLabel"/>
|
||||
|
||||
</resultMap>
|
||||
<select id="pageActivePriceRule" resultMap="ActivePriceRuleMap">
|
||||
<select id="pageActivePriceRule" resultType="com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleRespVO">
|
||||
SELECT
|
||||
main.*,
|
||||
ap.title AS activeTitle
|
||||
ap.title AS activeTitle,
|
||||
ta.real_name createName
|
||||
FROM
|
||||
active_price_rule main
|
||||
LEFT JOIN active_price ap ON main.active_id = ap.id
|
||||
LEFT JOIN t_account ta on main.create_by = ta.acct_id
|
||||
<where>
|
||||
<if test="entity.chainStorId != null and entity.chainStorId != ''">
|
||||
AND main.chain_stor_id = #{entity.chainStorId}
|
||||
@ -48,13 +50,13 @@
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getRuleById"
|
||||
resultMap="ActivePriceRuleMap">
|
||||
resultType="com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleRespVO">
|
||||
SELECT
|
||||
main.*,
|
||||
main.*,ap.active_type,
|
||||
ap.title AS activeTitle
|
||||
FROM
|
||||
active_price_rule main
|
||||
LEFT JOIN active_price ap ON main.active_id = ap.id
|
||||
where id = #{id}
|
||||
where main.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.marketingActivity.activePrice.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -11,7 +12,10 @@ import com.fuint.business.marketingActivity.activePrice.util.ActPriceUtil;
|
||||
import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleReqVO;
|
||||
import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleRespVO;
|
||||
import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleSaveVO;
|
||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||
import com.fuint.business.userManager.entity.UserLabel;
|
||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||
import com.fuint.business.userManager.service.UserLabelService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.StringUtils;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
@ -19,10 +23,13 @@ import com.fuint.framework.exception.BusinessCheckException;
|
||||
import com.fuint.quartz.util.BeanUtils;
|
||||
import com.fuint.repository.model.MtUserGrade;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.fuint.business.marketingActivity.activePrice.entity.ActivePrice.*;
|
||||
@ -43,6 +50,10 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
private ActivePriceRuleMapper activePriceRuleMapper;
|
||||
@Resource
|
||||
private ActPriceUtil actPriceUtil;
|
||||
@Autowired
|
||||
private LJUserGradeService userGradeService;
|
||||
@Autowired
|
||||
private UserLabelService userLabelService;
|
||||
|
||||
/**
|
||||
* 分页查询活动规则(分时优惠/限时特价通用接口)
|
||||
@ -59,13 +70,38 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
actPriceRuleReq.setStoreId(nowAccountInfo.getStoreId());
|
||||
/*1、列表数据查询,返回结构中带有会员等级集合和会员标签集合*/
|
||||
IPage<ActivePriceRuleRespVO> result = activePriceRuleMapper.pageActivePriceRule(page, actPriceRuleReq);
|
||||
// 会员等级列表
|
||||
List<LJUserGrade> ljUserGrades = userGradeService.selectUserGradeAll(nowAccountInfo.getStoreId());
|
||||
// 会员标签列表
|
||||
List<UserLabel> userLabels = userLabelService.queryList();
|
||||
/*2、数据处理*/
|
||||
result.getRecords().forEach(item -> {
|
||||
item.setPaymentTypeText(replacePayment(item.getPaymentType()));
|
||||
// item.setPaymentTypeText(replacePayment(item.getPaymentType()));
|
||||
//会员等级集合转文字列表展示
|
||||
item.setLevelText(item.getLevelList().stream().map(MtUserGrade::getName).collect(Collectors.joining(",")));
|
||||
// item.setLevelText(ljUserGrades.stream().map(LJUserGrade::getName).collect(Collectors.joining(",")));
|
||||
//会员标签集合转文字列表展示
|
||||
item.setLabelText(item.getLabelList().stream().map(UserLabel::getLabelName).collect(Collectors.joining(",")));
|
||||
// item.setLabelText(userLabels.stream().map(UserLabel::getLabelName).collect(Collectors.joining(",")));
|
||||
|
||||
String levelText = "";
|
||||
for (LJUserGrade ljUserGrade : ljUserGrades) {
|
||||
if (ObjectUtil.isNotEmpty(item.getLevelId()) && item.getLevelId().equals(ljUserGrade.getId().toString())){
|
||||
levelText = ljUserGrade.getName() + ",";
|
||||
}
|
||||
}
|
||||
item.setLevelText(levelText);
|
||||
|
||||
String labelText = "";
|
||||
if (ObjectUtil.isNotEmpty(item.getBabelIds())) {
|
||||
String[] babelIds = item.getBabelIds().split(",");
|
||||
for (UserLabel userLabel : userLabels) {
|
||||
for (String babelId : babelIds) {
|
||||
if (babelId.equals(userLabel.getId().toString())){
|
||||
labelText += userLabel.getLabelName() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
item.setLabelText(labelText);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@ -84,15 +120,15 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
ActivePriceRuleRespVO result = activePriceRuleMapper.getRuleById(id);
|
||||
/*2、数据处理,将会员等级和会员标签抽出id组成新的集合,方便前端展示*/
|
||||
//会员标签id集合抽取id方便前端展示
|
||||
if (!result.getLabelList().isEmpty()) {
|
||||
//会员标签id集合
|
||||
result.setLabelIdList(result.getLabelList().stream().map(item -> String.valueOf(item.getId())).collect(Collectors.toList()));
|
||||
}
|
||||
//会员等级集合抽取id方便前端展示
|
||||
if (!result.getLevelList().isEmpty()){
|
||||
//会员等级id集合
|
||||
result.setLevelIdList(result.getLevelList().stream().map(item -> String.valueOf(item.getId())).collect(Collectors.toList()));
|
||||
}
|
||||
// if (!result.getLabelList().isEmpty()) {
|
||||
// //会员标签id集合
|
||||
// result.setLabelIdList(result.getLabelList().stream().map(item -> String.valueOf(item.getId())).collect(Collectors.toList()));
|
||||
// }
|
||||
// //会员等级集合抽取id方便前端展示
|
||||
// if (!result.getLevelList().isEmpty()){
|
||||
// //会员等级id集合
|
||||
// result.setLevelIdList(result.getLevelList().stream().map(item -> String.valueOf(item.getId())).collect(Collectors.toList()));
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -116,16 +152,32 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
//实体类转换
|
||||
ActivePriceRule activePriceRule = new ActivePriceRule();
|
||||
BeanUtils.copyProperties(saveVO,activePriceRule);
|
||||
//会员等级id转换
|
||||
String levelId = String.join(",", saveVO.getLevelIdList());
|
||||
//会员标签id转换
|
||||
String babelIds = String.join(",",saveVO.getLabelIdList());
|
||||
activePriceRule.setLevelId(levelId);
|
||||
activePriceRule.setBabelIds(babelIds);
|
||||
// //会员等级id转换
|
||||
// String levelId = String.join(",", saveVO.getLevelIdList());
|
||||
// //会员标签id转换
|
||||
// String babelIds = String.join(",",saveVO.getLabelIdList());
|
||||
// activePriceRule.setLevelId(levelId);
|
||||
// activePriceRule.setBabelIds(babelIds);
|
||||
|
||||
// 插入店铺信息id
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
activePriceRule.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
activePriceRule.setStoreId(nowAccountInfo.getStoreId());
|
||||
|
||||
// 判断规则状态信息
|
||||
Date date = new Date();
|
||||
if (ObjectUtil.isNotEmpty(activePriceRule.getActiveStartTime()) && ObjectUtil.isNotEmpty(activePriceRule.getActiveEndTime())){
|
||||
if (activePriceRule.getActiveStartTime().after(date)){
|
||||
activePriceRule.setStatus("0");
|
||||
}
|
||||
if (activePriceRule.getActiveStartTime().before(date) && activePriceRule.getActiveEndTime().after(date)){
|
||||
activePriceRule.setStatus("1");
|
||||
}
|
||||
if (activePriceRule.getActiveEndTime().before(date)){
|
||||
activePriceRule.setStatus("2");
|
||||
}
|
||||
}
|
||||
|
||||
/*3、保存数据库*/
|
||||
//保存活动规则
|
||||
saveOrUpdate(activePriceRule);
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ActivePriceRuleRespVO extends ActivePriceRule {
|
||||
/** 活动名称 */
|
||||
/** 活动名称 分时优惠名称 */
|
||||
private String activeTitle ;
|
||||
/** 支付方式字符串 */
|
||||
private String paymentTypeText;
|
||||
@ -33,4 +33,10 @@ public class ActivePriceRuleRespVO extends ActivePriceRule {
|
||||
/**标签集合*/
|
||||
private List<String> labelIdList;
|
||||
|
||||
/** 活动名称 分时优惠 类型 */
|
||||
private String activeType ;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createName;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user