【R】自助进件业务接口开发

master
liuxinxin 5 years ago
parent 19229e1da4
commit b254d278cc

@ -3,7 +3,6 @@ package au.com.royalpay.payment.manage.application.beans;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotEmpty;
@ -77,30 +76,15 @@ public class ClientPreApplyBean {
private String registered_postcode;
@NotEmpty(message = "logo_url can't be null")
private String logo_url;
@NotEmpty(message = "company_website can't be null")
private String company_website;
@NotEmpty(message = "company_photo can't be null")
private String company_photo;
@NotEmpty(message = "royalpayindustry can't be null")
//@NotEmpty(message = "royalpayindustry can't be null")
private String royalpayindustry;
@NotEmpty(message = "alipayindustry can't be null")
//@NotEmpty(message = "alipayindustry can't be null")
private String alipayindustry;
/* private String contact_job;
private String representative_person;
private String representative_phone;
private String representative_email;
private String representative_job_title;
private String registered_address;
private String registered_suburb;
private String registered_state;
private String registered_postcode;
private String logo_url;
private String company_website;
private String company_photo;
private String royalpayindustry;
private String alipayindustry;*/
private String store_photo;
private String contract_url;//合同地址
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
@ -410,4 +394,20 @@ public class ClientPreApplyBean {
public void setAlipayindustry(String alipayindustry) {
this.alipayindustry = alipayindustry;
}
public String getContract_url() {
return contract_url;
}
public void setContract_url(String contract_url) {
this.contract_url = contract_url;
}
public String getStore_photo() {
return store_photo;
}
public void setStore_photo(String store_photo) {
this.store_photo = store_photo;
}
}

@ -89,6 +89,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
private SignInAccountService signInAccountService;
@Resource
private SimpleClientApplyService simpleClientApplyService;
@Resource
private ClientFilesMapper clientFilesMapper;
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientAccountMapper clientAccountMapper;
@ -112,8 +114,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Resource
private ClientBDMapper clientBDMapper;
private ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 10, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/09/06/1567741055646_qeWC7kwqEwsJjRHisJSyAjqnB9nnnh.pdf";
private static final String CLIENT_AGREE_FILE = "client_agree_file";
@Resource
private SmsSender smsSender;
@Resource
@ -363,7 +365,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
JSONObject rate = test.getJSONObject("t"+clean_days.trim());
apply.put("wechat_rate",rate.getString("Wechat"));
apply.put("alipay_rate",rate.getString("Alipay"));
apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
@ -401,22 +402,27 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
ImageIO.write(img, "png", out);
apply.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
return exportImgAggregateFile(username, apply);
return exportImgAggregateFile(apply);
}
private JSONObject exportImgAggregateFile(String username, JSONObject apply) throws IOException{
private JSONObject exportImgAggregateFile(JSONObject apply) throws IOException{
InputStream stream = null;
JSONObject contractInfo = new JSONObject();
try {
PdfUtils pdu = new PdfUtils();
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(apply);
File file = new File(username + "_agreement.pdf");
File file = new File(apply.getString("username") + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H");
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, username + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
JSONObject fileInfo = attachmentClient.uploadFile(stream, apply.getString("username") + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
contractInfo.put("contract_url",fileInfo.getString("url"));
JSONObject applyInfo = new JSONObject();
applyInfo.put("client_pre_apply_id", apply.getIntValue("client_pre_apply_id"));
applyInfo.put("update_time", new Date());
applyInfo.put("contract_url",fileInfo.getString("url"));
sysClientPreMapperMapper.update(applyInfo);
} catch (Exception e) {
logger.error("合同制作出现问题:", e);
throw new BadRequestException("合同制作出现问题:" + e.getMessage());
@ -476,6 +482,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("logo_url", apply.getString("logo_url"));
sysClient.put("company_website", apply.getString("company_website"));
sysClient.put("company_photo", apply.getString("company_photo"));
sysClient.put("store_photo",apply.getString("store_photo"));
sysClient.put("contact_email", apply.getString("contact_email"));
sysClient.put("contact_phone", "+61"+apply.getString("contact_phone"));
sysClient.put("company_phone", apply.getString("company_phone"));
@ -498,6 +505,20 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("ali_sub_merchant_id", clientMoniker);
clientMapper.save(sysClient);
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", sysClient.getIntValue("client_id"));
fileJson.put("last_update_date", new Date());
//fileJson.put("last_update_by", manager.getString("display_name"));
fileJson.put("file_name", CLIENT_AGREE_FILE);
fileJson.put("file_value", apply.getString("contact_url"));
fileJson.put("signature_time", new Date());
//fileJson.put("signature_ip", manager.getString("signature_ip"));
//fileJson.put("user_agent", manager.getString("user_agent"));
//fileJson.put("signature_account_id", signatureAccountId);
fileJson.put("status", 0);
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id", sysClient.getIntValue("client_id"));
representativeInfo.put("representative_person", apply.getString("representative_person"));

@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.application.beans.ClientPreApplyStep1Bean;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
@ -24,6 +25,8 @@ public class SimpleClientApplyController {
private SimpleClientApplyService simpleClientApplyService;
@Resource
private SysConfigManager sysConfigManager;
@Resource
private AttachmentClient attachmentClient;
@GetMapping("/account/check")
public void checkAccountName(@RequestParam String nation_code,@RequestParam String phone) {
@ -83,6 +86,11 @@ public class SimpleClientApplyController {
return simpleClientApplyService.getClientAggregateFile(username, file,clean_days);
}
@PostMapping("/risk/business/upload/files")
public JSONObject uploadImage(@RequestParam MultipartFile file) throws Exception {
return attachmentClient.uploadFile(file, false);
}
@GetMapping("/info/bank/{bsb_no}")
public JSONObject getBankInfo(@PathVariable String bsb_no, @RequestParam String username, @RequestParam String codeKey) {
simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, codeKey);

@ -385,6 +385,23 @@
<input type="text" class="form-control" ng-model="partner.company_name" name="company_name"
placeholder="Company Name" required maxlength="80">
</div>
<div class="form-group">
<label class="control-label col-sm-2">* Logo</label>
<div class="col-sm-8">
<div class="form-control-static">
<button class="btn btn-success" type="button"
ngf-select="uploadLogo($file)"
accept="image/*">
<i class="fa fa-upload"></i> Upload Logo
</button>
</div>
<uib-progressbar value="logoProgress.value"
ng-if="logoProgress"></uib-progressbar>
<img ng-src="{{partner.logo_url}}" ng-if="partner.logo_url" style="height: 100px;">
</div>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.abn.$invalid && companyForm.abn.$dirty}">
<input class="form-control" ng-model="partner.abn" placeholder="ABN"
@ -567,6 +584,24 @@
MiniProgram</a>
</div>
</div>
<div class="form-group" ng-if="partner.client_pay_type.indexOf('1')>=0"
ng-class="{'has-error':partnerForm.company_website.$invalid && partnerForm.company_website.$dirty}">
<label class="control-label col-sm-2" for="company_website-input">*
Website</label>
<div class="col-sm-8">
<input type="text" name="company_website" class="form-control"
ng-model="partner.company_website"
id="company_website-input" required maxlength="200">
<div ng-messages="partnerForm.company_website.$error"
ng-if="partnerForm.company_website.$dirty">
<p class="small text-danger" ng-message="required">Required
Field</p>
<p class="small text-danger" ng-message="maxlength">Less
Than 200
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div ng-if="partner.client_pay_type.indexOf('2')>=0">
<div class="form-group"
ng-class="{'has-error':partnerForm.client_offline.$invalid && partnerForm.client_offline.$dirty}">
@ -595,6 +630,38 @@
</div>
</div>
</div>
<div class="form-group" ng-if="partner.client_pay_type.indexOf('2')>=0">
<label class="control-label col-sm-2">* Shop Photo</label>
<div class="col-sm-4">
<div class="form-control-static"><em>1:</em>&nbsp;
<button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Shop Photo1
</button>
</div>
<uib-progressbar value="shopPhotoProgress.value"
ng-if="shopPhotoProgress"></uib-progressbar>
<a target="_blank" ng-if="partner.company_photo" ng-href="{{partner.company_photo}}">
<img ng-src="{{partner.company_photo}}"
ng-if="partner.company_photo"
class="thumbnail img-size col-sm-9">
</a>
</div>
<div class="col-sm-4">
<div class="form-control-static"><em>2:</em>&nbsp;
<button class="btn btn-primary" type="button"
ngf-select="uploadStorePhoto($file)" accept="image/*">
<i class="fa fa-upload"></i> Upload Shop Photo2
</button>
</div>
<uib-progressbar value="storePhotoProgress.value"
ng-if="storePhotoProgress"></uib-progressbar>
<a target="_blank" ng-if="partner.store_photo" ng-href="{{partner.store_photo}}">
<img ng-src="{{partner.store_photo}}" ng-if="partner.store_photo"
class="thumbnail img-size col-sm-9">
</a>
</div>
</div>
<div ng-if="partner.client_pay_desc.indexOf('203')>=0">
<div class="form-group"
ng-class="{'has-error':partnerForm.client_offline.$invalid && partnerForm.client_offline.$dirty}">
@ -796,225 +863,6 @@
</div>
</div>
</form>
<!-- <form novalidate name="materialsForm" action="" method="post" ng-show="chooseArray[4]">
<div class="form-horizontal" style="text-align: left">
<div class="form-group">
<label class="control-label col-sm-2">* Shop Photo</label>
<div class="col-sm-5">
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadShopPhoto($file)" accept="image/*" ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo1
</button>
</div>
<uib-progressbar value="shopPhotoProgress.value"
ng-if="shopPhotoProgress"></uib-progressbar>
<img ng-src="{{partner.company_photo}}" ng-if="partner.company_photo"
class="thumbnail img-size col-sm-9">
</div>
<div class="col-sm-5">
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadStorePhoto($file)" accept="image/*"
ngf-max-size="2MB">
<i class="fa fa-upload"></i> Upload Shop Photo2
</button>
</div>
<uib-progressbar value="storePhotoProgress.value"
ng-if="storePhotoProgress"></uib-progressbar>
<img ng-src="{{partner.store_photo}}" ng-if="partner.store_photo"
class="thumbnail img-size col-sm-9">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Logo</label>
<div class="col-sm-8">
<div class="form-control-static">
<button class="btn btn-success" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB">
<i class="fa fa-upload"></i> Upload Logo
</button>
</div>
<uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar>
<img ng-src="{{partner.logo_url}}" ng-if="partner.logo_url" style="height: 100px;">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">* bank statement</label>
<div class="col-sm-4">
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadBankFile($file)">
<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>
<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>
<a ng-if="bankIsImage" target="_blank" ng-href="{{file.client_bank_file}}">
<img ng-src="{{file.client_bank_file}}" class="col-sm-8"></a>
</div>
<div class="col-sm-6">
<div class="form-control-static">
<p>Example请保证图片信息清晰可见,如下图</p>
<img class="col-sm-6 img-responsive" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/03/07/1488859920633_5ruVtDa30yY2ytBSDAAqxg0Ob2nreh.jpeg">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">* Certificate of Registration</label>
<div class="col-sm-4">
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadCompanyFile($file)">
<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>
<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="companyFileProgress.value"
ng-if="companyFileProgress"></uib-progressbar>
<a ng-if="companyIsImage" ng-href="{{file.client_company_file}}" target="_blank">
<img ng-src="{{file.client_company_file}}" class="col-sm-8"></a>
</div>
<div class="col-sm-6">
<div class="form-control-static">
<div class="col-sm-6">
<p>Example公司请提供以下文件图片</p>
<img class="col-xs-12 img-responsive" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/03/07/1488865011738_mW91ylSb5V1NJYu8jxvBPGNN49Zyel.jpeg">
&lt;!&ndash;<img class="col-sm-12" src="https://file.royalpay.com.au/open/2017/03/07/1488864017622_BppIfz1yhMeoF0Z49rHt2gZIfVOihA.jpeg">&ndash;&gt;
</div>
<div class="col-sm-6">
<p>sole
trade个体户),partnership合伙,trust信托请在http://abr.business.gov.au将查询结果截图上传</p>
<img class="col-sm-12 img-responsive" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/03/07/1488860564017_37spL6phUySM27oRtO4cQ7FOJblYJ6.jpeg">
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">* ID </label>
<div class="col-sm-4">
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadIDFile($file)">
<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>
<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="idFileProgress.value"
ng-if="idFileProgress"></uib-progressbar>
<a ng-if="idIsImage" ng-href="{{file.client_id_file}}" target="_blank">
<img ng-src="{{file.client_id_file}}" class="col-sm-8"></a>
</div>
<div class="col-sm-6">
<div class="form-control-static">
<div class="col-sm-6">
<p>Example请保证图片(护照或驾照)信息清晰可见,如下图</p>
<img class="col-xs-12 img-responsive" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/06/29/1498725651779_OPiqOP1dGnTpaxPsCR3P9lVrp4384b.jpg">
</div>
<div class="col-sm-6">
<br/>
<br/>
<img class="col-sm-12 img-responsive" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/06/29/1498725678615_Bv2tzUtihY5U6YK9ScveXzKkVWOnrF.jpg">
</div>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2">* Agreement</label>
<div class="col-sm-4">
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadAgreementFile($file)">
<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>
<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="agreementFileProgress.value"
ng-if="agreementFileProgress"></uib-progressbar>
<a ng-if="agreeIsImage" target="_blank" ng-href="{{file.client_agree_file}}">
<img ng-src="{{file.client_agree_file}}" class="col-sm-8"></a>
</div>
<div class="col-sm-6">
<div class="form-control-static">
<p>Example请保证图片信息清晰可见,如下图</p>
<img class="col-sm-6 img-responsive" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/06/15/1497454561900_5mf5KC4WGkXyFynv025JlTukAq8BqX.png">
</div>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2">Application Form(optional)</label>
<div class="col-sm-4">
<div class="form-control-static">
<button class="btn btn-primary" type="button"
ngf-select="uploadApplyFile($file)">
<i class="fa fa-upload"></i> Upload
</button>
<a ng-if="file.client_apply_file" role="button"
class="btn-group btn btn-warning" type="button"
ng-href="{{file.client_apply_file}}" target="_blank"><i
class="fa fa-download"></i></a>
<i class="fa fa-check-square-o check-i" style="float: none"
aria-hidden="true" ng-if="$root.complianceCheck.authFile"></i>
</div>
<uib-progressbar value="bankFileProgress.value"
ng-if="applyFileProgress"></uib-progressbar>
<a ng-if="applyIsImage" target="_blank" ng-href="{{file.client_apply_file}}">
<img ng-src="{{file.client_apply_file}}" class="col-sm-8"></a>
</div>
<div class="col-sm-6">
<div class="form-control-static">
<p>Example请保证图片信息清晰可见,如下图</p>
<img class="col-sm-6 img-responsive" style="border: 1px solid #ddd"
src="https://file.royalpay.com.au/open/2017/06/15/1497454548133_uSn0TP2uQNLEfnMB57CMrxG2jTOWHG.png">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<button type="button" class="btn btn-success btn-block btn-flat"
ng-click="submit(materialsForm)">Submit
</button>
<div>
<p ng-if="resError" style="padding: 6px 12px;font-size: 14px;"
class="small text-danger">{{resError}}</p>
</div>
</div>
</div>
</form>-->
<form ng-show="chooseArray[4]">
<div class="success_img">
<img height="60" width="60" src="static/images/step/gou.png">

@ -496,7 +496,7 @@ angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('app
} else {
$scope.logoProgress = {value: 0};
Upload.upload({
url: '/risk/business/upload/files',
url: '/register/risk/business/upload/files',
data: {file: file}
}).then(function (resp) {
delete $scope.logoProgress;
@ -504,7 +504,8 @@ angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('app
$scope.partner.logo_url = resp.data.url;
}, function (resp) {
delete $scope.logoProgress;
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
/*commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})*/
alert(resp.data.message);
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
@ -512,4 +513,50 @@ angular.module('applyPartnerApp', ['ngMessages','ngFileUpload']).controller('app
}
};
$scope.uploadShopPhoto = function (file) {
if (file != null) {
if (file.size > 2 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
} else {
$scope.shopPhotoProgress = {value: 0};
Upload.upload({
url: '/register/risk/business/upload/files',
data: {file: file}
}).then(function (resp) {
delete $scope.shopPhotoProgress;
$scope.partner.company_photo = resp.data.url;
}, function (resp) {
delete $scope.shopPhotoProgress;
/*commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})*/
alert(resp.data.message);
}, function (evt) {
$scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
}
};
$scope.uploadStorePhoto = function (file) {
if (file != null) {
if (file.size > 2 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB请压缩后重试', type: 'error'})
} else {
$scope.storePhotoProgress = {value: 0};
Upload.upload({
url: '/register/risk/business/upload/files',
data: {file: file}
}).then(function (resp) {
delete $scope.storePhotoProgress;
$scope.partner.store_photo = resp.data.url;
}, function (resp) {
delete $scope.storePhotoProgress;
/*commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})*/
alert(resp.data.message);
}, function (evt) {
$scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total);
})
}
}
};
}]);

Loading…
Cancel
Save