From c36c5a9a1928df1e472a6b9ce12b789aeedc22e1 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 30 八月 2021 16:48:33 +0800
Subject: [PATCH] 预约登记修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java |  161 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 154 insertions(+), 7 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
index 5d0ee28..912692f 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -1,6 +1,11 @@
 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;
@@ -9,7 +14,14 @@
 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;
@@ -17,12 +29,46 @@
 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;
@@ -30,12 +76,41 @@
 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;
@@ -306,7 +381,27 @@
             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);
@@ -345,6 +440,50 @@
         }
         comActActivityVO.setIntegral(0);
         return R.ok(comActActivityVO);
+    }
+
+    /**
+     * 活动签到
+     *
+     * @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);
     }
 
     /**
@@ -2244,6 +2383,14 @@
     }
 
     /**
+     * 定时任务针对活动结束后7天还未评价的用户默认好评
+     */
+    @PostMapping("activity/default-praise")
+    public R timedTaskActivityDefaultPraise() {
+        return comActActEvaluateService.timedTaskActivityDefaultPraise();
+    }
+
+    /**
      * 小程序-新增问卷调查浏览数量
      * 
      * @param questId

--
Gitblit v1.7.1