|
@@ -29,6 +29,7 @@ import com.cyksj.server.recharge.dto.TaskSubmitResult;
|
|
|
import com.cyksj.server.recharge.dto.TokenParseResult;
|
|
import com.cyksj.server.recharge.dto.TokenParseResult;
|
|
|
import com.cyksj.service.chatgpt.GptUserRechargeRecordService;
|
|
import com.cyksj.service.chatgpt.GptUserRechargeRecordService;
|
|
|
import com.cyksj.service.mange.gpt.GptRechargeService;
|
|
import com.cyksj.service.mange.gpt.GptRechargeService;
|
|
|
|
|
+import com.cyksj.service.order.MultiQuantityOrderService;
|
|
|
import com.cyksj.service.recharge.*;
|
|
import com.cyksj.service.recharge.*;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -64,6 +65,8 @@ public class GptRechargeServiceImpl implements GptRechargeService {
|
|
|
|
|
|
|
|
private final OrderDonMapper orderDonMapper;
|
|
private final OrderDonMapper orderDonMapper;
|
|
|
|
|
|
|
|
|
|
+ private final MultiQuantityOrderService multiQuantityOrderService;
|
|
|
|
|
+
|
|
|
private final GptUserRechargeRecordService gptUserRechargeRecordService;
|
|
private final GptUserRechargeRecordService gptUserRechargeRecordService;
|
|
|
|
|
|
|
|
private final TransactionTemplate transactionTemplate;
|
|
private final TransactionTemplate transactionTemplate;
|
|
@@ -190,12 +193,18 @@ public class GptRechargeServiceImpl implements GptRechargeService {
|
|
|
if (updateRemainNum == 0) {
|
|
if (updateRemainNum == 0) {
|
|
|
throw BusinessRuntimeException.getInstance("剩余可代充次数为0");
|
|
throw BusinessRuntimeException.getInstance("剩余可代充次数为0");
|
|
|
}
|
|
}
|
|
|
- OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
|
|
- .eq(OrderDon::getUserId, relation.getUserId())
|
|
|
|
|
- .eq(OrderDon::getRelationId, relationId)
|
|
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
|
|
- .orderByDesc(OrderDon::getId)
|
|
|
|
|
- .last("limit 1"));
|
|
|
|
|
|
|
+ OrderDon orderDon = multiQuantityOrderService.findOrderByRelationId(relationId);
|
|
|
|
|
+ if (orderDon != null && !relation.getUserId().equals(orderDon.getUserId())) {
|
|
|
|
|
+ orderDon = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (orderDon == null) {
|
|
|
|
|
+ orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
|
|
+ .eq(OrderDon::getUserId, relation.getUserId())
|
|
|
|
|
+ .eq(OrderDon::getRelationId, relationId)
|
|
|
|
|
+ .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
|
|
+ .orderByDesc(OrderDon::getId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ }
|
|
|
if (orderDon == null) {
|
|
if (orderDon == null) {
|
|
|
throw BusinessRuntimeException.getInstance("代充订单不存在或已退款");
|
|
throw BusinessRuntimeException.getInstance("代充订单不存在或已退款");
|
|
|
}
|
|
}
|