From 1a44a6409a672dcd30a6bcafbf177c918c6e9c68 Mon Sep 17 00:00:00 2001
From: luoyuanqiao <2376770955@qq.com>
Date: 星期二, 01 三月 2022 15:29:27 +0800
Subject: [PATCH] 随手拍、微心愿分配接口修改
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java | 157 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 129 insertions(+), 28 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 7e2c566..13782bb 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
@@ -2,6 +2,8 @@
import static java.util.stream.Collectors.toList;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
@@ -11,6 +13,9 @@
import javax.annotation.Resource;
+import com.panzhihua.common.model.vos.community.ComActActivityTypeVO;
+import com.panzhihua.common.model.vos.user.SysTemplateConfigVO;
+import com.panzhihua.service_community.dao.ComActActEvaluateDAO;
import com.panzhihua.service_community.model.dos.*;
import com.panzhihua.service_community.service.*;
import org.springframework.beans.BeanUtils;
@@ -149,6 +154,8 @@
private ComEldersAuthElderlyService comEldersAuthElderlyService;
@Resource
private ComActMicroWishOperationRecordService wishOperationRecordService;
+ @Resource
+ private ComActActEvaluateDAO comActActEvaluateDAO;
/**
* 新增社区活动
@@ -274,8 +281,8 @@
});
}
comActActivityVO1.setComActActPrizeVOList(comActActPrizeVOList);
- Integer participantMax = comActActivityVO1.getParticipantMax();
- if (participantMax.intValue() == 0) {
+ Integer volunteerMax = comActActivityVO1.getVolunteerMax();
+ if (volunteerMax.intValue() != 0) {
comActActivityVO1.setType(1);
} else {
comActActivityVO1.setType(2);
@@ -334,7 +341,9 @@
*/
@PostMapping("detailactivity")
public R detailActivity(@RequestParam("id") Long id,
- @RequestParam(value = "userId", required = false) Long userId) {
+ @RequestParam(value = "userId", required = false) Long userId,
+ @RequestParam(value = "pageNum",defaultValue = "1", required = false) Long pageNum,
+ @RequestParam(value = "pageSize",defaultValue = "10", required = false) Long pageSize) {
ComActActivityVO comActActivityVO = comActActivityService.inforActivity(id, userId);
if (ObjectUtils.isEmpty(comActActivityVO)) {
return R.fail("活动不存在");
@@ -352,26 +361,31 @@
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());
- }
- });
+ IPage<ComActActEvaluateVO> comActActEvaluatePage = comActActEvaluateDAO.getEvaluateListPage(new Page(pageNum,pageSize),id);
+ comActActivityVO.setComActActEvaluateVOList(comActActEvaluatePage.getRecords());
+ //活动评价总数
+ comActActivityVO.setEvaluateAmount(comActActEvaluatePage.getTotal());
+ List<ComActActEvaluateDO> comActActEvaluateList = comActActEvaluateDAO
+ .selectList(new QueryWrapper<ComActActEvaluateDO>().lambda().eq(ComActActEvaluateDO::getActivityId, id));
+ if (comActActEvaluateList != null && comActActEvaluateList.size() > 0) {
+ BigDecimal starNum = BigDecimal.ZERO;
+ //总星级
+ for (ComActActEvaluateDO evaluate:comActActEvaluateList) {
+ starNum = starNum.add(BigDecimal.valueOf(evaluate.getStarLevel()==null?0:evaluate.getStarLevel()));
+ }
+ //评分星级(如果无评分默认5分)=总星级/总评价人数
+ if(starNum.compareTo(BigDecimal.ZERO) == 0){
+ comActActivityVO.setEvaluateLevel(BigDecimal.valueOf(5));
+ }else{
+ comActActivityVO.setEvaluateLevel(starNum.divide(BigDecimal.valueOf(comActActEvaluateList.size()),2, RoundingMode.HALF_UP));
+ }
+ }else{
+ comActActivityVO.setEvaluateLevel(BigDecimal.valueOf(5));
+ }
+ //当前用户对活动的评分
+ ComActActEvaluateVO userActEvaluateVO = comActActEvaluateDAO.getEvaluateListByUserId(id,userId);
+ if(userActEvaluateVO != null){
+ comActActivityVO.setMyRating(userActEvaluateVO.getStarLevel());
}
fillActivitySignList(id, comActActivityVO);
comActActivityVO.setIntegral(0);
@@ -387,6 +401,7 @@
//活动报名名单
ActivitySignVO activitySignVO = new ActivitySignVO();
activitySignVO.setActivityId(activityId);
+ activitySignVO.setStatus(1);
R r = comActActivityService.listActivitySigns(activitySignVO);
if (R.isOk(r)) {
List<ActivitySignVO> activitySignVOS =
@@ -1393,8 +1408,9 @@
* @return 活动列表
*/
@PostMapping("listactivity")
- public R listActivity(@RequestParam("userId") Long userId) {
- return comActActivityService.listActivity(userId);
+ public R listActivity(@RequestParam("userId") Long userId,
+ @RequestParam(value = "status", required = false) Integer status) {
+ return comActActivityService.listActivity(userId, status);
}
/**
@@ -1500,8 +1516,8 @@
* @return 社区集合 按照创建顺序倒序排列
*/
@PostMapping("listcommunityall")
- public R listCommunityAll() {
- return comActService.listCommunityAll();
+ public R listCommunityAll(@RequestParam("areaCode") String areaCode) {
+ return comActService.listCommunityAll(areaCode);
}
/**
@@ -2225,10 +2241,11 @@
String openid = map.get("openid");
try {
WxXCXTempSend util = new WxXCXTempSend();
+ R<SysTemplateConfigVO> sysTemplateConfigVO=userService.selectTemplate(eldersAuthFeedbackAddDTO.getAreaCode(),5);
String accessToken = util.getAppAccessToken();
WxUtil.sendSubscribeRZSH(openid, accessToken, "高龄认证",
DateUtils.format(eldersAuthDO.getCreateAt(), DateUtils.ymdhms_format),
- eldersAuthFeedbackAddDTO.getFeedBack());
+ eldersAuthFeedbackAddDTO.getFeedBack(),sysTemplateConfigVO.getData().getTemplateId());
} catch (Exception e) {
log.error("推送审核状态订阅消息失败,失败原因:" + e.getMessage());
}
@@ -2292,6 +2309,16 @@
@GetMapping("/eventgrid/community/list")
public R getCommunityLists() {
return comActService.getCommunityLists();
+ }
+
+ /**
+ * 查询西区社区列表
+ *
+ * @return 社区列表
+ */
+ @GetMapping("/eventgrid/community/westList")
+ public R getWestCommunityLists(@RequestParam("areaCode")String areaCode) {
+ return comActService.getWestCommunityLists(areaCode);
}
/**
@@ -2442,4 +2469,78 @@
public R easyPhotoNoHandleList(@RequestParam("communityId") Long communityId) {
return comActEasyPhotoService.easyPhotoNoHandleList(communityId);
}
+
+ /**
+ * 微心愿处理人列表
+ * @param communityId 社区id
+ * @param type 处理人类型(1.后台用户 2.党员 3.志愿者)
+ * @return 处理人列表
+ */
+ @GetMapping("wish/handle/list/admin")
+ public R wishHandleListAdmin(@RequestParam(value = "communityId") Long communityId,@RequestParam("type") Integer type){
+ return R.ok(comActMicroWishService.wishHandleListAdmin(communityId,type));
+ }
+
+ /**
+ * 社区后台分页查询微心愿
+ * @param comActMicroWishVO 请求参数
+ * @return 微心愿列表
+ */
+ @PostMapping("pagemicrowishAdmin")
+ public R pageMicroWishAdmin(@RequestBody ComActMicroWishVO comActMicroWishVO) {
+ return comActMicroWishService.pageMicroWishAdmin(comActMicroWishVO);
+ }
+
+ /**
+ * 活动报名签到情况
+ * @param id 活动主键id
+ * @return
+ */
+ @GetMapping("activity/sign-in/list")
+ public R listSignInRecord(@RequestParam("id") Long id) {
+ return comActActivityService.listSignInRecord(id);
+ }
+
+ /**
+ * 活动签到记录
+ * @param id 活动主键
+ * @param userId 用户id
+ * @return
+ */
+ @GetMapping("activity/regist/list")
+ public R listRegistRecord(@RequestParam("id") Long id, @RequestParam("userId") Long userId) {
+ return comActActivityService.listRegistRecord(id, userId);
+ }
+
+ /**
+ * 获取活动类型(目前只有志愿者活动需要获取)
+ * @param communityId
+ * @param type
+ * @return
+ */
+ @GetMapping("activity/type/list")
+ public R listActivityType(@RequestParam("communityId") Long communityId, @RequestParam("type") Integer type) {
+ return comActActivityService.listActivityType(communityId, type);
+ }
+
+ /**
+ * 添加活动类型
+ * @param comActActivityTypeVO
+ * @return
+ */
+ @PostMapping("activity/type/add")
+ public R addActivityType(@RequestBody ComActActivityTypeVO comActActivityTypeVO) {
+ return comActActivityService.addActivityType(comActActivityTypeVO);
+ }
+
+ /**
+ * 我的评价
+ * @param userId
+ * @param activityId 活动id
+ * @return
+ */
+ @GetMapping("activity/my-evaluate")
+ public R listMyActivityEvaluate(@RequestParam("userId") Long userId, @RequestParam("activityId") Long activityId) {
+ return comActActEvaluateService.listMyActivityEvaluate(userId, activityId);
+ }
}
--
Gitblit v1.7.1