add 代码优化、移动端新增合规文件状态

master
luoyang 5 years ago
parent 94ad879dc5
commit 263fbf42f4

@ -194,6 +194,8 @@ public interface RetailAppService {
JSONObject toggleCBBankCustomerSurcharge(JSONObject device, boolean customerSurcharge);
JSONObject getClientAuthFileStatus(JSONObject device);
void getCBBankAggregateFile(JSONObject device, HttpServletResponse httpResponse);
void getSourceAggregateFile(JSONObject device, HttpServletResponse httpResponse);

@ -2207,6 +2207,14 @@ public class RetailAppServiceImp implements RetailAppService {
exportAggregateFile(client, httpResponse);
}
@Override
public JSONObject getClientAuthFileStatus(JSONObject device) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject client = clientMapper.findClient(device.getIntValue("client_id"));
return signInAccountService.checkAuthFileStatus(client);
}
@Override
public void getSourceAggregateFile(JSONObject device, HttpServletResponse httpResponse) {
String clientType = device.getString("client_type");

@ -724,6 +724,11 @@ public class RetailAppController {
retailAppService.getCBBankAggregateFile(device, httpResponse);
}
@RequestMapping(value = "/client/auth_file/status", method = RequestMethod.GET)
public JSONObject getClientAuthFileStatus(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientAuthFileStatus(device);
}
/**
*
* @param device

@ -20,9 +20,6 @@ public interface ClientComplianceCompanyMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject partner);
@AutoSql(type = SqlType.SELECT)
JSONObject findFileByClientId(@Param("client_id") int client_id);
}

@ -1,24 +0,0 @@
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.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by yishuqian on 06/03/2017.
*/
@AutoMapper(tablename = "client_authfile_compliance_detail", pkName = "file_detial_id")
public interface ClientComplianceFilesMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject partner);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject partner);
}

@ -28,13 +28,6 @@ public interface ClientFilesMapper {
@AdvanceSelect(addonWhereClause = "is_valid = 1 and status = 0")
List<JSONObject> findClientFileCommit(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1 ")
List<JSONObject> findClientViewFile(@Param("client_id") int clientId);
void updateByFileId(@Param("file_id") String fileId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1")
List<JSONObject> findAllClientFile(@Param("client_id") int clientId);
@ -44,7 +37,7 @@ public interface ClientFilesMapper {
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 deleteByClientAndType(@Param("file_id") String file_id);
void confirmAgreeFile(@Param("client_id") int client_id);

@ -239,11 +239,13 @@ public interface ClientManager {
JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker);
void deleteAuthFiles(JSONObject fileInfo);
void deleteAuthFiles(String fileId);
void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo);
void uploadAuthFilesForClient(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo);
void uploadAuthFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo);
void commitAuthFilesToCompliance(String clientMoniker, JSONObject account);
JSONObject getClientsAnalysis(JSONObject manager);
@ -458,4 +460,6 @@ public interface ClientManager {
List<Integer> listLevel3Client(int client_id);
void updateRefundCreditLine(JSONObject manager, String clientMoniker, JSONObject refundLineInfo);
JSONObject getComplianceFiles(JSONObject account);
}

@ -287,6 +287,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private Locker locker;
@Resource
private MongoTemplate mongoTemplate;
@Resource
private ClientComplianceCompanyMapper clientComplianceCompanyMapper;
@Resource
@ -1985,6 +1987,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public JSONObject getComplianceFiles(JSONObject account) {
JSONObject client = getClientInfo(account.getIntValue("client_id"));
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject file = signInAccountService.checkAuthFileStatusByWEB(client);
file.put("file_company",clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")));
return file;
}
@Override
@Transactional
public void updateClientBDUsers(JSONObject manager, String clientMoniker, JSONObject data) throws Exception {
@ -3089,7 +3102,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
List<JSONObject> clientFiles = clientFilesMapper.findClientViewFile(client.getIntValue("client_id"));
List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
JSONObject fileJson = new JSONObject();
if (clientFiles != null && clientFiles.size() > 0) {
for (String fileKey : fileKeys) {
@ -3100,6 +3113,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject params = new JSONObject();
params.put("file_id", json.getString("file_id"));
params.put("file_value", json.getString("file_value"));
params.put("status", json.getIntValue("status"));
return params;
})
.collect(Collectors.toList());
@ -3113,9 +3127,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
};
@Override
public void deleteAuthFiles(JSONObject fileInfo)
public void deleteAuthFiles(String fileId)
{
clientFilesMapper.updateByFileId(fileInfo.getString("file_id"));
clientFilesMapper.deleteByClientAndType(fileId);
}
@Override
@ -3144,18 +3158,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
@Transactional
public void uploadAuthFilesForClient(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo) {
public void uploadAuthFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
int clientId = client.getIntValue("client_id");
try {
updateSysClientFilesForClient(manager, clientId, CLIENT_AGREE_FILE, filesInfo.getFile_agreement_info());
updateSysClientFilesForClient(manager, clientId, CLIENT_APPLY_FILE, filesInfo.getFile_apply_info());
updateSysClientFilesForClient(manager, clientId, CLIENT_BANK_FILE, filesInfo.getFile_bank_info());
updateSysClientFilesForClient(manager, clientId, CLIENT_COMPANY_FILE, filesInfo.getFile_company_info());
updateSysClientFilesForClient(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info());
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_AGREE_FILE, filesInfo.getFile_agreement_info());
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_APPLY_FILE, filesInfo.getFile_apply_info());
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_BANK_FILE, filesInfo.getFile_bank_info());
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_COMPANY_FILE, filesInfo.getFile_company_info());
updateSysClientFilesForWaitCompliance(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info());
} catch (Exception e) {
logger.error("上传合规文件失败", e);
}
@ -3166,6 +3180,41 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// }
}
@Override
@Transactional
public void commitAuthFilesToCompliance(String clientMoniker, JSONObject account) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
List<JSONObject> clientAllAuthFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
if (clientAllAuthFiles == null || clientAllAuthFiles.size() == 0) {
throw new BadRequestException("Please check the information is uploaded completely");
}
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"};
for (String fileKey : fileKeys) {
if (clientAllAuthFiles.stream().noneMatch(fileJson -> fileKey.equals(fileJson.getString("file_name")))) {
throw new BadRequestException("Please check the information is uploaded completely");
}
}
JSONObject fileComp = clientComplianceCompanyMapper.findFileByClientId(client.getIntValue("client_id"));
if(fileComp == null) {
fileComp = new JSONObject();
fileComp.put("client_id",client.getIntValue("client_id"));
fileComp.put("create_time",new Date());
fileComp.put("status",0);
fileComp.put("commit_by_id",account.getString("account_id"));
clientComplianceCompanyMapper.save(fileComp);
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
} else {
fileComp.put("status",0);
fileComp.put("commit_by_id",account.getString("account_id"));
clientComplianceCompanyMapper.update(fileComp);
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
}
}
@Override
public JSONObject getSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -3218,7 +3267,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
public void updateSysClientFilesForClient(JSONObject manager, int clientId, String fileType, String fileValue) {
public void updateSysClientFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue) {
if (fileValue != null) {
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", clientId);

@ -534,9 +534,9 @@ public class PartnerManageController {
return clientManager.getAllAuthFiles(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void deleteAuthFiles(@PathVariable String clientMoniker, @RequestBody JSONObject fileInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.deleteAuthFiles(fileInfo);
@ManagerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void deleteAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.deleteAuthFiles(fileId);
}
@ManagerMapping(value = "/{clientMoniker}/file", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER})

@ -3,9 +3,6 @@ package au.com.royalpay.payment.manage.merchants.web;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.mappers.system.ClientComplianceCompanyMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientComplianceFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
@ -15,6 +12,7 @@ import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequirePartner;
import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.support.wechatclients.KangaLandWechatApiImpl;
import au.com.royalpay.payment.manage.support.wechatclients.RedpackWechatApiImpl;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
@ -64,15 +62,7 @@ public class PartnerViewController {
@Resource
private ClientComplianceCompanyMapper clientComplianceCompanyMapper;
@Resource
private ClientComplianceFilesMapper clientComplianceFilesMapper;
@Resource
private ClientFilesMapper clientFilesMapper;
@Resource
private ClientMapper clientMapper;
private SignInAccountService signInAccountService;
@Resource
private SimpleClientApplyService simpleClientApplyService;
@ -526,9 +516,7 @@ public class PartnerViewController {
@PartnerMapping(value = "/compliance/clientViewFiles", method = RequestMethod.GET)
@ResponseBody
public JSONObject complianceFiles(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
JSONObject file = clientManager.getClientViewAuthFiles(null,account.getString("client_moniker"));
file.put("file_company",clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")));
return file;
return clientManager.getComplianceFiles(account);
}
/* @PartnerMapping(value = "/{clientMoniker}/clientViewFiles", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT})
@ -558,6 +546,19 @@ public class PartnerViewController {
@PartnerMapping(value = "/update/file", method = RequestMethod.PUT)
@ResponseBody
public void updateFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody ClientAuthFilesInfo filesInfo) {
JSONObject client = account.getJSONObject("client");
if (client.getIntValue("approve_result") != 1 && client.getIntValue("source") == 4){
JSONObject manager = new JSONObject();
manager.put("display_name","client");
clientManager.uploadAuthFiles(manager, account.getString("client_moniker"), filesInfo);
}else {
throw new BadRequestException("已通过审核,暂不能提交和修改");
}
}
@PartnerMapping(value = "/update/wait_compliance_file", method = RequestMethod.PUT)
@ResponseBody
public void updateWaitComplianceFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody ClientAuthFilesInfo filesInfo) {
JSONObject client = account.getJSONObject("client");
/*if (client.getIntValue("approve_result") != 1 && client.getIntValue("source") == 4){
JSONObject manager = new JSONObject();
@ -567,36 +568,22 @@ public class PartnerViewController {
if (true){
JSONObject manager = new JSONObject();
manager.put("display_name","client");
clientManager.uploadAuthFilesForClient(manager, account.getString("client_moniker"), filesInfo);
clientManager.uploadAuthFilesForWaitCompliance(manager, account.getString("client_moniker"), filesInfo);
}else {
throw new BadRequestException("已通过审核,暂不能提交和修改");
}
}
@PartnerMapping(value = "/clientCompliance/viewCommit", method = RequestMethod.PUT)
@PartnerMapping(value = "/clientCompliance/{clientMoniker}/viewCommit", method = RequestMethod.POST)
@ResponseBody
@Transactional
public void clientComplianceViewCommit(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody ClientAuthFilesInfo filesInfo) {
JSONObject client = account.getJSONObject("client");
JSONObject fileComp = clientComplianceCompanyMapper.findFileByClientId(client.getIntValue("client_id"));
if(fileComp == null )
{
fileComp = new JSONObject();
String a = client.getString("client_moniker")+"-"+ RandomStringUtils.random(8, true, true).toUpperCase();
fileComp.put("compliance_id", client.getString("client_moniker")+"-"+ RandomStringUtils.random(8, true, true).toUpperCase());
fileComp.put("client_id",client.getIntValue("client_id"));
fileComp.put("create_time",new Date());
fileComp.put("staus",0);
clientComplianceCompanyMapper.save(fileComp);
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
}else
{
fileComp.put("create_time",new Date());
fileComp.put("staus",0);
clientComplianceCompanyMapper.update(fileComp);
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
}
public void clientComplianceViewCommit(@PathVariable String clientMoniker ,@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.commitAuthFilesToCompliance(clientMoniker, account);
}
@PartnerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public void deleteAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.deleteAuthFiles(fileId);
}
}

@ -58,5 +58,7 @@ public interface SignInAccountService {
void deleteManagerCodeKey(String codekey);
JSONObject checkAuthFileStatusByWEB(JSONObject client);
JSONObject checkAuthFileStatus(JSONObject client);
}

@ -631,6 +631,69 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return RESET_MANAGER_ACCOUNT_PREFIX + codeKey;
}
@Override
public JSONObject checkAuthFileStatusByWEB(JSONObject client) {
JSONObject result = new JSONObject();
result.put("client_less_file", false);
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;
JSONObject resultFile = new JSONObject();
for (int i = 0; i < fileKeys.length; i++) {
String fileKey = fileKeys[i];
if (clientFiles != null && clientFiles.size() > 0) {
List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2)))
.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) {
JSONObject fileJson = new JSONObject();
fileJson.put("key", putKeys[i]);
fileJson.put("name", fileNames[i]);
fileJson.put("file_value", clientFileUrl);
fileJson.put("file_write", false);
resultFile.put(fileKey,fileJson);
} else {
List<JSONObject> clientBackToFileUrl = clientFiles.stream()
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 0 || fileJson.getIntValue("status") == 3)))
.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());
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);
}
fileJson.put("file_write", true);
resultFile.put(fileKey,fileJson);
clientFilesIsLess = true;
}
}
result.put("client_less_file", clientFilesIsLess);
if (clientFilesIsLess) {
result.put("client_files", resultFile);
}
}
}
return result;
}
public JSONObject checkAuthFileStatus(JSONObject client) {
JSONObject result = new JSONObject();
result.put("client_less_file", false);

@ -9,21 +9,10 @@
and is_valid = 1
order by last_update_date desc
</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 sys_files
set state = 2
where file_name = 'source_agree_file'
and client_id = #{client_id}
</update>
<update id="updateByFileId">
update sys_files
set is_valid = 0
where file_id = #{file_id}
</update>
</mapper>

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientComplianceFilesMapper">
</mapper>

@ -10,9 +10,8 @@
order by last_update_date desc
</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}
update sys_files set is_valid = 0
where file_id = #{file_id}
</select>
<update id="confirmAgreeFile">
update sys_files
@ -21,17 +20,12 @@
and client_id = #{client_id}
</update>
<update id="updateByFileId">
update sys_files
set is_valid = 0
where file_id = #{file_id}
</update>
<update id="updateBeforeCompliance">
update sys_files
set status = 2
where client_id = #{client_id}
and is_valid = 1
and (status = 0 or status = 3)
</update>
</mapper>

@ -574,7 +574,6 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
}]);*/
app.controller('partnerDashboardCtrl', ['$scope', '$http', '$filter', '$uibModal','$timeout', 'chartParser','clearingDetailService','commonDialog','company_info', function ($scope, $http, $filter, $uibModal,$timeout, chartParser,clearingDetailService,commonDialog,company_info) {
debugger;
$scope.company_info = company_info.data || {};
$scope.sendMailCount = 0;
$scope.scales = [
@ -981,11 +980,6 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
$uibModal.open({
templateUrl: '/static/payment/partner/templates/compliance_files_advice.html',
backdrop: false,
resolve: {
partner: ['$http', function ($http) {
return $http.get('');
}]
}
})
};

@ -3804,7 +3804,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.deleteComplianceFiles = function (file_id) {
debugger;
$scope.file_id = file_id;
/*$http.put('/sys/partners/' + $scope.partner.client_moniker + '/saveAdditional_content', {additional_content: $scope.partner.additional_content}).then(function (resp) {*/

@ -38,9 +38,9 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}]
}
}).state('basic.compliance_to_perfect', {
url: '/{client_moniker}/compliance_to_prefect',
url: '/compliance_to_prefect',
templateUrl: '/static/payment/partner/templates/client_compliance_to_prefect.html',
controller: 'clientComplianceFilesCtrl',
controller: 'clientCommitToComplianceFilesCtrl',
resolve: {
file: ['$http', function ($http) {
return $http.get('/client/partner_info/compliance/clientViewFiles');
@ -584,6 +584,236 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}
}
};
$scope.uploadCompanyFile = function (file) {
if (file != null) {
if (file.size > 3 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB请压缩后重试', type: 'error'})
} else {
$scope.companyFileProgress = {value: 0};
Upload.upload({
url: '/attachment/files',
data: {file: file}
}).then(function (resp) {
delete $scope.companyFileProgress;
$scope.file.file_company_info = resp.data.url;
$scope.updateFile();
if ($scope.file.file_company_info.endsWith('pdf')) {
$scope.companyIsImage = false;
} else {
$scope.companyIsImage = true;
}
}, function (resp) {
delete $scope.companyFileProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
}
};
//上传ID信息
$scope.uploadIDFile = function (file) {
if (file != null) {
if (file.size > 3 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB请压缩后重试', type: 'error'})
} else {
$scope.idFileProgress = {value: 0};
Upload.upload({
url: '/attachment/files',
data: {file: file}
}).then(function (resp) {
delete $scope.idFileProgress;
$scope.file.file_id_info = resp.data.url;
$scope.updateFile();
if ($scope.file.file_id_info.endsWith('pdf')) {
$scope.idIsImage = false;
} else {
$scope.idIsImage = true;
}
}, function (resp) {
delete $scope.idFileProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.idFileProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
}
};
//上传协议文件
$scope.uploadAgreementFile = function (file) {
if (file != null) {
if (file.size > 10 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过5MB请压缩后重试', type: 'error'})
} else {
$scope.agreementFileProgress = {value: 0};
Upload.upload({
url: '/attachment/files',
data: {file: file}
}).then(function (resp) {
delete $scope.agreementFileProgress;
$scope.file.file_agreement_info = resp.data.url;
$scope.updateFile();
if ($scope.file.file_agreement_info.endsWith('pdf')) {
$scope.agreeIsImage = false;
} else {
$scope.agreeIsImage = true;
}
}, function (resp) {
delete $scope.agreementFileProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.agreementFileProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
}
};
//上传申请表
$scope.uploadApplyFile = function (file) {
if (file != null) {
if (file.size > 3 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB请压缩后重试', type: 'error'})
} else {
$scope.applyFileProgress = {value: 0};
Upload.upload({
url: '/attachment/files',
data: {file: file}
}).then(function (resp) {
delete $scope.applyFileProgress;
$scope.file.file_apply_info = resp.data.url;
$scope.updateFile();
if ($scope.file.file_apply_info.endsWith('pdf')) {
$scope.applyIsImage = false;
} else {
$scope.applyIsImage = true;
}
}, function (resp) {
delete $scope.applyFileProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.applyFileProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
}
};
/* $scope.downloadAsZip = function () {
var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP';
return url;
};
*/
$scope.updateFile = function () {
$http.put('/client/partner_info/update/file', $scope.file).then(function () {
commonDialog.alert({
title: 'Success',
content: 'Upload Successful',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
function commitError() {
commonDialog.alert({
title: 'Error',
content: 'Missing file',
type: 'error'
});
};
$scope.clientComplianceViewCommit= function () {
if(!$scope.file.client_agree_file)
{
commonDialog.alert({title: 'Error', content: '请提交* Agreement', type: 'error'});
return;
}else if(!$scope.file.client_id_file)
{
commonDialog.alert({title: 'Error', content:'请提交* ID', type: 'error'});
return;
}else if(!$scope.file.client_bank_file)
{
commonDialog.alert({title: 'Error', content: '请提交* bank statement', type: 'error'});
return;
}
else if(!$scope.file.client_company_file)
{
commonDialog.alert({title: 'Error', content: '请提交* Certificate of Registration', type: 'error'});
return;
};
$http.post('/client/partner_info/clientCompliance/' + $scope.partner.client_moniker + '/viewCommit', $scope.file).then(function () {
commonDialog.alert({
title: 'Success',
content: 'Upload Successful',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
$scope.deleteComplianceFiles = function (file_id) {
$scope.file_id = file_id;
/*$http.put('/sys/partners/' + $scope.partner.client_moniker + '/saveAdditional_content', {additional_content: $scope.partner.additional_content}).then(function (resp) {*/
$http.put('/client/partner_info/auth_file/' + $scope.file_id + '/delete').then(function (resp) {
$state.reload();
})
};
$scope.commitPartner = function () {
if ($scope.file) {
if ($scope.file.file_bank_info != null && $scope.file.file_company_info != null && $scope.file.file_id_info != null && $scope.file_apply_info != null) {
$http.put('/client/partner_info/compliance_audit').then(function (resp) {
});
} else {
commitError();
}
} else {
commitError();
}
};
}]);
app.controller('clientCommitToComplianceFilesCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) {
$scope.file = file.data || {};
$scope.client_files = file.data.client_files;
//audit files
$scope.uploadBankFile = function (file) {
if (file != null) {
if (file.size > 3 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB请压缩后重试', type: 'error'})
} else {
$scope.bankFileProgress = {value: 0};
Upload.upload({
url: '/attachment/files',
data: {file: file}
}).then(function (resp) {
delete $scope.bankFileProgress;
$scope.file.file_bank_info = resp.data.url;
$scope.updateFile();
if ($scope.file.file_bank_info.endsWith('pdf')) {
$scope.bankIsImage = false;
} else {
$scope.bankIsImage = true;
}
}, function (resp) {
delete $scope.bankFileProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
}
};
$scope.agreeIsImage = true;
if ($scope.file.file_agreement_info && $scope.file.file_agreement_info.endsWith('pdf')) {
$scope.agreeIsImage = false;
@ -720,11 +950,11 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}
};
/* $scope.downloadAsZip = function () {
var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP';
return url;
};
*/
/* $scope.downloadAsZip = function () {
var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP';
return url;
};
*/
$scope.updateFile = function () {
$http.put('/client/partner_info/update/file', $scope.file).then(function () {
commonDialog.alert({
@ -767,7 +997,7 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
return;
};
$http.put('/client/partner_info/clientCompliance/viewCommit', $scope.file).then(function () {
$http.post('/client/partner_info/clientCompliance/' + $scope.partner.client_moniker + '/viewCommit', $scope.file).then(function () {
commonDialog.alert({
title: 'Success',
content: 'Upload Successful',
@ -780,11 +1010,10 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
};
$scope.deleteComplianceFiles = function (file_id) {
debugger;
$scope.file_id = file_id;
/*$http.put('/sys/partners/' + $scope.partner.client_moniker + '/saveAdditional_content', {additional_content: $scope.partner.additional_content}).then(function (resp) {*/
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/delete',{file_id: $scope.file_id}).then(function (resp) {
$http.put('/client/partner_info/auth_file/' + $scope.file_id + '/delete').then(function (resp) {
$state.reload();
})
};
@ -804,7 +1033,6 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}
};
}]);
app.controller('clientPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog','$uibModal', function ($scope, $http, $state, commonDialog, $uibModal) {
$scope.paymentInfo = $scope.partner;
$scope.old_customer_surcharge_rate = angular.copy($scope.partner.customer_surcharge_rate);

@ -6,9 +6,10 @@
<div class="panel panel-default">
<div class="panel-heading">Audit Files &nbsp;&nbsp;&nbsp;
<button class="btn-group btn btn-warning" type="button"
ng-click="clientComplianceViewCommit()" ng-if="file.file_company.staus != 0">Commit to Compliance
ng-click="clientComplianceViewCommit()" ng-if="file.file_company.status != 0 && file.file_company.status!=1">Commit to Compliance
</button>
<p class="btn-group btn btn-warning" ng-if="file.file_company.staus == 0">正在审核中
<p class="btn-group btn btn-warning" ng-if="file.file_company.status == 0">正在审核中
<p class="btn-group btn btn-success" ng-if="file.file_company.status == 1">审核成功
</p>
</div>
<div class="panel-body">
@ -19,10 +20,10 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadBankFile($file)"
ng-if="file.file_company.staus != 0">
ng-if="client_files.client_bank_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_bank_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_bank_file}}" target="_blank"><i class="fa fa-download"></i></a>
<a ng-if="client_files.client_bank_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{client_files.client_bank_file}}" target="_blank"><i class="fa fa-download"></i></a>
<i class="fa fa-check-square-o check-i" aria-hidden="true" style="float: none" ng-if="$root.complianceCheck.authFile"></i>
</div>
<uib-progressbar value="bankFileProgress.value" ng-if="bankFileProgress"></uib-progressbar>
@ -32,13 +33,13 @@
</a>-->
<table>
<tbody>
<tr ng-repeat="file_src in file.client_bank_file track by $index">
<tr ng-repeat="file_src in client_files.client_bank_file.file_value track by $index">
<td ng-bind="$index+1">1</td>
<td><a ng-if="bankIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img ng-src="{{file_src.file_value}}" class="col-sm-8">
</a></td>
<td >
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.file_company.staus != 0">X</button>
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_bank_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
</td>
</tr>
</tbody>
@ -61,7 +62,7 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadCompanyFile($file)"
ng-if="file.file_company.staus != 0">
ng-if="client_files.client_company_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_company_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_company_file}}" target="_blank"><i class="fa fa-download"></i></a>
@ -71,13 +72,13 @@
<!-- <a ng-if="companyIsImage" ng-repeat="src in file.client_company_file" ng-href="{{src}}" target="_blank">
<img ng-src="{{src}}" class="col-sm-8"></a>-->
<table><tbody>
<tr ng-repeat="file_src in file.client_company_file track by $index">
<tr ng-repeat="file_src in client_files.client_company_file.file_value track by $index">
<td ng-bind="$index+1">1</td>
<td><a ng-if="bankIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img ng-src="{{file_src.file_value}}" class="col-sm-8">
</a></td>
<td >
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.file_company.staus != 0">X</button>
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_company_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
</td>
</tr>
</tbody></table>
@ -105,7 +106,7 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadIDFile($file)"
ng-if="file.file_company.staus != 0">
ng-if="client_files.client_id_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_id_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_id_file}}" target="_blank"><i class="fa fa-download"></i></a>
@ -116,13 +117,13 @@
<img ng-src="{{src}}" class="col-sm-8"></a>-->
<table>
<tbody>
<tr ng-repeat="file_src in file.client_id_file track by $index">
<tr ng-repeat="file_src in client_files.client_id_file.file_value track by $index">
<td ng-bind="$index+1">1</td>
<td><a ng-if="bankIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img ng-src="{{file_src.file_value}}" class="col-sm-8">
</a></td>
<td >
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.file_company.staus != 0">X</button>
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_id_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1 ">X</button>
</td>
</tr>
</tbody></table>
@ -151,7 +152,7 @@
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadAgreementFile($file)"
ng-if="file.file_company.staus != 0">
ng-if="client_files.client_agree_file.file_write && file.file_company.status != 0 && file.file_company.status!=1">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_agree_file" role="button" class="btn-group btn btn-warning" type="button" ng-href="{{file.client_agree_file}}" target="_blank"><i class="fa fa-download"></i></a>
@ -162,13 +163,13 @@
<img ng-src="{{src}}" class="col-sm-8"></a>-->
<table>
<tbody>
<tr ng-repeat="file_src in file.client_agree_file track by $index">
<tr ng-repeat="file_src in client_files.client_agree_file.file_value track by $index">
<td ng-bind="$index+1">1</td>
<td><a ng-if="bankIsImage" target="_blank" ng-href="{{file_src.file_value}}">
<img ng-src="{{file_src.file_value}}" class="col-sm-8">
</a></td>
<td >
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="file.file_company.staus != 0">X</button>
<button class="btn-group btn btn-warning" type="button" ng-click="deleteComplianceFiles(file_src.file_id)" ng-if="client_files.client_agree_file.file_write && file_src.status !=1 && file.file_company.status != 0 && file.file_company.status!=1">X</button>
</td>
</tr>
</tbody></table>

Loading…
Cancel
Save