zoujiajian před 1 rokem
rodič
revize
2995e1fdfc

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/mapper/AccountMapper.java

@@ -32,4 +32,6 @@ public interface AccountMapper extends BaseMapper<Account> {
 	Integer isNormal(String account);
 
 	List<Account> selectNetflixAccountLimit(int limit);
+
+	List<Account> selectYinhelxComAccount();
 }

+ 11 - 0
netflix-dao/src/main/resources/mapper/AccountMapper.xml

@@ -207,4 +207,15 @@
     <select id="selectNetflixAccountLimit" resultType="com.cyksj.model.entity.Account">
         select * from account_netflix_state where state = 0 limit #{limit}
     </select>
+
+    <select id="selectYinhelxComAccount" resultType="com.cyksj.model.entity.Account">
+        select *
+        from account a
+        where account like '%yinhelx.com'
+          and goods_id = 1
+          and not exists(select 1
+                         from account_netflix_state ans
+                         where ans.account = a.account and ans.created_time > '2024-11-11 17:02:00')
+            limit 5
+    </select>
 </mapper>

+ 9 - 1
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -1044,13 +1044,21 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	@Override
 	public void syncNfAccountState() {
-		List<Account> accounts = accountMapper.selectNetflixAccountLimit(5);
+//		List<Account> accounts = accountMapper.selectNetflixAccountLimit(5);
+		List<Account> accounts = accountMapper.selectYinhelxComAccount();
 		if (CollUtil.isEmpty(accounts)) {
 			throw BusinessRuntimeException.getInstance("已同步完成");
 		}
 		accounts.forEach(account -> {
 			try {
 				String taskId = groupsRelationNetflixService.createNetflixAccountStatusTask(account);
+				AccountNetflixState exist = accountNetflixStateMapper.selectOne(Wrappers.lambdaQuery(AccountNetflixState.class)
+						.eq(AccountNetflixState::getAccount, account.getAccount())
+						.lt(AccountNetflixState::getCreatedTime, DateUtil.parse("2024-11-11 17:52:00"))
+						.last("limit 1"));
+				if (exist != null) {
+					accountNetflixStateMapper.deleteById(exist.getId());
+				}
 				log.info("任务taskId:{}", taskId);
 				AccountNetflixState accountNetflixState = new AccountNetflixState();
 				accountNetflixState.setAccount(account.getAccount());