|
|
@ -30,6 +30,7 @@ import jakarta.servlet.ServletOutputStream;
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.core.io.Resource;
|
|
|
|
import org.springframework.core.io.Resource;
|
|
|
|
import org.springframework.core.io.ResourceLoader;
|
|
|
|
import org.springframework.core.io.ResourceLoader;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@ -76,6 +77,7 @@ public class AskQuestionLibraryManageServiceImpl implements AskQuestionLibraryMa
|
|
|
|
public Page<AskQuestionLibraryResVo> queryPageList(Integer pageNum, Integer pageSize,
|
|
|
|
public Page<AskQuestionLibraryResVo> queryPageList(Integer pageNum, Integer pageSize,
|
|
|
|
AskQuestionLibraryReqVo askQuestionLibraryReqVo) {
|
|
|
|
AskQuestionLibraryReqVo askQuestionLibraryReqVo) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询标准问题
|
|
|
|
Page<AskQuestionLibraryResVo> askQuestionLibraryResVoPage = askTemplateQuestionLibraryService.queryPageList(pageNum, pageSize, askQuestionLibraryReqVo);
|
|
|
|
Page<AskQuestionLibraryResVo> askQuestionLibraryResVoPage = askTemplateQuestionLibraryService.queryPageList(pageNum, pageSize, askQuestionLibraryReqVo);
|
|
|
|
if (CollUtil.isNotEmpty(askQuestionLibraryResVoPage.getRecords())){
|
|
|
|
if (CollUtil.isNotEmpty(askQuestionLibraryResVoPage.getRecords())){
|
|
|
|
List<String> libraryQuestionIds = askQuestionLibraryResVoPage.getRecords().stream().map(AskQuestionLibraryResVo::getLibraryQuestionId).collect(Collectors.toList());
|
|
|
|
List<String> libraryQuestionIds = askQuestionLibraryResVoPage.getRecords().stream().map(AskQuestionLibraryResVo::getLibraryQuestionId).collect(Collectors.toList());
|
|
|
@ -102,14 +104,15 @@ public class AskQuestionLibraryManageServiceImpl implements AskQuestionLibraryMa
|
|
|
|
|
|
|
|
|
|
|
|
CommonDic commonDic = commonDicService.lambdaQuery().eq(CommonDic::getId, askTemplateQuestionLibrary.getDictId()).one();
|
|
|
|
CommonDic commonDic = commonDicService.lambdaQuery().eq(CommonDic::getId, askTemplateQuestionLibrary.getDictId()).one();
|
|
|
|
Assert.notNull(commonDic,"字典信息不存在");
|
|
|
|
Assert.notNull(commonDic,"字典信息不存在");
|
|
|
|
// 不存在,则新增
|
|
|
|
// 查询标准问题是否存在 不存在,则新增
|
|
|
|
AskTemplateQuestionLibrary one = askTemplateQuestionLibraryService.lambdaQuery().eq(AskTemplateQuestionLibrary::getDictId, askTemplateQuestionLibrary.getDictId()).one();
|
|
|
|
AskTemplateQuestionLibrary one = askTemplateQuestionLibraryService.lambdaQuery().eq(AskTemplateQuestionLibrary::getDictId, askTemplateQuestionLibrary.getDictId()).one();
|
|
|
|
|
|
|
|
// 根据标准问题查询对应相似问题
|
|
|
|
Map<String, List<String>> questionMap = askTemplateQuestionSimilarityService.querySimilarityQuestionMapByLibraryLists(CollUtil.newArrayList(one));
|
|
|
|
Map<String, List<String>> questionMap = askTemplateQuestionSimilarityService.querySimilarityQuestionMapByLibraryLists(CollUtil.newArrayList(one));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 原始数据已经存在,更新数据
|
|
|
|
// (标准问题)原始数据已经存在,更新数据
|
|
|
|
if (Objects.nonNull(one)){
|
|
|
|
if (Objects.nonNull(one)){
|
|
|
|
// 更新数据
|
|
|
|
// 更新问题到相似问题 数据
|
|
|
|
List<String> questionList = questionMap.get(one.getId());
|
|
|
|
List<String> questionList = questionMap.get(one.getId());
|
|
|
|
// 相似问不为空。查看相似问是否存在
|
|
|
|
// 相似问不为空。查看相似问是否存在
|
|
|
|
if (CollUtil.isEmpty(questionList) || !questionList.contains(askTemplateQuestionLibrary.getStandardQuestion())) {
|
|
|
|
if (CollUtil.isEmpty(questionList) || !questionList.contains(askTemplateQuestionLibrary.getStandardQuestion())) {
|
|
|
@ -129,7 +132,7 @@ public class AskQuestionLibraryManageServiceImpl implements AskQuestionLibraryMa
|
|
|
|
// askTemplateQuestionLibrary.getQuestion().add(commonDic.getDescription());
|
|
|
|
// askTemplateQuestionLibrary.getQuestion().add(commonDic.getDescription());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// 获取nexCode
|
|
|
|
// 获取nexCode 获取的是redis中的问题库
|
|
|
|
String nextCode = RedisSequenceUtil.getQuestionLibraryCode(() -> {
|
|
|
|
String nextCode = RedisSequenceUtil.getQuestionLibraryCode(() -> {
|
|
|
|
String maxCode = askTemplateQuestionLibraryService.getMaxCode();
|
|
|
|
String maxCode = askTemplateQuestionLibraryService.getMaxCode();
|
|
|
|
if (StrUtil.isNotEmpty(maxCode)) {
|
|
|
|
if (StrUtil.isNotEmpty(maxCode)) {
|
|
|
@ -194,7 +197,7 @@ public class AskQuestionLibraryManageServiceImpl implements AskQuestionLibraryMa
|
|
|
|
log.info("uploadQuestionLibrary : 读取文件耗时:{} s" , timer.intervalSecond());
|
|
|
|
log.info("uploadQuestionLibrary : 读取文件耗时:{} s" , timer.intervalSecond());
|
|
|
|
|
|
|
|
|
|
|
|
// 校验模板是否正确
|
|
|
|
// 校验模板是否正确
|
|
|
|
assertTitle(reader);
|
|
|
|
assertTitle(reader);
|
|
|
|
|
|
|
|
|
|
|
|
List<UploadQuestionLibraryDTO> uploadQuestionLibraryDTOS = reader.readAll(UploadQuestionLibraryDTO.class);
|
|
|
|
List<UploadQuestionLibraryDTO> uploadQuestionLibraryDTOS = reader.readAll(UploadQuestionLibraryDTO.class);
|
|
|
|
|
|
|
|
|
|
|
|