|
|
@ -29,6 +29,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.MailSendMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper;
|
|
|
@ -69,6 +70,7 @@ import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
import au.com.royalpay.payment.manage.system.core.ClientContractService;
|
|
|
|
import au.com.royalpay.payment.manage.system.core.ClientContractService;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.system.core.MailGunService;
|
|
|
|
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
|
|
|
|
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
|
|
|
|
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
|
|
|
|
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
|
|
|
@ -83,6 +85,7 @@ import au.com.royalpay.payment.tools.exceptions.NotFoundException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.event.WechatExceptionEvent;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.event.WechatExceptionEvent;
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.tools.mail.SendMail;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
@ -145,13 +148,16 @@ import java.net.URL;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
@ -260,6 +266,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
private ClientInfoCacheSupport clientInfoCacheSupport;
|
|
|
|
private ClientInfoCacheSupport clientInfoCacheSupport;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private MongoTemplate mongoTemplate;
|
|
|
|
private MongoTemplate mongoTemplate;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MailGunService mailGunService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MailSendMapper mailSendMapper;
|
|
|
|
|
|
|
|
|
|
|
|
private static final String SOURCE_AGREE_FILE = "source_agree_file";
|
|
|
|
private static final String SOURCE_AGREE_FILE = "source_agree_file";
|
|
|
|
private static final String CLIENT_BANK_FILE = "client_bank_file";
|
|
|
|
private static final String CLIENT_BANK_FILE = "client_bank_file";
|
|
|
@ -267,6 +277,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
private static final String CLIENT_AGREE_FILE = "client_agree_file";
|
|
|
|
private static final String CLIENT_AGREE_FILE = "client_agree_file";
|
|
|
|
private static final String CLIENT_COMPANY_FILE = "client_company_file";
|
|
|
|
private static final String CLIENT_COMPANY_FILE = "client_company_file";
|
|
|
|
private static final String CLIENT_APPLY_FILE = "client_apply_file";
|
|
|
|
private static final String CLIENT_APPLY_FILE = "client_apply_file";
|
|
|
|
|
|
|
|
private static final List<String> tags = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${app.agreetemplate.classic.path}")
|
|
|
|
@Value("${app.agreetemplate.classic.path}")
|
|
|
|
private String agreetemplatePdfPath;
|
|
|
|
private String agreetemplatePdfPath;
|
|
|
@ -276,6 +287,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private MpWechatApiProvider mpWechatApiProvider;
|
|
|
|
private MpWechatApiProvider mpWechatApiProvider;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
|
|
|
|
public void init(){
|
|
|
|
|
|
|
|
tags.add("account");
|
|
|
|
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject getSysRateConfig() {
|
|
|
|
public JSONObject getSysRateConfig() {
|
|
|
|
String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates");
|
|
|
|
String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates");
|
|
|
@ -572,6 +588,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
clientApplyMapper.updatePartnerApplication(apply);
|
|
|
|
clientApplyMapper.updatePartnerApplication(apply);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
mailGunService.addClientToMailList(partner);
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
logger.error("邮件列表添加成员失败",e);
|
|
|
|
|
|
|
|
}
|
|
|
|
return partner;
|
|
|
|
return partner;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -607,6 +628,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
clientMapper.update(updateInfo);
|
|
|
|
clientMapper.update(updateInfo);
|
|
|
|
|
|
|
|
if(client.getString("contact_email").equals(updateInfo.getString("contact_email"))){
|
|
|
|
|
|
|
|
mailGunService.updateClientOfMailList(updateInfo,client);
|
|
|
|
|
|
|
|
}
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -712,6 +736,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) {
|
|
|
|
private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) {
|
|
|
|
|
|
|
|
if(StringUtils.isEmpty(client.getString("sub_merchant_id"))){
|
|
|
|
|
|
|
|
throw new BadRequestException("Sub Merchant ID Can't be null ");
|
|
|
|
|
|
|
|
}
|
|
|
|
String username = clientMoniker + client.getString("sub_merchant_id");
|
|
|
|
String username = clientMoniker + client.getString("sub_merchant_id");
|
|
|
|
boolean duplicated = true;
|
|
|
|
boolean duplicated = true;
|
|
|
|
String pwd = RandomStringUtils.random(8, true, true);
|
|
|
|
String pwd = RandomStringUtils.random(8, true, true);
|
|
|
@ -790,7 +817,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
if (StringUtils.isEmpty(mailTo)) {
|
|
|
|
if (StringUtils.isEmpty(mailTo)) {
|
|
|
|
throw new EmailException("Client Contact Email is invalid");
|
|
|
|
throw new EmailException("Client Contact Email is invalid");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
final List<String> emails = new ArrayList<>();
|
|
|
|
final Set<String> emails = new HashSet<>();
|
|
|
|
for (JSONObject bd : bds) {
|
|
|
|
for (JSONObject bd : bds) {
|
|
|
|
String email = bd.getString("email");
|
|
|
|
String email = bd.getString("email");
|
|
|
|
if (StringUtils.isNotEmpty(email)) {
|
|
|
|
if (StringUtils.isNotEmpty(email)) {
|
|
|
@ -801,9 +828,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", mailTo,
|
|
|
|
SendMail sendMail = new SendMail();
|
|
|
|
emails.isEmpty() ? "" : StringUtils.join(emails, ","), content);
|
|
|
|
Set<String> to = new HashSet<>();
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 3, emailId));
|
|
|
|
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) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0, null));
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0, null));
|
|
|
|
throw new EmailException("Email Sending Failed", e);
|
|
|
|
throw new EmailException("Email Sending Failed", e);
|
|
|
@ -837,7 +872,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<JSONObject> bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date());
|
|
|
|
List<JSONObject> bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date());
|
|
|
|
|
|
|
|
|
|
|
|
final List<String> emails = new ArrayList<>();
|
|
|
|
final Set<String> emails = new HashSet<>();
|
|
|
|
for (JSONObject bd : bds) {
|
|
|
|
for (JSONObject bd : bds) {
|
|
|
|
String email = bd.getString("email");
|
|
|
|
String email = bd.getString("email");
|
|
|
|
if (StringUtils.isNotEmpty(email)) {
|
|
|
|
if (StringUtils.isNotEmpty(email)) {
|
|
|
@ -848,9 +883,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String emailId = mailService.sendEmail("Your Partner Account Has Been Authenticated Successfully", mailTo,
|
|
|
|
SendMail sendMail = new SendMail();
|
|
|
|
emails.isEmpty() ? "" : StringUtils.join(emails, ","), content);
|
|
|
|
Set<String> to = new HashSet<>();
|
|
|
|
clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 3, emailId));
|
|
|
|
to.add(mailTo);
|
|
|
|
|
|
|
|
sendMail.setMailTos(to);
|
|
|
|
|
|
|
|
sendMail.setFrom("info@mail.royalpay.com.au");
|
|
|
|
|
|
|
|
sendMail.setMailCcs(emails);
|
|
|
|
|
|
|
|
sendMail.setTitle("Your Partner Account Has Been Authenticated Successfully");
|
|
|
|
|
|
|
|
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) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new EmailException("Email Sending Failed", e);
|
|
|
|
throw new EmailException("Email Sending Failed", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -907,6 +950,37 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void newCheckEmailStatus() {
|
|
|
|
|
|
|
|
List<JSONObject> clients = clientMapper.listClientsWithEmailNotVerify();
|
|
|
|
|
|
|
|
for (JSONObject client : clients) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
String emailId = client.getString("approve_email_id");
|
|
|
|
|
|
|
|
JSONObject status = mailSendMapper.find(emailId,client.getString("contact_email"));
|
|
|
|
|
|
|
|
if (status!=null) {
|
|
|
|
|
|
|
|
int statusNo = status.getIntValue("status");
|
|
|
|
|
|
|
|
logger.debug("get mail status:" + emailId + "--" + statusNo);
|
|
|
|
|
|
|
|
int mailStatus = 3;
|
|
|
|
|
|
|
|
switch (statusNo) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
mailStatus = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
mailStatus = 2;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
updateClientApproveEmailStatus(mailStatus, null, client.getString("client_moniker"));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
logger.debug("get mail status:" + emailId + "-- none");
|
|
|
|
|
|
|
|
// updateClientApproveEmailStatus(client.getIntValue("client_id"), 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
logger.error("check email status failed", e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow) {
|
|
|
|
public void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow) {
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|