|
@@ -339,11 +339,14 @@ public class AIQuestionServiceImpl extends ServiceImpl<AIQuestionMapper, AIQuest
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Map<String,Object> resMap = new HashMap<>();
|
|
|
|
+
|
|
if(null == questionBO.getQuestionId()){
|
|
if(null == questionBO.getQuestionId()){
|
|
//提问获取回答,再插入
|
|
//提问获取回答,再插入
|
|
AIQuestion aiQuestion = new AIQuestion();
|
|
AIQuestion aiQuestion = new AIQuestion();
|
|
aiQuestion.setCompanyId(user.getCompanyId());
|
|
aiQuestion.setCompanyId(user.getCompanyId());
|
|
aiQuestion.setCreatorId(user.getId());
|
|
aiQuestion.setCreatorId(user.getId());
|
|
|
|
+ aiQuestion.setName(questionBO.getContent());
|
|
aiQuestionMapper.insert(aiQuestion);
|
|
aiQuestionMapper.insert(aiQuestion);
|
|
|
|
|
|
Integer questionId = aiQuestion.getQuestionId();
|
|
Integer questionId = aiQuestion.getQuestionId();
|
|
@@ -372,6 +375,8 @@ public class AIQuestionServiceImpl extends ServiceImpl<AIQuestionMapper, AIQuest
|
|
aiAnswer.setStartDate(questionBO.getStartDate());
|
|
aiAnswer.setStartDate(questionBO.getStartDate());
|
|
aiAnswer.setEndDate(questionBO.getEndDate());
|
|
aiAnswer.setEndDate(questionBO.getEndDate());
|
|
aiQuestionDetailMapper.insert(aiAnswer);
|
|
aiQuestionDetailMapper.insert(aiAnswer);
|
|
|
|
+
|
|
|
|
+ resMap.put("questionId",questionId);
|
|
} else {
|
|
} else {
|
|
Integer questionId = questionBO.getQuestionId();
|
|
Integer questionId = questionBO.getQuestionId();
|
|
AIQuestionDetail lastOne = aiQuestionDetailMapper.selectOne(new LambdaQueryWrapper<AIQuestionDetail>()
|
|
AIQuestionDetail lastOne = aiQuestionDetailMapper.selectOne(new LambdaQueryWrapper<AIQuestionDetail>()
|
|
@@ -410,9 +415,12 @@ public class AIQuestionServiceImpl extends ServiceImpl<AIQuestionMapper, AIQuest
|
|
aiAnswer.setEndDate(questionBO.getEndDate());
|
|
aiAnswer.setEndDate(questionBO.getEndDate());
|
|
aiQuestionDetailMapper.insert(aiAnswer);
|
|
aiQuestionDetailMapper.insert(aiAnswer);
|
|
|
|
|
|
|
|
+ resMap.put("questionId",questionId);
|
|
}
|
|
}
|
|
|
|
|
|
- httpRespMsg.setData(queryRes);
|
|
|
|
|
|
+
|
|
|
|
+ resMap.put("queryRes",queryRes);
|
|
|
|
+ httpRespMsg.setData(resMap);
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -472,6 +480,44 @@ public class AIQuestionServiceImpl extends ServiceImpl<AIQuestionMapper, AIQuest
|
|
.body(out.toByteArray());
|
|
.body(out.toByteArray());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getLatestQuestionList(HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ AIQuestion aiQuestion = aiQuestionMapper.selectOne(new LambdaQueryWrapper<AIQuestion>()
|
|
|
|
+ .eq(AIQuestion::getCreatorId, user.getId())
|
|
|
|
+ .orderByDesc(AIQuestion::getCreateTime)
|
|
|
|
+ .last(" limit 1")
|
|
|
|
+ );
|
|
|
|
+ Map<String,Object> resMap = new HashMap<>();
|
|
|
|
+ if(null != aiQuestion){
|
|
|
|
+ List<AIQuestionDetail> aiQuestionDetails = aiQuestionDetailMapper.selectList(new LambdaQueryWrapper<AIQuestionDetail>()
|
|
|
|
+ .select(AIQuestionDetail::getQuestionId, AIQuestionDetail::getSeq
|
|
|
|
+ , AIQuestionDetail::getType, AIQuestionDetail::getContent)
|
|
|
|
+ .eq(AIQuestionDetail::getQuestionId, aiQuestion.getQuestionId())
|
|
|
|
+ .orderByAsc(AIQuestionDetail::getSeq)
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ resMap.put("latestQuestionId",aiQuestion.getQuestionId());
|
|
|
|
+ resMap.put("contents",aiQuestionDetails);
|
|
|
|
+ httpRespMsg.setData(resMap);
|
|
|
|
+ }
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getHisQuestion(HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ List<AIQuestion> aiQuestions = aiQuestionMapper.selectList(new LambdaQueryWrapper<AIQuestion>()
|
|
|
|
+ .eq(AIQuestion::getCreatorId, user.getId())
|
|
|
|
+ .orderByDesc(AIQuestion::getCreateTime)
|
|
|
|
+ );
|
|
|
|
+ httpRespMsg.setData(aiQuestions);
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static List<Map<String, Object>> convertListWithAlias(ResultSet rs) {
|
|
public static List<Map<String, Object>> convertListWithAlias(ResultSet rs) {
|
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
try {
|
|
try {
|