|
|
@@ -50,6 +50,7 @@ import com.cyksj.model.request.ClickOutReq;
|
|
|
import com.cyksj.model.request.OrderBalanceRefundReq;
|
|
|
import com.cyksj.model.request.OrderRefundReq;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
+import com.cyksj.service.chatgpt.GptUserRechargeRecordService;
|
|
|
import com.cyksj.service.coin.UserGalaxyCoinService;
|
|
|
import com.cyksj.service.coupon.CouponFontService;
|
|
|
import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
|
|
|
@@ -227,6 +228,8 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
|
|
|
private final UserGalaxyCoinService userGalaxyCoinService;
|
|
|
|
|
|
+ private final GptUserRechargeRecordService gptUserRechargeRecordService;
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
@Override
|
|
|
@@ -1293,6 +1296,11 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
netflixUserAccountSubmitRecoverRecordMapper.updateById(recoverRecord);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //GPT独立会员
|
|
|
+ if (orderDon.getGoodsId() == Constant.GPT_PLUS_GID && sku.getNum() == 1) {
|
|
|
+ subRechargeNumOrder(orderDon.getUserId(), orderDon.getRelationId(), sku.getMonths(), operator);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//处理下级渠道分销提成
|
|
|
@@ -1744,4 +1752,31 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 退款扣除代充次数
|
|
|
+ */
|
|
|
+ private void subRechargeNumOrder(Long userId, Long relationId, Integer subNum, String operator) {
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
+ GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class).eq(GroupsRelation::getId, relationId).in(GroupsRelation::getUserId, userIdList).gt(GroupsRelation::getExpiryTime, DateTime.now()));
|
|
|
+ if (relation != null && relation.getRechargeStatus() != null) {
|
|
|
+ int update = 0;
|
|
|
+ while (update == 0) {
|
|
|
+ Integer rechargeRemainNum = relation.getRechargeRemainNum();
|
|
|
+ if (subNum > rechargeRemainNum) {
|
|
|
+ subNum = rechargeRemainNum;
|
|
|
+ }
|
|
|
+ update = groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
+ .set(GroupsRelation::getRechargeRemainNum, rechargeRemainNum - subNum)
|
|
|
+ .eq(GroupsRelation::getId, relationId)
|
|
|
+ .eq(GroupsRelation::getRechargeRemainNum, rechargeRemainNum));
|
|
|
+ if (update == 1) {
|
|
|
+ //记录gpt代充记录
|
|
|
+ gptUserRechargeRecordService.recordGptUserRechargeNum(relation.getUserId(), relation.getId(), relation.getAccount(), -subNum, operator, "订单退款");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ relation = relationMapper.selectById(relationId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|