|
@@ -31,6 +31,7 @@ import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.request.OrderPayRequest;
|
|
import com.cyksj.model.request.OrderPayRequest;
|
|
|
import com.cyksj.model.request.SpecialGoodsTicketReq;
|
|
import com.cyksj.model.request.SpecialGoodsTicketReq;
|
|
|
|
|
+import com.cyksj.model.response.GptStandbyResp;
|
|
|
import com.cyksj.model.views.*;
|
|
import com.cyksj.model.views.*;
|
|
|
import com.cyksj.redis.RedisService;
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.chatgpt.ChatGptAuthService;
|
|
import com.cyksj.service.chatgpt.ChatGptAuthService;
|
|
@@ -53,6 +54,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Optional;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -109,6 +111,8 @@ public class GroupRelationController {
|
|
|
|
|
|
|
|
private final SysConfigService sysConfigService;
|
|
private final SysConfigService sysConfigService;
|
|
|
|
|
|
|
|
|
|
+ private final GptTicketStandbyMapper gptTicketStandbyMapper;
|
|
|
|
|
+
|
|
|
private final static Sequence SEQUENCE = new Sequence(0);
|
|
private final static Sequence SEQUENCE = new Sequence(0);
|
|
|
|
|
|
|
|
@RequestMapping("/get/renewal")
|
|
@RequestMapping("/get/renewal")
|
|
@@ -584,4 +588,53 @@ public class GroupRelationController {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(groupRelationFrontService.getAiVerifyCode(userId, relationId));
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(groupRelationFrontService.getAiVerifyCode(userId, relationId));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 是否有gpt车票可候补
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/get/standby")
|
|
|
|
|
+ public Result<GptStandbyResp> getGptStandby() {
|
|
|
|
|
+ long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
+ List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ Number number = beanSearcher.searchCount(RenewalView.class, MapUtils.builder()
|
|
|
|
|
+ .field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
|
|
|
|
|
+ .field(RenewalView::getYhsId, 0)
|
|
|
|
|
+ .field(RenewalView::getExpiryTime).op(Operator.NotNull)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ GptStandbyResp gptStandbyResp = new GptStandbyResp();
|
|
|
|
|
+ gptStandbyResp.setIsHasAccount(number.intValue() > 0 ? true : false);
|
|
|
|
|
+ if (gptStandbyResp.getIsHasAccount()) {
|
|
|
|
|
+ Integer count = gptTicketStandbyMapper.selectCount(Wrappers.lambdaQuery(GptTicketStandby.class)
|
|
|
|
|
+ .in(GptTicketStandby::getUserId, relationUserIdList));
|
|
|
|
|
+ gptStandbyResp.setIsApply(count > 0 ? true : false);
|
|
|
|
|
+ }
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(gptStandbyResp);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 申请候补
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/apply/standby")
|
|
|
|
|
+ @NoSubmit
|
|
|
|
|
+ public Result<Boolean> applyGptStandby() {
|
|
|
|
|
+ long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
+ List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ Number number = beanSearcher.searchCount(RenewalView.class, MapUtils.builder()
|
|
|
|
|
+ .field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
|
|
|
|
|
+ .field(RenewalView::getYhsId, 0)
|
|
|
|
|
+ .field(RenewalView::getExpiryTime).op(Operator.NotNull)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ if (number.intValue() == 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("你未有GPT plus账号");
|
|
|
|
|
+ }
|
|
|
|
|
+ Integer count = gptTicketStandbyMapper.selectCount(Wrappers.lambdaQuery(GptTicketStandby.class)
|
|
|
|
|
+ .in(GptTicketStandby::getUserId, relationUserIdList));
|
|
|
|
|
+ if (count > 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("你已申请GPT plus账号候补");
|
|
|
|
|
+ }
|
|
|
|
|
+ GptTicketStandby gptTicketStandby = new GptTicketStandby();
|
|
|
|
|
+ gptTicketStandby.setUserId(userId);
|
|
|
|
|
+ gptTicketStandbyMapper.insert(gptTicketStandby);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(number.intValue() > 0 ? true : false);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|