| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.applets.weixin.CheckService; |
| | | import com.panzhihua.common.constants.NeighborCircleConstants; |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | @Resource |
| | | private CheckService checkService; |
| | | |
| | | @ApiOperation(value = "分页查询邻里圈列表", response = ComActNeighborCircleAppVO.class) |
| | | @PostMapping("pageApp") |
| | |
| | | public R addNeighborByApp(@RequestBody AddComActNeighborCircleAppDTO addNeighborCircleAppDTO) { |
| | | LoginUserInfoVO loginUser = this.getLoginUserInfo(); |
| | | Long userId = loginUser.getUserId(); |
| | | if (userId == null) { |
| | | Long communityId = loginUser.getCommunityId(); |
| | | if(userId == null){ |
| | | return R.fail("请重新登录"); |
| | | } |
| | | addNeighborCircleAppDTO.setUserId(userId); |
| | | if (StringUtils.isNotEmpty(loginUser.getPhone())) { |
| | | addNeighborCircleAppDTO.setPhone(this.getLoginUserInfo().getPhone()); |
| | | } |
| | | if (loginUser.getCommunityId() != null) { |
| | | addNeighborCircleAppDTO.setCommunityId(loginUser.getCommunityId()); |
| | | if(communityId != null){ |
| | | addNeighborCircleAppDTO.setCommunityId(communityId); |
| | | } |
| | | |
| | | //查询社区自动审核是否开着 |
| | | String key = NeighborCircleConstants.NEIGHBOR_CIRCLE_AUTO_EXAMINE; |
| | | R isOk = communityService.getSysConfValue(key + communityId,communityId); |
| | | if(R.isOk(isOk)){ |
| | | if(isOk.getData() != null){ |
| | | String value = isOk.getData().toString(); |
| | | if(value.equals("1")){ |
| | | addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no); |
| | | String msg = addNeighborCircleAppDTO.getReleaseContent(); |
| | | if (checkService.checkMessage(msg)) { |
| | | addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.yes); |
| | | }else{ |
| | | addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.no); |
| | | } |
| | | }else{ |
| | | addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes); |
| | | } |
| | | }else{ |
| | | communityService.addSysConfValue(key + communityId,communityId,"社区邻里圈自动审核参数","1"); |
| | | addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no); |
| | | } |
| | | }else{ |
| | | addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes); |
| | | } |
| | | |
| | | return communityService.addNeighborByApp(addNeighborCircleAppDTO); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "查询社区邻里圈话题列表", response = ComActNeighborCircleTopicAppVO.class) |
| | | @GetMapping("topic/list") |
| | | public R getNeighborTopicByApp(@RequestParam("communityId") Long communityId) { |
| | | public R getNeighborTopicByApp(@RequestParam("communityId") Long communityId |
| | | ,@RequestParam(value = "isZero",defaultValue = "2",required = false) Integer isZero |
| | | ,@RequestParam(value = "name",defaultValue = "",required = false) String name) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (loginUserInfo != null) { |
| | | communityId = loginUserInfo.getCommunityId(); |
| | | } |
| | | return communityService.getNeighborTopicByApp(communityId); |
| | | if(isZero == null){ |
| | | isZero = 2; |
| | | } |
| | | return communityService.getNeighborTopicByApp(communityId,isZero,name); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户新增邻里圈话题") |
| | | @PostMapping("topic/add") |
| | | public R addNeighborTopicByApp(@RequestBody AddNeighborCircleTopicAppDTO circleTopicAppDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if(loginUserInfo == null){ |
| | | return R.fail(401,"请先登录"); |
| | | } |
| | | circleTopicAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | circleTopicAppDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | return communityService.addNeighborTopicByApp(circleTopicAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户删除邻里圈") |
| | | @PostMapping("delete") |
| | | public R deleteNeighborByApp(@RequestBody DeleteNeighborCircleAppDTO circleTopicAppDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if(loginUserInfo == null){ |
| | | return R.fail(401,"请先登录"); |
| | | } |
| | | circleTopicAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | circleTopicAppDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | return communityService.deleteNeighborByApp(circleTopicAppDTO); |
| | | } |
| | | } |
| | | |