From bca12ee4bb081975bd6bb03e4f6883053110038b Mon Sep 17 00:00:00 2001 From: huanghongfa <18228131219@163.com> Date: 星期五, 15 一月 2021 10:09:22 +0800 Subject: [PATCH] 小程序社区活动不展示未发布的活动 --- springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 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 d75f8e1..25317c3 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.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 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") @@ -34,7 +42,7 @@ Long communityId = this.getCommunityId(); comActDynVO.setCommunityId(communityId); comActDynVO.setIsTopping(null); - comActDynVO.setStatus(null); + comActDynVO.setStatus(1); return communityService.pageDynamic(comActDynVO); } @@ -50,6 +58,7 @@ public R pageActivity(@RequestBody ComActActivityVO comActActivityVO){ Long communityId = this.getCommunityId(); comActActivityVO.setCommunityId(communityId); + comActActivityVO.setIsApplets(1); return communityService.pageActivity(comActActivityVO); } @@ -65,8 +74,28 @@ @PutMapping("signactivity") 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) -- Gitblit v1.7.1