@ -918,17 +918,31 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
clientMapper . update ( info ) ;
if ( StringUtils . isNotBlank ( info . getString ( "representative_person" ) ) ) {
JSONObject legal = new JSONObject ( ) ;
legal . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
legal . put ( "representative_person" , info . getString ( "representative_person" ) ) ;
legal . put ( "job_title" , info . getString ( "representative_job_title" ) ) ;
legal . put ( "phone" , info . getString ( "representative_phone" ) ) ;
legal . put ( "email" , info . getString ( "representative_email" ) ) ;
legal . put ( "address" , info . getString ( "registered_address" ) ) ;
legal . put ( "suburb" , info . getString ( "registered_suburb" ) ) ;
legal . put ( "state" , info . getString ( "registered_state" ) ) ;
legal . put ( "postcode" , info . getString ( "registered_postcode" ) ) ;
sysClientLegalPersonMapper . update ( legal ) ;
JSONObject legalInfo = sysClientLegalPersonMapper . findRepresentativeInfo ( clientId ) ;
if ( legalInfo ! = null ) {
legalInfo . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
legalInfo . put ( "representative_person" , info . getString ( "representative_person" ) ) ;
legalInfo . put ( "job_title" , info . getString ( "representative_job_title" ) ) ;
legalInfo . put ( "phone" , info . getString ( "representative_phone" ) ) ;
legalInfo . put ( "email" , info . getString ( "representative_email" ) ) ;
legalInfo . put ( "address" , info . getString ( "registered_address" ) ) ;
legalInfo . put ( "suburb" , info . getString ( "registered_suburb" ) ) ;
legalInfo . put ( "state" , info . getString ( "registered_state" ) ) ;
legalInfo . put ( "postcode" , info . getString ( "registered_postcode" ) ) ;
sysClientLegalPersonMapper . update ( legalInfo ) ;
} else {
JSONObject legal = new JSONObject ( ) ;
legal . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
legal . put ( "representative_person" , info . getString ( "representative_person" ) ) ;
legal . put ( "job_title" , info . getString ( "representative_job_title" ) ) ;
legal . put ( "phone" , info . getString ( "representative_phone" ) ) ;
legal . put ( "email" , info . getString ( "representative_email" ) ) ;
legal . put ( "address" , info . getString ( "registered_address" ) ) ;
legal . put ( "suburb" , info . getString ( "registered_suburb" ) ) ;
legal . put ( "state" , info . getString ( "registered_state" ) ) ;
legal . put ( "postcode" , info . getString ( "registered_postcode" ) ) ;
sysClientLegalPersonMapper . save ( legal ) ;
}
}
saveOrUpdateMailList ( info , client ) ;
clientInfoCacheSupport . clearClientCache ( clientId ) ;
@ -1105,6 +1119,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientModifySupport . processClientModify ( auditModify ) ;
sendCommissionWechatMessage ( client ) ; // wxMessage
if ( pass = = 1 ) {
createKycAuthStatus ( manager , client ) ;
clientModifySupport . processClientConfigModify ( new SwitchPermissionModify ( manager , clientMoniker , "skip_clearing" , false ) ) ;
if ( client . getIntValue ( "source" ) = = 4 ) {
List < JSONObject > accounts = clientAccountMapper . listAdminAccounts ( client . getIntValue ( "client_id" ) ) ;
@ -1126,6 +1141,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientInfoCacheSupport . clearClientCache ( client . getIntValue ( "client_id" ) ) ;
}
public void createKycAuthStatus ( JSONObject manager , JSONObject client ) {
JSONObject fileComp = new JSONObject ( ) ;
fileComp . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
fileComp . put ( "submit_time" , new Date ( ) ) ;
fileComp . put ( "status" , 1 ) ;
fileComp . put ( "source" , 2 ) ;
fileComp . put ( "commit_by_id" , manager . getString ( "display_name" ) ) ;
fileComp . put ( "type" , 2 ) ;
fileComp . put ( "is_valid" , 1 ) ;
clientComplianceCompanyMapper . save ( fileComp ) ;
}
@Override
public void auditClientGreenChannel ( JSONObject manager , String clientMoniker ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
@ -3404,6 +3431,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for ( JSONObject file : clientFiles ) {
fileJson . put ( file . getString ( "file_name" ) , file . getString ( "file_value" ) ) ;
}
String [ ] fileKeys = { "kyc_utility_bill_file" } ;
if ( clientFiles . size ( ) > 0 ) {
for ( String fileKey : fileKeys ) {
List < JSONObject > clientFileUrl = clientFiles . stream ( )
. filter ( json - > ( fileKey . 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 ( "file_value" , json . getString ( "file_value" ) ) ;
return params ;
} )
. collect ( Collectors . toList ( ) ) ;
if ( clientFileUrl ! = null & & clientFileUrl . size ( ) > 0 ) {
fileJson . put ( fileKey , clientFileUrl ) ;
}
}
}
return fileJson ;
}
@ -3423,7 +3469,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public JSONObject getAllAuthFiles ( JSONObject manager , String clientMoniker ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
String [ ] fileKeys = { "client_bank_file" , "client_company_file" , "client_id_file" , "client_agree_file" , "client_apply_file" };
String [ ] fileKeys = { "client_bank_file" , "client_company_file" , "client_id_file" , "client_agree_file" , "client_apply_file" ,"kyc_utility_bill_file" };
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
@ -3452,7 +3498,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public JSONObject getAllKycFiles ( JSONObject manager , String clientMoniker ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
String [ ] fileKeys = { "client_ bank _file", "kyc_utility_bill_file" , "client_id_file" } ;
String [ ] fileKeys = { "client_ company _file", "kyc_utility_bill_file" , "client_id_file" } ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
@ -3541,9 +3587,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try {
updateSysClientFiles ( manager , clientId , CLIENT_AGREE_FILE , filesInfo . getFile_agreement_info ( ) ) ;
updateSysClientFiles ( manager , clientId , CLIENT_APPLY_FILE , filesInfo . getFile_apply_info ( ) ) ;
updateSysClientFiles ( manager , clientId , CLIENT_BANK_FILE , filesInfo . getFile_bank_info ( ) ) ;
updateSysClientFiles ( manager , clientId , CLIENT_COMPANY_FILE , filesInfo . getFile_company_info ( ) ) ;
updateSysClientFiles ( manager , clientId , CLIENT_ID_FILE , filesInfo . getFile_id_info ( ) ) ;
updateSysClientFilesWithoutRepeat ( manager , clientId , CLIENT_BANK_FILE , filesInfo . getFile_bank_info ( ) ) ;
updateSysClientFilesWithoutRepeat ( manager , clientId , CLIENT_COMPANY_FILE , filesInfo . getFile_company_info ( ) ) ;
updateSysClientFilesWithoutRepeat ( manager , clientId , CLIENT_ID_FILE , filesInfo . getFile_id_info ( ) ) ;
updateSysClientFiles ( manager , clientId , KYC_UTILITY_BILL_FILE , filesInfo . getUtility_bill_info ( ) ) ;
} catch ( Exception e ) {
logger . error ( "上传合规文件失败" , e ) ;
}
@ -3563,7 +3610,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
int clientId = client . getIntValue ( "client_id" ) ;
try {
updateSysClientFiles ( manager , clientId , CLIENT_ BANK_FILE, filesInfo . getFile_bank _info( ) ) ;
updateSysClientFiles ( manager , clientId , CLIENT_ COMPANY_FILE, filesInfo . getFile_company _info( ) ) ;
updateSysClientFiles ( manager , clientId , CLIENT_ID_FILE , filesInfo . getFile_id_info ( ) ) ;
updateSysClientFiles ( manager , clientId , KYC_UTILITY_BILL_FILE , filesInfo . getUtility_bill_info ( ) ) ;
} catch ( Exception e ) {
@ -3603,7 +3650,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
int clientId = client . getIntValue ( "client_id" ) ;
try {
updateFilesForWaitAuditWithoutRepeat ( manager , clientId , CLIENT_ BANK_FILE, filesInfo . getFile_bank _info( ) , fileResult ) ;
updateFilesForWaitAuditWithoutRepeat ( manager , clientId , CLIENT_ COMPANY_FILE, filesInfo . getFile_company _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 ) {
@ -3987,6 +4034,29 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
public void updateSysClientFilesWithoutRepeat ( JSONObject manager , int clientId , String fileType , String fileValue ) {
List < JSONObject > repetitiveFiles = clientFilesMapper . findRepetitiveFilesForDelete ( clientId , fileType ) ;
if ( fileValue ! = null ) {
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" , fileValue ) ;
fileJson . put ( "status" , 1 ) ;
fileJson . put ( "is_valid" , 1 ) ;
clientFilesMapper . save ( fileJson ) ;
logger . info ( clientId + "的fileType文件上传成功" ) ;
if ( repetitiveFiles ! = null ) {
for ( JSONObject repetitiveFile : repetitiveFiles ) {
clientFilesMapper . deleteByClientAndFileId ( repetitiveFile . getString ( "file_id" ) ) ;
}
}
}
}
public void updateSysClientFilesForWaitCompliance ( JSONObject manager , int clientId , String fileType , String fileValue , List < JSONObject > fileResult ) {
if ( fileValue ! = null ) {
String [ ] values = fileValue . split ( "," ) ;
@ -5659,6 +5729,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException ( "The Partner's Bank Account is not config!" ) ;
}
JSONObject representativeInfo = sysClientLegalPersonMapper . findRepresentativeInfo ( client . getIntValue ( "client_id" ) ) ;
if ( representativeInfo = = null ) {
throw new BadRequestException ( "The LegalPersonInfo is not config!Please upgrade the RoyalPay App version" ) ;
}
for ( String str : representativeInfo . keySet ( ) ) {
if ( representativeInfo . getString ( str ) = = null | | ! ( representativeInfo . getString ( str ) . length ( ) > 0 ) | | ! ( client . getString ( "contact_job" ) ! = null & & client . getString ( "contact_job" ) . length ( ) > 0 ) ) {
throw new BadRequestException ( "The LegalPersonInfo is not config!Please upgrade the RoyalPay App version" ) ;
@ -6273,6 +6346,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} } ;
}
@Override
public JSONObject isLessFiles ( JSONObject partner ) {
JSONObject client = clientMapper . findClientByMoniker ( partner . getString ( "client_moniker" ) ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
if ( client . getIntValue ( "approve_result" ) = = 1 & & ( "PINE" . equals ( client . getString ( "client_moniker" ) )
| | "LEOH" . equals ( client . getString ( "client_moniker" ) ) ) ) {
boolean lessKycFiles = isPartnerKycfilesComplete ( partner . getString ( "client_moniker" ) ) ;
partner . put ( "lessKycFiles" , lessKycFiles ) ;
partner . put ( "lessComplianceFiles" , signInAccountService . checkAuthFileStatus ( partner . getJSONObject ( "client" ) ) . getBoolean ( "client_less_file" ) ) ;
}
return partner ;
}
@Override
public boolean isPartnerKycfilesComplete ( String clientMoniker ) {
boolean lessKycFiles = true ;