Browse Source

奈飞外部装置查看功能供号商使用

zoujiajian 1 năm trước cách đây
mục cha
commit
5a7b6ff951

+ 5 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -393,4 +393,9 @@ public interface Constant {
 	String WHOLESALE_DEPOSIT_KEY = "wholesale_deposit_key";
 
 	String SHOP = "店铺";
+
+	/**
+	 * 账号邮箱外部验证码
+	 */
+	List<Long> YH_EMAIL_VERIFY_OUTSIDE_CODE_GIDS = List.of(1l, 3l, 33l);
 }

+ 7 - 0
netflix-dao/src/main/java/com/cyksj/model/request/TicketLoginReq.java

@@ -47,4 +47,11 @@ public class TicketLoginReq {
 	 * 1.同步装置 ,2.验证链接
 	 */
 	private Integer linkType;
+
+	/**
+	 * 是否是号商
+	 */
+	private Boolean merchants = false;
+
+	private Long accountId;
 }

+ 70 - 29
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -152,7 +152,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	private final OrderDonRenewRecordMapper orderDonRenewRecordMapper;
 
-	private final UpgradeOrderDonMapper upgradeOrderDonMapper;
+	private final AccountMapper accountMapper;
 
 	@Override
 	public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account) {
@@ -496,23 +496,40 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	@Override
 	public String getAiVerifyCode(TicketLoginReq loginReq) throws Exception {
-		Long userId = loginReq.getUserId();
-		Long relationId = loginReq.getRelationId();
 		Integer type = loginReq.getType();
-		Boolean sync = loginReq.getSync();
-		List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
-		RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder().field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
-				.field(RenewalView::getRelationId, relationId).build());
-		if (renewalView == null) {
-			throw BusinessRuntimeException.getInstance("您的车票不存在...");
-		}
-		if (StrUtil.isEmpty(renewalView.getAccount())) {
-			throw BusinessRuntimeException.getInstance("车票未配置账号");
-		}
-		String account = renewalView.getAccount();
-		String password = renewalView.getPassword();
-		if (StrUtil.hasEmpty(account, password)) {
-			throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
+		RenewalView renewalView;
+		String account;
+		Long userId = 0l;
+		Long relationId = 0l;
+		if (loginReq.getMerchants()) {
+			renewalView = new RenewalView();
+			renewalView.setGoodsId(loginReq.getGoodsId());
+			renewalView.setAccount(loginReq.getAccount());
+			GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
+					.eq(GroupsTrips::getAccountId, loginReq.getAccountId())
+					.last("limit 1"));
+			if (groupsTrips != null) {
+				renewalView.setSkuId(groupsTrips.getSkuId());
+			}
+			renewalView.setUserId(userId);
+			account = loginReq.getAccount();
+		} else {
+			userId = loginReq.getUserId();
+			relationId = loginReq.getRelationId();
+			List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
+			renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder().field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
+					.field(RenewalView::getRelationId, relationId).build());
+			if (renewalView == null) {
+				throw BusinessRuntimeException.getInstance("您的车票不存在...");
+			}
+			if (StrUtil.isEmpty(renewalView.getAccount())) {
+				throw BusinessRuntimeException.getInstance("车票未配置账号");
+			}
+			account = renewalView.getAccount();
+			String password = renewalView.getPassword();
+			if (StrUtil.hasEmpty(account, password)) {
+				throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
+			}
 		}
 		if (renewalView.getGoodsId() == 1l) {
 			Integer linkType = loginReq.getLinkType();
@@ -810,6 +827,18 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 	@Override
 	public GroupsRelation ticketLogin(TicketLoginReq loginReq) {
 		String account = loginReq.getAccount();
+		if (loginReq.getMerchants()) {
+			Account dbAccount = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class)
+					.eq(Account::getAccount, account)
+					.eq(Account::getGoodsId, Constant.YH_EMAIL_VERIFY_OUTSIDE_CODE_GIDS.get(0))
+					.last("limit 1"));
+			if (dbAccount == null) {
+				throw BusinessRuntimeException.getInstance("账号错误,请联系客服");
+			}
+			GroupsRelation relation = new GroupsRelation();
+			relation.setId(0l);
+			return relation;
+		}
 		String password = loginReq.getPassword();
 		Integer num = loginReq.getNum();
 		Long goodsId = Optional.ofNullable(loginReq.getGoodsId()).orElse(1l);
@@ -827,20 +856,32 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 	@Override
 	public String outsideTicketVerify(TicketLoginReq loginReq) {
 		String account = loginReq.getAccount();
-		String password = loginReq.getPassword();
-		Integer num = loginReq.getNum();
-		Long goodsId = Optional.ofNullable(loginReq.getGoodsId()).orElse(1l);
-		GroupsRelation relation = groupsRelationMapper.selectRelationByAccountAndNum(account, password, goodsId, num);
-		if (relation == null) {
-			log.info("外部入口使用账号account:{},pwd:{},座位num:{}同步验证链接失败...", account, password, num);
-			if (StrUtil.equals(loginReq.getLang(), Constant.EN_US)) {
-				throw BusinessRuntimeException.getInstance("This account is no longer valid");
+		if (loginReq.getMerchants()) {
+			Account dbAccount = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class)
+					.eq(Account::getAccount, account)
+					.eq(Account::getGoodsId, Constant.YH_EMAIL_VERIFY_OUTSIDE_CODE_GIDS.get(0))
+					.last("limit 1"));
+			if (dbAccount == null) {
+				throw BusinessRuntimeException.getInstance("账号错误,请联系客服");
+			}
+			loginReq.setGoodsId(dbAccount.getGoodsId());
+			loginReq.setAccountId(dbAccount.getId());
+		} else {
+			String password = loginReq.getPassword();
+			Integer num = loginReq.getNum();
+			Long goodsId = Optional.ofNullable(loginReq.getGoodsId()).orElse(1l);
+			GroupsRelation relation = groupsRelationMapper.selectRelationByAccountAndNum(account, password, goodsId, num);
+			if (relation == null) {
+				log.info("外部入口使用账号account:{},pwd:{},座位num:{}同步验证链接失败...", account, password, num);
+				if (StrUtil.equals(loginReq.getLang(), Constant.EN_US)) {
+					throw BusinessRuntimeException.getInstance("This account is no longer valid");
+				}
+				throw BusinessRuntimeException.getInstance("该账号已失效");
 			}
-			throw BusinessRuntimeException.getInstance("该账号已失效");
+			loginReq.setUserId(relation.getUserId());
+			loginReq.setRelationId(relation.getId());
+			loginReq.setGoodsId(goodsId);
 		}
-		loginReq.setUserId(relation.getUserId());
-		loginReq.setRelationId(relation.getId());
-		loginReq.setGoodsId(goodsId);
 		try {
 			String aiVerifyCode = getAiVerifyCode(loginReq);
 			if (StrUtil.isEmpty(aiVerifyCode)) {