修改bug

This commit is contained in:
齐天大圣 2024-01-03 13:39:21 +08:00
parent a897807c16
commit 99767393bc
12 changed files with 145 additions and 382 deletions

View File

@ -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:15:07
*/
@SuppressWarnings("serial")
@Data
public class CardExchangeRecord extends Model<CardExchangeRecord> {
//主键id
@TableId(type = IdType.AUTO)
@ -50,7 +52,7 @@ public class CardExchangeRecord extends Model<CardExchangeRecord> {
private String ticketCode;
//券来源
private String exchangeFrom;
//使用状态 0 未使用 1已使用
//使用状态 0 未使用 1已使用
private String status;
//创建者
private String createBy;
@ -74,216 +76,5 @@ public class CardExchangeRecord extends Model<CardExchangeRecord> {
//结束时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCardExchangeId() {
return cardExchangeId;
}
public void setCardExchangeId(Integer cardExchangeId) {
this.cardExchangeId = cardExchangeId;
}
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 getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getMtStaffId() {
return mtStaffId;
}
public void setMtStaffId(Integer mtStaffId) {
this.mtStaffId = mtStaffId;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getStaffMobile() {
return staffMobile;
}
public void setStaffMobile(String staffMobile) {
this.staffMobile = staffMobile;
}
public Integer getMtUserId() {
return mtUserId;
}
public void setMtUserId(Integer mtUserId) {
this.mtUserId = mtUserId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getExchangeName() {
return exchangeName;
}
public void setExchangeName(String exchangeName) {
this.exchangeName = exchangeName;
}
public String getTicketCode() {
return ticketCode;
}
public void setTicketCode(String ticketCode) {
this.ticketCode = ticketCode;
}
public String getExchangeFrom() {
return exchangeFrom;
}
public void setExchangeFrom(String exchangeFrom) {
this.exchangeFrom = exchangeFrom;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
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;
}
public Date getOutTime() {
return outTime;
}
public void setOutTime(Date outTime) {
this.outTime = outTime;
}
public Date getCancelTime() {
return cancelTime;
}
public void setCancelTime(Date cancelTime) {
this.cancelTime = cancelTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
}

View File

@ -3,11 +3,8 @@ package com.fuint.business.marketingActivity.cardValue.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.framework.web.BaseController;

View File

@ -7,6 +7,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;
@ -17,6 +18,7 @@ import java.io.Serializable;
* @since 2023-11-20 17:51:05
*/
@SuppressWarnings("serial")
@Data
public class CardValueChild extends Model<CardValueChild> {
//主键id
@TableId(type = IdType.AUTO)
@ -55,151 +57,5 @@ public class CardValueChild extends Model<CardValueChild> {
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public String getTimeType() {
return timeType;
}
public void setTimeType(String timeType) {
this.timeType = timeType;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCardValueId() {
return cardValueId;
}
public void setCardValueId(Integer cardValueId) {
this.cardValueId = cardValueId;
}
public Integer getVouchersId() {
return vouchersId;
}
public void setVouchersId(Integer vouchersId) {
this.vouchersId = vouchersId;
}
public String getActiveGift() {
return activeGift;
}
public void setActiveGift(String activeGift) {
this.activeGift = activeGift;
}
public String getGiftCardName() {
return giftCardName;
}
public void setGiftCardName(String giftCardName) {
this.giftCardName = giftCardName;
}
public String getGiftCardType() {
return giftCardType;
}
public void setGiftCardType(String giftCardType) {
this.giftCardType = giftCardType;
}
public String getGiftCardDetail() {
return giftCardDetail;
}
public void setGiftCardDetail(String giftCardDetail) {
this.giftCardDetail = giftCardDetail;
}
public Integer getGiftCardTime() {
return giftCardTime;
}
public void setGiftCardTime(Integer giftCardTime) {
this.giftCardTime = giftCardTime;
}
public Integer getGiftCardTotal() {
return giftCardTotal;
}
public void setGiftCardTotal(Integer giftCardTotal) {
this.giftCardTotal = giftCardTotal;
}
public Integer getValidityZero() {
return validityZero;
}
public void setValidityZero(Integer validityZero) {
this.validityZero = validityZero;
}
public Integer getValidityOne() {
return validityOne;
}
public void setValidityOne(Integer validityOne) {
this.validityOne = validityOne;
}
public Integer getValidityTwo() {
return validityTwo;
}
public void setValidityTwo(Integer validityTwo) {
this.validityTwo = validityTwo;
}
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

@ -81,7 +81,7 @@
and combined_result.recordName = #{cardValueRecord.recordName}
</if>
</where>
ORDER BY combined_result.createTime
ORDER BY combined_result.createTime desc
</select>
<select id="selectListExport"
resultType="com.fuint.business.marketingActivity.cardValue.vo.Excel.CardValueRecordExcel">

View File

@ -136,7 +136,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){
cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit());
}
//查询储值卡对应的优惠券列表
/*//查询储值卡对应的优惠券列表
List<CardFavorable> cardValueVouchers = getCardValueVouchers(cardValue);
//筛选符合条件的优惠券并计算优惠金额
if (CollectionUtils.isNotEmpty(cardValueVouchers)) {
@ -153,13 +153,13 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
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) {
@ -185,7 +185,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardExchangeRecordService.save(cardExchangeRecord);
}
}
}
}*/
//订单号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
@ -195,7 +195,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
//付款类型
cardValueOrders.setPayType(cardValueRecordDTO.getPayType());
//用户信息
cardValueOrders.setStoreId(ljUserVo.getStoreId());
cardValueOrders.setStoreId(cardValueRecordDTO.getStoreId());
cardValueOrders.setMtUserId(ljUserVo.getId());
cardValueOrders.setName(ljUserVo.getName());
cardValueOrders.setMobile(ljUserVo.getMobile());
@ -214,13 +214,12 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueOrders.setAmountCommission(cardValue.getAmountCommission());
}
//订单金额
cardValueOrders.setAmount(0.02);
/*if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){
if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){
//订单金额
cardValueOrders.setAmount(cardValue.getRechargeBalance());
//支付金额
cardValueOrders.setPayAmount(cardValue.getRechargeBalance() - cardValue.getGiftBalance() - cardFavorableValue);
}*/
//cardValueOrders.setPayAmount(cardValue.getRechargeBalance() - cardValue.getGiftBalance() - cardFavorableValue);
}
//支付金额
cardValueOrders.setPayAmount(0.01);
//优惠金额
@ -551,7 +550,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Override
public IPage<CardValueRecordDTO> selectAllRecord(@Param("page") Page page, CardValueRecordDTO cardValueRecord) {
cardValueRecord.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardValueRecord.setStoreId(cardValueRecord.getStoreId());
cardValueRecord.setMtUserId(TokenUtil.getNowAccountInfo().getId());
return this.cardValueRecordMapper.selectAllRecord(page, cardValueRecord);
}
@ -628,12 +627,16 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
double afterBalance = 0.0;
//订单详情
CardValueOrders cardValueOrders = cardValueOrdersService.getOneByOrderNo(orderNo);
//会员信息
LJUserVo ljUserVo = ljUserMapper.selectUserById(cardValueOrders.getMtUserId());
//员工信息
LJStaff ljStaff = mtStaffService.selectStaffById(cardValueOrders.getStaffId());
//更新订单状态
cardValueOrders.setStatus("paid");
cardValueOrders.setPayTime(new Date());
cardValueOrdersService.updateById(cardValueOrders);
//用户余额
UserBalance userBalance = userBalanceService.selectUserBalance(cardValueOrders.getMtUserId());
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(cardValueOrders.getMtUserId(),cardValueOrders.getStoreId());
//用户 (新用户新建 老用户叠加)
if (ObjectUtils.isNotEmpty(userBalance)){
//积分
@ -654,8 +657,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
userBalance.setCardBalance(userBalance.getCardBalance() + cardValueOrders.getAmount());
}*/
//加油次数
Integer consumeNum = userBalance.getConsumeNum();
userBalance.setConsumeNum(consumeNum+=1);
/* Integer consumeNum = userBalance.getConsumeNum();
userBalance.setConsumeNum(consumeNum+=1);*/
userBalanceService.updateUserBalance(userBalance);
}else {
userBalance1.setMtUserId(cardValueOrders.getMtUserId());
@ -692,6 +695,75 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardBalanceChange.setAfterTheChange(afterBalance);
cardBalanceChange.setOrderNo(cardValueOrders.getOrderNo());
cardBalanceChangeService.save(cardBalanceChange);
//查询储值卡信息
CardValueVO cardValue = cardValueService.getOneById(cardValueOrders.getCardValueId());
//查询储值卡对应的优惠券列表
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(cardValueOrders.getStoreId());
cardFavorableRecord.setMtUserId(ljUserVo.getId());
cardFavorableRecord.setName(ljUserVo.getName());
cardFavorableRecord.setMobile(ljUserVo.getMobile());
cardFavorableRecord.setStatus("0");
cardFavorableRecord.setExchangeFrom("充值送券");
//优惠券开始结束时间
if (ObjectUtils.isNotEmpty(cardValueVoucher) && ObjectUtils.isNotEmpty(cardValueVoucher.getTimeType())) {
if (cardValueVoucher.getTimeType().equals("0")) {
cardFavorableRecord.setStartTime(new Date());
long endTimeL = new Date().getTime() + cardValueVoucher.getValidityZero() * 86400000;
cardFavorableRecord.setEndTime(new Date(endTimeL));
} else if (cardValueVoucher.getTimeType().equals("1")) {
cardFavorableRecord.setStartTime(cardValueVoucher.getEffectiveDate());
long endTimeM = cardValueVoucher.getEffectiveDate().getTime() + cardValueVoucher.getValidityOne() * 86400000;
cardFavorableRecord.setEndTime(new Date(endTimeM));
} else {
long startTimeN = new Date().getTime() + Integer.parseInt(cardValueVoucher.getValidityDay()) * 86400000L;
long endTimeN = startTimeN + cardValueVoucher.getValidityTwo() * 86400000L;
cardFavorableRecord.setStartTime(new Date(startTimeN));
cardFavorableRecord.setEndTime(new Date(endTimeN));
}
}
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(cardValueOrders.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);
}
}
}
//生成充值记录
cardValueRecord.setMtUserId(cardValueOrders.getMtUserId());
cardValueRecord.setName(cardValueOrders.getName());

View File

@ -3,6 +3,7 @@ package com.fuint.business.userManager.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.entity.UserStatistic;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserBalanceService;
@ -10,6 +11,7 @@ import com.fuint.business.userManager.service.UserStatisticService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -81,6 +83,15 @@ public class LJUserController extends BaseController {
return getSuccessResult(userBalanceService.getUserBalance());
}
/**
* 查询会员储值卡余额小程序端
* @return
*/
@GetMapping("/getUserBalanceApplet")
public ResponseObject getUserBalanceApplet(@Param("userBalance") UserBalance userBalance){
return getSuccessResult(userBalanceService.getUserBalanceApplet(userBalance));
}
/**
* 查询会员统计信息
* @return

View File

@ -47,12 +47,14 @@ public interface UserBalanceService extends IService<UserBalance> {
* @return
*/
public UserBalance selectUserBalance(int userId, int chainStoreId);
public UserBalance selectUserBalanceByStorId(int userId, int storeId);
/**
* 查询会员储值卡余额
* @return
*/
UserBalance getUserBalance();
UserBalance getUserBalanceApplet(UserBalance userBalance);
int initBalance(Integer userId , Integer chainStoreId);

View File

@ -69,6 +69,15 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
return balance;
}
@Override
public UserBalance selectUserBalanceByStorId(int userId, int storeId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",userId);
queryWrapper.eq("store_id",storeId);
UserBalance balance = baseMapper.selectOne(queryWrapper);
return balance;
}
/**
* 查询会员储值卡余额
* @return
@ -82,6 +91,20 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
UserBalance balance = baseMapper.selectOne(queryWrapper);
return balance;
}
/**
* 查询会员储值卡余额
* @return
*/
@Override
public UserBalance getUserBalanceApplet(UserBalance userBalance) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",nowAccountInfo.getId());
queryWrapper.eq("store_id",userBalance.getStoreId());
UserBalance balance = baseMapper.selectOne(queryWrapper);
return balance;
}
/**
* 初始化用户余额信息
* @param userId

View File

@ -286,8 +286,9 @@
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalance',
url: '/business/userManager/user/getUserBalanceApplet',
method: 'get',
params: this.query
}).then(res => {
if (res.code == 200) {
this.cardBalance = res.data.cardBalance,

View File

@ -116,6 +116,13 @@
export default {
data() {
return {
query: {
storeId: '',
couponType: '',
useStatus: 0,
pageNo: 1,
pageSize: 10
},
cardBalance: 0.00,
cardsList: [],
cardsIndex: 0,
@ -127,6 +134,7 @@
},
onShow() {
this.query.storeId = uni.getStorageSync("storeId")
this.getCardFuleRecords();
this.getUserBalance()
},
@ -180,8 +188,9 @@
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalance',
url: '/business/userManager/user/getUserBalanceApplet',
method: 'get',
params: this.query
}).then(res => {
console.log(res)
if (res.code == 200) {

View File

@ -166,7 +166,7 @@
},
goRecharge() {
uni.navigateTo({
url: '/pagesHome/oilRecharge/oilRecharge'
url: '/pagesHome/oilRecharge/oilRecharge?id=0'
})
},
click(item) {

View File

@ -90,7 +90,8 @@
},
onShow() {
this.getAllOrderList()
this.getAllOrderList();
this.storeId = uni.getStorageSync("storeId")
},
onReachBottom() {
this.show = true
@ -272,4 +273,4 @@
font-size: 14px;
border-radius: 15px;
}
</style>
</style>