New file |
| | |
| | | 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.model.vos.R; |
| | | import com.panzhihua.sangeshenbian.model.entity.BcRegion; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComStreet; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.panzhihua.sangeshenbian.service.IBcRegionService; |
| | | import com.panzhihua.sangeshenbian.service.IComActService; |
| | | import com.panzhihua.sangeshenbian.service.IComStreetService; |
| | | import com.panzhihua.sangeshenbian.service.IPartyMemberService; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberApplicationRequest; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberAuditRequest; |
| | | import com.panzhihua.sangeshenbian.warpper.PendingPartyMemberApplicationVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Api(tags = {"小程序-党员管理"}) |
| | | @Validated |
| | | @RestController("/applet/party-member") |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class PartyMemberController extends BaseController { |
| | | private final IPartyMemberService partyMemberService; |
| | | private final IBcRegionService bcRegionService; |
| | | private final IComStreetService comStreetService; |
| | | private final IComActService comActService; |
| | | |
| | | /** |
| | | * 党员申请 |
| | | */ |
| | | @ApiOperation(value = "党员申请") |
| | | @PostMapping("/apply") |
| | | public R<?> apply(@Valid @RequestBody PartyMemberApplicationRequest dto) { |
| | | 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不能为空"); |
| | | } |
| | | partyMemberService.applyForMembership(dto, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 党员信息详情 |
| | | */ |
| | | @ApiOperation(value = "党员信息详情") |
| | | @PostMapping("/detail") |
| | | public R<?> detail(@RequestParam Long id) { |
| | | return R.ok(partyMemberService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 党员待审核列表 |
| | | */ |
| | | @ApiOperation(value = "党员待审核列表") |
| | | @PostMapping("/pre-audit-list") |
| | | public R<?> preAuditList(Page<PendingPartyMemberApplicationVO> page) { |
| | | return R.ok(partyMemberService.preAuditList(page,getLoginUserInfo())); |
| | | } |
| | | |
| | | /** |
| | | * 党员申请审核 |
| | | */ |
| | | @ApiOperation(value = "党员申请审核") |
| | | @PostMapping("/audit") |
| | | public R<?> audit(@Valid @RequestBody PartyMemberAuditRequest request) { |
| | | Integer result = request.getResult(); |
| | | if (result == null){ |
| | | return R.fail("审核结果不能为空"); |
| | | } |
| | | if (result == 2 && Objects.isNull(request.getReason())){ |
| | | return R.fail("审核不通过原因不能为空"); |
| | | } |
| | | partyMemberService.update(new LambdaUpdateWrapper<PartyMember>() |
| | | .eq(PartyMember::getId,request.getId()) |
| | | .set(PartyMember::getAuditStatus,result) |
| | | .set(PartyMember::getRefuseReason,result == 2 ? request.getReason() : null)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |