feat: user portal support kyc certification
This commit is contained in:
@@ -699,6 +699,7 @@ CREATE TABLE `u_user` (
|
|||||||
`age` int(11) NULL DEFAULT NULL COMMENT '年龄',
|
`age` int(11) NULL DEFAULT NULL COMMENT '年龄',
|
||||||
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
|
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
|
||||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '帐号状态(0正常 1停用)',
|
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '帐号状态(0正常 1停用)',
|
||||||
|
`kyc_status` enum('VERIFIED','UNVERIFIED') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'UNVERIFIED',
|
||||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||||
`login_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '最后登录IP',
|
`login_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '最后登录IP',
|
||||||
`login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间',
|
`login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间',
|
||||||
@@ -713,9 +714,9 @@ CREATE TABLE `u_user` (
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of u_user
|
-- Records of u_user
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `u_user` VALUES (1, 100, 'super', '超级用户', '超级用户', '00', 'super@mail.com', '123456', '1', '', '$2a$10$XF99QEWn2MjEE3pbFVvHuOyMi/YVIrQbdenEleJN5dYxAfgXFaaqG', 1, '', '0', '0', '192.168.88.14', '2024-12-06 10:36:35', 'system', '2024-05-08 21:50:54', '', '2024-12-06 10:36:35', 'super');
|
INSERT INTO `u_user` VALUES (1, 100, 'super', '超级用户', '超级用户', '00', 'super@mail.com', '123456', '1', '', '$2a$10$XF99QEWn2MjEE3pbFVvHuOyMi/YVIrQbdenEleJN5dYxAfgXFaaqG', 1, '', '0', 'UNVERIFIED', '0', '192.168.88.14', '2024-12-06 10:36:35', 'system', '2024-05-08 21:50:54', '', '2024-12-06 10:36:35', 'super');
|
||||||
INSERT INTO `u_user` VALUES (2, 100, 'demo', 'demo user', 'demo user', '00', 'demo@mail.com', '123456', '1', '', '$2a$10$XF99QEWn2MjEE3pbFVvHuOyMi/YVIrQbdenEleJN5dYxAfgXFaaqG', 1, '', '0', '0', '192.168.88.14', '2024-12-06 10:36:35', 'system', '2024-12-06 10:30:54', '', '2024-12-06 10:36:35', 'demo');
|
INSERT INTO `u_user` VALUES (2, 100, 'demo', 'demo user', 'demo user', '00', 'demo@mail.com', '123456', '1', '', '$2a$10$XF99QEWn2MjEE3pbFVvHuOyMi/YVIrQbdenEleJN5dYxAfgXFaaqG', 1, '', '0', 'UNVERIFIED', '0', '192.168.88.14', '2024-12-06 10:36:35', 'system', '2024-12-06 10:30:54', '', '2024-12-06 10:36:35', 'demo');
|
||||||
INSERT INTO `u_user` VALUES (3, NULL, '123456', 'general user', 'general user', '00', '12345678@mail.com', '1234567', '1', '', '$2a$10$XF99QEWn2MjEE3pbFVvHuOyMi/YVIrQbdenEleJN5dYxAfgXFaaqG', 1, '', '0', '0', '192.168.2.94', '2024-12-16 17:36:08', 'system', '2024-05-08 21:50:54', '123456', '2024-12-16 17:36:08', '');
|
INSERT INTO `u_user` VALUES (3, NULL, '123456', 'general user', 'general user', '00', '12345678@mail.com', '1234567', '1', '', '$2a$10$XF99QEWn2MjEE3pbFVvHuOyMi/YVIrQbdenEleJN5dYxAfgXFaaqG', 1, '', '0', 'UNVERIFIED', '0', '192.168.2.94', '2024-12-16 17:36:08', 'system', '2024-05-08 21:50:54', '123456', '2024-12-16 17:36:08', '');
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for u_user_post
|
-- Table structure for u_user_post
|
||||||
@@ -826,4 +827,27 @@ CREATE TABLE `u_credit_card_token` (
|
|||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for u_kyc
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `u_kyc`;
|
||||||
|
CREATE TABLE `u_kyc` (
|
||||||
|
`kyc_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
|
`user_id` bigint(20) NULL DEFAULT NULL COMMENT 'link to user_id of u_user',
|
||||||
|
`birth_date` datetime NULL DEFAULT NULL,
|
||||||
|
`id_type` enum('DRIVERS_LICENSE','PASSPORT','RESIDENCE_PERMIT','STUDENT_ID','MEDICARE_CARD','BIRTH_CERTIFICATE') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'identify type',
|
||||||
|
`id_file` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'ID file',
|
||||||
|
`identify_picture` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'identify picture',
|
||||||
|
`status` enum('APPROVED','REJECTED','PENDING') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'PENDING' COMMENT 'kyc status: APPROVED/REJECTED/PENDING',
|
||||||
|
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
|
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||||
|
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`kyc_id`) USING BTREE,
|
||||||
|
INDEX `user_id`(`user_id`) USING BTREE,
|
||||||
|
CONSTRAINT `u_kyc_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `u_user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_用户信息表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package org.wfc.user.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
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 org.wfc.common.core.web.controller.BaseController;
|
||||||
|
import org.wfc.common.core.web.domain.AjaxResult;
|
||||||
|
import org.wfc.common.core.web.page.TableDataInfo;
|
||||||
|
import org.wfc.common.log.annotation.Log;
|
||||||
|
import org.wfc.common.log.enums.BusinessType;
|
||||||
|
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||||
|
import org.wfc.user.domain.UKyc;
|
||||||
|
import org.wfc.user.domain.vo.UKycUserVo;
|
||||||
|
import org.wfc.user.service.IUKycService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户平台-账单表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sys
|
||||||
|
* @since 2025-01-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kyc")
|
||||||
|
public class UKycController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUKycService uKycService;
|
||||||
|
|
||||||
|
@RequiresPermissions("Utem:kyc:query")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public TableDataInfo page() {
|
||||||
|
startPage();
|
||||||
|
List<UKycUserVo> list = uKycService.selectKycByUserId();
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("Utem:kyc:add")
|
||||||
|
@Log(title = "User Management", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/verify")
|
||||||
|
public AjaxResult add(@Validated @RequestBody UKyc uKyc) {
|
||||||
|
return toAjax(uKycService.insertUserKyc(uKyc));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("Utem:kyc:edit")
|
||||||
|
@Log(title = "User Management", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/verify")
|
||||||
|
public AjaxResult edit(@Validated @RequestBody UKyc uKyc) {
|
||||||
|
return toAjax(uKycService.updateUserKyc(uKyc));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.wfc.user.domain;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import org.wfc.common.mybatis.domain.BaseData;
|
||||||
|
import org.wfc.user.domain.constant.IdTypeEnum;
|
||||||
|
import org.wfc.user.domain.constant.KycRequestStatusEnum;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("u_kyc")
|
||||||
|
@Schema(name = "UKyc", description = "User portal: u_kyc table")
|
||||||
|
public class UKyc extends BaseData {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "KYC ID")
|
||||||
|
private Long kycId;
|
||||||
|
|
||||||
|
@Schema(description = "User ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "Birth Date")
|
||||||
|
private String birthDate;
|
||||||
|
|
||||||
|
@Schema(description = "Identify Type")
|
||||||
|
private Integer idType;
|
||||||
|
|
||||||
|
@Schema(description = "Identify File")
|
||||||
|
private String idFile;
|
||||||
|
|
||||||
|
@Schema(description = "Identify Picture")
|
||||||
|
private String identifyPicture;
|
||||||
|
|
||||||
|
@Schema(description = "Status")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "Description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
// @Schema(description = "Create Time")
|
||||||
|
// private LocalDateTime createTime;
|
||||||
|
|
||||||
|
// @Schema(description = "Update Time")
|
||||||
|
// private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package org.wfc.user.domain.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 证件类型枚举
|
||||||
|
* @since: 2025-01-08
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum IdTypeEnum {
|
||||||
|
|
||||||
|
DRIVERS_LICENSE(0, "driver's license"),
|
||||||
|
PASSPORT(1, "passport"),
|
||||||
|
RESIDENCE_PERMIT(2, "residence permit"),
|
||||||
|
STUDENT_ID(3, "student ID"),
|
||||||
|
MEDICARE_CARD(4, "medicare card"),
|
||||||
|
BIRTH_CERTIFICATE(5, "birth certificate");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package org.wfc.user.domain.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: KYC request status enum
|
||||||
|
* @since: 2025-01-08
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum KycRequestStatusEnum {
|
||||||
|
|
||||||
|
APPROVED(0, "approved"),
|
||||||
|
REJECTED(1, "rejected"),
|
||||||
|
PENDING(2, "pending");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String desc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package org.wfc.user.domain.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: User KYC status enum
|
||||||
|
* @since: 2025-01-08
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum UserKycStatusEnum {
|
||||||
|
|
||||||
|
VERIFIED(0, "verified"),
|
||||||
|
UNVERIFIED(1, "unverified");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String desc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package org.wfc.user.domain.vo;
|
||||||
|
|
||||||
|
import org.wfc.user.domain.constant.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UKycUserVo {
|
||||||
|
|
||||||
|
@Schema(description = "KYC ID")
|
||||||
|
private Long kycId;
|
||||||
|
|
||||||
|
@Schema(description = "User ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "Real Name")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Schema(description = "Birth Date")
|
||||||
|
private String birthDate;
|
||||||
|
|
||||||
|
@Schema(description = "ID Type")
|
||||||
|
private IdTypeEnum idType;
|
||||||
|
|
||||||
|
@Schema(description = "ID File")
|
||||||
|
private String idFile;
|
||||||
|
|
||||||
|
@Schema(description = "Identify Picture")
|
||||||
|
private String identifyPicture;
|
||||||
|
|
||||||
|
@Schema(description = "KYC Request Status")
|
||||||
|
private KycRequestStatusEnum kycRequestStatus;
|
||||||
|
|
||||||
|
@Schema(description = "User KYC Status")
|
||||||
|
private UserKycStatusEnum userKycStatus;
|
||||||
|
|
||||||
|
@Schema(description = "Create Time")
|
||||||
|
private String createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.wfc.user.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.wfc.user.domain.UKyc;
|
||||||
|
import org.wfc.user.domain.vo.UKycUserVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户平台-KYC表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sys
|
||||||
|
* @since 2025-01-08
|
||||||
|
*/
|
||||||
|
public interface UKycMapper extends BaseMapper<UKyc> {
|
||||||
|
|
||||||
|
public int isExistUserKyc(Long userId);
|
||||||
|
|
||||||
|
public int insertUserKyc(UKyc uKyc);
|
||||||
|
|
||||||
|
public int updateUserKyc(UKyc uKyc);
|
||||||
|
|
||||||
|
List<UKycUserVo> selectKycByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.wfc.user.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.wfc.user.domain.UKyc;
|
||||||
|
import org.wfc.user.domain.vo.UKycUserVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户平台-KYC表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sys
|
||||||
|
* @since 2025-01-08
|
||||||
|
*/
|
||||||
|
public interface IUKycService extends IService<UKyc> {
|
||||||
|
|
||||||
|
List<UKycUserVo> selectKycByUserId();
|
||||||
|
|
||||||
|
public int isExistUserKyc(Long userId);
|
||||||
|
|
||||||
|
public int insertUserKyc(UKyc uKyc);
|
||||||
|
|
||||||
|
public int updateUserKyc(UKyc uKyc);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package org.wfc.user.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.wfc.common.core.domain.LoginUser;
|
||||||
|
import org.wfc.common.security.utils.SecurityUtils;
|
||||||
|
import org.wfc.user.domain.UKyc;
|
||||||
|
import org.wfc.user.domain.constant.IdTypeEnum;
|
||||||
|
import org.wfc.user.domain.constant.KycRequestStatusEnum;
|
||||||
|
import org.wfc.user.domain.vo.UKycUserVo;
|
||||||
|
import org.wfc.user.mapper.UKycMapper;
|
||||||
|
import org.wfc.user.mapper.UUserMapper;
|
||||||
|
import org.wfc.user.service.IUKycService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户平台-KYC表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author sys
|
||||||
|
* @since 2025-01-08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UKycServiceImpl extends ServiceImpl<UKycMapper, UKyc> implements IUKycService {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(UKycServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UKycMapper uKycMapper;
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<UKycUserVo> selectKycByUserId(Long userId) {
|
||||||
|
// return this.baseMapper.selectKycByUserId(userId);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UKycUserVo> selectKycByUserId() {
|
||||||
|
LoginUser<Object> loginUser = SecurityUtils.getLoginUser();
|
||||||
|
return this.uKycMapper.selectKycByUserId(loginUser.getUserid());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isExistUserKyc(Long userId) {
|
||||||
|
return this.uKycMapper.isExistUserKyc(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertUserKyc(UKyc uKyc) {
|
||||||
|
// // Convert string to enum
|
||||||
|
// uKyc.setIdType(uKyc.getIdType());
|
||||||
|
// uKyc.setStatus(uKyc.getStatus());
|
||||||
|
|
||||||
|
log.debug("uKyc: {}", uKyc);
|
||||||
|
if (this.uKycMapper.isExistUserKyc(uKyc.getUserId()) == 0) {
|
||||||
|
return this.uKycMapper.insertUserKyc(uKyc);
|
||||||
|
} else {
|
||||||
|
return this.uKycMapper.updateUserKyc(uKyc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateUserKyc(UKyc uKyc) {
|
||||||
|
return this.uKycMapper.updateUserKyc(uKyc);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<?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="org.wfc.user.mapper.UKycMapper">
|
||||||
|
|
||||||
|
<resultMap type="UKyc" id="UKycResult">
|
||||||
|
<id property="kycId" column="kyc_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="birthDate" column="birth_date" />
|
||||||
|
<result property="idType" column="id_type" />
|
||||||
|
<result property="idFile" column="id_file" />
|
||||||
|
<result property="identifyPicture" column="identify_picture" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="insertUserKyc" parameterType="UKyc" useGeneratedKeys="true" keyProperty="kycId">
|
||||||
|
insert into u_kyc(
|
||||||
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
|
<if test="birthDate != null">birth_date,</if>
|
||||||
|
<if test="idType != null and idType != ''">id_type,</if>
|
||||||
|
<if test="idFile != null and idFile != ''">id_file,</if>
|
||||||
|
<if test="identifyPicture != null and identifyPicture != ''">identify_picture,</if>
|
||||||
|
<if test="status != null and status != ''">status,</if>
|
||||||
|
<if test="description != null and description != ''">description,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="userId != null and userId != ''">#{userId},</if>
|
||||||
|
<if test="birthDate != null">STR_TO_DATE(#{birthDate}, '%Y-%m-%d %H:%i:%s'),</if>
|
||||||
|
<if test="idType != null and idType != ''">#{idType},</if>
|
||||||
|
<if test="idFile != null and idFile != ''">#{idFile},</if>
|
||||||
|
<if test="identifyPicture != null and identifyPicture != ''">#{identifyPicture},</if>
|
||||||
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
|
<if test="description != null and description != ''">#{description},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateUserKyc" parameterType="UKyc">
|
||||||
|
update u_kyc
|
||||||
|
<set>
|
||||||
|
<if test="birthDate != null">birth_date = STR_TO_DATE(#{birthDate}, '%Y-%m-%d %H:%i:%s'),</if>
|
||||||
|
<if test="idType != null and idType != ''">id_type = #{idType},</if>
|
||||||
|
<if test="idFile != null and idFile != ''">id_file = #{idFile},</if>
|
||||||
|
<if test="identifyPicture != null and identifyPicture != ''">identify_picture = #{identifyPicture},</if>
|
||||||
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
|
<if test="description != null and description != ''">description = #{description},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="isExistUserKyc" parameterType="Long" resultType="int">
|
||||||
|
select count(1) from u_user where user_id = #{userId} and del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectKycByUserId" resultType="org.wfc.user.domain.vo.UKycUserVo">
|
||||||
|
SELECT
|
||||||
|
k.kyc_id,
|
||||||
|
k.user_id,
|
||||||
|
u.user_name,
|
||||||
|
k.birth_date,
|
||||||
|
k.id_type,
|
||||||
|
k.id_file,
|
||||||
|
k.identify_picture,
|
||||||
|
k.`status` as kyc_request_status,
|
||||||
|
u.`kyc_status` as user_kyc_status,
|
||||||
|
k.create_time,
|
||||||
|
k.update_time
|
||||||
|
FROM
|
||||||
|
u_kyc k
|
||||||
|
LEFT JOIN u_user u ON u.user_id = k.user_id
|
||||||
|
WHERE
|
||||||
|
u.del_flag = 0
|
||||||
|
AND k.del_flag = 0
|
||||||
|
AND k.user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user