package com.ruoyi.user.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.user.domain.AccountCancelApply; import com.ruoyi.user.domain.vo.AccountCancelApplyVo; import com.ruoyi.user.service.IAccountCancelApplyService; /** * 注销申请审核 信息操作处理 * * 网关前缀 /account 由 StripPrefix=1 剥掉,故此处映射为 /user/cancel, * 外部实际路径是 /account/user/cancel/**。 * * 本模块只有"审"没有"增删":申请由 C 端会员提交(不在本仓库范围), * 后台只负责查看与通过/驳回。 * * @author ruoyi */ @RestController @RequestMapping("/user/cancel") public class AccountCancelApplyController extends BaseController { @Autowired private IAccountCancelApplyService cancelApplyService; /** * 查询注销申请列表 */ @RequiresPermissions("member:cancel:list") @GetMapping("/list") public TableDataInfo list(AccountCancelApplyVo apply) { // 筛选区是「申请人」单个输入框。纯数字时补一个 keywordId 让用户编号与申请号走等值匹配; // 非数字则不参与这两列的比较(否则要 cast 列,主键索引用不上)。 String keyword = (String) apply.getParams().get("keyword"); if (StringUtils.isNotEmpty(keyword)) { try { apply.getParams().put("keywordId", Long.valueOf(keyword.trim())); } catch (NumberFormatException ignored) { // 非纯数字,只走手机号/姓名/企业名的模糊匹配 } } startPage(); return getDataTable(cancelApplyService.selectCancelApplyList(apply)); } /** * 获取注销申请审核详情 */ @RequiresPermissions("member:cancel:query") @GetMapping("/detail/{id}") public AjaxResult detail(@PathVariable Long id) { return success(cancelApplyService.selectCancelApplyDetail(id)); } /** * 审核注销申请(通过/驳回) * * 置为独立接口而非复用 PUT 全量更新:审核只允许改审核结果 4 列, * 走全量更新会把申请快照(会员提交的资料)也暴露成可写字段。 */ @RequiresPermissions("member:cancel:audit") @Log(title = "注销申请审核", businessType = BusinessType.UPDATE) @PutMapping("/audit") public AjaxResult audit(@RequestBody AccountCancelApply apply) { if (StringUtils.isNull(apply.getId())) { return error("申请号不能为空"); } if (StringUtils.isEmpty(apply.getAuditStatus())) { return error("审核结果不能为空"); } return toAjax(cancelApplyService.auditCancelApply( apply.getId(), apply.getAuditStatus(), apply.getAuditRemark())); } }