Administrator
2026-02-12 a325c295cc5c0943d9345cd3868164dc5e90eace
src/main/java/cc/mrbird/febs/ai/service/impl/AiProductQuestionServiceImpl.java
@@ -222,6 +222,20 @@
    }
    @Override
    public FebsResponse jobStateUpdate(String ids) {
        if (StrUtil.isEmpty(ids)) {
            throw new FebsException("参数错误");
        }
        List<String> idList = StrUtil.split(ids, ',');
        aiProductQuestionJobMapper.update(null,
                Wrappers.lambdaUpdate(AiProductQuestionJob.class)
                        .set(AiProductQuestionJob::getState, 2)
                        .set(AiProductQuestionJob::getUpdatedTime, new Date())
                        .in(AiProductQuestionJob::getId, idList));
        return new FebsResponse().success().message("操作成功");
    }
    @Override
    public FebsResponse delete(String id) {
        AiProductQuestion entity = this.getById(id);
        if(ObjectUtil.isNotNull( entity)){
@@ -354,7 +368,6 @@
            Integer questionCnt = aiProductQuestionJob.getQuestionCnt();
            Integer questionDoneCnt = aiProductQuestionJob.getQuestionDoneCnt();
            if (questionCnt <= questionDoneCnt){
                aiProductQuestionJob.setState(2);
                aiProductQuestionJobMapper.update(null,
                        Wrappers.lambdaUpdate(AiProductQuestionJob.class)
                                .set(AiProductQuestionJob::getState, 2)
@@ -362,10 +375,11 @@
                                .eq(AiProductQuestionJob::getId, id));
                return;
            }
//            int i = questionCnt - questionDoneCnt;
//            if (i >= 5){
//                i = 5;
//            }
            int i = questionCnt - questionDoneCnt;
            if (i >= 5){
                i = 5;
            }
            AiProductQuestionAiDto dto = new AiProductQuestionAiDto();
            String jsonFormat = "{\"question_list\":[{\"title\": \"消费者对透明质酸的主要担忧是什么?\",\"answer_list\":[{\"answer\": \"消费者担心透明质酸维持时间短,效果不明显。\",\"type\": 1,\"analysis\": \"\"},{\"answer\": \"消费者担心透明质酸注射后可能出现移位、凹陷、馒化、僵硬以及炎症反应。\",\"type\": 1,\"analysis\": \"\"},{\"answer\": \"消费者的主要担忧包括效果不明显、维持时间短、注射后出现移位、凹陷、馒化、僵硬以及炎症反应。他们希望既达到理想效果,又避免这些副作用。\",\"type\": 2,\"analysis\": \"标准答案涵盖了消费者对透明质酸的所有主要担忧,既包括效果问题,也涵盖副作用风险,全面反映消费者心理需求。\"}]}]} ";
            dto.setJsonFormat(jsonFormat);
@@ -394,6 +408,7 @@
                    aiProductQuestion.setProductCategoryId(productCategoryId);
                    aiProductQuestion.setTitle(title);
                    aiProductQuestion.setDifficulty(difficulty);
                    aiProductQuestion.setJobId(id);
                    aiProductQuestion.setCreatedTime(createdTime);
                    this.save(aiProductQuestion);
                    JSONArray answerList = questionObj.getJSONArray("answer_list");
@@ -418,7 +433,6 @@
                        Wrappers.lambdaUpdate(AiProductQuestionJob.class)
                                .set(AiProductQuestionJob::getQuestionDoneCnt, questionDoneCnt + questionList.size())
                                .set(AiProductQuestionJob::getUpdatedTime, new Date())
                                .set(AiProductQuestionJob::getState, 1)
                                .eq(AiProductQuestionJob::getId, id));
            }
            AiProductQuestionJob aiProductQuestionJobDone = aiProductQuestionJobMapper.selectById(id);
@@ -725,7 +739,7 @@
    }
    @Override
    public FebsResponse importNewProductQuestion(MultipartFile file, String categoryId, String companyId) {
    public FebsResponse importNewProductQuestion(MultipartFile file, String categoryId, String companyId, Integer difficulty) {
        try {
            if (file.isEmpty()) {
                return new FebsResponse().fail().message("文件不能为空");
@@ -840,7 +854,7 @@
                    question.setCompanyId(companyId);
                    question.setProductCategoryId(categoryId);
                    question.setTitle(title);
                    question.setDifficulty(2); // 默认中等难度
                    question.setDifficulty(difficulty); // 默认中等难度
                    question.setState(0); // 默认启用
                    question.setCreatedTime(new Date());