master
wangning 7 years ago
parent 25f11e7c3c
commit 5980813f58

@ -0,0 +1,78 @@
package au.com.royalpay.payment.manage.application.beans;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.hibernate.validator.constraints.NotEmpty;
/**
* Created by yuan on 2018/5/23.
*/
public class ClientPreApplyStep1Bean {
@NotEmpty(message = "username can't be null")
private String username;
@NotEmpty(message = "password can't be null")
private String password;
@NotEmpty(message = "contact_person can't be null")
private String contact_person;
@NotEmpty(message = "contact_phone can't be null")
private String contact_phone;
@NotEmpty(message = "contact_email can't be null")
private String contact_email;
@NotEmpty(message = "phoneCodeKey can't be null")
private String phoneCodeKey;
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
return res;
}
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 getPhoneCodeKey() {
return phoneCodeKey;
}
public void setPhoneCodeKey(String phoneCodeKey) {
this.phoneCodeKey = phoneCodeKey;
}
}

@ -1,7 +1,7 @@
package au.com.royalpay.payment.manage.application.core; 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 au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
public interface SimpleClientApplyService { public interface SimpleClientApplyService {
@ -25,7 +25,7 @@ public interface SimpleClientApplyService {
void verifyMail(String address, JSONObject loginAccount); void verifyMail(String address, JSONObject loginAccount);
void saveOrUpdateApplyInfo(ClientPreApplyBean companyBean, String client_moniker); void saveOrUpdateApplyInfo(JSONObject companyBean, String username);
JSONObject getBankInfo(String bsb_no); JSONObject getBankInfo(String bsb_no);

@ -1,6 +1,5 @@
package au.com.royalpay.payment.manage.application.core.impls; 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.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.mappers.preapply.SysClientPreMapperMapper; import au.com.royalpay.payment.manage.mappers.preapply.SysClientPreMapperMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
@ -224,9 +223,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Override @Override
@Transactional @Transactional
public void saveOrUpdateApplyInfo(ClientPreApplyBean companyBean, String username) { public void saveOrUpdateApplyInfo(JSONObject applyInfo, String username) {
JSONObject apply = sysClientPreMapperMapper.findByUserName(username); JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
JSONObject applyInfo = companyBean.insertObject();
if (apply == null ){ if (apply == null ){
applyInfo.put("client_pre_apply_id", IdUtil.getId()); applyInfo.put("client_pre_apply_id", IdUtil.getId());
sysClientPreMapperMapper.save(applyInfo); sysClientPreMapperMapper.save(applyInfo);

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.application.web; 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.ClientPreApplyBean;
import au.com.royalpay.payment.manage.application.beans.ClientPreApplyStep1Bean;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
@ -24,7 +25,7 @@ public class SimpleClientApplyController {
private SimpleClientApplyService simpleClientApplyService; private SimpleClientApplyService simpleClientApplyService;
@RequestMapping(value = "/account/{account_name}/check", method = RequestMethod.GET) @RequestMapping(value = "/account/{account_name}/check", method = RequestMethod.GET)
public void checkAccountName(@PathVariable String account_name){ public void checkAccountName(@PathVariable String account_name) {
simpleClientApplyService.checkAccountName(account_name); simpleClientApplyService.checkAccountName(account_name);
} }
@ -32,17 +33,16 @@ public class SimpleClientApplyController {
@ResponseBody @ResponseBody
public void registerAccount(@PathVariable String codeKey, @RequestBody @Valid NewAccountBean accountBean, Errors errors, HttpServletResponse response) { public void registerAccount(@PathVariable String codeKey, @RequestBody @Valid NewAccountBean accountBean, Errors errors, HttpServletResponse response) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
simpleClientApplyService.verifyRegisterSMSCode(codeKey,accountBean.getContactPhone()); simpleClientApplyService.verifyRegisterSMSCode(codeKey, accountBean.getContactPhone());
JSONObject account = simpleClientApplyService.newAccount(accountBean); JSONObject account = simpleClientApplyService.newAccount(accountBean);
String statusKey = simpleClientApplyService.partnerSignIn(account); String statusKey = simpleClientApplyService.partnerSignIn(account);
HttpUtils.setCookie(response, CommonConsts.CODE_KEY, statusKey); HttpUtils.setCookie(response, CommonConsts.CODE_KEY, statusKey);
} }
@RequestMapping(value = "/account/mail/{address}/verify/{codeKey}/jump", method = RequestMethod.GET) @RequestMapping(value = "/account/mail/{address}/verify/{codeKey}/jump", method = RequestMethod.GET)
public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String address){ public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String address) {
simpleClientApplyService.checkOrGenerateVerifyMailKey(address,codeKey); simpleClientApplyService.checkOrGenerateVerifyMailKey(address, codeKey);
ModelAndView view = new ModelAndView("mail/register_application"); ModelAndView view = new ModelAndView("mail/register_application");
view.addObject("codeKey", codeKey); view.addObject("codeKey", codeKey);
view.addObject("address", address); view.addObject("address", address);
@ -51,23 +51,39 @@ public class SimpleClientApplyController {
@RequestMapping(value = "/account/mail/{address}/verify/{codeKey}", method = RequestMethod.POST) @RequestMapping(value = "/account/mail/{address}/verify/{codeKey}", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public void verifyMail(@PathVariable String codeKey, @PathVariable String address,@RequestBody JSONObject account){ public void verifyMail(@PathVariable String codeKey, @PathVariable String address, @RequestBody JSONObject account) {
simpleClientApplyService.checkOrGenerateVerifyMailKey(address,codeKey); simpleClientApplyService.checkOrGenerateVerifyMailKey(address, codeKey);
simpleClientApplyService.verifyMail(address,account); simpleClientApplyService.verifyMail(address, account);
simpleClientApplyService.deleteVerifyMailKey(codeKey); simpleClientApplyService.deleteVerifyMailKey(codeKey);
} }
@RequestMapping(value = "/info/update/{username}/step1", method = RequestMethod.POST)
@ResponseBody
public void registerCompanyInfoStep1(@PathVariable String username, @RequestBody @Valid ClientPreApplyStep1Bean account) {
simpleClientApplyService.verifyRegisterSMSCode(account.getPhoneCodeKey(), account.getContact_phone());
simpleClientApplyService.saveOrUpdateApplyInfo(account.insertObject(), username);
}
@RequestMapping(value = "/info/phone/{phone_number}/verify", method = RequestMethod.POST)
@ResponseBody
public JSONObject registerCompanyInfoStep1(@PathVariable String phone_number, @RequestParam String nation_code) {
JSONObject result = new JSONObject();
result.put("phoneCodeKey", simpleClientApplyService.getAndSendSmsCode(phone_number, nation_code));
return result;
}
@RequestMapping(value = "/info/update/{username}", method = RequestMethod.POST) @RequestMapping(value = "/info/update/{username}", method = RequestMethod.POST)
public JSONObject registerCompanyInfo(@PathVariable String username, @RequestBody @Valid ClientPreApplyBean applyBean) { public JSONObject registerCompanyInfo(@PathVariable String username, @RequestBody @Valid ClientPreApplyBean applyBean) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, StringUtils.isEmpty(applyBean.getCodeKey())?null:applyBean.getCodeKey()); String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username,
simpleClientApplyService.saveOrUpdateApplyInfo(applyBean,username); StringUtils.isEmpty(applyBean.getCodeKey()) ? null : applyBean.getCodeKey());
result.put("codeKey",codeKey); simpleClientApplyService.saveOrUpdateApplyInfo(applyBean.insertObject(), username);
result.put("codeKey", codeKey);
return result; return result;
} }
@RequestMapping(value = "/info/bank/{bsb_no}", method = RequestMethod.GET) @RequestMapping(value = "/info/bank/{bsb_no}", method = RequestMethod.GET)
public JSONObject getBankInfo(@PathVariable String bsb_no,@RequestParam String username,@RequestParam String codeKey) { public JSONObject getBankInfo(@PathVariable String bsb_no, @RequestParam String username, @RequestParam String codeKey) {
simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, codeKey); simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, codeKey);
return simpleClientApplyService.getBankInfo(bsb_no); return simpleClientApplyService.getBankInfo(bsb_no);
} }

Loading…
Cancel
Save