营销活动。
This commit is contained in:
parent
6436423875
commit
7532c12f3d
@ -136,3 +136,17 @@ export function getwei() {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
export function encryptData(id) {
|
||||
return request({
|
||||
url: 'cardGiftActive/encryptData?activeId='+id,
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
|
||||
export function exportCardInfo(id) {
|
||||
return request({
|
||||
url: 'cardGiftActive/exportCardInfo?activeId='+id,
|
||||
method: 'post',
|
||||
responseType:'blob',
|
||||
})
|
||||
}
|
||||
|
@ -432,78 +432,6 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="fji" >-->
|
||||
<!-- <div class="wrap-box" @click="gobox(1)" >-->
|
||||
<!-- <img src="./imgs/xfyl.png" style="width: 315px;height: 265px;margin: 0 auto " >-->
|
||||
<!-- <div class="p-r-title">-->
|
||||
<!-- <div style="font-size: 24px;font-weight: bold" >消费有礼</div>-->
|
||||
<!-- <div style="font-size: 12px">Consumption is polite</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="bottom-box">-->
|
||||
<!-- <div>消费有礼</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="wrap-box" @click="gobox(2)" >-->
|
||||
<!-- <img src="./imgs/zkyx.png" style="width: 315px;height: 265px;margin: 0 auto " >-->
|
||||
<!-- <div class="p-r-title">-->
|
||||
<!-- <div style="font-size: 24px;font-weight: bold" >折扣营销</div>-->
|
||||
<!-- <div style="font-size: 12px">Discount marketing</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="bottom-box">-->
|
||||
<!-- <div>折扣营销</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="wrap-box" @click="gobox(3)" >-->
|
||||
<!-- <img src="./imgs/mjyx.png" style="width: 315px;height: 265px;margin: 0 auto " >-->
|
||||
<!-- <div class="p-r-title">-->
|
||||
<!-- <div style="font-size: 24px;font-weight: bold" >满减营销</div>-->
|
||||
<!-- <div style="font-size: 12px">Consumption is polite</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="bottom-box">-->
|
||||
<!-- <div>满减营销</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="wrap-box" @click="gobox(4)" >-->
|
||||
<!-- <img src="./imgs/xryl.png" style="width: 315px;height: 265px;margin: 0 auto " >-->
|
||||
<!-- <div class="p-r-title">-->
|
||||
<!-- <div style="font-size: 24px;font-weight: bold" >新人有礼</div>-->
|
||||
<!-- <div style="font-size: 12px">Full reduction marketing</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="bottom-box">-->
|
||||
<!-- <div>新人有礼</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="wrap-box" @click="gobox(5)" >-->
|
||||
<!-- <img src="./imgs/tjyl.png" style="width: 315px;height: 265px;margin: 0 auto " >-->
|
||||
<!-- <div class="p-r-title">-->
|
||||
<!-- <div style="font-size: 24px;font-weight: bold" >推荐有礼</div>-->
|
||||
<!-- <div style="font-size: 12px">Newcomers are polite</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="bottom-box">-->
|
||||
<!-- <div>推荐有礼</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="wrap-box" @click="gobox(6)" >-->
|
||||
<!-- <img src="./imgs/yjfq.png" style="width: 315px;height: 265px;margin: 0 auto " >-->
|
||||
<!-- <div class="p-r-title">-->
|
||||
<!-- <div style="font-size: 24px;font-weight: bold" >一键发券</div>-->
|
||||
<!-- <div style="font-size: 12px">One click coupon issuance</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="bottom-box">-->
|
||||
<!-- <div>一键发券</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
|
||||
<!-- <activeConsumption v-if="value == 1"></activeConsumption>-->
|
||||
<!-- <activeDiscount v-if="value == 2"></activeDiscount>-->
|
||||
<!-- <activeFullminus v-if="value == 3"></activeFullminus>-->
|
||||
<!-- <activeNewlyweds v-if="value == 4" ></activeNewlyweds>-->
|
||||
<!-- <activeRecommend v-if="value == 5"></activeRecommend>-->
|
||||
<!-- 添加或修改兑换券对话框 -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -59,8 +59,8 @@
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="lastNum"
|
||||
label="剩余制卡数量"
|
||||
prop="sailNum"
|
||||
label="售出数量"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -77,7 +77,7 @@
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.pwdType == 0">免密</span>
|
||||
<span v-if="scope.row.pwdType == 1">密码</span>
|
||||
<span v-if="scope.row.pwdType == 1">加密</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -90,11 +90,11 @@
|
||||
<span v-if="scope.row.status == 2">生效中</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createBy"
|
||||
label="创建人"
|
||||
>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="createBy"-->
|
||||
<!-- label="创建人"-->
|
||||
<!-- >-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column
|
||||
prop="address"
|
||||
label="操作">
|
||||
@ -102,21 +102,31 @@
|
||||
<div style="display: flex;flex-wrap: wrap">
|
||||
<el-button
|
||||
type="text"
|
||||
v-if="scope.row.status == 0"
|
||||
@click="updateId(scope.row)"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
v-if="scope.row.status == 0"
|
||||
@click="uploadShow(scope.row)"
|
||||
>上传礼品卡数据
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
@click="Encryption =! Encryption"
|
||||
>密码加密
|
||||
v-if="scope.row.status == 1"
|
||||
@click="jmData(scope.row.id)"
|
||||
>一键加密
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
v-if="scope.row.status == 2"
|
||||
@click="downData(scope.row.id)"
|
||||
>下载
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
v-if="scope.row.status ==2"
|
||||
@click="orderShow =! orderShow"
|
||||
>查看订单信息
|
||||
</el-button>
|
||||
@ -300,12 +310,12 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="密码形式" prop="name">
|
||||
<div class="d-s">
|
||||
<div class="icon-type" v-for="(item,index) in modalitylsit" :key="index"
|
||||
:class="{ 'acvtive' : index === tindex }" @click="Typeindex2(index)">
|
||||
<img src="../../../assets/images/wx.png" style="width: 20px;height: 20px" v-if="index != tindex">
|
||||
<img src="../../../assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex">
|
||||
{{ item }}
|
||||
</div>
|
||||
|
||||
|
||||
<el-radio-group v-model="ruleForm.pwdType">
|
||||
<el-radio :label="0">免密</el-radio>
|
||||
<el-radio :label="1">加密</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="礼品卡说明" prop="remark">
|
||||
@ -375,20 +385,13 @@ import {
|
||||
getList,
|
||||
getListtj,
|
||||
uploadFile,
|
||||
downloadTemplate,
|
||||
addList,
|
||||
eitList,
|
||||
deleteList,
|
||||
oilDepotConfiguration,
|
||||
getdownload,
|
||||
getselectGiftValue,
|
||||
getyi,
|
||||
getwei,
|
||||
getqb,
|
||||
getsk
|
||||
encryptData, exportCardInfo
|
||||
} from "@/api/EventMarketing/giftBlock";
|
||||
import {getToken} from "@/utils/auth";
|
||||
import saveAs from 'file-saver';
|
||||
import {exportExcelTankApi} from "@/api/oilConfig/oilTank";
|
||||
import {exportExcelApi} from "@/api/convenienceStore/damage";
|
||||
|
||||
export default {
|
||||
name: 'index',
|
||||
@ -542,7 +545,15 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
downData(activeId){
|
||||
exportCardInfo(activeId).then(res=>{
|
||||
console.log("res",res)
|
||||
// this.downloadFile(res);
|
||||
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
|
||||
this.$download.saveAs(blob,+'礼品卡数据.xLs')
|
||||
})
|
||||
},
|
||||
beforeUpload(file) {
|
||||
// 自定义上传前的逻辑
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -552,6 +563,7 @@ export default {
|
||||
});
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.getlist()
|
||||
console.log('上传成功:', response);
|
||||
this.$message.success('上传成功!');
|
||||
this.uploadingShow = false;
|
||||
@ -617,69 +629,29 @@ export default {
|
||||
// 卡类型 确保下拉框选中
|
||||
this.ruleForm.cardType = row.cardType
|
||||
},
|
||||
|
||||
jmData(activeId){
|
||||
encryptData(activeId).then(response => {
|
||||
this.$message.success('成功!');
|
||||
this.getlist()
|
||||
})
|
||||
},
|
||||
uploadShow(row) {
|
||||
this.uploadingShow = !this.uploadingShow
|
||||
// 将编号赋值
|
||||
this.ruleForm2.activeNum = row.activeName
|
||||
},
|
||||
Typeindex(index) {
|
||||
this.tindex = index
|
||||
},
|
||||
Typeindex2(index) {
|
||||
this.tindex2 = index
|
||||
},
|
||||
toggleSelection(rows) {
|
||||
if (rows) {
|
||||
rows.forEach(row => {
|
||||
this.$refs.multipleTable.toggleRowSelection(row);
|
||||
});
|
||||
} else {
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
}
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
getwysk(row) {
|
||||
if (row.sailStatus == 1) {
|
||||
this.$message.error("此卡已经售出过了呦")
|
||||
return
|
||||
}
|
||||
if (row.activateStatus == 1) {
|
||||
this.$message.error("此卡还未激活呦")
|
||||
return
|
||||
}
|
||||
let data = {
|
||||
id: row.id,
|
||||
sailStatus: 1
|
||||
}
|
||||
getsk(data).then(res => {
|
||||
this.getlist()
|
||||
console.log(res)
|
||||
this.$message.success("售卡成功")
|
||||
})
|
||||
},
|
||||
|
||||
handleChange(file, fileList) {
|
||||
// 文件变化时的处理逻辑
|
||||
console.log('文件变化:', file, fileList);
|
||||
this.fileList2 = fileList; // 更新 fileList
|
||||
},
|
||||
|
||||
putStatus(id) {
|
||||
let data = {
|
||||
id: 1,
|
||||
exchangeStatus: id,
|
||||
}
|
||||
oilDepotConfiguration(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.$message.success("操作成功")
|
||||
this.gettj()
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
// 重置按钮操作
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
|
@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsAppletVO;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsVO;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.dto.ActiveNewlywedsDTO;
|
||||
@ -19,10 +18,6 @@ import com.fuint.business.marketingActivity.activeNewlyweds.mapper.ActiveNewlywe
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsChildService;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsService;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommend;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendAppletVO;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper;
|
||||
@ -87,18 +82,9 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
|
||||
// 查看是否存在活动,存在则返回
|
||||
ActiveNewlyweds activeNewlyweds1 = selectByStoreId();
|
||||
if (ObjectUtil.isNotEmpty(activeNewlyweds1)) return false;
|
||||
|
||||
boolean save = false;
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
activeApplet.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
//根据店铺id查询
|
||||
/*LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,storeId);
|
||||
ActiveNewlyweds one = getOne(lambdaQueryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(one)){
|
||||
activeNewlywedsDTO.setId(one.getId());
|
||||
save = updateOneById(activeNewlywedsDTO);
|
||||
}else {*/
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
activeNewlywedsDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
@ -114,17 +100,14 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
|
||||
save = save(activeNewlyweds);
|
||||
}
|
||||
activeApplet.setActiveId(activeNewlyweds.getId());
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(activeNewlyweds.getActiveStartTime());
|
||||
String formatEd = dateFormat.format(activeNewlyweds.getActiveEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
|
||||
activeApplet.setPoints(activeNewlyweds.getPoints());
|
||||
activeApplet.setGrowaValue(activeNewlyweds.getGrowthValue());
|
||||
activeApplet.setType("6");
|
||||
activeApplet.setName("新人有礼活动");
|
||||
|
||||
//赠送优惠券兑换券实物
|
||||
String card = "";
|
||||
if (CollectionUtils.isNotEmpty(activeNewlywedsDTO.getActiveNewlywedsChildList())) {
|
||||
@ -136,35 +119,13 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
|
||||
"积分,赠送成长值为:"+activeNewlywedsDTO.getGrowthValue()+"成长值,赠送券为:"+
|
||||
(ObjectUtil.isNotEmpty(card) ? card : "无")+"。");
|
||||
activeAppletService.save(activeApplet);
|
||||
|
||||
//新增兑换物品
|
||||
List<ActiveNewlywedsChild> list = activeNewlywedsDTO.getActiveNewlywedsChildList();
|
||||
list.stream().map(s ->{
|
||||
s.setActiveNewlywedsId(activeNewlyweds.getId());
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
save = activeNewlywedsChildService.saveBatch(list);
|
||||
//}
|
||||
/* //获取当前店铺的id和连锁店id
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
activeNewlywedsDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
activeNewlywedsDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
//新增折扣营销活动模板
|
||||
ActiveNewlyweds activeNewlyweds = new ActiveNewlyweds();
|
||||
if (ObjectUtils.isNotEmpty(activeNewlywedsDTO)){
|
||||
BeanUtils.copyProperties(activeNewlywedsDTO,activeNewlyweds);
|
||||
//有礼奖励
|
||||
activeNewlyweds.setCourtesyReward(arrayToString(activeNewlywedsDTO.getCourtesyReward()));
|
||||
save = save(activeNewlyweds);
|
||||
}
|
||||
//新增兑换物品
|
||||
List<ActiveNewlywedsChild> list = activeNewlywedsDTO.getActiveNewlywedsChildList();
|
||||
list.stream().map(s ->{
|
||||
s.setActiveNewlywedsId(activeNewlyweds.getId());
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
save = activeNewlywedsChildService.saveBatch(list);*/
|
||||
list.stream().map(s ->{
|
||||
s.setActiveNewlywedsId(activeNewlyweds.getId());
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
save = activeNewlywedsChildService.saveBatch(list);
|
||||
return save;
|
||||
}
|
||||
|
||||
@ -241,37 +202,6 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
|
||||
@Override
|
||||
public IPage select(Page page, ActiveNewlyweds activeNewlywedss) {
|
||||
//构建查询条件
|
||||
/*LambdaQueryWrapper<ActiveNewlyweds> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(ObjectUtils.isNotEmpty(activeNewlyweds.getName())){
|
||||
queryWrapper.like(ActiveNewlyweds::getName,activeNewlyweds.getName());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(activeNewlyweds.getStatus())) {
|
||||
queryWrapper.eq(ActiveNewlyweds::getStatus,activeNewlyweds.getStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(activeNewlyweds.getIsonline())) {
|
||||
queryWrapper.eq(ActiveNewlyweds::getIsonline,activeNewlyweds.getIsonline());
|
||||
}
|
||||
queryWrapper.eq(ActiveNewlyweds::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper.orderByDesc(ActiveNewlyweds::getCreateTime);
|
||||
IPage page1 = page(page, queryWrapper);
|
||||
|
||||
List<ActiveNewlyweds> records = page1.getRecords();
|
||||
List<ActiveNewlywedsVO> activeNewlywedsVOList = records.stream().map(s ->{
|
||||
ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO();
|
||||
//获取兑换卡券
|
||||
LambdaQueryWrapper<ActiveNewlywedsChild> queryWrappers = new LambdaQueryWrapper<>();
|
||||
queryWrappers.eq(ActiveNewlywedsChild::getActiveNewlywedsId,s.getId());
|
||||
queryWrappers.orderByDesc(ActiveNewlywedsChild::getCreateTime);
|
||||
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrappers);
|
||||
|
||||
BeanUtils.copyProperties(s,activeNewlywedsVO);
|
||||
activeNewlywedsVO.setCourtesyReward(s.getCourtesyReward().split(","));
|
||||
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
|
||||
return activeNewlywedsVO;
|
||||
}).collect(Collectors.toList());
|
||||
page1.setRecords(activeNewlywedsVOList);
|
||||
return page1;*/
|
||||
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
|
||||
ArrayList<ActiveNewlywedsVO> activeNewlywedsVOS = new ArrayList<>();
|
||||
//获取新人有礼活动信息
|
||||
LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceRule;
|
||||
import com.fuint.business.marketingActivity.activePrice.mapper.ActivePriceRuleMapper;
|
||||
import com.fuint.business.marketingActivity.activePrice.service.ActivePriceRuleService;
|
||||
@ -23,11 +25,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.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -54,6 +58,8 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
private LJUserGradeService userGradeService;
|
||||
@Autowired
|
||||
private UserLabelService userLabelService;
|
||||
@Resource
|
||||
private ActiveAppletService activeAppletService;
|
||||
|
||||
/**
|
||||
* 分页查询活动规则(分时优惠/限时特价通用接口)
|
||||
@ -70,18 +76,12 @@ 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.setLevelText(ljUserGrades.stream().map(LJUserGrade::getName).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())){
|
||||
@ -89,7 +89,6 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
}
|
||||
}
|
||||
item.setLevelText(levelText);
|
||||
|
||||
String labelText = "";
|
||||
if (ObjectUtil.isNotEmpty(item.getBabelIds())) {
|
||||
String[] babelIds = item.getBabelIds().split(",");
|
||||
@ -118,17 +117,6 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
public ActivePriceRuleRespVO getActPriceRuleById(Integer id) {
|
||||
/*1、根据活动规则id查询规则详情,返回结构中带有会员等级集合和会员标签集合*/
|
||||
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()));
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -152,19 +140,11 @@ 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
|
||||
//插入店铺信息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)){
|
||||
@ -187,6 +167,43 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
ACTIVE_TYPE_1.equals(saveVO.getActiveType()) ? ACTIVE_TYPE_RULE_1_TEXT : ACTIVE_TYPE_RULE_2_TEXT,
|
||||
saveVO.getRuleName());
|
||||
actPriceUtil.saveActLog(LOG_SYSTEM_NAME_SIGN, LOG_SYSTEM_MODULE_ACTIVE, content);
|
||||
//活动主表插入数据
|
||||
//插入营销活动主表
|
||||
LambdaQueryWrapper<ActiveApplet> queryWrapper=new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveApplet::getType,saveVO.getActiveType().equals("1")?"8":"9").eq(ActiveApplet::getActiveId,activePriceRule.getId()).last("limit 1");
|
||||
ActiveApplet activeApplet = activeAppletService.getOne(queryWrapper);
|
||||
if (ObjectUtils.isEmpty(activeApplet)){
|
||||
activeApplet = new ActiveApplet();
|
||||
}
|
||||
activeApplet.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
activeApplet.setActiveId(activePriceRule.getId());
|
||||
activeApplet.setActiveStatus("1");
|
||||
activeApplet.setName(saveVO.getRuleName());
|
||||
activeApplet.setType(saveVO.getActiveType().equals("1")?"8":"9");
|
||||
activeApplet.setDiscountActiveDescribe("本活动适用实收金额为"+activePriceRule.getMoneyMin()+"到"+activePriceRule.getMoneyMax()+",适用加油升数"+activePriceRule.getLiterMin()+
|
||||
"到"+activePriceRule.getLiterMax()+",最大优惠金额为"+activePriceRule.getDisMax());
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
String formatSt = dateFormat.format(activePriceRule.getActiveStartTime());
|
||||
String formatEd = dateFormat.format(activePriceRule.getActiveEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd);
|
||||
//获取会员等级
|
||||
String str = "";
|
||||
if (ObjectUtils.isNotEmpty(activePriceRule.getLevelId())){
|
||||
for (String gradeId : activePriceRule.getLevelId().split(",")) {
|
||||
if (gradeId.length()>2){
|
||||
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||
}
|
||||
}else {
|
||||
str = "全部会员";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
str = "全部会员";
|
||||
}
|
||||
activeApplet.setAdaptUserType(str);
|
||||
activeApplet.setActiveStatus("1");
|
||||
activeAppletService.saveOrUpdate(activeApplet);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,26 +220,4 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl<ActivePriceRuleMappe
|
||||
remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付方式转换
|
||||
*
|
||||
* @param paymentType 支付方式
|
||||
* @return java.lang.String
|
||||
* @author PQZ
|
||||
* @date 14:01 2024/9/2
|
||||
**/
|
||||
public String replacePayment(String paymentType) {
|
||||
if (StringUtil.isNotBlank(paymentType)) {
|
||||
paymentType = paymentType.replace("0", "微信支付");
|
||||
paymentType = paymentType.replace("1", "支付宝");
|
||||
paymentType = paymentType.replace("2", "云闪付");
|
||||
paymentType = paymentType.replace("3", "会员卡");
|
||||
paymentType = paymentType.replace("4", "现金");
|
||||
paymentType = paymentType.replace("5", "POS刷卡");
|
||||
} else {
|
||||
paymentType = "无限制";
|
||||
}
|
||||
return paymentType;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.fuint.business.marketingActivity.activePrice.service.impl;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet;
|
||||
import com.fuint.business.marketingActivity.activeApplet.service.ActiveAppletService;
|
||||
import com.fuint.business.marketingActivity.activePrice.entity.ActivePrice;
|
||||
import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceOil;
|
||||
import com.fuint.business.marketingActivity.activePrice.mapper.ActivePriceMapper;
|
||||
|
@ -2,9 +2,13 @@ package com.fuint.business.marketingActivity.cardGiftActive.controller;
|
||||
|
||||
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.convenienceSore.vo.excel.MtReturnsDetailsExcel;
|
||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||
import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
|
||||
import com.fuint.business.marketingActivity.cardGiftActive.entity.CardGiftActive;
|
||||
import com.fuint.business.marketingActivity.cardGiftActive.service.CardGiftActiveService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@ -34,6 +39,8 @@ public class CardGiftActiveController extends BaseController {
|
||||
*/
|
||||
@Resource
|
||||
private CardGiftActiveService cardGiftActiveService;
|
||||
@Resource
|
||||
private CardGiftService giftService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
@ -124,7 +131,25 @@ public class CardGiftActiveController extends BaseController {
|
||||
cardGiftActiveService.importCardInfo(file,activeNum,interType);
|
||||
return getSuccessResult("导入成功");
|
||||
}
|
||||
@PostMapping("/exportCardInfo")
|
||||
public void exportCardInfo(@RequestParam("activeId") String activeId, HttpServletResponse response) throws IOException {
|
||||
// 需要导出的数据
|
||||
LambdaQueryWrapper<CardGift> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardGift::getActiveId,activeId).eq(CardGift::getSailStatus,"0");
|
||||
List<CardGift> list = giftService.list(queryWrapper);
|
||||
// 设置响应头信息
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=demo.xlsx");
|
||||
try{
|
||||
// 写入文件数据
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
EasyExcel.write(response.getOutputStream(), CardGift.class).sheet("download").doWrite(list);
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 加密密码
|
||||
* @param activeId 活动id
|
||||
|
@ -59,9 +59,9 @@ public class CardGiftActive extends Model<CardGiftActive> {
|
||||
//礼品卡总数量
|
||||
@TableField(exist = false)
|
||||
private Integer sumNum;
|
||||
//礼品卡剩余数量
|
||||
//礼品卡售出数量
|
||||
@TableField(exist = false)
|
||||
private Integer lastNum;
|
||||
private Integer sailNum=0;
|
||||
@TableField(exist = false)
|
||||
private String userPhone;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<select id="pageVo" resultType="com.fuint.business.marketingActivity.cardGiftActive.entity.CardGiftActive">
|
||||
SELECT
|
||||
cga.*,count(cg.id) as sumNum,sum(cg.sail_status=0) lastNum
|
||||
cga.*,count(cg.id) as sumNum,sum(cg.sail_status=1) sailNum
|
||||
FROM
|
||||
card_gift_active cga
|
||||
left join card_gift cg on cga.id = cg.active_id
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.marketingActivity.cardGiftActive.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.EasyExcelFactory;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -60,7 +61,7 @@ public class CardGiftActiveServiceImpl extends ServiceImpl<CardGiftActiveMapper,
|
||||
//获取数据
|
||||
List<Object> list = listener.getDatas();
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
if (list.size() >= 1) {
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
LambdaQueryWrapper<CardGiftActive> queryWrapperActive = new LambdaQueryWrapper<>();
|
||||
queryWrapperActive.eq(CardGiftActive::getActiveNum,activeNum)
|
||||
.eq(CardGiftActive::getStoreId,nowAccountInfo.getStoreId()).last("limit 1");
|
||||
|
Loading…
Reference in New Issue
Block a user