diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java index f927a8278..49411c40b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java @@ -38,6 +38,8 @@ public interface ClientFilesMapper { List findAllClientFile(@Param("client_id") int clientId); + List findRepetitiveFiles(@Param("client_id") int clientId,@Param("file_name") String fileType); + @AutoSql(type = SqlType.SELECT) JSONObject findFileById(@Param("file_id") String file_id); 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 af1be6c92..3ad82c423 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 @@ -3601,8 +3601,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); try { - updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_BANK_FILE, filesInfo.getFile_bank_info(),fileResult); - updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info(),fileResult); + updateFilesForWaitAuditWithoutRepeat(manager, clientId, CLIENT_BANK_FILE, filesInfo.getFile_bank_info(),fileResult); + updateFilesForWaitAuditWithoutRepeat(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info(),fileResult); updateSysClientFilesForWaitCompliance(manager, clientId, KYC_UTILITY_BILL_FILE, filesInfo.getUtility_bill_info(),fileResult); } catch (Exception e) { logger.error("上传KYC文件失败", e); @@ -3989,6 +3989,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + public void updateFilesForWaitAuditWithoutRepeat(JSONObject manager, 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", manager.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) { List passAggregateFiles = clientFilesMapper.findClientPassAggreeFile(clientId); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index 74bb84a63..70c30374c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -758,7 +758,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati String fileKey = KYC_FILE_KEYS[i]; if (clientFiles != null && clientFiles.size() > 0) { List clientFileUrl = clientFiles.stream() - .filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2))) + .filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 0 || fileJson.getIntValue("status") == 2|| fileJson.getIntValue("status") == 3))) .sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date"))) .map(json -> { JSONObject params = new JSONObject(); @@ -772,11 +772,10 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati fileJson.put("key", KYC_PUT_KEYS[i]); fileJson.put("name", KYC_FILE_NAMES[i]); fileJson.put("file_value", clientFileUrl); - fileJson.put("file_write", false); result.put(fileKey,fileJson); } else { List clientBackToFileUrl = clientFiles.stream() - .filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 0 || fileJson.getIntValue("status") == 3))) + .filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 1))) .sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date"))) .map(json -> { JSONObject params = new JSONObject(); @@ -797,7 +796,6 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati fileJson.put("file_value", clientBackToFileUrl); } } - fileJson.put("file_write", true); result.put(fileKey,fileJson); } }else { @@ -806,7 +804,6 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati JSONObject fileJson = new JSONObject(); fileJson.put("key", KYC_PUT_KEYS[c]); fileJson.put("name", KYC_FILE_NAMES[c]); - fileJson.put("file_write", true); result.put(key,fileJson); } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml index 24d736120..9895409a0 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml @@ -25,6 +25,19 @@ and file_name='client_agree_file' and status != 1 + + +