|
|
|
@ -14,8 +14,28 @@ import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.*;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.*;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
|
|
|
|
|
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.ClientsContractMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper;
|
|
|
|
|
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.SysWxMerchantApplyMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
|
|
|
@ -43,16 +63,21 @@ import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard;
|
|
|
|
|
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider;
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.*;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.ImageUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PasswordUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PdfUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent;
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestGenerator;
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestResult;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -71,27 +96,40 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
import org.thymeleaf.context.Context;
|
|
|
|
|
import org.thymeleaf.spring4.SpringTemplateEngine;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestGenerator;
|
|
|
|
|
import cn.yixblog.platform.http.HttpRequestResult;
|
|
|
|
|
|
|
|
|
|
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -168,6 +206,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
@Resource
|
|
|
|
|
private FinancialBDConfigMapper financialBDConfigMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientsContractMapper clientsContractMapper;
|
|
|
|
|
|
|
|
|
|
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_ID_FILE = "client_id_file";
|
|
|
|
@ -1848,37 +1889,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
|
|
|
|
|
if (weChatRate == null) {
|
|
|
|
|
throw new BadRequestException("The Partner's Rate is not config!");
|
|
|
|
|
}
|
|
|
|
|
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
client.put("clean", "T+" + weChatRate.getString("clean_days"));
|
|
|
|
|
client.put("clean_days", weChatRate.getString("clean_days"));
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
|
|
|
|
|
if (alipayRate != null) {
|
|
|
|
|
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
|
|
|
|
|
if (bestPayRate != null) {
|
|
|
|
|
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
|
|
|
|
|
if (jdRate != null) {
|
|
|
|
|
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
|
|
|
|
|
if (alipayOnlineRate != null) {
|
|
|
|
|
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
// do nothing
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> clientRate = clientRateMapper.minExpiryTime(client.getIntValue("client_id"),null);
|
|
|
|
|
clientRate.forEach((p)->{
|
|
|
|
|
String rate_name = p.getString("rate_name");
|
|
|
|
|
if("Wechat".equals(rate_name)){
|
|
|
|
|
client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
client.put("clean", "T+" + p.getString("clean_days"));
|
|
|
|
|
client.put("clean_days", p.getString("clean_days"));
|
|
|
|
|
}else if("Alipay".equals(rate_name)){
|
|
|
|
|
client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}else if("Bestpay".equals(rate_name)){
|
|
|
|
|
client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}else if("jd".equals(rate_name)){
|
|
|
|
|
client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}else if("AlipayOnline".equals(rate_name)){
|
|
|
|
|
client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
JSONObject account = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
@ -1897,7 +1924,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
File file = new File(clientMoniker + "_agreement.pdf");
|
|
|
|
|
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
|
|
|
|
|
InputStream stream = new ByteArrayInputStream(bos.toByteArray());
|
|
|
|
|
JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_agreement.pdf", false);
|
|
|
|
|
JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker +"_"+System.currentTimeMillis()+ "_agreement.pdf", false);
|
|
|
|
|
if (fileRes != null) {
|
|
|
|
|
importAgreeFile(clientMoniker, manager, fileRes.getString("url"));
|
|
|
|
|
}
|
|
|
|
@ -1991,15 +2018,24 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
if (sourceFile != null) {
|
|
|
|
|
JSONObject existFile = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), SOURCE_AGREE_FILE);
|
|
|
|
|
|
|
|
|
|
List<JSONObject> existFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), SOURCE_AGREE_FILE);
|
|
|
|
|
JSONObject existFile = null;
|
|
|
|
|
if (!CollectionUtils.isEmpty(existFiles)) {
|
|
|
|
|
existFile = existFiles.get(0);
|
|
|
|
|
}
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
JSONObject file = new JSONObject();
|
|
|
|
|
file.put("file_name", SOURCE_AGREE_FILE);
|
|
|
|
|
file.put("file_value", sourceFile);
|
|
|
|
|
file.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
file.put("last_update_date", new Date());
|
|
|
|
|
file.put("last_update_by", manager.getString("display_name"));
|
|
|
|
|
if (existFile == null || existFile.isEmpty()) {
|
|
|
|
|
file.put("last_update_date", now);
|
|
|
|
|
if(manager == null){
|
|
|
|
|
file.put("last_update_by", "System Import");
|
|
|
|
|
}else {
|
|
|
|
|
file.put("last_update_by", manager.getString("display_name"));
|
|
|
|
|
}
|
|
|
|
|
JSONObject contract = clientsContractMapper.findByClientId(client.getIntValue("client_id"));
|
|
|
|
|
if (contract == null ||now.compareTo(contract.getDate("expiry_date"))>0||existFile == null || existFile.isEmpty()) {
|
|
|
|
|
clientFilesMapper.save(file);
|
|
|
|
|
} else {
|
|
|
|
|
file.put("file_id", existFile.getString("file_id"));
|
|
|
|
@ -2007,7 +2043,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
client.put("open_status", 2);
|
|
|
|
|
clientMapper.update(client);
|
|
|
|
|
saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager);
|
|
|
|
|
|
|
|
|
|
if (manager != null) {
|
|
|
|
|
saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2017,8 +2056,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
JSONObject existFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), SOURCE_AGREE_FILE);
|
|
|
|
|
if (existFiles == null || existFiles.isEmpty()) {
|
|
|
|
|
List<JSONObject> existFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), SOURCE_AGREE_FILE);
|
|
|
|
|
if (CollectionUtils.isEmpty(existFiles)) {
|
|
|
|
|
throw new BadRequestException("The Agree File is not Complete!");
|
|
|
|
|
}
|
|
|
|
|
client.put("open_status", 3);
|
|
|
|
@ -2077,7 +2116,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
if (StringUtils.isNotBlank(master_merchant)) {
|
|
|
|
|
//throw new NotFoundException("Invalid Input");
|
|
|
|
|
// throw new NotFoundException("Invalid Input");
|
|
|
|
|
JSONObject master_client = getClientInfoByMoniker(master_merchant);
|
|
|
|
|
if (master_client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
@ -2296,7 +2335,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
|
|
|
|
|
public void updateSysClientFiles(JSONObject manager, int clientId, String fileType, String fileValue) {
|
|
|
|
|
if (fileValue != null) {
|
|
|
|
|
JSONObject existFile = clientFilesMapper.findFileByClientAndType(clientId, fileType);
|
|
|
|
|
|
|
|
|
|
List<JSONObject> existFiles = clientFilesMapper.findFileByClientAndType(clientId, fileType);
|
|
|
|
|
JSONObject existFile = null;
|
|
|
|
|
if (!CollectionUtils.isEmpty(existFiles)) {
|
|
|
|
|
existFile = existFiles.get(0);
|
|
|
|
|
}
|
|
|
|
|
JSONObject fileJson = new JSONObject();
|
|
|
|
|
fileJson.put("client_id", clientId);
|
|
|
|
|
fileJson.put("last_update_date", new Date());
|
|
|
|
@ -2825,7 +2869,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name,
|
|
|
|
|
JSONObject client) {
|
|
|
|
|
JSONObject client) {
|
|
|
|
|
TemplateMessage msg = new TemplateMessage(wxopenid, templateId2, loginUrl);
|
|
|
|
|
msg.put("first", bd_user_name + " 提交了新商户绿色通道申请,请审核", "#ff0000");
|
|
|
|
|
msg.put("keyword1", client.getString("client_moniker") + "申请绿色通道", "#0000ff");
|
|
|
|
@ -2984,7 +3028,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"), new PageBounds(Order.formString("create_time.desc")));
|
|
|
|
|
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"),
|
|
|
|
|
new PageBounds(Order.formString("create_time.desc")));
|
|
|
|
|
if (!applices.isEmpty()) {
|
|
|
|
|
return applices;
|
|
|
|
|
} else {
|
|
|
|
|