master
wangning 7 years ago
parent 2b414c537d
commit 1e97502b4b

@ -52,8 +52,6 @@ public class ClientPreApplyBean {
@NotEmpty(message = "agree can't be null") @NotEmpty(message = "agree can't be null")
private boolean agree; private boolean agree;
private String codeKey;
public JSONObject insertObject() { public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this); JSONObject res = (JSONObject) JSON.toJSON(this);
return res; return res;

@ -9,9 +9,14 @@ import au.com.royalpay.payment.tools.http.HttpUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*; 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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -59,9 +64,13 @@ public class SimpleClientApplyController {
@RequestMapping(value = "/info/update/{username}/step1", method = RequestMethod.POST) @RequestMapping(value = "/info/update/{username}/step1", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public void registerCompanyInfoStep1(@PathVariable String username, @RequestBody @Valid ClientPreApplyStep1Bean account) { public JSONObject registerCompanyInfoStep1(@PathVariable String username, @RequestBody @Valid ClientPreApplyStep1Bean account) {
JSONObject result = new JSONObject();
simpleClientApplyService.verifyRegisterSMSCode(account.getPhoneCodeKey(), account.getContact_phone()); simpleClientApplyService.verifyRegisterSMSCode(account.getPhoneCodeKey(), account.getContact_phone());
String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, null);
simpleClientApplyService.saveOrUpdateApplyInfo(account.insertObject(), username); simpleClientApplyService.saveOrUpdateApplyInfo(account.insertObject(), username);
result.put("codeKey",codeKey);
return result;
} }
@RequestMapping(value = "/info/phone/{phone_number}/verify", method = RequestMethod.POST) @RequestMapping(value = "/info/phone/{phone_number}/verify", method = RequestMethod.POST)
@ -75,8 +84,7 @@ public class SimpleClientApplyController {
@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, String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username,applyBean.getCodeKey());
StringUtils.isEmpty(applyBean.getCodeKey()) ? null : applyBean.getCodeKey());
simpleClientApplyService.saveOrUpdateApplyInfo(applyBean.insertObject(), username); simpleClientApplyService.saveOrUpdateApplyInfo(applyBean.insertObject(), username);
result.put("codeKey", codeKey); result.put("codeKey", codeKey);
return result; return result;

Loading…
Cancel
Save