Merge branch 'develop_T1068_client_apply' into develop

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java
#	src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java
#	src/main/resources/application.properties
#	src/main/ui/static/payment/partner/partner.js
master
luoyang 5 years ago
commit 38d959e20c

@ -35,6 +35,11 @@ public class AppClientBean {
@JSONField(name = "contact_job")
private String contactJob;
private String registered_address;
private String registered_suburb;
private String registered_state;
private String registered_postcode;
public JSONObject updateObject() {
JSONObject res = new JSONObject();
if (contactPerson != null) {
@ -84,6 +89,18 @@ public class AppClientBean {
if (legalJobTitle != null) {
res.put("job_title", legalJobTitle);
}
if (registered_address != null) {
res.put("registered_address", registered_address);
}
if (registered_suburb != null) {
res.put("registered_suburb", registered_suburb);
}
if (registered_state != null) {
res.put("registered_state", registered_state);
}
if (registered_postcode != null) {
res.put("registered_postcode", registered_postcode);
}
return res;
}
@ -205,4 +222,36 @@ public class AppClientBean {
public void setLegalPhone(String legalPhone) {
this.legalPhone = legalPhone;
}
public String getRegistered_address() {
return registered_address;
}
public void setRegistered_address(String registered_address) {
this.registered_address = registered_address;
}
public String getRegistered_suburb() {
return registered_suburb;
}
public void setRegistered_suburb(String registered_suburb) {
this.registered_suburb = registered_suburb;
}
public String getRegistered_state() {
return registered_state;
}
public void setRegistered_state(String registered_state) {
this.registered_state = registered_state;
}
public String getRegistered_postcode() {
return registered_postcode;
}
public void setRegistered_postcode(String registered_postcode) {
this.registered_postcode = registered_postcode;
}
}

@ -0,0 +1,34 @@
package au.com.royalpay.payment.manage.appclient.beans;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import javax.validation.constraints.NotEmpty;
/**
* @Author DuLingLing
* @create 2019/10/18 0018 18:14
*/
public class MobileLoginInfo {
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
@NotEmpty(message = "error.payment.valid.param_missing")
private String verifyCode;
private String devId;
public LoginInfo toLoginInfo(String username){
LoginInfo info = new LoginInfo();
info.setLoginId(username);
// info.setPassword(password);
info.setVerifyCode(verifyCode);
return info;
}
}

@ -191,8 +191,11 @@ public interface RetailAppService {
void bindAccountPhone(JSONObject device, JSONObject phone);
void updateAccountPhone(JSONObject device, JSONObject codekey);
JSONObject updateAccountPhone(JSONObject device,JSONObject codekey);
void updateLoginClientAccountPhone(JSONObject account,String contactPhone, String nationCode);
void updateLoginClientAccountOpenId(JSONObject client,JSONObject params);
/**
* 退
*/
@ -227,6 +230,13 @@ public interface RetailAppService {
boolean isSubPartner(JSONObject device, String clientMoniker);
JSONObject postAppMessage(JSONObject device, RetailAppMessage message);
JSONObject unbindAccountPhone(JSONObject device, JSONObject params);
JSONObject unbindAccountWechat(JSONObject device);
JSONObject bindAccountWechat(JSONObject device, JSONObject params);
JSONObject getAccountBindInfos(JSONObject device);
JSONObject postAppMessage(JSONObject device, RetailAppMessage message);
}

@ -48,6 +48,7 @@ import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.manage.tradelog.refund.RefundService;
import au.com.royalpay.payment.tools.cms.RoyalPayCMSSupport;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.connections.mpsupport.MpClientAppWechatApiProvider;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.device.message.AppMessage;
import au.com.royalpay.payment.tools.device.message.AppMsgSender;
@ -77,6 +78,7 @@ import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.joda.time.DateTime;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.slf4j.LoggerFactory;
@ -205,6 +207,8 @@ public class RetailAppServiceImp implements RetailAppService {
private AuthAppMessageMapper authAppMessageMapper;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private MpClientAppWechatApiProvider mpClientAppWechatApiProvider;
private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf";
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/10/22/1571723034726_5xK6A0FGv5aQPbMIDJzXJrUPKHFutv.pdf";
@ -212,6 +216,7 @@ public class RetailAppServiceImp implements RetailAppService {
private SmsSender smsSender;
private final String BIND_ACCOUNT_EMAIL_PREFIX = "BIND_ACCOUNT_EMAIL";
private final String BIND_ACCOUNT_PHONE_PREFIX = "BIND_ACCOUNT_PHONE";
private final String UNBIND_ACCOUNT_PHONE_PREFIX = "UHBIND_ACCOUNT_PHONE";
private final int BIND_PHONE_TEMPLID = 126978;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
@ -670,6 +675,8 @@ public class RetailAppServiceImp implements RetailAppService {
if (clientType.equals("iphone")) {
res.put("skip_clearing", !res.getBoolean("skip_clearing"));
}
sysClientLegalPersonMapper.findRepresentativeInfo(device.getIntValue("client_id"));
res.put("representative_info", sysClientLegalPersonMapper.findRepresentativeInfo(device.getIntValue("client_id")));
return res;
}
@ -693,6 +700,17 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getClientInfoRealtime(JSONObject device) {
JSONObject clientWithConfig = clientManager.getClientInfo(device.getIntValue("client_id"));
clientWithConfig.putAll(clientConfigService.find(device.getIntValue("client_id")));
JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(device.getIntValue("client_id"));
if (legalInfo != null) {
clientWithConfig.put("representative_person", legalInfo.getString("representative_person"));
clientWithConfig.put("representative_phone", legalInfo.getString("phone"));
clientWithConfig.put("representative_email", legalInfo.getString("email"));
clientWithConfig.put("representative_job_title", legalInfo.getString("job_title"));
clientWithConfig.put("registered_address", legalInfo.getString("address"));
clientWithConfig.put("registered_suburb", legalInfo.getString("suburb"));
clientWithConfig.put("registered_state", legalInfo.getString("state"));
clientWithConfig.put("registered_postcode", legalInfo.getString("postcode"));
}
return clientWithConfig;
}
@ -716,6 +734,7 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getClientInfoMe(JSONObject device) {
JSONObject result = new JSONObject();
result.put("base_info_lack", false);
result.put("legal_info_lack", false);
result.put("compliance_info_lack", false);
JSONObject client = clientMapper.findClient(device.getIntValue("client_id"));
if (StringUtils.isEmpty(client.getString("business_structure")) || StringUtils.isEmpty(client.getString("logo_url"))
@ -725,7 +744,16 @@ public class RetailAppServiceImp implements RetailAppService {
|| (StringUtils.isEmpty(client.getString("company_website")) && StringUtils.isEmpty(client.getString("company_photo"))
&& StringUtils.isEmpty(client.getString("store_photo")))) {
result.put("base_info_lack", true);
}
JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(device.getIntValue("client_id"));
if (StringUtils.isEmpty(legalInfo.getString("representative_person")) || StringUtils.isEmpty(legalInfo.getString("job_title"))
|| StringUtils.isEmpty(legalInfo.getString("phone"))
|| StringUtils.isEmpty(legalInfo.getString("email"))
|| StringUtils.isEmpty(legalInfo.getString("address"))
|| StringUtils.isEmpty(legalInfo.getString("suburb"))
|| StringUtils.isEmpty(legalInfo.getString("state"))
|| StringUtils.isEmpty(legalInfo.getString("postcode"))) {
result.put("legal_info_lack", true);
}
JSONObject file = clientManager.getAuthFiles(null, client.getString("client_moniker"));
for (String s : fileName) {
@ -2109,27 +2137,27 @@ public class RetailAppServiceImp implements RetailAppService {
String codeKey = device.getString("account_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get();
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 5 minutes.");
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 1 minutes.");
}
String codeKeyValue = RandomStringUtils.random(6, false, true);
String nationCode = phone.getString("nation_code");
String nationCode = phone.getString("nation_code").contains("+")?phone.getString("nation_code").substring(1):phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone");
ArrayList<String> param = new ArrayList<>();
param.add("绑定手机号");
param.add(codeKeyValue);
String expireMin = "5";
String expireMin = "1";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ServerErrorException("Phone number is wrong.Please try again.");
throw new BadRequestException("Phone number is wrong.Please try again.");
}
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
}
@Override
public void updateAccountPhone(JSONObject device, JSONObject params) {
public JSONObject updateAccountPhone(JSONObject device, JSONObject params) {
String key = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
if (key == null) {
throw new BadRequestException("Captcha has expired");
@ -2137,15 +2165,118 @@ public class RetailAppServiceImp implements RetailAppService {
String captcha = key.split("&")[0];
String nationCode = key.split("&")[1];
String contactPhone = key.split("&")[2];
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
}
JSONObject account = clientAccountMapper.findByPhone(contact_phone, "+" + nation_code);
if (account != null) {
throw new BadRequestException("Mobile phone number has been bound to other users, please unbind it before binding");
}
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", device.getString("account_id"));
updateAccount.put("contact_phone", contactPhone);
updateAccount.put("nation_code", "+" + nationCode);
clientAccountMapper.update(updateAccount);
deleteAccountPhoneKey(device.getString("account_id"));
JSONObject result = new JSONObject();
result.put("status", "success");
return result;
}
@Override
public void updateLoginClientAccountPhone(JSONObject account, String contactPhone, String nationCode) {
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", account.getString("account_id"));
updateAccount.put("contact_phone", contactPhone);
updateAccount.put("nation_code", "+" + nationCode);
clientAccountMapper.update(updateAccount);
}
@Override
public void updateLoginClientAccountOpenId(JSONObject account, JSONObject params) {
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", account.getString("account_id"));
updateAccount.put("wechat_openid", params.getString("wechat_openid"));
updateAccount.put("wechat_name", params.getString("nick_name"));
updateAccount.put("wx_unionid", params.getString("union_id"));
clientAccountMapper.update(updateAccount);
}
@Override
public JSONObject unbindAccountPhone(JSONObject device, JSONObject params) {
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
if (codeKeyValueRedis == null) {
throw new BadRequestException("Captcha has expired");
}
String captcha = codeKeyValueRedis.split("&")[0];
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
}
JSONObject account = new JSONObject();
account.put("account_id", device.getString("account_id"));
account.put("contact_phone", contactPhone);
account.put("nation_code", "+" + nationCode);
account.put("contact_phone", null);
account.put("nation_code", null);
clientAccountMapper.update(account);
deleteAccountPhoneKey(device.getString("account_id"));
JSONObject result = new JSONObject();
result.put("status", "success");
return result;
}
@Override
public JSONObject unbindAccountWechat(JSONObject device) {
JSONObject account = new JSONObject();
account.put("account_id", device.getString("account_id"));
account.put("wechat_openid", null);
account.put("wechat_name", null);
account.put("wx_unionid", null);
clientAccountMapper.update(account);
JSONObject result = new JSONObject();
result.put("status", "success");
return result;
}
@Override
public JSONObject bindAccountWechat(JSONObject device, JSONObject params) {
JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(params.getString("code"));
if (user == null) {
throw new BadRequestException("WeChat users do not exist");
}
String openId = user.getString("openid");
JSONObject account = clientAccountMapper.findByOpenId(openId);
if (account != null) {
throw new BadRequestException("WeChat ID has been bound to other accounts, please unbind it before binding");
}
JSONObject wechatUserInfo = mpClientAppWechatApiProvider.getApi("merchant-app").appUserInfo(openId,user.getString("access_token"));
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", device.getString("account_id"));
updateAccount.put("wechat_openid", openId);
updateAccount.put("wechat_name",wechatUserInfo.getString("nickname"));
updateAccount.put("wx_unionid",wechatUserInfo.getString("unionid"));
clientAccountMapper.update(updateAccount);
JSONObject result = new JSONObject();
result.put("status", "success");
return result;
}
@Override
public JSONObject getAccountBindInfos(JSONObject device) {
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
JSONObject result = new JSONObject();
result.put("phone_bind_status",account.containsKey("contact_phone"));
if(account.containsKey("contact_phone")){
result.put("contact_phone",account.getString("contact_phone"));
String contact_phone = account.getString("contact_phone").replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
result.put("remark_contact_phone",contact_phone);
result.put("naticon_code",account.getString("nation_code"));
}
result.put("wechat_bind_status",account.containsKey("wechat_openid"));
if(account.containsKey("wechat_openid")){
result.put("wechat_name",account.getString("wechat_name"));
}
return result;
}
@Override
@ -2559,9 +2690,11 @@ public class RetailAppServiceImp implements RetailAppService {
private JSONObject getClientBaseInfo(JSONObject clientWithConfig) {
JSONObject res = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientWithConfig);
res.put("is_skip_clearing", res.getBoolean("skip_clearing"));
JSONObject clientLegalInfo = null;
if ("4".equals(clientWithConfig.getString("source"))) {
res.put("refuse_remark", clientWithConfig.getString("refuse_remark"));
res.put("base_info_lack", false);
res.put("legal_info_lack", false);
res.put("compliance_info_lack", false);
if (StringUtils.isEmpty(clientWithConfig.getString("business_structure")) || StringUtils.isEmpty(clientWithConfig.getString("logo_url"))
|| StringUtils.isEmpty(clientWithConfig.getString("description"))
@ -2570,7 +2703,16 @@ public class RetailAppServiceImp implements RetailAppService {
|| (StringUtils.isEmpty(clientWithConfig.getString("company_website")) && StringUtils.isEmpty(clientWithConfig.getString("company_photo"))
&& StringUtils.isEmpty(clientWithConfig.getString("store_photo")))) {
res.put("base_info_lack", true);
}
clientLegalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(res.getIntValue("client_id"));
if (StringUtils.isEmpty(clientLegalInfo.getString("representative_person")) || StringUtils.isEmpty(clientLegalInfo.getString("job_title"))
|| StringUtils.isEmpty(clientLegalInfo.getString("phone"))
|| StringUtils.isEmpty(clientLegalInfo.getString("email"))
|| StringUtils.isEmpty(clientLegalInfo.getString("address"))
|| StringUtils.isEmpty(clientLegalInfo.getString("suburb"))
|| StringUtils.isEmpty(clientLegalInfo.getString("state"))
|| StringUtils.isEmpty(clientLegalInfo.getString("postcode"))) {
res.put("legal_info_lack", true);
}
JSONObject file = clientManager.getAuthFiles(null, clientWithConfig.getString("client_moniker"));
for (String s : fileName) {
@ -2579,12 +2721,11 @@ public class RetailAppServiceImp implements RetailAppService {
}
}
}
JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(res.getIntValue("client_id"));
if (clientLegal != null) {
res.put("legal_person", clientLegal.getString("representative_person"));
res.put("legal_job_title", clientLegal.getString("job_title"));
res.put("legal_phone", clientLegal.getString("phone"));
res.put("legal_email", clientLegal.getString("email"));
if (clientLegalInfo != null) {
res.put("legal_person", clientLegalInfo.getString("representative_person"));
res.put("legal_job_title", clientLegalInfo.getString("job_title"));
res.put("legal_phone", clientLegalInfo.getString("phone"));
res.put("legal_email", clientLegalInfo.getString("email"));
}
return res;
}

@ -8,6 +8,7 @@ import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage;
import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.apps.AppController;
import au.com.royalpay.payment.manage.bill.bean.NewBillBean;
import au.com.royalpay.payment.manage.bill.bean.QueryBillBean;
import au.com.royalpay.payment.manage.bill.bean.QueryBillOrderBean;
@ -727,8 +728,9 @@ public class RetailAppController {
* @throws Exception
*/
@PutMapping("/account/phone")
public void bindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject phone) throws Exception {
public JSONObject bindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject phone) throws Exception {
retailAppService.bindAccountPhone(device, phone);
return new JSONObject();
}
/**
@ -739,10 +741,45 @@ public class RetailAppController {
* @throws Exception
*/
@PutMapping("/account/phone/bind")
public void updateAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception {
retailAppService.updateAccountPhone(device, params);
public JSONObject updateAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception {
return retailAppService.updateAccountPhone(device, params);
}
/**
*
*
* @param device
* @param params
* @throws Exception
*/
@PutMapping("/account/phone/unbind")
public JSONObject unbindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception {
return retailAppService.unbindAccountPhone(device, params);
}
/**
*
* @param device
* @param params
*/
@PutMapping("/account/wechat/bind")
public JSONObject bindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params){
return retailAppService.bindAccountWechat(device,params);
}
/**
*
* @param device
*/
@PutMapping("/account/wechat/unbind")
public JSONObject unbindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device){
return retailAppService.unbindAccountWechat(device);
}
/**
* 退
*/
@ -857,4 +894,14 @@ public class RetailAppController {
return model;
}
/**
* ()
* @param device
* @return
*/
@GetMapping("/client/account/bind/infos")
public JSONObject findClientAccountBindStatusInfos(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
return retailAppService.getAccountBindInfos(device);
}
}

@ -1,11 +1,17 @@
package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo;
import au.com.royalpay.payment.manage.appclient.core.ManageAppService;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.signin.events.ClientLoginEvent;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.device.ManageDeviceSupport;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
@ -17,12 +23,16 @@ import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -32,8 +42,8 @@ import java.io.IOException;
*/
@RestController
@RequestMapping("/api/v1.0/retail_valid")
public class RetailValidationController {
Logger logger = LoggerFactory.getLogger(getClass());
public class RetailValidationController implements ApplicationEventPublisherAware {
Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private Producer captchaProducer;
@Resource
@ -44,6 +54,18 @@ public class RetailValidationController {
private ManageDeviceSupport manageDeviceSupport;
@Resource
private RetailAppService retailAppService;
@Resource
private ClientManager clientManager;
@Resource
private SimpleClientApplyService simpleClientApplyService;
private ApplicationEventPublisher publisher;
@Resource
private ManageAppService manageAppService;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
@PostMapping("/devices/{devType}/register")
public JSONObject register(@RequestBody String registeration, @PathVariable String devType) {
@ -149,6 +171,142 @@ public class RetailValidationController {
@GetMapping("/ads/{article_id}")
public JSONObject getAdDetail(@PathVariable String article_id) {
return retailAppService.getAdDetail( article_id);
return retailAppService.getAdDetail(article_id);
}
/**
*
*
* @param phoneNumber
* @param nationCode
* @param request
* @return
*/
@PostMapping("/send/{phone_number}/verify_code")
@ResponseBody
public JSONObject sendLoginMobileVerifyCode(@PathVariable("phone_number") String phoneNumber,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
HttpServletRequest request) {
simpleClientApplyService.getAndSendLoginSmsCode(phoneNumber, nationCode, request);
return new JSONObject();
}
/**
*
*
* @param contactPhone
* @param nationCode
* @param params
*/
@PostMapping("/login/verify/{contact_phone}/verify_code")
public JSONObject verifyLoginMobileCode(@PathVariable("contact_phone") String contactPhone,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
@RequestBody JSONObject params,
@ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device,
Errors errors) {
HttpUtils.handleValidErrors(errors);
JSONObject result = new JSONObject();
simpleClientApplyService.verifyLoginSMSCode(params.getString("verify_code"), contactPhone);
String signKey = signInStatusManager.getClientInfoByPhoneStatusKey(contactPhone, nationCode,RequestEnvironment.getClientIp());
if(signKey!=null){
JSONObject account = signInStatusManager.getCurrentClient(signKey);
account = JSON.parseObject(account.toJSONString());
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(account, params.getString("devId"));
}
account.put("sign_key", signKey);
result.put("account",account);
result.put("status","success");
result.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
}else{
result.put("status","success");
result.put("bind_status", false);
result.put("contact_phone",contactPhone);
result.put("nation_code",nationCode);
}
return result;
}
/**
* -
* @param contactPhone
* @param nationCode
* @param params
*/
@PostMapping("/login/mobile/{contact_phone}/bind")
public JSONObject mobileLoginBind(@PathVariable("contact_phone")String contactPhone,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
@RequestBody JSONObject params,
Errors errors){
HttpUtils.handleValidErrors(errors);
LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password"));
String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"phone");
signInStatusManager.verifyClientLoginPhoneBindCode(contactPhone,nationCode,RequestEnvironment.getClientIp());
JSONObject account = signInStatusManager.getCurrentClient(signKey);
retailAppService.updateLoginClientAccountPhone(account, contactPhone,nationCode);
account.put("sign_key", signKey);
account = JSON.parseObject(account.toJSONString());
JSONObject result = new JSONObject();
result.put("account",account);
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(account, params.getString("devId"));
}
result.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
return result;
}
/**
* App
* @param params
* @return
*/
@PostMapping("/client_app_wechat_signin")
public JSONObject clientAppWechatSignIn(@RequestBody JSONObject params,
Errors errors) {
HttpUtils.handleValidErrors(errors);
JSONObject account = signInStatusManager.clientAppWechatSignIn(params.getString("code"),RequestEnvironment.getClientIp());
if(!account.getBoolean("bind_status")){
deviceSupport.validDeviceWithClient(account, params.getString("app_openid"));
return account;
}
this.publisher.publishEvent(new ClientLoginEvent(this, account.getJSONObject("account").getIntValue("client_id"), account.getJSONObject("account").getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return account;
}
/**
*
* @param params
* @return
*/
@PostMapping("/login/wechat_bind")
public JSONObject wechatLoginBind(@RequestBody JSONObject params){
JSONObject wechatInfo = signInStatusManager.verifyClientLoginWechatBindCode(params.getString("wechat_openid"),RequestEnvironment.getClientIp());
LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password"));
String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"wechat");
JSONObject account = signInStatusManager.getCurrentClient(signKey);
params.put("nick_name",wechatInfo.getString("nick_name"));
params.put("union_id",wechatInfo.getString("union_id"));
retailAppService.updateLoginClientAccountOpenId(account,params);
account = JSON.parseObject(account.toJSONString());
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(account, params.getString("devId"));
}
JSONObject result = new JSONObject();
account.put("sign_key", signKey);
result.put("account",account);
result.put("bind_status", true);
result.put("status","success");
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return result;
}
}

@ -3,6 +3,7 @@ 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;
@ -55,6 +56,12 @@ public class ClientPreApplyBean {
private String nation_code;
private String client_pay_type = "2";
private String client_pay_desc = "201";
private String company_website;
private String company_photo;
private String alipayindustry;
private String wechatindustry;
private String store_photo;
public JSONObject insertObject() {
@ -253,4 +260,44 @@ public class ClientPreApplyBean {
public String getClient_pay_desc() {
return client_pay_desc;
}
public void setAlipayindustry(String alipayindustry) {
this.alipayindustry = alipayindustry;
}
public void setCompany_photo(String company_photo) {
this.company_photo = company_photo;
}
public void setCompany_website(String company_website) {
this.company_website = company_website;
}
public void setStore_photo(String store_photo) {
this.store_photo = store_photo;
}
public void setWechatindustry(String wechatindustry) {
this.wechatindustry = wechatindustry;
}
public String getAlipayindustry() {
return alipayindustry;
}
public String getCompany_photo() {
return company_photo;
}
public String getCompany_website() {
return company_website;
}
public String getStore_photo() {
return store_photo;
}
public String getWechatindustry() {
return wechatindustry;
}
}

@ -3,8 +3,11 @@ package au.com.royalpay.payment.manage.application.core;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
public interface SimpleClientApplyService {
void verifyRegisterSMSCode(String codeKey, String phoneNumber);
@ -15,6 +18,8 @@ public interface SimpleClientApplyService {
String getAndSendSmsCode(String phoneNumber, String nationCode, HttpServletRequest request);
void sendOpenSms(String phoneNumber, String nationCode);
String checkOrGenerateRegisterProcessKey(String accountName, String codeKey);
void deleteRegisterProcessKey(String codeKey);
@ -29,10 +34,26 @@ public interface SimpleClientApplyService {
void saveOrUpdateApplyInfo(JSONObject companyBean, String username);
JSONObject getPayType();
List<JSONObject> getSysRate(JSONObject sysConfig);
List<JSONObject> getIndustryMap();
JSONObject getSourceAggregateFile(String username ,String clean_days);
JSONObject getClientAggregateFile(String username, MultipartFile file,String clean_days, JSONObject signInfo) throws IOException;
JSONObject getPreApplyInfoForAggree(String username ,String clean_days);
JSONObject getBankInfo(String bsb_no);
void checkAccountName(String contact_phone,String nation_code);
void subscribeNewsletter(String mail, String lang);
void getAndSendLoginSmsCode(String phoneNumber, String nationCode, HttpServletRequest request);
void verifyLoginSMSCode(String codeKey, String phoneNumber);
}

@ -15,6 +15,7 @@ import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.manage.system.core.MailGunService;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -24,21 +25,32 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.thymeleaf.context.Context;
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.io.*;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -47,6 +59,7 @@ import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import cn.yixblog.platform.http.HttpRequestGenerator;
@ -65,20 +78,29 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Resource
private MailService mailService;
@Resource
private AttachmentClient attachmentClient;
@Resource
private PermissionPartnerManager permissionPartnerManager;
@Resource
private SpringTemplateEngine thymeleaf;
@Resource
private SysClientLegalPersonMapper sysClientLegalPersonMapper;
@Resource
private ClientManager clientManager;
@Resource
private SignInAccountService signInAccountService;
@Resource
private SimpleClientApplyService simpleClientApplyService;
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private SysClientPreMapperMapper sysClientPreMapperMapper;
@Resource
private ClientBankAccountMapper clientBankAccountMapper;
@Resource
private ClientFilesMapper clientFilesMapper;
@Resource
private ClientMapper clientMapper;
@Resource
private ClientRateMapper clientRateMapper;
@ -95,6 +117,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
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";
@Resource
private SmsSender smsSender;
@Resource
@ -104,6 +127,9 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
private final String REGISTER_CLIENT_PREFIX = "REGISTER_CLIENT";
private final String REGISTER_CLIENT_PROCESS_PREFIX = "REGISTER_CLIENT_PROCESS";
private final String VERIFY_MAIL_PREFIX = "VERIFY_MAIL";
private final String LOGIN_CLIENT_PREFIX = "LGOIN_CLIENT";
private final String LOGIN_CLIENT_PROCESS_PREFIX = "LOGIN_CLIENT_PROCESS";
private static final String CLIENT_AGREE_FILE = "client_agree_file";
private final List<String> tags = new ArrayList<>();
@PostConstruct
@ -158,6 +184,19 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
return registerClientCode;
}
@Override
public void sendOpenSms(String phoneNumber, String nationCode) {
ArrayList<String> param = new ArrayList<>();
String phone_Number = phoneNumber.substring(0, 3) + "****" + phoneNumber.substring(7, phoneNumber.length());
param.add(phone_Number);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, 462770, param, "RoyalPay", "", "");
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong Please try again");
}
}
@Override
public void sendVerifyEmail(String address, int client_id, String username) {
JSONObject client = clientManager.getClientInfo(client_id);
@ -281,6 +320,68 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
}
}
@Override
public JSONObject getSourceAggregateFile(String username ,String clean_days) {
JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
String address = apply.getString("address").trim();
if (address.contains(",")) {
apply.put("address", address.substring(0, address.lastIndexOf(",")).trim());
apply.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
}
apply.put("acn_type", "ABN: (" + apply.getString("abn") + ")");
apply.put("company_name_acn", apply.getString("company_name") + " (ABN " + apply.getString("abn") + ")");
apply.put("clean", "T+" + clean_days.trim());
apply.put("clean_days", clean_days);
JSONObject sysConfig = sysConfigManager.getSysConfig();
JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
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"));
apply.put("cbbank_rate",rate.getString("CB_Bankpay"));
apply.put("bestpay_rate",rate.getString("Bestpay"));
apply.put("jd_rate",rate.getString("JDpay"));
JSONObject bankInfo = getBankInfo(apply.getString("bsb_no"));
apply.put("bank", bankInfo.getString("bank"));
apply.put("bsb_no", apply.getString("bsb_no"));
apply.put("account_no", apply.getString("bank_no"));
apply.put("account_name", apply.getString("bank_name"));
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
apply.put("start_date", start_date);
Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
apply.put("end_date", end_date);
apply.put("legal_person", apply.getString("representative_person"));
apply.put("legal_job_title", apply.getString("representative_job_title"));
apply.put("legal_phone", apply.getString("representative_phone"));
apply.put("legal_email", apply.getString("representative_email"));
return exportClientAggregateFile(apply);
}
private JSONObject exportClientAggregateFile(JSONObject apply) {
InputStream stream = null;
JSONObject result = new JSONObject();
try {
PdfUtils pdu = new PdfUtils();
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(apply);
File file = new File(apply.getString("username") + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, apply.getString("username") + "_" + System.currentTimeMillis() + "_agreement_source.pdf", false);
result.put("file_value", fileInfo.getString("url"));
} catch (Exception e) {
throw new BadRequestException("获取合同文件失败");
}
return result;
}
@Override
@Transactional
public void saveOrUpdateApplyInfo(JSONObject applyInfo, String username) {
@ -296,21 +397,193 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
applyInfo.put("update_time", new Date());
sysClientPreMapperMapper.update(applyInfo);
if (applyInfo.getBooleanValue("agree")) {
applyerToClient(username);
applyerToClient(username, null);
}
}
}
@Override
public JSONObject getPayType() {
String[] online_desc = {"pc网站|PC Web","手机端网站|Mobile Web","APP ","微信内/支付宝内网站|Wechat/Alipay JSAPI","小程序|MiniProgram"};
String[] online_desc_value = {"101","102","103","104","105"};
String[] offline_desc = {"二维码立牌|QR Code","Royalpay POS","收银系统|POS","无人售货机|Vending machine"};
String[] offline_desc_value = {"201","202","203","204"};
String[] pos = {"ipos","pospal","Aus Post","Lotus","AoShangBao","Infinity","EasyCloud","AoMaiKe","其他|other"};
String[] pos_value = {"20301","20302","20303","20304","20305","20306","20307","20308","20399"};
JSONObject payType = new JSONObject();
List<JSONObject> online = new ArrayList<>();
List<JSONObject> offline = new ArrayList<>();
List<JSONObject> sub = new ArrayList<>();
for(int i =0 ; i< pos.length;i++) {
JSONObject temp = new JSONObject();
temp.put("label",pos[i]);
temp.put("value",pos_value[i]);
sub.add(temp);
}
for(int i =0 ; i< online_desc.length;i++) {
JSONObject temp = new JSONObject();
temp.put("label",online_desc[i]);
temp.put("value",online_desc_value[i]);
online.add(temp);
}
for(int i =0 ; i< offline_desc.length;i++) {
JSONObject temp = new JSONObject();
temp.put("label",offline_desc[i]);
temp.put("value",offline_desc_value[i]);
if("收银系统|POS".equals(offline_desc[i])) {
temp.put("sub",sub);
}
offline.add(temp);
}
payType.put("online",online);
payType.put("offline",offline);
return payType;
}
@Override
public List<JSONObject> getSysRate(JSONObject sysConfig){
HashMap<String, JSONObject> map = JSON.parseObject(sysConfig.getString("sys_apply_rates"),LinkedHashMap.class, Feature.OrderedField);
List<JSONObject> rates= new ArrayList<>();
JSONObject tName = new JSONObject();
tName.put("t1","T+1");
tName.put("t2","T+2");
tName.put("t3","T+3");
for( String strt:map.keySet()){
JSONObject t = map.get(strt);
List<JSONObject> data = new ArrayList<>();
for(String str:t.keySet()){
JSONObject rate = new JSONObject();
rate.put("channel",str);
rate.put("rate",t.get(str));
data.add(rate);
}
JSONObject temp = new JSONObject();
temp.put("data",data);
temp.put("name",tName.getString(strt));
rates.add(temp);
}
return rates;
}
@Override
public List<JSONObject> getIndustryMap(){
List<JSONObject> industryMap = new ArrayList<>();
String[] industryLabel ={"鞋包服饰","机票行业","软件服务","旅游票务","国际租车","医疗服务(出国)","医疗服务(不出国)","留学教育(网络教育)","留学教育(一年及以下)","其它货物贸易行业","文具/办公用品","综合商城","酒店行业","教育行业","国际物流","数码电器","母婴","化妆品","食品","留学教育(一年以上)","其它服务行业"};
String[] industryValue ={"327","339","356","357","358","359","360","361","362","338","337","336","328","329","330","332","333","334","335","363","331"};
for(int i =0 ; i< industryLabel.length;i++) {
JSONObject temp = new JSONObject();
temp.put("label",industryLabel[i]);
temp.put("value",industryValue[i]);
industryMap.add(temp);
}
return industryMap;
}
@Override
public JSONObject getPreApplyInfoForAggree(String username ,String clean_days) {
JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
String address = apply.getString("address").trim();
if (address.contains(",")) {
apply.put("address", address.substring(0, address.lastIndexOf(",")).trim());
apply.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
}
apply.put("acn_type", "ABN: (" + apply.getString("abn") + ")");
apply.put("company_name_acn", apply.getString("company_name") + " (ABN " + apply.getString("abn") + ")");
apply.put("clean", "T+" + clean_days.trim());
apply.put("clean_days", clean_days);
JSONObject sysConfig = sysConfigManager.getSysConfig();
JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
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"));
apply.put("cbbank_rate",rate.getString("CB_Bankpay"));
apply.put("bestpay_rate",rate.getString("Bestpay"));
apply.put("jd_rate",rate.getString("JDpay"));
JSONObject bankInfo = getBankInfo(apply.getString("bsb_no"));
apply.put("bank", bankInfo.getString("bank"));
apply.put("bsb_no", apply.getString("bsb_no"));
apply.put("account_no", apply.getString("bank_no"));
apply.put("account_name", apply.getString("bank_name"));
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
apply.put("start_date", start_date);
Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
apply.put("end_date", end_date);
apply.put("legal_person", apply.getString("representative_person"));
apply.put("legal_job_title", apply.getString("representative_job_title"));
apply.put("legal_phone", apply.getString("representative_phone"));
apply.put("legal_email", apply.getString("representative_email"));
return apply;
}
@Override
public JSONObject getClientAggregateFile(String username, MultipartFile file ,String clean_days, JSONObject signInfo) throws IOException{
JSONObject apply = getPreApplyInfoForAggree(username ,clean_days);
apply.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8"));
BufferedImage img = ImageIO.read(file.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(img, "png", out);
apply.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
return exportImgAggregateFile(username, apply, signInfo);
}
private JSONObject exportImgAggregateFile(String username, JSONObject apply, JSONObject signInfo) 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");
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);
contractInfo.put("contract_url", fileInfo.getString("url"));
apply.put("contract_url", contractInfo.getString("contract_url"));
signInfo.put("contract_url", contractInfo.getString("contract_url"));
apply.put("agree", true);
apply.put("update_time", new Date());
sysClientPreMapperMapper.update(apply);
} catch (Exception e) {
logger.error("合同制作出现问题:", e);
throw new BadRequestException("合同制作出现问题:" + e.getMessage());
} finally {
stream.close();
}
applyerToClient(apply.getString("username"), signInfo);
return contractInfo;
}
//todo
private void applyerToClient(String username) {
private void applyerToClient(String username, JSONObject signInfo) {
JSONObject sysConfig = sysConfigManager.getSysConfig();
String arr[] = sysConfig.getString("temp_sub_mch_id").split(",");
List<String> availableMerchants = WechatPayEnvironment.getEnv().getWechatMerchantConfigs().stream()
.filter(mch->StringUtils.equals(mch.getMpId(),"globalpay"))
.filter(mch -> StringUtils.equals(mch.getMpId(), "globalpay"))
.map(WeChatPayConfig.Merchant::getMerchantId)
.collect(Collectors.toList());
JSONObject subMerchant = pmtSubMerchantIdMapper.randomOne(availableMerchants);
if(subMerchant==null){
if (subMerchant == null) {
throw new BadRequestException("System is busy Please try again");
}
Date now = new Date();
@ -329,9 +602,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
throw new ForbiddenException("The user name has been registered");
}
String clientMoniker = generateClientMoniker();
JSONObject sysClient = new JSONObject();
JSONObject followBd = managerMapper.findByLoginId("customerservice");
sysClient.put("bd_user", followBd.getString("manager_id"));
@ -344,9 +615,21 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("state", apply.getString("state"));
sysClient.put("postcode", apply.getString("postcode"));
sysClient.put("royalpayindustry", apply.getString("industry"));
sysClient.put("alipayindustry", apply.getString("alipayindustry"));
sysClient.put("industry", apply.getString("wechatindustry"));
sysClient.put("enable_wechat", 1);
if (StringUtils.isBlank(apply.getString("wechatindustry"))) {
sysClient.put("industry", 331);
sysClient.put("enable_wechat", 0);
}
sysClient.put("contact_person", apply.getString("contact_person"));
sysClient.put("contact_job", apply.getString("contact_job"));
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("contact_phone", "+61" + apply.getString("contact_phone"));
sysClient.put("company_phone", apply.getString("company_phone"));
sysClient.put("client_moniker", clientMoniker);
sysClient.put("create_time", new Date());
@ -356,7 +639,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("approve_time", new Date());
sysClient.put("creator", 0);
sysClient.put("business_name", apply.getString("short_name"));
sysClient.put("industry", 331);
/*sysClient.put("industry", 331);*/
sysClient.put("merchant_id", subMerchant.getString("merchant_id"));
sysClient.put("sub_merchant_id", subMerchant.getString("sub_merchant_id"));
sysClient.put("common_sub_merchant_id", 1);
@ -367,12 +650,24 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("ali_sub_merchant_id", clientMoniker);
clientMapper.save(sysClient);
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id", sysClient.getIntValue("client_id"));
representativeInfo.put("representative_person", apply.getString("representative_person"));
representativeInfo.put("job_title", apply.getString("representative_job_title"));
representativeInfo.put("phone", apply.getString("representative_phone"));
representativeInfo.put("email", apply.getString("representative_email"));
representativeInfo.put("address", apply.getString("registered_address"));
representativeInfo.put("suburb", apply.getString("registered_suburb"));
representativeInfo.put("state", apply.getString("registered_state"));
representativeInfo.put("postcode", apply.getString("registered_postcode"));
sysClientLegalPersonMapper.save(representativeInfo);
JSONObject clientBd = new JSONObject();
clientBd.put("client_id", sysClient.getIntValue("client_id"));
clientBd.put("bd_id", followBd.getString("manager_id"));
clientBd.put("bd_name", followBd.getString("display_name"));
clientBd.put("create_time", new Date());
clientBd.put("create_id","0");
clientBd.put("create_id", "0");
clientBd.put("start_date", new Date());
clientBd.put("proportion", 1);
clientBDMapper.saveBD(clientBd);
@ -394,6 +689,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysAccount.put("nation_code", "+61");
clientAccountMapper.save(sysAccount);
if (signInfo != null) {
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", sysClient.getString("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", signInfo.getString("contract_url"));
fileJson.put("status", 1);
fileJson.put("signature_time", new Date());
fileJson.put("signature_ip", signInfo.getString("signature_ip"));
fileJson.put("user_agent", signInfo.getString("user_agent"));
fileJson.put("signature_account_id", sysAccount.getString("account_id"));
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
}
JSONObject sysBank = new JSONObject();
sysBank.put("client_id", clientId);
sysBank.put("account_no", apply.getString("bank_no"));
@ -412,6 +723,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
JSONObject clientConfig = new JSONObject();
clientConfig.put("client_id", clientId);
clientConfig.put("skip_clearing", 1);
clientConfig.put("enable_wechat", 1);
clientConfig.put("client_moniker", clientMoniker);
clientConfig.put("clean_days", apply.getIntValue("clean_days"));
clientConfig.put("common_sub_merchant_id", 1);
@ -424,7 +736,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
apply.put("client_moniker", clientMoniker);
sysClientPreMapperMapper.update(apply);
permissionPartnerManager.permissionClientModuleSave(clientId,clientMoniker);
permissionPartnerManager.permissionClientModuleSave(clientId, clientMoniker);
JSONObject sysRate = new JSONObject();
sysRate.put("client_id", clientId);
@ -432,7 +744,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysRate.put("remark", "自主申请");
sysRate.put("create_time", new Date());
sysRate.put("update_time", new Date());
sysRate.put("active_time", DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
sysRate.put("active_time", DateFormatUtils.format(DateUtils.addDays(new Date(),-1), "yyyy-MM-dd"));
sysRate.put("expiry_time", DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd"));
JSONObject rateConfig = JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
@ -453,14 +765,26 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline");
configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay");
configNewClientRate(sysRate, clientId, "jd", "JDpay");
configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay");
Runnable task2 = () -> {
try {
clientManager.getNewAggregateAgreeFile(clientMoniker, null, true);
if (signInfo != null) {
clientManager.registerClientApplyGMS(clientMoniker, sysAccount.getString("account_id"));
}else {
clientManager.getNewAggregateAgreeFile(clientMoniker, null, true);
}
} catch (Exception ignore) {
logger.error("{}自助申请成功,支付宝报备失败:{}",clientMoniker,ignore);
}
//发送开通短信和邮件
try {
simpleClientApplyService.sendOpenSms(apply.getString("contact_phone"), "61");
// clientManager.sendOpenEmail(sysClient, apply.getString("username"), apply.getString("password"));
} catch (Exception e) {
logger.error("{}:发送短信或邮件失败:{}",clientMoniker,e);
}
};
pool.execute(task2);
}
private String generateClientMoniker() {
@ -533,7 +857,55 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
return REGISTER_CLIENT_PROCESS_PREFIX + codeKey;
}
//region 手机登录
@Override
public void getAndSendLoginSmsCode(String phoneNumber, String nationCode, HttpServletRequest request) {
JSONObject result = new JSONObject();
String reidsCheckCodeKey = getLoginClientRedisKey(phoneNumber);
String value = stringRedisTemplate.boundValueOps(reidsCheckCodeKey).get();
if (StringUtils.isNotEmpty(value)) {
throw new BadRequestException("SMS has been sentPlease check your messages or try again in 1 minutes.");
}
ArrayList<String> param = new ArrayList<>();
String registerClientCode = RandomStringUtils.random(6, false, true);
param.add("RoyalPay");
param.add(registerClientCode);
String expireMin = "1";
param.add(expireMin);
try {
if(request.getLocales().nextElement().equals(Locale.CHINESE)|| request.getLocales().nextElement().equals(Locale.SIMPLIFIED_CHINESE)){
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", "");
}else{
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID_ENGLISH, param, "RoyalPay", "", "");
}
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong Please try again");
}
stringRedisTemplate.boundValueOps(getLoginClientRedisKey(phoneNumber)).set(registerClientCode, Long.parseLong(expireMin), TimeUnit.MINUTES);
}
@Override
public void verifyLoginSMSCode(String codeKey, String phoneNumber) {
String rediskey = getLoginClientRedisKey(phoneNumber);
String codeValue = stringRedisTemplate.boundValueOps(rediskey).get();
if (codeValue == null || !codeValue.equals(codeKey)) {
throw new BadRequestException("Verification code has expired or is not correct");
}
stringRedisTemplate.delete(rediskey);
}
private String getVerifyMailRedisKey(String codekey) {
return VERIFY_MAIL_PREFIX + codekey;
}
private String getLoginClientRedisKey(String phoneNumber){
return LOGIN_CLIENT_PREFIX + phoneNumber;
}
private String getLoginClientProcessRedisKey(String codeKey) {
return LOGIN_CLIENT_PROCESS_PREFIX + codeKey;
}
//endregion
}

@ -0,0 +1,56 @@
package au.com.royalpay.payment.manage.application.web;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
@Controller
public class ContentController {
@Resource
private SimpleClientApplyService simpleClientApplyService;
@GetMapping("/contract/source")
private String helloWorld(Model model,@RequestParam String username, @RequestParam String clean_days){
JSONObject contractInfo= simpleClientApplyService.getPreApplyInfoForAggree(username ,clean_days);
model.addAttribute("company_phone", contractInfo.getString("company_phone"));
model.addAttribute("legal_phone", contractInfo.getString("legal_phone"));
model.addAttribute("acn_type", contractInfo.getString("acn_type"));
model.addAttribute("account_no", contractInfo.getString("account_no"));
model.addAttribute("contact_email", contractInfo.getString("contact_email"));
model.addAttribute("bank", contractInfo.getString("bank"));
model.addAttribute("account_name", contractInfo.getString("account_name"));
model.addAttribute("legal_email", contractInfo.getString("legal_email"));
model.addAttribute("state", contractInfo.getString("state"));
model.addAttribute("start_date", contractInfo.getString("start_date"));
model.addAttribute("contact_person", contractInfo.getString("contact_person"));
model.addAttribute("postcode", contractInfo.getString("postcode"));
model.addAttribute("clean", contractInfo.getString("clean"));
model.addAttribute("clean_days", contractInfo.getString("clean_days"));
model.addAttribute("legal_job_title", contractInfo.getString("legal_job_title"));
model.addAttribute("bsb_no", contractInfo.getString("bsb_no"));
model.addAttribute("company_name", contractInfo.getString("company_name"));
model.addAttribute("address", contractInfo.getString("address"));
model.addAttribute("suburb", contractInfo.getString("suburb"));
model.addAttribute("wechat_rate", contractInfo.getString("wechat_rate"));
model.addAttribute("cbbank_rate", contractInfo.getString("cbbank_rate"));
model.addAttribute("alipay_online_rate", contractInfo.getString("alipay_online_rate"));
model.addAttribute("bestpay_rate", contractInfo.getString("bestpay_rate"));
model.addAttribute("alipay_rate", contractInfo.getString("alipay_rate"));
model.addAttribute("jd_rate", contractInfo.getString("jd_rate"));
return "contract_for_compliance";
}
@GetMapping(value = "/aggregateFile/client_info")
@ResponseBody
public JSONObject getClientInfoByAggree(@RequestParam String username, @RequestParam String clean_days) {
return simpleClientApplyService.getPreApplyInfoForAggree(username ,clean_days);
}
}

@ -3,15 +3,24 @@ package au.com.royalpay.payment.manage.application.web;
import au.com.royalpay.payment.manage.application.beans.ClientPreApplyBean;
import au.com.royalpay.payment.manage.application.beans.ClientPreApplyStep1Bean;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/register")
@ -20,19 +29,21 @@ 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) {
simpleClientApplyService.checkAccountName(phone,nation_code);
public void checkAccountName(@RequestParam String nation_code, @RequestParam String phone) {
simpleClientApplyService.checkAccountName(phone, nation_code);
}
@GetMapping("/account/mail/{address}/verify/{codeKey}/jump")
public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String address,@RequestParam String username) {
public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String address, @RequestParam String username) {
simpleClientApplyService.checkOrGenerateVerifyMailKey(address, codeKey);
ModelAndView view = new ModelAndView("mail/verify_mail");
view.addObject("codeKey", codeKey);
view.addObject("address", address);
view.addObject("username",username);
view.addObject("username", username);
return view;
}
@ -70,6 +81,31 @@ public class SimpleClientApplyController {
simpleClientApplyService.saveOrUpdateApplyInfo(applyBean.insertObject(), username);
}
@PostMapping(value = "/clientCompliance/commit_aggregate_file")
@ResponseBody
public JSONObject getClientArregateFile(@RequestHeader("User-Agent") String userAgent,@RequestParam MultipartFile file, @RequestParam(value = "username") String username, @RequestParam(value = "clean_days") String clean_days) throws IOException {
JSONObject signInfo = new JSONObject();
signInfo.put("signature_ip", RequestEnvironment.getClientIp());
signInfo.put("user_agent", userAgent);
return simpleClientApplyService.getClientAggregateFile(username, file, clean_days, signInfo);
}
@GetMapping("/client/source_aggregate_file")
public JSONObject getSourceAggregateFile(@RequestParam String username, @RequestParam String clean_days) {
return simpleClientApplyService.getSourceAggregateFile(username, clean_days);
}
@PostMapping("/upload/files")
public JSONObject uploadImage(@RequestParam MultipartFile file) throws Exception {
return attachmentClient.uploadFile(file, false);
}
@GetMapping(value = "/aggregateFile/client_info")
@ResponseBody
public JSONObject getClientInfoByAggree(@RequestParam String username, @RequestParam String clean_days) {
return simpleClientApplyService.getPreApplyInfoForAggree(username, clean_days);
}
@GetMapping("/info/bank/{bsb_no}")
public JSONObject getBankInfo(@PathVariable String bsb_no, @RequestParam String username, @RequestParam String codeKey) {
simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, codeKey);
@ -82,6 +118,21 @@ public class SimpleClientApplyController {
return JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
}
@GetMapping("/config/sys_rates_register")
public List<JSONObject> getSysRateRegister() {
return simpleClientApplyService.getSysRate(sysConfigManager.getSysConfig());
}
@GetMapping("/config/pay_type")
public JSONObject getPayType() {
return simpleClientApplyService.getPayType();
}
@GetMapping("/config/getWechatIndustry")
public List<JSONObject> getWechatIndustry() {
return simpleClientApplyService.getIndustryMap();
}
@GetMapping("/send/mail/subscribe")
public void sendSubscribeMail(@RequestParam(value = "mail", required = true) String mail, @RequestParam("lang") String lang) {
simpleClientApplyService.subscribeNewsletter(mail, lang);

@ -82,4 +82,17 @@ public interface ClientAccountMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1 and (role=1 or role=2) and wechat_openid is not null", excludeColumns = {"salt", "password_hash"})
List<JSONObject> listRiskNoticeAccounts(@Param("client_id") int clientId);
/**
*
* @param openid
* @return
*/
JSONObject findOneByOpenIdAndCreateTimeDesc(@Param("wechat_openid")String openid);
JSONObject findOneByPhoneAndCreateTimeDesc(@Param("contact_phone")String contactPhone,@Param("nation_code")String nationCode);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
JSONObject findByWechatOpenId(@Param("wechat_openid")String openid);
}

@ -57,18 +57,18 @@ public class ClientUpdateInfo {
private String country;
@Pattern(regexp = "^((Australia/West)|(Australia/Eucla)|(Australia/North)|(Australia/South)|(Australia/Brisbane)|(Australia/Melbourne)|(Australia/LHI))$", message = "error.payment.valid.invalid_timezone")
private String timezone;
// private String jdindustry;
// private String royalpayindustry;
// private String referrer_id;
// private String referrer_name;
//
private String client_apply_id;
//
// private String business_hours;
// private String merchant_introduction;
// private String merchant_tag;
// private String merchant_video_url;
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;
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
@ -325,9 +325,87 @@ public class ClientUpdateInfo {
this.businessStructure = businessStructure;
}
public String getContact_job() {
return contact_job;
}
public String getLogo_url() {
return logo_url;
}
public String getRegistered_address() {
return registered_address;
}
public String getRegistered_postcode() {
return registered_postcode;
}
public String getRegistered_state() {
return registered_state;
}
public String getRegistered_suburb() {
return registered_suburb;
}
public String getRepresentative_email() {
return representative_email;
}
public String getRepresentative_job_title() {
return representative_job_title;
}
public String getRepresentative_person() {
return representative_person;
}
public String getRepresentative_phone() {
return representative_phone;
}
public void setContact_job(String contact_job) {
this.contact_job = contact_job;
}
public void setLogo_url(String logo_url) {
this.logo_url = logo_url;
}
public void setRegistered_address(String registered_address) {
this.registered_address = registered_address;
}
public void setRegistered_postcode(String registered_postcode) {
this.registered_postcode = registered_postcode;
}
public void setRegistered_state(String registered_state) {
this.registered_state = registered_state;
}
public void setRegistered_suburb(String registered_suburb) {
this.registered_suburb = registered_suburb;
}
public void setRepresentative_email(String representative_email) {
this.representative_email = representative_email;
}
public void setRepresentative_job_title(String representative_job_title) {
this.representative_job_title = representative_job_title;
}
public void setRepresentative_person(String representative_person) {
this.representative_person = representative_person;
}
public void setRepresentative_phone(String representative_phone) {
this.representative_phone = representative_phone;
}
// public String getReferrer_id() {
// public String getReferrer_id() {
// return referrer_id;
// }
//

@ -82,6 +82,8 @@ public interface ClientManager {
void checkAndSendInitEmail(JSONObject manager, String clientMoniker);
void sendOpenEmail(final JSONObject client, String username, String pwd);
// void sendInitEmail(JSONObject account,JSONObject client, String username, String pwd);
void markApproveEmailSendStatus(String clientMoniker, JSONObject manager);
@ -368,6 +370,8 @@ public interface ClientManager {
void registerAlipayOnlineGms(String clientMoniker, JSONObject manager);
void registerClientApplyGMS(String clientMoniker, String account_id);
String queryAlipayGmsStatus(String clientMoniker, JSONObject manager);
JSONObject queryAlipayGmsJson(String clientMoniker, JSONObject manager);

@ -121,6 +121,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
@ -330,7 +331,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
@Cacheable(value = ":app_client_info:", key = "''+#clientId", unless="#result == null")
@Cacheable(value = ":app_client_info:", key = "''+#clientId", unless = "#result == null")
public JSONObject getClientInfo(int clientId) {
return clientMapper.findClient(clientId);
}
@ -768,15 +769,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try {
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id",partner.getIntValue("client_id"));
representativeInfo.put("representative_person",partner.getString("legal_representative_person"));
representativeInfo.put("phone",partner.getString("legal_representative_phone"));
representativeInfo.put("email",partner.getString("legal_representative_email"));
representativeInfo.put("job_title",partner.getString("legal_representative_job"));
representativeInfo.put("address",partner.getString("registered_address"));
representativeInfo.put("suburb",partner.getString("registered_suburb"));
representativeInfo.put("postcode",partner.getString("registered_postcode"));
representativeInfo.put("state",partner.getString("registered_state"));
representativeInfo.put("client_id", partner.getIntValue("client_id"));
representativeInfo.put("representative_person", partner.getString("legal_representative_person"));
representativeInfo.put("phone", partner.getString("legal_representative_phone"));
representativeInfo.put("email", partner.getString("legal_representative_email"));
representativeInfo.put("job_title", partner.getString("legal_representative_job"));
representativeInfo.put("address", partner.getString("registered_address"));
representativeInfo.put("suburb", partner.getString("registered_suburb"));
representativeInfo.put("postcode", partner.getString("registered_postcode"));
representativeInfo.put("state", partner.getString("registered_state"));
sysClientLegalPersonMapper.save(representativeInfo);
} catch (Exception e) {
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
@ -833,19 +834,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
updateInfo.put("client_id", clientId);
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id",clientId);
representativeInfo.put("representative_person",info.getRepresentativePerson());
representativeInfo.put("phone",info.getRepresentativePhone());
representativeInfo.put("email",info.getRepresentativeEmail());
representativeInfo.put("job_title",info.getRepresentativeJobTitle());
representativeInfo.put("address",info.getRegisteredAddress());
representativeInfo.put("suburb",info.getRegisteredSuburb());
representativeInfo.put("postcode",info.getRegisteredPostcode());
representativeInfo.put("state",info.getRegisteredState());
if(sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null){
representativeInfo.put("client_id", clientId);
representativeInfo.put("representative_person", info.getRepresentativePerson());
representativeInfo.put("phone", info.getRepresentativePhone());
representativeInfo.put("email", info.getRepresentativeEmail());
representativeInfo.put("job_title", info.getRepresentativeJobTitle());
representativeInfo.put("address", info.getRegisteredAddress());
representativeInfo.put("suburb", info.getRegisteredSuburb());
representativeInfo.put("postcode", info.getRegisteredPostcode());
representativeInfo.put("state", info.getRegisteredState());
if (sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null) {
sysClientLegalPersonMapper.update(representativeInfo);
}else{
} else {
sysClientLegalPersonMapper.save(representativeInfo);
}
@ -905,6 +906,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
clientMapper.update(info);
if (StringUtils.isNotBlank(info.getString("representative_person"))) {
JSONObject legal = new JSONObject();
legal.put("client_id", client.getIntValue("client_id"));
legal.put("representative_person", info.getString("representative_person"));
legal.put("job_title", info.getString("representative_job_title"));
legal.put("phone", info.getString("representative_phone"));
legal.put("email", info.getString("representative_email"));
legal.put("address", info.getString("registered_address"));
legal.put("suburb", info.getString("registered_suburb"));
legal.put("state", info.getString("registered_state"));
legal.put("postcode", info.getString("registered_postcode"));
sysClientLegalPersonMapper.update(legal);
}
saveOrUpdateMailList(info, client);
clientInfoCacheSupport.clearClientCache(clientId);
}
@ -1185,6 +1199,72 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
@Override
public void sendOpenEmail(final JSONObject client, String username, String pwd) {
JSONObject model = new JSONObject();
model.put("username", username);
model.put("password", pwd);
model.put("client_moniker", client.getString("client_moniker"));
model.put("contact_person", client.getString("contact_person"));
model.put("credential_code", client.getString("credential_code"));
List<JSONObject> bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date());
// todo Velocity
Context ctx = new Context();
ctx.setVariable("bds", bds);
ctx.setVariable("password", pwd);
ctx.setVariable("username", username);
ctx.setVariable("client_moniker", client.getString("client_moniker"));
ctx.setVariable("contact_person", client.getString("contact_person"));
ctx.setVariable("credential_code", client.getString("credential_code"));
final String content = thymeleaf.process("mail/new_client_notice", ctx);
// final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/new_client_notice.vm",
// "utf-8", model);
ctx.setVariable("password", "*****");
final String contentBd = thymeleaf.process("mail/new_client_notice", ctx);
final List<String> mailTos = new ArrayList<>();
String mailTo = client.getString("contact_email");
if (StringUtils.isEmpty(mailTo)) {
throw new EmailException("Client Contact Email is invalid");
}
mailTos.add(mailTo);
JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
if (clientLegal != null && StringUtils.isNotBlank(clientLegal.getString("email"))) {
mailTos.add(clientLegal.getString("email"));
}
final List<String> emails = new ArrayList<>();
for (JSONObject bd : bds) {
String email = bd.getString("email");
if (StringUtils.isNotEmpty(email)) {
emails.add(email);
}
}
new Thread() {
@Override
public void run() {
try {
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content);
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
"", contentBd);
JSONObject clientUpdate = new JSONObject();
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 3);
clientUpdate.put("approve_email_id", emailId);
clientMapper.update(clientUpdate);
} catch (Exception e) {
JSONObject clientUpdate = new JSONObject();
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 0);
clientUpdate.put("approve_email_id", null);
clientMapper.update(clientUpdate);
throw new EmailException("Email Sending Failed", e);
}
}
}.start();
}
public void sendInitEmail(final JSONObject client, String username, String pwd) {
logger.debug("sending email after comply");
JSONObject model = new JSONObject();
@ -1230,7 +1310,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public void run() {
try {
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos,","), "", content);
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content);
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
"", contentBd);
JSONObject clientUpdate = new JSONObject();
@ -1476,6 +1556,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
checkPhoneAndWechatExist(account);
JSONObject accountJson = account.toJson();
JSONObject accountCheck = clientAccountMapper.findByUsernameForDuplicate(accountJson.getString("username"));
if (accountCheck != null) {
@ -1496,6 +1577,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return accountJson;
}
private void checkPhoneAndWechatExist(NewAccountBean account) {
if (clientAccountMapper.findByPhone(account.getContactPhone(), "+" + account.getNation_code()) != null) {
throw new BadRequestException("Mobile phone number has been bound to other accounts");
}
;
}
@Override
@Transactional
public void resetAccountPwd(JSONObject manager, String clientMoniker, String accountId, String pwd) {
@ -1564,6 +1652,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account == null) {
throw new BadRequestException("account not exists");
}
if (clientAccountMapper.findByWechatOpenId(user.getString("openid")) != null || clientAccountMapper.findByWxUnioinId(user.getString("unioinid")) != null) {
throw new BadRequestException("The WeChat has been linked to other accounts");
}
JSONObject res = new JSONObject();
if (StringUtils.equals(user.getString("openid"), account.getString("wechat_openid"))) {
res.put("notitle", true);
@ -3386,8 +3477,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject client = getClientInfoByMoniker(clientMoniker);
String clientPayType = "";
String companyPhoto = "";
String storePhoto= "";
String webSite= "";
String storePhoto = "";
String webSite = "";
int sourceEnum = 2;
if (client == null) {
throw new InvalidShortIdException();
@ -3403,7 +3494,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (clientAllAuthFiles.stream().noneMatch(fileJson -> fileKey.equals(fileJson.getString("file_name")))) {
if ("client_agree_file".equals(fileKey)) {
throw new BadRequestException("Please check that the agreement has been signed");
}else {
} else {
throw new BadRequestException("Please check the " + fileNames[i] + " is uploaded completely");
}
}
@ -3448,7 +3539,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException{
public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException {
if (StringUtils.isBlank(file.getOriginalFilename())) {
throw new BadRequestException("Please Enter Full Name");
}
@ -3524,11 +3615,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
client.put("end_date", end_date);
client.put("full_name", file.getOriginalFilename());
client.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8"));
BufferedImage img = ImageIO.read(file.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(img, "png", out);
client.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
client.put("img", "data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
if (clientLegal != null) {
client.put("legal_person", clientLegal.getString("representative_person"));
@ -3623,7 +3714,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (aggregateFiles != null && aggregateFiles.size() > 0) {
clientFilesMapper.deleteAggreeByClientId(clientId);
}
String signatureAccountId = StringUtils.isNotBlank("account_id")?manager.getString("account_id"):manager.getString("manager_id");
String signatureAccountId = StringUtils.isNotBlank("account_id") ? manager.getString("account_id") : manager.getString("manager_id");
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", clientId);
fileJson.put("last_update_date", new Date());
@ -3637,7 +3728,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
fileJson.put("status", 0);
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
logger.info("{}合同文件上传成功IP:{},us-agent:{},signature_id:{}",clientId,manager.getString("signature_ip"),manager.getString("user_agent"),signatureAccountId);
logger.info("{}合同文件上传成功IP:{},us-agent:{},signature_id:{}", clientId, manager.getString("signature_ip"), manager.getString("user_agent"), signatureAccountId);
JSONObject file = new JSONObject();
file.put("file_id", fileJson.getString("file_id"));
file.put("file_value", fileJson.getString("file_value"));
@ -4133,7 +4224,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject oldClienetLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client_id);
if (oldClienetLegal == null) {
sysClientLegalPersonMapper.save(clientLegal);
}else {
} else {
sysClientLegalPersonMapper.update(clientLegal);
}
}
@ -4719,18 +4810,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
if (!client.containsKey("store_photo") || !client.containsKey("company_photo")) {
throw new InvalidParameterException("store photo cannot be empty ");
}
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
if (client_bank == null || client_bank.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
client.put("bank_id", client_bank.getString("account_no"));
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
client.put("business_structure", "Registered body(Sole Trader)");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
@ -4850,24 +4935,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
if (!client.containsKey("company_website")) {
throw new InvalidParameterException("Website cannot be empty ");
}
if (StringUtils.isBlank(client.getString("business_structure"))) {
throw new BadRequestException("Business Structure can't be null");
client.put("business_structure", "Registered body(Sole Trader)");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
throw new BadRequestException("Alipay Industry can't be null");
}
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
if (client_bank == null || client_bank.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
client.put("bank_id", client_bank.getString("account_no"));
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
@ -4884,12 +4962,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void registerClientApplyGMS(String clientMoniker, String accountId) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker);
JSONObject account = clientAccountMapper.findById(accountId);
if (clientConfig == null) {
throw new InvalidShortIdException();
}
if (StringUtils.isNotBlank(clientConfig.getString("client_pay_type"))) {
String[] payType = clientConfig.getString("client_pay_type").split(",");
if (Arrays.asList(payType).contains("1")) {
registerAlipayOnlineGms(clientMoniker, null);
switchChannelPermission(account, clientMoniker, "Alipay", true);
}
if (Arrays.asList(payType).contains("2")) {
registerAlipayGms(clientMoniker, null);
enableGatewayAlipayOnline(account, clientMoniker, true);
}
}
}
@Override
public String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.queryOnlineGmsPortalStatus(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
@ -5184,12 +5286,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
List<JSONObject> clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id"));
if (clientFiles == null || clientFiles.equals("")) {
throw new BadRequestException("The Compliance File Must Be Uploaded!");
throw new BadRequestException("The Compliance File Must Be Uploaded!");
}
JSONObject account = getBankAccountByClientId(client.getIntValue("client_id"));
if (account == null) {
throw new BadRequestException("The Partner's Bank Account is not config!");
}
JSONObject representativeInfo = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
for(String str:representativeInfo.keySet()){
if(representativeInfo.getString(str) == null || !(representativeInfo.getString(str).length()>0)|| !(client.getString("contact_job")!=null && client.getString("contact_job").length()>0)) {
throw new BadRequestException("The LegalPersonInfo is not config!Please upgrade the RoyalPay App version");
}
}
if ( !(StringUtils.isNotBlank(client.getString("client_pay_type"))) || !(StringUtils.isNotBlank(client.getString("client_pay_desc"))) ) {
throw new BadRequestException("Merchant Payment Scenario is not config!");
}
int open_status_from = client.getIntValue("open_status");
OpenStatusModify openStatusModify = new OpenStatusModify(client_account, client_moniker, 4);
if ((client.getIntValue("source") == 1 || client.getIntValue("source") == 2) && client.getIntValue("approve_result") == 2) {
@ -5682,7 +5794,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientMapper.update(updateClient);
}
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException{
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException {
JSONObject result = new JSONObject();
InputStream stream = null;
try {
@ -5690,7 +5802,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(client);
File file = new File(client.getString("client_moniker") + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H");
ByteArrayOutputStream bos = pdu.templetPdfBos(file, "STSong-Light", "UniGB-UCS2-H");
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
ClientAuthFilesInfo clientAuthFilesInfo = new ClientAuthFilesInfo();

@ -28,6 +28,8 @@ public interface SignInAccountService {
JSONObject clientLoginCheck(LoginInfo loginInfo);
JSONObject clientAccountCheck(LoginInfo loginInfo);
void changeManagerPassword(JSONObject manager, ChangePwdBean change);
void changeAccountPassword(JSONObject partnerStatus, ChangePwdBean change);
@ -38,6 +40,13 @@ public interface SignInAccountService {
JSONObject clientWechatSignIn(String openid);
/**
*
* @param openid
* @return
*/
JSONObject clientWechatOneSignIn(String openid);
JSONObject clientWechatAppSignIn(String openId);
JSONObject clientWechatAppSignInByUnionId(String unionId);
@ -59,4 +68,5 @@ public interface SignInAccountService {
void deleteManagerCodeKey(String codekey);
JSONObject checkAuthFileStatus(JSONObject client);
}

@ -67,4 +67,43 @@ public interface SignInStatusManager {
void scanCustomerQrcode(String codeId, String openid);
String getWechatCustomerId(String codeId);
/**
* App
* @param code
* @return
*/
JSONObject clientAppWechatSignIn(String code,String ip);
/**
*
* @param phone
* @param nationCode
* @return
*/
String getClientInfoByPhoneStatusKey(String phone,String nationCode,String ip);
/**
*
* @param loginInfo
* @return
*/
String verifyClientAccountLogin(LoginInfo loginInfo,String verfiyType);
/**
* openId
* @param codeId
* @param ip
* @return
*/
JSONObject verifyClientLoginWechatBindCode (String codeId,String ip);
/**
*
* @param phone
* @param nationCode
* @param ip
* @return
*/
void verifyClientLoginPhoneBindCode (String phone,String nationCode,String ip);
}

@ -267,6 +267,13 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return account;
}
@Override
public JSONObject clientAccountCheck(LoginInfo loginInfo) {
JSONObject account = clientAccountMapper.findByUsername(loginInfo.getLoginId());
validLoginInfo(loginInfo, account);
return account;
}
@Override
public void changeManagerPassword(JSONObject manager, ChangePwdBean change) {
manager = managerMapper.findDetail(manager.getString("manager_id"));
@ -355,6 +362,17 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return account;
}
@Override
public JSONObject clientWechatOneSignIn(String openid){
JSONObject account = clientAccountMapper.findOneByOpenIdAndCreateTimeDesc(openid);
if (account == null) {
return null;
}
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return account;
}
@Override
public JSONObject clientWechatAppSignIn(String openId) {
JSONObject account = clientAccountMapper.findByAppOpenId(openId);

@ -1,16 +1,17 @@
package au.com.royalpay.payment.manage.signin.core.impls;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.tools.connections.mpsupport.WechatAppApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpClient;
import au.com.royalpay.payment.tools.connections.mpsupport.MpClientAppWechatApiProvider;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@ -19,10 +20,8 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/**
* Created by yixian on 2016-06-29.
@ -36,7 +35,11 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
@Resource
private SignInAccountService signInAccountService;
@Resource
private WechatAppApi wechatAppApi;
private MpClientAppWechatApiProvider mpClientAppWechatApiProvider;
@Resource
private ClientAccountMapper clientAccountMapper;
private final String CLIENT_LOGIN_WECHAT_BIND_PREFIX = "CLIENT_LOGIN_WECHAT_BIND_PREFIX";
private final String CLIENT_LOGIN_PHONE_BIND_PREFIX = "CLIENT_LOGIN_PHONE_BIND_PREFIX";
@Override
public JSONObject getCurrentManager(String statusKey) {
@ -61,7 +64,9 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
return null;
}
op.expire(30, TimeUnit.MINUTES);
return signInAccountService.getClient(accountId);
JSONObject account = signInAccountService.getClient(accountId);
return account;
}
private String partnerLoginRedisKey(String statusKey) {
@ -76,10 +81,40 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
return statusKey;
}
@Override
public String getClientInfoByPhoneStatusKey(String phone, String nationCode,String ip) {
String statusKey = newStatusKey();
JSONObject account = clientAccountMapper.findOneByPhoneAndCreateTimeDesc(phone, "+" + nationCode);
if (account == null) {
String expireMin = "5";
stringRedisTemplate.boundValueOps(getClientLoginPhoneBindRedisKey(phone,nationCode,ip)).set(phone, Long.parseLong(expireMin), TimeUnit.MINUTES);
return null;
}
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
return statusKey;
}
private String newStatusKey() {
return Long.toHexString(System.currentTimeMillis()) + "_" + RandomStringUtils.random(20, true, true);
}
@Override
public String verifyClientAccountLogin(LoginInfo loginInfo, String verfiyType) {
JSONObject account = signInAccountService.clientAccountCheck(loginInfo);;
if ("phone".equals(verfiyType)) {
if (account.containsKey("contact_phone")) {
throw new BadRequestException("The account has been linked to the phone number!");
}
} else {
if (account.containsKey("wechat_openid")) {
throw new BadRequestException("The account has been linked to the wechat!");
}
}
String statusKey = newStatusKey();
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getString("account_id"), 30, TimeUnit.MINUTES);
return statusKey;
}
@Override
public String managerSignIn(LoginInfo loginInfo) {
JSONObject manager = signInAccountService.managerLoginCheck(loginInfo);
@ -177,7 +212,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
String codeId = "manager_" + RandomStringUtils.random(15, true, true) + "_" + System.currentTimeMillis();
JSONObject res = new JSONObject();
res.put("code_id", codeId);
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat_qrcode/" + codeId), 300,false));
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat_qrcode/" + codeId), 300, false));
return res;
}
@ -231,13 +266,13 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
@Override
public JSONObject partnerWechatAppSignIn(String code) {
JSONObject user = wechatAppApi.appLoginUser(code);
JSONObject user = mpClientAppWechatApiProvider.getApi("clientapp").appLoginUser(code);
String openId = user.getString("openid");
String unionId = user.getString("unionid");
JSONObject account = signInAccountService.clientWechatAppSignIn(openId);
if (account == null) {
account = signInAccountService.clientWechatAppSignInByUnionId(unionId);
if (account==null){
account = signInAccountService.clientWechatAppSignInByUnionId(unionId);
if (account == null) {
JSONObject res = new JSONObject();
res.put("not_exists", true);
res.put("app_openid", openId);
@ -265,7 +300,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
String codeId = "client_" + RandomStringUtils.random(15, true, true) + "_" + System.currentTimeMillis();
JSONObject res = new JSONObject();
res.put("code_id", codeId);
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_signin_wechat_qrcode/" + codeId), 300,false));
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_signin_wechat_qrcode/" + codeId), 300, false));
lockRandomCodeId(codeId);
return res;
}
@ -275,13 +310,13 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
String codeId = "app_" + RandomStringUtils.random(20, true, true) + "_" + System.currentTimeMillis();
JSONObject res = new JSONObject();
res.put("code_id", codeId);
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_signin_qrcode/verify/" + codeId), 300,false));
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_signin_qrcode/verify/" + codeId), 300, false));
lockRandomCodeId(codeId);
return res;
}
@Override
public void clientQRCodeAppSignIn(JSONObject device,String codeId) {
public void clientQRCodeAppSignIn(JSONObject device, String codeId) {
getlockRandomCodeId(codeId);
String statusKey = newStatusKey();
JSONObject account = new JSONObject();
@ -296,7 +331,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
}
@Override
public void clientQRCodeWechatSignIn(JSONObject wxUser,String codeId) {
public void clientQRCodeWechatSignIn(JSONObject wxUser, String codeId) {
getlockRandomCodeId(codeId);
String statusKey = newStatusKey();
JSONObject account = new JSONObject();
@ -325,7 +360,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
String codeId = "customer_" + RandomStringUtils.random(15, true, true) + "_" + System.currentTimeMillis();
JSONObject res = new JSONObject();
res.put("code_id", codeId);
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/customer_qrcode_scan/" + codeId), 300,false));
res.put("code_img", QRCodeUtils.qrcodeImageCode(PlatformEnvironment.getEnv().concatUrl("/global/userstatus/customer_qrcode_scan/" + codeId), 300, false));
return res;
}
@ -344,6 +379,73 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
return statusKey;
}
@Override
public JSONObject clientAppWechatSignIn(String code,String ip) {
JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(code);
if(user==null){
throw new BadRequestException("WeChat users do not exist");
}
String openId = user.getString("openid");
JSONObject account = signInAccountService.clientWechatOneSignIn(openId);
if (account == null) {
JSONObject wechatUserInfo = mpClientAppWechatApiProvider.getApi("merchant-app").appUserInfo(openId,user.getString("access_token"));
JSONObject res = new JSONObject();
String nickName = wechatUserInfo.getString("nickname");
String unionId = wechatUserInfo.getString("unionid");
res.put("bind_status", false);
res.put("app_openid", openId);
res.put("status", "success");
String expireMin = "5";
stringRedisTemplate.boundValueOps(getClientLoginWechatBindRedisKey(openId,ip)).set(openId+"&"+nickName+"&"+unionId, Long.parseLong(expireMin), TimeUnit.MINUTES);
return res;
}
String statusKey = newStatusKey();
JSONObject result = new JSONObject();
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
account = getCurrentClient(statusKey);
account.put("sign_key", statusKey);
result.put("account",account);
result.put("app_openid", openId);
result.put("bind_status", true);
result.put("status", "success");
return result;
}
private String getClientLoginWechatBindRedisKey(String openId,String ip){
return "login:"+":"+CLIENT_LOGIN_WECHAT_BIND_PREFIX + "&"+openId+"&"+ip;
}
@Override
public JSONObject verifyClientLoginWechatBindCode(String openId,String ip){
String rediskey = getClientLoginWechatBindRedisKey(openId,ip);
String codeValue = stringRedisTemplate.boundValueOps(rediskey).get();
if (codeValue == null || !codeValue.split("&")[0].equals(openId)) {
throw new BadRequestException("The WeChat ID does not apply for binding");
}
String nickName = codeValue.split("&")[1];
String unionId = codeValue.split("&")[2];
stringRedisTemplate.delete(rediskey);
return new JSONObject(){{
put("nick_name",nickName);
put("union_id",unionId);
}};
}
private String getClientLoginPhoneBindRedisKey(String phone,String nationCode,String ip){
return "login:"+CLIENT_LOGIN_PHONE_BIND_PREFIX + "&"+nationCode+"&"+phone+"&"+ip;
}
public void verifyClientLoginPhoneBindCode(String phone,String nationCode,String ip){
String rediskey = getClientLoginPhoneBindRedisKey(phone,nationCode,ip);
String codeValue = stringRedisTemplate.boundValueOps(rediskey).get();
if (codeValue == null || !codeValue.equals(phone)) {
throw new BadRequestException("The phone number is for application binding");
}
stringRedisTemplate.delete(rediskey);
}
private void lockRandomCodeId(String codeId) {
stringRedisTemplate.boundValueOps(redisPrefix + "partner_signin" + codeId).set(codeId, 30, TimeUnit.SECONDS);

@ -0,0 +1,28 @@
package au.com.royalpay.payment.manage.support.wechatclients;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.WechatAppApi;
import au.com.royalpay.payment.tools.connections.mpsupport.impls.AbstractClientWechatAppImpl;
import org.springframework.stereotype.Service;
/**
* @Author DuLingLing
* @create 2019/10/21 0021 17:57
*/
@Service
public class MerchantAppWechatImpl extends AbstractClientWechatAppImpl implements WechatAppApi {
@Override
public String targetMpAccount() {
return "merchant-app";
}
@Override
public String getOpenIdKey() {
return "";
}
@Override
public boolean matchOpenId(String openId) {
return false;
}
}

@ -28,4 +28,17 @@
OR
sc.parent_client_id IN (select client_id from sys_clients where client_id =#{client_id} or parent_client_id=#{client_id}));
</select>
<select id="findOneByOpenIdAndCreateTimeDesc" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_accounts a
WHERE a.is_valid =1 and a.wechat_openid=#{wechat_openid}
ORDER BY a.create_time DESC
limit 1
</select>
<select id="findOneByPhoneAndCreateTimeDesc" resultType="com.alibaba.fastjson.JSONObject">
SELECT * FROM sys_accounts a
WHERE a.is_valid =1 and a.contact_phone=#{contact_phone} AND a.nation_code = #{nation_code}
ORDER BY a.create_time DESC
limit 1
</select>
</mapper>

@ -10,7 +10,7 @@
<script type="text/javascript" src="/static/lib/jquery/jquery-2.1.4.min.js"></script>
<meta content="#ffffff" name="msapplication-TileColor" />
<script type="text/javascript" data-th-inline="javascript">
window.email = /*[[*{_client.contact_email}]]*/'';
window.email = /*[[*{client.contact_email}]]*/'';
window.id = /*[[*{client.client_id}]]*/'';
window.name = /*[[*{client.contact_person}]]*/'';
window.country = /*[[*{client.country}]]*/'';

File diff suppressed because it is too large Load Diff

@ -13,6 +13,8 @@
<!-- Bootstrap 3.3.5 -->
<link href="static/css/merchant_application.css" rel="stylesheet">
<link href="static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="static/commons/css/multiLevelSelect.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="static/lib/font-awesome-4.6.3/css/font-awesome.min.css" rel="stylesheet">
<!-- Font Awesome -->
@ -33,6 +35,8 @@
<script type="text/javascript" src="/static/lib/angularjs/angular-messages.js"></script>
<script type="text/javascript" src="/static/lib/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/lib/blocs.min.js"></script>
<script type="text/javascript" src="/static/lib/ngfileupload/ng-file-upload.min.js"></script>
<script src="/static/lib/angular-plugins/ui-bootstrap-tpls-1.2.4.min.js"></script>
<script type="text/javascript" src="/static/merchantapplication/merchant_application.js"></script>
<style type="text/css">
.register-box-bg {
@ -118,6 +122,31 @@
background-color: #f7bf90;
border-color: #adadad;
}
@keyframes myfirst {
0% {
transform: rotateY(1deg);
}
100% {
transform: rotateY(90deg);
}
}
div.polaroid {
text-align: center;
}
div.rotate_left {
position: fixed;
width: 200px;
margin: 0 -100px;
top: 40%;
left: 50%;
z-index: 9999999;
}
.dh {
animation: myfirst 1s linear 0s infinite alternate;
}
</style>
<script>
var _hmt = _hmt || [];
@ -141,6 +170,8 @@
<div class="pace-activity"></div>
</div>
<div id="loading" style="width:100%;height:100%;display:none"></div>
<div id="main">
<div id="page-index" class="register-page">
<nav id="header" class="navbar navbar-dark navbar-full navbar-bg">
@ -200,6 +231,15 @@
</ul>
</div>
</nav>
<div class="polaroid" id="loading_logo" style="display: none">
<div class="rotate_left">
<img class="dh" src="static/images/r_logo.svg" alt="RoyalPay" style="width:150px;height:150px;margin-top: 10%;
margin-bottom: 10%;"/>
<p style="color: #666">To Be The Best QRCode Payment Service Provider!</p>
</div>
</div>
<div id="fullpage" class="fullpage-wrapper">
<div style="clear: both"></div>
<div class='progress' style="height: 0px">
@ -368,6 +408,7 @@
<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 has-feedback"
ng-class="{'has-error':companyForm.abn.$invalid && companyForm.abn.$dirty}">
<input class="form-control" ng-model="partner.abn" placeholder="ABN"
@ -425,8 +466,33 @@
</ul>
</div>
</div>
<div class="form-group has-feedback">
<select class="form-control" ng-model="partner.wechatindustry" id="wechatindustry"
ng-change="changeDays(partner.clean_days)" name="wechatindustry" required
ng-options="wechatindustry.value as wechatindustry.label for wechatindustry in industries">
<option value="" readonly>WechatIndustry</option>
</select>
</div>
<div class="form-group has-feedback">
<input class="form-control" id="alipay_category" required
name="alipay_category" readonly
ng-model="partner.alipay_category"
multi-level-select-popup="alipayMccCategory"
on-select="onAlipayMccSelect($selected)"
placeholder="alipayIndustry"
>
<div ng-messages="partnerForm.alipay_category.$error"
ng-if="partnerForm.alipay_category.$dirty">
<p class="small text-danger" ng-message="required">Required
Field</p>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Merchant Payment Scenario</div>
<div class="panel-body">
@ -479,6 +545,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}">
@ -507,6 +591,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}">
@ -564,15 +680,6 @@
</div>
</div>
<!-- <div class="form-group has-feedback"
ng-class="{'has-error':companyForm.royalpayindustry.$invalid && companyForm.royalpayindustry.$dirty}">
<input class="form-control" id="royalpayindustry" required
name="royalpayindustry" readonly
ng-model="partner.royalpayindustry"
multi-level-select-popup="royalpayindustry"
on-select="onRoyalPayIndustrySelect($selected)">
</div>-->
<div class="row">
<div class="col-xs-12 margin-bottom">
<button type="button" class="btn btn-success btn-block btn-flat"
@ -686,6 +793,9 @@
<div class="form-group has-feedback">
<p class="form-control-static">&nbsp; <small>JD Rate Value: &nbsp;{{rate.jd_rate_value}}%</small></p>
</div>
<div class="form-group has-feedback">
<p class="form-control-static">&nbsp; <small>CB Bankpay Rate Value: &nbsp;{{rate.cb_bankpay_rate_value}}%</small></p>
</div>
</div>
<div class="form-group has-feedback">
@ -693,229 +803,14 @@
<label><input type="checkbox" ng-model="partner.agree" value="1"><a href="https://file.royalpay.com.au/open/2018/03/07/merchant_service20180307.pdf" target="_blank">Agree to Terms & Conditions</a></label>
</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="saveApplyInfo(cleanForm,4)" ng-disabled="cleanForm.$invalid || !partner.agree || submit" >Submit<span ng-if="submit" class="dotting"></span>
</button>
<div>
<p ng-if="resError" style="padding: 6px 12px;font-size: 14px;"
class="small text-danger">{{resError}}</p>
</div>
</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="saveApplyInfo(cleanForm,4)" ng-disabled="cleanForm.$invalid || !partner.agree || submit" >Submit<span ng-if="submit" class="dotting"></span>
</button>-->
<button type="button" class="btn btn-success btn-block btn-flat"
ng-click="submit(materialsForm)">Submit
ng-click="submitApply()" ng-disabled="cleanForm.$invalid || !partner.agree || submit" >Submit<span ng-if="submit" class="dotting"></span>
</button>
<div>
<p ng-if="resError" style="padding: 6px 12px;font-size: 14px;"
@ -923,7 +818,7 @@
</div>
</div>
</div>
</form>-->
</form>
<form ng-show="chooseArray[4]">
<div class="success_img">
<img height="60" width="60" src="static/images/step/gou.png">
@ -949,6 +844,9 @@
<p>4. If you have any questions, you can contact our customer service.<br>
若有任何疑问,请联系我们客服。
</p>
<p>
<a ng-href="{{contract_url}}" target="_blank">查看合同</a>
</p>
</div>
<div class="row" style=" margin-left: 70px; margin-right: 70px;">
<div class="col-xs-12">
@ -992,7 +890,6 @@
</div>
</div>
</div>
</div>
<section class="section section-six fp-auto-height footer">
<div class="container">

@ -0,0 +1,43 @@
goBottom = function () {
window.scrollTo(0, document.documentElement.scrollHeight - document.documentElement.clientHeight);
document.getElementById("signPlace").style="";
};
cancel = function () {
document.getElementById("signPlace").style="display:none";
};
submitSign = function () {
var sign = $("#signature").jSignature('getData', 'image');
var signInfo = {};
var signSrc = 'data:' + sign[0] + ',' + sign[1];
debugger;
document.getElementById("img1").src='data:' + sign[0] + ',' + sign[1];
var full_name = document.getElementById("full_name").value
document.getElementById('fullName').value = full_name;
document.getElementById("signPlace").style="display:none";
};
uploadSign2 = function()
{
debugger;
var src = document.getElementById("img1").src;
var filename = document.getElementById('fullName').value;
var signFile = dataURLtoFile(src,filename);
/*未完成*/
}
function dataURLtoFile(dataurl, filename) {//将base64转换为文件
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, {type: mime});
}

@ -1,4 +1,5 @@
angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl', ['$scope', '$http','$interval', function ($scope, $http,$interval) {
var app = angular.module('applyPartnerApp', ['ngMessages','ngFileUpload','ui.bootstrap']);
app.controller('applyPartnerCtrl', ['$scope', '$http','$interval','Upload','$uibModal', 'commonDialog', function ($scope, $http,$interval,Upload,$uibModal,commonDialog) {
var countryMap = [{
"label": "AUS",
"value": "AUS"
@ -51,6 +52,93 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
"value": "WA"
}
];
var industryMap = [
{
"label": "鞋包服饰",
"value": "327"
},
{
"label": "机票行业",
"value": "339"
},
{
"label": "软件服务",
"value": "356"
},
{
"label": "旅游票务",
"value": "357"
},
{
"label": "国际租车",
"value": "358"
},
{
"label": "医疗服务(出国)",
"value": "359"
},
{
"label": "医疗服务(不出国)",
"value": "360"
},
{
"label": "留学教育(网络教育)",
"value": "361"
},
{
"label": "留学教育(一年及以下)",
"value": "362"
},
{
"label": "其它货物贸易行业",
"value": "338"
},
{
"label": "文具/办公用品",
"value": "337"
},
{
"label": "综合商城",
"value": "336"
},
{
"label": "酒店行业",
"value": "328"
},
{
"label": "教育行业",
"value": "329"
},
{
"label": "国际物流",
"value": "330"
},
{
"label": "数码电器",
"value": "332"
},
{
"label": "母婴",
"value": "333"
},
{
"label": "化妆品",
"value": "334"
},
{
"label": "食品",
"value": "335"
},
{
"label": "留学教育(一年以上)",
"value": "363"
},
{
"label": "其它服务行业",
"value": "331"
}
];
var removeClientPayDesc = function (items, key) {
for (var i = 0; i < items.length; i++) {
var item = items[i];
@ -64,6 +152,7 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.states = angular.copy(stateMap);
$scope.countries = angular.copy(countryMap);
$scope.cleanDays = angular.copy(cleanDays);
$scope.industries = angular.copy(industryMap);
$scope.canClick=false;
$scope.description = "Send Code";
$scope.partner = {nation_code:"+61"};
@ -72,6 +161,7 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.partner.client_pay_type = [];
$scope.partner.client_pay_desc = [];
$scope.phone_code_timer=$interval(function () {}, 1000);
$scope.signInfo = {};
$scope.loadRoyalpayindustry = function () {
$http.get('/static/data/rp_industry_apply.json').then(function (resp) {
@ -80,6 +170,18 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
};
$scope.loadRoyalpayindustry();
$scope.loadAlipayCategory = function () {
$http.get('/static/data/alipayMcc.json').then(function (resp) {
$scope.alipayMccCategory = resp.data;
})
};
$scope.loadAlipayCategory();
$scope.onAlipayMccSelect = function (selectedItem) {
$scope.partner.alipay_category = selectedItem.label;
$scope.partner.alipayindustry = selectedItem.mccCode;
};
$scope.loadCustomerChannel = function () {
$http.get('/static/data/rp_customer_channel.json').then(function (resp) {
$scope.customerchannel = resp.data;
@ -160,6 +262,29 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
}
},1000)
};*/
$scope.partner.sameAsAddress=false;
$scope.sameAddress = function (){
$scope.partner.sameAsAddress = !($scope.partner.sameAsAddress);
if($scope.partner.sameAsAddress) {
$scope.partner.registered_address = $scope.partner.address;
$scope.partner.registered_suburb = $scope.partner.suburb;
$scope.partner.registered_postcode = $scope.partner.postcode;
$scope.partner.registered_state = $scope.partner.state;
}
}
$scope.partner.sameAsContactPerson = false;
$scope.samePerson = function (){
$scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson);
if($scope.partner.sameAsContactPerson) {
$scope.partner.representative_person = $scope.partner.contact_person;
$scope.partner.representative_phone = $scope.partner.contact_phone;
$scope.partner.representative_email = $scope.partner.contact_email;
$scope.partner.representative_job_title = $scope.partner.contact_job;
}
}
$scope.checkEmail = function () {
$scope.trueEmail = false;
if($scope.partner.contact_email){
@ -171,6 +296,13 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
}
}
};
$scope.signContract = function(username,clean_days)
{
var url='/contract/source?username='+username+'&clean_days='+clean_days;
return url;
}
$scope.sendVerificationCode = function () {
$scope.initErrorMsg();
$scope.sendPhoneCodeTime();
@ -181,7 +313,6 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.description="Send Code";
$scope.canClick=false;
}
$scope.resError = resp.data.message;
});
};
@ -226,6 +357,7 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t1.AlipayOnline);
$scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t1.Bestpay);
$scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t1.JDpay);
$scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t1.CB_Bankpay);
$scope.showCleanDay = true;
break;
}
@ -235,6 +367,7 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t2.Bestpay);
$scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t2.AlipayOnline);
$scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t2.JDpay);
$scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t2.CB_Bankpay);
$scope.showCleanDay = true;
break;
}
@ -244,6 +377,7 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t3.Bestpay);
$scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t3.AlipayOnline);
$scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t3.JDpay);
$scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t3.CB_Bankpay);
$scope.showCleanDay = true;
break;
}
@ -336,6 +470,43 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
if(index == 4){
$scope.submit = true;
}
if ($scope.partner.client_pay_type.indexOf('2') >= 0) {
if (!$scope.partner.company_photo) {
alert('Shop Photo1 is necessary');
return;
}
if (!$scope.partner.store_photo) {
alert('Shop Photo2 is necessary');
return;
}
}
if ($scope.partner.client_pay_type.length == 0) {
alert('请选择商户支付场景')
return;
}
if ($scope.partner.client_pay_desc.length == 0) {
alert('请选择商户支付方式')
return;
}
if ($scope.partner.client_pay_type.indexOf('1') >= 0) {
if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) {
alert("请检查线上支付场景是否已选择支付方式");
return;
}
}
if ($scope.partner.client_pay_type.indexOf('2') >= 0) {
if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) {
alert("请检查线下支付场景是否已选择支付方式");
return;
}
}
if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) {
if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) {
alert("请检查线下支付是否已选择收银系统类型");
return;
}
}
$scope.initParam();
if ($scope.partner.company_name.indexOf("Migration") != -1) {
alert("Company Name包含敏感词汇请检查后重新提交");
@ -444,11 +615,409 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
if(!$scope.partner.abn){
$scope.partner.abn = ' ';
}
if(!$scope.partner.contact_job){
$scope.partner.contact_job = ' ';
}
if(!$scope.partner.representative_person){
$scope.partner.representative_person = ' ';
}
if(!$scope.partner.representative_phone){
$scope.partner.representative_phone = ' ';
}
if(!$scope.partner.representative_email){
$scope.partner.representative_email = ' ';
}
if(!$scope.partner.representative_job_title){
$scope.partner.representative_job_title = ' ';
}
if(!$scope.partner.registered_address){
$scope.partner.registered_address = ' ';
}
if(!$scope.partner.registered_suburb){
$scope.partner.registered_suburb = ' ';
}
if(!$scope.partner.registered_state){
$scope.partner.registered_state = ' ';
}
if(!$scope.partner.registered_postcode){
$scope.partner.registered_postcode = ' ';
}
if(!$scope.partner.logo_url){
$scope.partner.logo_url = ' ';
}
if(!$scope.partner.company_website){
$scope.partner.company_website = ' ';
}
if(!$scope.partner.company_photo){
$scope.partner.company_photo = ' ';
}
}
$scope.initErrorMsg = function () {
$scope.resError = '';
}
$scope.uploadLogo = function (file) {
if (file != null) {
if (file.size > 1 * 1024 * 1024) {
commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB请压缩后重试', type: 'error'})
} else {
$scope.logoProgress = {value: 0};
Upload.upload({
url: '/register/upload/files',
data: {file: file}
}).then(function (resp) {
delete $scope.logoProgress;
$scope.partner.logo_id = resp.data.fileid;
$scope.partner.logo_url = resp.data.url;
}, function (resp) {
delete $scope.logoProgress;
/*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);
})
}
}
};
$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/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/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);
})
}
}
};
$scope.submitSign = function (fullName) {
var sign = $("#signature").jSignature('getData', 'image');
var signInfo = {};
signInfo.src = 'data:' + sign[0] + ',' + sign[1];
signInfo.fullName = fullName;
$scope.$close(signInfo);
};
$scope.submitApply = function () {
$uibModal.open({
backdrop: false,
templateUrl: '/static/payment/partner/templates/agreement_signature_dialog.html',
controller: 'agreementSignDialogCtrl',
size: 'lg'
}).result.then(function (result) {
$scope.confirmBtn = true;
$scope.signItBtn = false;
$scope.signInfo.fullName = result.fullName;
$scope.signInfo.src = result.src;
$scope.uploadSign();
})
};
$scope.uploadSign = function () {
if ($scope.signInfo.fullName == null || $scope.signInfo.fullName == "") {
commonDialog.alert({title: 'Submit Fail', content: 'Please confirm full name entered', type: 'error'});
return;
}
if ($scope.signInfo.src == null || $scope.signInfo.src == "") {
commonDialog.alert({title: 'Submit Fail', content: 'Please confirm signature', type: 'error'});
return;
}
document.getElementById("loading_logo").style ="";
$scope.white();
var signFile = dataURLtoFile($scope.signInfo.src, $scope.signInfo.fullName);
$scope.logoProgress = {value: 0};
Upload.upload({
url: '/register/clientCompliance/commit_aggregate_file'+'?username='+$scope.partner.contact_phone+'&clean_days='+$scope.partner.clean_days,
data: {file: signFile}
}).then(function (resp) {
$scope.contract_url= resp.data.contract_url;
document.getElementById('loading').style.display = "none";
document.getElementById('loading_logo').style.display = "none";
delete $scope.logoProgress;
$scope.changeChoose(4);
}, function (resp) {
document.getElementById('loading').style.display = "none";
document.getElementById('loading_logo').style.display = "none";
delete $scope.logoProgress;
commonDialog.alert({title: 'Commit Aggregate File Fail', content: resp.data.message, type: 'error'})
}, function (evt) {
$scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total);
});
};
$scope.white=function(){
$("#loading").css({
"position":"absolute",    //绝对位置
"display":"block",    //让对象成为块级元素
"background-color":"white",  //背景白色
"z-index":"9999",  //最上层显示
"opacity":"0.7"  //背景透明度
});
}
function dataURLtoFile(dataurl, filename) {//将base64转换为文件
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, {type: mime});
}
}]);
app.controller('agreementSignDialogCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
$scope.submitSign = function (fullName) {
var sign = $("#signature").jSignature('getData', 'image');
var signInfo = {};
signInfo.src = 'data:' + sign[0] + ',' + sign[1];
signInfo.fullName = fullName;
$scope.$close(signInfo);
};
}]);
app.factory('commonDialog', ['$q', '$uibModal', function ($q, $uibModal) {
return {
alert: function (cfg) {
var choises = [{label: 'OK', className: 'btn-default', key: '1'}];
var config = {
title: cfg.title,
content: cfg.content,
contentHtml: cfg.contentHtml,
backdrop: cfg.backdrop,
size: cfg.size,
choises: choises,
type: cfg.type
};
var defer = $q.defer();
showModalDialog(config).then(function () {
defer.resolve();
}, function () {
defer.resolve()
});
return defer.promise;
},
confirm: function (cfg) {
var choises = [{label: 'OK', className: 'btn-success', key: '1'},
{label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}];
var config = {
title: cfg.title,
content: cfg.content,
contentHtml: cfg.contentHtml,
json:cfg.json,
backdrop: cfg.backdrop,
size: cfg.size,
choises: cfg.choises || choises
};
var deferred = $q.defer();
showModalDialog(config).then(function (choice) {
if (choice.dismiss) {
deferred.reject();
} else {
deferred.resolve(choice.key);
}
}, function () {
deferred.reject();
});
return deferred.promise;
},
inputNum: function (cfg) {
return $uibModal.open({
templateUrl: '/static/commons/templates/num_input.html',
size: 'sm',
resolve: {
cfg: function () {
return cfg;
}
},
controller: ['$scope', 'cfg', function ($scope, cfg) {
$scope.title = cfg.title || 'Input Amount';
$scope.data = {};
$scope.submit = function () {
$scope.$close($scope.data.num);
};
}]
}).result;
},
inputText:function (cfg) {
return $uibModal.open({
backdrop: 'static', keyboard: false,
templateUrl:'/static/commons/templates/text_input.html',
size: cfg.size || 'sm',
resolve:{
cfg:function () {
return cfg;
}
},
controller:['$scope','cfg',function ($scope, cfg) {
$scope.title = cfg.title || 'Input Amount';
$scope.data = {};
$scope.submit = function () {
$scope.$close($scope.data.text);
};
}]
}).result;
}
};
function showModalDialog(cfg) {
cfg = angular.extend({}, defaultCfg, cfg);
return $uibModal.open({
templateUrl: 'static/commons/templates/dialog.html',
controller: 'commonModalCtrl',
size: cfg.size,
backdrop: cfg.backdrop,
resolve: {
cfg: function () {
return cfg;
}
}
}).result;
}
}]);
app.controller('commonModalCtrl', ['$scope', '$timeout', 'cfg', function ($scope, $timeout, cfg) {
var bgClasses = {
success: 'bg-success',
error: 'bg-warning',
info: 'bg-info'
};
var glyIcons = {
success: 'glyphicon-ok-circle',
error: 'glyphicon-remove-circle',
info: 'glyphicon-info-sign'
};
$scope.title = cfg.title;
$scope.content = cfg.content;
$scope.contentHtml = cfg.contentHtml;
$scope.jsonData = cfg.json;
$scope.bgClass = bgClasses[cfg.type];
$scope.glyIcon = glyIcons[cfg.type];
$scope.choises = cfg.choises;
if(cfg.type=='success'){
$timeout(function () {
$scope.$dismiss();
},2000)
}
$scope.btnClick = function (choice) {
$scope.$close(choice);
}
}]);
app.directive('multiLevelSelectPopup', [function () {
return {
restrict: 'A',
scope: {
multiLevelSelectPopup: '=',
childrenKey: '@',
labelKey: '@',
onSelect: '&'
},
link: function (scope, element, attr) {
var selectBox,bg;
var selectGroups = [];
scope.labelKey = scope.labelKey || 'label';
scope.childrenKey = scope.childrenKey || 'children';
$(element).focus(function () {
if (selectBox) {
selectBox.remove();
}
selectBox = $('<div></div>').addClass('ml-select-box');
var offset = $(this).offset();
selectBox.css({
top: (offset.top + $(this).outerHeight() + 3) + 'px',
left: offset.left + 'px'
});
var container = $('<div></div>').appendTo(selectBox);
initSelectLevel(container, scope.multiLevelSelectPopup, 0);
var $body = $('body');
selectBox.appendTo($body);
bg = $('<div></div>').css({position:'fixed',top:0,left:0,right:0,bottom:0,zIndex:9998}).appendTo($body);
bg.click(function () {
selectBox.remove();
bg.remove();
selectBox = null;
})
});
function initSelectLevel(container, list, groupIndex) {
if (selectGroups[groupIndex]) {
var groups = selectGroups.splice(groupIndex, 999);
angular.forEach(groups, function (group) {
group.remove();
})
}
var levelBox = $('<ul></ul>').addClass('select-group').appendTo(container);
selectGroups[groupIndex] = levelBox;
angular.forEach(list, function (item) {
var label = item[scope.labelKey];
var li = $('<li></li>').text(label).attr('title', label).appendTo(levelBox);
if (!item[scope.childrenKey] || !item[scope.childrenKey].length) {
if (angular.isFunction(scope.onSelect)) {
li.click(function () {
try {
scope.$apply(function () {
scope.onSelect({$selected: item});
})
}catch(err){}
selectBox.remove();
bg.remove();
selectBox = null;
})
}
} else {
li.hover(function () {
levelBox.find('.active').removeClass('active');
li.addClass('active');
initSelectLevel(container, item.children, groupIndex + 1);
});
}
})
}
}
}
}]);

@ -337,6 +337,17 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiBoo
return;
}
if ($scope.partner.representativeInfo.address == null||
$scope.partner.representativeInfo.suburb == null ||
$scope.partner.representativeInfo.postcode == null ||
$scope.partner.representativeInfo.state == null ||
$scope.partner.representativeInfo.representative_person == null ||
$scope.partner.representativeInfo.phone == null ||
$scope.partner.representativeInfo.email == null ||
$scope.partner.representativeInfo.job_title == null || $scope.partner.contact_job == null || !$scope.partner.contact_job.length>0) {
commonDialog.alert({title: 'Message', content: '请前去完善商户法人信息注册地址,再进行提交!', type: 'info'});
return;
}
if (($scope.partner.business_structure == "Company" && $scope.partner.acn == null) || ($scope.partner.business_structure != "Company" && $scope.partner.abn == null)) {
commonDialog.alert({title: 'Message', content: '请前去完善商户资料,再进行提交!', type: 'info'});
return;
@ -1137,6 +1148,23 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiBoo
})
})
};
$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('aggregateFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', '$uibModal', 'Upload', function ($scope, $http, $rootScope, commonDialog, $state, $uibModal, Upload) {

@ -4,6 +4,11 @@
.dialog{
font-size: 17px;
}
.modal-lg{
width: 60%;
}
</style>
<!--<div class="modal-header bg-green">-->
<!-- <h4 style="text-align: center">Sign</h4>-->
@ -12,7 +17,12 @@
<div class="row dialog">
<div class="container-fluid">
<div class="" style="overflow-x: auto;">
<span style="color:#f39c12">* Please sign here</span>
<span style="font-size: 150%">You are signing the agreement, and the merchant will be officially opened after you submit your signature</span>
<br/>
<span style="font-size: 150%">您正在签署协议,签名提交后正式开通商户。</span>
<br/>
<br/>
<span style="color:#f39c12;font-size: 150%;">* Please sign here\请在此签名)</span>
<div id="signatureparent" class="sign">
<div id="signature" style="border:1px solid black;background-color: white; lineWidth:5; color: black "></div>
<div style="float:right">

Loading…
Cancel
Save