add 合规文件可以上传多张 & 商户登陆后返还商户合规文件状态

master
luoyang 7 years ago
parent 672d58fec9
commit e4e25acee9

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.mappers.system; package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
@ -20,13 +21,20 @@ public interface ClientFilesMapper {
void update(JSONObject partner); void update(JSONObject partner);
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1 and status = 1")
List<JSONObject> findClientFile(@Param("client_id") int clientId); List<JSONObject> findClientFile(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1")
List<JSONObject> findAllClientFile(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
JSONObject findFileById(@Param("file_id") String file_id); JSONObject findFileById(@Param("file_id") String file_id);
List<JSONObject> findFileByClientAndType(@Param("client_id") int client_id, @Param("file_name") String file_name); List<JSONObject> findFileByClientAndType(@Param("client_id") int client_id, @Param("file_name") String file_name);
void deleteByClientAndType(@Param("client_id") int client_id, @Param("file_id") String file_id);
void confirmAgreeFile(@Param("client_id") int client_id); void confirmAgreeFile(@Param("client_id") int client_id);
} }

@ -3040,18 +3040,30 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
public JSONObject getAuthFiles(JSONObject manager, String clientMoniker) { public JSONObject getAuthFiles(JSONObject manager, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file"};
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
List<JSONObject> clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); List<JSONObject> clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id"));
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
for (JSONObject file : clientFiles) { if (clientFiles != null && clientFiles.size() > 0) {
fileJson.put(file.getString("file_name"), file.getString("file_value")); for (int i = 0; i < fileKeys.length; i++) {
String fileKey = fileKeys[i];
List<String> 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(groupBd -> groupBd.getString("file_value"))
.collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) {
fileJson.put(fileKey, clientFileUrl);
}
}
} }
return fileJson; return fileJson;
} }
@Override @Override
@Transactional
public void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo) { public void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
@ -3113,28 +3125,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
public void updateSysClientFiles(JSONObject manager, int clientId, String fileType, String fileValue) { public void updateSysClientFiles(JSONObject manager, int clientId, String fileType, String fileValue) {
if (fileValue != null) { if (fileValue != null) {
List<JSONObject> existFiles = clientFilesMapper.findFileByClientAndType(clientId, fileType);
JSONObject existFile = null;
if (!CollectionUtils.isEmpty(existFiles)) {
existFile = existFiles.get(0);
}
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
fileJson.put("client_id", clientId); fileJson.put("client_id", clientId);
fileJson.put("last_update_date", new Date()); fileJson.put("last_update_date", new Date());
fileJson.put("last_update_by", manager.getString("display_name")); fileJson.put("last_update_by", manager.getString("display_name"));
if (existFile != null) { fileJson.put("file_name", fileType);
fileJson.put("file_id", existFile.getString("file_id")); fileJson.put("file_value", fileValue);
fileJson.put("file_name", fileType); fileJson.put("status", 1);
fileJson.put("file_value", fileValue); fileJson.put("is_valid", 1);
clientFilesMapper.update(fileJson); clientFilesMapper.save(fileJson);
logger.info(clientId + "的fileType文件更新成功"); logger.info(clientId + "的fileType文件上传成功");
} else {
fileJson.put("file_name", fileType);
fileJson.put("file_value", fileValue);
clientFilesMapper.save(fileJson);
logger.info(clientId + "的fileType文件上传成功");
}
} }
} }

@ -42,10 +42,7 @@ import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -162,32 +159,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
} }
client.putAll(clientConfigService.find(client_id)); client.putAll(clientConfigService.find(client_id));
client = clientInfoWithNoSecretInfo(client); client = clientInfoWithNoSecretInfo(client);
if (client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10) { checkAuthFileStatus(client);
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);
}
}
if (client.getInteger("parent_client_id") != null) { if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfoIgnoreInvalid(client.getIntValue("parent_client_id")); JSONObject rootPartner = clientManager.getClientInfoIgnoreInvalid(client.getIntValue("parent_client_id"));
rootPartner.putAll(clientConfigService.find(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; 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);
}
}
}
} }

@ -5,17 +5,19 @@
select * from sys_files select * from sys_files
where client_id = #{client_id} where client_id = #{client_id}
and file_name = #{file_name} and file_name = #{file_name}
and status = 1
and is_valid = 1
order by last_update_date desc order by last_update_date desc
</select> </select>
<select id="deleteByClientAndType" resultType="com.alibaba.fastjson.JSONObject">
update from sys_files set is_valid = 0
where client_id = #{client_id}
and file_id = #{file_id}
</select>
<update id="confirmAgreeFile"> <update id="confirmAgreeFile">
update sys_files update sys_files
set state = 2 set state = 2
where file_name = 'source_agree_file' where file_name = 'source_agree_file'
and client_id = #{client_id} and client_id = #{client_id}
</update> </update>
<select id="findClientFile" resultType="com.alibaba.fastjson.JSONObject">
select * from sys_files
where client_id = #{client_id}
order by last_update_date
</select>
</mapper> </mapper>

@ -26,8 +26,10 @@
<i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i> <i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i>
</div> </div>
<uib-progressbar value="bankFileProgress.value" ng-if="bankFileProgress"></uib-progressbar> <uib-progressbar value="bankFileProgress.value" ng-if="bankFileProgress"></uib-progressbar>
<a ng-if="bankIsImage" target="_blank" ng-href="{{file.client_bank_file}}"> <a ng-if="bankIsImage" target="_blank" ng-repeat="src in file.client_bank_file" ng-href="{{src}}">
<img ng-src="{{file.client_bank_file}}" class="col-sm-8"></a> <img ng-src="{{src}}" class="col-sm-8">
</a>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-control-static"> <div class="form-control-static">
@ -50,8 +52,8 @@
<i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i> <i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i>
</div> </div>
<uib-progressbar value="companyFileProgress.value" ng-if="companyFileProgress"></uib-progressbar> <uib-progressbar value="companyFileProgress.value" ng-if="companyFileProgress"></uib-progressbar>
<a ng-if="companyIsImage" ng-href="{{file.client_company_file}}" target="_blank"> <a ng-if="companyIsImage" ng-repeat="src in file.client_company_file" ng-href="{{src}}" target="_blank">
<img ng-src="{{file.client_company_file}}" class="col-sm-8"></a> <img ng-src="{{src}}" class="col-sm-8"></a>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-control-static"> <div class="form-control-static">
@ -82,8 +84,8 @@
<i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i> <i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i>
</div> </div>
<uib-progressbar value="idFileProgress.value" ng-if="idFileProgress"></uib-progressbar> <uib-progressbar value="idFileProgress.value" ng-if="idFileProgress"></uib-progressbar>
<a ng-if="idIsImage" ng-href="{{file.client_id_file}}" target="_blank"> <a ng-if="idIsImage" ng-repeat="src in file.client_id_file" ng-href="{{src}}" target="_blank">
<img ng-src="{{file.client_id_file}}" class="col-sm-8"></a> <img ng-src="{{src}}" class="col-sm-8"></a>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-control-static"> <div class="form-control-static">
@ -115,8 +117,8 @@
<i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i> <i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i>
</div> </div>
<uib-progressbar value="agreementFileProgress.value" ng-if="agreementFileProgress"></uib-progressbar> <uib-progressbar value="agreementFileProgress.value" ng-if="agreementFileProgress"></uib-progressbar>
<a ng-if="agreeIsImage" target="_blank" ng-href="{{file.client_agree_file}}"> <a ng-if="agreeIsImage" target="_blank" ng-repeat="src in file.client_agree_file" ng-href="{{src}}">
<img ng-src="{{file.client_agree_file}}" class="col-sm-8"></a> <img ng-src="{{src}}" class="col-sm-8"></a>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-control-static"> <div class="form-control-static">
@ -141,8 +143,8 @@
<i class="fa fa-check-square-o check-i" style="float: none" aria-hidden="true"ng-if="$root.complianceCheck.authFile"></i> <i class="fa fa-check-square-o check-i" style="float: none" aria-hidden="true"ng-if="$root.complianceCheck.authFile"></i>
</div> </div>
<uib-progressbar value="bankFileProgress.value" ng-if="applyFileProgress"></uib-progressbar> <uib-progressbar value="bankFileProgress.value" ng-if="applyFileProgress"></uib-progressbar>
<a ng-if="applyIsImage" target="_blank" ng-href="{{file.client_apply_file}}"> <a ng-if="applyIsImage" target="_blank" ng-repeat="src in file.client_apply_file" ng-href="{{src}}">
<img ng-src="{{file.client_apply_file}}" class="col-sm-8"></a> <img ng-src="{{src}}" class="col-sm-8"></a>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-control-static"> <div class="form-control-static">

Loading…
Cancel
Save