|
|
|
@ -18,6 +18,7 @@ import com.supervision.manage.service.FileManageService;
|
|
|
|
|
import com.supervision.model.*;
|
|
|
|
|
import com.supervision.service.AskTemplateQuestionLibraryService;
|
|
|
|
|
import com.supervision.service.CommonDicService;
|
|
|
|
|
import com.supervision.util.RedisSequenceUtil;
|
|
|
|
|
import com.supervision.vo.manage.AskQuestionLibraryReqVo;
|
|
|
|
|
import com.supervision.vo.manage.AskQuestionLibraryResVo;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@ -101,11 +102,32 @@ public class AskQuestionLibraryManageServiceImpl implements AskQuestionLibraryMa
|
|
|
|
|
}else {
|
|
|
|
|
// 新增数据
|
|
|
|
|
askTemplateQuestionLibrary.setQuestion(CollUtil.newArrayList(askTemplateQuestionLibrary.getDescription()));
|
|
|
|
|
if (StrUtil.isBlank(commonDic.getDescription())){
|
|
|
|
|
if (StrUtil.isNotEmpty(commonDic.getDescription())){
|
|
|
|
|
askTemplateQuestionLibrary.setDescription(commonDic.getDescription());
|
|
|
|
|
askTemplateQuestionLibrary.getQuestion().add(commonDic.getDescription());
|
|
|
|
|
}
|
|
|
|
|
askTemplateQuestionLibraryService.updateById(askTemplateQuestionLibrary);
|
|
|
|
|
|
|
|
|
|
// 获取nexCode
|
|
|
|
|
String nextCode = RedisSequenceUtil.getQuestionLibraryCode(() -> {
|
|
|
|
|
String maxCode = askTemplateQuestionLibraryService.getMaxCode();
|
|
|
|
|
if (StrUtil.isNotEmpty(maxCode)) {
|
|
|
|
|
return Long.parseLong(StrUtil.removePrefix(maxCode, "Q"));
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 获取nextDefaultAnswerCode
|
|
|
|
|
String nextDefaultCode = RedisSequenceUtil.getQuestionLibraryDefaultAnswerCode(() -> {
|
|
|
|
|
String code = askTemplateQuestionLibraryService.getMaxDefaultAnswerCode();
|
|
|
|
|
if (StrUtil.isNotEmpty(code)) {
|
|
|
|
|
return Long.parseLong(StrUtil.removePrefix(code, "A"));
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
askTemplateQuestionLibrary.setCode(nextCode);
|
|
|
|
|
askTemplateQuestionLibrary.setDefaultAnswerCode(nextDefaultCode);
|
|
|
|
|
|
|
|
|
|
askTemplateQuestionLibraryService.save(askTemplateQuestionLibrary);
|
|
|
|
|
return askTemplateQuestionLibrary.getId();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -115,6 +137,7 @@ public class AskQuestionLibraryManageServiceImpl implements AskQuestionLibraryMa
|
|
|
|
|
Assert.notEmpty(askTemplateQuestionLibrary.getId(),"id不能为空");
|
|
|
|
|
|
|
|
|
|
assertSave(askTemplateQuestionLibrary);
|
|
|
|
|
this.saveQuestionLibrary(askTemplateQuestionLibrary);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|