|
|
@@ -90,4 +90,49 @@ public class AccountCommonServiceImpl implements AccountCommonService {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 除去yinhe.ac 奈飞账号 同步奈飞账号状态
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void syncAc() {
|
|
|
+ List<Account> accounts = accountMapper.selectAc();
|
|
|
+ if (CollUtil.isEmpty(accounts)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("已同步完成");
|
|
|
+ }
|
|
|
+ accounts.forEach(account -> {
|
|
|
+ try {
|
|
|
+ AccountNetflixState exist = accountNetflixStateMapper.selectOne(Wrappers.lambdaQuery(AccountNetflixState.class)
|
|
|
+ .eq(AccountNetflixState::getAccount, account.getAccount())
|
|
|
+ .lt(AccountNetflixState::getCreatedTime, DateUtil.parse("2024-11-28 14:22:00"))
|
|
|
+ .last("limit 1"));
|
|
|
+ if (exist != null) {
|
|
|
+ accountNetflixStateMapper.deleteById(exist.getId());
|
|
|
+ }
|
|
|
+ String taskId = groupsRelationNetflixService.createNetflixAccountStatusTask(account);
|
|
|
+ log.info("任务taskId:{}", taskId);
|
|
|
+ AccountNetflixState accountNetflixState = new AccountNetflixState();
|
|
|
+ accountNetflixState.setAccount(account.getAccount());
|
|
|
+ accountNetflixState.setPassword(account.getPassword());
|
|
|
+ accountNetflixState.setState(0);
|
|
|
+ accountNetflixState.setTaskId(taskId);
|
|
|
+ accountNetflixState.setRemark("28号");
|
|
|
+ accountNetflixStateMapper.insert(accountNetflixState);
|
|
|
+
|
|
|
+ Integer status = groupsRelationNetflixService.checkNetflixAccountState(accountNetflixState);
|
|
|
+ while (status == 0) {
|
|
|
+ Thread.sleep(2000);
|
|
|
+ try {
|
|
|
+ status = groupsRelationNetflixService.checkNetflixAccountState(accountNetflixState);
|
|
|
+ } catch (Exception e) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ accountNetflixState.setState(status);
|
|
|
+ accountNetflixStateMapper.updateById(accountNetflixState);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("创建检测奈飞账号状态任务失败:{}", StringUtil.getErrorText(e));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|