1.增加账号实名认证接口
2.去除自动提现
This commit is contained in:
@@ -4,6 +4,7 @@ package com.sqx.modules.app.controller.app;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.ApiAccessLimitUtil;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.dao.AuthCertNoDTO;
|
||||
@@ -170,6 +171,9 @@ public class AppLoginController {
|
||||
@Debounce(value = "#authCertNoDTO.idNum")
|
||||
@PostMapping("/authCertNo")
|
||||
public Result authCertNo(@RequestBody @Validated AuthCertNoDTO authCertNoDTO, @RequestAttribute("userId") long userId) {
|
||||
if (!ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) {
|
||||
return Result.error("每月可修改次数已用完,请联系管理员");
|
||||
}
|
||||
return Result.success().put("data", userService.authCertNo(userId, authCertNoDTO));
|
||||
}
|
||||
|
||||
|
||||
@@ -199,8 +199,4 @@ public class UserEntity implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private Integer vipType;
|
||||
|
||||
private String certName;
|
||||
private String certNo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
93
src/main/java/com/sqx/modules/app/entity/UserInfo.java
Normal file
93
src/main/java/com/sqx/modules/app/entity/UserInfo.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName user_info
|
||||
*/
|
||||
@TableName(value ="user_info")
|
||||
@Data
|
||||
public class UserInfo implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String certName;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String certNo;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
UserInfo other = (UserInfo) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
|
||||
&& (this.getCertName() == null ? other.getCertName() == null : this.getCertName().equals(other.getCertName()))
|
||||
&& (this.getCertNo() == null ? other.getCertNo() == null : this.getCertNo().equals(other.getCertNo()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
|
||||
result = prime * result + ((getCertName() == null) ? 0 : getCertName().hashCode());
|
||||
result = prime * result + ((getCertNo() == null) ? 0 : getCertNo().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", userId=").append(userId);
|
||||
sb.append(", certName=").append(certName);
|
||||
sb.append(", certNo=").append(certNo);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
20
src/main/java/com/sqx/modules/app/mapper/UserInfoMapper.java
Normal file
20
src/main/java/com/sqx/modules/app/mapper/UserInfoMapper.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.sqx.modules.app.mapper;
|
||||
|
||||
import com.sqx.modules.app.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【user_info】的数据库操作Mapper
|
||||
* @createDate 2025-01-02 14:15:08
|
||||
* @Entity com.sqx.modules.app.entity.UserInfo
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserInfoMapper extends BaseMapper<UserInfo> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
import com.sqx.modules.app.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【user_info】的数据库操作Service
|
||||
* @createDate 2025-01-02 14:15:08
|
||||
*/
|
||||
public interface UserInfoService extends IService<UserInfo> {
|
||||
|
||||
UserInfo getByUserId(long userId);
|
||||
|
||||
Integer countCertCount(String name, String idNum);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.UserInfo;
|
||||
import com.sqx.modules.app.service.UserInfoService;
|
||||
import com.sqx.modules.app.mapper.UserInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【user_info】的数据库操作Service实现
|
||||
* @createDate 2025-01-02 14:15:08
|
||||
*/
|
||||
@Service
|
||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
implements UserInfoService{
|
||||
|
||||
@Override
|
||||
public UserInfo getByUserId(long userId) {
|
||||
UserInfo userInfo = getOne(new LambdaQueryWrapper<UserInfo>()
|
||||
.eq(UserInfo::getUserId, userId));
|
||||
if (userInfo == null) {
|
||||
userInfo = new UserInfo();
|
||||
userInfo.setUserId(userId);
|
||||
save(userInfo);
|
||||
}
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countCertCount(String name, String idNum) {
|
||||
return count(new LambdaQueryWrapper<UserInfo>()
|
||||
.eq(UserInfo::getCertName, name)
|
||||
.eq(UserInfo::getCertNo, idNum));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -121,14 +121,16 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
private final AliService aliService;
|
||||
private final UserInfoService userInfoService;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String profiles;
|
||||
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
||||
|
||||
public UserServiceImpl(@Lazy AliService aliService) {
|
||||
public UserServiceImpl(@Lazy AliService aliService, UserInfoService userInfoService) {
|
||||
this.aliService = aliService;
|
||||
this.userInfoService = userInfoService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1557,21 +1559,21 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
throw new SqxException("用户信息不存在");
|
||||
}
|
||||
|
||||
if (userEntity.getCertName() != null) {
|
||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||
if (userInfo.getCertName() != null) {
|
||||
throw new SqxException("此账号已认证");
|
||||
}
|
||||
|
||||
Integer count = baseMapper.selectCount(new LambdaQueryWrapper<UserEntity>()
|
||||
.eq(UserEntity::getCertName, authCertNoDTO.getName())
|
||||
.eq(UserEntity::getCertNo, authCertNoDTO.getIdNum()));
|
||||
Integer count = userInfoService.countCertCount(authCertNoDTO.getName(), authCertNoDTO.getIdNum());
|
||||
if (count > 1) {
|
||||
throw new SqxException("此实名信息已存在");
|
||||
}
|
||||
|
||||
aliService.authCertNo(authCertNoDTO.getName(), authCertNoDTO.getIdNum());
|
||||
|
||||
userEntity.setCertName(authCertNoDTO.getName());
|
||||
userEntity.setCertNo(authCertNoDTO.getIdNum());
|
||||
return updateById(userEntity);
|
||||
userInfo.setCertName(authCertNoDTO.getName());
|
||||
userInfo.setCertNo(authCertNoDTO.getIdNum());
|
||||
userInfo.setUpdateTime(DateUtil.date());
|
||||
return userInfoService.updateById(userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,8 @@ import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.dao.MsgDao;
|
||||
import com.sqx.modules.app.dao.UserDao;
|
||||
import com.sqx.modules.app.entity.Msg;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.entity.*;
|
||||
import com.sqx.modules.app.service.UserInfoService;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
@@ -93,6 +91,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
private InviteMoneyService inviteMoneyService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
private final UserInfoService userInfoService;
|
||||
@Autowired
|
||||
private MsgDao msgDao;
|
||||
|
||||
@@ -102,6 +101,10 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
@Autowired
|
||||
private WuyouPay wuyouPay;
|
||||
|
||||
public CashOutServiceImpl(UserInfoService userInfoService) {
|
||||
this.userInfoService = userInfoService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils selectCashOutList(Integer page, Integer limit, CashOut cashOut) {
|
||||
return new PageUtils(baseMapper.selectCashOutPage(new Page<>(page, limit), cashOut));
|
||||
@@ -454,11 +457,13 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
if (StringUtils.isBlank(userInfo.getZhiFuBao()) || StringUtils.isBlank(userInfo.getZhiFuBaoName())) {
|
||||
return Result.error(9999, "请先绑定支付宝账号!");
|
||||
}
|
||||
if (StrUtil.isBlank(userInfo.getCertName())) {
|
||||
|
||||
UserInfo userDetailInfo = userInfoService.getByUserId(userId);
|
||||
if (StrUtil.isBlank(userDetailInfo.getCertName())) {
|
||||
return Result.error(9999, "请先实名认证!");
|
||||
}
|
||||
|
||||
if (!userInfo.getZhiFuBaoName().equals(userInfo.getCertName())) {
|
||||
if (!userInfo.getZhiFuBaoName().equals(userDetailInfo.getCertName())) {
|
||||
return Result.error(9999, "支付宝和实名姓名不太无法提现!");
|
||||
}
|
||||
alipayAccount = userInfo.getZhiFuBao();
|
||||
|
||||
19
src/main/resources/mapper/UserInfoMapper.xml
Normal file
19
src/main/resources/mapper/UserInfoMapper.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sqx.modules.app.mapper.UserInfoMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.sqx.modules.app.entity.UserInfo">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="certName" column="cert_name" jdbcType="VARCHAR"/>
|
||||
<result property="certNo" column="cert_no" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,cert_name,
|
||||
cert_no,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user