master
yuan 7 years ago
parent 5984216f64
commit 9889521acd

@ -0,0 +1,191 @@
package au.com.royalpay.payment.manage.application.beans;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateUtils;
import java.util.Date;
/**
* Created by yuan on 2018/5/23.
*/
public class ClientPreApplyBean {
private String username;
private String password;
private String contact_person;
private String contact_phone;
private String contact_email;
private String company_name;
private String company_phone;
private String abn;
private String short_name;
private String address;
private String suburb;
private String state;
private String postcode;
private String industry;
private String bank_no;
private String bank_name;
private String bsb_no;
private String clean_days;
private boolean agree;
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
return res;
}
public String getCompany_name() {
return company_name;
}
public void setCompany_name(String company_name) {
this.company_name = company_name;
}
public String getAbn() {
return abn;
}
public void setAbn(String abn) {
this.abn = abn;
}
public String getShort_name() {
return short_name;
}
public void setShort_name(String short_name) {
this.short_name = short_name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSuburb() {
return suburb;
}
public void setSuburb(String suburb) {
this.suburb = suburb;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public String getIndustry() {
return industry;
}
public void setIndustry(String industry) {
this.industry = industry;
}
public String getBank_no() {
return bank_no;
}
public void setBank_no(String bank_no) {
this.bank_no = bank_no;
}
public String getBank_name() {
return bank_name;
}
public void setBank_name(String bank_name) {
this.bank_name = bank_name;
}
public String getBsb_no() {
return bsb_no;
}
public void setBsb_no(String bsb_no) {
this.bsb_no = bsb_no;
}
public String getClean_days() {
return clean_days;
}
public void setClean_days(String clean_days) {
this.clean_days = clean_days;
}
public boolean isAgree() {
return agree;
}
public void setAgree(boolean agree) {
this.agree = agree;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getContact_person() {
return contact_person;
}
public void setContact_person(String contact_person) {
this.contact_person = contact_person;
}
public String getContact_phone() {
return contact_phone;
}
public void setContact_phone(String contact_phone) {
this.contact_phone = contact_phone;
}
public String getContact_email() {
return contact_email;
}
public void setContact_email(String contact_email) {
this.contact_email = contact_email;
}
public String getCompany_phone() {
return company_phone;
}
public void setCompany_phone(String company_phone) {
this.company_phone = company_phone;
}
}

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.application.core;
import au.com.royalpay.payment.manage.application.beans.ClientPreApplyBean;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import com.alibaba.fastjson.JSONObject;
@ -22,5 +23,9 @@ public interface SimpleClientApplyService {
void deleteVerifyMailKey(String codeKey);
void updateApplyInfo(ClientPreApplyBean companyBean,String client_moniker);
JSONObject getBankInfo(String bsb_no);
void checkAccountName(String acocunt_name);
}

@ -1,7 +1,9 @@
package au.com.royalpay.payment.manage.application.core.impls;
import au.com.royalpay.payment.manage.application.beans.ClientPreApplyBean;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.mappers.preapply.SysClientPreMapperMapper;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.system.core.MailGunService;
@ -11,13 +13,21 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.mail.SendMail;
import au.com.royalpay.payment.tools.utils.sms.SmsSingleSender;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSONObject;
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.springframework.beans.factory.annotation.Value;
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.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
@ -27,10 +37,16 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Service
public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Value("${royalpay.sms.appid}")
private int appId;
@Value("${royalpay.sms.appkey}")
@ -46,6 +62,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private SysClientPreMapperMapper sysClientPreMapperMapper;
@Resource
private ClientBankAccountMapper clientBankAccountMapper;
@Resource
private ClientMapper clientMapper;
@Resource
private ClientRateMapper clientRateMapper;
@Resource
private ClientConfigMapper clientConfigMapper;
@Resource
private StringRedisTemplate stringRedisTemplate;
private final SmsSingleSender smsSingleSender = new SmsSingleSender(appId, appKey);
@ -171,11 +203,159 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Override
public void checkAccountName(String account_name) {
JSONObject account = clientAccountMapper.findByUsernameForDuplicate(account_name);
if (!account.isEmpty()){
if (account != null){
throw new ForbiddenException("用户名已被注册");
}
}
@Override
@Transactional
public void updateApplyInfo(ClientPreApplyBean companyBean, String username) {
JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
if (apply == null ){
throw new BadRequestException();
}
JSONObject applyInfo = companyBean.insertObject();
applyInfo.put("client_pre_apply_id",apply.getIntValue("client_pre_apply_id"));
applyInfo.put("update_time",new Date());
sysClientPreMapperMapper.update(applyInfo);
if(applyInfo.getBoolean("agree")){
applyerToClient(username);
}
}
@Transactional
private void applyerToClient(String username){
JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
String clientMoniker = generateClientMoniker();
JSONObject sysClient = new JSONObject();
sysClient.put("company_name",apply.getString("company_name"));
sysClient.put("abn",apply.getString("abn"));
sysClient.put("short_name",apply.getString("short_name"));
sysClient.put("address",apply.getString("address"));
sysClient.put("suburb",apply.getString("suburb"));
sysClient.put("state",apply.getString("state"));
sysClient.put("postcode",apply.getString("postcode"));
sysClient.put("industry",apply.getString("industry"));
sysClient.put("contact_person",apply.getString("contact_person"));
sysClient.put("contact_email",apply.getString("contact_email"));
sysClient.put("contact_phone",apply.getString("contact_phone"));
sysClient.put("company_phone",apply.getString("company_phone"));
sysClient.put("client_moniker",clientMoniker);
sysClient.put("create_time",new Date());
sysClient.put("source",4);
sysClient.put("creator",0);
clientMapper.save(sysClient);
int clientId = sysClient.getIntValue("client_id");
JSONObject sysAccount = new JSONObject();
sysAccount.put("username",apply.getString("username"));
sysAccount.put("display_name",apply.getString("username"));
String salt = PasswordUtils.newSalt();
sysAccount.put("salt", salt);
sysAccount.put("password_hash", PasswordUtils.hashPwd(apply.getString("password"), salt));
sysAccount.put("password_aes", PasswordUtils.encryptAESPwd(apply.getString("password")));
sysAccount.put("creator",0);
sysAccount.put("contact_phone",apply.getString("contact_phone"));
sysAccount.put("password_hash",apply.getString("password"));
sysAccount.put("client_id",clientId);
sysAccount.put("create_time",new Date());
clientAccountMapper.save(sysAccount);
JSONObject sysBank = new JSONObject();
sysBank.put("client_id",clientId);
sysBank.put("account_no",apply.getString("bank_no"));
sysBank.put("account_name",apply.getString("bank_name"));
sysBank.put("bsb_no",apply.getString("bsb_no"));
JSONObject bankInfo = getBankInfo(apply.getString("bsb_no"));
sysBank.put("bank",bankInfo.getString("bank"));
sysBank.put("city",bankInfo.getString("city"));
sysBank.put("address",bankInfo.getString("address"));
sysBank.put("system",bankInfo.getString("system"));
sysBank.put("postcode",bankInfo.getString("postcode"));
sysBank.put("state",bankInfo.getString("state"));
sysBank.put("branch",bankInfo.getString("branch"));
clientBankAccountMapper.save(sysBank);
JSONObject sysConfig = new JSONObject();
sysConfig.put("client_id",clientId);
sysConfig.put("client_moniker",clientMoniker);
sysConfig.put("clean_days",apply.getIntValue("clean_days"));
clientConfigMapper.save(sysConfig);
JSONObject sysRate = new JSONObject();
sysRate.put("client_id",clientId);
sysRate.put("clean_days",apply.getIntValue("clean_days"));
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("expiry_time", DateFormatUtils.format(DateUtils.addYears(new Date(),1), "yyyy-MM-dd"));
JSONObject rateConfig = clientManager.getSysRateConfig();
JSONObject chooseRate = new JSONObject();
if (apply.getIntValue("clean_days") == 1){
chooseRate = rateConfig.getJSONObject("t1");
}
if (apply.getIntValue("clean_days") == 2){
chooseRate = rateConfig.getJSONObject("t2");
}
if (apply.getIntValue("clean_days") == 3){
chooseRate = rateConfig.getJSONObject("t3");
}
sysRate.putAll(chooseRate);
configNewClientRate(sysRate, clientId, "Wechat", "Wechat");
configNewClientRate(sysRate, clientId, "Alipay", "Alipay");
configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline");
configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay");
configNewClientRate(sysRate, clientId, "jd", "JDpay");
}
private String generateClientMoniker(){
String clientMoniker = RandomStringUtils.random(4, true, true).toUpperCase();
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client != null){
generateClientMoniker();
}
return clientMoniker;
}
private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey) {
if (config.containsKey(rateKey)) {
JSONObject newConfig = new JSONObject();
newConfig.putAll(config);
newConfig.put("rate_value", config.getBigDecimal(rateKey));
newConfig.put("rate_name", channel);
if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"),
config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) {
return;
}
List<JSONObject> existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel);
for (JSONObject rateLog : existRate) {
rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1));
clientRateMapper.updateConfig(rateLog);
}
clientRateMapper.saveRate(newConfig);
}
}
@Override
public JSONObject getBankInfo(String bsb_no) {
String url = "https://api.bank.codes/au-bsb/json/ab9379cfdab559509bbdcdd11923489f/" + bsb_no;
JSONObject banInfo = new JSONObject();
try {
HttpRequestResult result = new HttpRequestGenerator(url, RequestMethod.GET).execute();
if (result.isSuccess()) {
banInfo = result.getResponseContentJSONObj();
}
} catch (URISyntaxException | IOException e) {
}
return banInfo;
}
private String getRegisterClientRedisKey(String phoneNumber){
return REGISTER_CLIENT_PREFIX +phoneNumber;
}

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.application.web;
import au.com.royalpay.payment.manage.application.beans.ClientPreApplyBean;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
@ -9,20 +10,15 @@ import au.com.royalpay.payment.tools.http.HttpUtils;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Controller
@RestController
@RequestMapping("/register")
public class SimpleClientApplyController {
@Resource
@ -32,8 +28,7 @@ public class SimpleClientApplyController {
@RequestMapping(value = "/account/{account_name}", method = RequestMethod.GET)
@ResponseBody
public void checkAccountName(@PathVariable String account_name, Errors errors){
HttpUtils.handleValidErrors(errors);
public void checkAccountName(@PathVariable String account_name){
simpleClientApplyService.checkAccountName(account_name);
}
@ -70,4 +65,14 @@ public class SimpleClientApplyController {
signInAccountService.accountCheck(loginInfo);
simpleClientApplyService.deleteVerifyMailKey(codeKey);
}
@RequestMapping(value = "/info/update/{username}", method = RequestMethod.POST)
public void registerCompanyInfo(@PathVariable String username, @RequestBody @Valid ClientPreApplyBean applyBean) throws Exception {
simpleClientApplyService.updateApplyInfo(applyBean,username);
}
@RequestMapping(value = "/info/bank/{bsb_no}", method = RequestMethod.GET)
public JSONObject getBankInfo(@PathVariable String bsb_no) throws Exception {
return simpleClientApplyService.getBankInfo(bsb_no);
}
}

@ -0,0 +1,23 @@
package au.com.royalpay.payment.manage.mappers.preapply;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@AutoMapper(tablename = "sys_client_pre_apply", pkName = "client_pre_apply_id")
public interface SysClientPreMapperMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject data);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject data);
@AutoSql(type = SqlType.SELECT)
JSONObject findByUserName(@Param("username") String username);
}

@ -175,26 +175,26 @@
<div id="fullpage" class="fullpage-wrapper">
<div class='progress' style="height: 0px">
<div class='progress_inner'>
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(1):before':!disabledArray[0],'dis_before':!disabledArray[0]}">
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(1):before':chooseArray[0],'dis_before':chooseArray[0]}">
<label for='step-1'>Account Information</label>
</div>
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(2):before':!disabledArray[1],'dis_before':!disabledArray[1]}">
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(2):before':chooseArray[1],'dis_before':chooseArray[1]}">
<label for='step-2'>Company Information</label>
</div>
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(3):before':!disabledArray[2],'dis_before':!disabledArray[2]}">
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(3):before':chooseArray[2],'dis_before':chooseArray[2]}">
<label for='step-3'>Bank Account</label>
</div>
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(4):before':!disabledArray[3],'dis_before':!disabledArray[3]}">
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(4):before':chooseArray[3],'dis_before':chooseArray[3]}">
<label for='step-4'>Clean Days</label>
</div>
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(5):before':!disabledArray[4],'dis_before':!disabledArray[4]}">
<div class='progress_inner__step' ng-class="{'body .dis_before:nth-child(5):before':chooseArray[4],'dis_before':chooseArray[4]}">
<label for='step-5'>Success</label>
</div>
<input checked='checked' id='step-1' name='step' type='radio' ng-disabled = "!disabledArray[0]" ng-checked="chooseArray[0]" ng-click="changeChoose(0);">
<input id='step-2' name='step' type='radio' ng-disabled = "!disabledArray[1]" ng-checked="chooseArray[1]" ng-click="changeChoose(1);">
<input id='step-3' name='step' type='radio' ng-disabled = "!disabledArray[2]" ng-checked="chooseArray[2]" ng-click="changeChoose(2);">
<input id='step-4' name='step' type='radio' ng-disabled = "!disabledArray[3]" ng-checked="chooseArray[3]" ng-click="changeChoose(3);">
<input id='step-5' name='step' type='radio' ng-disabled = "!disabledArray[4]" ng-checked="chooseArray[4]" ng-click="changeChoose(4);">
<input checked='checked' id='step-1' name='step' type='radio' ng-disabled = "!chooseArray[0]" ng-checked="chooseArray[0]" >
<input id='step-2' name='step' type='radio' ng-disabled = "!chooseArray[1]" ng-checked="chooseArray[1]">
<input id='step-3' name='step' type='radio' ng-disabled = "!chooseArray[2]" ng-checked="chooseArray[2]">
<input id='step-4' name='step' type='radio' ng-disabled = "!chooseArray[3]" ng-checked="chooseArray[3]" >
<input id='step-5' name='step' type='radio' ng-disabled = "!chooseArray[4]" ng-checked="chooseArray[4]">
<div class='progress_inner__bar'></div>
<div class='progress_inner__bar--set'></div>
<div class='progress_inner__tabs'>
@ -241,19 +241,17 @@
<p class="login-box-msg">Easy BusinessEasy Payment</p>
<form novalidate name="accountForm" action="" method="post" ng-show="chooseArray[0]">
<div class="form-group has-feedback"
ng-class="{'has-error':accountForm.short_name.$invalid && accountForm.short_name.$dirty}">
<input type="text" class="form-control" ng-model="partner.short_name" name="short_name"
placeholder="Account Name" required maxlength="80">
<span ng-messages="accountForm.short_name.$error" ng-if="accountForm.short_name.$dirty"
ng-message="required">
</span>
ng-class="{'has-error':accountForm.username.$invalid && accountForm.username.$dirty}">
<input type="text" class="form-control" ng-model="partner.username" name="username"
placeholder="Account Name" required maxlength="80" ng-mousedown="name_exist = false">
<div style="text-align: left" ng-if="name_exist">
<p class="small text-danger">用户名已存在</p>
</div>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':accountForm.contact_person.$invalid && accountForm.contact_person.$dirty}">
<input class="form-control" ng-model="partner.contact_person" placeholder="Your Name"
required maxlength="50" name="contact_person">
<span ng-messages="accountForm.contact_person.$error"
ng-if="accountForm.contact_person.$dirty" ng-message="required">Required Field</span>
required maxlength="50" name="contact_person" ng-focus="checkUserName(partner.username)">
</div>
<div class="form-group has-feedback"
@ -261,39 +259,35 @@
<input class="form-control" ng-model="partner.contact_email" placeholder="Work Email"
required
maxlength="50" name="contact_email">
<span ng-messages="accountForm.contact_email.$error"
ng-if="accountForm.contact_email.$dirty" ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':accountForm.password.$invalid && accountForm.password.$dirty}">
<input type="password" class="form-control" ng-model="partner.password" placeholder="Password" required
maxlength="50" name="password">
<span ng-messages="accountForm.password.$error"
ng-if="accountForm.password.$dirty" ng-message="required">Required Field</span>
</div>
minlength="6" maxlength="12" name="password">
<div style="text-align: left">
<p style="text-align: left" class="small text-info">6~12个字符区分大小写</p>
</div></div>
<div class="form-group has-feedback"
ng-class="{'has-error':(accountForm.rePassword.$invalid && accountForm.rePassword.$dirty) ||partner.rePassword != partner.password}">
<input type="password" class="form-control" ng-model="partner.rePassword" placeholder="Confirm Password"
required
maxlength="50" name="rePassword">
<span ng-messages="accountForm.rePassword.$error"
ng-if="accountForm.rePassword.$dirty" ng-message="required">Required Field</span>
</div>
<div class="row">
<div class="form-group col-xs-12"
ng-class="{'has-error':accountForm.contact_phone.$invalid && accountForm.contact_phone.$dirty}">
<input type="text" name="contact_phone" required ng-model="partner.contact_phone"
class="form-control" style="width: 80%;display: inline" id="verifyCode"
placeholder="Your Phone">
<button type="button" class="btn btn-success" style="width:20%;display:inline;height: 34px;float: right;border-radius: 0px"
title="发送验证码" ng-click="sendVerificationCode()"
ng-bind="description" ng-disabled="canClick"></button>
<div style="margin-left: 40%" ng-messages="accountForm.contact_phone.$error"
ng-if="accountForm.contact_phone.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<div class="input-group">
<span class="input-group-addon">+61</span>
<input type="text" name="contact_phone" required ng-model="partner.contact_phone"
class="form-control" style="width: 80%;display: inline"
placeholder="Your Phone">
<button type="button" class="btn btn-success" style="width:20%;display:inline;height: 34px;float: right;border-radius: 0px"
title="发送验证码" ng-click="sendVerificationCode(partner.contact_phone)"
ng-bind="description" ng-disabled="canClick"></button>
</div>
</div>
</div>
@ -301,14 +295,12 @@
ng-class="{'has-error':accountForm.code.$invalid && accountForm.code.$dirty}">
<input class="form-control" ng-model="partner.code" placeholder="Code"
required maxlength="50" name="code">
<span ng-messages="accountForm.code.$error"
ng-if="accountForm.code.$dirty" ng-message="required">Required Field</span>
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<button type="button" class="btn btn-success btn-block btn-flat"
ng-click="save(accountForm,1)" ng-disabled="accountForm.$invalid">Next
ng-click="saveApplyInfo(accountForm,1)">Next
</button>
<div>
<p ng-if="resError" style="padding: 6px 12px;font-size: 14px;"
@ -322,39 +314,32 @@
ng-class="{'has-error':companyForm.company_name.$invalid && companyForm.company_name.$dirty}">
<input type="text" class="form-control" ng-model="partner.company_name" name="company_name"
placeholder="Company Name" required maxlength="80">
<span ng-messages="companyForm.company_name.$error" ng-if="companyForm.company_name.$dirty"
ng-message="required">
</span>
</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"
required maxlength="50" name="abn">
<span ng-messages="partnerForm.abn.$error"
ng-if="partnerForm.abn.$dirty" ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.short_name.$invalid && companyForm.short_name.$dirty}">
<input type="text" class="form-control" ng-model="partner.short_name" name="short_name"
placeholder="Merchant Name" required maxlength="80">
<span ng-messages="partnerForm.short_name.$error" ng-if="partnerForm.short_name.$dirty"
ng-message="required">
</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.company_phone.$invalid && companyForm.company_phone.$dirty}">
<input type="text" class="form-control" ng-model="partner.company_phone" name="company_phone"
placeholder="Company phone" required maxlength="80">
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.address.$invalid && companyForm.address.$dirty}">
<textarea class="form-control" ng-model="partner.address" placeholder="Address"
name="address" required maxlength="100"></textarea>
<span ng-messages="partnerForm.address.$error" ng-if="partnerForm.address.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.suburb.$invalid && companyForm.suburb.$dirty}">
<input class="form-control" ng-model="partner.suburb" placeholder="Suburb" required
maxlength="50" name="suburb">
<span ng-messages="partnerForm.suburb.$error" ng-if="partnerForm.suburb.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.state.$invalid && companyForm.state.$dirty}">
@ -364,15 +349,11 @@
ng-options="state.value as state.label for state in states">
<option value="">State</option>
</select>
<span ng-messages="companyForm.state.$error" ng-if="companyForm.state.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.postcode.$invalid && companyForm.postcode.$dirty}">
<input class="form-control" ng-model="partner.postcode" placeholder="Postcode" required
maxlength="50" name="postcode">
<span ng-messages="companyForm.postcode.$error" ng-if="companyForm.postcode.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':companyForm.industry.$invalid && companyForm.industry.$dirty}">
@ -382,14 +363,12 @@
ng-options="industry.value as industry.label for industry in industries">
<option value="">Industry</option>
</select>
<span ng-messages="companyForm.industry.$error" ng-if="companyForm.industry.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<button type="button" class="btn btn-success btn-block btn-flat"
ng-click="validateForm(companyForm,2)" ng-disabled="companyForm.$invalid">Next
ng-click="saveApplyInfo(companyForm,2)">Next
</button>
<div>
<p ng-if="resError" style="padding: 6px 12px;font-size: 14px;"
@ -401,83 +380,67 @@
<form novalidate name="bankForm" action="" method="post" ng-show="chooseArray[2]">
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.account_no.$invalid && bankForm.account_no.$dirty}">
<input class="form-control" ng-model="bankaccount.account_no" placeholder="Account No"
<input class="form-control" ng-model="partner.bank_no" placeholder="Account No"
required
name="account_no">
<span ng-messages="bankForm.account_no.$error" ng-if="bankForm.account_no.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.account_name.$invalid && bankForm.account_name.$dirty}">
<input class="form-control" ng-model="bankaccount.account_name" placeholder="Account Name"
<input class="form-control" ng-model="partner.bank_name" placeholder="Account Name"
required name="account_name">
<span ng-messages="bankForm.account_name.$error" ng-if="bankForm.account_name.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.bsb_no.$invalid && bankForm.bsb_no.$dirty}">
<input class="form-control" ng-model="bankaccount.bsb_no" placeholder="BSB No" required
name="bsb_no">
<span ng-messages="bankForm.bsb_no.$error" ng-if="bankForm.bsb_no.$dirty"
ng-message="required">Required Field</span>
<div class="row">
<div class="form-group col-xs-12"
ng-class="{'has-error':bankForm.bsb_no.$invalid && bankForm.bsb_no.$dirty}">
<input class="form-control" ng-model="partner.bsb_no" placeholder="BSB No" required
name="bsb_no" style="width: 80%;display: inline">
<button type="button" class="btn btn-success" style="width:20%;display:inline;height: 34px;float: right;border-radius: 0px"
title="Search" ng-click="searchBankInfo(partner.bsb_no)">Search</button>
</div>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.bank.$invalid && bankForm.bank.$dirty}">
<input class="form-control" ng-model="bankaccount.bank" placeholder="Bank" required
name="bank">
<span ng-messages="bankForm.bank.$error" ng-if="bankForm.bank.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.city.$invalid && bankForm.city.$dirty}">
<input class="form-control" ng-model="bankaccount.city" placeholder="City" required
name="city">
<span ng-messages="bankForm.city.$error" ng-if="bankForm.city.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.address.$invalid && bankForm.address.$dirty}">
<input class="form-control" ng-model="bankaccount.address" placeholder="Address" required
name="address">
<span ng-messages="bankForm.address.$error" ng-if="bankForm.address.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.system.$invalid && bankForm.system.$dirty}">
ng-class="{'has-error':bankForm.system.$invalid && bankForm.bank_system.$dirty}">
<input class="form-control" ng-model="bankaccount.system" placeholder="System" required
name="system">
<span ng-messages="bankForm.bank.$error" ng-if="bankForm.bank.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.postcode.$invalid && bankForm.postcode.$dirty}">
ng-class="{'has-error':bankForm.postcode.$invalid && bankForm.bank_postcode.$dirty}">
<input class="form-control" ng-model="bankaccount.postcode" placeholder="Postcode" required
name="postcode">
<span ng-messages="bankForm.postcode.$error" ng-if="bankForm.postcode.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.state.$invalid && bankForm.state.$dirty}">
ng-class="{'has-error':bankForm.state.$invalid && bankForm.bank_state.$dirty}">
<input class="form-control" ng-model="bankaccount.state" placeholder="State" required
name="state">
<span ng-messages="bankForm.state.$error" ng-if="bankForm.state.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':bankForm.branch.$invalid && bankForm.branch.$dirty}">
<input class="form-control" ng-model="bankaccount.branch" placeholder="Branch" required
name="branch">
<span ng-messages="bankForm.branch.$error" ng-if="bankForm.branch.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<button type="button" class="btn btn-success btn-block btn-flat"
ng-click="validateForm(bankForm,3)" ng-disabled="bankForm.$invalid">Next
ng-click="saveApplyInfo(bankForm,3)">Next
</button>
<div>
<p ng-if="resError" style="padding: 6px 12px;font-size: 14px;"
@ -489,16 +452,14 @@
<form novalidate name="cleanForm" action="" method="post" ng-show="chooseArray[3]">
<div class="form-group has-feedback"
ng-class="{'has-error':cleanForm.clean_days.$invalid && cleanForm.clean_days.$dirty}">
<select class="form-control" ng-model="rate.clean_days" id="citySelect"
ng-change="changeDays()" name="clean_days">
<select class="form-control" ng-model="partner.clean_days" id="citySelect"
ng-change="changeDays(partner.clean_days)" name="clean_days">
<option value="">Clean Days</option>
<option value="1">T+1</option>
<option value="2">T+2</option>
<option value="3">T+3</option>
</select>
<div>{{rateConfig}}</div>
<span ng-messages="cleanForm.clean_days.$error" ng-if="cleanForm.clean_days.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
@ -509,9 +470,6 @@
min="0.6" max="2.2" step="0.1" id="wechat_rate_value_input" required>
<div class="input-group-addon">%</div>
</div>
<span ng-messages="cleanForm.wechat_rate_value.$error"
ng-if="cleanForm.wechat_rate_value.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
@ -522,9 +480,6 @@
min="0.6" max="2.2" step="0.1" id="alipay_rate_value_input" required>
<div class="input-group-addon">%</div>
</div>
<span ng-messages="cleanForm.alipay_rate_value.$error"
ng-if="cleanForm.alipay_rate_value.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
@ -536,9 +491,6 @@
min="0.6" max="2.2" step="0.1" id="alipayonline_rate_value_input" required>
<div class="input-group-addon">%</div>
</div>
<span ng-messages="cleanForm.alipayonline_rate_value.$error"
ng-if="cleanForm.alipayonline_rate_value.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':cleanForm.bestpay_rate_value.$invalid && cleanForm.bestpay_rate_value.$dirty}">
@ -548,9 +500,6 @@
min="0.6" max="2.2" step="0.1" id="bestpay_rate_value_input" required>
<div class="input-group-addon">%</div>
</div>
<span ng-messages="cleanForm.bestpay_rate_value.$error"
ng-if="cleanForm.bestpay_rate_value.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':cleanForm.jd_rate_value.$invalid && cleanForm.jd_rate_value.$dirty}">
@ -560,19 +509,16 @@
min="0.6" max="2.2" step="0.1" id="jd_rate_value_input" required>
<div class="input-group-addon">%</div>
</div>
<span ng-messages="cleanForm.jd_rate_value.$error"
ng-if="cleanForm.jd_rate_value.$dirty"
ng-message="required">Required Field</span>
</div>
<div class="form-group has-feedback">
<div class="checkbox agree_left agree-text">
<label><input type="checkbox" ng-model="rate.agree">Agree to Terms & Conditions</label>
<label><input type="checkbox" ng-model="partner.agree" value="1">Agree to Terms & Conditions</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="save(cleanForm,4)" ng-disabled="!rate.agree && cleanForm.$invalid" >Submit
ng-click="saveApplyInfo(cleanForm,4)" ng-disabled="!partner.agree" >Submit
</button>
<div>
<p ng-if="resError" style="padding: 6px 12px;font-size: 14px;"
@ -819,7 +765,8 @@
</div>
<div class="row">
<div class="col-xs-12 margin-bottom2">
<button type="button" id="login-btn7" class="btn btn-success btn-block btn-flat">
<button type="button" id="login-btn7" class="btn btn-success btn-block btn-flat"
onclick="window.location.href='/login.html'">
{{seconds}}秒后,将跳转登录页, 或点击直接跳转登录页
</button>
<div>

@ -396,19 +396,27 @@ body .progress_inner input[type="radio"] {
.agree_left{
text-align: left;
}
body .dis_before{
color: white;
}
body .dis_before:nth-child(1):before{
color: white;
background: #1ea4ec;
}
body .dis_before:nth-child(2):before{
color: white;
background: #1ea4ec;
}
body .dis_before:nth-child(3):before{
color: white;
background: #1ea4ec;
}
body .dis_before:nth-child(4):before{
color: white;
background: #1ea4ec;
}
body .dis_before:nth-child(5):before {
color: white;
background: #1ea4ec;
}
/*.progress_inner__step:before{

@ -94,23 +94,28 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
"value": 338
}
];
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)return unescape(r[2]);
return null;
}
var from = getQueryString("from");
$scope.name_exist = false;
$scope.industries = angular.copy(industryMap);
$scope.states = angular.copy(stateMap);
$scope.countries = angular.copy(countryMap);
$scope.seconds = 6;
$scope.canClick=false;
$scope.description = "Send Code";
$scope.partner = {};
$scope.bankaccount = {};
$scope.rate = {};
$scope.checkUserName = function (username) {
if(username != null && username != ''){
$http.get('/register/account/' + $scope.partner.username).then(function (resp) {
$scope.name_exist = false;
}, function (resp) {
if (resp.data.status == 403){
$scope.name_exist = true;
}
})
}
};
$scope.disabledArray = new Array(true, false, false, false, false);
$scope.chooseArray = new Array(true, false, false, false, false);
$scope.changeChoose = function (index) {
@ -118,60 +123,113 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.chooseArray[index] = true;
$scope.disabledArray[index] = true;
};
$scope.goToLogin = function () {
$scope.seconds = $scope.seconds -1;
if ($scope.seconds == 0) {
location.href = '/login.html';
}
$scope.getRateConfig = function () {
$http.get('/sys/partners/sys_rates').then(function (resp) {
$scope.sysRateConfig = resp.data;
}, function (resp) {
})
};
$scope.partner = {};
if (from != null && from.toString().length == 1) {
$scope.partner.source = from;
}
$scope.validateForm = function (form,index) {
/* if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}*/
$scope.changeChoose(index);
};
$scope.getTestCode = function(){
$scope.sendPhoneCodeTime = function(){
var second=59;
var timerHandler;
timerHandler =$interval(function(){
if(second<=0){
$interval.cancel(timerHandler); //当执行的时间59s,结束时,取消定时器 cancle方法取消
$interval.cancel(timerHandler);
second=59;
$scope.description="获取验证码";
$scope.canClick=false; //因为 ng-disabled属于布尔值设置按钮可以点击可点击发送
$scope.canClick=false;
}else{
$scope.description=second+"s后重发";
second--;
$scope.canClick=true;
}
},1000) //每一秒执行一次$interval定时器方法
},1000)
};
$scope.goToLogin = function () {
var timer = $interval(function(){
$scope.seconds = $scope.seconds -1;
if ($scope.seconds == 0) {
location.href = '/login.html';
}
},1000)
};
$scope.sendVerificationCode = function (phone_number) {
$scope.sendPhoneCodeTime();
$http.post('/register/get/code/{number}').then(function (resp) {
}, function (resp) {
$scope.resError = resp.data.message;
});
};
$scope.searchBankInfo = function (bsb_no) {
if (bsb_no != null && bsb_no != "") {
$http.get('/register/info/bank/' + bsb_no).then(function (resp) {
$scope.bankInfo = resp.data;
$scope.bankaccount.bank = $scope.bankInfo.bank;
$scope.bankaccount.city = $scope.bankInfo.city;
$scope.bankaccount.address = $scope.bankInfo.address;
$scope.bankaccount.system = $scope.bankInfo.system;
$scope.bankaccount.postcode = $scope.bankInfo.postcode;
$scope.bankaccount.state = $scope.bankInfo.state;
$scope.bankaccount.branch = $scope.bankInfo.branch;
});
} else {
$scope.resError = "请先填写BSB No";
}
};
$scope.changeDays = function (clean_days) {
if (clean_days) {
switch (clean_days) {
case '1': {
$scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat);
$scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t1.Alipay);
$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);
break;
}
case '2': {
$scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat);
$scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t2.Alipay);
$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);
break;
}
case '3': {
$scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat);
$scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t3.Alipay);
$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);
break;
}
}
}
};
$scope.saveApplyInfo = function (form,index) {
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
$http.post('/register/info/update/' + $scope.partner.username, $scope.partner).then(function (resp) {
if (index == 3) {
$scope.getRateConfig();
}
if (index == 4) {
$scope.goToLogin();
}
$scope.changeChoose(index);
}, function (resp) {
$scope.resError = resp.data.message;
});
};
$scope.sendVerificationCode = function () {
$scope.getTestCode();
};
$scope.save = function (from,index) {
$scope.validateForm(from,index);
/* var timer = $interval(function(){
$scope.goToLogin();
},1000);*/
}
<!--/partners/application/captcha-image-->

Loading…
Cancel
Save