diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java index e8e979b80..8705e5b80 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java @@ -221,41 +221,44 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl idList) { + public ResponseObject drawDown(@RequestBody IdListDTO idList) { return getSuccessResult(this.cardFavorableRecordService.drawDown(idList)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/dto/IdListDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/dto/IdListDTO.java new file mode 100644 index 000000000..4119eb70d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/dto/IdListDTO.java @@ -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 idList; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml index 3da638087..a0016a8cd 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml @@ -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 and card_favorables.couponType = #{cardFavorableDTOS.couponType} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java index 337b0c8d1..ef877a4d1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java @@ -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 idList); + boolean drawDown(IdListDTO idList); /** * 小程序端判断是否领取优惠券 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableService.java index 6c98b3de8..0f3d8ccc9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableService.java @@ -33,6 +33,14 @@ public interface CardFavorableService extends IService { */ IPage select(Page page, CardFavorable cardFavorable); + /** + * 小程序端 + * @param page + * @param cardFavorable + * @return + */ + IPage selectAllApplet(Page page, CardFavorable cardFavorable); + /** * 通过主键查询单条数据 * @param id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java index cb5898ce3..8e5794d64 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java @@ -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 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 list = list(queryWrapper); - if (CollectionUtils.isNotEmpty(list) && list.size() == 0){ + if (CollectionUtils.isEmpty(list)){ isDrawDown = true; } return isDrawDown; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java index 3e11e934d..1e8729e9b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java @@ -78,9 +78,49 @@ public class CardFavorableServiceImpl extends ServiceImpl 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 records = page1.getRecords(); + if (records.size()>3){ + List 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 queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CardFavorable::getStoreId,storeId); if(ObjectUtils.isNotEmpty(cardFavorable.getName())){ queryWrapper.like(CardFavorable::getName,cardFavorable.getName()); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java index 7d4b10032..857140129 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java @@ -86,6 +86,17 @@ public class CardGiftServiceImpl extends ServiceImpl i //获取礼品卡总额度 LambdaQueryWrapper 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())){ diff --git a/gasStation-uni/pagesHome/Activity/index.vue b/gasStation-uni/pagesHome/Activity/index.vue index 3d4f905f8..db4ab51a7 100644 --- a/gasStation-uni/pagesHome/Activity/index.vue +++ b/gasStation-uni/pagesHome/Activity/index.vue @@ -36,7 +36,7 @@ 活动时间 - {{item.time}} + {{item.time || ''}} diff --git a/gasStation-uni/pagesHome/MyCard/MyCard.vue b/gasStation-uni/pagesHome/MyCard/MyCard.vue index dfd091dc0..f41eb3a91 100644 --- a/gasStation-uni/pagesHome/MyCard/MyCard.vue +++ b/gasStation-uni/pagesHome/MyCard/MyCard.vue @@ -22,7 +22,7 @@ 通用余额 - {{cardBalance || ''}} + {{cardBalance || '0'}} @@ -56,14 +56,14 @@ 囤油卡 - {{cardsList[cardsIndex].type || '暂无囤油'}}:{{cardsList[cardsIndex].oilType || ''}} + {{cardsList[cardsIndex].type || '暂无囤油'}}:{{cardsList[cardsIndex].oilType || '0'}} - + @@ -91,8 +91,8 @@ 礼品卡 - 卡号:454545578545 - 卡密: **** **** **** 970 + 卡号:**** **** **** **** + 卡密: **** **** **** **** {{datas.newlywedsActiveDescribe || ""}} 活动时间 - {{datas.time}} + {{datas.time || ''}} - 赠送{{datas.point}}积分 + 赠送{{datas.point || ''}}积分 - 赠送{{datas.growValue}}成长值 + 赠送{{datas.growValue || ''}}成长值 @@ -150,11 +150,11 @@ --> - 赠送{{datas.point}}积分 + 赠送{{datas.point || ''}}积分 - 赠送{{datas.growValue}}成长值 + 赠送{{datas.growValue || ''}}成长值 diff --git a/gasStation-uni/pagesMy/Coupons/Coupons.vue b/gasStation-uni/pagesMy/Coupons/Coupons.vue index 911a3bb1b..e01c74ddd 100644 --- a/gasStation-uni/pagesMy/Coupons/Coupons.vue +++ b/gasStation-uni/pagesMy/Coupons/Coupons.vue @@ -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) {