|
|
|
@ -121,6 +121,7 @@ import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.net.URLDecoder;
|
|
|
|
|
import java.security.*;
|
|
|
|
|
import java.security.interfaces.RSAPrivateKey;
|
|
|
|
|
import java.security.interfaces.RSAPublicKey;
|
|
|
|
@ -330,7 +331,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Cacheable(value = ":app_client_info:", key = "''+#clientId", unless="#result == null")
|
|
|
|
|
@Cacheable(value = ":app_client_info:", key = "''+#clientId", unless = "#result == null")
|
|
|
|
|
public JSONObject getClientInfo(int clientId) {
|
|
|
|
|
return clientMapper.findClient(clientId);
|
|
|
|
|
}
|
|
|
|
@ -768,15 +769,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
JSONObject representativeInfo = new JSONObject();
|
|
|
|
|
representativeInfo.put("client_id",partner.getIntValue("client_id"));
|
|
|
|
|
representativeInfo.put("representative_person",partner.getString("legal_representative_person"));
|
|
|
|
|
representativeInfo.put("phone",partner.getString("legal_representative_phone"));
|
|
|
|
|
representativeInfo.put("email",partner.getString("legal_representative_email"));
|
|
|
|
|
representativeInfo.put("job_title",partner.getString("legal_representative_job"));
|
|
|
|
|
representativeInfo.put("address",partner.getString("registered_address"));
|
|
|
|
|
representativeInfo.put("suburb",partner.getString("registered_suburb"));
|
|
|
|
|
representativeInfo.put("postcode",partner.getString("registered_postcode"));
|
|
|
|
|
representativeInfo.put("state",partner.getString("registered_state"));
|
|
|
|
|
representativeInfo.put("client_id", partner.getIntValue("client_id"));
|
|
|
|
|
representativeInfo.put("representative_person", partner.getString("legal_representative_person"));
|
|
|
|
|
representativeInfo.put("phone", partner.getString("legal_representative_phone"));
|
|
|
|
|
representativeInfo.put("email", partner.getString("legal_representative_email"));
|
|
|
|
|
representativeInfo.put("job_title", partner.getString("legal_representative_job"));
|
|
|
|
|
representativeInfo.put("address", partner.getString("registered_address"));
|
|
|
|
|
representativeInfo.put("suburb", partner.getString("registered_suburb"));
|
|
|
|
|
representativeInfo.put("postcode", partner.getString("registered_postcode"));
|
|
|
|
|
representativeInfo.put("state", partner.getString("registered_state"));
|
|
|
|
|
sysClientLegalPersonMapper.save(representativeInfo);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
|
|
|
|
@ -833,19 +834,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
updateInfo.put("client_id", clientId);
|
|
|
|
|
|
|
|
|
|
JSONObject representativeInfo = new JSONObject();
|
|
|
|
|
representativeInfo.put("client_id",clientId);
|
|
|
|
|
representativeInfo.put("representative_person",info.getRepresentativePerson());
|
|
|
|
|
representativeInfo.put("phone",info.getRepresentativePhone());
|
|
|
|
|
representativeInfo.put("email",info.getRepresentativeEmail());
|
|
|
|
|
representativeInfo.put("job_title",info.getRepresentativeJobTitle());
|
|
|
|
|
representativeInfo.put("address",info.getRegisteredAddress());
|
|
|
|
|
representativeInfo.put("suburb",info.getRegisteredSuburb());
|
|
|
|
|
representativeInfo.put("postcode",info.getRegisteredPostcode());
|
|
|
|
|
representativeInfo.put("state",info.getRegisteredState());
|
|
|
|
|
|
|
|
|
|
if(sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null){
|
|
|
|
|
representativeInfo.put("client_id", clientId);
|
|
|
|
|
representativeInfo.put("representative_person", info.getRepresentativePerson());
|
|
|
|
|
representativeInfo.put("phone", info.getRepresentativePhone());
|
|
|
|
|
representativeInfo.put("email", info.getRepresentativeEmail());
|
|
|
|
|
representativeInfo.put("job_title", info.getRepresentativeJobTitle());
|
|
|
|
|
representativeInfo.put("address", info.getRegisteredAddress());
|
|
|
|
|
representativeInfo.put("suburb", info.getRegisteredSuburb());
|
|
|
|
|
representativeInfo.put("postcode", info.getRegisteredPostcode());
|
|
|
|
|
representativeInfo.put("state", info.getRegisteredState());
|
|
|
|
|
|
|
|
|
|
if (sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null) {
|
|
|
|
|
sysClientLegalPersonMapper.update(representativeInfo);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
sysClientLegalPersonMapper.save(representativeInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1231,7 +1232,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
try {
|
|
|
|
|
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos,","), "", content);
|
|
|
|
|
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content);
|
|
|
|
|
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
|
|
|
|
|
"", contentBd);
|
|
|
|
|
JSONObject clientUpdate = new JSONObject();
|
|
|
|
@ -1296,7 +1297,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
try {
|
|
|
|
|
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos,","), "", content);
|
|
|
|
|
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content);
|
|
|
|
|
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
|
|
|
|
|
"", contentBd);
|
|
|
|
|
JSONObject clientUpdate = new JSONObject();
|
|
|
|
@ -1563,10 +1564,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
return accountJson;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkPhoneAndWechatExist(NewAccountBean account){
|
|
|
|
|
if(clientAccountMapper.findByPhone(account.getContactPhone(),"+"+account.getNation_code())!=null){
|
|
|
|
|
private void checkPhoneAndWechatExist(NewAccountBean account) {
|
|
|
|
|
if (clientAccountMapper.findByPhone(account.getContactPhone(), "+" + account.getNation_code()) != null) {
|
|
|
|
|
throw new BadRequestException("Mobile phone number has been bound to other accounts");
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1637,7 +1639,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (account == null) {
|
|
|
|
|
throw new BadRequestException("account not exists");
|
|
|
|
|
}
|
|
|
|
|
if(clientAccountMapper.findByWechatOpenId(user.getString("openid"))!=null || clientAccountMapper.findByWxUnioinId(user.getString("unioinid"))!=null){
|
|
|
|
|
if (clientAccountMapper.findByWechatOpenId(user.getString("openid")) != null || clientAccountMapper.findByWxUnioinId(user.getString("unioinid")) != null) {
|
|
|
|
|
throw new BadRequestException("The WeChat has been linked to other accounts");
|
|
|
|
|
}
|
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
@ -3462,8 +3464,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
String clientPayType = "";
|
|
|
|
|
String companyPhoto = "";
|
|
|
|
|
String storePhoto= "";
|
|
|
|
|
String webSite= "";
|
|
|
|
|
String storePhoto = "";
|
|
|
|
|
String webSite = "";
|
|
|
|
|
int sourceEnum = 2;
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
@ -3479,7 +3481,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (clientAllAuthFiles.stream().noneMatch(fileJson -> fileKey.equals(fileJson.getString("file_name")))) {
|
|
|
|
|
if ("client_agree_file".equals(fileKey)) {
|
|
|
|
|
throw new BadRequestException("Please check that the agreement has been signed");
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException("Please check the " + fileNames[i] + " is uploaded completely");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3524,7 +3526,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException{
|
|
|
|
|
public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException {
|
|
|
|
|
if (StringUtils.isBlank(file.getOriginalFilename())) {
|
|
|
|
|
throw new BadRequestException("Please Enter Full Name");
|
|
|
|
|
}
|
|
|
|
@ -3600,11 +3602,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
Date endDate = TimeZoneUtils.nextYearByCurrDay();
|
|
|
|
|
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
|
|
|
|
|
client.put("end_date", end_date);
|
|
|
|
|
client.put("full_name", file.getOriginalFilename());
|
|
|
|
|
client.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8"));
|
|
|
|
|
BufferedImage img = ImageIO.read(file.getInputStream());
|
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
|
|
ImageIO.write(img, "png", out);
|
|
|
|
|
client.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
|
|
|
|
|
client.put("img", "data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
|
|
|
|
|
JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
|
|
|
|
|
if (clientLegal != null) {
|
|
|
|
|
client.put("legal_person", clientLegal.getString("representative_person"));
|
|
|
|
@ -3699,7 +3701,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (aggregateFiles != null && aggregateFiles.size() > 0) {
|
|
|
|
|
clientFilesMapper.deleteAggreeByClientId(clientId);
|
|
|
|
|
}
|
|
|
|
|
String signatureAccountId = StringUtils.isNotBlank("account_id")?manager.getString("account_id"):manager.getString("manager_id");
|
|
|
|
|
String signatureAccountId = StringUtils.isNotBlank("account_id") ? manager.getString("account_id") : manager.getString("manager_id");
|
|
|
|
|
JSONObject fileJson = new JSONObject();
|
|
|
|
|
fileJson.put("client_id", clientId);
|
|
|
|
|
fileJson.put("last_update_date", new Date());
|
|
|
|
@ -3713,7 +3715,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
fileJson.put("status", 0);
|
|
|
|
|
fileJson.put("is_valid", 1);
|
|
|
|
|
clientFilesMapper.save(fileJson);
|
|
|
|
|
logger.info("{}合同文件上传成功,IP:{},us-agent:{},signature_id:{}",clientId,manager.getString("signature_ip"),manager.getString("user_agent"),signatureAccountId);
|
|
|
|
|
logger.info("{}合同文件上传成功,IP:{},us-agent:{},signature_id:{}", clientId, manager.getString("signature_ip"), manager.getString("user_agent"), signatureAccountId);
|
|
|
|
|
JSONObject file = new JSONObject();
|
|
|
|
|
file.put("file_id", fileJson.getString("file_id"));
|
|
|
|
|
file.put("file_value", fileJson.getString("file_value"));
|
|
|
|
@ -4209,7 +4211,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
JSONObject oldClienetLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client_id);
|
|
|
|
|
if (oldClienetLegal == null) {
|
|
|
|
|
sysClientLegalPersonMapper.save(clientLegal);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
sysClientLegalPersonMapper.update(clientLegal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -4795,18 +4797,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
if (!client.containsKey("store_photo") || !client.containsKey("company_photo")) {
|
|
|
|
|
throw new InvalidParameterException("store photo cannot be empty ");
|
|
|
|
|
}
|
|
|
|
|
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
|
if (client_bank == null || client_bank.size() <= 0) {
|
|
|
|
|
throw new BadRequestException("The Partner's Account is not config!");
|
|
|
|
|
}
|
|
|
|
|
client.put("bank_id", client_bank.getString("account_no"));
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(client.getString("business_structure"))) {
|
|
|
|
|
throw new BadRequestException("Business Structure can't be null");
|
|
|
|
|
client.put("business_structure", "Registered body(Sole Trader)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
|
|
|
|
@ -4926,24 +4922,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
if (!client.containsKey("company_website")) {
|
|
|
|
|
throw new InvalidParameterException("Website cannot be empty ");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isBlank(client.getString("business_structure"))) {
|
|
|
|
|
throw new BadRequestException("Business Structure can't be null");
|
|
|
|
|
client.put("business_structure", "Registered body(Sole Trader)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
|
|
|
|
|
throw new BadRequestException("Alipay Industry can't be null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
|
if (client_bank == null || client_bank.size() <= 0) {
|
|
|
|
|
throw new BadRequestException("The Partner's Account is not config!");
|
|
|
|
|
}
|
|
|
|
|
client.put("bank_id", client_bank.getString("account_no"));
|
|
|
|
|
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
|
|
|
|
|
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
@ -4960,12 +4949,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void registerClientApplyGMS(String clientMoniker, String accountId) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker);
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(accountId);
|
|
|
|
|
if (clientConfig == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(clientConfig.getString("client_pay_type"))) {
|
|
|
|
|
String[] payType = clientConfig.getString("client_pay_type").split(",");
|
|
|
|
|
if (Arrays.asList(payType).contains("1")) {
|
|
|
|
|
registerAlipayOnlineGms(clientMoniker, null);
|
|
|
|
|
switchChannelPermission(account, clientMoniker, "Alipay", true);
|
|
|
|
|
}
|
|
|
|
|
if (Arrays.asList(payType).contains("2")) {
|
|
|
|
|
registerAlipayGms(clientMoniker, null);
|
|
|
|
|
enableGatewayAlipayOnline(account, clientMoniker, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
|
|
public String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
|
|
|
|
|
Element resultElement = alipayClient.queryOnlineGmsPortalStatus(mch.getPid(), client);
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
@ -5758,7 +5771,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
clientMapper.update(updateClient);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException{
|
|
|
|
|
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException {
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
InputStream stream = null;
|
|
|
|
|
try {
|
|
|
|
@ -5766,7 +5779,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
|
|
|
|
|
pdu.setPdfTemplate(client);
|
|
|
|
|
File file = new File(client.getString("client_moniker") + "_agreement.pdf");
|
|
|
|
|
ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H");
|
|
|
|
|
ByteArrayOutputStream bos = pdu.templetPdfBos(file, "STSong-Light", "UniGB-UCS2-H");
|
|
|
|
|
stream = new ByteArrayInputStream(bos.toByteArray());
|
|
|
|
|
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
|
|
|
|
|
ClientAuthFilesInfo clientAuthFilesInfo = new ClientAuthFilesInfo();
|
|
|
|
|