Upd:微信渠道-商户进件功能新接口

master
dulingling 4 years ago
parent d06cb3afa6
commit b6bb133f19

@ -724,3 +724,40 @@ alter pmt_custom_reports add PRIMARY key (report_serial);
alter table sys_org add COLUMN `state` varchar(20) DEFAULT NULL COMMENT '州 (使用标准码 NSW,QLD,WA,VIC,ACT,NT,TAS,SA)';
INSERT INTO `royalpay`.`sys_configs`(`config_key`, `config_value`, `config_desc`) VALUES ('rick_interior_send_email', 'dll19920503@qq.com', '内部调用测试发送邮箱');
--2020-11-24-
alter table sys_wx_merchant_apply modify contact_phone varchar(20) not null;
alter table sys_wx_merchant_apply
add merchant_country_code varchar(3) not null comment '商户国家编码';
alter table sys_wx_merchant_apply
add extra_merchant_type varchar(1) not null comment '商户类型:1.Enterprise 2.Individual';
alter table sys_wx_merchant_apply
add mcc_code varchar(4) not null comment 'Mcc编码';
alter table sys_wx_merchant_apply
add extra_reg_cer_number varchar(50) not null comment '公司注册文件编号';
alter table sys_wx_merchant_apply
add extra_reg_cer_exp_date varchar(10) not null comment '公司注册文件日期,格式:yyyy-MM-dd';
alter table sys_wx_merchant_apply
add stores_address varchar(128) not null comment '店铺地址';
alter table sys_wx_merchant_apply
add business_type varchar(1) not null comment '固定值为3';
alter table sys_wx_merchant_apply
add director_name varchar(128) null comment '董事';
alter table sys_wx_merchant_apply
add director_id_number varchar(128) null comment '董事身份证号';
alter table sys_wx_merchant_apply
add principal_name varchar(128) null comment '负责人';
alter table sys_wx_merchant_apply
add principal_id_number varchar(128) null comment '负责人身份证号';

@ -155,4 +155,11 @@ public interface ClientMapper {
PageList<JSONObject> listCompletedContractKycClients(JSONObject params, PageBounds pageBounds);
int countKycClients(JSONObject params);
/**
*
* @return
*/
List<JSONObject> halfYearHaveTransactionClients(@Param("from") Date fromDate, @Param("to") Date toDate);
}

@ -0,0 +1,284 @@
package au.com.royalpay.payment.manage.merchants.beans;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* Created by yuan on 2018/1/19.
*/
public class NewSubMerchantIdApply {
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 50)
@JSONField(name = "company_name")
private String merchant_name;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 10)
@JSONField(name = "merchant_id")
private String merchant_id;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 20)
@JSONField(name = "store_name")
private String merchant_storename;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 20)
@JSONField(name = "company_phone")
private String office_phone;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 32)
@JSONField(name = "contact_person")
private String contact_name;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 16)
private String contact_phone;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 128)
private String contact_email;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 10)
@JSONField(name = "industry")
private String business_category;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 128)
@JSONField(name = "company_website")
private String website;
//2020-11-16
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 10)
@JSONField(name = "merchant_type")
private String merchant_type;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(max = 4)
@JSONField(name = "mcc_code")
private String mcc_code;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(min = 4, max = 128)
@JSONField(name = "address")
private String address;
@Length(min=1 ,max = 128)
@JSONField(name = "director_name")
private String legal_director_name;
@Length(min=1 ,max = 128)
@JSONField(name = "director_id_number")
private String director_id_number;
@Length(min=1 ,max = 128)
@JSONField(name = "principal_name")
@Length(min=1 ,max = 128)
private String principal_name;
@JSONField(name = "principal_id_number")
private String principal_id_number;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(min=1 ,max = 50)
@JSONField(name = "company_register_no")
private String company_register_no;
@NotBlank(message = "error.payment.valid.param_missing")
@Length(min=1 ,max = 10)
@JSONField(name = "company_register_date")
private String company_register_date;
public JSONObject insertObject(JSONObject client) {
JSONObject params = new JSONObject();
if(StringUtils.isNotEmpty(merchant_name)){
params.put("merchant_name",merchant_name);
}
if(StringUtils.isNotEmpty(merchant_storename)){
params.put("merchant_shortname",merchant_storename);
}
if(StringUtils.isNotEmpty(office_phone)){
params.put("office_phone",office_phone);
}
if(StringUtils.isNotEmpty(contact_name)){
params.put("contact_name",contact_name);
}
if(StringUtils.isNotEmpty(contact_phone)){
params.put("contact_phone",contact_phone);
}
if(StringUtils.isNotEmpty(contact_email)){
params.put("contact_email",contact_email);
}
if(StringUtils.isNotEmpty(business_category)){
params.put("business_category",business_category);
}
if(StringUtils.isNotEmpty(website)){
params.put("website",website);
}
if(StringUtils.isNotEmpty(address)){
params.put("stores_address", address);
}
if(StringUtils.isNotEmpty(company_register_no)){
params.put("extra_reg_cer_number", company_register_no);
}
if(StringUtils.isNotEmpty(company_register_date)){
params.put("extra_reg_cer_exp_date", company_register_date);
}
if(StringUtils.isNotEmpty(merchant_type)){
params.put("extra_merchant_type",merchant_type);
if(StringUtils.equals("1",merchant_type)){
params.put("director_name",legal_director_name);//董事、项目主持人
params.put("director_id_number", director_id_number);
}else{
params.put("principal_name",principal_name);//[企业]主要负责人
params.put("principal_id_number",principal_id_number);
}
}
if(StringUtils.isNotEmpty(mcc_code)){
params.put("mcc_code", mcc_code);
}
params.put("business_type","3");
params.put("merchant_country_code","036");//固定值036-澳大利亚国家编码
params.put("merchant_remark",client.getString("client_moniker"));
return params;
}
public NewSubMerchantIdApply() {
}
public String getMerchant_name() {
return this.merchant_name;
}
public String getMerchant_id() {
return merchant_id;
}
public void setMerchant_id(String merchant_id) {
this.merchant_id = merchant_id;
}
public void setMerchant_name(String merchant_name) {
this.merchant_name = merchant_name;
}
public String getMerchant_storename() {
return this.merchant_storename;
}
public void setMerchant_storename(String merchant_storename) {
this.merchant_storename = merchant_storename;
}
public String getOffice_phone() {
return this.office_phone;
}
public void setOffice_phone(String office_phone) {
this.office_phone = office_phone;
}
public String getContact_name() {
return this.contact_name;
}
public void setContact_name(String contact_name) {
this.contact_name = contact_name;
}
public String getContact_phone() {
return this.contact_phone;
}
public void setContact_phone(String contact_phone) {
this.contact_phone = contact_phone;
}
public String getContact_email() {
return this.contact_email;
}
public void setContact_email(String contact_email) {
this.contact_email = contact_email;
}
public String getBusiness_category() {
return this.business_category;
}
public void setBusiness_category(String business_category) {
this.business_category = business_category;
}
public String getWebsite() {
return this.website;
}
public void setWebsite(String website) {
this.website = website;
}
public void setAddress(String address) {
this.address = address;
}
public String getAddress() {
return this.address;
}
public String getMerchant_type() {
return merchant_type;
}
public void setMerchant_type(String merchant_type) {
this.merchant_type = merchant_type;
}
public String getLegal_director_name() {
return legal_director_name;
}
public void setLegal_director_name(String legal_director_name) {
this.legal_director_name = legal_director_name;
}
public String getDirector_id_number() {
return director_id_number;
}
public void setDirector_id_number(String director_id_number) {
this.director_id_number = director_id_number;
}
public String getPrincipal_name() {
return principal_name;
}
public void setPrincipal_name(String principal_name) {
this.principal_name = principal_name;
}
public String getPrincipal_id_number() {
return principal_id_number;
}
public void setPrincipal_id_number(String principal_id_number) {
this.principal_id_number = principal_id_number;
}
public String getMcc_code() {
return mcc_code;
}
public void setMcc_code(String mcc_code) {
this.mcc_code = mcc_code;
}
public String getCompany_register_no() {
return company_register_no;
}
public void setCompany_register_no(String company_register_no) {
this.company_register_no = company_register_no;
}
public String getCompany_register_date() {
return company_register_date;
}
public void setCompany_register_date(String company_register_date) {
this.company_register_date = company_register_date;
}
}

@ -432,6 +432,8 @@ public interface ClientManager {
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager);
String newSubMerchantApplication(String clientMoniker, NewSubMerchantIdApply subMerchantIdApply, JSONObject manager);
void registerAlipayGms(String clientMoniker, JSONObject manager);
void registerAlipayOnlineGms(String clientMoniker, JSONObject manager);

@ -13,6 +13,7 @@ import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo;
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfoInheritance;
import au.com.royalpay.payment.core.PaymentChannelApi;
import au.com.royalpay.payment.core.beans.EmptyMerchantApplication;
import au.com.royalpay.payment.core.beans.MerchantApplicationResult;
@ -5637,6 +5638,33 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return sub_merchant_id;
}
@Override
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
public String newSubMerchantApplication(String clientMoniker, NewSubMerchantIdApply subMerchantApply, JSONObject manager){
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject params = subMerchantApply.insertObject(client);
SubMerchantInfoInheritance subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfoInheritance.class);
params.put("merchant_id", subMerchantApply.getMerchant_id());
params.put("client_id", client.getString("client_id"));
params.put("create_time", new Date());
params.put("operator", manager.getString("display_name"));
Element elem = wxPayClient.newSubMerchantApplication(subMerchantApply.getMerchant_id(), subMerchantInfo);
String sub_merchant_id = elem.elementText("sub_mch_id");
if (StringUtils.isNotEmpty(sub_merchant_id)) {
params.put("sub_merchant_id", sub_merchant_id);
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
clearCacheSubMerchantIdApplices(clientMoniker);
} else {
throw new BadRequestException(elem.elementText("return_msg"));
}
return sub_merchant_id;
}
@Override
public void registerAlipayGms(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);

@ -837,6 +837,11 @@ public class PartnerManageController {
return clientManager.subMerchantApplication(clientMoniker, subMerchantIdApply, manager);
}
@ManagerMapping(value = "/{clientMoniker}/new_sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public String newSubMerchantApplication(@PathVariable String clientMoniker, @RequestBody NewSubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.newSubMerchantApplication(clientMoniker, subMerchantIdApply, manager);
}
@ManagerMapping(value = "/{clientMoniker}/register/alipay_gms", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void registerAlipayGms(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.registerAlipayGms(clientMoniker, manager);

@ -941,4 +941,15 @@
</if>
</where>
</select>
<select id="halfYearHaveTransactionClients" resultType="com.alibaba.fastjson.JSONObject">
select c.client_moniker from pmt_orders o
left join sys_clients c on o.client_id = c.client_id
where o.create_time &gt;= #{from}
and o.create_time &lt; #{to}
and c.is_valid = 1
-- and (c.company_website is not null and c.alipayindustry is not null and c.business_structure is NOT null)
GROUP BY c.client_id
order by c.bd_user_name
</select>
</mapper>

@ -80,6 +80,132 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
"value": "494"
}
];
var newWxMerchantIndustries = [
{
"label": "Online shopping",
"value": "648"
},
{
"label": "Supermarket",
"value": "649"
},
{
"label": "Convenience Store",
"value": "651"
},
{
"label": "Duty-free Shop",
"value": "652"
},
{
"label": "Pharmacy",
"value": "653"
},
{
"label": "Vending Machine",
"value": "654"
},
{
"label": "Department Store /Shopping Centre",
"value": "655"
},
{
"label": "Food/Beverages",
"value": "656"
},
{
"label": "Catering Services",
"value": "657"
},
{
"label": "Furniture/Household Products",
"value": "658"
},
{
"label": "Home Appliances/Camera Equipment/Office Equipment",
"value": "659"
},
{
"label": "Beauty/Personal Care Products",
"value": "660"
},{
"label": "Flowers/Plants/Interior Decorations/Decorations",
"value": "661"
},
{
"label": "Nursery Products/Toys",
"value": "662"
},
{
"label": "Clothing/Shoes/Other Accessories",
"value": "663"
},
{
"label": "Sports/Fitness Equipment/Security",
"value": "664"
},
{
"label": "Watches/Eyewear/Jewellery",
"value": "665"
},
{
"label": "Outdoor Products /Travel Products",
"value": "666"
},
{
"label": "Books / Records / Stationery / Musical Instruments",
"value": "667"
},
{
"label": "Flight ticket/ticketing agent",
"value": "668"
},
{
"label": "Sightseeing Passes",
"value": "669"
},
{
"label": "Hotel/Resor",
"value": "670"
},
{
"label": "Online Books/Video/Music",
"value": "671"
},
{
"label": "Online games (Download)",
"value": "672"
},
{
"label": "University Education",
"value": "677"
},
{
"label": "Private hospitals/Clinics/Medical institutions",
"value": "678"
},
{
"label": "Public hospitals/Medical Institutions",
"value": "679"
},
{
"label": "Public transit",
"value": "680"
},
{
"label": "Car Rental",
"value": "681"
},
{
"label": "Logistics/ Courier Service",
"value": "684"
},
{
"label": "Telecommunication Services",
"value": "690"
}
];
var removeClientPayDesc = function (items, key) {
for (var i = 0; i < items.length; i++) {
var item = items[i];
@ -5259,6 +5385,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.loadSubMerchantInfos();
})
};
/*$scope.applyWxSubMerchantId = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/new_apply_wx_sub_merchant_id.html',
controller: 'newApplyWxSubMerchantIdCtrl',
resolve: {
subMerchantInfo: function () {
return $scope.partner;
},
merchantIds: ['$http', '$stateParams', function ($http) {
return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids');
}]
}
}).result.then(function () {
$scope.loadSubMerchantInfos();
})
};*/
$scope.applyMWSubMerchantId = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/mw_info').then(function (resp) {
commonDialog.confirm({
@ -5384,6 +5528,82 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
}
}]);
app.controller('newApplyWxSubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', '$filter', 'merchantIds', 'commonDialog','wechatGoodMcc', function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog,wechatGoodMcc) {
$scope.wxIndustries = angular.copy(wxMerchantIndustries);
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
$scope.wechatMccIndustries = wechatGoodMcc.configs();
$scope.merchantIds = merchantIds.data;
$scope.subMerchantInfo.industry = $filter('wxindustries')($scope.subMerchantInfo.industry);
$scope.saveAppliy = function (form) {
$scope.errmsg = null;
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
var merchant_type = $scope.subMerchantInfo.business_structure == 'Company'? 1:2;
var params = {
company_name : $scope.subMerchantInfo.company_name,
merchant_id : $scope.subMerchantInfo.merchant_id,
store_name : $scope.subMerchantInfo.store_name,
office_phone : $scope.subMerchantInfo.office_phone,
contact_person : $scope.subMerchantInfo.contact_person,
contact_phone : $scope.subMerchantInfo.contact_phone,
company_phone : $scope.subMerchantInfo.company_phone,
contact_email : $scope.subMerchantInfo.contact_email,
industry : $scope.subMerchantInfo.industry,
company_website : $scope.subMerchantInfo.company_website,
merchant_type: merchant_type,
mcc_code : $scope.subMerchantInfo.mcc_code,
address: $scope.subMerchantInfo.address,
company_register_no: $scope.subMerchantInfo.company_register_no,
company_register_date: $scope.subMerchantInfo.company_register_date
};
if(merchant_type == 1){
params.director_name = $scope.subMerchantInfo.representative_person;
params.director_id_number = $scope.subMerchantInfo.representative_person_id_number;
}else{
params.principal_name = $scope.subMerchantInfo.marketing_person;
params.principal_id_number = $scope.subMerchantInfo.marketing_person_id_number;
}
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/new_sub_apply', params).then(function (resp) {
$scope.apply_sub_merchant_id = resp.data;
$scope.$close();
if (subMerchantInfo.sub_merchant_id != null) {
commonDialog.confirm({title: 'Confirm', content: '已申请成功,是否确认使用'}).then(function () {
$http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Modify Wechat Sub Merchant ID successfully',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
})
} else {
$http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Apply Success And Modify Wechat Sub Merchant ID successfully',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
}
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
}
}]);
app.controller('applyRpaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'businessStructuresMap', '$filter', 'commonDialog', 'timezone', function ($scope, $http, $uibModal, $state, subMerchantInfo, businessStructuresMap, $filter, commonDialog, timezone) {
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
$scope.business_structures = businessStructuresMap.configs();

@ -0,0 +1,273 @@
<div class="content">
<form novalidate name="subForm">
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Apply Wechat Sub Merchant Id</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group"
ng-class="{'has-error':subForm.merchant_name.$invalid && subForm.merchant_name.$dirty}">
<label class="control-label col-sm-3" for="merchant_name_input">* Merchant Name</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.company_name"
type="text" name="merchant_name" id="merchant_name_input" required maxlength="50">
<div ng-messages="subForm.merchant_name.$error" ng-if="subForm.merchant_name.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 50</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.merchant_id.$invalid && subForm.merchant_id.$dirty}">
<label class="control-label col-sm-3" for="business_category_input">* Merchant ID</label>
<div class="col-sm-8">
<select class="form-control" name="merchant_id"
ng-model="subMerchantInfo.merchant_id"
id="merchant_id_input" required
ng-options="merchant_id.merchant_id as merchant_id.merchant_id for merchant_id in merchantIds">
<option value="">Please Choose</option>
</select>
<div ng-messages="subForm.merchant_id.$error" ng-if="subForm.merchant_id.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
</div>
</div>
<div ng-messages="subForm.business_category.$error" ng-if="subForm.business_category.$dirty">
<p class="small text-danger" ng-message="maxLength">More than 50</p>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.merchant_storename.$invalid && subForm.merchant_storename.$dirty}">
<label class="control-label col-sm-3" for="merchant_storename_input">* Merchant Store Name</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.store_name"
type="text" name="merchant_storename" id="merchant_storename_input" required maxlength="50">
<div ng-messages="subForm.merchant_storename.$error" ng-if="subForm.merchant_storename.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 50</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.business_category.$invalid && subForm.business_category.$dirty}">
<label class="control-label col-sm-3" for="business_category_input">* Business Category</label>
<div class="col-sm-8">
<select class="form-control" name="business_category"
ng-model="subMerchantInfo.industry"
id="business_category_input" required
ng-options="industry.value as industry.label for industry in wxIndustries">
<option value="">Please Choose</option>
</select>
<div ng-messages="subForm.business_category.$error" ng-if="subForm.business_category.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
</div>
</div>
<div ng-messages="subForm.business_category.$error" ng-if="subForm.business_category.$dirty">
<p class="small text-danger" ng-message="maxLength">More than 50</p>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.company_website.$invalid && subForm.company_website.$dirty}">
<label class="control-label col-sm-3" for="website_input">* Website</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.company_website"
type="url" name="website" id="website_input" required maxlength="128">
<div ng-messages="subForm.company_website.$error" ng-if="subForm.company_website.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
</div>
</div>
</div>
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
<div class="form-group"
ng-class="{'has-error':subForm.office_phone.$invalid && subForm.office_phone.$dirty}">
<label class="control-label col-sm-3" for="office_phone_input">* Office Phone</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.company_phone"
type="tel" name="office_phone" id="office_phone_input" required>
<div ng-messages="subForm.office_phone.$error" ng-if="subForm.office_phone.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.contact_name.$invalid && subForm.contact_person.$dirty}">
<label class="control-label col-sm-3" for="contact_name_input">* Contact Name</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.contact_person"
type="text" name="contact_name" id="contact_name_input" required maxlength="32">
<div ng-messages="subForm.contact_name.$error" ng-if="subForm.contact_name.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 32</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.contact_phone.$invalid && subForm.contact_phone.$dirty}">
<label class="control-label col-sm-3" for="contact_phone_input">* Contact Phone</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.contact_phone"
type="text" name="contact_phone" id="contact_phone_input" required maxlength="16">
<div ng-messages="subForm.contact_phone.$error" ng-if="subForm.contact_phone.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 16</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.contact_email.$invalid && subForm.contact_email.$dirty}">
<label class="control-label col-sm-3" for="contact_email_input">* Contact Email</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.contact_email"
type="text" name="contact_email" id="contact_email_input" required maxlength="128">
<div ng-messages="subForm.contact_email.$error" ng-if="subForm.contact_email.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
</div>
</div>
</div>
<!-- mcc code -->
<div class="form-group"
ng-class="{'has-error':subForm.mcc_code.$invalid && subForm.mcc_code.$dirty}">
<label class="control-label col-sm-3" for="mcc_code_input">* Mcc Code</label>
<div class="col-sm-8">
<select class="form-control" name="mcc_code"
ng-model="subMerchantInfo.mcc_code"
id="mcc_code_input" required
ng-options="mccCode.value as mccCode.label for mccCode in wechatMccIndustries">
<option value="">Please Choose</option>
</select>
<div ng-messages="subForm.mcc_code.$error" ng-if="subForm.mcc_code.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
</div>
</div>
<div ng-messages="subForm.mcc_code.$error" ng-if="subForm.mcc_code.$dirty">
<p class="small text-danger" ng-message="maxLength">More than 50</p>
</div>
</div>
<!-- store address 店铺地址 -->
<div class="form-group"
ng-class="{'has-error':subForm.address.$invalid && subForm.address.$dirty}">
<label class="control-label col-sm-3" for="address_input">* Store Address</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.address"
type="text" name="address" id="address_input" required maxlength="128">
<div ng-messages="subForm.address.$error" ng-if="subForm.address.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
</div>
</div>
</div>
<!-- 公司注册号 -->
<div class="form-group"
ng-class="{'has-error':subForm.company_register_no.$invalid && subForm.company_register_no.$dirty}">
<label class="control-label col-sm-3" for="company_register_no_input">* Company registration document No</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.company_register_no"
type="text" name="company_register_no" id="company_register_no_input" required maxlength="50">
<div ng-messages="subForm.company_register_no.$error" ng-if="subForm.company_register_no.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 50</p>
</div>
</div>
</div>
<!-- 公司注册日期 -->
<div class="form-group"
ng-class="{'has-error':subForm.company_register_date.$invalid && subForm.company_register_date.$dirty}">
<label class="control-label col-sm-3" for="company_register_date_input">* Company registration Date</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.company_register_date" required maxlength="50"
type="text" name="company_register_date" id="company_register_date_input">
<div ng-messages="subForm.company_register_date.$error" ng-if="subForm.company_register_date.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 50</p>
</div>
</div>
</div>
<!-- director name 法人姓名 -->
<div class="form-group" ng-if="subMerchantInfo.business_structure == 'Company'"
ng-class="{'has-error':subForm.representative_person.$invalid && subForm.representative_person.$dirty}">
<label class="control-label col-sm-3" for="representative_person_input">* Director Name</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.representative_person" required maxlength="128"
type="text" name="representative_person" id="representative_person_input">
<div ng-messages="subForm.representative_person.$error" ng-if="subForm.representative_person.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
</div>
</div>
</div>
<!-- director id number 法人身份证号-->
<div class="form-group" ng-if="subMerchantInfo.business_structure == 'Company'"
ng-class="{'has-error':subForm.representative_person_id_number.$invalid && subForm.representative_person_id_number.$dirty}">
<label class="control-label col-sm-3" for="representative_person_id_number_input">* Director Id</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.representative_person_id_number" required maxlength="128"
type="text" name="representative_person_id_number" id="representative_person_id_number_input">
<div ng-messages="subForm.representative_person_id_number.$error" ng-if="subForm.representative_person_id_number.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
</div>
</div>
</div>
<!-- principal name 负责人姓名 -->
<div class="form-group" ng-if="subMerchantInfo.business_structure != 'Company'"
ng-class="{'has-error':subForm.marketing_person.$invalid && subForm.marketing_person.$dirty}">
<label class="control-label col-sm-3" for="marketing_person_input">* Principal Name</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.marketing_person" required maxlength="128"
type="text" name="marketing_person" id="marketing_person_input">
<div ng-messages="subForm.marketing_person.$error" ng-if="subForm.marketing_person.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
</div>
</div>
</div>
<!-- principal id number 负责人身份证号 -->
<div class="form-group" ng-if="subMerchantInfo.business_structure != 'Company'"
ng-class="{'has-error':subForm.marketing_person_id_number.$invalid && subForm.marketing_person_id_number.$dirty}">
<label class="control-label col-sm-3" for="marketing_person_id_number_input">* Marketing Person Id</label>
<div class="col-sm-8">
<input class="form-control" ng-model="subMerchantInfo.marketing_person_id_number" required maxlength="128"
type="text" name="marketing_person_id_number" id="marketing_person_id_number_input">
<div ng-messages="subForm.marketing_person_id_number.$error" ng-if="subForm.marketing_person_id_number.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Length is more than 128</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!--end 商品基本资料-->
<!--<div class="panel panel-default">-->
<!--<div class="panel-heading">Goods Qr Code</div>-->
<!--<div class="panel-body">-->
<!--</div>-->
<!--</div>-->
<!--end 商品二维码-->
<div class="btn-group margin-bottom margin-top">
<button class="btn btn-success" type="button"
ng-click="saveAppliy(subForm)">Submit
</button>
</div>
</div>
</div>
</form>
</div>

@ -0,0 +1,122 @@
package au.com.royalpay.payment.manage.alipayregisty;
import au.com.royalpay.payment.channels.alipay.config.AlipayConfig;
import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment;
import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Element;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@SpringBootTest
@RunWith(SpringRunner.class)
public class AlipayOnlineRegistryTest {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientMapper clientMapper;
@Resource
private AlipayClient alipayClient;
int applyNum = 0;
/**
*
*
*/
@Test
public void findMissingFields() {
///获取近半年有效交易的商户
Date to = new Date();
Calendar calendar1 = Calendar.getInstance();
calendar1.add(Calendar.MONTH, -6);
calendar1.set(Calendar.DAY_OF_MONTH,1);
Date from = calendar1.getTime();
// List<JSONObject> clients = clientMapper.halfYearHaveTransactionClients(from,to);
List<String> clients = new ArrayList<>();
clients.add("PLPR");
clients.add("MZZI");
clients.add("AGSH");
clients.add("AGBC");
clients.add("ISKI");
clients.add("BTGL");
clients.add("BTVL");
clients.add("HJCO");
clients.add("BAOC");
clients.add("WANR");
clients.add("XSPL");
clients.add("H20C");
clients.add("SDCN");
List<JSONObject> result = new ArrayList<>();
List<JSONObject> errorClients = new ArrayList<>();
clients.forEach(client->{
JSONObject clientInfo = clientMapper.findClientByMonikerAll(client);
try {
Element resultElement = alipayClient.queryOnlineGmsPortalStatus("2088821643021586", clientInfo);
if (StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
Element responseElement = resultElement.element("response");
Element element1 = responseElement.element("alipay");
// if (!StringUtils.equalsIgnoreCase("SUCCESS", element1.elementText("status"))) {
// return;
// }
Element registerAddress = element1.element("register_address");
Element registrationNo = element1.element("registration_no");
if (registerAddress != null && registrationNo != null) {
return;
}
if ((clientInfo.containsKey("acn") || clientInfo.containsKey("abn"))
&& clientInfo.containsKey("country")
&& clientInfo.containsKey("state")
&& clientInfo.containsKey("suburb")
&& clientInfo.containsKey("address")) {
//重新进件
Element applyResponse = alipayClient.registerOnlineGmsPortal("2088821643021586", clientInfo);
if(!StringUtils.equalsIgnoreCase("SUCCESS", applyResponse.element("is_success").getText())){
logger.info("商户:"+clientInfo.getString("client_moniker")+",进件失败,失败原因:" + applyResponse.element("error").getText());
clientInfo.put("error_message",applyResponse.elementText("result_code") +
":" + responseElement.elementText("reject_reason"));
errorClients.add(clientInfo);
}else{
logger.info("商户:"+clientInfo.getString("client_moniker")+",重新进件");
}
} else {
//打印缺失信息商户编码、所属BD
result.add(clientInfo);
}
} else {
System.out.println("非Alipay Online商户");
}
}catch (Exception e){
}
});
logger.info("重新进件商户为 "+applyNum+" 个");
logger.info("进见调用异常商户:"+errorClients.size());
logger.info("以下为数据缺失商户需BD补充 :");
result.forEach(client->{
String registrationNo = client.containsKey("acn") ? client.getString("acn"): (client.containsKey("abn") ? client.getString("abn") : "缺失");
logger.info("商户编码===>"+client.getString("client_moniker") +
" , registration_no===>" + registrationNo +
" , register_address===>" + (client.containsKey("country") ? (client.getString("country") + " " + client.getString("state") + " " + client.getString("suburb") + " " + client.getString("address")) : "缺失" )+
" , bd===>"+(client.containsKey("bd_user_name") ? client.getString("bd_user_name") : "-"));
});
}
}
Loading…
Cancel
Save