|
|
@@ -18,6 +18,7 @@ import com.cyksj.service.mange.vip.CmsVipOrderService;
|
|
|
import com.cyksj.service.order.OrderRefundService;
|
|
|
import com.cyksj.service.relation.GroupRelationClearService;
|
|
|
import com.cyksj.service.user.UserBenefitsService;
|
|
|
+import com.cyksj.service.user.UserBindRelationService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -55,6 +56,8 @@ public class CmsVipOrderServiceImpl implements CmsVipOrderService {
|
|
|
|
|
|
private final UserBenefitsService userBenefitsService;
|
|
|
|
|
|
+ private final UserBindRelationService userBindRelationService;
|
|
|
+
|
|
|
@Override
|
|
|
public void refundOrders(OrderRefundReq refundReq) throws Exception {
|
|
|
VipOrderDon orderDon = vipOrderDonMapper.selectById(refundReq.getOrderId());
|
|
|
@@ -96,13 +99,18 @@ public class CmsVipOrderServiceImpl implements CmsVipOrderService {
|
|
|
userBenefitsService.addUserBalance(orderDon.getUserId(), addBalance, UserBalanceSourceRecord.Source.vip_refund, null, orderDon.getId(), orderDon.getPayTitle() + UserBalanceSourceRecord.Source.vip_refund.getDesc(), true);
|
|
|
}
|
|
|
//扣除会员时长
|
|
|
- VipUser vipUser = vipUserMapper.selectById(orderDon.getUserId());
|
|
|
- Date expiryTime = vipUser.getExpiryTime();
|
|
|
- DateTime subExpiryTime = DateUtil.offsetMonth(expiryTime, -1);
|
|
|
- vipUser.setExpiryTime(subExpiryTime);
|
|
|
- //若会员过期清除镜像user
|
|
|
- clearVipMirrorUser(vipUser.getUserId(), subExpiryTime);
|
|
|
- vipUserMapper.updateById(vipUser);
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(orderDon.getUserId(), null);
|
|
|
+ VipUser vipUser = vipUserMapper.selectOne(Wrappers.lambdaQuery(VipUser.class)
|
|
|
+ .in(VipUser::getUserId, userIdList)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (vipUser != null) {
|
|
|
+ Date expiryTime = vipUser.getExpiryTime();
|
|
|
+ DateTime subExpiryTime = DateUtil.offsetMonth(expiryTime, -1);
|
|
|
+ vipUser.setExpiryTime(subExpiryTime);
|
|
|
+ //若会员过期清除镜像user
|
|
|
+ clearVipMirrorUser(vipUser.getUserId(), subExpiryTime);
|
|
|
+ vipUserMapper.updateById(vipUser);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void recordRefundOrder(VipOrderDon orderDon, String outRefundNo, BigDecimal refundMoney, String operator, String chatImg, String refundType) {
|