| | |
| | | package com.panzhihua.service_community.api; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.dtos.community.*; |
| | | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; |
| | | import com.panzhihua.common.model.dtos.community.EldersAuthAddByFamilyDTO; |
| | | import com.panzhihua.common.model.dtos.community.EldersAuthAddDTO; |
| | | import com.panzhihua.common.model.dtos.community.EldersAuthDeleteDTO; |
| | | import com.panzhihua.common.model.dtos.community.EldersAuthEditDTO; |
| | | import com.panzhihua.common.model.dtos.community.EldersAuthFeedbackAddDTO; |
| | | import com.panzhihua.common.model.dtos.community.GrantRewardDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageEldersAuthDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageQuestnaireAnswerDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageQuestnaireDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageQuestnaireSubDetailsDTO; |
| | | import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; |
| | | import com.panzhihua.common.model.dtos.community.questnaire.StatisticsSummaryDTO; |
| | | 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.community.ComActActRegistVO; |
| | | import com.panzhihua.common.model.vos.community.ActivitySignVO; |
| | | import com.panzhihua.common.model.vos.community.BatchhouseVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActEvaluateVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActPrizeVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.common.model.vos.community.ComActMessageBackVO; |
| | | import com.panzhihua.common.model.vos.community.ComActMessageVO; |
| | | import com.panzhihua.common.model.vos.community.ComActMicroWishVO; |
| | | import com.panzhihua.common.model.vos.community.ComActVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructAreaVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructHouseVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructOtherBuildVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVolunteerMngAppletsVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO; |
| | | import com.panzhihua.common.model.vos.community.EldersAuthDetailsVO; |
| | | import com.panzhihua.common.model.vos.community.EldersAuthVO; |
| | | import com.panzhihua.common.model.vos.community.ResetComActMessageVO; |
| | | import com.panzhihua.common.model.vos.community.SignactivityVO; |
| | | import com.panzhihua.common.model.vos.community.TodoEventsVO; |
| | | import com.panzhihua.common.model.vos.community.questnaire.EditComActQuestnaireVo; |
| | | import com.panzhihua.common.model.vos.community.questnaire.QuestnaireVO; |
| | | import com.panzhihua.common.model.vos.community.questnaire.UsersAnswerQuestnaireVO; |
| | |
| | | import com.panzhihua.common.model.vos.user.SysUserNoticeVO; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.*; |
| | | import com.panzhihua.common.utlis.AgeUtils; |
| | | import com.panzhihua.common.utlis.ClazzUtils; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.IdCard; |
| | | import com.panzhihua.common.utlis.WxUtil; |
| | | import com.panzhihua.common.utlis.WxXCXTempSend; |
| | | import com.panzhihua.service_community.dao.ComActActSignDAO; |
| | | import com.panzhihua.service_community.dao.ComEldersAuthHistoryRecordMapper; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.model.dos.*; |
| | | import com.panzhihua.service_community.service.*; |
| | | import com.panzhihua.service_community.model.dos.ComActActEvaluateDO; |
| | | import com.panzhihua.service_community.model.dos.ComActActPrizeDO; |
| | | import com.panzhihua.service_community.model.dos.ComActDynDO; |
| | | import com.panzhihua.service_community.model.dos.ComActEasyPhotoDO; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishDO; |
| | | import com.panzhihua.service_community.model.dos.ComEldersAuthHistoryRecordDO; |
| | | import com.panzhihua.service_community.model.dos.ComEldersAuthUserDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngStructAreaDO; |
| | | import com.panzhihua.service_community.model.dos.EldersAuthDO; |
| | | import com.panzhihua.service_community.service.ComActActEvaluateService; |
| | | import com.panzhihua.service_community.service.ComActActPrizeService; |
| | | import com.panzhihua.service_community.service.ComActActivityService; |
| | | import com.panzhihua.service_community.service.ComActDynService; |
| | | import com.panzhihua.service_community.service.ComActEasyPhotoActivityService; |
| | | import com.panzhihua.service_community.service.ComActEasyPhotoService; |
| | | import com.panzhihua.service_community.service.ComActMessageService; |
| | | import com.panzhihua.service_community.service.ComActMicroWishService; |
| | | import com.panzhihua.service_community.service.ComActQuestnaireService; |
| | | import com.panzhihua.service_community.service.ComActService; |
| | | import com.panzhihua.service_community.service.ComEldersAuthUserService; |
| | | import com.panzhihua.service_community.service.ComMngStructAreaDistrictService; |
| | | import com.panzhihua.service_community.service.ComMngStructAreaService; |
| | | import com.panzhihua.service_community.service.ComMngStructHouseService; |
| | | import com.panzhihua.service_community.service.ComMngStructOtherBuildService; |
| | | import com.panzhihua.service_community.service.ComMngVolunteerMngService; |
| | | import com.panzhihua.service_community.service.EldersAuthService; |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private ComEldersAuthHistoryRecordMapper comEldersAuthHistoryRecordMapper; |
| | | @Resource |
| | | private ComActEasyPhotoActivityService comActEasyPhotoActivityService; |
| | | @Resource |
| | | private ComActActEvaluateService comActActEvaluateService; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | if (ObjectUtils.isEmpty(comActActivityVO)) { |
| | | return R.fail("活动不存在"); |
| | | } |
| | | //活动奖品 |
| | | List<ComActActPrizeDO> comActActPrizeDOS = comActActPrizeService |
| | | .list(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, id)); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeDOS)) { |
| | |
| | | }); |
| | | comActActivityVO.setComActActPrizeVOList(comActActPrizeVOS); |
| | | } |
| | | //活动评价 |
| | | List<ComActActEvaluateDO> comActActEvaluateDOList = comActActEvaluateService |
| | | .list(new QueryWrapper<ComActActEvaluateDO>().lambda().eq(ComActActEvaluateDO::getActivityId, id)); |
| | | if (!ObjectUtils.isEmpty(comActActEvaluateDOList)) { |
| | | List<ComActActEvaluateVO> comActActEvaluateVOList = new ArrayList<>(); |
| | | comActActEvaluateDOList.forEach(comActActEvaluateDO -> { |
| | | ComActActEvaluateVO comActActEvaluateVO = new ComActActEvaluateVO(); |
| | | BeanUtils.copyProperties(comActActEvaluateDO, comActActEvaluateVO); |
| | | comActActEvaluateVOList.add(comActActEvaluateVO); |
| | | }); |
| | | comActActivityVO.setComActActEvaluateVOList(comActActEvaluateVOList); |
| | | //活动评价总数 |
| | | comActActivityVO.setEvaluateAmount(comActActEvaluateDOList.size()); |
| | | //当前用户对活动的评分 |
| | | Optional.ofNullable(userId).ifPresent(currentUserId -> { |
| | | Optional<ComActActEvaluateDO> optional = comActActEvaluateDOList.stream() |
| | | .filter(comActActEvaluateDO -> comActActEvaluateDO.getUserId().equals(currentUserId)).findFirst(); |
| | | if (optional.isPresent()) { |
| | | comActActivityVO.setMyRating(optional.get().getStarLevel()); |
| | | } |
| | | }); |
| | | } |
| | | //签到时间 |
| | | Optional.ofNullable(userId).ifPresent(currentUserId -> { |
| | | R listSignInResult = comActActivityService.listSignInActivity(currentUserId); |
| | | if (R.isOk(listSignInResult) && !ObjectUtils.isEmpty(listSignInResult.getData())) { |
| | | Optional<ComActActRegistVO> optional = JSONArray.parseArray(JSONArray.toJSONString(listSignInResult.getData()), ComActActRegistVO.class).stream() |
| | | .filter(activitySignInVO -> activitySignInVO.getActivityId().equals(id)) |
| | | .sorted(Comparator.comparing(ComActActRegistVO::getCreateAt).reversed()).findFirst(); |
| | | if (optional.isPresent()) { |
| | | comActActivityVO.setActivitySignInDate(optional.get().getCreateAt()); |
| | | } |
| | | } |
| | | }); |
| | | //活动报名名单 |
| | | ActivitySignVO activitySignVO = new ActivitySignVO(); |
| | | activitySignVO.setActivityId(id); |
| | | R r = comActActivityService.listActivitySigns(activitySignVO); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 活动签到 |
| | | * |
| | | * @param comActActRegistVO 请求参数 |
| | | * @return 签到结果 |
| | | */ |
| | | @PostMapping("activity/sign-in") |
| | | public R activitySignIn(@RequestBody ComActActRegistVO comActActRegistVO) { |
| | | return comActActivityService.activitySignIn(comActActRegistVO); |
| | | } |
| | | |
| | | /** |
| | | * 用户签到列表 |
| | | * |
| | | * @param userId 用户id |
| | | * @return 用户签到记录列表 |
| | | */ |
| | | @GetMapping("/sign-in/user/list") |
| | | public R listSignInActivity(@RequestParam("userId") Long userId) { |
| | | return comActActivityService.listSignInActivity(userId); |
| | | } |
| | | |
| | | /** |
| | | * 社区活动评价 |
| | | * |
| | | * @param comActActEvaluateVO 社区评价VO |
| | | * @return 评价结果 |
| | | */ |
| | | @PostMapping("activity/evaluate") |
| | | public R activityEvaluate(@RequestBody ComActActEvaluateVO comActActEvaluateVO) { |
| | | return comActActEvaluateService.activityEvaluate(comActActEvaluateVO); |
| | | } |
| | | |
| | | /** |
| | | * 用户评价列表 |
| | | * |
| | | * @param userId 用户id |
| | | * @return 当前用户对所有活动的评价列表 |
| | | */ |
| | | @GetMapping("/evaluate/user/list") |
| | | public R listEvaluate(@RequestParam("userId") Long userId) { |
| | | return comActActEvaluateService.listEvaluate(userId); |
| | | } |
| | | |
| | | /** |
| | | * 分页活动报名名单 |
| | | * |
| | | * @param activitySignVO |
| | |
| | | @PostMapping("listactivitysigns") |
| | | public R listActivitySigns(@RequestBody ActivitySignVO activitySignVO) { |
| | | return comActActivityService.listActivitySigns(activitySignVO); |
| | | } |
| | | |
| | | /** |
| | | * description getSignLists 查询活动报名名单 |
| | | * @param activitySignVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("activity/sign/getList") |
| | | public R getSignLists(@RequestBody ActivitySignVO activitySignVO){ |
| | | return comActActivityService.getSignLists(activitySignVO); |
| | | } |
| | | |
| | | /** |
| | | * description listActivityRegists 分页查询活动评价 |
| | | * @param comActActEvaluateVO 活动评价vo |
| | | * @return R 分页查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("activity/evaluate/page") |
| | | public R pageActivityEvaluates(@RequestBody ComActActEvaluateVO comActActEvaluateVO) { |
| | | return comActActivityService.pageActivityEvaluates(comActActEvaluateVO); |
| | | } |
| | | |
| | | /** |
| | | * description getEvaluateLists 查询活动评价 |
| | | * @param comActActEvaluateVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("activity/evaluate/getList") |
| | | public R getEvaluateLists(@RequestBody ComActActEvaluateVO comActActEvaluateVO){ |
| | | return comActActivityService.getEvaluateLists(comActActEvaluateVO); |
| | | } |
| | | |
| | | /** |
| | | * description pageActivityRegists 分页查询活动签到 |
| | | * @param comActActRegistVO 活动签到vo |
| | | * @return R 分页查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("activity/regist/page") |
| | | public R pageActivityRegists(@RequestBody ComActActRegistVO comActActRegistVO) { |
| | | return comActActivityService.pageActivityRegists(comActActRegistVO); |
| | | } |
| | | |
| | | /** |
| | | * description getRegistLists 查询活动签到 |
| | | * @param comActActRegistVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/25 9:33 |
| | | */ |
| | | @PostMapping("activity/regist/getList") |
| | | public R getRegistLists(@RequestBody ComActActRegistVO comActActRegistVO){ |
| | | return comActActivityService.getRegistLists(comActActRegistVO); |
| | | } |
| | | |
| | | /** |
| | | * description getRegistLists 查询活动未签到 |
| | | * @param comActActRegistVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/25 9:33 |
| | | */ |
| | | @PostMapping("activity/noRegist/getList") |
| | | public R getNoRegistLists(@RequestBody ComActActRegistVO comActActRegistVO){ |
| | | return comActActivityService.getNoRegistLists(comActActRegistVO); |
| | | } |
| | | |
| | | /** |
| | | * description activityStagistics 活动数据统计 |
| | | * @param activityId 活动id |
| | | * @return R 统计结果 |
| | | * @author txb |
| | | * @date 2021/8/25 13:33 |
| | | */ |
| | | @GetMapping("activity/statistics") |
| | | public R activityStatistics(@RequestParam("activityId") Long activityId){ |
| | | return comActActivityService.activityStatistics(activityId); |
| | | } |
| | | |
| | | /** |
| | | * 获取活动历史封面 getPictureList |
| | | * @param userId 用户id |
| | | * @return R 统计结果 |
| | | * @author txb |
| | | * @date 2021/8/27 13:33 |
| | | */ |
| | | @GetMapping("/activity/picture/getList") |
| | | public R getPictureList(@RequestParam("userId") Long userId){ |
| | | return comActActivityService.getPictureList(userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 定时任务针对活动结束后7天还未评价的用户默认好评 |
| | | */ |
| | | @PostMapping("activity/default-praise") |
| | | public R timedTaskActivityDefaultPraise() { |
| | | return comActActEvaluateService.timedTaskActivityDefaultPraise(); |
| | | } |
| | | |
| | | /** |
| | | * 小程序-新增问卷调查浏览数量 |
| | | * |
| | | * @param questId |