Przeglądaj źródła

gpt账号登录验证码;踢出奈飞设备;奈飞同步更新装置代点

zoujiajian 1 rok temu
rodzic
commit
29647c8465
20 zmienionych plików z 269 dodań i 41 usunięć
  1. 1 1
      netflix-common/src/main/java/com/cyksj/common/constant/Constant.java
  2. 19 1
      netflix-common/src/main/java/com/cyksj/common/util/TicketCodeCommonUtil.java
  3. 10 0
      netflix-dao/src/main/java/com/cyksj/model/entity/Account.java
  4. 5 0
      netflix-dao/src/main/java/com/cyksj/model/entity/GroupsRelation.java
  5. 6 0
      netflix-dao/src/main/java/com/cyksj/model/manage/views/AccountView.java
  6. 16 0
      netflix-dao/src/main/java/com/cyksj/model/request/NfDeviceReq.java
  7. 6 0
      netflix-dao/src/main/java/com/cyksj/model/views/RenewalView.java
  8. 1 0
      netflix-service/src/main/java/com/cyksj/redis/RedisService.java
  9. 1 1
      netflix-service/src/main/java/com/cyksj/service/mail/CuiQiuMailService.java
  10. 1 1
      netflix-service/src/main/java/com/cyksj/service/mail/YhMailService.java
  11. 11 12
      netflix-service/src/main/java/com/cyksj/service/mail/impl/CuiQiuMailServiceImpl.java
  12. 9 16
      netflix-service/src/main/java/com/cyksj/service/mail/impl/YhEmailServiceImpl.java
  13. 2 0
      netflix-service/src/main/java/com/cyksj/service/mange/CmsAccountService.java
  14. 26 2
      netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java
  15. 2 0
      netflix-service/src/main/java/com/cyksj/service/relation/GroupRelationFrontService.java
  16. 5 0
      netflix-service/src/main/java/com/cyksj/service/relation/GroupsRelationNetflixService.java
  17. 34 2
      netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java
  18. 75 1
      netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupsRelationNetflixServiceImpl.java
  19. 30 4
      netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java
  20. 9 0
      netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

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

@@ -352,7 +352,7 @@ public interface Constant {
 	/**
 	 * 电影域名
 	 */
-	String ZHAOJU_MOVIES = "http://43.154.169.245:8090";
+	String ZHAOJU_MOVIES = "http://43.154.169.245:8089";
 
 	//英文
 	String EN_US = "en_US";

+ 19 - 1
netflix-common/src/main/java/com/cyksj/common/util/TicketCodeCommonUtil.java

@@ -1,6 +1,10 @@
 package com.cyksj.common.util;
 
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.cyksj.common.exception.BusinessRuntimeException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -13,6 +17,7 @@ import java.util.regex.Pattern;
  */
 
 public class TicketCodeCommonUtil {
+	private static final Logger LOGGER = LoggerFactory.getLogger(TicketCodeCommonUtil.class);
 	/**
 	 * 车票邮箱验证码
 	 */
@@ -32,7 +37,16 @@ public class TicketCodeCommonUtil {
 		if (StrUtil.isNotBlank(code)) {
 			code = code.replace(str, "");
 		}
-		return code;
+		int length = 4;
+		if (goodsId == 33l || goodsId == 45l || goodsId == 18l) {
+			length = 6;
+		}
+		code = StringUtil.getVerifyCodePattern(code, length);
+		if (!Validator.isNumber(code)) {
+			LOGGER.error("获取账号验证码失败:{}", StrUtil.subSufByLength(code, 512));
+			throw BusinessRuntimeException.getInstance("获取验证码失败,请重新获取..");
+		}
+		return code.trim();
 	}
 
 	public static String extractUrl(String body, String prefixUrl) {
@@ -69,6 +83,10 @@ public class TicketCodeCommonUtil {
 				}
 			}
 		}
+		//GPT PLUS
+		if (goodsId == 18l) {
+			str = "X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-80345.templateTenant";
+		}
 		return str;
 	}
 }

+ 10 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/Account.java

@@ -107,4 +107,14 @@ public class Account extends BaseEntity {
      * 账号是否禁用
      */
     private Boolean isDisable;
+
+    /**
+     * cookie nf
+     */
+    private String cookie;
+
+    /**
+     * 关联邮箱 收取邮件
+     */
+    private String relateEmail;
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GroupsRelation.java

@@ -108,6 +108,11 @@ public class GroupsRelation extends BaseEntity {
      */
     private Integer aqType;
 
+    /**
+     * 奈飞pinCode
+     */
+    private String pinCode;
+
 
     @AllArgsConstructor
     @Getter

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/AccountView.java

@@ -164,4 +164,10 @@ public class AccountView {
 
     @DbField("a.is_disable")
     private Boolean isDisable;
+
+    @DbField("a.cookie")
+    private String cookie;
+
+    @DbField("a.relate_email")
+    private Boolean relateEmail;
 }

+ 16 - 0
netflix-dao/src/main/java/com/cyksj/model/request/NfDeviceReq.java

@@ -0,0 +1,16 @@
+package com.cyksj.model.request;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: NfDeviceReq
+ * 创建者: JavaZou
+ * 创建时间:2024/10/14 16:23
+ */
+@Getter
+@Setter
+public class NfDeviceReq {
+	private String url;
+}

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/views/RenewalView.java

@@ -216,6 +216,12 @@ public class RenewalView {
     @DbField("sku.luma_num")
     private Integer lumaNUm;
 
+    /**
+     * 关联邮箱 接收邮件
+     */
+    @DbField("a.relate_email")
+    private String relateEmail;
+
     /**
      * mj 套餐包最低单价
      */

+ 1 - 0
netflix-service/src/main/java/com/cyksj/redis/RedisService.java

@@ -846,6 +846,7 @@ public class RedisService {
         LUMA_USER("luma_user:", "luma_user", 60 * 60 * 2L),
         LUMA_NUM_LIMIT("luma_num_limit:", "luma次数", 60 * 60 * 48L),
         NF_SET_TIME_LIMIT("nf_set_time_limit:", "设置pin码", 60l),
+        NF_KICKOUT_TIME_LIMIT("nf_kickout_time_limit:", "踢出奈飞设备", 60l),
         GOODS_WHOLESALE_KEY("yh_home_paghe_cache:wholesale_key", "平台批发", 60 * 60 * 4L),
         ;
 

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mail/CuiQiuMailService.java

@@ -11,7 +11,7 @@ public interface CuiQiuMailService {
 	/**
 	 * 获取最新邮箱 返回验证码
 	 */
-	String getVerifyCode(String email, Long goodsId, Integer type, Integer linkType) throws Exception;
+	String getVerifyCode(String email, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception;
 
 	boolean isCuiQiuEmail(String account);
 }

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mail/YhMailService.java

@@ -11,5 +11,5 @@ public interface YhMailService {
 	/**
 	 * 获取最新邮箱 返回验证码
 	 */
-	String getVerifyCode(String email, Long goodsId, Integer type, Integer linkType) throws Exception;
+	String getVerifyCode(String email, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception;
 }

+ 11 - 12
netflix-service/src/main/java/com/cyksj/service/mail/impl/CuiQiuMailServiceImpl.java

@@ -9,7 +9,6 @@ import cn.hutool.http.HttpResponse;
 import cn.hutool.http.HttpUtil;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.Jsons;
-import com.cyksj.common.util.StringUtil;
 import com.cyksj.common.util.TicketCodeCommonUtil;
 import com.cyksj.mapper.CuiQiuEmailConfigMapper;
 import com.cyksj.model.dto.CuiQiuEmailDetailDto;
@@ -62,12 +61,12 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 	}
 
 	/**
-	 *
-	 * @param type 1:奈飞安全码
+	 * @param type     1:奈飞安全码
 	 * @param linkType 链接 1:同步验证链接
+	 * @param isReturnDeviceUrl true 直接返回同步装置url
 	 */
 	@Override
-	public String getVerifyCode(String email, Long goodsId, Integer type, Integer linkType) throws Exception {
+	public String getVerifyCode(String email, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception {
 		//获取近二十封邮件
 		String url = "https://domain-open-api.cuiqiu.com/v1/message/list";
 
@@ -119,7 +118,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 			for (CuiQiuEmailDto CuiQiuEmailDto : list) {
 				Long messageId = CuiQiuEmailDto.getId();
 				try {
-					String code = getVerifyCodeByEmail(messageId, goodsId, type, linkType, mailId);
+					String code = getVerifyCodeByEmail(messageId, goodsId, type, linkType, mailId, isReturnDeviceUrl);
 					if (StrUtil.isNotBlank(code)) {
 						return code;
 					}
@@ -140,7 +139,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		return false;
 	}
 
-	public String getVerifyCodeByEmail(Long messageId, Long goodsId, Integer type, Integer linkType, String mailId) throws Exception {
+	public String getVerifyCodeByEmail(Long messageId, Long goodsId, Integer type, Integer linkType, String mailId, Boolean isReturnDeviceUrl) throws Exception {
 		String url = "https://domain-open-api.cuiqiu.com/v1/message/detail";
 		Map<String, Object> params = new HashMap<>();
 		params.put("token", CUI_QIU_TOKEN);
@@ -177,10 +176,14 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 					nfVerifyUrl = TicketCodeCommonUtil.extractUrl(body, urlPref);
 				}
 				if (StrUtil.isEmpty(nfVerifyUrl)) {
-					throw BusinessRuntimeException.getInstance("获取认证链接失败,请重新获取");
+					throw BusinessRuntimeException.getInstance("请在奈飞端点击“传送电子邮件”");
 				}
 				//非点击装置同步更新按钮 直接返回链接
 				if (linkType == 2) return nfVerifyUrl;
+				//直接返回同步装置url
+				if (isReturnDeviceUrl) {
+					return nfVerifyUrl;
+				}
 				//失败返回验证链接
 				if (!groupsRelationNetflix.confirmUpdate(nfVerifyUrl)) {
 					return nfVerifyUrl;
@@ -191,11 +194,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		if (StrUtil.isEmpty(code)) {
 			code = TicketCodeCommonUtil.getTicketCodeStr(body, goodsId);
 		}
-		int length = 4;
-		if (goodsId == 33l || goodsId == 45l) {
-			length = 6;
-		}
-		return StringUtil.getVerifyCodePattern(code, length);
+		return code;
 	}
 
 	/**

+ 9 - 16
netflix-service/src/main/java/com/cyksj/service/mail/impl/YhEmailServiceImpl.java

@@ -1,13 +1,11 @@
 package com.cyksj.service.mail.impl;
 
-import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpStatus;
 import cn.hutool.http.HttpUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.StringUtil;
 import com.cyksj.common.util.TicketCodeCommonUtil;
 import com.cyksj.mapper.sys.SysEmailMapper;
 import com.cyksj.model.entity.SysEmail;
@@ -35,7 +33,7 @@ public class YhEmailServiceImpl implements YhMailService {
 	private final SysEmailMapper sysEmailMapper;
 
 	@Override
-	public String getVerifyCode(String account, Long goodsId, Integer type, Integer linkType) throws Exception {
+	public String getVerifyCode(String account, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception {
 		//获取邮箱密码
 		SysEmail sysEmail = sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class)
 				.eq(SysEmail::getEmail, account)
@@ -62,11 +60,11 @@ public class YhEmailServiceImpl implements YhMailService {
 		if (execute.getStatus() != HttpStatus.HTTP_OK) {
 			throw BusinessRuntimeException.getInstance("获取验证码异常,请联系客服...");
 		}
-		String code = getDifferentGoodsCode(goodsId, execute.body(), type, linkType);
+		String code = getDifferentGoodsCode(goodsId, execute.body(), type, linkType, isReturnDeviceUrl);
 		return code;
 	}
 
-	public String getDifferentGoodsCode(Long goodsId, String body, Integer type, Integer linkType) {
+	public String getDifferentGoodsCode(Long goodsId, String body, Integer type, Integer linkType, Boolean isReturnDeviceUrl) {
 		String code = null;
 		//奈飞
 		if (goodsId == 1) {
@@ -95,11 +93,15 @@ public class YhEmailServiceImpl implements YhMailService {
 					code = StrUtil.subBetween(body, "[" + urlPref, "]");
 				}
 				if (StrUtil.isEmpty(code)) {
-					throw BusinessRuntimeException.getInstance("获取认证链接失败,请重新获取");
+					throw BusinessRuntimeException.getInstance("请在奈飞端点击“传送电子邮件”");
 				}
 				String url = urlPref + code;
 				//非点击装置同步更新按钮 直接返回链接
 				if (linkType == 2) return url;
+				//直接返回同步更新装置url
+				if (isReturnDeviceUrl) {
+					return url;
+				}
 				//失败返回验证链接
 				if (!groupsRelationNetflixService.confirmUpdate(url)) {
 					return url;
@@ -111,16 +113,7 @@ public class YhEmailServiceImpl implements YhMailService {
 		if (StrUtil.isEmpty(code)) {
 			code = TicketCodeCommonUtil.getTicketCodeStr(body, goodsId);
 		}
-		int length = 4;
-		if (goodsId == 33l || goodsId == 45l) {
-			length = 6;
-		}
-		code = StringUtil.getVerifyCodePattern(code, length);
-		if (!Validator.isNumber(code)) {
-			log.error("获取账号验证码失败:{}", StrUtil.subSufByLength(code, 512));
-			throw BusinessRuntimeException.getInstance("获取验证码失败,请重新获取..");
-		}
-		return code.trim();
+		return code;
 	}
 
 }

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/mange/CmsAccountService.java

@@ -55,4 +55,6 @@ public interface CmsAccountService extends IService<Account> {
 	void batchImportBlockedAccount(Long goodsId, List<Object> accountBlockedList);
 
 	String nfUpgradeDevice(Long accountId) throws Exception;
+
+	String getAccountEmailCode(Long accountId) throws Exception;
 }

+ 26 - 2
netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java

@@ -461,12 +461,15 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 		if (StrUtil.hasEmpty(account, password)) {
 			throw BusinessRuntimeException.getInstance("账户异常");
 		}
+		if (StrUtil.isNotEmpty(at.getRelateEmail())) {
+			account = at.getRelateEmail();
+		}
 		if (cuiQiuMailService.isCuiQiuEmail(account)) {
-			return cuiQiuMailService.getVerifyCode(account, at.getGoodsId(), null, 1);
+			return cuiQiuMailService.getVerifyCode(account, at.getGoodsId(), null, 1, false);
 		}
 		String code = null;
 		try {
-			code = yhMailService.getVerifyCode(account, at.getGoodsId(), null, 1);
+			code = yhMailService.getVerifyCode(account, at.getGoodsId(), null, 1, false);
 		} catch (Exception e) {
 			if (e.getMessage() != null && e.getMessage().contains("认证链接")) {
 				throw BusinessRuntimeException.getInstance("请联系用户确认是否发送邮件");
@@ -475,4 +478,25 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 		}
 		return code;
 	}
+
+	@Override
+	public String getAccountEmailCode(Long accountId) throws Exception {
+		Account at = accountMapper.selectById(accountId);
+		String account = at.getAccount();
+		String password = at.getPassword();
+		if (StrUtil.isNotEmpty(at.getRelateEmail())) {
+			account = at.getRelateEmail();
+		}
+		if (StrUtil.hasEmpty(account, password)) {
+			throw BusinessRuntimeException.getInstance("账户异常");
+		}
+		if (StrUtil.isNotEmpty(at.getRelateEmail())) {
+			account = at.getRelateEmail();
+		}
+		if (cuiQiuMailService.isCuiQiuEmail(account)) {
+			return cuiQiuMailService.getVerifyCode(account, at.getGoodsId(), null, null, false);
+		}
+		String code = yhMailService.getVerifyCode(account, at.getGoodsId(), null, null, false);
+		return code;
+	}
 }

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/relation/GroupRelationFrontService.java

@@ -64,4 +64,6 @@ public interface GroupRelationFrontService {
 	GroupsRelation ticketLogin(TicketLoginReq loginReq);
 
 	String outsideTicketVerify(TicketLoginReq loginReq);
+
+	String getNfHouseholdDevice(long userId, Long relationId) throws Exception;
 }

+ 5 - 0
netflix-service/src/main/java/com/cyksj/service/relation/GroupsRelationNetflixService.java

@@ -1,6 +1,7 @@
 package com.cyksj.service.relation;
 
 import cn.hutool.json.JSONObject;
+import com.cyksj.model.request.NfDeviceReq;
 
 import java.util.Date;
 
@@ -24,4 +25,8 @@ public interface GroupsRelationNetflixService {
 	 * 定时设置奈飞座位号
 	 */
 	void timingSetNetflix(Integer num, String nickname, String account, String password, Date expiryTime);
+
+	JSONObject nfKickOut(long userId, Long relationId);
+
+	void clickNfHouseholdDevice(NfDeviceReq nfDeviceReq);
 }

+ 34 - 2
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -535,6 +535,10 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				throw BusinessRuntimeException.getInstance("车票未配置账号");
 			}
 			account = renewalView.getAccount();
+			//收取邮件的关联邮箱
+			if (StrUtil.isNotEmpty(renewalView.getRelateEmail())) {
+				account = renewalView.getRelateEmail();
+			}
 			String password = renewalView.getPassword();
 			if (StrUtil.hasEmpty(account, password)) {
 				throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
@@ -557,10 +561,10 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			}
 		}
 		if (cuiQiuMailService.isCuiQiuEmail(renewalView.getAccount())) {
-			return cuiQiuMailService.getVerifyCode(renewalView.getAccount(), renewalView.getGoodsId(), type, loginReq.getLinkType());
+			return cuiQiuMailService.getVerifyCode(renewalView.getAccount(), renewalView.getGoodsId(), type, loginReq.getLinkType(), false);
 		}
 		//银河域名邮件
-		String code = yhMailService.getVerifyCode(account, renewalView.getGoodsId(), type, loginReq.getLinkType());
+		String code = yhMailService.getVerifyCode(account, renewalView.getGoodsId(), type, loginReq.getLinkType(), false);
 		GroupsRelationLoginCodeRecord record = new GroupsRelationLoginCodeRecord();
 		record.setUserId(userId);
 		record.setRelationId(relationId);
@@ -919,6 +923,34 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		}
 	}
 
+	@Override
+	public String getNfHouseholdDevice(long userId, Long relationId) throws Exception {
+		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();
+		//收取邮件的关联邮箱
+		if (StrUtil.isNotEmpty(renewalView.getRelateEmail())) {
+			account = renewalView.getRelateEmail();
+		}
+		String password = renewalView.getPassword();
+		if (StrUtil.hasEmpty(account, password)) {
+			throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
+		}
+
+		if (cuiQiuMailService.isCuiQiuEmail(renewalView.getAccount())) {
+			return cuiQiuMailService.getVerifyCode(renewalView.getAccount(), renewalView.getGoodsId(), null, 1, true);
+		}
+		//银河域名邮件
+		return yhMailService.getVerifyCode(account, renewalView.getGoodsId(), null, 1, true);
+	}
+
 	private DistributePosterGoodsDetailView setGoodsPoster(RenewalView ticket, User user, List<Long> userIds) {
 		DistributePosterGoodsDetailView distributePosterGoodsDetailView = beanSearcher.searchFirst(DistributePosterGoodsDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
 				.field(DistributePosterGoodsFrontView::getGoodsId, ticket.getGoodsId()).build());

+ 75 - 1
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupsRelationNetflixServiceImpl.java

@@ -18,6 +18,7 @@ import com.cyksj.model.entity.Account;
 import com.cyksj.model.entity.GroupsRelation;
 import com.cyksj.model.entity.GroupsTrips;
 import com.cyksj.model.entity.User;
+import com.cyksj.model.request.NfDeviceReq;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.relation.GroupsRelationNetflixService;
 import com.cyksj.service.user.UserBindRelationService;
@@ -109,7 +110,10 @@ public class GroupsRelationNetflixServiceImpl implements GroupsRelationNetflixSe
 		if (!redisService.setNx(RedisService.key.NF_SET_TIME_LIMIT.getName() + relationId, relationId, RedisService.key.NF_SET_TIME_LIMIT.getTimeout())) {
 			throw BusinessRuntimeException.getInstance("一分钟内可执行一次");
 		}
-		return setNetflixSeatNum(relation.getNum(), user.getNickname(), account.getAccount(), account.getPassword(), relation.getExpiryTime(), code);
+		JSONObject jsonObject = setNetflixSeatNum(relation.getNum(), user.getNickname(), account.getAccount(), account.getPassword(), relation.getExpiryTime(), code);
+		relation.setPinCode(code);
+		relationMapper.updateById(relation);
+		return jsonObject;
 	}
 
 	@Override
@@ -176,4 +180,74 @@ public class GroupsRelationNetflixServiceImpl implements GroupsRelationNetflixSe
 		} catch (Exception e) {
 		}
 	}
+
+	@Override
+	public JSONObject nfKickOut(long userId, Long relationId) {
+		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+		GroupsRelation relation = relationMapper.selectById(relationId);
+		if (!userIdList.contains(relation.getUserId())) {
+			throw BusinessRuntimeException.getInstance("您车票已失效");
+		}
+		GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
+		Account account = accountMapper.selectById(groupsTrips.getAccountId());
+		if (account.getGoodsId() != 1) {
+			throw BusinessRuntimeException.getInstance("系统错误");
+		}
+		User user = userMapper.selectById(relation.getUserId());
+		if (!redisService.setNx(RedisService.key.NF_KICKOUT_TIME_LIMIT.getName()  + relationId, relationId, RedisService.key.NF_KICKOUT_TIME_LIMIT.getTimeout())) {
+			throw BusinessRuntimeException.getInstance("一分钟内可执行一次");
+		}
+		return doNfKickOut(relation.getNum(), user.getNickname(), account.getAccount(), account.getPassword(),account.getCookie(), relation.getExpiryTime(), relation.getPinCode());
+	}
+
+	@Override
+	public void clickNfHouseholdDevice(NfDeviceReq nfDeviceReq) {
+		String url = nfDeviceReq.getUrl();
+		if (!confirmUpdate(url)) {
+			throw BusinessRuntimeException.getInstance("程序代点失败");
+		}
+	}
+
+	/**
+	 * 踢出奈飞设备
+	 */
+	private JSONObject doNfKickOut(Integer seatNum, String seatName, String account, String password, String cookie, Date expiryTime, String code) {
+		JSONObject params = new JSONObject();
+		params.putOpt("username", account);
+		params.putOpt("password", password);
+		params.putOpt("seat_name", seatName);
+		params.putOpt("seat_num", seatNum);
+		params.putOpt("seat_time", expiryTime);
+		if (StrUtil.isNotBlank(code)) {
+			params.putOpt("pin_code", code);
+		}
+		if (StrUtil.isNotEmpty(cookie)) {
+			params.putOpt("cookie", cookie);
+		}
+		//设置座位
+		String url = Constant.ZHAOJU_MOVIES + "/netflix_seat";
+		log.info("设置账号:{} 奈飞用户:{}座位信息", account, seatName);
+		try {
+			HttpResponse<String> res =
+					J11HttpC.custom()
+							.ofPost()
+							.url(url)
+							.headers(J11HttpC.ReqType.raw_json)
+							.body(HttpRequest.BodyPublishers.ofString(Jsons.toJson(params), IoKit.Charsets.UTF_8.getCharset()))
+							.send(HttpResponse.BodyHandlers.ofString());
+			String body = res.body();
+			JSONObject jsonObject = Jsons.parseObject(body, JSONObject.class);
+			JSONObject data = Jsons.parseObject(jsonObject.get("data"), JSONObject.class);
+			Integer status = data.getInt("status");
+			if (status == 2) {
+				log.error("设置用户:{}奈飞座位号失败", seatName);
+			}
+			return data;
+		} catch (Exception e) {
+			log.error("设置用户:{}奈飞座位号错误,msg:{}", seatName, StringUtil.getErrorText(e));
+		}
+		JSONObject jsonObject = new JSONObject();
+		jsonObject.putOpt("status", 2);
+		return jsonObject;
+	}
 }

+ 30 - 4
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -28,10 +28,7 @@ import com.cyksj.model.dto.DoubleVerifyDto;
 import com.cyksj.model.dto.QuestionnaireView;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.manage.views.GroupsRelationView;
-import com.cyksj.model.request.OrderPayRequest;
-import com.cyksj.model.request.OrderRefundReq;
-import com.cyksj.model.request.SpecialGoodsTicketReq;
-import com.cyksj.model.request.TicketLoginReq;
+import com.cyksj.model.request.*;
 import com.cyksj.model.response.GptStandbyResp;
 import com.cyksj.model.views.*;
 import com.cyksj.redis.RedisService;
@@ -58,6 +55,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
@@ -906,6 +904,34 @@ public class GroupRelationController {
         return GatewayResponse.SUCCESS.newBuilder().toResult(groupsRelationNetflixService.getPinStatus(taskId));
     }
 
+    /**
+     * 踢出奈飞设备
+     */
+    @PostMapping("/kickOut/nf/{relationId}")
+    public Result<String> nfKickOut(@PathVariable Long relationId) {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        JSONObject data = groupsRelationNetflixService.nfKickOut(userId, relationId);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(data.toString());
+    }
+
+    /**
+     * 奈飞同户装置链接
+     */
+    @GetMapping("/get/nf/household/device")
+    public Result<String> getNfHouseholdDevice(@NotNull Long relationId) throws Exception {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        String url = groupRelationFrontService.getNfHouseholdDevice(userId, relationId);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(url);
+    }
+
+    /**
+     * 代点奈飞同户装置
+     */
+    @PostMapping("/click/nf/household/device")
+    public void clickNfHouseholdDevice(@RequestBody NfDeviceReq nfDeviceReq) {
+        groupsRelationNetflixService.clickNfHouseholdDevice(nfDeviceReq);
+    }
+
     /**
      * 可选 续费升级车票
      */

+ 9 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -1293,4 +1293,13 @@ public class CmsAccountController {
 		String url = accountService.nfUpgradeDevice(accountId);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(url);
 	}
+
+	/**
+	 * 查看验证码
+	 */
+	@GetMapping("/get/account/email/code")
+	public Result<String> getAccountEmailCode(Long accountId) throws Exception {
+		String code = accountService.getAccountEmailCode(accountId);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(code);
+	}
 }