diff --git a/pom.xml b/pom.xml index aa8fad51b..e2e11ef74 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.3.10 + 1.3.11 UTF-8 1.4.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index 485b4834c..d7f01c895 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -219,6 +219,8 @@ public interface RetailAppService { JSONObject getClientAuthFileStatusAggregate(JSONObject device); + JSONObject getKycFiles(JSONObject device); + void getCBBankAggregateFile(JSONObject device, HttpServletResponse httpResponse); JSONObject getSourceAggregateFile(JSONObject device); @@ -229,11 +231,13 @@ public interface RetailAppService { List uploadKycAuthFiles(JSONObject device, ClientKycFilesInfo filesInfo); + void uploadKycAuthFilesForApp(JSONObject device, JSONObject filesInfo,String fileType); + void deleteGreenChannelAuthFiles(JSONObject device, String filesInfo); void commitAuthFilesToCompliance(JSONObject device, JSONObject photoInfo); - void commitAuthFilesToKyc(JSONObject device); + void commitAuthFilesToKyc(JSONObject device,String idType); JSONObject getClientSubManage(JSONObject device); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 2d61fac42..f8a9ff9e6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.appclient.core.impls; import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.exceptions.EmailException; +import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.activities.app_index.core.AppActService; import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; @@ -16,6 +17,7 @@ import au.com.royalpay.payment.manage.customers.core.CouponValidateService; import au.com.royalpay.payment.manage.device.core.DeviceManager; import au.com.royalpay.payment.manage.fund.core.impls.XPlanFundConfigServiceImpl; import au.com.royalpay.payment.manage.kyc.core.KycService; +import au.com.royalpay.payment.manage.kyc.enums.FilesAuthTypeEnum; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.mappers.client.AuthAppMessageMapper; import au.com.royalpay.payment.manage.mappers.log.*; @@ -107,6 +109,7 @@ import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * Created by yishuqian on 28/03/2017. @@ -219,6 +222,8 @@ public class RetailAppServiceImp implements RetailAppService { @Resource private MessageSource messageSource; @Resource + private ClientFilesMapper clientFilesMapper; + @Resource private DeviceManager deviceManager; private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf"; private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/10/22/1571723034726_5xK6A0FGv5aQPbMIDJzXJrUPKHFutv.pdf"; @@ -2529,6 +2534,61 @@ public class RetailAppServiceImp implements RetailAppService { return authFileStatus; } + @Override + public JSONObject getKycFiles(JSONObject device) { + String clientType = device.getString("client_type"); + deviceSupport.findRegister(clientType); + JSONObject client = clientMapper.findClient(device.getIntValue("client_id")); + + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject file = checkKycFileStatusForApp(client); + JSONObject compliance = clientComplianceCompanyMapper.findKycFileByClientId(device.getIntValue("client_id")); + file.put("file_company", compliance); + return file; + } + + public JSONObject checkKycFileStatusForApp(JSONObject client) { + JSONObject result = new JSONObject(); + boolean lessKycFiles = true; + JSONObject kycFilesAuth = clientComplianceCompanyMapper.findKycFileComplete(client.getIntValue("client_id")); + if(kycFilesAuth != null + || !("PINE".equals(client.getString("client_moniker")) + || "LEOH".equals(client.getString("client_moniker")))){ + lessKycFiles = false; + } + result.put("help_confirm", messageSource.getMessage("client.auth.file.help_confirm", null, RequestEnvironment.getLocale())); + result.put("help_success", messageSource.getMessage("client.auth.file.help_success", null, RequestEnvironment.getLocale())); + + result.put("client_less_file", lessKycFiles); + if (lessKycFiles) { + List kycFiles = new ArrayList<>(); + kycFiles = clientFilesMapper.findKycClientFileByClient(client.getIntValue("client_id")); + for (JSONObject file : kycFiles) { + result.put(file.getString("file_name"), file.getString("file_value")); + } + List clientFileUrl = kycFiles.stream() + .filter(json -> ("kyc_utility_bill_file".equals(json.getString("file_name")))) + .sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date"))) + .map(json -> { + JSONObject params = new JSONObject(); + params.put("file_id", json.getString("file_id")); + params.put("status", json.getString("status")); + params.put("file_value", json.getString("file_value")); + return params; + }) + .collect(Collectors.toList()); + if (clientFileUrl.size() > 0) { + result.put("kyc_utility_bill_file", clientFileUrl); + } + } + return result; + } + + + + public JSONObject complianceFilesNotice(JSONObject client,JSONObject account){ JSONObject complianceFilesNotice = new JSONObject(); @@ -2538,9 +2598,10 @@ public class RetailAppServiceImp implements RetailAppService { } JSONObject compliance = clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")); + complianceFilesNotice.put("auth_type",FilesAuthTypeEnum.COMPLIANCE.getAuthType()); complianceFilesNotice.put("type", messageSource.getMessage("client.auth.file.compliance.type", null, RequestEnvironment.getLocale())); - complianceFilesNotice.put("deadline", messageSource.getMessage("client.auth.file.aggregate.deadline", null, RequestEnvironment.getLocale())); - complianceFilesNotice.put("root_url","111"); + complianceFilesNotice.put("deadline","2020-01-31"); + /* complianceFilesNotice.put("root_url","111");*/ complianceFilesNotice.put("client_less_file",complianceFileStatus.getBoolean("client_less_file")); if(compliance != null){ complianceFilesNotice.put("refused_reason",compliance.getString("description")); @@ -2559,9 +2620,10 @@ public class RetailAppServiceImp implements RetailAppService { return null; } + kycFilesNotice.put("auth_type",FilesAuthTypeEnum.KYC.getAuthType()); kycFilesNotice.put("type", messageSource.getMessage("client.auth.file.kyc.type", null, RequestEnvironment.getLocale())); - kycFilesNotice.put("deadline", messageSource.getMessage("client.auth.file.aggregate.deadline", null, RequestEnvironment.getLocale())); - kycFilesNotice.put("root_url","111"); + kycFilesNotice.put("deadline", "2020-01-31"); + /* kycFilesNotice.put("root_url","111");*/ kycFilesNotice.put("client_less_file",kycFileStatus.getBoolean("client_less_file")); if(compliance != null){ kycFilesNotice.put("refused_reason",compliance.getString("description")); @@ -2693,6 +2755,15 @@ public class RetailAppServiceImp implements RetailAppService { return clientManager.uploadKycFilesForWaitCompliance(account, client.getString("client_moniker"), clientKycFilesInfo); } + @Override + public void uploadKycAuthFilesForApp(JSONObject device, JSONObject filesInfo, String fileType) { + String clientType = device.getString("client_type"); + deviceSupport.findRegister(clientType); + JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); + JSONObject account = clientAccountMapper.findById(device.getString("account_id")); + clientManager.uploadKycFilesForWaitComplianceForApp(account, client.getString("client_moniker"), filesInfo,fileType); + } + @Override public void deleteGreenChannelAuthFiles(JSONObject device, String fileId) { @@ -2712,11 +2783,12 @@ public class RetailAppServiceImp implements RetailAppService { } @Override - public void commitAuthFilesToKyc(JSONObject device) { + public void commitAuthFilesToKyc(JSONObject device,String idType) { String clientType = device.getString("client_type"); deviceSupport.findRegister(clientType); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id")); + account.put("id_type", idType); kycService.commitAuthKycFilesToCompliance(client.getString("client_moniker"), account, "App"); } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index cff65aa35..d2b7210a0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -14,9 +14,12 @@ import au.com.royalpay.payment.manage.bill.bean.QueryBillBean; import au.com.royalpay.payment.manage.bill.bean.QueryBillOrderBean; import au.com.royalpay.payment.manage.bill.core.BillOrderService; import au.com.royalpay.payment.manage.bill.core.BillService; +import au.com.royalpay.payment.manage.kyc.core.KycService; +import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo; +import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; import au.com.royalpay.payment.manage.riskbusiness.bean.RiskEventQuery; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService; @@ -81,6 +84,12 @@ public class RetailAppController { private ManualSettleSupport manualSettleSupport; @Resource private AttachmentClient attachmentClient; + @Resource + private KycService kycService; + + @Resource + private ClientAccountMapper clientAccountMapper; + @Autowired private RiskBusinessService riskBusinessService; @@ -899,14 +908,21 @@ public class RetailAppController { retailAppService.commitAuthFilesToCompliance(device, photoInfo); } + @GetMapping("/client/kyc_auth_file/clientViewFiles") + public JSONObject getkycFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { + return retailAppService.getKycFiles(device); + } + /** * 提交待审核KYC文件 * * @param device */ - @PutMapping("/client/kyc_auth_file") - public List uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody ClientKycFilesInfo filesInfo) { - return retailAppService.uploadKycAuthFiles(device, filesInfo); + @PostMapping("/client/kyc_auth_file") + public JSONObject uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam MultipartFile file, @RequestParam("fileType") String fileType)throws Exception{ + JSONObject fileInfo = attachmentClient.uploadFile(file, false); + retailAppService.uploadKycAuthFilesForApp(device, fileInfo,fileType); + return fileInfo; } /** @@ -915,8 +931,19 @@ public class RetailAppController { * @param device */ @PostMapping("/client/auth_file/commit_to_kyc") - public void commitToKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - retailAppService.commitAuthFilesToKyc(device); + public void commitToKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestBody JSONObject params) { + retailAppService.commitAuthFilesToKyc(device, params.getString("id_type")); + } + + @PutMapping(value = "/notifyBd") + public void clientKycBdIntervention(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { + JSONObject account = clientAccountMapper.findById(device.getString("account_id")); + kycService.kycNotifyBd(account, "app"); + } + + @PutMapping("/client/kyc_auth_file") + public List uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody ClientKycFilesInfo filesInfo) { + return retailAppService.uploadKycAuthFiles(device, filesInfo); } @GetMapping("/client/sub_manage") diff --git a/src/main/java/au/com/royalpay/payment/manage/kyc/enums/FilesAuthTypeEnum.java b/src/main/java/au/com/royalpay/payment/manage/kyc/enums/FilesAuthTypeEnum.java new file mode 100644 index 000000000..8f07a33a7 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/kyc/enums/FilesAuthTypeEnum.java @@ -0,0 +1,22 @@ + +package au.com.royalpay.payment.manage.kyc.enums; + + /** + * @Author: liuxinxin + * @Date: 2019-12-20 + */ + public enum FilesAuthTypeEnum { + KYC("kyc"), + COMPLIANCE("compliance"); + + private final String authType; + + public String getAuthType() { + return authType; + } + + FilesAuthTypeEnum(String authType) { + this.authType = authType; + } + } + diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index d05dde710..dd65e8846 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -266,6 +266,8 @@ public interface ClientManager { List uploadKycFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientKycFilesInfo filesInfo); + List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo,String fileType); + List uploadAuthFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); void commitAuthFilesToCompliance(String clientMoniker, JSONObject account, String source); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 6b3377205..688269b9d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -3613,6 +3613,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return fileResult; } + @Override + @Transactional + public List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo,String fileType) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + List fileResult = new ArrayList<>(); + if (client == null) { + throw new InvalidShortIdException(); + } + int clientId = client.getIntValue("client_id"); + try { + updateFilesForWaitAuditWithoutRepeatForApp(account,clientId, fileType, filesInfo.getString("url"),fileResult); + } catch (Exception e) { + logger.error("上传KYC文件失败", e); + throw new BadRequestException("上传KYC文件失败" + e.getMessage()); + } + return fileResult; + } + + @Override @Transactional @@ -4019,6 +4038,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } + public void updateFilesForWaitAuditWithoutRepeatForApp(JSONObject account, int clientId, String fileType, String fileValue, List fileResult) { + if (fileValue != null) { + String[] values = fileValue.split(","); + List repetitiveFiles = clientFilesMapper.findRepetitiveFiles(clientId,fileType); + for (String value : values) { + JSONObject fileJson = new JSONObject(); + fileJson.put("client_id", clientId); + fileJson.put("last_update_date", new Date()); + fileJson.put("last_update_by", account.getString("display_name")); + fileJson.put("file_name", fileType); + fileJson.put("file_value", value); + fileJson.put("status", 0); + fileJson.put("is_valid", 1); + clientFilesMapper.save(fileJson); + logger.info(clientId + "的fileType文件上传成功" + fileJson.getString("file_id")); + JSONObject file = new JSONObject(); + file.put("file_id", fileJson.getString("file_id")); + file.put("file_value", fileJson.getString("file_value")); + fileResult.add(file); + } + if(repetitiveFiles != null){ + for(JSONObject repetitiveFile : repetitiveFiles){ + clientFilesMapper.deleteByClientAndFileId(repetitiveFile.getString("file_id")); + } + } + } + } + + public void updateAggregateFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue, List fileResult) { if (fileValue != null) { diff --git a/src/main/resources/i18n/msg_en.properties b/src/main/resources/i18n/msg_en.properties index b086bea98..9900c4061 100644 --- a/src/main/resources/i18n/msg_en.properties +++ b/src/main/resources/i18n/msg_en.properties @@ -120,3 +120,5 @@ client.auth.file.aggregate.title=Notice Of Supplementary Files client.auth.file.compliance.type=Compliance Files client.auth.file.kyc.type=KYC Files client.auth.file.aggregate.deadline=Deadline 2020-1-20 +client.auth.file.help_confirm=Please confirm whether you need help from customer service ? +client.auth.file.help_success=Successful notification, please wait for customer service to contact you. diff --git a/src/main/resources/i18n/msg_zh.properties b/src/main/resources/i18n/msg_zh.properties index 2ca365c29..19c0318c4 100644 --- a/src/main/resources/i18n/msg_zh.properties +++ b/src/main/resources/i18n/msg_zh.properties @@ -113,3 +113,5 @@ client.auth.file.aggregate.title=补充材料通知 client.auth.file.compliance.type=合规材料 client.auth.file.kyc.type=KYC材料 client.auth.file.aggregate.deadline=截止时间 2020-1-20 +client.auth.file.help_confirm=请确认您是否需要客服的帮助? +client.auth.file.help_success=通知成功,请等待客服与您联系。