| | |
| | | import cc.mrbird.febs.ai.mapper.AiProductQuestionJobMapper; |
| | | import cc.mrbird.febs.ai.mapper.AiProductQuestionMapper; |
| | | import cc.mrbird.febs.ai.req.AiProductQuestionAiDto; |
| | | import cc.mrbird.febs.ai.service.AiProductCategoryService; |
| | | import cc.mrbird.febs.ai.service.AiProductQuestionItemService; |
| | | import cc.mrbird.febs.ai.service.AiProductQuestionService; |
| | | import cc.mrbird.febs.ai.service.AiService; |
| | |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * AI产品题目 Service实现类 |
| | |
| | | private final AiProductQuestionMapper aiProductQuestionMapper; |
| | | private final AiProductQuestionJobMapper aiProductQuestionJobMapper; |
| | | private final AiProductQuestionItemService aiProductQuestionItemService; |
| | | private final AiProductCategoryService aiProductCategoryService; |
| | | private final AiService aiService; |
| | | private final AgentProducer agentProducer; |
| | | |
| | |
| | | query.ne(AiProductQuestion::getState, 2); |
| | | query.orderByDesc(AiProductQuestion::getCreatedTime); |
| | | Page<AiProductQuestion> pages = aiProductQuestionMapper.selectPage(page, query); |
| | | List<AiProductQuestion> records = pages.getRecords(); |
| | | if (CollUtil.isNotEmpty( records)){ |
| | | //stream流操作records,获取全部的productCategoryId的set集合 |
| | | Set<String> productCategoryIds = records.stream().map(AiProductQuestion::getProductCategoryId).collect(Collectors.toSet()); |
| | | if(CollUtil.isNotEmpty( productCategoryIds)){ |
| | | Map<String,AiProductCategory> map = aiProductCategoryService.selectMapByIds(productCategoryIds); |
| | | for (AiProductQuestion record : records){ |
| | | AiProductCategory orDefault = map.getOrDefault(record.getProductCategoryId(), null); |
| | | if(ObjectUtil.isNotNull(orDefault)){ |
| | | record.setProductCategoryName(orDefault.getName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return pages; |
| | | } |
| | | |