|
|
|
@ -2,8 +2,12 @@ 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.*;
|
|
|
|
|
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.ClientBankAccountMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
|
|
|
|
@ -16,10 +20,9 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.mail.SendMail;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PasswordUtils;
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestGenerator;
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestResult;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.id.IdUtil;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.qcloudsms.SmsSingleSender;
|
|
|
|
|
|
|
|
|
@ -36,17 +39,21 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
import org.thymeleaf.context.Context;
|
|
|
|
|
import org.thymeleaf.spring4.SpringTemplateEngine;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestGenerator;
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestResult;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
@ -217,21 +224,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void updateApplyInfo(ClientPreApplyBean companyBean, String username) {
|
|
|
|
|
public void saveOrUpdateApplyInfo(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);
|
|
|
|
|
if (apply == null ){
|
|
|
|
|
applyInfo.put("client_pre_apply_id", IdUtil.getId());
|
|
|
|
|
sysClientPreMapperMapper.save(applyInfo);
|
|
|
|
|
}else {
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
@ -374,7 +382,10 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
if (!address.equals(client.getString("contact_email"))) {
|
|
|
|
|
throw new BadRequestException(LocaleSupport.localeMessage("error.login.password"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject record = new JSONObject();
|
|
|
|
|
record.put("client_id",client.getIntValue("client_id"));
|
|
|
|
|
record.put("mail_confirm",true);
|
|
|
|
|
clientMapper.update(record);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getRegisterClientRedisKey(String phoneNumber){
|
|
|
|
|