| 
					
				 | 
			
			
				@@ -9,6 +9,7 @@ import com.google.common.collect.Lists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.google.common.util.concurrent.ThreadFactoryBuilder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.CommonThreadPoolExecutor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.FieshuTableColumnDataTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.aigc.MiniprogramUseTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.aigc.ProduceContentAuditStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.recommend.AccountBusinessTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -20,10 +21,7 @@ import com.tzld.longarticle.recommend.server.mapper.growth.NewPushMessageCallbac 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.dto.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.dto.aigc.BadCrawlerAccountDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlan; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceReviewRecord; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.model.entity.aigc.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.entity.crawler.GetOffVideoCrawler; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.entity.crawler.LongArticlesVideo; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -110,6 +108,8 @@ public class XxlJobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ProducePlanRepository producePlanRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private AIGCProduceContentAuditService aigcProduceContentAuditService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private AccountRepository accountRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ExecutorService thread = new CommonThreadPoolExecutor( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             5, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -843,4 +843,82 @@ public class XxlJobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ReturnT.SUCCESS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @XxlJob("refreshAccountJob") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ReturnT<String> refreshAccount(String param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> accountIds = publishContentMapper.getPublishAccountIds(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Account> accountList = publishContentMapper.getAccountByIds(accountIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Account> existsAccounts = accountRepository.findAll(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Account> existsAccountMap = existsAccounts.stream().collect( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Collectors.toMap(Account::getId, Function.identity())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> existsAccountIds = existsAccounts.stream().map(Account::getId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long now = System.currentTimeMillis(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, List<Integer>> accountNameMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (Account account : accountList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String type = StringUtils.hasText(account.getType()) && account.getType().contains("买号") ? "买号" : "代运营"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 投流判断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<PublishPlanMiniprogramTask> miniprogramTaskList = publishContentMapper.getAccountMiniprogramTaskList(account.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (CollectionUtil.isNotEmpty(miniprogramTaskList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<Integer> useTypeList = miniprogramTaskList.stream().map(PublishPlanMiniprogramTask::getMiniprogramUseType) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (Integer useType : useTypeList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (useType.equals(MiniprogramUseTypeEnum.Touliu.getVal()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            || useType.equals(MiniprogramUseTypeEnum.Daitou.getVal()))  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        type = MiniprogramUseTypeEnum.from(useType).getDescription(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (useTypeList.size() > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    accountNameMap.put(account.getName(), useTypeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            account.setType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!existsAccountIds.contains(account.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                account.setStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                account.setCreateTimestamp(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Account existAccount = existsAccountMap.get(account.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                account.setStatus(existAccount.getStatus()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                account.setCreateTimestamp(existAccount.getCreateTimestamp()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            account.setUpdateTimestamp(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            accountRepository.save(account); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sendRefreshAccountMsg(accountNameMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return ReturnT.SUCCESS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void sendRefreshAccountMsg(Map<String, List<Integer>> accountNameMap) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtil.isNotEmpty(accountNameMap)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<FeishuTableDTO.Column> columns = buildRefreshAccountColumns(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<JSONObject> rows = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Map.Entry<String, List<Integer>> entry : accountNameMap.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JSONObject row = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                row.put("account_name", entry.getKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<String> useTypeList = entry.getValue().stream().map(MiniprogramUseTypeEnum::from) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .map(MiniprogramUseTypeEnum::getDescription).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                row.put("ues_type", useTypeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rows.add(row); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            FeishuTableDTO tableDTO = FeishuTableDTO.createTable("账号类型更新异常", columns, rows, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            JSONObject content = JSONObject.parseObject(JSONObject.toJSONString(tableDTO)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            JSONObject bodyParam = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bodyParam.put("msg_type", "interactive"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bodyParam.put("card", content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.DAILY.getRobotId(), bodyParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private List<FeishuTableDTO.Column> buildRefreshAccountColumns() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FeishuTableDTO.Column> columns = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FeishuTableDTO.Column planIdColumn = FeishuTableDTO.createFeishuColumns( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FieshuTableColumnDataTypeEnum.TEXT.getType(), "account_name", "账号名称", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        columns.add(planIdColumn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FeishuTableDTO.Column planNameColumn = FeishuTableDTO.createFeishuColumns( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FieshuTableColumnDataTypeEnum.TEXT.getType(), "ues_type", "用途类型列表", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        columns.add(planNameColumn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return columns; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |