充值记录

This commit is contained in:
齐天大圣 2024-01-02 12:45:39 +08:00
parent 53062019b4
commit 3389960aa5
14 changed files with 158 additions and 60 deletions

View File

@ -221,41 +221,44 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
ActiveNewlywedsAppletVO activeNewlywedsAppletVO = new ActiveNewlywedsAppletVO();
//获取本店铺的推荐有礼活动
ActiveNewlywedsVO activeNewlywedsVO = getOneById(1);
//活动时间
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
String formatSt = dateFormat.format(activeNewlywedsVO.getActiveStartTime());
String formatEd = dateFormat.format(activeNewlywedsVO.getActiveEndTime());
activeNewlywedsAppletVO.setTime(formatSt+"-" + formatEd+"");
//邀请人获得
if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getPoints())){
//积分
activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString());
}
if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getGrowthValue())){
//成长值
activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString());
}
//邀请人赠送优惠券兑换券
String cardi1 = "";
String cardo1 = "";
if (CollectionUtils.isNotEmpty(activeNewlywedsVO.getActiveNewlywedsChildList())){
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsVO.getActiveNewlywedsChildList()) {
if (activeNewlywedsChild.getActiveGift().equals("1")){
//优惠券
cardi1 += activeNewlywedsChild.getGiftCardName()+"的券("+activeNewlywedsChild.getGiftCardDetail()+");";
}
if (activeNewlywedsChild.getActiveGift().equals("2")){
//兑换券
cardo1 += activeNewlywedsChild.getGiftCardName()+"的券;";
if (ObjectUtils.isNotEmpty(activeNewlywedsVO.getId())){
//活动时间
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
String formatSt = dateFormat.format(activeNewlywedsVO.getActiveStartTime());
String formatEd = dateFormat.format(activeNewlywedsVO.getActiveEndTime());
activeNewlywedsAppletVO.setTime(formatSt+"-" + formatEd+"");
//邀请人获得
if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getPoints())){
//积分
activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString());
}
if (ObjectUtils.isNotEmpty(activeNewlywedsVO) && ObjectUtils.isNotEmpty(activeNewlywedsVO.getGrowthValue())){
//成长值
activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString());
}
//邀请人赠送优惠券兑换券
String cardi1 = "";
String cardo1 = "";
if (CollectionUtils.isNotEmpty(activeNewlywedsVO.getActiveNewlywedsChildList())){
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsVO.getActiveNewlywedsChildList()) {
if (activeNewlywedsChild.getActiveGift().equals("1")){
//优惠券
cardi1 += activeNewlywedsChild.getGiftCardName()+"的券("+activeNewlywedsChild.getGiftCardDetail()+");";
}
if (activeNewlywedsChild.getActiveGift().equals("2")){
//兑换券
cardo1 += activeNewlywedsChild.getGiftCardName()+"的券;";
}
}
}
//邀请人的券
//积分
activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString());
//成长值
activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString());
activeNewlywedsAppletVO.setNewlywedsActiveDescribe("欢迎各位亲朋好友参加本店的新人有礼活动,我们有丰厚的奖励哦,参加即送优惠券:"+cardi1+"兑换券:"+cardo1);
return activeNewlywedsAppletVO;
}
//邀请人的券
//积分
activeNewlywedsAppletVO.setPoint(activeNewlywedsVO.getPoints().toString());
//成长值
activeNewlywedsAppletVO.setGrowValue(activeNewlywedsVO.getGrowthValue().toString());
activeNewlywedsAppletVO.setNewlywedsActiveDescribe("欢迎各位亲朋好友参加本店的新人有礼活动,我们有丰厚的奖励哦,参加即送优惠券:"+cardi1+"兑换券:"+cardo1);
return activeNewlywedsAppletVO;
}

View File

@ -46,6 +46,21 @@ public class CardFavorableController extends BaseController {
return getSuccessResult(this.cardFavorableService.select(page,cardFavorable));
}
/**分页查询所有数据(小程序端)
*
* @param pageNo
* @param pageSize
* @param cardFavorable
* @return
*/
@GetMapping("appletList")
public ResponseObject selectAllApplet(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorable cardFavorable) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFavorableService.selectAllApplet(page,cardFavorable));
}
/**
* 通过主键查询单条数据
*

View File

@ -2,6 +2,7 @@ package com.fuint.business.marketingActivity.cardFavorable.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFavorable.dto.IdListDTO;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
@ -90,7 +91,7 @@ public class CardFavorableRecordController extends BaseController {
* @return 新增结果
*/
@PostMapping("drawDown")
public ResponseObject drawDown(@RequestParam("idList") List<Integer> idList) {
public ResponseObject drawDown(@RequestBody IdListDTO idList) {
return getSuccessResult(this.cardFavorableRecordService.drawDown(idList));
}

View File

@ -0,0 +1,11 @@
package com.fuint.business.marketingActivity.cardFavorable.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class IdListDTO implements Serializable {
private List<Integer> idList;
}

View File

@ -70,7 +70,8 @@
card_favorable cf
LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id
WHERE
cfr.mt_user_id = #{cardFavorableDTOS.id} UNION ALL
cfr.mt_user_id = #{cardFavorableDTOS.id}
and cfr.status = #{cardFavorableDTOS.useStatus} UNION ALL
SELECT
'兑换券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent
@ -79,7 +80,8 @@
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardFavorableDTOS.id}
and ce.type = 0 UNION ALL
and ce.type = 0
and cer.status = #{cardFavorableDTOS.useStatus} UNION ALL
SELECT
'洗车券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent
@ -88,7 +90,8 @@
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardFavorableDTOS.id}
and ce.type = 1 UNION ALL
and ce.type = 1
and cer.status = #{cardFavorableDTOS.useStatus} UNION ALL
SELECT
'洗车卡' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent
@ -97,7 +100,8 @@
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardFavorableDTOS.id}
and ce.type = 2) AS card_favorables
and ce.type = 2
and cer.status = #{cardFavorableDTOS.useStatus}) AS card_favorables
<where>
<if test="cardFavorableDTOS.couponType != null">
and card_favorables.couponType = #{cardFavorableDTOS.couponType}

View File

@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardFavorable.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardFavorable.dto.IdListDTO;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
@ -40,7 +41,7 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
* @param idList
* @return
*/
boolean drawDown(List<Integer> idList);
boolean drawDown(IdListDTO idList);
/**
* 小程序端判断是否领取优惠券

View File

@ -33,6 +33,14 @@ public interface CardFavorableService extends IService<CardFavorable> {
*/
IPage select(Page page, CardFavorable cardFavorable);
/**
* 小程序端
* @param page
* @param cardFavorable
* @return
*/
IPage selectAllApplet(Page page, CardFavorable cardFavorable);
/**
* 通过主键查询单条数据
* @param id

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardFavorable.dto.IdListDTO;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
@ -96,13 +97,13 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
* @return
*/
@Override
public boolean drawDown(List<Integer> idList) {
public boolean drawDown(IdListDTO idList) {
boolean save = false;
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer userId = nowAccountInfo.getId();
LJUserVo ljUserVo = userService.selectUserById(userId);
//优惠券
for (Integer id : idList) {
for (Integer id : idList.getIdList()) {
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setCardFavorableId(id);
cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId());
@ -131,7 +132,7 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
queryWrapper.eq(CardFavorableRecord::getStoreId,nowAccountInfo.getStoreId());
//如果领过券 就不让领了
List<CardFavorableRecord> list = list(queryWrapper);
if (CollectionUtils.isNotEmpty(list) && list.size() == 0){
if (CollectionUtils.isEmpty(list)){
isDrawDown = true;
}
return isDrawDown;

View File

@ -78,9 +78,49 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
* @return
*/
@Override
public IPage select(Page page, CardFavorable cardFavorable) {
public IPage selectAllApplet(Page page, CardFavorable cardFavorable) {
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
//构建查询条件
LambdaQueryWrapper<CardFavorable> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardFavorable::getStoreId,storeId);
if(ObjectUtils.isNotEmpty(cardFavorable.getName())){
queryWrapper.like(CardFavorable::getName,cardFavorable.getName());
}
if (ObjectUtils.isNotEmpty(cardFavorable.getType())){
queryWrapper.eq(CardFavorable::getType,cardFavorable.getType());
}
if (ObjectUtils.isNotEmpty(cardFavorable.getDiscountType())){
queryWrapper.eq(CardFavorable::getDiscountType,cardFavorable.getDiscountType());
}
if(ObjectUtils.isNotEmpty(cardFavorable.getStatus())) {
queryWrapper.eq(CardFavorable::getStatus,cardFavorable.getStatus());
}
if(ObjectUtils.isNotEmpty(cardFavorable.getIsonline())) {
queryWrapper.eq(CardFavorable::getIsonline,cardFavorable.getIsonline());
}
queryWrapper.eq(CardFavorable::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
queryWrapper.orderByDesc(CardFavorable::getCreateTime);
IPage page1 = page(page, queryWrapper);
List<CardFavorable> records = page1.getRecords();
if (records.size()>3){
List<CardFavorable> cardFavorables = records.subList(0, 3);
page1.setRecords(cardFavorables);
}
return page1;
}
/**
* 分页查询所有数据小程序端
* @param page
* @param cardFavorable
* @return
*/
@Override
public IPage select(Page page, CardFavorable cardFavorable) {
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
//构建查询条件
LambdaQueryWrapper<CardFavorable> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardFavorable::getStoreId,storeId);
if(ObjectUtils.isNotEmpty(cardFavorable.getName())){
queryWrapper.like(CardFavorable::getName,cardFavorable.getName());
}

View File

@ -86,6 +86,17 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
//获取礼品卡总额度
LambdaQueryWrapper<OilDepotConfig> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OilDepotConfig::getStoreId, storeId);
OilDepotConfig oilDepotConfig2 = oilDepotConfigService.getOne(queryWrapper);
//没有先新增
if (ObjectUtils.isEmpty(oilDepotConfig2) || ObjectUtils.isEmpty(oilDepotConfig2.getId())){
OilDepotConfig oilDepotConfig1 = new OilDepotConfig();
oilDepotConfig1.setStoreId(storeId);
oilDepotConfig1.setTotalAmount(2000);
oilDepotConfig1.setExchangeStatus("0");
oilDepotConfig1.setCreateBy(TokenUtil.getNowAccountInfo().getRealName());
oilDepotConfig1.setCreateTime(new Date());
oilDepotConfigService.save(oilDepotConfig1);
}
OilDepotConfig oilDepotConfig = oilDepotConfigService.getOne(queryWrapper);
//礼品卡兑换功能状态
if (ObjectUtils.isNotEmpty(oilDepotConfig) && StringUtils.isNotEmpty(oilDepotConfig.getExchangeStatus())){

View File

@ -36,7 +36,7 @@
</view>
<view class="box-bottom">
<view class="">活动时间</view>
<view>{{item.time}}</view>
<view>{{item.time || ''}}</view>
</view>
</view>
</view>

View File

@ -22,7 +22,7 @@
<view class="dis-but">
<view class="bai-box">
<view class="">通用余额</view>
<view class=""> <text style="font-weight: bold;font-size: 26px;">{{cardBalance || ''}}</text>
<view class=""> <text style="font-weight: bold;font-size: 26px;">{{cardBalance || '0'}}</text>
</view>
</view>
<view class="anniu-cz" @click="gocard(0)">
@ -56,14 +56,14 @@
<view style="width: 100%;display: flex;align-items: center;justify-content: space-between; ">
<view class="bai-box">
<view class="title-card">囤油卡</view>
<view class="">{{cardsList[cardsIndex].type || '暂无囤油'}}:{{cardsList[cardsIndex].oilType || ''}}
<view class="">{{cardsList[cardsIndex].type || '暂无囤油'}}:{{cardsList[cardsIndex].oilType || '0'}}
</view>
<!-- <view style="lins"> **** **** **** 970 </view> -->
</view>
<view class="">
<!-- <view class="">
<uni-icons type="eye-slash-filled" color="#ffffff" size="30"
style="margin-right: 15px;"></uni-icons>
</view>
</view> -->
</view>
<view class="z_yw">
<view class="anniu-cz" @click="gocard(1)">
@ -91,8 +91,8 @@
<view style="width: 100%;display: flex;align-items: center;justify-content: space-between; ">
<view class="bai-box">
<view class="title-card">礼品卡</view>
<view class="">卡号:454545578545</view>
<view style="lins"> 卡密: **** **** **** 970 </view>
<view class="">卡号:**** **** **** ****</view>
<view style="lins"> 卡密: **** **** **** **** </view>
</view>
<view class="">
<uni-icons type="eye-slash-filled" color="#ffffff" size="30"

View File

@ -111,7 +111,7 @@
<view class="h_size">{{datas.newlywedsActiveDescribe || ""}}</view>
<view class="box-bottom">
<view class="">活动时间</view>
<view>{{datas.time}}</view>
<view>{{datas.time || ''}}</view>
</view>
<!-- <view class="title-box">参与油品</view> -->
<!-- <view class="w_box">
@ -124,11 +124,11 @@
</view> -->
<view class="dis-box">
<view class="dian" style="background: #FA5E03;"></view>
<view class="h_size">赠送{{datas.point}}积分</view>
<view class="h_size">赠送{{datas.point || ''}}积分</view>
</view>
<view class="dis-box">
<view class="dian" style="background: #FA5E03;"></view>
<view class="h_size">赠送{{datas.growValue}}成长值</view>
<view class="h_size">赠送{{datas.growValue || ''}}成长值</view>
</view>
</view>
</view>
@ -150,11 +150,11 @@
</view> -->
<view class="dis-box">
<view class="dian" style="background: #FA5E03;"></view>
<view class="h_size">赠送{{datas.point}}积分</view>
<view class="h_size">赠送{{datas.point || ''}}积分</view>
</view>
<view class="dis-box">
<view class="dian" style="background: #FA5E03;"></view>
<view class="h_size">赠送{{datas.growValue}}成长值</view>
<view class="h_size">赠送{{datas.growValue || ''}}成长值</view>
</view>
</view>
</view>

View File

@ -60,7 +60,7 @@
export default {
data() {
return {
idList: [18, 19],
idList: [],
cardFavorableList: [],
cardsList: [],
shows: true,
@ -108,13 +108,16 @@
methods: {
getAllCardFavorables() {
request({
url: 'business/marketingActivity/cardFavorable',
url: 'business/marketingActivity/cardFavorable/appletList',
method: 'get',
params: this.query
}).then(res => {
if (res.code == 200) {
this.cardFavorableList = res.data.records;
console.log("555" + this.cardFavorableList)
// console.log("555" + this.cardFavorableList)
for (var i = 0; i < res.data.records.length; i++) {
this.idList.push(res.data.records[i].id)
}
/* this.cardFavorableList.forEach(item => this.idList.push(item.id));
console.log("333" + idList) */
}
@ -124,9 +127,9 @@
request({
url: 'business/marketingActivity/cardFavorableRecord/drawDown',
method: 'post',
/* data: {
idList: [18, 19]
} */
data: {
idList: this.idList
}
}).then(res => {
console.log("222" + res)
if (res.code == 200 && res.data == true) {