|
@@ -76,7 +76,7 @@ public class VipFrontServiceImpl implements VipFrontService {
|
|
|
//可抵扣车票
|
|
//可抵扣车票
|
|
|
if (count.intValue() > 0) {
|
|
if (count.intValue() > 0) {
|
|
|
//处理vip抵扣金额
|
|
//处理vip抵扣金额
|
|
|
- VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, vipSkuIds);
|
|
|
|
|
|
|
+ VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, vipSkuIds, 12);
|
|
|
deductMoney = vipDeductDto.getDeductMoney();
|
|
deductMoney = vipDeductDto.getDeductMoney();
|
|
|
vipUserPageResp.setRelationUserViews(vipDeductDto.getRelationUserViews());
|
|
vipUserPageResp.setRelationUserViews(vipDeductDto.getRelationUserViews());
|
|
|
}
|
|
}
|
|
@@ -87,7 +87,7 @@ public class VipFrontServiceImpl implements VipFrontService {
|
|
|
* 检查用户并获取订单抵扣金额
|
|
* 检查用户并获取订单抵扣金额
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public VipDeductDto checkAndGetOrderDeductMoney(Long userId) {
|
|
|
|
|
|
|
+ public VipDeductDto checkAndGetOrderDeductMoney(Long userId, Integer months) {
|
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
List<Long> vipSkuIds = vipGoodsSkuMapper.selectList(null).stream().map(VipGoodsSku::getSkuId).collect(Collectors.toList());
|
|
List<Long> vipSkuIds = vipGoodsSkuMapper.selectList(null).stream().map(VipGoodsSku::getSkuId).collect(Collectors.toList());
|
|
|
Number count = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder()
|
|
Number count = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder()
|
|
@@ -99,29 +99,29 @@ public class VipFrontServiceImpl implements VipFrontService {
|
|
|
if (count.intValue() == 0) {
|
|
if (count.intValue() == 0) {
|
|
|
throw BusinessRuntimeException.getInstance("暂无可抵扣AI车票");
|
|
throw BusinessRuntimeException.getInstance("暂无可抵扣AI车票");
|
|
|
}
|
|
}
|
|
|
- VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, vipSkuIds);
|
|
|
|
|
|
|
+ VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, vipSkuIds, months);
|
|
|
return vipDeductDto;
|
|
return vipDeductDto;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- private BigDecimal getVipMoney() {
|
|
|
|
|
|
|
+ private BigDecimal getVipMoney(Integer months) {
|
|
|
SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, Constant.VIP_FEE_KEY).last("limit 1"));
|
|
SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, Constant.VIP_FEE_KEY).last("limit 1"));
|
|
|
if (sysConfig == null || StrUtil.isEmpty(sysConfig.getSysValue())) {
|
|
if (sysConfig == null || StrUtil.isEmpty(sysConfig.getSysValue())) {
|
|
|
throw BusinessRuntimeException.getInstance("系统异常");
|
|
throw BusinessRuntimeException.getInstance("系统异常");
|
|
|
}
|
|
}
|
|
|
BigDecimal vipFee = BigDecimal.valueOf(Long.valueOf(sysConfig.getSysValue()));
|
|
BigDecimal vipFee = BigDecimal.valueOf(Long.valueOf(sysConfig.getSysValue()));
|
|
|
- return vipFee;
|
|
|
|
|
|
|
+ return vipFee.multiply(BigDecimal.valueOf(months));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 统一处理vip抵扣金额
|
|
* 统一处理vip抵扣金额
|
|
|
*/
|
|
*/
|
|
|
- public VipDeductDto commonHandleVipDeductMoney(List<Long> userIdList, List<Long> vipSkuIds) {
|
|
|
|
|
|
|
+ public VipDeductDto commonHandleVipDeductMoney(List<Long> userIdList, List<Long> vipSkuIds, Integer months) {
|
|
|
VipDeductDto vipDeductDto = new VipDeductDto();
|
|
VipDeductDto vipDeductDto = new VipDeductDto();
|
|
|
DateTime now = DateTime.now();
|
|
DateTime now = DateTime.now();
|
|
|
List<Long> deductRelationIds = new ArrayList<>();
|
|
List<Long> deductRelationIds = new ArrayList<>();
|
|
|
BigDecimal deductMoney = BigDecimal.ZERO;
|
|
BigDecimal deductMoney = BigDecimal.ZERO;
|
|
|
- BigDecimal vipMoney = getVipMoney();
|
|
|
|
|
|
|
+ BigDecimal vipMoney = getVipMoney(months);
|
|
|
//会员规格
|
|
//会员规格
|
|
|
Set<Long> goodsIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
Set<Long> goodsIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
.in(GoodsDonSku::getId, vipSkuIds)).stream().map(GoodsDonSku::getGoodsId).collect(Collectors.toSet());
|
|
.in(GoodsDonSku::getId, vipSkuIds)).stream().map(GoodsDonSku::getGoodsId).collect(Collectors.toSet());
|