|
|
|
@ -105,6 +105,7 @@ import org.springframework.ui.Model;
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.thymeleaf.context.Context;
|
|
|
|
import org.thymeleaf.context.Context;
|
|
|
|
import org.thymeleaf.spring4.SpringTemplateEngine;
|
|
|
|
import org.thymeleaf.spring4.SpringTemplateEngine;
|
|
|
|
|
|
|
|
|
|
|
|
@ -306,6 +307,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
private String agreetemplatePdfPath;
|
|
|
|
private String agreetemplatePdfPath;
|
|
|
|
@Value("${app.agreetemplate.aggregate.path}")
|
|
|
|
@Value("${app.agreetemplate.aggregate.path}")
|
|
|
|
private String aggregateAgreetemplatePdfPath;
|
|
|
|
private String aggregateAgreetemplatePdfPath;
|
|
|
|
|
|
|
|
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/22/1566440384256_R7Jc3cl5JPZsmVznKffzStwVMELwsl.pdf";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private MpWechatApiProvider mpWechatApiProvider;
|
|
|
|
private MpWechatApiProvider mpWechatApiProvider;
|
|
|
|
@ -3325,6 +3328,83 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException{
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(file.getOriginalFilename())) {
|
|
|
|
|
|
|
|
throw new BadRequestException("Please Enter Full Name");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject client = getClientInfo(account.getIntValue("client_id"));
|
|
|
|
|
|
|
|
String address = client.getString("address").trim();
|
|
|
|
|
|
|
|
if (address.contains(",")) {
|
|
|
|
|
|
|
|
client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
|
|
|
|
|
|
|
|
client.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (client.getString("acn") != null && !client.getString("acn").equals("")) {
|
|
|
|
|
|
|
|
client.put("acn_type", "ACN: (" + client.getString("acn") + ")");
|
|
|
|
|
|
|
|
client.put("company_name_acn", client.getString("company_name") + " (ACN " + client.getString("acn") + ")");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
client.put("acn_type", "ABN: (" + client.getString("abn") + ")");
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
|
|
|
|
|
|
|
|
if (cbBankPayRate != null) {
|
|
|
|
|
|
|
|
client.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
|
|
|
throw new BadRequestException("Merchant Rate Not Configure");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
|
|
|
|
if (bankAccount == null || bankAccount.size() <= 0) {
|
|
|
|
|
|
|
|
throw new BadRequestException("The Partner's Account is not config!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
client.put("bank", bankAccount.getString("bank"));
|
|
|
|
|
|
|
|
client.put("bsb_no", bankAccount.getString("bsb_no"));
|
|
|
|
|
|
|
|
client.put("account_no", bankAccount.getString("account_no"));
|
|
|
|
|
|
|
|
client.put("account_name", bankAccount.getString("account_name"));
|
|
|
|
|
|
|
|
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
|
|
|
|
|
|
|
|
client.put("start_date", start_date);
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
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()));
|
|
|
|
|
|
|
|
return exportImgAggregateFile(account, client);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject getSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query) {
|
|
|
|
public JSONObject getSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query) {
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
@ -5448,6 +5528,33 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
clientMapper.update(updateClient);
|
|
|
|
clientMapper.update(updateClient);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException{
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
InputStream stream = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PdfUtils pdu = new PdfUtils();
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
stream = new ByteArrayInputStream(bos.toByteArray());
|
|
|
|
|
|
|
|
JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
|
|
|
|
|
|
|
|
ClientAuthFilesInfo clientAuthFilesInfo = new ClientAuthFilesInfo();
|
|
|
|
|
|
|
|
clientAuthFilesInfo.setFile_agreement_info(fileInfo.getString("url"));
|
|
|
|
|
|
|
|
clientAuthFilesInfo.setFile_apply_info(null);
|
|
|
|
|
|
|
|
clientAuthFilesInfo.setFile_bank_info(null);
|
|
|
|
|
|
|
|
clientAuthFilesInfo.setFile_company_info(null);
|
|
|
|
|
|
|
|
clientAuthFilesInfo.setFile_id_info(null);
|
|
|
|
|
|
|
|
clientAuthFilesInfo.setAuthStatus(0);
|
|
|
|
|
|
|
|
result = uploadAuthFilesForWaitCompliance(account, client.getString("client_moniker"), clientAuthFilesInfo).get(0);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
logger.error("合同制作出现问题:", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
stream.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) {
|
|
|
|
private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) {
|
|
|
|
TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null);
|
|
|
|
TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null);
|
|
|
|
notice.put("first", "您好,您的合同费率已到期,根据合同协议系统已自动为您延期1年。", "#ff0000");
|
|
|
|
notice.put("first", "您好,您的合同费率已到期,根据合同协议系统已自动为您延期1年。", "#ff0000");
|
|
|
|
|