| | |
| | | package com.panzhihua.service_community.api; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.ComPbServiceTeamDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.PageComPbServiceTeamDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.SystemmanagementConfigVO; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import com.panzhihua.service_community.model.dos.ComActActPrizeDO; |
| | |
| | | boolean ok = R.isOk(r); |
| | | if (ok) { |
| | | Integer hasPrize = comActActivityVO.getHasPrize(); |
| | | Long actActivityVOId = comActActivityVO.getId(); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeVOList) && hasPrize.intValue() == 1) { |
| | | Long actActivityVOId = comActActivityVO.getId(); |
| | | comActActPrizeService.remove(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, actActivityVOId)); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeVOList)) { |
| | | List<ComActActPrizeDO> comActActPrizeDOS = new ArrayList<>(); |
| | |
| | | return R.fail("保存奖品失败"); |
| | | } |
| | | } |
| | | }else if(hasPrize.intValue() == 0){ |
| | | boolean remove = comActActPrizeService.remove(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, actActivityVOId)); |
| | | log.info("删除社区活动奖品结果【{}】,社区活动id【{}】",remove,actActivityVOId); |
| | | } |
| | | } |
| | | return r; |
| | |
| | | Page<ComActActivityVO> page = (Page<ComActActivityVO>) r.getData(); |
| | | List<ComActActivityVO> content = page.getRecords(); |
| | | if (!ObjectUtils.isEmpty(content)) { |
| | | List<ComActActPrizeVO> comActActPrizeVOList = new ArrayList<>(); |
| | | content.forEach(comActActivityVO1 -> { |
| | | List<ComActActPrizeVO> comActActPrizeVOList = new ArrayList<>(); |
| | | Long id = comActActivityVO1.getId(); |
| | | List<ComActActPrizeDO> list = comActActPrizeService.list(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, id)); |
| | | if (!ObjectUtils.isEmpty(list)) { |
| | |
| | | }); |
| | | } |
| | | comActActivityVO1.setComActActPrizeVOList(comActActPrizeVOList); |
| | | comActActPrizeVOList.clear(); |
| | | }); |
| | | page.setRecords(content); |
| | | } |
| | | |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 社区后台分页查询社区活动 |
| | | * @param comActActivityVO 查询参数 |
| | | * @return 返回结果 |
| | | */ |
| | | @PostMapping("pageactivitycommunityback") |
| | | public R pageActivityCommunityBack(@RequestBody ComActActivityVO comActActivityVO){ |
| | | return comActActivityService.pageActivityCommunityBack(comActActivityVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | activitySignVO.setActivityId(id); |
| | | R r = comActActivityService.listActivitySign(activitySignVO); |
| | | if (R.isOk(r)) { |
| | | List<ActivitySignVO> activitySignVOS = (List<ActivitySignVO>) r.getData(); |
| | | comActActivityVO.setActivitySignVOList(activitySignVOS); |
| | | List<ActivitySignVO> activitySignVOS = JSONArray.parseArray(JSONArray.toJSONString( r.getData()),ActivitySignVO.class); |
| | | if (!ObjectUtils.isEmpty(activitySignVOS)) { |
| | | List<ActivitySignVO> collect = activitySignVOS.stream().filter(activitySignVO1 -> activitySignVO1.getIsVolunteer() == 1).collect(Collectors.toList()); |
| | | if (!ObjectUtils.isEmpty(collect)) { |
| | | int size = collect.size(); |
| | | if (size>=6) { |
| | | comActActivityVO.setActivityVolunteerList(collect.subList(0,6)); |
| | | } else { |
| | | comActActivityVO.setActivityVolunteerList(collect); |
| | | } |
| | | } |
| | | List<ActivitySignVO> collect1 = activitySignVOS.stream().filter(activitySignVO1 -> activitySignVO1.getIsVolunteer() == 0).collect(Collectors.toList()); |
| | | if (!ObjectUtils.isEmpty(collect1)) { |
| | | int size = collect1.size(); |
| | | if (size>=6) { |
| | | comActActivityVO.setActivitySignVOList(collect1.subList(0,6)); |
| | | } else { |
| | | comActActivityVO.setActivitySignVOList(collect1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | comActActivityVO.setIntegral(0); |
| | | return R.ok(comActActivityVO); |
| | | } |
| | | |
| | |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addarea") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | R addArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO) { |
| | | R r = comMngStructAreaService.addArea(comMngStructAreaVO); |
| | | if (R.isOk(r)) { |
| | | String areaCode = (String) r.getData(); |
| | | String areaCode = String.valueOf(r.getData()) ; |
| | | comMngStructAreaVO.setAreaCode(areaCode); |
| | | R r1 = comMngStructHouseService.addHouseArea(comMngStructAreaVO); |
| | | if (!R.isOk(r1)) { |
| | | throw new RuntimeException("新增小区地址失败"); |
| | | } |
| | | return r1; |
| | | } |
| | | return r; |
| | | } |
| | |
| | | */ |
| | | @PostMapping("batchhouse") |
| | | public R batchHouse(@RequestBody BatchhouseVO batchhouseVO) { |
| | | return comMngStructHouseService.batchHouse(batchhouseVO); |
| | | R r = comMngStructHouseService.batchHouse(batchhouseVO); |
| | | if (R.isOk(r)) { |
| | | String areaCode = batchhouseVO.getAreaCode(); |
| | | String ruleDoor = batchhouseVO.getRuleDoor(); |
| | | String ruleConnector = batchhouseVO.getRuleConnector(); |
| | | String ruleFloor = batchhouseVO.getRuleFloor(); |
| | | ComMngStructAreaVO comMngStructAreaVO=new ComMngStructAreaVO(); |
| | | comMngStructAreaVO.setRoleDoor(ruleDoor); |
| | | comMngStructAreaVO.setRoleFloor(ruleFloor); |
| | | comMngStructAreaVO.setRoleConnector(ruleConnector); |
| | | comMngStructAreaVO.setAreaCode(areaCode); |
| | | comMngStructAreaVO.setCommunityId(null); |
| | | comMngStructAreaVO.setIsAccumulation(null); |
| | | comMngStructAreaService.putArea(comMngStructAreaVO); |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | |
| | | R r=comMngStructAreaService.selectAreaByAreaCode(batchhouseVO.getAreaCode()); |
| | | if (R.isOk(r)) { |
| | | ComMngStructAreaDO comMngStructAreaDO = (ComMngStructAreaDO)r.getData(); |
| | | return comMngStructHouseService.addHouse(batchhouseVO,comMngStructAreaDO); |
| | | try { |
| | | R r1 = comMngStructHouseService.addHouse(batchhouseVO, comMngStructAreaDO); |
| | | return r1; |
| | | } catch (Exception e) { |
| | | if (e.getMessage().contains("unique_house_name")) { |
| | | return R.fail("房屋地址重复"); |
| | | }else { |
| | | log.error("添加同级地址失败【{}】",e.getMessage()); |
| | | return R.fail("添加房屋失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | return r; |
| | | } |
| | |
| | | if (ObjectUtils.isEmpty(parentCode)) { |
| | | R r = comMngStructAreaService.selectAreaById(areaId); |
| | | if (R.isOk(r)) { |
| | | parentCode =(String) r.getData(); |
| | | parentCode =String.valueOf(r.getData()) ; |
| | | }else{ |
| | | return R.fail("用户没有绑定小区"); |
| | | } |
| | | } |
| | | return comMngStructHouseService.putVolunteerPhone(parentCode); |
| | |
| | | */ |
| | | @PostMapping("addhouses") |
| | | public R addHouses(@RequestBody ComMngStructHouseVO comMngStructHouseVO){ |
| | | R r = comMngStructAreaService.selectAreaById(comMngStructHouseVO.getAreaId()); |
| | | if (!R.isOk(r)) { |
| | | return R.fail("用户没有绑定小区"); |
| | | } |
| | | String data = String.valueOf(r.getData()); |
| | | comMngStructHouseVO.setAreaCode(data); |
| | | return comMngStructHouseService.addHouses(comMngStructHouseVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询小区 |
| | | * @param communityId 社区id |
| | | * @return 小区集合 |
| | | */ |
| | | @PostMapping("listarea") |
| | | public R listArea(@RequestParam("communityId")Long communityId){ |
| | | return comMngStructAreaService.listArea(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 用户参加的所有社区活动 |
| | | * @param userId 用户id |
| | | * @return 活动列表 |
| | | */ |
| | | @PostMapping("listactivity") |
| | | public R listActivity(@RequestParam("userId")Long userId ){ |
| | | return comActActivityService.listActivity(userId); |
| | | } |
| | | |
| | | /** |
| | | * 用户确认心愿 |
| | | * @param comActMicroWishVO 用户评价 |
| | | * @return 确认结果 |
| | | */ |
| | | @PostMapping("putmicrowishconfirm") |
| | | R putMicroWishConfirm(@RequestBody ComActMicroWishVO comActMicroWishVO){ |
| | | return comActMicroWishService.putMicroWishConfirm(comActMicroWishVO); |
| | | } |
| | | |
| | | /** |
| | | * 建筑类型 |
| | | * @param communityId 社区id |
| | | * @return 建筑集合 |
| | | */ |
| | | @PostMapping("listcommngstructbuildtype") |
| | | public R listComMngStructBuildType(@RequestParam("communityId") Long communityId){ |
| | | return comMngStructOtherBuildService.listComMngStructBuildType(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 增加删除建筑类型 |
| | | * @param systemmanagementConfigVO 操作内容 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("putcommngstructbuildtype") |
| | | public R putComMngStructBuildType(@RequestBody SystemmanagementConfigVO systemmanagementConfigVO){ |
| | | try { |
| | | R r=comMngStructOtherBuildService.putComMngStructBuildType(systemmanagementConfigVO); |
| | | } catch (ServiceException e) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 社区详情 |
| | | * @param communityId 社区id |
| | | * @return 社区详情 |
| | | */ |
| | | @PostMapping("detailcommunity") |
| | | public R detailCommunity(@RequestParam("communityId") Long communityId){ |
| | | return comActService.detailCommunity(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 小区详情 |
| | | * @param areaId 小区id |
| | | * @return 小区信息 |
| | | */ |
| | | @PostMapping("detailarea") |
| | | public R detailArea(@RequestParam("areaId")Long areaId){ |
| | | return comMngStructAreaService.detailArea(areaId); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询社区 |
| | | * @param pageComActDTO 查询参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pagecommunity") |
| | | public R pageCommunity(@RequestBody PageComActDTO pageComActDTO){ |
| | | return comActService.pageCommunity(pageComActDTO); |
| | | } |
| | | |
| | | /** |
| | | * 志愿者详情 |
| | | * @param id 主键 |
| | | * @return 志愿者 |
| | | */ |
| | | @PostMapping("detailvolunteer") |
| | | public R detailVolunteer(@RequestParam("id") Long id){ |
| | | R r = comMngVolunteerMngService.detailVolunteer(id); |
| | | if (R.isOk(r)) { |
| | | ComMngVolunteerMngAppletsVO comMngVolunteerMngAppletsVO =(ComMngVolunteerMngAppletsVO) r.getData(); |
| | | String phone = comMngVolunteerMngAppletsVO.getPhone(); |
| | | List<ComActActivityVO> comActActivityVOS= comActActivityService.listActivityByPhone(phone); |
| | | comMngVolunteerMngAppletsVO.setComActActivityVOList(comActActivityVOS); |
| | | r.setData(comMngVolunteerMngAppletsVO); |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 查询平台所有的社区 |
| | | * @return 社区集合 按照创建顺序倒序排列 |
| | | */ |
| | | @PostMapping("listcommunityall") |
| | | public R listCommunityAll(){ |
| | | return comActService.listCommunityAll(); |
| | | } |
| | | |
| | | /** |
| | | * 社区管理后台数据看板 代办事件 |
| | | * @param communityId 社区id |
| | | * @param userId 登录用户信息 |
| | | * @return 代办事件列表 |
| | | */ |
| | | @PostMapping("indexdatacommunitybackstage") |
| | | public R indexDataCommunityBackstage(@RequestParam("communityId") Long communityId, @RequestParam("userId")Long userId){ |
| | | List<TodoEventsVO> todoEventsVOS=new ArrayList<>(); |
| | | List<TodoEventsVO> todoEventsVOS1=comActEasyPhotoService.selectNeedToDo(communityId,userId); |
| | | List<TodoEventsVO> todoEventsVOS2=comActMicroWishService.selectNeedToDo(communityId,userId); |
| | | List<TodoEventsVO> todoEventsVOS3=comMngVolunteerMngService.selectNeedToDo(communityId,userId); |
| | | if (!ObjectUtils.isEmpty(todoEventsVOS1)) { |
| | | todoEventsVOS.addAll(todoEventsVOS1); |
| | | } |
| | | if (!ObjectUtils.isEmpty(todoEventsVOS2)) { |
| | | todoEventsVOS.addAll(todoEventsVOS2); |
| | | } |
| | | if (!ObjectUtils.isEmpty(todoEventsVOS3)) { |
| | | todoEventsVOS.addAll(todoEventsVOS3); |
| | | } |
| | | return R.ok(todoEventsVOS); |
| | | } |
| | | |
| | | /** |
| | | * 删除社区 |
| | | * @param communityId 社区id |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("delectcommunity") |
| | | public R delectCommunity(@RequestParam("communityId") Long communityId){ |
| | | return comActService.delectCommunity(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务刷新社区动态置顶状态 |
| | | * @return 刷新结果 |
| | | */ |
| | | @PostMapping("timedtaskdynistopping") |
| | | public R timedTaskDynIstopping(){ |
| | | return comActDynService.timedTaskDynIstopping(); |
| | | } |
| | | /** |
| | | * 定时任务刷新社区动态发布状态 |
| | | * @return |
| | | */ |
| | | @PostMapping("timedtaskdynstatus") |
| | | public R timedTaskDynStatus(){ |
| | | return comActDynService.timedTaskDynStatus(); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务查询所有要取消的社区活动 |
| | | * @return 社区活动集合 |
| | | */ |
| | | @PostMapping("timedtaskactactivity") |
| | | public R timedTaskActActivity(){ |
| | | return comActActivityService.timedTaskActActivity(); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务刷新社区活动的各个状态 除取消外 |
| | | * @return 更新结果 |
| | | */ |
| | | @PostMapping("timedtaskactactivityall") |
| | | R timedTaskActActivityAll(){ |
| | | return comActActivityService.timedTaskActActivityAll(); |
| | | } |
| | | |
| | | /** |
| | | * 其他建筑详情 |
| | | * @param id 主键id |
| | | * @return 建筑内容 |
| | | */ |
| | | @PostMapping("detailotherbuild") |
| | | public R detailOtherbuild(@RequestParam("id")Long id){ |
| | | return comMngStructOtherBuildService.detailOtherbuild(id); |
| | | } |
| | | |
| | | /** |
| | | * 编辑其他建筑 |
| | | * @param comMngStructOtherBuildVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putotherbuild") |
| | | public R putOtherbuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO){ |
| | | return comMngStructOtherBuildService.putOtherbuild(comMngStructOtherBuildVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除其他建筑 |
| | | * @param id 主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deleteotherbuild") |
| | | public R deleteOtherbuild(@RequestParam("id")Long id){ |
| | | return comMngStructOtherBuildService.deleteOtherbuild(id); |
| | | } |
| | | |
| | | /** |
| | | * 小程序分页查询随手拍 |
| | | * @param comActEasyPhotoVO 查询参数 |
| | | * @return 返回结果 |
| | | */ |
| | | @PostMapping("pageeasyphotoapplets") |
| | | public R pageEasyPhotoApplets(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO){ |
| | | return comActEasyPhotoService.pageEasyPhotoApplets(comActEasyPhotoVO); |
| | | } |
| | | |
| | | /** |
| | | * 随手拍评论分页查询 |
| | | * @param pageComActEasyPhotoCommentDTO 查询参数 |
| | | * @return 查询结果 |
| | | */ |
| | | @PostMapping("pagecomacteasyphotocomment") |
| | | public R pageComActEasyPhotoComment(@RequestBody PageComActEasyPhotoCommentDTO pageComActEasyPhotoCommentDTO){ |
| | | return comActEasyPhotoService.pageComActEasyPhotoComment(pageComActEasyPhotoCommentDTO); |
| | | } |
| | | |
| | | /** |
| | | * 评论点赞/取消点赞 |
| | | * @param comActEasyPhotoCommentUserDTO 操作 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("commentsign") |
| | | public R commentSign(@RequestBody ComActEasyPhotoCommentUserDTO comActEasyPhotoCommentUserDTO){ |
| | | return comActEasyPhotoService.commentSign(comActEasyPhotoCommentUserDTO); |
| | | } |
| | | |
| | | /** |
| | | * 随手拍--评论--新增评论 |
| | | * @param comActEasyPhotoCommentDTO 新增内容 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addcomacteasyphotocomment") |
| | | public R addComActEasyPhotoComment(@RequestBody ComActEasyPhotoCommentDTO comActEasyPhotoCommentDTO){ |
| | | return comActEasyPhotoService.addComActEasyPhotoComment(comActEasyPhotoCommentDTO); |
| | | } |
| | | |
| | | |
| | | |
| | | |