feat: support kyc on user and system module
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
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;
|
||||
|
||||
@@ -11,12 +11,12 @@ import lombok.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");
|
||||
DRIVERS_LICENSE(1, "driver's license"),
|
||||
PASSPORT(2, "passport"),
|
||||
RESIDENCE_PERMIT(3, "residence permit"),
|
||||
STUDENT_ID(4, "student ID"),
|
||||
MEDICARE_CARD(5, "medicare card"),
|
||||
BIRTH_CERTIFICATE(6, "birth certificate");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
@@ -9,11 +9,12 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum KycRequestStatusEnum {
|
||||
public enum KycStatusEnum {
|
||||
|
||||
APPROVED(0, "approved"),
|
||||
REJECTED(1, "rejected"),
|
||||
PENDING(2, "pending");
|
||||
VERIFIED(1, "verified"),
|
||||
UNVERIFIED(2, "unverified"),
|
||||
PENDING(3, "pending"),
|
||||
REJECTED(4, "rejected");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
@@ -11,8 +11,8 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum UserKycStatusEnum {
|
||||
|
||||
VERIFIED(0, "verified"),
|
||||
UNVERIFIED(1, "unverified");
|
||||
VERIFIED(1, "verified"),
|
||||
UNVERIFIED(2, "unverified");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
@@ -28,11 +28,11 @@ public class UKycUserVo {
|
||||
@Schema(description = "Identify Picture")
|
||||
private String identifyPicture;
|
||||
|
||||
@Schema(description = "KYC Request Status")
|
||||
private KycRequestStatusEnum kycRequestStatus;
|
||||
@Schema(description = "KYC Status")
|
||||
private KycStatusEnum status;
|
||||
|
||||
@Schema(description = "User KYC Status")
|
||||
private UserKycStatusEnum userKycStatus;
|
||||
@Schema(description = "Description")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "Create Time")
|
||||
private String createTime;
|
||||
|
||||
@@ -9,11 +9,8 @@ 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;
|
||||
@@ -52,10 +49,6 @@ public class UKycServiceImpl extends ServiceImpl<UKycMapper, UKyc> implements IU
|
||||
|
||||
@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);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertUserKyc" parameterType="UKyc" useGeneratedKeys="true" keyProperty="kycId">
|
||||
insert into u_kyc(
|
||||
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>
|
||||
@@ -29,7 +29,7 @@
|
||||
<if test="description != null and description != ''">description,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
)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>
|
||||
@@ -43,7 +43,7 @@
|
||||
</insert>
|
||||
|
||||
<update id="updateUserKyc" parameterType="UKyc">
|
||||
update u_kyc
|
||||
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>
|
||||
@@ -54,11 +54,19 @@
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
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
|
||||
count(1)
|
||||
FROM
|
||||
u_kyc k
|
||||
LEFT JOIN u_user u ON u.user_id = k.user_id
|
||||
WHERE
|
||||
k.user_id = #{userId}
|
||||
AND k.del_flag = '0'
|
||||
AND u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectKycByUserId" resultType="org.wfc.user.domain.vo.UKycUserVo">
|
||||
@@ -70,8 +78,8 @@
|
||||
k.id_type,
|
||||
k.id_file,
|
||||
k.identify_picture,
|
||||
k.`status` as kyc_request_status,
|
||||
u.`kyc_status` as user_kyc_status,
|
||||
k.`status`,
|
||||
<!-- u.`kyc_status` as user_kyc_status, -->
|
||||
k.create_time,
|
||||
k.update_time
|
||||
FROM
|
||||
@@ -83,5 +91,4 @@
|
||||
AND k.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user