Closed chaos-cn closed 2 years ago
以master更新到May 22, 2022的代码为准,在问卷配置为"需要登录"、“允许修改答案”时,修改答案不生效,排查代码发现两个问题 SurveyServiceImpl.java中
private String validateAndGetLatestAnswer(ProjectView project) { ProjectSetting setting = project.getSetting(); boolean needGetLatest = false; ... if (needGetLatest) { AnswerQuery answerQuery = new AnswerQuery(); answerQuery.setProjectId(project.getId()); answerQuery.setLatest(true); AnswerView latestAnswer = answerService.getAnswer(answerQuery); if (latestAnswer != null) { // @here 此处返回一直为null,是否应该调整为return latestAnswer.getId(); return answerQuery.getId(); } } return null; }
public PublicAnswerView saveAnswer(AnswerRequest answer, HttpServletRequest request) { ... String answerId; if (isBlank(answer.getId())) { // @here 新增公开查询文档功能后,此处没有处理好,允许修改答案时answer.getId()有值,无法进入这里 // 问卷允许修改答案开关修改答案 answerId = validateAndGetLatestAnswer(project); } else { // 公开查询修改答案 answerId = answer.getId(); validateAndMergeAnswer(project, answer); } ... }
已修复,这块重构了
以master更新到May 22, 2022的代码为准,在问卷配置为"需要登录"、“允许修改答案”时,修改答案不生效,排查代码发现两个问题 SurveyServiceImpl.java中