From 6eaf2bf471267c501fb683c8ca4ffe3ec1cb30b7 Mon Sep 17 00:00:00 2001 From: zhangsz Date: Wed, 15 Jan 2025 14:33:51 +0800 Subject: [PATCH] fix: update kyc user module --- sql/wfc_config_db/wfc_config_db.sql | 4 +- sql/wfc_user_db/wfc_user_db.sql | 3 +- .../wfc/user/controller/UKycController.java | 4 +- .../main/java/org/wfc/user/domain/UKyc.java | 3 + .../wfc/user/domain/constant/IdTypeEnum.java | 8 +++ .../user/domain/constant/KycStatusEnum.java | 9 +++ .../org/wfc/user/domain/vo/UKycUserVo.java | 15 +++++ .../user/service/impl/UKycServiceImpl.java | 56 +++++++++++++++++-- .../typehandler/IdTypeEnumTypeHandler.java | 37 ++++++++++++ .../typehandler/KycStatusEnumTypeHandler.java | 38 +++++++++++++ .../src/main/resources/application.yml | 3 +- .../main/resources/mapper/user/UKycMapper.xml | 10 +++- .../resources/mapper/user/UUserMapper.xml | 6 +- .../src/main/resources/mybatis-config.xml | 10 ++++ 14 files changed, 189 insertions(+), 17 deletions(-) create mode 100644 wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/IdTypeEnumTypeHandler.java create mode 100644 wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/KycStatusEnumTypeHandler.java create mode 100644 wfc-modules/wfc-user/src/main/resources/mybatis-config.xml diff --git a/sql/wfc_config_db/wfc_config_db.sql b/sql/wfc_config_db/wfc_config_db.sql index 2b28652..e54a8b3 100644 --- a/sql/wfc_config_db/wfc_config_db.sql +++ b/sql/wfc_config_db/wfc_config_db.sql @@ -94,7 +94,7 @@ INSERT INTO `config_info` VALUES (65, 'wfc-system-prod.yml', 'DEFAULT_GROUP', '# INSERT INTO `config_info` VALUES (66, 'wfc-gen-prod.yml', 'DEFAULT_GROUP', '# spring配置\nspring:\n redis:\n host: wfc-redis\n port: 6379\n password:\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://wfc-mysql:3306/wfc_system_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: org.wfc.gen.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 代码生成接口文档\n license: Powered By wfc\n licenseUrl: https://wfc.vip\n\n# 代码生成\ngen:\n # 作者\n author: wfc\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\n packageName: org.wfc.system\n # 自动去除表前缀,默认是false\n autoRemovePre: false\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\n tablePrefix: sys_\n', '5ec7d9b8eb46eca656316e5f817aadb2', '2024-12-13 11:52:34', '2024-12-13 11:55:28', NULL, '192.168.2.116', '', 'wfc-prod', '代码生成', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (67, 'wfc-job-prod.yml', 'DEFAULT_GROUP', '# spring配置\nspring:\n redis:\n host: wfc-redis\n port: 6379\n password: \n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://wfc-mysql:3306/wfc_system_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: org.wfc.job.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 定时任务接口文档\n license: Powered By wfc\n licenseUrl: https://wfc.vip\n', '1376deec876c0878df743b4d96c7f125', '2024-12-13 11:52:34', '2024-12-13 11:56:07', NULL, '192.168.2.116', '', 'wfc-prod', '定时任务', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (68, 'wfc-file-prod.yml', 'DEFAULT_GROUP', '# 本地文件上传 \nfile:\n domain: wfc-file:9201\n path: /opt/wfc/upload\n prefix: /kyc\n\n# FastDFS配置\nfdfs:\n domain: http://wfc-file\n soTimeout: 3000\n connectTimeout: 2000\n trackerList: wfc-file:22122\n\n# Minio配置\nminio:\n url: http://wfc-file:9000\n accessKey: minioadmin\n secretKey: minioadmin\n bucketName: test', '788c4d2b226a744eefc465bf31c3824b', '2024-12-13 11:52:34', '2025-01-07 12:15:07', NULL, '172.19.0.1', '', 'wfc-prod', '文件服务', '', '', 'yaml', '', ''); -INSERT INTO `config_info` VALUES (69, 'wfc-user-prod.yml', 'DEFAULT_GROUP', '# spring配置\nspring:\n redis:\n host: wfc-redis\n port: 6379\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://wfc-mysql:3306/wfc_user_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n # 从库数据源\n # slave:\n # username:\n # password:\n # url:\n # driver-class-name:\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: org.wfc.user\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By wfc\n licenseUrl: https://wfc.vip', 'db8c5a7eeebb0d57d180d1a97ad6226e', '2024-12-28 19:17:13', '2024-12-28 19:17:13', NULL, '172.19.0.1', '', 'wfc-prod', '用户平台模块', NULL, NULL, 'yaml', NULL, ''); +INSERT INTO `config_info` VALUES (69, 'wfc-user-prod.yml', 'DEFAULT_GROUP', '# spring配置\nspring:\n redis:\n host: wfc-redis\n port: 6379\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://wfc-mysql:3306/wfc_user_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n # 从库数据源\n # slave:\n # username:\n # password:\n # url:\n # driver-class-name:\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: org.wfc.user\n config-location: classpath:mybatis-config.xml\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By wfc\n licenseUrl: https://wfc.vip\n\nlogging:\n level:\n root: INFO\n org.springframework.web: INFO\n org.mybatis.mapper: DEBUG\n org.wfc.user: DEBUG\n', 'a4a5091fab85f9a67ba3800e6254c086', '2024-12-28 19:17:13', '2025-01-14 09:00:36', NULL, '172.19.0.1', '', 'wfc-prod', '用户平台模块', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (70, 'wfc-payment-prod.yml', 'DEFAULT_GROUP', '# spring配置\nspring:\n application:\n name: wfc-payment\n cloud:\n nacos:\n discovery:\n server-addr: ${NACOS_SERVER_ADDR:wfc-nacos}:${NACOS_SERVER_PORT:8848}\n namespace: ${NACOS_NAMESPACE:wfc-prod}\n \n main:\n allow-bean-definition-overriding: true\n \n redis:\n host: wfc-redis\n port: 6379\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://wfc-mysql:3306/wfc_user_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n # 从库数据源\n # slave:\n # username:\n # password:\n # url:\n # driver-class-name:\n\n# mybatis-plus配置\nmybatis-plus:\n # 搜索指定包别名\n type-aliases-package: org.wfc.payment\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapper-locations: classpath:mapper/**/*.xml\n global-config:\n db-config:\n logic-delete-field: del_flag\n logic-delete-value: 1\n logic-not-delete-value: 0\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By wfc\n licenseUrl: https://wfc.vip\n\nlogging:\n level:\n root: INFO\n org.springframework.web: INFO\n org.mybatis.mapper: DEBUG\n com.github.binarywang: DEBUG\n\nwxpay:\n appId: wxd678efh567hg6787\n mchId: 1230000109\n mchKey: 1525342aa\n subAppId: #服务商模式下的子商户公众账号ID\n subMchId: #服务商模式下的子商户号 \n keyPath: /opt/wfc/conf/wxpay/wxpay_key.pem\n useSandboxEnv: true\n\nalipay:\n appId: 121412414112\n privateKey: MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC3/5tHX5ioibCWXzUYVVIgd0wexio5CbRITNQ2saPOb17jioe0Q5Qu/xjcdjEu8JQ17PQzjDHciHV8E/fcJ1qgWjYcpvLptp/jRJ7C75kckj7Z3maajgzwxjk2ylmhgTkd5yJiX+7ywNX/48D/Bx906TXUlEUMIN+AO19MZzfc5NwDL5DAAsUOIVbGP/OTAJIfr1yPms9NoFtOad/L3Bb8OEo2xVi2ac07yyU8bftVPEtYgH6Ox+ubtYQ74dRszk4h6Qoeuqcqo4YeWA9XO471J8y6tc+oMsf3rF8zjo69W+HsfxfBNvUzheKCym4XyS3bI0KHwe7yFC7v/qR7ahMxAgMBAAECggEBAJ7cEi3KTJxe3NbHdqj+qTyco10CjNvYFA5EPwjF0H7gSxW7ujSaECuPVeCqLwau8depMKH8zePw8TZiayJp2+YMXSHZxmqgoWTwDv6RLSms3pTuXrncITIUgrtac45samr17wrudviiI2GeOzg05yTiYPab2Q2CqFUnbb0idOnCOEWK37z2ojA9XgNDukoA+1Wpm1HqoTNNRNHZOq8ZfbxyZY3iq4nuoEDQf741kzNe4skmw21N6rC21QJ8nrCfc70C47iz5XW8lfuVNkUeJc+E595HrLBp7he5cEBWKsZ4xi+X0tlyNgg9OlLuP+8twOxl9rwP/0d4pjKnnfEa0a0CgYEA+EM7FqCFhExZHoO6/c9igbtqlIc93UNT5YVrujgmgfq0ACq6X8tWV1j+1WPcYwLqOKlgprNCoW+aT0rUTI3Nq/wFr5AkAdNClje707Ec8n5NTNUSX3i2zpdgTIKFHFEgl13BsKgb5ABosexlXU/gxpJCZctQ33tfYtZfnA5Zr3MCgYEAvbukhHBv1UcSH54UULoY1tNkFKwiiAbJIcSRV+ZLqxW9adREFLxSJOqk90B9t8CXdRVgT+7Oap0GztACQ63psqxbeKeXdHnJNL4CEl4RWcge6isI3V7kU0/yx+/miWhyYGByZ816D/QUdbbF1kU14dD79TVD171uS9IJxKTRgcsCgYAopYlFGR8DHCTzNAoniA7Owsqeas4cLevMhl2u7YaQfWV/KX++M2J9hpqigWkR5OZIRKMIaA0etVEEbnH33rev0uFzbxwWGGqsgY+FB1h/82HglHofm3oCtRIVNMFqc3XsknMl40A9wjth9hxafLuGh2fLltA05tQlMIgS2t6gNQKBgQCzRHJDeIESAR7MpO4JAGyrvfwX1DSkVdUAhNvXM49XTSk0rwzMkssCenn37AVc8ymnxNTFcZuy/D8MdVlOXSosWdHrhF4D/XXw0X7fn+XA8ObU1mh/0ULmvOllo/Qs7HT1PuuZzHmCTVpvhowS0j4A6RbHLta1JxTpqsDz/c6+VQKBgQDubC69oYbaBjxOKsQGvYUhpS9RsqZCxmg1GzLcPiUOvjWzi8fNx3JrrJ8PFOcpxs+OhRT0rlzlePfHGu/lzrSuL0sCol9enFk80rKLFAw4oXAdnTbtEjaoxA1dFTrrUIxFQkHpeH0NAkqU6BVaxbCPH22zH6/BZt2J9225lBuelQ==\n publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt/+bR1+YqImwll81GFVSIHdMHsYqOQm0SEzUNrGjzm9e44qHtEOULv8Y3HYxLvCUNez0M4wx3Ih1fBP33CdaoFo2HKby6baf40Sewu+ZHJI+2d5mmo4M8MY5NspZoYE5HeciYl/u8sDV/+PA/wcfdOk11JRFDCDfgDtfTGc33OTcAy+QwALFDiFWxj/zkwCSH69cj5rPTaBbTmnfy9wW/DhKNsVYtmnNO8slPG37VTxLWIB+jsfrm7WEO+HUbM5OIekKHrqnKqOGHlgPVzuO9SfMurXPqDLH96xfM46OvVvh7H8XwTb1M4XigspuF8kt2yNCh8Hu8hQu7/6ke2oTMQIDAQAB\n notifyUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/alipay/notify\n returnUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/alipay/return\n signType: RSA2\n charset: utf-8\n gatewayUrl: https://openapi.alipaydev.com/gateway.do\n logPath: /opt/wfc/logs/alipay/alipay_log.txt\n maxQueryRetry: 5\n queryDuration: 5\n maxCancelRetry: 3\n cancelDuration: 2\n heartbeatDelay: 5\n heartbeatDuration: 5\n storeId: \n storeName: \n supportEmail: \n supportPhone:\n\nccpay:\n url: https://api.paymentgateway.com/v1/payments\n apiKey: api-key-from-nacos\n merchantId: merchant-id-from-nacos\n currency: USD\n timeout: 30\n callbackUrl: https://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/payment/callback\n\nunionpay:\n merId: 700000000000001\n keyPrivateCert: /opt/wfc/conf/cert/unionpay/wfc-root.pfx\n keyPrivateCertPwd: 123456\n signCertType: PKCS12\n encryptCertPath: /opt/wfc/conf/cert/unionpay/wfc-root.cer\n acpMiddleCert: /opt/wfc/conf/cert/unionpay/wfc-middle.cer\n acpRootCert: /opt/wfc/conf/cert/unionpay/wfc-root.cer\n frontUrl: https://gateway.test.95516.com/gateway/api/frontTransReq.do\n backUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/notify\n signMethod: 01\n version: 5.1.0\n channelType: 07\n accessType: 0\n currencyCode: 156\n bizType: 000201\n txnType: 01\n txnSubType: 01\n payTimeout: 30\n queryTimeout: 30\n refundTimeout: 30\n frontFailUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/fail\n frontSuccessUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/success\n frontBackUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/front\n backBackUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/back\n frontNotifyUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/front/notify\n backNotifyUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/back/notify\n refundNotifyUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/refund/notify\n queryNotifyUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/query/notify\n refundSuccessUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/refund/success\n refundFailUrl: http://wfc-gateway:${GATEWAY_SERVER_PORT:8080}/unionpay/refund/fail\n querySuccessUrl: ', '43039c5e1b2bd1a823fcb3e0ca73cbde', '2024-12-28 19:17:46', '2025-01-07 11:14:01', NULL, '172.19.0.1', '', 'wfc-prod', 'wfc-modules-payment production yaml', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (71, 'sentinel-wfc-gateway-prod', 'DEFAULT_GROUP', '[\r\n {\r\n \"resource\": \"wfc-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"wfc-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"wfc-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"wfc-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]', 'a8b3ec396dd09d5f2ba494cc80a7afa0', '2024-12-28 19:27:43', '2024-12-28 19:27:43', NULL, '172.19.0.1', '', 'wfc-prod', '限流策略', NULL, NULL, 'json', NULL, ''); @@ -237,7 +237,7 @@ CREATE TABLE `his_config_info` ( INDEX `idx_gmt_create`(`gmt_create`) USING BTREE, INDEX `idx_gmt_modified`(`gmt_modified`) USING BTREE, INDEX `idx_did`(`data_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 242 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '多租户改造' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '多租户改造' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of his_config_info diff --git a/sql/wfc_user_db/wfc_user_db.sql b/sql/wfc_user_db/wfc_user_db.sql index 4a8d673..537edc4 100644 --- a/sql/wfc_user_db/wfc_user_db.sql +++ b/sql/wfc_user_db/wfc_user_db.sql @@ -863,7 +863,8 @@ 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, + `real_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `birth_date` date 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', diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UKycController.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UKycController.java index 16c777d..d67d183 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UKycController.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UKycController.java @@ -13,7 +13,6 @@ 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.constant.KycStatusEnum; import org.wfc.user.domain.vo.UKycUserVo; @@ -57,5 +56,6 @@ public class UKycController extends BaseController { public AjaxResult edit(@Validated @RequestBody UKyc uKyc) { uKyc.setStatus(KycStatusEnum.PENDING.getCode()); return toAjax(uKycService.updateUserKyc(uKyc)); - } + } + } diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/UKyc.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/UKyc.java index 8111ad0..eaaafd9 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/UKyc.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/UKyc.java @@ -26,6 +26,9 @@ public class UKyc extends BaseData { @Schema(description = "User ID") private Long userId; + @Schema(description = "Real Name") + private String realName; + @Schema(description = "Birth Date") private String birthDate; diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/IdTypeEnum.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/IdTypeEnum.java index 7d43820..04170d9 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/IdTypeEnum.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/IdTypeEnum.java @@ -21,4 +21,12 @@ public enum IdTypeEnum { private final Integer code; private final String desc; + public static IdTypeEnum fromCode(Integer code) { + for (IdTypeEnum type : IdTypeEnum.values()) { + if (type.getCode().equals(code)) { + return type; + } + } + throw new IllegalArgumentException("Unknown code: " + code); + } } diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/KycStatusEnum.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/KycStatusEnum.java index ad83a78..ff16f93 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/KycStatusEnum.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/constant/KycStatusEnum.java @@ -18,4 +18,13 @@ public enum KycStatusEnum { private final Integer code; private final String desc; + + public static KycStatusEnum fromCode(Integer code) { + for (KycStatusEnum type : KycStatusEnum.values()) { + if (type.getCode().equals(code)) { + return type; + } + } + throw new IllegalArgumentException("Unknown code: " + code); + } } diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/vo/UKycUserVo.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/vo/UKycUserVo.java index daca557..ef63670 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/vo/UKycUserVo.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/domain/vo/UKycUserVo.java @@ -22,6 +22,9 @@ public class UKycUserVo { @Schema(description = "ID Type") private IdTypeEnum idType; + // @Schema(description = "ID Type") + // private Integer idType; + @Schema(description = "ID File") private String idFile; @@ -31,9 +34,21 @@ public class UKycUserVo { @Schema(description = "KYC Status") private KycStatusEnum status; + // @Schema(description = "KYC Status") + // private Integer status; + @Schema(description = "Description") private String description; + @Schema(description = "Create By") + private String createBy; + @Schema(description = "Create Time") private String createTime; + + @Schema(description = "Update By") + private String updateBy; + + @Schema(description = "Update Time") + private String updateTime; } diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java index 213b4c1..35fc8ff 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java @@ -8,11 +8,18 @@ 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.api.domain.UUser; import org.wfc.user.domain.UKyc; import org.wfc.user.domain.vo.UKycUserVo; import org.wfc.user.mapper.UKycMapper; import org.wfc.user.service.IUKycService; +import org.wfc.user.service.IUUserService; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.Period; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.List; /** @@ -26,11 +33,16 @@ import java.util.List; @Service public class UKycServiceImpl extends ServiceImpl implements IUKycService { - private static final Logger log = LoggerFactory.getLogger(UKycServiceImpl.class); + private static final Logger logger = LoggerFactory.getLogger(UKycServiceImpl.class); @Autowired private UKycMapper uKycMapper; + @Autowired + private IUUserService uUserService; + + private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + // @Override // public List selectKycByUserId(Long userId) { // return this.baseMapper.selectKycByUserId(userId); @@ -49,19 +61,19 @@ public class UKycServiceImpl extends ServiceImpl implements IU @Override public int insertUserKyc(UKyc uKyc) { - log.debug("uKyc: {}", uKyc); + logger.debug("uKyc: {}", uKyc); LoginUser loginUser = SecurityUtils.getLoginUser(); if (uKyc.getUserId() == null) { uKyc.setUserId(loginUser.getUserid()); } else { if (!loginUser.getUserid().equals(uKyc.getUserId())) { - log.error("The kyc user(userId={}) is not the logged in user(userId={})", + logger.error("The kyc user(userId={}) is not the logged in user(userId={})", uKyc.getUserId(), loginUser.getUserid()); return 0; } } - + updateUserByKyc(uKyc); if (this.uKycMapper.isExistUserKyc(uKyc.getUserId()) == 0) { return this.uKycMapper.insertUserKyc(uKyc); } else { @@ -77,12 +89,44 @@ public class UKycServiceImpl extends ServiceImpl implements IU uKyc.setUserId(loginUser.getUserid()); } else { if (!loginUser.getUserid().equals(uKyc.getUserId())) { - log.error("The kyc user(userId={}) is not the logged in user(userId={})", + logger.error("The kyc user(userId={}) is not the logged in user(userId={})", uKyc.getUserId(), loginUser.getUserid()); return 0; } } - + updateUserByKyc(uKyc); return this.uKycMapper.updateUserKyc(uKyc); } + + /** + * Updates the user information based on the KYC details. + * + * @param uKyc the KYC details + * @return the number of rows affected by the update + * @throws IllegalArgumentException if the birthDate is null or in an invalid format + */ + private int updateUserByKyc(UKyc uKyc) { + UUser uUser = uUserService.selectUserById(uKyc.getUserId()); + + uUser.setFullName(uKyc.getRealName()); + + if (uKyc.getBirthDate() == null) { + throw new IllegalArgumentException("BirthDate cannot be null"); + } + // Parse birthDate and calculate age + try { + LocalDate birthDate = LocalDate.parse(uKyc.getBirthDate(), DATE_FORMATTER); + uUser.setAge(calculateAge(birthDate)); + } catch (DateTimeParseException e) { + throw new IllegalArgumentException("Invalid birthDate format"); + } + return uUserService.updateUser(uUser); + } + + private int calculateAge(LocalDate birthDate) { + if (birthDate == null) { + return 0; + } + return Period.between(birthDate, LocalDate.now()).getYears(); + } } diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/IdTypeEnumTypeHandler.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/IdTypeEnumTypeHandler.java new file mode 100644 index 0000000..899f891 --- /dev/null +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/IdTypeEnumTypeHandler.java @@ -0,0 +1,37 @@ +package org.wfc.user.typehandler; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.wfc.user.domain.constant.IdTypeEnum; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class IdTypeEnumTypeHandler extends BaseTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, IdTypeEnum parameter, JdbcType jdbcType) + throws SQLException { + ps.setString(i, parameter.name()); + } + + @Override + public IdTypeEnum getNullableResult(ResultSet rs, String columnName) throws SQLException { + String name = rs.getString(columnName); + return name == null ? null : IdTypeEnum.valueOf(name); + } + + @Override + public IdTypeEnum getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + String name = rs.getString(columnIndex); + return name == null ? null : IdTypeEnum.valueOf(name); + } + + @Override + public IdTypeEnum getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + String name = cs.getString(columnIndex); + return name == null ? null : IdTypeEnum.valueOf(name); + } +} \ No newline at end of file diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/KycStatusEnumTypeHandler.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/KycStatusEnumTypeHandler.java new file mode 100644 index 0000000..9d04971 --- /dev/null +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/typehandler/KycStatusEnumTypeHandler.java @@ -0,0 +1,38 @@ +package org.wfc.user.typehandler; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.wfc.user.domain.constant.KycStatusEnum; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class KycStatusEnumTypeHandler extends BaseTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, + KycStatusEnum parameter, JdbcType jdbcType) + throws SQLException { + ps.setString(i, parameter.name()); + } + + @Override + public KycStatusEnum getNullableResult(ResultSet rs, String columnName) throws SQLException { + String name = rs.getString(columnName); + return name == null ? null : KycStatusEnum.valueOf(name); + } + + @Override + public KycStatusEnum getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + String name = rs.getString(columnIndex); + return name == null ? null : KycStatusEnum.valueOf(name); + } + + @Override + public KycStatusEnum getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + String name = cs.getString(columnIndex); + return name == null ? null : KycStatusEnum.valueOf(name); + } +} \ No newline at end of file diff --git a/wfc-modules/wfc-user/src/main/resources/application.yml b/wfc-modules/wfc-user/src/main/resources/application.yml index 9ef12da..126e8a8 100644 --- a/wfc-modules/wfc-user/src/main/resources/application.yml +++ b/wfc-modules/wfc-user/src/main/resources/application.yml @@ -46,6 +46,7 @@ spring: mybatis-plus: # 搜索指定包别名 type-aliases-package: org.wfc.user + config-location: classpath:mybatis-config.xml # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapper-locations: classpath:mapper/**/*.xml global-config: @@ -62,7 +63,7 @@ swagger: # Omada 配置 omada: - omada-url: 'https://192.168.2.248:8043' + omada-url: 'https://192.168.2.249:8043' omadac-id: 'f3aa6e479b94222581523710cc2c2a9d' client-id: '5036e77c81a74008821c694a715fe2b8' client-secret: '29faa06fb7f244b094377b48eb3083a7' diff --git a/wfc-modules/wfc-user/src/main/resources/mapper/user/UKycMapper.xml b/wfc-modules/wfc-user/src/main/resources/mapper/user/UKycMapper.xml index cc27755..d82a6d2 100644 --- a/wfc-modules/wfc-user/src/main/resources/mapper/user/UKycMapper.xml +++ b/wfc-modules/wfc-user/src/main/resources/mapper/user/UKycMapper.xml @@ -5,6 +5,7 @@ + @@ -21,6 +22,7 @@ INSERT INTO u_kyc( user_id, + real_name, birth_date, id_type, id_file, @@ -31,7 +33,8 @@ create_time )VALUES( #{userId}, - STR_TO_DATE(#{birthDate}, '%Y-%m-%d %H:%i:%s'), + #{realName}, + STR_TO_DATE(#{birthDate}, '%Y-%m-%d'), #{idType}, #{idFile}, #{identifyPicture}, @@ -45,7 +48,8 @@ UPDATE u_kyc - birth_date = STR_TO_DATE(#{birthDate}, '%Y-%m-%d %H:%i:%s'), + real_name = #{realName}, + birth_date = STR_TO_DATE(#{birthDate}, '%Y-%m-%d'), id_type = #{idType}, id_file = #{idFile}, identify_picture = #{identifyPicture}, @@ -73,7 +77,7 @@ SELECT k.kyc_id, k.user_id, - u.full_name as realName, + u.full_name as real_name, k.birth_date, k.id_type, k.id_file, diff --git a/wfc-modules/wfc-user/src/main/resources/mapper/user/UUserMapper.xml b/wfc-modules/wfc-user/src/main/resources/mapper/user/UUserMapper.xml index 901162f..5a1314f 100644 --- a/wfc-modules/wfc-user/src/main/resources/mapper/user/UUserMapper.xml +++ b/wfc-modules/wfc-user/src/main/resources/mapper/user/UUserMapper.xml @@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.user_id, u.dept_id, u.user_name, u.nick_name, u.full_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.age, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from u_user u @@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"