From a529c7e67eb904417418e712fd933376e09fd80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Wed, 3 Jan 2024 15:43:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/ActiveRecommendRecords.java | 93 +------------------ .../mapper/xml/CardFavorableRecordMapper.xml | 11 ++- .../service/CardFavorableRecordService.java | 7 ++ .../impl/CardFavorableRecordServiceImpl.java | 30 ++++++ .../cardFavorable/vo/CouponVO.java | 2 + .../cardValue/dto/CardValueRecordDTO.java | 5 +- .../impl/CardValueRecordServiceImpl.java | 91 +++++------------- .../entity/CardValueOrders.java | 2 + .../pagesHome/oilRecharge/oilRecharge.vue | 9 +- gasStation-uni/pagesMy/Coupons/Coupons.vue | 9 +- 10 files changed, 91 insertions(+), 168 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java index de9da036c..06fee4766 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java @@ -34,6 +34,8 @@ public class ActiveRecommendRecords extends Model { private String inviteeUserId; //被邀请人姓名 private String inviteeUserName; + //来源 + private String type; //创建者 private String createBy; //创建时间 @@ -44,96 +46,5 @@ public class ActiveRecommendRecords extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getActiveNewlywedsId() { - return activeNewlywedsId; - } - - public void setActiveNewlywedsId(Integer activeNewlywedsId) { - this.activeNewlywedsId = activeNewlywedsId; - } - - public Integer getChainStoreId() { - return chainStoreId; - } - - public void setChainStoreId(Integer chainStoreId) { - this.chainStoreId = chainStoreId; - } - - public Integer getStoreId() { - return storeId; - } - - public void setStoreId(Integer storeId) { - this.storeId = storeId; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getInviteeUserId() { - return inviteeUserId; - } - - public void setInviteeUserId(String inviteeUserId) { - this.inviteeUserId = inviteeUserId; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } } 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 d89773cdf..ca17cfaa6 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 @@ -61,11 +61,12 @@ card_favorables.couponName, card_favorables.id, card_favorables.couponAmount, - card_favorables.couponContent + card_favorables.couponContent, + card_favorables.cardRecordId from (SELECT '优惠券' AS couponType, - cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.satisfied_amount couponContent + cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.satisfied_amount couponContent,cfr.id cardRecordId FROM card_favorable cf LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id @@ -75,7 +76,7 @@ and cfr.store_id = #{cardFavorableDTOS.storeId} UNION ALL SELECT '兑换券' AS couponType, - ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent + ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId FROM card_exchange_record cer LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id @@ -86,7 +87,7 @@ and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL SELECT '洗车券' AS couponType, - ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent + ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId FROM card_exchange_record cer LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id @@ -97,7 +98,7 @@ and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL SELECT '洗车卡' AS couponType, - ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent + ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId FROM card_exchange_record cer LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id 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 f0f15ecf1..12092cb70 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 @@ -48,5 +48,12 @@ public interface CardFavorableRecordService extends IService cardValueVouchers = getCardValueVouchers(cardValue); - //筛选符合条件的优惠券并计算优惠金额 - if (CollectionUtils.isNotEmpty(cardValueVouchers)) { - for (CardFavorable cardValueVoucher : cardValueVouchers) { - if (ObjectUtils.isNotEmpty(cardValueVoucher)){ - cardValueOrders.setCardFavorableId(cardValueVoucher.getId()); - CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); - cardFavorableRecord.setCardFavorableId(cardValueVoucher.getId()); - cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId()); - cardFavorableRecord.setMtUserId(nowAccountInfo.getId()); - cardFavorableRecord.setName(nowAccountInfo.getRealName()); - cardFavorableRecord.setMobile(ljUserVo.getMobile()); - cardFavorableRecord.setStatus("0"); - cardFavorableRecord.setExchangeFrom("充值送券"); - cardFavorableRecordService.save(cardFavorableRecord); - } - *//* - if (cardValue.getRechargeBalance() >= cardValueVoucher.getSatisfiedAmount()) { - cardFavorableValue += cardValueVoucher.getDiscountAmount(); - }*//* + //优惠券优惠金额 + if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getCardFavorableId())){ + CardFavorable cardFavorable = cardFavorableService.getById(cardValueRecordDTO.getCardFavorableId()); + if (cardValue.getRechargeBalance() >= cardFavorable.getSatisfiedAmount()) { + cardFavorableValue += cardFavorable.getDiscountAmount(); } - }*/ - /*//查询储值卡对应的兑换券列表 - List cardExchangeVouchers = getCardExchangeVouchers(cardValue); - if (CollectionUtils.isNotEmpty(cardExchangeVouchers)){ - for (CardExchange cardExchangeVoucher : cardExchangeVouchers) { - if (ObjectUtils.isNotEmpty(cardExchangeVoucher)){ - CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); - cardValueOrders.setCardExchangeId(cardExchangeVoucher.getId()); - cardExchangeRecord.setCardExchangeId(cardExchangeVoucher.getId()); - cardExchangeRecord.setStoreId(ljUserVo.getStoreId()); - cardExchangeRecord.setMtUserId(ljUserVo.getId()); - cardExchangeRecord.setName(ljUserVo.getName()); - cardExchangeRecord.setMobile(ljUserVo.getMobile()); - cardExchangeRecord.setPhoto(ljUserVo.getAvatar()); - cardExchangeRecord.setMtStaffId(ljStaff.getId()); - cardExchangeRecord.setRealName(ljStaff.getRealName()); - cardExchangeRecord.setStaffMobile(ljStaff.getMobile()); - cardExchangeRecord.setExchangeName(cardExchangeVoucher.getName()); - cardExchangeRecord.setExchangeFrom("充值送券"); - cardExchangeRecord.setGiftName(cardExchangeVoucher.getGiftName()); - cardExchangeRecord.setDescription(cardExchangeVoucher.getUseInstructions()); - cardExchangeRecord.setStatus("0"); - cardExchangeRecord.setStartTime(cardExchangeVoucher.getCreateTime()); - cardExchangeRecord.setEndTime(cardExchangeVoucher.getOutTime()); - cardExchangeRecordService.save(cardExchangeRecord); - } - } - }*/ + } //订单号 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); String timestamp = dateFormat.format(new Date()); @@ -222,6 +180,14 @@ public class CardValueRecordServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(CardFavorableRecord::getId,cardValueOrders.getCardRecordId()); + lambdaQueryWrapper.eq(CardFavorableRecord::getStatus,"1");*/ + cardFavorableRecordService.updateById(cardFavorableRecord); + } //查询储值卡对应的优惠券列表 List cardValueVouchers = getCardValueVouchers(cardValue); //送优惠券兑换券 @@ -789,7 +749,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl { private Integer cardFavorableId; //兑换券id private Integer cardExchangeId; + //卡券领取记录id + private Integer cardRecordId; //创建者 private String createBy; //创建时间 diff --git a/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue b/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue index 5ba07927b..368752d8e 100644 --- a/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue +++ b/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue @@ -149,6 +149,8 @@ export default { data() { return { + cardRecordId: '', + cardFavorableId: '', storeId: '', staffId: '', carValueId: '', @@ -198,6 +200,9 @@ onLoad(option) { this.storeId = uni.getStorageSync("storeId") this.actinput = option.id + this.cardFavorableId = option.cardFavorableId + this.cardRecordId = option.cardRecordId + console.log('11111111111111', this.cardRecordId); if (option.id == 0) { this.getValueCars(); } @@ -235,7 +240,9 @@ payType: 'WECHAT', mtStaffId: this.staffId, id: this.carValueId, - storeId: this.storeId + storeId: this.storeId, + cardFavorableId: this.cardFavorableId, + cardRecordId: this.cardRecordId }, }).then(res => { if (res.code === 200) { diff --git a/gasStation-uni/pagesMy/Coupons/Coupons.vue b/gasStation-uni/pagesMy/Coupons/Coupons.vue index 2ceda3c01..0323402b3 100644 --- a/gasStation-uni/pagesMy/Coupons/Coupons.vue +++ b/gasStation-uni/pagesMy/Coupons/Coupons.vue @@ -26,7 +26,8 @@ {{item.couponContent}} 有效期:2023-11-30 - + 立即使用 @@ -104,7 +105,6 @@ onShow() { this.query.storeId = uni.getStorageSync("storeId") this.isDrawDown(); - console.log(this.query); }, @@ -164,9 +164,10 @@ this.getAllCardFavorables(); }) }, - goRecharge() { + goRecharge(id, cardRecordId) { uni.navigateTo({ - url: '/pagesHome/oilRecharge/oilRecharge?id=0' + url: '/pagesHome/oilRecharge/oilRecharge?id=0&cardFavorableId=' + id + '&cardRecordId=' + + cardRecordId }) }, click(item) { From 93e3d51e5b1af800f720f30cf8d32d9b08dc21d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Wed, 3 Jan 2024 16:02:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardExchange/entity/CardExchange.java | 149 +----------------- .../service/CardExchangeRecordService.java | 7 + .../impl/CardExchangeRecordServiceImpl.java | 21 +++ .../impl/CardValueRecordServiceImpl.java | 9 +- 4 files changed, 32 insertions(+), 154 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/entity/CardExchange.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/entity/CardExchange.java index 1971723da..5cfe3416b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/entity/CardExchange.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/entity/CardExchange.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; import java.io.Serializable; @@ -16,6 +17,7 @@ import java.io.Serializable; * @since 2023-11-06 14:14:17 */ @SuppressWarnings("serial") +@Data public class CardExchange extends Model { //主键id @TableId(type = IdType.AUTO) @@ -55,152 +57,5 @@ public class CardExchange extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getChainStorId() { - return chainStorId; - } - - public void setChainStorId(Integer chainStorId) { - this.chainStorId = chainStorId; - } - - public Integer getStoreId() { - return storeId; - } - - public void setStoreId(Integer storeId) { - this.storeId = storeId; - } - - public String getIsonline() { - return isonline; - } - - public void setIsonline(String isonline) { - this.isonline = isonline; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getGiftName() { - return giftName; - } - - public void setGiftName(String giftName) { - this.giftName = giftName; - } - - public Integer getValidity() { - return validity; - } - - public void setValidity(Integer validity) { - this.validity = validity; - } - - public String getUseInstructions() { - return useInstructions; - } - - public void setUseInstructions(String useInstructions) { - this.useInstructions = useInstructions; - } - - public String getQrCodeLink() { - return qrCodeLink; - } - - public void setQrCodeLink(String qrCodeLink) { - this.qrCodeLink = qrCodeLink; - } - - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } - - public Date getOutTime() { - return outTime; - } - - public void setOutTime(Date outTime) { - this.outTime = outTime; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取主键值 - * - * @return 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/CardExchangeRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/CardExchangeRecordService.java index 95f8db5e9..4cc838c4e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/CardExchangeRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/CardExchangeRecordService.java @@ -40,5 +40,12 @@ public interface CardExchangeRecordService extends IService * @return */ IPage selectCancelRecords (Page page, CardExchangeRecordDTO cardExchangeRecordDTO); + + /** + * 兑换券领取通用接口 + * @param cardExchangeRecord + * @return + */ + boolean addCardExchangeRecord(CardExchangeRecord cardExchangeRecord); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/impl/CardExchangeRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/impl/CardExchangeRecordServiceImpl.java index 9e206a794..4b6e3d48b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/impl/CardExchangeRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/service/impl/CardExchangeRecordServiceImpl.java @@ -5,9 +5,11 @@ 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.cardExchange.dto.CardExchangeRecordDTO; +import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange; import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeRecordMapper; import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord; import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService; +import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService; import com.fuint.business.marketingActivity.cardExchange.vo.CardExchangeRecordVO; import com.fuint.business.store.service.StoreService; import com.fuint.common.util.TokenUtil; @@ -15,6 +17,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; /** @@ -29,6 +32,8 @@ public class CardExchangeRecordServiceImpl extends ServiceImpl