From a64bcc9be2f4e6e84bcdf92c1805124d91aa3cf5 Mon Sep 17 00:00:00 2001 From: 罗元桥 <2376770955@qq.com> Date: 星期一, 02 八月 2021 18:28:43 +0800 Subject: [PATCH] Merge branch 'test' into 'master' --- springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityQuestnaireApi.java | 43 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 36 insertions(+), 7 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityQuestnaireApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityQuestnaireApi.java index 081e912..a677e86 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityQuestnaireApi.java +++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityQuestnaireApi.java @@ -5,6 +5,7 @@ import com.panzhihua.common.model.dtos.community.PageCommunityQuestnaireDTO; import com.panzhihua.common.model.dtos.community.PageQuestnaireDTO; import com.panzhihua.common.model.dtos.community.PageQuestnaireSubDetailsDTO; +import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComActQuestnaireAnswerContentVO; @@ -33,17 +34,36 @@ @Resource private CommunityService communityService; - @ApiOperation(value = "分页查询调查问卷", response = ComActQuestnaireVO.class) - @PostMapping("/page") - public R page(@RequestBody PageQuestnaireDTO pageQuestnaireDTO) { + @ApiOperation(value = "分页查询登录用户调查问卷", response = QuestnaireListVo.class) + @PostMapping("/pageUser") + public R pageUser(@RequestBody PageQuestnaireDTO pageQuestnaireDTO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); + Integer isPartymember = loginUserInfo.getIsPartymember(); + Integer isVolunteer = loginUserInfo.getIsVolunteer(); + pageQuestnaireDTO.setForParty(1 == isPartymember.intValue()); + pageQuestnaireDTO.setForVolunteer(1 == isVolunteer.intValue()); + pageQuestnaireDTO.setUserId(loginUserInfo.getUserId()); return communityService.pageQuestnaire(pageQuestnaireDTO, loginUserInfo.getCommunityId()); + } + + @ApiOperation(value = "分页查询社区调查问卷", response = QuestnaireListVo.class) + @PostMapping("/pageVolunteer") + public R pageVolunteer(@RequestBody PageQuestnaireDTO pageQuestnaireDTO) { + pageQuestnaireDTO.setForMasses(null); + pageQuestnaireDTO.setForVolunteer(true); + pageQuestnaireDTO.setForParty(true); + return communityService.pageQuestnaire(pageQuestnaireDTO, getLoginUserInfo().getCommunityId()); } @ApiOperation(value = "创建调查问卷") @PostMapping("/add") public R add(@RequestBody QuestnaireVO questnaireVO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); + boolean userHasRight = loginUserInfo.getIsmemberrole()==1; + //if(!userHasRight){ + if(false){ + return R.fail("用户无创建调查问卷的权限!"); + } return communityService.addQuestnaire(questnaireVO, loginUserInfo.getCommunityId(), loginUserInfo.getUserId()); } @@ -61,7 +81,7 @@ } @ApiOperation(value = "在线统计详细", response = ComActQuestnaireAnswerContentVO.class) - @GetMapping("/stat/details") + @PostMapping("/stat/details") public R statDetails(@RequestBody PageQuestnaireSubDetailsDTO pageQuestnaireSubDetailsDTO) { //问卷调查 return communityService.qaQeustAnswerDetails(pageQuestnaireSubDetailsDTO); @@ -71,21 +91,30 @@ @PostMapping("/stat/answer") public R usersAnswerQuestnaire(@RequestBody UsersAnswerQuestnaireVO usersAnswerQuestnaireVO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); + boolean userHasRight = loginUserInfo.getIsmemberrole()==1; + //if(!userHasRight){ + if(false){ + return R.fail("用户写问卷调查问卷!"); + } + //填写调查问卷发放积分 + communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(usersAnswerQuestnaireVO.getQuestId() + ,AddComActIntegralUserDTO.integralType.cydcwj,loginUserInfo.getCommunityId(),loginUserInfo.getUserId())); return communityService.usersAnsweQuestnaire(usersAnswerQuestnaireVO, loginUserInfo.getUserId()); } @ApiOperation(value = "编辑问卷") @PostMapping("/edit") - public R eidtQuestnaire(@RequestBody QuestnaireVO questnaireVO) { + public R editQuestnaire(@RequestBody QuestnaireVO questnaireVO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); return communityService.editQuestnaire(questnaireVO); } @ApiOperation(value = "继续调研/停止调研") - @GetMapping("/toggle") + @PostMapping("/toggle") public R toggle(@RequestBody EditComActQuestnaireVo editComActQuestnaireVo) { - return communityService.editQuestnaireDO(editComActQuestnaireVo); + LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); + return communityService.editQuestnaireDO(editComActQuestnaireVo, loginUserInfo.getUserId()); } @ApiOperation(value = "删除问卷") -- Gitblit v1.7.1