From 4d74cda64ed8f82ce8744270a21f87dfe2da57c6 Mon Sep 17 00:00:00 2001 From: DESKTOP-71BH0QO\L、ming <172680469@qq.com> Date: 星期五, 09 四月 2021 15:41:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActQuestnaireServiceImpl.java | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActQuestnaireServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActQuestnaireServiceImpl.java index 36c1f56..0aac825 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActQuestnaireServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActQuestnaireServiceImpl.java @@ -177,21 +177,21 @@ } @Override - public R statQuestnaire(Long questId) { + public R statQuestnaire(Long questId){ return null; } @Override public R infoQuestnaire(Long questId) { - return null; + return answerInfoQuestnaire(null, questId); } @Override public R answerInfoQuestnaire(Long userId, Long questId) { ComActQuestnaireDO comActQuestnaireDO = questnaireDAO.selectById(questId); - if (comActQuestnaireDO == null) { - return R.fail("问卷不存在!"); + if(comActQuestnaireDO==null){ + return R.fail("问卷不存在!"); } UsersAnswerVO usersAnswerVO = new UsersAnswerVO(); @@ -203,7 +203,7 @@ list.sort(Comparator.comparing(ComActQuestnaireSubDO::getSort).reversed()); List<UsersSubAnswerVO> usersSubAnswerVOList = new ArrayList<>(); - list.forEach(comActQuestnaireSubDO -> { + list.forEach(comActQuestnaireSubDO ->{ UsersSubAnswerVO usersSubAnswerVO = new UsersSubAnswerVO(); //问卷调查题目 ComActQuestnaireSubVO comActQuestnaireSubVO = new ComActQuestnaireSubVO(); @@ -224,18 +224,20 @@ }); usersSubAnswerVO.setQuestSelectionList(comActQuestnaireSubSelectionVOs); //用户回答 - List<ComActQuestnaireAnswerContentDO> questnaireAnswerContentDOList = - questnaireAnswerContentDAO.selectList(new QueryWrapper<ComActQuestnaireAnswerContentDO>().lambda().eq(ComActQuestnaireAnswerContentDO::getUserId, userId) - .eq(ComActQuestnaireAnswerContentDO::getSubId, subId)); + if(userId!=null) { + List<ComActQuestnaireAnswerContentDO> questnaireAnswerContentDOList = + questnaireAnswerContentDAO.selectList(new QueryWrapper<ComActQuestnaireAnswerContentDO>().lambda().eq(ComActQuestnaireAnswerContentDO::getUserId, userId) + .eq(ComActQuestnaireAnswerContentDO::getSubId, subId)); - List<ComActQuestnaireAnswerContentVO> questnaireAnswerContentVOList = new ArrayList<>(); - questnaireAnswerContentDOList.forEach(questnaireAnswerContentDO -> { - ComActQuestnaireAnswerContentVO comActQuestnaireSubSelectionVO = new ComActQuestnaireAnswerContentVO(); - BeanUtils.copyProperties(questnaireAnswerContentDO, comActQuestnaireSubSelectionVO); - questnaireAnswerContentVOList.add(comActQuestnaireSubSelectionVO); - }); + List<ComActQuestnaireAnswerContentVO> questnaireAnswerContentVOList = new ArrayList<>(); + questnaireAnswerContentDOList.forEach(questnaireAnswerContentDO -> { + ComActQuestnaireAnswerContentVO comActQuestnaireSubSelectionVO = new ComActQuestnaireAnswerContentVO(); + BeanUtils.copyProperties(questnaireAnswerContentDO, comActQuestnaireSubSelectionVO); + questnaireAnswerContentVOList.add(comActQuestnaireSubSelectionVO); + }); - usersSubAnswerVO.setUsersAnswer(questnaireAnswerContentVOList); + usersSubAnswerVO.setUsersAnswer(questnaireAnswerContentVOList); + } usersSubAnswerVOList.add(usersSubAnswerVO); } ); -- Gitblit v1.7.1