|  | @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleCategoryStatusEnum;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleAuditMapper;
 | 
	
		
			
				|  |  | +import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleCategoryMapper;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.model.dto.kimi.KimiResult;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord;
 | 
	
	
		
			
				|  | @@ -15,9 +16,9 @@ import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanExeRecor
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanRepository;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.repository.longArticle.ArticleCategoryRepository;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticleTitleAuditRepository;
 | 
	
		
			
				|  |  | -import com.tzld.longarticle.recommend.server.service.recommend.ArticleCategoryService;
 | 
	
		
			
				|  |  |  import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  | +import org.apache.commons.collections4.CollectionUtils;
 | 
	
		
			
				|  |  |  import org.apache.poi.ss.usermodel.Cell;
 | 
	
		
			
				|  |  |  import org.apache.poi.ss.usermodel.Row;
 | 
	
		
			
				|  |  |  import org.apache.poi.ss.usermodel.Sheet;
 | 
	
	
		
			
				|  | @@ -32,6 +33,7 @@ import org.springframework.util.StringUtils;
 | 
	
		
			
				|  |  |  import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  import java.io.FileOutputStream;
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  import java.util.Map;
 | 
	
		
			
				|  |  |  import java.util.Objects;
 | 
	
	
		
			
				|  | @@ -50,7 +52,7 @@ public class ArticleVideoAuditTest {
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      private ProducePlanRepository producePlanRepository;
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  | -    private ArticleCategoryService articleCategoryService;
 | 
	
		
			
				|  |  | +    private ArticleCategoryMapper articleCategoryMapper;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      ArticleCategoryRepository articleCategoryRepository;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
	
		
			
				|  | @@ -177,4 +179,41 @@ public class ArticleVideoAuditTest {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return prompt.toString();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Test
 | 
	
		
			
				|  |  | +    public void articleCategoryAdd() {
 | 
	
		
			
				|  |  | +        List<ArticleCategory> oldList = articleCategoryRepository.getByStatusAndVersion(
 | 
	
		
			
				|  |  | +                ArticleCategoryStatusEnum.SUCCESS.getCode(), 1);
 | 
	
		
			
				|  |  | +        Map<String, ArticleCategory> oldMap = oldList.stream()
 | 
	
		
			
				|  |  | +                .filter(o -> !o.getProduceContentId().startsWith("video"))
 | 
	
		
			
				|  |  | +                .collect(Collectors.toMap(ArticleCategory::getProduceContentId, o -> o));
 | 
	
		
			
				|  |  | +        List<String> oldIds = oldList.stream().map(ArticleCategory::getProduceContentId)
 | 
	
		
			
				|  |  | +                .filter(o -> !o.startsWith("video"))
 | 
	
		
			
				|  |  | +                .collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        List<ArticleCategory> newList = articleCategoryRepository.getByStatusAndVersion(
 | 
	
		
			
				|  |  | +                ArticleCategoryStatusEnum.SUCCESS.getCode(), 2);
 | 
	
		
			
				|  |  | +        List<String> newIds = newList.stream().map(ArticleCategory::getProduceContentId)
 | 
	
		
			
				|  |  | +               .filter(o ->!o.startsWith("video"))
 | 
	
		
			
				|  |  | +               .collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        List<ArticleCategory> saveList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (String oldId : oldIds) {
 | 
	
		
			
				|  |  | +            if (newIds.contains(oldId)) {
 | 
	
		
			
				|  |  | +                continue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            ArticleCategory articleCategory = oldMap.get(oldId);
 | 
	
		
			
				|  |  | +            articleCategory.setVersion(2);
 | 
	
		
			
				|  |  | +            articleCategory.setKimiResult(null);
 | 
	
		
			
				|  |  | +            articleCategory.setId(null);
 | 
	
		
			
				|  |  | +            articleCategory.setStatus(0);
 | 
	
		
			
				|  |  | +            articleCategory.setCategory(null);
 | 
	
		
			
				|  |  | +            articleCategory.setFailReason(null);
 | 
	
		
			
				|  |  | +            articleCategory.setRetryTimes(null);
 | 
	
		
			
				|  |  | +            articleCategory.setCreateTimestamp(System.currentTimeMillis());
 | 
	
		
			
				|  |  | +            saveList.add(articleCategory);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(saveList)) {
 | 
	
		
			
				|  |  | +            articleCategoryMapper.batchInsertArticleCategory(saveList);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |