修复:实名认证模块
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -17,6 +18,7 @@ import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -82,6 +84,7 @@ public class UserVerifyController extends BaseController {
|
||||
return fail("提交失败");
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ApiOperation("修改实名认证")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody UserVerify userVerify) {
|
||||
@@ -89,14 +92,25 @@ public class UserVerifyController extends BaseController {
|
||||
if (loginUser == null) {
|
||||
return fail("请先登录");
|
||||
}
|
||||
|
||||
final User byUserId = userService.getByUserId(userVerify.getUserId().toString());
|
||||
if (ObjUtil.isEmpty(byUserId)) {
|
||||
return fail("用户不存在");
|
||||
}
|
||||
// 不通过
|
||||
byUserId.setCertification(false);
|
||||
// 通过认证
|
||||
if (userVerify.getStatus().equals(1)) {
|
||||
loginUser.setRealName(userVerify.getRealName());
|
||||
byUserId.setRealName(userVerify.getRealName());
|
||||
byUserId.setCertification(true);
|
||||
byUserId.setType(userVerify.getType());
|
||||
// 企业认证
|
||||
if (userVerify.getType().equals(1)) {
|
||||
loginUser.setRealName(userVerify.getName());
|
||||
loginUser.setCertification(1);
|
||||
byUserId.setRealName(userVerify.getName());
|
||||
}
|
||||
userService.updateById(loginUser);
|
||||
}
|
||||
userService.updateById(byUserId);
|
||||
|
||||
if (userVerifyService.updateById(userVerify)) {
|
||||
return success("提交成功");
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class User implements UserDetails {
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty("是否已实名认证")
|
||||
private Integer certification;
|
||||
private Boolean certification;
|
||||
|
||||
@ApiModelProperty("机构名称")
|
||||
@TableField(exist = false)
|
||||
|
||||
Reference in New Issue
Block a user