init
This commit is contained in:
@@ -0,0 +1,93 @@
|
|||||||
|
package com.ruoyi.xq.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.xq.domain.CardAuthRecord;
|
||||||
|
import com.ruoyi.xq.service.CardAuthRecordService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证管理
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-29
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/xq/cardAuthRecord")
|
||||||
|
public class CardAuthRecordController extends BaseController {
|
||||||
|
|
||||||
|
private final CardAuthRecordService cardAuthRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询实名认证管理列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:cardAuthRecord:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<CardAuthRecord> list(CardAuthRecord bo, PageQuery pageQuery) {
|
||||||
|
Page<CardAuthRecord> page = cardAuthRecordService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||||
|
return TableDataInfo.build(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取实名认证管理详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:cardAuthRecord:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<CardAuthRecord> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(cardAuthRecordService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增实名认证管理
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:cardAuthRecord:add")
|
||||||
|
@Log(title = "实名认证管理", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@RequestBody CardAuthRecord bo) {
|
||||||
|
return toAjax(cardAuthRecordService.save(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改实名认证管理
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:cardAuthRecord:edit")
|
||||||
|
@Log(title = "实名认证管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@RequestBody CardAuthRecord bo) {
|
||||||
|
return toAjax(cardAuthRecordService.updateById(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除实名认证管理
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:cardAuthRecord:remove")
|
||||||
|
@Log(title = "实名认证管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(cardAuthRecordService.removeBatchByIds(Arrays.asList(ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.ruoyi.xq.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证管理对象 xq_card_auth_record
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("xq_card_auth_record")
|
||||||
|
public class CardAuthRecord implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户号
|
||||||
|
*/
|
||||||
|
private String usercode;
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String bizToken;
|
||||||
|
/**
|
||||||
|
* 身份证号码
|
||||||
|
*/
|
||||||
|
private String idCard;
|
||||||
|
/**
|
||||||
|
* 姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 民族
|
||||||
|
*/
|
||||||
|
private String nation;
|
||||||
|
/**
|
||||||
|
* 认证视频
|
||||||
|
*/
|
||||||
|
private String livenessVideo;
|
||||||
|
/**
|
||||||
|
* 身份证正面
|
||||||
|
*/
|
||||||
|
private String cardFront;
|
||||||
|
/**
|
||||||
|
* 身份证背面
|
||||||
|
*/
|
||||||
|
private String cardBack;
|
||||||
|
/**
|
||||||
|
* 状态 0-未处理 1-成功 2-失败 3-失效
|
||||||
|
*/
|
||||||
|
private Integer tokenStatus;
|
||||||
|
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.xq.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.xq.domain.CardAuthRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证管理Mapper接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-29
|
||||||
|
*/
|
||||||
|
public interface CardAuthRecordMapper extends BaseMapper<CardAuthRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ruoyi.xq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.xq.domain.CardAuthRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证管理Service接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-29
|
||||||
|
*/
|
||||||
|
public interface CardAuthRecordService extends IService<CardAuthRecord> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.xq.domain.CardAuthRecord;
|
||||||
|
import com.ruoyi.xq.mapper.CardAuthRecordMapper;
|
||||||
|
import com.ruoyi.xq.service.CardAuthRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证管理Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-29
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CardAuthRecordServiceImpl extends ServiceImpl<CardAuthRecordMapper,CardAuthRecord> implements CardAuthRecordService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,10 @@ import java.util.Objects;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class TencentAuthClient {
|
public class TencentAuthClient {
|
||||||
|
|
||||||
|
private final static String SECRET_ID = "AKIDviL2b1KWHGNdR6gLwLbfaHpBSVQ8i8Pe";
|
||||||
|
private final static String SECRET_KEY = "DapskQxS7gBXlsqgP0a0KXXK8oy45INf";
|
||||||
|
|
||||||
|
|
||||||
public static boolean faceDetectIsPass(String bizToken) {
|
public static boolean faceDetectIsPass(String bizToken) {
|
||||||
GetDetectInfoEnhancedResponse resp = getDetectInfo(bizToken);
|
GetDetectInfoEnhancedResponse resp = getDetectInfo(bizToken);
|
||||||
if (!Objects.isNull(resp)) {
|
if (!Objects.isNull(resp)) {
|
||||||
@@ -37,7 +41,7 @@ public class TencentAuthClient {
|
|||||||
public static GetDetectInfoEnhancedResponse getDetectInfo(String bizToken) {
|
public static GetDetectInfoEnhancedResponse getDetectInfo(String bizToken) {
|
||||||
GetDetectInfoEnhancedResponse resp = null;
|
GetDetectInfoEnhancedResponse resp = null;
|
||||||
try {
|
try {
|
||||||
Credential cred = new Credential("AKIDviL2b1KWHGNdR6gLwLbfaHpBSVQ8i8Pe", "DapskQxS7gBXlsqgP0a0KXXK8oy45INf");
|
Credential cred = new Credential(SECRET_ID, SECRET_KEY);
|
||||||
HttpProfile httpProfile = new HttpProfile();
|
HttpProfile httpProfile = new HttpProfile();
|
||||||
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
||||||
httpProfile.setConnTimeout(10); // 请求连接超时时间,单位为秒(默认60秒)
|
httpProfile.setConnTimeout(10); // 请求连接超时时间,单位为秒(默认60秒)
|
||||||
@@ -62,10 +66,13 @@ public class TencentAuthClient {
|
|||||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||||
Credential cred = new Credential("AKIDviL2b1KWHGNdR6gLwLbfaHpBSVQ8i8Pe", "DapskQxS7gBXlsqgP0a0KXXK8oy45INf");
|
Credential cred = new Credential(SECRET_ID, SECRET_KEY);
|
||||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||||
HttpProfile httpProfile = new HttpProfile();
|
HttpProfile httpProfile = new HttpProfile();
|
||||||
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
||||||
|
httpProfile.setConnTimeout(10); // 请求连接超时时间,单位为秒(默认60秒)
|
||||||
|
httpProfile.setWriteTimeout(10); // 设置写入超时时间,单位为秒(默认0秒)
|
||||||
|
httpProfile.setReadTimeout(10);
|
||||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||||
ClientProfile clientProfile = new ClientProfile();
|
ClientProfile clientProfile = new ClientProfile();
|
||||||
clientProfile.setHttpProfile(httpProfile);
|
clientProfile.setHttpProfile(httpProfile);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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.ruoyi.xq.mapper.CardAuthRecordMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.xq.domain.CardAuthRecord" id="CardAuthRecordResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="usercode" column="usercode"/>
|
||||||
|
<result property="bizToken" column="biz_token"/>
|
||||||
|
<result property="idCard" column="id_card"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="nation" column="nation"/>
|
||||||
|
<result property="livenessVideo" column="liveness_video"/>
|
||||||
|
<result property="cardFront" column="card_front"/>
|
||||||
|
<result property="cardBack" column="card_back"/>
|
||||||
|
<result property="tokenStatus" column="token_status"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user