| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.panzhihua.applets.weixin.CheckService; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.constants.NeighborCircleConstants; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.neighbor.*; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO; |
| | | import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleDetailAppVO; |
| | | import com.panzhihua.common.model.vos.neighbor.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | @Resource |
| | | private CheckService checkService; |
| | | |
| | | @ApiOperation(value = "分页查询邻里圈列表" , response = ComActNeighborCircleAppVO.class) |
| | | @ApiOperation(value = "分页查询邻里圈列表", response = ComActNeighborCircleAppVO.class) |
| | | @PostMapping("pageApp") |
| | | public R pageNeighborByApp(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO) { |
| | | Long communityId = this.getLoginUserInfo().getCommunityId(); |
| | | if(communityId == null){ |
| | | return R.fail("请先绑定社区"); |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (loginUserInfo != null) { |
| | | neighborCircleAppDTO.setPhone(loginUserInfo.getPhone()); |
| | | neighborCircleAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | } |
| | | neighborCircleAppDTO.setCommunityId(communityId); |
| | | return communityService.pageNeighborByApp(neighborCircleAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询可关联清单列表", response = ComActNeighborCircleAppVO.class) |
| | | @PostMapping("pageRelationList") |
| | | public R pageRelationList(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (loginUserInfo != null) { |
| | | neighborCircleAppDTO.setPhone(loginUserInfo.getPhone()); |
| | | neighborCircleAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | neighborCircleAppDTO.setCheckUnitId(loginUserInfo.getCheckUnitId()); |
| | | } |
| | | return communityService.pageRelationList(neighborCircleAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户发布邻里圈审核") |
| | |
| | | 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("请重新登录"); |
| | | } |
| | | if (!this.getAppId().equals("wx118de8a734d269f0")){ |
| | | String releaseContent = addNeighborCircleAppDTO.getReleaseContent(); |
| | | if (StrUtil.isNotBlank(releaseContent)) { |
| | | String result = checkService.checkMessageBy(releaseContent, this.getLoginUserInfo().getOpenid(), this.getAppId()); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | return R.fail(501, "填写内容存在 " + result + " 违规信息"); |
| | | } |
| | | } |
| | | /* String releaseImages = addNeighborCircleAppDTO.getReleaseImages(); |
| | | if (StrUtil.isNotBlank(releaseImages)) { |
| | | if (checkService.checkImageBy(releaseImages, this.getAppId())) { |
| | | return R.fail(501, "上传图片存在违规信息"); |
| | | } |
| | | }*/ |
| | | } |
| | | addNeighborCircleAppDTO.setUserId(userId); |
| | | if(StringUtils.isNotEmpty(loginUser.getPhone())){ |
| | | if (StringUtils.isNotEmpty(loginUser.getPhone())) { |
| | | addNeighborCircleAppDTO.setPhone(this.getLoginUserInfo().getPhone()); |
| | | } |
| | | if(loginUser.getCommunityId() != null){ |
| | | addNeighborCircleAppDTO.setCommunityId(loginUser.getCommunityId()); |
| | | if (communityId != null) { |
| | | addNeighborCircleAppDTO.setCommunityId(communityId); |
| | | } |
| | | |
| | | //查询社区自动审核是否开着 |
| | | |
| | | if (this.getAppId().equals("wx118de8a734d269f0")) { |
| | | //花城直接通过 |
| | | addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no); |
| | | addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.yes); |
| | | |
| | | } else { |
| | | //西区 |
| | | 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 (StrUtil.isEmpty(checkService.checkMessageBy(msg, this.getLoginUserInfo().getOpenid(), this.getAppId()))) { |
| | | 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 = ComActNeighborCircleDetailAppVO.class) |
| | | @ApiOperation(value = "查询邻里圈详情", response = ComActNeighborCircleDetailAppVO.class) |
| | | @PostMapping("detail") |
| | | public R neighborDetailByApp(@RequestBody ComActNeighborCircleDetailAppDTO neighborCircleAppDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (loginUserInfo != null) { |
| | | neighborCircleAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | } |
| | | // Long userId = this.getLoginUserInfo().getUserId(); |
| | | // if(userId == null){ |
| | | // return R.fail("请先登录"); |
| | | // } |
| | | // neighborCircleAppDTO.setUserId(userId); |
| | | return communityService.neighborDetailByApp(neighborCircleAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询用户邻里圈审核列表" , response = ComActNeighborCircleAppVO.class) |
| | | @ApiOperation(value = "分页查询用户邻里圈审核列表", response = ComActNeighborCircleAppVO.class) |
| | | @PostMapping("user/page") |
| | | public R neighborExamineByApp(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | if (userId == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | neighborCircleAppDTO.setUserId(userId); |
| | |
| | | @PostMapping("fabulous") |
| | | public R neighborFabulousByApp(@RequestBody ComActNeighborFabulousAppDTO fabulousAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | if (userId == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | fabulousAppDTO.setUserId(userId); |
| | |
| | | @ApiOperation(value = "邻里圈转发") |
| | | @PostMapping("forward") |
| | | public R neighborForwardByApp(@RequestBody ComActNeighborForwardAppDTO forwardAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | return R.fail("请先登录"); |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (loginUserInfo != null) { |
| | | forwardAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | } |
| | | forwardAppDTO.setUserId(userId); |
| | | // Long userId = this.getLoginUserInfo().getUserId(); |
| | | // if(userId == null){ |
| | | // return R.fail("请先登录"); |
| | | // } |
| | | // forwardAppDTO.setUserId(userId); |
| | | return communityService.neighborForwardByApp(forwardAppDTO); |
| | | } |
| | | |
| | |
| | | @PostMapping("comment") |
| | | public R neighborCommentByApp(@RequestBody ComActNeighborCommentAppDTO commentAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | if (userId == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | String content = commentAppDTO.getContent(); |
| | | if (StrUtil.isNotBlank(content)) { |
| | | String result = checkService.checkMessageBy(content, this.getLoginUserInfo().getOpenid(), this.getAppId()); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | return R.fail(501, "填写内容存在 " + result + " 违规信息"); |
| | | } |
| | | } |
| | | commentAppDTO.setUserId(userId); |
| | | return communityService.neighborCommentByApp(commentAppDTO); |
| | |
| | | @PostMapping("reply") |
| | | public R neighborReplyByApp(@RequestBody ComActNeighborReplyAppDTO replyAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | if (userId == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | String content = replyAppDTO.getContent(); |
| | | if (StrUtil.isNotBlank(content)) { |
| | | String result = checkService.checkMessageBy(content, this.getLoginUserInfo().getOpenid(), this.getAppId()); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | return R.fail(501, "填写内容存在 " + result + " 违规信息"); |
| | | } |
| | | } |
| | | replyAppDTO.setUserId(userId); |
| | | return communityService.neighborReplyByApp(replyAppDTO); |
| | |
| | | @PostMapping("cancel/fabulous") |
| | | public R neighborFabulousCancelByApp(@RequestBody ComActNeighborFabulousAppDTO fabulousAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | if (userId == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | fabulousAppDTO.setUserId(userId); |
| | |
| | | @PostMapping("add/browse") |
| | | public R neighborAddBrowseByApp(@RequestBody ComActNeighborAddBrowseAppDTO addBrowseAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | if (userId == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | addBrowseAppDTO.setUserId(userId); |
| | | return communityService.neighborAddBrowseByApp(addBrowseAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询评论下所有回复") |
| | | @ApiOperation(value = "分页查询评论下所有回复", response = ComActNeighborCommentReplyAppVO.class) |
| | | @PostMapping("comment/reply") |
| | | public R neighborCommentReplyByApp(@RequestBody ComActNeighborCommentReplyAppDTO commentReplyAppDTO) { |
| | | Long userId = this.getLoginUserInfo().getUserId(); |
| | | if(userId == null){ |
| | | return R.fail("请先登录"); |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (loginUserInfo != null) { |
| | | commentReplyAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | } |
| | | commentReplyAppDTO.setUserId(userId); |
| | | // Long userId = this.getLoginUserInfo().getUserId(); |
| | | // if(userId == null){ |
| | | // return R.fail("请先登录"); |
| | | // } |
| | | // commentReplyAppDTO.setUserId(userId); |
| | | return communityService.neighborCommentReplyByApp(commentReplyAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询社区邻里圈话题列表", response = ComActNeighborCircleTopicAppVO.class) |
| | | @GetMapping("topic/list") |
| | | public R getNeighborTopicByApp( |
| | | @RequestParam(value = "name", defaultValue = "", required = false) String name) { |
| | | return communityService.getNeighborTopicByApp(name); |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询邻里圈列表 |
| | | * |
| | | * @param neighborCircleAppDTO 请求参数 |
| | | * @return 邻里圈列表 |
| | | */ |
| | | @ApiOperation(value = "新版接单问题", response = ComActNeighborCircleAppVO.class) |
| | | @PostMapping("selectSolve") |
| | | public R selectSolve(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO) { |
| | | neighborCircleAppDTO.setUserId(this.getUserId()); |
| | | return communityService.selectSolve(neighborCircleAppDTO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * |
| | | * @param editNeighborCircleAdminVO |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "接单 反馈", response = ComActNeighborCircleAppVO.class) |
| | | @PostMapping("update") |
| | | public R order(@RequestBody EditNeighborCircleAdminVO editNeighborCircleAdminVO) { |
| | | return this.communityService.order(editNeighborCircleAdminVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "服务统计", response = ServiceStaticsVO.class) |
| | | @PostMapping("/serviceStatic") |
| | | public R serviceStatic(@RequestBody ServiceStaticDTO serviceStaticDTO) { |
| | | return this.communityService.serviceStatic(serviceStaticDTO); |
| | | } |
| | | |
| | | /** |
| | | * 求助我的问题数量统计 |
| | | * |
| | | * @param type |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "求助我的问题数量统计") |
| | | @GetMapping("/selectCount") |
| | | public R selectCount(@RequestParam("type") Integer type, @RequestParam(value = "phone", required = false) String phone, @RequestParam("communityId") Long communityId) { |
| | | return this.communityService.selectCount(type, phone, communityId); |
| | | } |
| | | } |
| | | |