修改bug

This commit is contained in:
齐天大圣 2024-01-03 15:43:34 +08:00
parent 99767393bc
commit a529c7e67e
10 changed files with 91 additions and 168 deletions

View File

@ -34,6 +34,8 @@ public class ActiveRecommendRecords extends Model<ActiveRecommendRecords> {
private String inviteeUserId; private String inviteeUserId;
//被邀请人姓名 //被邀请人姓名
private String inviteeUserName; private String inviteeUserName;
//来源
private String type;
//创建者 //创建者
private String createBy; private String createBy;
//创建时间 //创建时间
@ -44,96 +46,5 @@ public class ActiveRecommendRecords extends Model<ActiveRecommendRecords> {
//更新时间 //更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; 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;
}
} }

View File

@ -61,11 +61,12 @@
card_favorables.couponName, card_favorables.couponName,
card_favorables.id, card_favorables.id,
card_favorables.couponAmount, card_favorables.couponAmount,
card_favorables.couponContent card_favorables.couponContent,
card_favorables.cardRecordId
from from
(SELECT (SELECT
'优惠券' AS couponType, '优惠券' 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 FROM
card_favorable cf card_favorable cf
LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id 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 and cfr.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT SELECT
'兑换券' AS couponType, '兑换券' 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 FROM
card_exchange_record cer card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
@ -86,7 +87,7 @@
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT SELECT
'洗车券' AS couponType, '洗车券' 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 FROM
card_exchange_record cer card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
@ -97,7 +98,7 @@
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT SELECT
'洗车卡' AS couponType, '洗车卡' 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 FROM
card_exchange_record cer card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id

View File

@ -48,5 +48,12 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
* @return * @return
*/ */
boolean isDrawDown(CardFavorableRecord cardFavorableRecord); boolean isDrawDown(CardFavorableRecord cardFavorableRecord);
/**
* 通用优惠券领取接口
* @param cardFavorableRecord
* @return
*/
boolean addCardFavorableRecord(CardFavorableRecord cardFavorableRecord);
} }

View File

@ -157,5 +157,35 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
} }
return isDrawDown; return isDrawDown;
} }
/**
* 通用优惠券领取接口
* @param cardFavorableRecord
* @return
*/
@Override
public boolean addCardFavorableRecord(CardFavorableRecord cardFavorableRecord) {
CardFavorable cardFavorable = cardFavorableService.getById(cardFavorableRecord.getCardFavorableId());
if (ObjectUtils.isNotEmpty(cardFavorable)){
//优惠券开始结束时间
if (ObjectUtils.isNotEmpty(cardFavorable) && ObjectUtils.isNotEmpty(cardFavorable.getTimeType())) {
if (cardFavorable.getTimeType().equals("0")) {
cardFavorableRecord.setStartTime(new Date());
long endTimeL = new Date().getTime() + cardFavorable.getValidityZero() * 86400000;
cardFavorableRecord.setEndTime(new Date(endTimeL));
} else if (cardFavorable.getTimeType().equals("1")) {
cardFavorableRecord.setStartTime(cardFavorable.getEffectiveDate());
long endTimeM = cardFavorable.getEffectiveDate().getTime() + cardFavorable.getValidityOne() * 86400000;
cardFavorableRecord.setEndTime(new Date(endTimeM));
} else {
long startTimeN = new Date().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L;
long endTimeN = startTimeN + cardFavorable.getValidityTwo() * 86400000L;
cardFavorableRecord.setStartTime(new Date(startTimeN));
cardFavorableRecord.setEndTime(new Date(endTimeN));
}
}
}
return save(cardFavorableRecord);
}
} }

View File

@ -8,6 +8,8 @@ import java.io.Serializable;
public class CouponVO implements Serializable { public class CouponVO implements Serializable {
//券id //券id
private Integer id; private Integer id;
//卡券领取记录id
private Integer cardRecordId;
//券类型 //券类型
private String couponType; private String couponType;
//券金额 //券金额

View File

@ -14,7 +14,10 @@ public class CardValueRecordDTO extends CardValueRecord {
private Double realyPayBills; private Double realyPayBills;
//付款类型 1.微信 2.支付宝 //付款类型 1.微信 2.支付宝
private String payType; private String payType;
//优惠券 //优惠券id
private Integer cardFavorableId;
//卡券领取记录id
private Integer cardRecordId;
// /** // /**
// * 会员id // * 会员id

View File

@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardValue.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@ -136,56 +137,13 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){ if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){
cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit()); cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit());
} }
/*//查询储值卡对应的优惠券列表 //优惠券优惠金额
List<CardFavorable> cardValueVouchers = getCardValueVouchers(cardValue); if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getCardFavorableId())){
//筛选符合条件的优惠券并计算优惠金额 CardFavorable cardFavorable = cardFavorableService.getById(cardValueRecordDTO.getCardFavorableId());
if (CollectionUtils.isNotEmpty(cardValueVouchers)) { if (cardValue.getRechargeBalance() >= cardFavorable.getSatisfiedAmount()) {
for (CardFavorable cardValueVoucher : cardValueVouchers) { cardFavorableValue += cardFavorable.getDiscountAmount();
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();
}*//*
} }
}*/ }
/*//查询储值卡对应的兑换券列表
List<CardExchange> 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"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date()); String timestamp = dateFormat.format(new Date());
@ -222,6 +180,14 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
} }
//支付金额 //支付金额
cardValueOrders.setPayAmount(0.01); cardValueOrders.setPayAmount(0.01);
//优惠券id
if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getCardFavorableId())){
cardValueOrders.setCardFavorableId(cardValueRecordDTO.getCardFavorableId());
}
//卡券领取记录id
if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getCardRecordId())){
cardValueOrders.setCardRecordId(cardValueRecordDTO.getCardRecordId());
}
//优惠金额 //优惠金额
if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){ if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){
cardValueOrders.setDiscount(cardValue.getGiftBalance() + cardFavorableValue); cardValueOrders.setDiscount(cardValue.getGiftBalance() + cardFavorableValue);
@ -620,7 +586,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
*/ */
@Transactional @Transactional
public void rechargeFinallDeal(String orderNo){ public void rechargeFinallDeal(String orderNo){
//AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
UserBalance userBalance1 = new UserBalance(); UserBalance userBalance1 = new UserBalance();
CardValueRecord cardValueRecord = new CardValueRecord(); CardValueRecord cardValueRecord = new CardValueRecord();
CardBalanceChange cardBalanceChange = new CardBalanceChange(); CardBalanceChange cardBalanceChange = new CardBalanceChange();
@ -652,18 +617,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
afterBalance = userBalance.getCardBalance() + cardValueOrders.getAmount(); afterBalance = userBalance.getCardBalance() + cardValueOrders.getAmount();
userBalance.setCardBalance(afterBalance); userBalance.setCardBalance(afterBalance);
} }
//油量
/*if (ObjectUtils.isNotEmpty(userBalance.getRefuelMoney()) && ObjectUtils.isNotEmpty(cardValueOrders.getAmount())){
userBalance.setCardBalance(userBalance.getCardBalance() + cardValueOrders.getAmount());
}*/
//加油次数
/* Integer consumeNum = userBalance.getConsumeNum();
userBalance.setConsumeNum(consumeNum+=1);*/
userBalanceService.updateUserBalance(userBalance); userBalanceService.updateUserBalance(userBalance);
}else { }else {
userBalance1.setMtUserId(cardValueOrders.getMtUserId()); userBalance1.setMtUserId(cardValueOrders.getMtUserId());
userBalance1.setStoreId(cardValueOrders.getStoreId()); userBalance1.setStoreId(cardValueOrders.getStoreId());
//userBalance1.setChainStoreId(nowAccountInfo.getChainStoreId());
//积分 //积分
if (ObjectUtils.isNotEmpty(cardValueOrders.getPoints())){ if (ObjectUtils.isNotEmpty(cardValueOrders.getPoints())){
userBalance1.setPoints(cardValueOrders.getPoints()); userBalance1.setPoints(cardValueOrders.getPoints());
@ -677,17 +634,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
afterBalance = cardValueOrders.getAmount(); afterBalance = cardValueOrders.getAmount();
userBalance1.setCardBalance(afterBalance); userBalance1.setCardBalance(afterBalance);
} }
//油量
/*if (ObjectUtils.isNotEmpty(userBalance.getRefuelMoney()) && ObjectUtils.isNotEmpty(cardValueOrders.getAmount())){
userBalance.setCardBalance(userBalance.getCardBalance() + cardValueOrders.getAmount());
}*/
//加油次数
userBalance1.setConsumeNum(1);
userBalanceService.save(userBalance1); userBalanceService.save(userBalance1);
} }
//用户余额变化记录 //用户余额变化记录
cardBalanceChange.setUserId(cardValueOrders.getMtUserId()); cardBalanceChange.setUserId(cardValueOrders.getMtUserId());
//cardBalanceChange.setChainStoreId(nowAccountInfo.getChainStoreId());
cardBalanceChange.setStoreId(cardValueOrders.getStoreId()); cardBalanceChange.setStoreId(cardValueOrders.getStoreId());
cardBalanceChange.setChangeType("1"); cardBalanceChange.setChangeType("1");
cardBalanceChange.setFromType("储值卡充值"); cardBalanceChange.setFromType("储值卡充值");
@ -697,6 +647,16 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardBalanceChangeService.save(cardBalanceChange); cardBalanceChangeService.save(cardBalanceChange);
//查询储值卡信息 //查询储值卡信息
CardValueVO cardValue = cardValueService.getOneById(cardValueOrders.getCardValueId()); CardValueVO cardValue = cardValueService.getOneById(cardValueOrders.getCardValueId());
//更新所用优惠券状态
if (ObjectUtils.isNotEmpty(cardValueOrders.getCardRecordId())){
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setId(cardValueOrders.getCardRecordId());
cardFavorableRecord.setStatus("1");
/*LambdaQueryWrapper<CardFavorableRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CardFavorableRecord::getId,cardValueOrders.getCardRecordId());
lambdaQueryWrapper.eq(CardFavorableRecord::getStatus,"1");*/
cardFavorableRecordService.updateById(cardFavorableRecord);
}
//查询储值卡对应的优惠券列表 //查询储值卡对应的优惠券列表
List<CardFavorable> cardValueVouchers = getCardValueVouchers(cardValue); List<CardFavorable> cardValueVouchers = getCardValueVouchers(cardValue);
//送优惠券兑换券 //送优惠券兑换券
@ -789,7 +749,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueRecord.setPayStatus("paid"); cardValueRecord.setPayStatus("paid");
cardValueRecord.setStoreId(cardValueOrders.getStoreId()); cardValueRecord.setStoreId(cardValueOrders.getStoreId());
cardValueRecord.setPaymentNo(cardValueOrders.getOrderNo()); cardValueRecord.setPaymentNo(cardValueOrders.getOrderNo());
//cardValueRecord.setChainStoreId(nowAccountInfo.getChainStoreId());
save(cardValueRecord); save(cardValueRecord);
} }

View File

@ -81,6 +81,8 @@ public class CardValueOrders extends Model<CardValueOrders> {
private Integer cardFavorableId; private Integer cardFavorableId;
//兑换券id //兑换券id
private Integer cardExchangeId; private Integer cardExchangeId;
//卡券领取记录id
private Integer cardRecordId;
//创建者 //创建者
private String createBy; private String createBy;
//创建时间 //创建时间

View File

@ -149,6 +149,8 @@
export default { export default {
data() { data() {
return { return {
cardRecordId: '',
cardFavorableId: '',
storeId: '', storeId: '',
staffId: '', staffId: '',
carValueId: '', carValueId: '',
@ -198,6 +200,9 @@
onLoad(option) { onLoad(option) {
this.storeId = uni.getStorageSync("storeId") this.storeId = uni.getStorageSync("storeId")
this.actinput = option.id this.actinput = option.id
this.cardFavorableId = option.cardFavorableId
this.cardRecordId = option.cardRecordId
console.log('11111111111111', this.cardRecordId);
if (option.id == 0) { if (option.id == 0) {
this.getValueCars(); this.getValueCars();
} }
@ -235,7 +240,9 @@
payType: 'WECHAT', payType: 'WECHAT',
mtStaffId: this.staffId, mtStaffId: this.staffId,
id: this.carValueId, id: this.carValueId,
storeId: this.storeId storeId: this.storeId,
cardFavorableId: this.cardFavorableId,
cardRecordId: this.cardRecordId
}, },
}).then(res => { }).then(res => {
if (res.code === 200) { if (res.code === 200) {

View File

@ -26,7 +26,8 @@
<view class="hui-size">{{item.couponContent}}</view> <view class="hui-size">{{item.couponContent}}</view>
<view class="dis-bt"> <view class="dis-bt">
<view class="hui-size">有效期2023-11-30</view> <view class="hui-size">有效期2023-11-30</view>
<view class="anniu" v-if="item.couponType == '优惠券'" @click="goRecharge()"> <view class="anniu" v-if="item.couponType == '优惠券'"
@click="goRecharge(item.id,item.cardRecordId)">
<text>立即使用</text> <text>立即使用</text>
</view> </view>
</view> </view>
@ -104,7 +105,6 @@
onShow() { onShow() {
this.query.storeId = uni.getStorageSync("storeId") this.query.storeId = uni.getStorageSync("storeId")
this.isDrawDown(); this.isDrawDown();
console.log(this.query); console.log(this.query);
}, },
@ -164,9 +164,10 @@
this.getAllCardFavorables(); this.getAllCardFavorables();
}) })
}, },
goRecharge() { goRecharge(id, cardRecordId) {
uni.navigateTo({ uni.navigateTo({
url: '/pagesHome/oilRecharge/oilRecharge?id=0' url: '/pagesHome/oilRecharge/oilRecharge?id=0&cardFavorableId=' + id + '&cardRecordId=' +
cardRecordId
}) })
}, },
click(item) { click(item) {