zoujiajian hace 1 año
padre
commit
8029db1b96

+ 16 - 6
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -1088,12 +1088,12 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	@Override
 	public void syncExcelAccountState(String account, String password) {
-		Integer selectCount = accountNetflixStateMapper.selectCount(Wrappers.lambdaQuery(AccountNetflixState.class)
-				.eq(AccountNetflixState::getAccount, account));
-		if (selectCount > 0) {
-			log.info("该账号:{}已经同步", account);
-			return;
-		}
+//		Integer selectCount = accountNetflixStateMapper.selectCount(Wrappers.lambdaQuery(AccountNetflixState.class)
+//				.eq(AccountNetflixState::getAccount, account));
+//		if (selectCount > 0) {
+//			log.info("该账号:{}已经同步", account);
+//			return;
+//		}
 
 
 		try {
@@ -1136,6 +1136,16 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		}
 	}
 
+	public static void main(String[] args) {
+		System.out.println("vysniusabitu8986@outlook.com");
+		System.out.println("gerqjayjmyp@eggks.cc");
+		System.out.println("KSLC1NZWL@yinhe.ac.cn");
+		System.out.println("iwiudxsomn66@outlook.com");
+		System.out.println("wjxevmssqxuhh@outlook.com");
+		System.out.println("hvrvbssn@eggks.cc");
+		System.out.println("oerqdpazlcpon@outlook.com");
+	}
+
 	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());

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

@@ -213,7 +213,7 @@ public class GroupsRelationNetflixServiceImpl implements GroupsRelationNetflixSe
 		JSONObject params = new JSONObject();
 		params.putOpt("username", at);
 		params.putOpt("password", pd);
-		String url = "http://netflix.galaxydvd.com/frpnetflix_check_account";
+		String url = "http://124.220.3.236:8089/frpnetflix_check_account";
 		HttpResponse<String> res =
 				J11HttpC.custom()
 						.ofPost()
@@ -233,7 +233,7 @@ public class GroupsRelationNetflixServiceImpl implements GroupsRelationNetflixSe
 		JSONObject params = new JSONObject();
 		params.putOpt("transId", state.getTaskId());
 		//查询任务状态
-		String url = "http://netflix.galaxydvd.com/frp/netflix_task_status";
+		String url = "http://124.220.3.236:8089/netflix_task_status";
 		HttpResponse<String> res =
 				J11HttpC.custom()
 						.ofPost()
@@ -253,7 +253,7 @@ public class GroupsRelationNetflixServiceImpl implements GroupsRelationNetflixSe
 		JSONObject params = new JSONObject();
 		params.putOpt("username", account);
 		params.putOpt("password", password);
-		String url = "http://netflix.galaxydvd.com/frpnetflix_check_account";
+		String url = "http://124.220.3.236:8089/netflix_check_account";
 		HttpResponse<String> res =
 				J11HttpC.custom()
 						.ofPost()

+ 63 - 0
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -1159,5 +1159,68 @@ public class GroupRelationController {
         return GatewayResponse.SUCCESS.newBuilder().toResult("成功");
     }
 
+    private final AccountMapper accountMapper;
 
+    private final GroupsMapper groupsMapper;
+
+    @PostMapping("/excel")
+    public Result<String> excel(MultipartFile file) throws IOException {
+        AtomicInteger normal = new AtomicInteger(0);
+        AtomicInteger abNormal = new AtomicInteger(0);
+        EasyExcel.read(file.getInputStream(), ExcelAccountStateData.class, new AnalysisEventListener<ExcelAccountStateData>() {
+            @Override
+            public void invoke(ExcelAccountStateData data, AnalysisContext analysisContext) {
+                String account = data.getAccount();
+                String password = data.getPassword();
+
+                if (StrUtil.isEmpty(account) || StrUtil.isEmpty(password)) {
+                    log.info("账号或密码为空");
+                    return;
+                }
+                Integer state = accountMapper.isNormal(account);
+
+                if (state == null) {
+                    log.info("{}暂无iu同步", account);
+                    groupRelationFrontService.syncExcelAccountState(account, password);
+                    state = accountMapper.isNormal(account);
+                }
+
+                if (state == 1) {
+                    Account dbAccount = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class)
+                            .eq(Account::getAccount, account)
+                            .eq(Account::getGoodsId, 1)
+                            .last("limit 1"));
+
+                    if (dbAccount != null) {
+                        GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
+                                .eq(GroupsTrips::getAccountId, dbAccount.getId())
+                                .last("limit 1"));
+                        if (groupsTrips.getStatus() == GroupsTrips.Status.down) {
+                            log.info("{}是否正常", account);
+//                            groupRelationFrontService.syncExcelAccountState(account, password);
+                            state = accountMapper.isNormal(account);
+                            if (state == 1) {
+                                log.info("account:{} 正常", account);
+                                groupsTrips.setStatus(GroupsTrips.Status.validity);
+                                groupsMapper.updateById(groupsTrips);
+                                normal.incrementAndGet();
+                            } else {
+                                abNormal.incrementAndGet();
+                            }
+                        }
+                    }
+                } else {
+                    abNormal.incrementAndGet();
+                }
+            }
+
+            @Override
+            public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+
+            }
+        }).sheet().doRead();
+        System.out.println("正:" + normal.get());
+        System.out.println("异常:" + abNormal.get());
+        return GatewayResponse.SUCCESS.newBuilder().toResult("成功");
+    }
 }