| | |
| | | } |
| | | |
| | | @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)){ |
| | |
| | | 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) |
| | |
| | | .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); |
| | |
| | | aiProductQuestion.setProductCategoryId(productCategoryId); |
| | | aiProductQuestion.setTitle(title); |
| | | aiProductQuestion.setDifficulty(difficulty); |
| | | aiProductQuestion.setJobId(id); |
| | | aiProductQuestion.setCreatedTime(createdTime); |
| | | this.save(aiProductQuestion); |
| | | JSONArray answerList = questionObj.getJSONArray("answer_list"); |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | @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("文件不能为空"); |
| | |
| | | question.setCompanyId(companyId); |
| | | question.setProductCategoryId(categoryId); |
| | | question.setTitle(title); |
| | | question.setDifficulty(2); // 默认中等难度 |
| | | question.setDifficulty(difficulty); // 默认中等难度 |
| | | question.setState(0); // 默认启用 |
| | | question.setCreatedTime(new Date()); |
| | | |