|
@@ -67,6 +67,7 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
public Boolean getPayRealGoodsBenefits(Long userId, Long orderId, Long yhsId, List<GoodsDonSku> skuIds) {
|
|
public Boolean getPayRealGoodsBenefits(Long userId, Long orderId, Long yhsId, List<GoodsDonSku> skuIds) {
|
|
|
Boolean isReceivedAll = true;
|
|
Boolean isReceivedAll = true;
|
|
|
log.info("用户:{}实物订单orderId:{}发货,兑换权益规格数量:{}", userId, orderId, skuIds.size());
|
|
log.info("用户:{}实物订单orderId:{}发货,兑换权益规格数量:{}", userId, orderId, skuIds.size());
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
for (GoodsDonSku sku : skuIds) {
|
|
for (GoodsDonSku sku : skuIds) {
|
|
|
Long skuId = sku.getId();
|
|
Long skuId = sku.getId();
|
|
|
sku = goodsDonSkuMapper.selectById(skuId);
|
|
sku = goodsDonSkuMapper.selectById(skuId);
|
|
@@ -77,7 +78,7 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
// .field(GroupsRelationView::getUserId, userId)
|
|
// .field(GroupsRelationView::getUserId, userId)
|
|
|
// .field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
|
|
// .field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
|
|
|
// .build());
|
|
// .build());
|
|
|
- List<GroupsRelationView> relationViewList = groupsRelationMapper.selectRelationByGoodsId(goodsId, userId, yhsId);
|
|
|
|
|
|
|
+ List<GroupsRelationView> relationViewList = groupsRelationMapper.selectRelationByGoodsId(goodsId, userIdList, yhsId);
|
|
|
//是否有该规格车票,若无直接发放车票
|
|
//是否有该规格车票,若无直接发放车票
|
|
|
if (CollUtil.isEmpty(relationViewList)) {
|
|
if (CollUtil.isEmpty(relationViewList)) {
|
|
|
log.info("用户userId:{}未有skuId:{}车票,获取对应车票", userId, sku.getId());
|
|
log.info("用户userId:{}未有skuId:{}车票,获取对应车票", userId, sku.getId());
|
|
@@ -99,10 +100,8 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
throw BusinessRuntimeException.getInstance("用户存在未发车的车票,请发车后再进行发货");
|
|
throw BusinessRuntimeException.getInstance("用户存在未发车的车票,请发车后再进行发货");
|
|
|
}
|
|
}
|
|
|
DateTime updateExpiryTime = DateUtil.offset(expiryTime, DateField.MONTH, sku.getMonths());
|
|
DateTime updateExpiryTime = DateUtil.offset(expiryTime, DateField.MONTH, sku.getMonths());
|
|
|
- updateExpiryTime = DateUtil.offsetDay(updateExpiryTime, 3);
|
|
|
|
|
groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
.eq(GroupsRelation::getId, groupsRelationView.getId())
|
|
.eq(GroupsRelation::getId, groupsRelationView.getId())
|
|
|
- .eq(GroupsRelation::getUserId, userId)
|
|
|
|
|
.set(GroupsRelation::getExpiryTime, updateExpiryTime));
|
|
.set(GroupsRelation::getExpiryTime, updateExpiryTime));
|
|
|
groupsRelationView.setUpdateExpiryTime(updateExpiryTime);
|
|
groupsRelationView.setUpdateExpiryTime(updateExpiryTime);
|
|
|
saveReceiveBenefitsRecord(userId, skuId, orderId, null, groupsRelationView.getId(), sku.getMonths(), sku.getDays(), 1);
|
|
saveReceiveBenefitsRecord(userId, skuId, orderId, null, groupsRelationView.getId(), sku.getMonths(), sku.getDays(), 1);
|
|
@@ -223,12 +222,13 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
Long userId = orderDon.getUserId();
|
|
Long userId = orderDon.getUserId();
|
|
|
Long yhsId = orderDon.getYhsId();
|
|
Long yhsId = orderDon.getYhsId();
|
|
|
List<Long> relationIds = new ArrayList<>();
|
|
List<Long> relationIds = new ArrayList<>();
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
goodsDonSkus.forEach(sku -> {
|
|
goodsDonSkus.forEach(sku -> {
|
|
|
Long skuId = sku.getId();
|
|
Long skuId = sku.getId();
|
|
|
sku = goodsDonSkuMapper.selectById(skuId);
|
|
sku = goodsDonSkuMapper.selectById(skuId);
|
|
|
Long goodsId = sku.getGoodsId();
|
|
Long goodsId = sku.getGoodsId();
|
|
|
log.info("开始发放用户套餐优惠权益订单:{} 车票规格:{}", orderId, skuId);
|
|
log.info("开始发放用户套餐优惠权益订单:{} 车票规格:{}", orderId, skuId);
|
|
|
- List<GroupsRelationView> relationViewList = groupsRelationMapper.selectRelationByGoodsId(goodsId, userId, yhsId);
|
|
|
|
|
|
|
+ List<GroupsRelationView> relationViewList = groupsRelationMapper.selectRelationByGoodsId(goodsId, userIdList, yhsId);
|
|
|
//是否有该规格车票,若无直接发放车票
|
|
//是否有该规格车票,若无直接发放车票
|
|
|
if (CollUtil.isEmpty(relationViewList)) {
|
|
if (CollUtil.isEmpty(relationViewList)) {
|
|
|
log.info("用户userId:{}未有skuId:{}车票,获取对应车票", userId, sku.getId());
|
|
log.info("用户userId:{}未有skuId:{}车票,获取对应车票", userId, sku.getId());
|
|
@@ -237,7 +237,6 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
relationIds.add(relation.getId());
|
|
relationIds.add(relation.getId());
|
|
|
} else if (relationViewList.size() == 1) {
|
|
} else if (relationViewList.size() == 1) {
|
|
|
//若有且只有一张增加时长
|
|
//若有且只有一张增加时长
|
|
|
- //TODO
|
|
|
|
|
GroupsRelationView groupsRelationView = relationViewList.get(0);
|
|
GroupsRelationView groupsRelationView = relationViewList.get(0);
|
|
|
log.info("存在对应规格:{}的车票,增加车票:relationId:{}时长", sku.getId(), groupsRelationView.getId());
|
|
log.info("存在对应规格:{}的车票,增加车票:relationId:{}时长", sku.getId(), groupsRelationView.getId());
|
|
|
Date expiryTime = groupsRelationView.getExpiryTime();
|
|
Date expiryTime = groupsRelationView.getExpiryTime();
|
|
@@ -245,10 +244,8 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
|
|
|
throw BusinessRuntimeException.getInstance("用户存在未发车的车票,请发车后再进行发货");
|
|
throw BusinessRuntimeException.getInstance("用户存在未发车的车票,请发车后再进行发货");
|
|
|
}
|
|
}
|
|
|
DateTime updateExpiryTime = DateUtil.offset(expiryTime, DateField.MONTH, sku.getMonths());
|
|
DateTime updateExpiryTime = DateUtil.offset(expiryTime, DateField.MONTH, sku.getMonths());
|
|
|
- updateExpiryTime = DateUtil.offsetDay(updateExpiryTime, 3);
|
|
|
|
|
groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
.eq(GroupsRelation::getId, groupsRelationView.getId())
|
|
.eq(GroupsRelation::getId, groupsRelationView.getId())
|
|
|
- .eq(GroupsRelation::getUserId, userId)
|
|
|
|
|
.set(GroupsRelation::getExpiryTime, updateExpiryTime));
|
|
.set(GroupsRelation::getExpiryTime, updateExpiryTime));
|
|
|
groupsRelationView.setUpdateExpiryTime(updateExpiryTime);
|
|
groupsRelationView.setUpdateExpiryTime(updateExpiryTime);
|
|
|
relationIds.add(groupsRelationView.getId());
|
|
relationIds.add(groupsRelationView.getId());
|