| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.PageComCvtBusinessAppletsDTO; |
| | | 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; |
| | | import com.panzhihua.common.model.vos.community.ComActQuestnaireVO; |
| | | import com.panzhihua.common.model.vos.community.ComCvtBusinessVO; |
| | | import com.panzhihua.common.model.vos.community.questnaire.*; |
| | | |
| | | import com.panzhihua.common.model.vos.community.questnaire.QuestnaireListVo; |
| | | import com.panzhihua.common.model.vos.community.questnaire.UsersAnswerQuestnaireVO; |
| | | import com.panzhihua.common.model.vos.community.questnaire.UsersAnswerVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @description: 社区通/调查问卷接口 |
| | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "分页查询登录用户调查问卷", response = QuestnaireListVo.class) |
| | | @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); |
| | | pageQuestnaireDTO.setForVolunteer(1 == isVolunteer); |
| | | pageQuestnaireDTO.setUserId(loginUserInfo.getUserId()); |
| | | System.out.println("分页查询登录用户调查问卷: " + pageQuestnaireDTO.toString()); |
| | | return communityService.pageQuestnaire(pageQuestnaireDTO, loginUserInfo.getCommunityId()); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询社区调查问卷", response = QuestnaireListVo.class) |
| | | @PostMapping("/pageVolunteer") |
| | | public R pageVolunteer(@RequestBody PageQuestnaireDTO pageQuestnaireDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | pageQuestnaireDTO.setForMasses(null); |
| | | pageQuestnaireDTO.setForVolunteer(true); |
| | | pageQuestnaireDTO.setForParty(true); |
| | | return communityService.pageQuestnaire(pageQuestnaireDTO, loginUserInfo.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("用户无创建调查问卷的权限!"); |
| | | if (loginUserInfo == null) { |
| | | return R.fail(401, "请先登录"); |
| | | } |
| | | return communityService.addQuestnaire(questnaireVO, loginUserInfo.getCommunityId(), loginUserInfo.getUserId()); |
| | | pageQuestnaireDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | pageQuestnaireDTO.setUserId(loginUserInfo.getUserId()); |
| | | return communityService.pageQuestnaire(pageQuestnaireDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "查看问卷", response = UsersAnswerVO.class) |
| | | @GetMapping("/view") |
| | | @ApiOperation(value = "查询调查问卷详情", response = UsersAnswerVO.class) |
| | | @GetMapping("/detail") |
| | | public R viewQuestnaire(@RequestParam("questId") Long questId) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | return communityService.view(loginUserInfo.getUserId(), questId); |
| | | } |
| | | |
| | | @ApiOperation(value = "在线统计信息", response = QuestnaireAnswerStatVO.class) |
| | | @GetMapping("/stat") |
| | | public R stat(@RequestParam("questId") Long questId) { |
| | | return communityService.statistics(questId); |
| | | } |
| | | |
| | | @ApiOperation(value = "在线统计详细", response = ComActQuestnaireAnswerContentVO.class) |
| | | @PostMapping("/stat/details") |
| | | public R statDetails(@RequestBody PageQuestnaireSubDetailsDTO pageQuestnaireSubDetailsDTO) { |
| | | //问卷调查 |
| | | return communityService.qaQeustAnswerDetails(pageQuestnaireSubDetailsDTO); |
| | | if (loginUserInfo == null) { |
| | | return R.fail(401, "请先登录"); |
| | | } |
| | | return communityService.viewDetail(loginUserInfo.getUserId(), questId); |
| | | } |
| | | |
| | | @ApiOperation(value = "居民填写问卷调查问卷") |
| | | @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("用户写问卷调查问卷!"); |
| | | if (loginUserInfo == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | return communityService.usersAnsweQuestnaire(usersAnswerQuestnaireVO, loginUserInfo.getUserId()); |
| | | usersAnswerQuestnaireVO.setUserId(loginUserInfo.getUserId()); |
| | | // 填写调查问卷发放积分 |
| | | communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(usersAnswerQuestnaireVO.getQuestId(), |
| | | AddComActIntegralUserDTO.integralType.cydcwj, loginUserInfo.getCommunityId(), loginUserInfo.getUserId())); |
| | | return communityService.usersAnsweQuestnaire(usersAnswerQuestnaireVO); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑问卷") |
| | | @PostMapping("/edit") |
| | | public R editQuestnaire(@RequestBody QuestnaireVO questnaireVO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | return communityService.editQuestnaire(questnaireVO); |
| | | @ApiOperation(value = "添加浏览量") |
| | | @GetMapping("/add/view") |
| | | public R addView(@RequestParam("questId") Long questId) { |
| | | return communityService.addView(questId); |
| | | } |
| | | |
| | | @ApiOperation(value = "继续调研/停止调研") |
| | | @PostMapping("/toggle") |
| | | public R toggle(@RequestBody EditComActQuestnaireVo editComActQuestnaireVo) { |
| | | @ApiOperation(value = "用户弹窗添加不在提醒接口") |
| | | @GetMapping("/add/noNotice") |
| | | public R addNoNotice(@RequestParam("questId") Long questId) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | return communityService.editQuestnaireDO(editComActQuestnaireVo, loginUserInfo.getUserId()); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除问卷") |
| | | @GetMapping("/delete") |
| | | public R delete(@RequestParam("questId") Long questId) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | return communityService.editQuestnaireDO(questId, loginUserInfo.getUserId()); |
| | | if (loginUserInfo == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | return communityService.addNoNotice(questId, loginUserInfo.getUserId()); |
| | | } |
| | | |
| | | } |