|
|
|
@ -756,7 +756,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client.getIntValue("source") == 4) {
|
|
|
|
|
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id"));
|
|
|
|
|
JSONObject account = accounts.get(0);
|
|
|
|
|
sendInitEmail(manager, client, account.getString("username"), "*****");
|
|
|
|
|
sendInitEmail(client, account.getString("username"), "*****");
|
|
|
|
|
// sendInitEmail(manager, client, account.getString("username"), "*****");
|
|
|
|
|
saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager);
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager,clientMoniker,"skip_clearing",false));
|
|
|
|
|
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager,clientMoniker,"common_sub_merchant_id",false));
|
|
|
|
@ -812,7 +813,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
username += "1";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sendInitEmail(manager, client, username, pwd);
|
|
|
|
|
sendInitEmail(client, username, pwd);
|
|
|
|
|
// sendInitEmail(manager, client, username, pwd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -836,7 +838,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(clientId);
|
|
|
|
|
if (client.getIntValue("source") == 4) {
|
|
|
|
|
JSONObject account = accounts.get(0);
|
|
|
|
|
sendInitEmail(manager, client, account.getString("username"), "*****");
|
|
|
|
|
// sendInitEmail(manager, client, account.getString("username"), "*****");
|
|
|
|
|
sendInitEmail(client, account.getString("username"), "*****");
|
|
|
|
|
} else {
|
|
|
|
|
if (accounts.size() == 0) {
|
|
|
|
|
initAdminUserAndSendEmail(manager, clientMoniker, client);
|
|
|
|
@ -844,13 +847,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
JSONObject account = accounts.get(0);
|
|
|
|
|
String pwd = RandomStringUtils.random(8, true, true);
|
|
|
|
|
resetAccountPwd(manager, clientMoniker, account.getString("account_id"), pwd);
|
|
|
|
|
sendInitEmail(manager, client, account.getString("username"), pwd);
|
|
|
|
|
// sendInitEmail(manager, client, account.getString("username"), pwd);
|
|
|
|
|
sendInitEmail(client, account.getString("username"), pwd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void sendInitEmail(JSONObject account, final JSONObject client, String username, String pwd) {
|
|
|
|
|
public void sendInitEmail(final JSONObject client, String username, String pwd) {
|
|
|
|
|
logger.debug("sending email after comply");
|
|
|
|
|
JSONObject model = new JSONObject();
|
|
|
|
|
model.put("username", username);
|
|
|
|
@ -867,7 +870,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
ctx.setVariable("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
ctx.setVariable("contact_person", client.getString("contact_person"));
|
|
|
|
|
ctx.setVariable("credential_code", client.getString("credential_code"));
|
|
|
|
|
ctx.setVariable("short_name", client.getString("short_name"));
|
|
|
|
|
final String content = thymeleaf.process("mail/new_client_notice", ctx);
|
|
|
|
|
// final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/new_client_notice.vm",
|
|
|
|
|
// "utf-8", model);
|
|
|
|
@ -875,7 +877,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (StringUtils.isEmpty(mailTo)) {
|
|
|
|
|
throw new EmailException("Client Contact Email is invalid");
|
|
|
|
|
}
|
|
|
|
|
final Set<String> emails = new HashSet<>();
|
|
|
|
|
final List<String> emails = new ArrayList<>();
|
|
|
|
|
for (JSONObject bd : bds) {
|
|
|
|
|
String email = bd.getString("email");
|
|
|
|
|
if (StringUtils.isNotEmpty(email)) {
|
|
|
|
@ -886,24 +888,81 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
try {
|
|
|
|
|
SendMail sendMail = new SendMail();
|
|
|
|
|
Set<String> to = new HashSet<>();
|
|
|
|
|
to.add(mailTo);
|
|
|
|
|
sendMail.setFrom("info@mail.royalpay.com.au");
|
|
|
|
|
sendMail.setMailTos(to);
|
|
|
|
|
sendMail.setMailCcs(emails);
|
|
|
|
|
sendMail.setTitle("Your RoyalPay Cross-border Payment has been set up");
|
|
|
|
|
sendMail.setContent(content);
|
|
|
|
|
sendMail.setTags(tags);
|
|
|
|
|
JSONObject mailResult = mailGunService.sendMail(sendMail);
|
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 3, mailResult.getString("mail_id")));
|
|
|
|
|
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", mailTo,
|
|
|
|
|
emails.isEmpty() ? "" : StringUtils.join(emails, ","), content);
|
|
|
|
|
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) {
|
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0, null));
|
|
|
|
|
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(JSONObject account, final JSONObject client, String username, String pwd) {
|
|
|
|
|
logger.debug("sending email after comply");
|
|
|
|
|
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"));
|
|
|
|
|
ctx.setVariable("short_name", client.getString("short_name"));
|
|
|
|
|
final String content = thymeleaf.process("mail/new_client_notice", ctx);
|
|
|
|
|
// final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/new_client_notice.vm",
|
|
|
|
|
// "utf-8", model);
|
|
|
|
|
final String mailTo = client.getString("contact_email");
|
|
|
|
|
if (StringUtils.isEmpty(mailTo)) {
|
|
|
|
|
throw new EmailException("Client Contact Email is invalid");
|
|
|
|
|
}
|
|
|
|
|
final Set<String> emails = new HashSet<>();
|
|
|
|
|
for (JSONObject bd : bds) {
|
|
|
|
|
String email = bd.getString("email");
|
|
|
|
|
if (StringUtils.isNotEmpty(email)) {
|
|
|
|
|
emails.add(email);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
try {
|
|
|
|
|
SendMail sendMail = new SendMail();
|
|
|
|
|
Set<String> to = new HashSet<>();
|
|
|
|
|
to.add(mailTo);
|
|
|
|
|
sendMail.setFrom("info@mail.royalpay.com.au");
|
|
|
|
|
sendMail.setMailTos(to);
|
|
|
|
|
sendMail.setMailCcs(emails);
|
|
|
|
|
sendMail.setTitle("Your RoyalPay Cross-border Payment has been set up");
|
|
|
|
|
sendMail.setContent(content);
|
|
|
|
|
sendMail.setTags(tags);
|
|
|
|
|
JSONObject mailResult = mailGunService.sendMail(sendMail);
|
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 3, mailResult.getString("mail_id")));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0, null));
|
|
|
|
|
throw new EmailException("Email Sending Failed", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void sendAuthInitEmail(JSONObject account, final JSONObject client) {
|
|
|
|
|
logger.debug("sending email after comply about a new partner opening by quick access");
|
|
|
|
|