| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.partybuilding.ActivitySignUpDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.ComPbActivityDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.PageComPbServiceTeamDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.partybuilding.*; |
| | | import com.panzhihua.common.model.vos.user.SysUserNoticeVO; |
| | | import com.panzhihua.common.service.partybuilding.PartyBuildingService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | public R pageActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | partyBuildingActivityVO.setCommunityId(communityId); |
| | | Integer status = partyBuildingActivityVO.getStatus(); |
| | | if (null!=status&&status.intValue()==4) { |
| | | partyBuildingActivityVO.setIsAppliets(1); |
| | | } |
| | | return partyBuildingService.pageActivity(partyBuildingActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "动态/政策文件详情",response =PartyBuildingComPbDynVO.class ) |
| | | @GetMapping("infodynamic") |
| | | public R infoYnamic(@RequestParam("id") Long id) { |
| | | return partyBuildingService.infoYnamic(id); |
| | | R r = partyBuildingService.infoYnamic(id); |
| | | if (R.isOk(r)) { |
| | | if (ObjectUtils.isEmpty(id)||0==id) { |
| | | return R.fail("主键id不能为空"); |
| | | } |
| | | Long userId = this.getUserId(); |
| | | ComPbDynUserVO comPbDynUserVO=new ComPbDynUserVO(); |
| | | comPbDynUserVO.setCreateAt(new Date()); |
| | | comPbDynUserVO.setDynId(id); |
| | | comPbDynUserVO.setUserId(userId); |
| | | partyBuildingService.addDynUser(comPbDynUserVO); |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "增加阅读记录") |
| | | @PostMapping("adddynuser") |
| | | public R addDynUser(@RequestBody PartyBuildingComPbDynVO partyBuildingComPbDynVO) { |
| | | Long id = partyBuildingComPbDynVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)||0==id) { |
| | | return R.fail("主键id不能为空"); |
| | | } |
| | | Long userId = this.getUserId(); |
| | | ComPbDynUserVO comPbDynUserVO=new ComPbDynUserVO(); |
| | | comPbDynUserVO.setCreateAt(new Date()); |
| | | comPbDynUserVO.setDynId(id); |
| | | comPbDynUserVO.setUserId(userId); |
| | | return partyBuildingService.addDynUser(comPbDynUserVO); |
| | | } |
| | | // @ApiOperation(value = "增加阅读记录") |
| | | // @PostMapping("adddynuser") |
| | | // public R addDynUser(@RequestBody PartyBuildingComPbDynVO partyBuildingComPbDynVO) { |
| | | // Long id = partyBuildingComPbDynVO.getId(); |
| | | // if (ObjectUtils.isEmpty(id)||0==id) { |
| | | // return R.fail("主键id不能为空"); |
| | | // } |
| | | // Long userId = this.getUserId(); |
| | | // ComPbDynUserVO comPbDynUserVO=new ComPbDynUserVO(); |
| | | // comPbDynUserVO.setCreateAt(new Date()); |
| | | // comPbDynUserVO.setDynId(id); |
| | | // comPbDynUserVO.setUserId(userId); |
| | | // return partyBuildingService.addDynUser(comPbDynUserVO); |
| | | // } |
| | | |
| | | @ApiOperation(value = "分页党委查询",response =PartyCommitteeVO.class ) |
| | | @PostMapping("pagepartycommittee") |
| | |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "创建党员活动") |
| | | @PostMapping("activityinfo") |
| | | public R addActivityinfo(@RequestBody @Validated(AddGroup.class) ComPbActivityDTO comPbActivityDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | comPbActivityDTO.setCreateBy(userId); |
| | | comPbActivityDTO.setCommunityId(communityId); |
| | | Date date=new Date(); |
| | | comPbActivityDTO.setReleaseTime(date); |
| | | Date activityTimeBegin = comPbActivityDTO.getActivityTimeBegin(); |
| | | Date activityTimeEnd = comPbActivityDTO.getActivityTimeEnd(); |
| | | boolean before = activityTimeEnd.before(activityTimeBegin); |
| | | if (before) { |
| | | return R.fail("活动结束时间不能早于开始时间"); |
| | | } |
| | | // 1 待发布 2 未开始 3 报名中 4 进行中 5 已结束 6 已取消 |
| | | int status=2; |
| | | Date enrollTimeBegin = comPbActivityDTO.getEnrollTimeBegin(); |
| | | Date enrollTimeEnd = comPbActivityDTO.getEnrollTimeEnd(); |
| | | if (enrollTimeEnd.before(enrollTimeBegin)) { |
| | | return R.fail("报名结束时间不能早于报名开始时间"); |
| | | } |
| | | if (enrollTimeBegin.before(date)) { |
| | | status=3; |
| | | } |
| | | comPbActivityDTO.setStatus(status); |
| | | return partyBuildingService.addActivityApplets(comPbActivityDTO); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "分页查询服务团队成员",response = ComPbServiceTeamVO.class) |
| | | @PostMapping("pageserviceteam") |
| | | public R pageServiceTeam(@RequestBody PageComPbServiceTeamDTO pageComPbServiceTeamDTO) { |
| | | pageComPbServiceTeamDTO.setCommunityId(this.getCommunityId()); |
| | | return partyBuildingService.pageServiceTeam(pageComPbServiceTeamDTO); |
| | | } |
| | | |
| | | } |