更新9.20
This commit is contained in:
parent
f727da7ce3
commit
a4c1320597
@ -1,6 +1,7 @@
|
||||
package com.fuint.business.userManager.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@ -12,6 +13,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||
import com.fuint.business.marketingActivity.cardGift.mapper.CardGiftMapper;
|
||||
import com.fuint.business.marketingActivity.cardGiftActive.mapper.CardGiftActiveMapper;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueRecordMapper;
|
||||
import com.fuint.business.order.mapper.AllOrderInfoMapper;
|
||||
@ -44,6 +48,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 会员储值卡信息 业务层
|
||||
@ -77,6 +82,10 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
@Autowired
|
||||
CardFavorableRecordMapper cardFavorableRecordMapper;
|
||||
|
||||
@Autowired
|
||||
CardGiftMapper cardGiftMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<UserBalanceVo> listByZt(Page page, UserBalanceVo user) {
|
||||
if (ObjectUtil.isEmpty(user.getDeptId())) {
|
||||
@ -98,7 +107,9 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
LJUserGrade ljUserGrade = ljUserGradeMapper.selectById(record.getGradeId());
|
||||
if (ObjectUtil.isNotEmpty(ljUserGrade)) {
|
||||
record.setGradeName(ljUserGrade.getName());
|
||||
}else {record.setGradeName("--");}
|
||||
} else {
|
||||
record.setGradeName("--");
|
||||
}
|
||||
// 累计充值金额
|
||||
Map<String, Object> amountAndConsume = cardValueRecordMapper.getAmountAndConsume(record);
|
||||
if (ObjectUtil.isNotEmpty(amountAndConsume)) {
|
||||
@ -180,8 +191,6 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public int addUserBalanceByLock(Integer oilId, Integer userId, Integer changeBalance) {
|
||||
|
||||
// int row = baseMapper.addUserBalance(balance);
|
||||
@ -194,7 +203,8 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
UserBalance userBalance = selectUserBalance(userId, chainStoreId);
|
||||
if (ObjectUtil.isNotEmpty(userBalance) && ObjectUtil.isNotEmpty(userBalance.getRefuelMoney())) {
|
||||
|
||||
List<Map<String, Object>> resultMapList = JSON.parseObject(userBalance.getRefuelMoney(), new TypeReference<List<Map<String, Object>>>() {});
|
||||
List<Map<String, Object>> resultMapList = JSON.parseObject(userBalance.getRefuelMoney(), new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
|
||||
if (ObjectUtil.isNotEmpty(resultMapList)) {
|
||||
for (Map<String, Object> stringStringMap : resultMapList) {
|
||||
@ -210,8 +220,6 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -323,6 +331,7 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
|
||||
/**
|
||||
* 查询会员储值卡余额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -337,6 +346,7 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
|
||||
/**
|
||||
* 查询会员储值卡余额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -353,10 +363,21 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
userBlanceUniVo.setAllBalance(balance.getCardBalance() + giveAmount);
|
||||
//查询优惠券数量
|
||||
Integer count = cardFavorableRecordMapper.selectCount(new LambdaQueryWrapper<CardFavorableRecord>()
|
||||
.eq(CardFavorableRecord::getMtUserId, balance.getMtUserId())
|
||||
.eq(CardFavorableRecord::getMtUserId, nowAccountInfo.getId())
|
||||
.eq(CardFavorableRecord::getStatus, 0)
|
||||
.eq(CardFavorableRecord::getStoreId, balance.getStoreId()));
|
||||
userBlanceUniVo.setCardFavorableCount(count);
|
||||
//查询礼品卡已兑换数量和金额
|
||||
List<CardGift> cardGifts = cardGiftMapper.selectList(new LambdaQueryWrapper<CardGift>()
|
||||
.eq(CardGift::getUserId, nowAccountInfo.getId())
|
||||
.eq(CardGift::getStoreId, balance.getStoreId()));
|
||||
|
||||
if (CollUtil.isNotEmpty(cardGifts)) {
|
||||
Double giftCardAmount = cardGifts.stream().mapToDouble(CardGift::getCardAmount).sum();
|
||||
userBlanceUniVo.setGiftCardAmount(giftCardAmount);
|
||||
}
|
||||
|
||||
userBlanceUniVo.setGiftCardCount(cardGifts.size());
|
||||
} else {
|
||||
userBlanceUniVo.setAllBalance(0.0);
|
||||
userBlanceUniVo.setCardBalance(0.0);
|
||||
@ -364,8 +385,10 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
}
|
||||
return userBlanceUniVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化用户余额信息
|
||||
*
|
||||
* @param userId
|
||||
* @param chainStoreId
|
||||
* @return
|
||||
|
@ -10,4 +10,10 @@ public class UserBlanceUniVo extends UserBalance {
|
||||
|
||||
//卡券数量
|
||||
private int cardFavorableCount;
|
||||
|
||||
//礼品卡数量
|
||||
private int giftCardCount;
|
||||
|
||||
//礼品卡总金额
|
||||
private Double giftCardAmount;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user