feat:
1. 增加用户实名
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
-- 新增 user_hierarchy
|
||||||
drop table if exists user_hierarchy;
|
drop table if exists user_hierarchy;
|
||||||
CREATE TABLE user_hierarchy
|
CREATE TABLE user_hierarchy
|
||||||
(
|
(
|
||||||
@@ -32,3 +33,15 @@ COMMENT ON COLUMN user_hierarchy.update_user IS '修改人';
|
|||||||
COMMENT ON COLUMN user_hierarchy.update_time IS '修改时间';
|
COMMENT ON COLUMN user_hierarchy.update_time IS '修改时间';
|
||||||
COMMENT ON COLUMN user_hierarchy.status IS '状态';
|
COMMENT ON COLUMN user_hierarchy.status IS '状态';
|
||||||
COMMENT ON COLUMN user_hierarchy.is_deleted IS '是否已删除';
|
COMMENT ON COLUMN user_hierarchy.is_deleted IS '是否已删除';
|
||||||
|
|
||||||
|
|
||||||
|
-- 修改 user_market_info
|
||||||
|
alter table public.user_market_info add verified_mobile varchar(50);
|
||||||
|
comment on column public.user_market_info.verified_mobile is '实名手机号码';
|
||||||
|
alter table public.user_market_info add gender varchar(10);
|
||||||
|
comment on column public.user_market_info.gender is '性别';
|
||||||
|
alter table public.user_market_info add birthday varchar(10);
|
||||||
|
comment on column public.user_market_info.birthday is '生日';
|
||||||
|
alter table public.user_market_info add address varchar(255);
|
||||||
|
comment on column public.user_market_info.address is '地址';
|
||||||
|
|
||||||
|
|||||||
23
src/main/java/org/springblade/common/cache/MarketInfoCache.java
vendored
Normal file
23
src/main/java/org/springblade/common/cache/MarketInfoCache.java
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package org.springblade.common.cache;
|
||||||
|
|
||||||
|
import org.springblade.core.cache.utils.CacheUtil;
|
||||||
|
import org.springblade.core.tool.utils.SpringUtil;
|
||||||
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
|
|
||||||
|
import static org.springblade.common.constant.MarketInfoConstant.MARKET_INFO_CONFIG_CACHE;
|
||||||
|
|
||||||
|
public class MarketInfoCache {
|
||||||
|
|
||||||
|
public final static String REAL_NAME = "realName:";
|
||||||
|
|
||||||
|
private static final IMarketInfoService marketInfoService;
|
||||||
|
|
||||||
|
static {
|
||||||
|
marketInfoService = SpringUtil.getBean(IMarketInfoService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasVerifyRealName(Long userId) {
|
||||||
|
return Boolean.TRUE.equals(CacheUtil.get(MARKET_INFO_CONFIG_CACHE, REAL_NAME, userId, () -> marketInfoService.hasVerifyRealName(userId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.springblade.common.constant;
|
||||||
|
|
||||||
|
public interface MarketInfoConstant {
|
||||||
|
String MARKET_INFO_CONFIG_CACHE = "market:info:";
|
||||||
|
}
|
||||||
@@ -25,6 +25,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.common.utils;
|
package org.springblade.common.utils;
|
||||||
|
|
||||||
|
import org.springblade.core.tool.utils.RegexUtil;
|
||||||
|
import org.springblade.core.tool.utils.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用工具类
|
* 通用工具类
|
||||||
*
|
*
|
||||||
@@ -32,4 +35,34 @@ package org.springblade.common.utils;
|
|||||||
*/
|
*/
|
||||||
public class CommonUtil {
|
public class CommonUtil {
|
||||||
|
|
||||||
|
private static final String CHINESE_NAME_REGEX = "^[\\u4e00-\\u9fa5]+(?:[·\\u00B7\\u2027][\\u4e00-\\u9fa5]+)*$";
|
||||||
|
|
||||||
|
public static boolean isValidChineseName(String name) {
|
||||||
|
if (StringUtil.isBlank(name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String trimmed = name.trim();
|
||||||
|
// 长度限制:2-20个字符(覆盖绝大多数姓名)
|
||||||
|
if (trimmed.length() < 2 || trimmed.length() > 20) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return RegexUtil.match(CHINESE_NAME_REGEX, trimmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isValidIdCard(String idCard) {
|
||||||
|
if (StringUtil.isBlank(idCard)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String trimmed = idCard.trim();
|
||||||
|
return RegexUtil.match(RegexUtil.ID_CARD, trimmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isValidMobile(String mobile) {
|
||||||
|
if (StringUtil.isBlank(mobile)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String trimmed = mobile.trim();
|
||||||
|
return RegexUtil.match(RegexUtil.PHONE, trimmed);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package org.springblade.modules.api.client;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springblade.core.http.util.HttpUtil;
|
||||||
|
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||||
|
import org.springblade.core.tool.utils.StringUtil;
|
||||||
|
import org.springblade.modules.api.response.RemoteVerifyResponse;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class RemoteVerifyClient {
|
||||||
|
|
||||||
|
private static final String URL = "https://mobile3elements.shumaidata.com/mobile/verify_real_name";
|
||||||
|
|
||||||
|
private static final String APP_CODE = "650c376cec984b06a1289d30531c05a6";
|
||||||
|
|
||||||
|
public static RemoteVerifyResponse verifyRealName(String realName, String idCard, String mobile) {
|
||||||
|
try {
|
||||||
|
if (StringUtil.isAnyBlank(realName, idCard, mobile)) {
|
||||||
|
return buildErrorResponse("请求参数缺失");
|
||||||
|
}
|
||||||
|
Map<String, Object> body = new HashMap<>();
|
||||||
|
body.put("name", realName);
|
||||||
|
body.put("mobile", mobile);
|
||||||
|
body.put("idcard", idCard);
|
||||||
|
String strJson = HttpUtil.post(URL, getHeaders(), body);
|
||||||
|
if (StringUtil.isBlank(strJson)) {
|
||||||
|
return buildErrorResponse("远程服务返回空响应");
|
||||||
|
}
|
||||||
|
RemoteVerifyResponse response = JSON.parseObject(strJson, RemoteVerifyResponse.class);
|
||||||
|
if (response == null) {
|
||||||
|
return buildErrorResponse("远程服务返回无效数据格式");
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("实名认证调用异常 [name={}, mobile={}, idCard={}]", SensitiveUtil.process(realName), SensitiveUtil.process(mobile), SensitiveUtil.process(idCard), e);
|
||||||
|
return buildErrorResponse("服务调用失败,请稍后重试");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RemoteVerifyResponse buildErrorResponse(String msg) {
|
||||||
|
RemoteVerifyResponse resp = new RemoteVerifyResponse();
|
||||||
|
resp.setCode("CLIENT_ERROR"); // 与业务 SUCCESS code 区分
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, String> getHeaders() {
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "APPCODE " + APP_CODE);
|
||||||
|
headers.put("Content-Type", "application/json; charset=utf-8");
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,21 +3,24 @@ package org.springblade.modules.api.market;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springblade.common.cache.MarketInfoCache;
|
||||||
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Condition;
|
||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.core.secure.annotation.PreAuth;
|
import org.springblade.core.secure.annotation.PreAuth;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
import org.springblade.modules.api.request.AcquireBenefitPackageRequest;
|
import org.springblade.modules.api.request.AcquireBenefitPackageRequest;
|
||||||
|
import org.springblade.modules.api.request.VerifyRealNameRequest;
|
||||||
import org.springblade.modules.api.vo.*;
|
import org.springblade.modules.api.vo.*;
|
||||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||||
import org.springblade.modules.market.manager.MarketUserManager;
|
import org.springblade.modules.market.manager.MarketUserManager;
|
||||||
import org.springblade.modules.market.manager.MarketUserPointManager;
|
import org.springblade.modules.market.manager.MarketUserPointManager;
|
||||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||||
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -37,12 +40,14 @@ public class MarketUserController {
|
|||||||
|
|
||||||
private final MarketUserPointManager marketUserPointManager;
|
private final MarketUserPointManager marketUserPointManager;
|
||||||
|
|
||||||
|
private final IMarketInfoService marketInfoService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/package-list")
|
@GetMapping("/package-list")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
|
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
|
||||||
public R<IPage<MarketBenefitPackageVO>> findUserPackList(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
|
public R<IPage<MarketBenefitPackageVO>> findUserPackList(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
|
||||||
IPage<MarketBenefitPackageVO> pages = userMarketBenefitPackageService.findUserPackList(Condition.getPage(query),userMarketBenefitPackage , AuthUtil.getUserId());
|
IPage<MarketBenefitPackageVO> pages = userMarketBenefitPackageService.findUserPackList(Condition.getPage(query), userMarketBenefitPackage, AuthUtil.getUserId());
|
||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +78,7 @@ public class MarketUserController {
|
|||||||
|
|
||||||
@GetMapping("/user-notice")
|
@GetMapping("/user-notice")
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 5)
|
||||||
@Operation(summary = "Market用户消息列表", description = "传入userNoticeVO")
|
@Operation(summary = "Market用户消息列表", description = "传入userNoticeVO")
|
||||||
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
||||||
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectMarketUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectMarketUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
@@ -82,7 +87,7 @@ public class MarketUserController {
|
|||||||
|
|
||||||
@GetMapping("/notice-detail")
|
@GetMapping("/notice-detail")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "用户消息详情", description = "传入request")
|
@Operation(summary = "用户消息详情", description = "传入request")
|
||||||
public R<CommonUserNoticeDetailApiVO> noticeDetail(Long id) {
|
public R<CommonUserNoticeDetailApiVO> noticeDetail(Long id) {
|
||||||
return R.data(userNoticeService.userNoticeDetail(id));
|
return R.data(userNoticeService.userNoticeDetail(id));
|
||||||
}
|
}
|
||||||
@@ -96,7 +101,6 @@ public class MarketUserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/benefit-package")
|
@GetMapping("/benefit-package")
|
||||||
@ApiOperationSupport(order = 8)
|
@ApiOperationSupport(order = 8)
|
||||||
@Operation(summary = "福利包列表")
|
@Operation(summary = "福利包列表")
|
||||||
@@ -106,7 +110,7 @@ public class MarketUserController {
|
|||||||
|
|
||||||
@PostMapping("/acquire-benefit-package")
|
@PostMapping("/acquire-benefit-package")
|
||||||
@ApiOperationSupport(order = 9)
|
@ApiOperationSupport(order = 9)
|
||||||
@Operation(summary = "兑换福利包", description = "传入acquireBenefitPackageRequest")
|
@Operation(summary = "兑换福利包", description = "传入acquireBenefitPackageRequest")
|
||||||
public R<Boolean> acquireBenefitPackage(@RequestBody AcquireBenefitPackageRequest request) {
|
public R<Boolean> acquireBenefitPackage(@RequestBody AcquireBenefitPackageRequest request) {
|
||||||
return R.status(marketUserManager.acquireBenefitPackage(request));
|
return R.status(marketUserManager.acquireBenefitPackage(request));
|
||||||
}
|
}
|
||||||
@@ -122,22 +126,22 @@ public class MarketUserController {
|
|||||||
@GetMapping("/benefit-point-log")
|
@GetMapping("/benefit-point-log")
|
||||||
@ApiOperationSupport(order = 11)
|
@ApiOperationSupport(order = 11)
|
||||||
@Operation(summary = "福利积分流水")
|
@Operation(summary = "福利积分流水")
|
||||||
public R<IPage<MarketUserBenefitPointLogVO>> benefitPointLogList(Query query , MarketUserBenefitPointLogVO benefitPointLogVO) {
|
public R<IPage<MarketUserBenefitPointLogVO>> benefitPointLogList(Query query, MarketUserBenefitPointLogVO benefitPointLogVO) {
|
||||||
return R.data(marketUserPointManager.benefitPointLogList(Condition.getPage(query) , benefitPointLogVO));
|
return R.data(marketUserPointManager.benefitPointLogList(Condition.getPage(query), benefitPointLogVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/cash-coupon-log")
|
@GetMapping("/cash-coupon-log")
|
||||||
@ApiOperationSupport(order = 12)
|
@ApiOperationSupport(order = 12)
|
||||||
@Operation(summary = "现金券流水")
|
@Operation(summary = "现金券流水")
|
||||||
public R<IPage<MarketUserCashCouponLogVO>> cashCouponLogList(Query query , MarketUserCashCouponLogVO cashCouponLogVO) {
|
public R<IPage<MarketUserCashCouponLogVO>> cashCouponLogList(Query query, MarketUserCashCouponLogVO cashCouponLogVO) {
|
||||||
return R.data(marketUserPointManager.cashCouponLogList(Condition.getPage(query) , cashCouponLogVO));
|
return R.data(marketUserPointManager.cashCouponLogList(Condition.getPage(query), cashCouponLogVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/user-commission-log")
|
@GetMapping("/user-commission-log")
|
||||||
@ApiOperationSupport(order = 13)
|
@ApiOperationSupport(order = 13)
|
||||||
@Operation(summary = "用户佣金流水")
|
@Operation(summary = "用户佣金流水")
|
||||||
public R<IPage<MarketUserCommissionLogVO>> userCommissionLogList(Query query , MarketUserCommissionLogVO userCommissionLogVO) {
|
public R<IPage<MarketUserCommissionLogVO>> userCommissionLogList(Query query, MarketUserCommissionLogVO userCommissionLogVO) {
|
||||||
return R.data(marketUserPointManager.userCommissionLogList(Condition.getPage(query) , userCommissionLogVO));
|
return R.data(marketUserPointManager.userCommissionLogList(Condition.getPage(query), userCommissionLogVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/self-kpi")
|
@GetMapping("/self-kpi")
|
||||||
@@ -147,4 +151,18 @@ public class MarketUserController {
|
|||||||
return R.data(new MarketKPIApiVO());
|
return R.data(new MarketKPIApiVO());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/real-name-verification")
|
||||||
|
@ApiOperationSupport(order = 15)
|
||||||
|
@Operation(summary = "提交实名认证")
|
||||||
|
public R verifyRealName(@RequestBody @Valid VerifyRealNameRequest request) {
|
||||||
|
return R.status(marketInfoService.verifyRealName(request.getName(), request.getMobile(), request.getIdCard()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/real-name-verification")
|
||||||
|
@ApiOperationSupport(order = 16)
|
||||||
|
@Operation(summary = "是否已实名")
|
||||||
|
public R hasVerifyRealName() {
|
||||||
|
return R.status(MarketInfoCache.hasVerifyRealName(AuthUtil.getUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package org.springblade.modules.api.request;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VerifyRealNameRequest implements Serializable {
|
||||||
|
|
||||||
|
@NotEmpty(message = "无效参数")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@NotEmpty(message = "无效参数")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@NotEmpty(message = "无效参数")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package org.springblade.modules.api.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RemoteVerifyResponse implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private VerifyInfo result;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class VerifyInfo implements Serializable {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
private String idcard;
|
||||||
|
|
||||||
|
private String res;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.springblade.modules.common.eums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum RemoteVerifyCodeStatus {
|
||||||
|
|
||||||
|
SUCCESS("0");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
RemoteVerifyCodeStatus(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.springblade.modules.common.eums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum RemoteVerifyResponseStatus {
|
||||||
|
//1:一致 2:不一致 3:无记录 -1:异常
|
||||||
|
CONSISTENT("1"),
|
||||||
|
INCONSISTENT("2"),
|
||||||
|
NO_RECORD("3"),
|
||||||
|
EXCEPTION("-1");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
RemoteVerifyResponseStatus(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -93,5 +93,26 @@ public class MarketInfoEntity extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "实名身份证")
|
@Schema(description = "实名身份证")
|
||||||
private String idCard;
|
private String idCard;
|
||||||
|
/**
|
||||||
|
* 实名手机
|
||||||
|
*/
|
||||||
|
@Schema(description = "实名手机")
|
||||||
|
private String verifiedMobile;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
@Schema(description = "性别")
|
||||||
|
private String gender;
|
||||||
|
/**
|
||||||
|
* 生日
|
||||||
|
*/
|
||||||
|
@Schema(description = "生日")
|
||||||
|
private String birthday;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
@Schema(description = "地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,4 +54,9 @@ public interface IMarketInfoService extends BaseService<MarketInfoEntity> {
|
|||||||
boolean resetPassword(String userIds);
|
boolean resetPassword(String userIds);
|
||||||
|
|
||||||
List<Long> selectAncestorIds(Long userId);
|
List<Long> selectAncestorIds(Long userId);
|
||||||
|
|
||||||
|
boolean verifyRealName(String name, String mobile, String idCard);
|
||||||
|
|
||||||
|
boolean hasVerifyRealName(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,18 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.common.cache.ParamCache;
|
import org.springblade.common.cache.ParamCache;
|
||||||
import org.springblade.common.constant.CommonConstant;
|
import org.springblade.common.constant.CommonConstant;
|
||||||
|
import org.springblade.common.utils.CommonUtil;
|
||||||
|
import org.springblade.core.cache.utils.CacheUtil;
|
||||||
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.core.tool.utils.DateUtil;
|
import org.springblade.core.tool.utils.DateUtil;
|
||||||
import org.springblade.core.tool.utils.DigestUtil;
|
import org.springblade.core.tool.utils.DigestUtil;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
|
import org.springblade.modules.api.client.RemoteVerifyClient;
|
||||||
|
import org.springblade.modules.api.response.RemoteVerifyResponse;
|
||||||
import org.springblade.modules.auth.provider.UserType;
|
import org.springblade.modules.auth.provider.UserType;
|
||||||
|
import org.springblade.modules.common.eums.RemoteVerifyCodeStatus;
|
||||||
|
import org.springblade.modules.common.eums.RemoteVerifyResponseStatus;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
||||||
import org.springblade.modules.common.service.ICommonUserPointService;
|
import org.springblade.modules.common.service.ICommonUserPointService;
|
||||||
import org.springblade.modules.market.pojo.entity.*;
|
import org.springblade.modules.market.pojo.entity.*;
|
||||||
@@ -49,9 +56,12 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.springblade.common.cache.MarketInfoCache.REAL_NAME;
|
||||||
import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD;
|
import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD;
|
||||||
|
import static org.springblade.common.constant.MarketInfoConstant.MARKET_INFO_CONFIG_CACHE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户拓展信息表 服务实现类
|
* 用户拓展信息表 服务实现类
|
||||||
@@ -79,7 +89,6 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
|||||||
private final IMarketCashPerformanceService cashPerformanceService;
|
private final IMarketCashPerformanceService cashPerformanceService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<MarketInfoVO> selectMarketInfoPage(IPage<MarketInfoVO> page, MarketInfoVO marketInfo) {
|
public IPage<MarketInfoVO> selectMarketInfoPage(IPage<MarketInfoVO> page, MarketInfoVO marketInfo) {
|
||||||
return page.setRecords(baseMapper.selectMarketInfoPage(page, marketInfo));
|
return page.setRecords(baseMapper.selectMarketInfoPage(page, marketInfo));
|
||||||
@@ -124,4 +133,46 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
|||||||
return this.baseMapper.selectAncestorIds(userId);
|
return this.baseMapper.selectAncestorIds(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean verifyRealName(String name, String mobile, String idCard) {
|
||||||
|
MarketInfoEntity marketInfo = getById(AuthUtil.getUserId());
|
||||||
|
if (marketInfo == null) {
|
||||||
|
throw new ServiceException("无效参数");
|
||||||
|
}
|
||||||
|
if (marketInfo.getVerified() == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!CommonUtil.isValidChineseName(name) || !CommonUtil.isValidIdCard(idCard) || !CommonUtil.isValidMobile(mobile)) {
|
||||||
|
throw new ServiceException("无效姓名、身份证号、手机号");
|
||||||
|
}
|
||||||
|
RemoteVerifyResponse response = RemoteVerifyClient.verifyRealName(name, idCard, mobile);
|
||||||
|
if (RemoteVerifyCodeStatus.SUCCESS.getCode().equals(response.getCode())) {
|
||||||
|
RemoteVerifyResponse.VerifyInfo result = response.getResult();
|
||||||
|
if (!Objects.isNull(result) && result.getRes().equals(RemoteVerifyResponseStatus.CONSISTENT.getCode())) {
|
||||||
|
marketInfo.setRealName(name);
|
||||||
|
marketInfo.setIdCard(idCard);
|
||||||
|
marketInfo.setVerifiedMobile(mobile);
|
||||||
|
marketInfo.setGender(result.getSex());
|
||||||
|
marketInfo.setBirthday(result.getBirthday());
|
||||||
|
marketInfo.setAddress(result.getAddress());
|
||||||
|
marketInfo.setVerifiedDate(DateUtil.now());
|
||||||
|
marketInfo.setVerified(1);
|
||||||
|
if (updateById(marketInfo)) {
|
||||||
|
CacheUtil.evict(MARKET_INFO_CONFIG_CACHE, REAL_NAME, marketInfo.getId());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasVerifyRealName(Long userId) {
|
||||||
|
if (Objects.isNull(userId)) {
|
||||||
|
throw new ServiceException("无效参数");
|
||||||
|
}
|
||||||
|
MarketInfoEntity marketInfo = getById(userId);
|
||||||
|
return !Objects.isNull(marketInfo) && marketInfo.getVerified() == 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user