|
|
|
@ -42,10 +42,7 @@ import org.thymeleaf.spring4.SpringTemplateEngine;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -162,32 +159,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
|
|
|
|
|
}
|
|
|
|
|
client.putAll(clientConfigService.find(client_id));
|
|
|
|
|
client = clientInfoWithNoSecretInfo(client);
|
|
|
|
|
if (client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10) {
|
|
|
|
|
List<JSONObject> resultFiles = new ArrayList<>();
|
|
|
|
|
List<JSONObject> clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id"));
|
|
|
|
|
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file"};
|
|
|
|
|
String[] putKeys = {"file_bank_info", "file_company_info", "file_id_info", "file_agreement_info", "file_apply_info"};
|
|
|
|
|
String[] fileNames = {"* bank statement", "* Certificate of Registration", "* ID", "* Agreement" ,"Application Form(optional)"};
|
|
|
|
|
boolean clientFilesIsLess = false;
|
|
|
|
|
for (int i = 0; i < fileKeys.length; i++) {
|
|
|
|
|
String fileKey = fileKeys[i];
|
|
|
|
|
if (clientFiles.stream().noneMatch(fileJson -> fileKey.equals(fileJson.getString("file_name")))) {
|
|
|
|
|
JSONObject fileJson = new JSONObject();
|
|
|
|
|
fileJson.put("key", putKeys[i]);
|
|
|
|
|
fileJson.put("name", fileNames[i]);
|
|
|
|
|
fileJson.put("file_value", "not Configure");
|
|
|
|
|
resultFiles.add(fileJson);
|
|
|
|
|
if (!"client_apply_file".equals(fileKey)) {
|
|
|
|
|
clientFilesIsLess = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
client.put("greenChannel", 1);
|
|
|
|
|
client.put("client_less_file", clientFilesIsLess);
|
|
|
|
|
if (clientFilesIsLess) {
|
|
|
|
|
client.put("client_files", resultFiles);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
checkAuthFileStatus(client);
|
|
|
|
|
if (client.getInteger("parent_client_id") != null) {
|
|
|
|
|
JSONObject rootPartner = clientManager.getClientInfoIgnoreInvalid(client.getIntValue("parent_client_id"));
|
|
|
|
|
rootPartner.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
|
|
|
|
@ -647,4 +619,49 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
|
|
|
|
|
return RESET_MANAGER_ACCOUNT_PREFIX + codeKey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkAuthFileStatus(JSONObject client) {
|
|
|
|
|
if (client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10) {
|
|
|
|
|
List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
|
|
|
|
|
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"};
|
|
|
|
|
String[] putKeys = {"file_bank_info", "file_company_info", "file_id_info", "file_agreement_info"};
|
|
|
|
|
String[] fileNames = {"* bank statement", "* Certificate of Registration", "* ID", "* Agreement"};
|
|
|
|
|
boolean clientFilesIsLess = false;
|
|
|
|
|
List<JSONObject> resultFile = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < fileKeys.length; i++) {
|
|
|
|
|
String fileKey = fileKeys[i];
|
|
|
|
|
List<String> clientFileUrl = clientFiles.stream()
|
|
|
|
|
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status")==0 || fileJson.getIntValue("status")==1)))
|
|
|
|
|
.sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date")))
|
|
|
|
|
.map(groupBd -> groupBd.getString("file_value"))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (clientFileUrl!=null && clientFileUrl.size()>0) {
|
|
|
|
|
JSONObject fileJson = new JSONObject();
|
|
|
|
|
fileJson.put("key", putKeys[i]);
|
|
|
|
|
fileJson.put("name", fileNames[i]);
|
|
|
|
|
fileJson.put("file_value", clientFileUrl);
|
|
|
|
|
resultFile.add(fileJson);
|
|
|
|
|
}else {
|
|
|
|
|
List<String> clientBackToFileUrl = clientFiles.stream()
|
|
|
|
|
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status")==2)))
|
|
|
|
|
.sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date")))
|
|
|
|
|
.map(groupBd -> groupBd.getString("file_value"))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
JSONObject fileJson = new JSONObject();
|
|
|
|
|
fileJson.put("key", putKeys[i]);
|
|
|
|
|
fileJson.put("name", fileNames[i]);
|
|
|
|
|
if (clientBackToFileUrl !=null &&clientBackToFileUrl.size() > 0) {
|
|
|
|
|
fileJson.put("file_value", clientBackToFileUrl);
|
|
|
|
|
}
|
|
|
|
|
resultFile.add(fileJson);
|
|
|
|
|
clientFilesIsLess = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
client.put("greenChannel", 1);
|
|
|
|
|
client.put("client_less_file", clientFilesIsLess);
|
|
|
|
|
if (clientFilesIsLess) {
|
|
|
|
|
client.put("client_files", resultFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|