| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.partybuilding.ActivitySignUpDTO; |
| | | 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 io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-02 16:19 |
| | | **/ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/partybuilding/") |
| | | @Api(tags = {"党群服务"}) |
| | | public class PartyBuildingApi extends BaseController { |
| | | @Resource |
| | | private PartyBuildingService partyBuildingService; |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @ApiOperation(value = "分页党建动态/政策文件",response =PartyCommitteeVO.class ) |
| | | @PostMapping("pagedynamic") |
| | |
| | | @ApiOperation(value = "报名、取消报名党员活动") |
| | | @PutMapping("activitysignup") |
| | | public R putActivitySignUp(@RequestBody @Validated ActivitySignUpDTO activitySignUpDTO) { |
| | | activitySignUpDTO.setUserId(this.getUserId()); |
| | | return partyBuildingService.putActivitySignUp(activitySignUpDTO); |
| | | Long userId = this.getUserId(); |
| | | activitySignUpDTO.setUserId(userId); |
| | | Long id = activitySignUpDTO.getId(); |
| | | R r = partyBuildingService.putActivitySignUp(activitySignUpDTO); |
| | | if (R.isOk(r)&&activitySignUpDTO.getType().intValue()==1) { |
| | | R r2 = partyBuildingService.activityinfo(id, userId); |
| | | PartyBuildingActivityVO partyBuildingActivityVO=JSONObject.parseObject(JSONObject.toJSONString(r2.getData()),PartyBuildingActivityVO.class); |
| | | SysUserNoticeVO sysUserNoticeVO=new SysUserNoticeVO(); |
| | | sysUserNoticeVO.setUserId(userId); |
| | | sysUserNoticeVO.setType(1); |
| | | sysUserNoticeVO.setTitle("报名成功"); |
| | | sysUserNoticeVO.setBusinessType(2); |
| | | sysUserNoticeVO.setBusinessTitle(partyBuildingActivityVO.getName()); |
| | | sysUserNoticeVO.setBusinessContent(String.format("活动将于%s开始,请按时参加",partyBuildingActivityVO.getActivityTimeBegin())); |
| | | sysUserNoticeVO.setBusinessId(id); |
| | | sysUserNoticeVO.setStatus(0); |
| | | sysUserNoticeVO.setBusinessStatus(2); |
| | | R r1 = userService.addNotice(sysUserNoticeVO); |
| | | if (R.isOk(r1)) { |
| | | log.info("新增用户报名党建活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | |