| | |
| | | package com.panzhihua.sangeshenbian.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.panzhihua.sangeshenbian.service.IPartyMemberService; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | @ApiOperation(value = "党员申请") |
| | | @PostMapping("/apply") |
| | | public R<?> apply(@Valid @RequestBody PartyMemberApplicationRequest dto) { |
| | | int count = partyMemberService.count(new LambdaQueryWrapper<PartyMember>() |
| | | .eq(PartyMember::getPhone, getLoginUserInfo().getPhone()) |
| | | .eq(PartyMember::getDelFlag, 0)); |
| | | if (count > 0){ |
| | | return R.fail("您已提交过申请,请勿重复提交"); |
| | | } |
| | | partyMemberService.applyForMembership(dto, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | |
| | | @ApiOperation(value = "编辑党员信息") |
| | | @PostMapping("/edit") |
| | | public R<?> edit(@Valid @RequestBody PartyMemberApplicationRequest dto) { |
| | | if (Objects.isNull(dto.getId())){ |
| | | return R.fail("id不能为空"); |
| | | LoginUserInfoVO loginUserInfo = getLoginUserInfo(); |
| | | String phone = loginUserInfo.getPhone(); |
| | | PartyMember partyMember = partyMemberService.getOne(new LambdaUpdateWrapper<PartyMember>() |
| | | .eq(PartyMember::getPhone, phone)); |
| | | if (partyMember == null){ |
| | | return R.fail("请先完善党员信息"); |
| | | } |
| | | dto.setId(partyMember.getId()); |
| | | partyMemberService.applyForMembership(dto, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | |
| | | */ |
| | | @ApiOperation(value = "党员信息详情") |
| | | @PostMapping("/detail") |
| | | public R<?> detail(@RequestParam Long id) { |
| | | return R.ok(partyMemberService.getById(id)); |
| | | public R<?> detail() { |
| | | LoginUserInfoVO loginUserInfo = getLoginUserInfo(); |
| | | String phone = loginUserInfo.getPhone(); |
| | | return R.ok(partyMemberService.getOne(new LambdaUpdateWrapper<PartyMember>() |
| | | .eq(PartyMember::getPhone, phone) |
| | | .eq(PartyMember::getDelFlag, 0))); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "党员待审核列表") |
| | | @PostMapping("/pre-audit-list") |
| | | public R<?> preAuditList(Page<PendingPartyMemberApplicationVO> page) { |
| | | public R<Page<PendingPartyMemberApplicationVO>> preAuditList(Page<PendingPartyMemberApplicationVO> page) { |
| | | return R.ok(partyMemberService.preAuditList(page,getLoginUserInfo())); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 确认党员信息 |
| | | */ |
| | | @GetMapping("/confirm-party-member-info") |
| | | @ApiOperation("确认党员信息") |
| | | public R<?> confirmPartyMemberInfo() { |
| | | LoginUserInfoVO loginUserInfo = getLoginUserInfo(); |
| | | // 获取党员信息 |
| | | PartyMember partyMember = partyMemberService.getOne(new LambdaQueryWrapper<PartyMember>() |
| | | .eq(PartyMember::getPhone, loginUserInfo.getPhone()) |
| | | .eq(PartyMember::getDelFlag, 0)); |
| | | if (partyMember == null){ |
| | | return R.fail("请先完善党员信息"); |
| | | } |
| | | partyMember.setIsConfirm(1); |
| | | partyMemberService.updateById(partyMember); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |