From 0135fa289418c5fd231fa4e7c60ee7b8f06f17a7 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 06 五月 2025 19:29:11 +0800
Subject: [PATCH] Merge branch 'dev-2.0.1' of http://120.76.84.145:10101/gitblit/r/java/zhihuishenqu into dev-2.0.1

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/PartyMemberController.java |  137 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 137 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/PartyMemberController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/PartyMemberController.java
new file mode 100644
index 0000000..47f0bd0
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/PartyMemberController.java
@@ -0,0 +1,137 @@
+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 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.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.Objects;
+
+@Api(tags = {"小程序-党员管理"})
+@Validated
+@RestController
+@RequestMapping("/applet/party-member")
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class PartyMemberController extends BaseController {
+    private final IPartyMemberService partyMemberService;
+
+    /**
+     * 党员申请
+     */
+    @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) {
+        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() {
+        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<Page<PendingPartyMemberApplicationVO>> 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();
+    }
+
+    /**
+     * 确认党员信息
+     */
+    @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();
+    }
+
+
+
+}

--
Gitblit v1.7.1