From ae33fef700e5d2558dffb03c8f66358da2545791 Mon Sep 17 00:00:00 2001
From: huanghongfa <18228131219@163.com>
Date: 星期四, 07 一月 2021 16:25:41 +0800
Subject: [PATCH] 通知后台加入代码

---
 springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java
index 884b264..6ba63f3 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java
@@ -1,15 +1,20 @@
 package com.panzhihua.applets.api;
 
+import com.alibaba.fastjson.JSONObject;
 import com.panzhihua.common.controller.BaseController;
-import com.panzhihua.common.model.vos.LoginUserInfoVO;
+import com.panzhihua.common.model.dtos.community.PageVolunteerDTO;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.vos.community.*;
+import com.panzhihua.common.model.vos.partybuilding.PartyBuildingActivityVO;
+import com.panzhihua.common.model.vos.user.SysUserNoticeVO;
 import com.panzhihua.common.service.community.CommunityService;
+import com.panzhihua.common.service.user.UserService;
 import com.panzhihua.common.validated.AddGroup;
+import com.panzhihua.common.validated.PageGroup;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.util.ObjectUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -21,12 +26,15 @@
  * @author: huang.hongfa weixin hhf9596 qq 959656820
  * @create: 2020-12-10 10:04
  **/
+@Slf4j
 @RestController
 @RequestMapping("/community/")
 @Api(tags = {"社区服务"})
 public class CommunityApi extends BaseController {
     @Resource
     private CommunityService communityService;
+    @Resource
+    private UserService userService;
 
     @ApiOperation(value = "分页获取社区动态",response = ComActDynVO.class)
     @PostMapping("pagedynamic")
@@ -63,15 +71,35 @@
 
     @ApiOperation(value = "报名/取消报名社区活动")
     @PutMapping("signactivity")
-    public R signActivity(@RequestBody SignactivityVO signactivityVO){
+    public R signActivity(@RequestBody @Validated(AddGroup.class) SignactivityVO signactivityVO){
         Long userId = this.getUserId();
+        Long activityId = signactivityVO.getActivityId();
         signactivityVO.setUserId(userId);
-        return communityService.signActivity(signactivityVO);
+        R r = communityService.signActivity(signactivityVO);
+        if (R.isOk(r)&&signactivityVO.getType().intValue()==1) {
+            R r2 = communityService.detailActivity(activityId, userId);
+            ComActActivityVO comActActivityVO= JSONObject.parseObject(JSONObject.toJSONString(r2.getData()),ComActActivityVO.class);
+            SysUserNoticeVO sysUserNoticeVO=new SysUserNoticeVO();
+            sysUserNoticeVO.setUserId(userId);
+            sysUserNoticeVO.setType(1);
+            sysUserNoticeVO.setTitle("报名成功");
+            sysUserNoticeVO.setBusinessType(1);
+            sysUserNoticeVO.setBusinessTitle(comActActivityVO.getActivityName());
+            sysUserNoticeVO.setBusinessContent(String.format("活动将于%s开始,请按时参加",comActActivityVO.getBeginAt()));
+            sysUserNoticeVO.setBusinessId(activityId);
+            sysUserNoticeVO.setStatus(0);
+            sysUserNoticeVO.setBusinessStatus(2);
+            R r1 = userService.addNotice(sysUserNoticeVO);
+            if (R.isOk(r1)) {
+                log.info("新增用户报名社区活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
+            }
+        }
+        return r;
     }
 
     @ApiOperation(value = "活动人员列表",response = ActivitySignVO.class)
     @ApiImplicitParam(name ="id",value = "社区活动主键",required = true)
-    @PostMapping("listactivitysign")
+    @GetMapping("listactivitysign")
     public R listActivitySign(@RequestParam("id") Long id){
         ActivitySignVO activitySignVO=new ActivitySignVO();
         activitySignVO.setActivityId(id);
@@ -96,6 +124,23 @@
         return communityService.addVolunteer(comMngVolunteerMngVO);
     }
 
+    @ApiOperation(value = "分页查询志愿者团队")
+    @PostMapping("pagevolunteer")
+    public R pageVolunteer(@RequestBody @Validated(PageGroup.class) PageVolunteerDTO pageVolunteerDTO){
+        Long communityId = this.getCommunityId();
+        ComMngVolunteerMngVO comMngVolunteerMngVO=new ComMngVolunteerMngVO();
+        comMngVolunteerMngVO.setCommunityId(communityId);
+        comMngVolunteerMngVO.setPageNum(pageVolunteerDTO.getPageNum());
+        comMngVolunteerMngVO.setPageSize(pageVolunteerDTO.getPageSize());
+        return communityService.pageVolunteer(comMngVolunteerMngVO);
+    }
+
+    @ApiOperation(value = "志愿者详情",response = ComMngVolunteerMngAppletsVO.class)
+    @GetMapping("volunteer")
+    public R detailVolunteer(@RequestParam("id") Long id){
+        return communityService.detailVolunteer(id);
+    }
+
 
 }
 

--
Gitblit v1.7.1