修改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 inviteeUserName;
//来源
private String type;
//创建者
private String createBy;
//创建时间
@ -44,96 +46,5 @@ public class ActiveRecommendRecords extends Model<ActiveRecommendRecords> {
//更新时间
@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;
}
}

View File

@ -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

View File

@ -48,5 +48,12 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
* @return
*/
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;
}
/**
* 通用优惠券领取接口
* @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 {
//券id
private Integer id;
//卡券领取记录id
private Integer cardRecordId;
//券类型
private String couponType;
//券金额

View File

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

View File

@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardValue.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@ -136,56 +137,13 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){
cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit());
}
/*//查询储值卡对应的优惠券列表
List<CardFavorable> 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<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");
String timestamp = dateFormat.format(new Date());
@ -222,6 +180,14 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
}
//支付金额
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())){
cardValueOrders.setDiscount(cardValue.getGiftBalance() + cardFavorableValue);
@ -620,7 +586,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
*/
@Transactional
public void rechargeFinallDeal(String orderNo){
//AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
UserBalance userBalance1 = new UserBalance();
CardValueRecord cardValueRecord = new CardValueRecord();
CardBalanceChange cardBalanceChange = new CardBalanceChange();
@ -652,18 +617,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
afterBalance = userBalance.getCardBalance() + cardValueOrders.getAmount();
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);
}else {
userBalance1.setMtUserId(cardValueOrders.getMtUserId());
userBalance1.setStoreId(cardValueOrders.getStoreId());
//userBalance1.setChainStoreId(nowAccountInfo.getChainStoreId());
//积分
if (ObjectUtils.isNotEmpty(cardValueOrders.getPoints())){
userBalance1.setPoints(cardValueOrders.getPoints());
@ -677,17 +634,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
afterBalance = cardValueOrders.getAmount();
userBalance1.setCardBalance(afterBalance);
}
//油量
/*if (ObjectUtils.isNotEmpty(userBalance.getRefuelMoney()) && ObjectUtils.isNotEmpty(cardValueOrders.getAmount())){
userBalance.setCardBalance(userBalance.getCardBalance() + cardValueOrders.getAmount());
}*/
//加油次数
userBalance1.setConsumeNum(1);
userBalanceService.save(userBalance1);
}
//用户余额变化记录
cardBalanceChange.setUserId(cardValueOrders.getMtUserId());
//cardBalanceChange.setChainStoreId(nowAccountInfo.getChainStoreId());
cardBalanceChange.setStoreId(cardValueOrders.getStoreId());
cardBalanceChange.setChangeType("1");
cardBalanceChange.setFromType("储值卡充值");
@ -697,6 +647,16 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardBalanceChangeService.save(cardBalanceChange);
//查询储值卡信息
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);
//送优惠券兑换券
@ -789,7 +749,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueRecord.setPayStatus("paid");
cardValueRecord.setStoreId(cardValueOrders.getStoreId());
cardValueRecord.setPaymentNo(cardValueOrders.getOrderNo());
//cardValueRecord.setChainStoreId(nowAccountInfo.getChainStoreId());
save(cardValueRecord);
}

View File

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

View File

@ -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) {

View File

@ -26,7 +26,8 @@
<view class="hui-size">{{item.couponContent}}</view>
<view class="dis-bt">
<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>
</view>
</view>
@ -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) {