|
|
@ -52,7 +52,6 @@ import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.apache.http.util.TextUtils;
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
@ -62,9 +61,9 @@ import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import org.thymeleaf.context.Context;
|
|
|
|
import org.thymeleaf.context.Context;
|
|
|
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
|
|
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
|
|
|
import org.xhtmlrenderer.pdf.ITextFontResolver;
|
|
|
|
|
|
|
|
import org.xhtmlrenderer.pdf.ITextRenderer;
|
|
|
|
import org.xhtmlrenderer.pdf.ITextRenderer;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
@ -523,9 +522,6 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id"));
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id"));
|
|
|
|
params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
|
|
|
|
params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
|
|
|
|
|
|
|
|
|
|
|
|
// PageList<JSONObject> logs = transactionMapper.listTransFlowPage(params,
|
|
|
|
|
|
|
|
// new PageBounds(query.getPage(), query.getLimit(), Order.formString("transaction_time.desc")));
|
|
|
|
|
|
|
|
List<JSONObject> logs = transactionMapper.listTransFlow(params);
|
|
|
|
List<JSONObject> logs = transactionMapper.listTransFlow(params);
|
|
|
|
TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time");
|
|
|
|
TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time");
|
|
|
|
Paginator paginator = new Paginator(query.getPage(), query.getLimit(), logs.size());
|
|
|
|
Paginator paginator = new Paginator(query.getPage(), query.getLimit(), logs.size());
|
|
|
@ -570,9 +566,11 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
int clientId = partner.getIntValue("client_id");
|
|
|
|
int clientId = partner.getIntValue("client_id");
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|
JSONObject params = query.toParams(timezone);
|
|
|
|
JSONObject params = query.toParams(timezone);
|
|
|
|
params.put("channel", channels);
|
|
|
|
// params.put("channel", channels);
|
|
|
|
clientManager.validateClients(clientId, params);
|
|
|
|
clientManager.validateClients(clientId, params);
|
|
|
|
params.put("client_id", clientId);
|
|
|
|
params.put("client_id", clientId);
|
|
|
|
|
|
|
|
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id"));
|
|
|
|
|
|
|
|
params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
|
|
|
|
clientManager.queryModifyClientIds(clientId, params);
|
|
|
|
clientManager.queryModifyClientIds(clientId, params);
|
|
|
|
List<JSONObject> logs = transactionMapper.listTransFlow(params);
|
|
|
|
List<JSONObject> logs = transactionMapper.listTransFlow(params);
|
|
|
|
TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy HH:mm:ss", Collections.singletonList("transaction_time"));
|
|
|
|
TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy HH:mm:ss", Collections.singletonList("transaction_time"));
|
|
|
@ -771,15 +769,14 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
public void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"Wechat","Alipay","AlipayOnline"});
|
|
|
|
JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner, new String[]{"Wechat", "Alipay", "AlipayOnline"});
|
|
|
|
JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
|
Context ctx = new Context();
|
|
|
|
Context ctx = new Context();
|
|
|
|
|
|
|
|
|
|
|
|
// JSONObject manager = managerMapper.findById(device.getString("manager_id"));
|
|
|
|
|
|
|
|
// ctx.setVariable("firstname","lu");
|
|
|
|
|
|
|
|
if (!transFlow.getJSONArray("data").isEmpty()) {
|
|
|
|
if (!transFlow.getJSONArray("data").isEmpty()) {
|
|
|
|
try {
|
|
|
|
try (OutputStream outs = response.getOutputStream();
|
|
|
|
|
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
|
|
|
|
|
|
) {
|
|
|
|
List<JSONObject> dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class);
|
|
|
|
List<JSONObject> dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class);
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom())
|
|
|
|
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom())
|
|
|
@ -788,7 +785,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
StringUtils.isNotBlank(query.getDateto())
|
|
|
|
StringUtils.isNotBlank(query.getDateto())
|
|
|
|
? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy")
|
|
|
|
? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy")
|
|
|
|
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
|
|
|
|
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
|
|
|
|
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + "~"
|
|
|
|
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + " ~ "
|
|
|
|
+ parmerters.getString("dateTo"));
|
|
|
|
+ parmerters.getString("dateTo"));
|
|
|
|
parmerters.put("partnerCode", client.getString("client_moniker"));
|
|
|
|
parmerters.put("partnerCode", client.getString("client_moniker"));
|
|
|
|
parmerters.put("clientName", client.getString("company_name"));
|
|
|
|
parmerters.put("clientName", client.getString("company_name"));
|
|
|
@ -833,63 +830,116 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
: "-";
|
|
|
|
: "-";
|
|
|
|
item.put("debit", debit);
|
|
|
|
item.put("debit", debit);
|
|
|
|
item.put("credit", credit);
|
|
|
|
item.put("credit", credit);
|
|
|
|
if(item.get("settle_amount")==null){
|
|
|
|
item.putIfAbsent("settle_amount", "-");
|
|
|
|
item.put("settle_amount","-");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
System.out.println("------>dataList:"+dataList);
|
|
|
|
ctx.setVariable("parmerters", parmerters);
|
|
|
|
System.out.println("------>parmerters:"+parmerters);
|
|
|
|
ctx.setVariable("dataList", dataList);
|
|
|
|
ctx.setVariable("parmerters",parmerters);
|
|
|
|
JSONObject orgInfo = orgManager.getOrgDetail(client.getIntValue("org_id"), null);
|
|
|
|
ctx.setVariable("dataList",dataList);
|
|
|
|
if (!orgInfo.containsKey("logo") || orgInfo.getIntValue("org_id") == 1) {
|
|
|
|
|
|
|
|
orgInfo.put("logo", "none");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.setVariable("orgInfo", orgInfo);
|
|
|
|
final String html = thymeleaf.process("app/invoice.html", ctx);
|
|
|
|
final String html = thymeleaf.process("app/invoice.html", ctx);
|
|
|
|
|
|
|
|
|
|
|
|
JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList);
|
|
|
|
|
|
|
|
response.setContentType("application/pdf");
|
|
|
|
response.setContentType("application/pdf");
|
|
|
|
String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", "");
|
|
|
|
String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", "");
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
|
|
|
|
OutputStream outs = response.getOutputStream();
|
|
|
|
|
|
|
|
// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城");
|
|
|
|
|
|
|
|
// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream();
|
|
|
|
|
|
|
|
// byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource);
|
|
|
|
|
|
|
|
System.out.println("------>content:"+html);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
|
|
|
|
|
|
ITextRenderer renderer = new ITextRenderer();
|
|
|
|
ITextRenderer renderer = new ITextRenderer();
|
|
|
|
// ITextFontResolver fontResolver = (ITextFontResolver) renderer.getSharedContext().getFontResolver();
|
|
|
|
|
|
|
|
//添加字体库 begin
|
|
|
|
|
|
|
|
// File f = new File(fontDir);
|
|
|
|
|
|
|
|
// if (f.isDirectory()) {
|
|
|
|
|
|
|
|
// File[] files = f.listFiles(new FilenameFilter() {
|
|
|
|
|
|
|
|
// public boolean accept(File dir, String name) {
|
|
|
|
|
|
|
|
// String lower = name.toLowerCase();
|
|
|
|
|
|
|
|
// return lower.endsWith(".otf") || lower.endsWith(".ttf") ;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// for (int i = 0; i < files.length; i++) {
|
|
|
|
|
|
|
|
// fontResolver.addFont(files[i].getAbsolutePath(), BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//添加字体库end
|
|
|
|
//添加字体库end
|
|
|
|
renderer.setDocumentFromString(html);
|
|
|
|
renderer.setDocumentFromString(html);
|
|
|
|
renderer.layout();
|
|
|
|
renderer.layout();
|
|
|
|
renderer.createPDF(os);
|
|
|
|
renderer.createPDF(os);
|
|
|
|
renderer.finishPDF();
|
|
|
|
|
|
|
|
byte[] bytes = os.toByteArray();
|
|
|
|
byte[] bytes = os.toByteArray();
|
|
|
|
outs.write(bytes, 0, bytes.length);
|
|
|
|
outs.write(bytes, 0, bytes.length);
|
|
|
|
outs.flush();
|
|
|
|
outs.flush();
|
|
|
|
outs.close();
|
|
|
|
renderer.finishPDF();
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public ModelAndView exportTransFlow(TradeLogQuery query, JSONObject partner, Model model) throws Exception {
|
|
|
|
|
|
|
|
JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner, new String[]{"Wechat", "Alipay", "AlipayOnline"});
|
|
|
|
|
|
|
|
JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
|
|
|
|
|
ModelAndView view = new ModelAndView("app/invoice.html");
|
|
|
|
|
|
|
|
if (!transFlow.getJSONArray("data").isEmpty()) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
List<JSONObject> dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class);
|
|
|
|
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
|
|
|
|
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom())
|
|
|
|
|
|
|
|
? DateFormatUtils.format(DateUtils.parseDate(query.getDatefrom(), "yyyyMMdd"), "dd/MM/yyyy") : "");
|
|
|
|
|
|
|
|
parmerters.put("dateTo",
|
|
|
|
|
|
|
|
StringUtils.isNotBlank(query.getDateto())
|
|
|
|
|
|
|
|
? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy")
|
|
|
|
|
|
|
|
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
|
|
|
|
|
|
|
|
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + " ~ "
|
|
|
|
|
|
|
|
+ parmerters.getString("dateTo"));
|
|
|
|
|
|
|
|
parmerters.put("partnerCode", client.getString("client_moniker"));
|
|
|
|
|
|
|
|
parmerters.put("clientName", client.getString("company_name"));
|
|
|
|
|
|
|
|
parmerters.put("clientAddress", client.getString("address"));
|
|
|
|
|
|
|
|
parmerters.put("balance", analysis.getDoubleValue("balance"));
|
|
|
|
|
|
|
|
parmerters.put("logo", logo.getInputStream());
|
|
|
|
|
|
|
|
parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("totalSettledAmount", takeDecimalOrDefault(analysis, "total_settle_amount", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("royalpay_charge", takeDecimalOrDefault(analysis, "total_royal_surcharge", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO));
|
|
|
|
|
|
|
|
parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataList.parallelStream().forEach(item -> {
|
|
|
|
|
|
|
|
BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal taxAmount = item.containsKey("tax_amount") ? item.getBigDecimal("tax_amount") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal royalpaySurhcarge = item.containsKey("royal_surcharge") ? item.getBigDecimal("royal_surcharge") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal surhcargeBack = item.containsKey("surcharge_cashback") ? item.getBigDecimal("surcharge_cashback") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal channelSurcharge = item.containsKey("channel_surcharge") ? item.getBigDecimal("channel_surcharge") : BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal incrementalTax = incrementalSurcharge.divide(new BigDecimal(10), 2, RoundingMode.HALF_UP);
|
|
|
|
|
|
|
|
BigDecimal royalpayTax = taxAmount.subtract(incrementalTax);
|
|
|
|
|
|
|
|
BigDecimal realRoyalpayCharge = royalpaySurhcarge
|
|
|
|
|
|
|
|
.add(surhcargeBack)
|
|
|
|
|
|
|
|
.add(channelSurcharge)
|
|
|
|
|
|
|
|
.add(royalpayTax);
|
|
|
|
|
|
|
|
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
item.put("real_royalpay_surcharge", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
scaleDecimalVal(item, "display_amount", item.getString("currency"));
|
|
|
|
|
|
|
|
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
|
|
|
|
|
|
|
|
scaleDecimalVal(item, "clearing_amount", platformCurrency);
|
|
|
|
|
|
|
|
scaleDecimalVal(item, "settle_amount", platformCurrency);
|
|
|
|
|
|
|
|
scaleDecimalVal(item, "total_surcharge", platformCurrency);
|
|
|
|
|
|
|
|
String debit = item.getString("transaction_type").equals("Debit") ? item.getBigDecimal("clearing_amount").toString()
|
|
|
|
|
|
|
|
: "-";
|
|
|
|
|
|
|
|
String credit = item.getString("transaction_type").equals("Credit") ? item.getBigDecimal("clearing_amount").toString()
|
|
|
|
|
|
|
|
: "-";
|
|
|
|
|
|
|
|
item.put("debit", debit);
|
|
|
|
|
|
|
|
item.put("credit", credit);
|
|
|
|
|
|
|
|
item.putIfAbsent("settle_amount", "-");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
view.addObject("parmerters", parmerters);
|
|
|
|
|
|
|
|
view.addObject("dataList", dataList);
|
|
|
|
|
|
|
|
JSONObject orgInfo = orgManager.getOrgDetail(client.getIntValue("org_id"), null);
|
|
|
|
|
|
|
|
if (!orgInfo.containsKey("logo") || orgInfo.getIntValue("org_id") == 1) {
|
|
|
|
|
|
|
|
orgInfo.put("logo", "none");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
view.addObject("orgInfo", orgInfo);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
public void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws
|
|
|
|
JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"rpaypmt_card","rpaypmt_dd"});
|
|
|
|
Exception {
|
|
|
|
|
|
|
|
JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner, new String[]{"rpaypmt_card", "rpaypmt_dd"});
|
|
|
|
JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
|
if (!transFlow.getJSONArray("data").isEmpty()) {
|
|
|
|
if (!transFlow.getJSONArray("data").isEmpty()) {
|
|
|
@ -920,7 +970,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO));
|
|
|
|
parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO));
|
|
|
|
parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO));
|
|
|
|
parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO));
|
|
|
|
parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO));
|
|
|
|
parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO));
|
|
|
|
parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2,RoundingMode.HALF_UP));
|
|
|
|
parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge")
|
|
|
|
BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge")
|
|
|
|
.subtract(analysis.getBigDecimal("total_transaction_fee"))
|
|
|
|
.subtract(analysis.getBigDecimal("total_transaction_fee"))
|
|
|
@ -944,7 +994,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax);
|
|
|
|
BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax);
|
|
|
|
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("total_surcharge_intax", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("total_surcharge_intax", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2,RoundingMode.HALF_UP));
|
|
|
|
item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
scaleDecimalVal(item, "display_amount", item.getString("currency"));
|
|
|
|
scaleDecimalVal(item, "display_amount", item.getString("currency"));
|
|
|
|
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
|
|
|
|
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
|
|
|
|
scaleDecimalVal(item, "clearing_amount", platformCurrency);
|
|
|
|
scaleDecimalVal(item, "clearing_amount", platformCurrency);
|
|
|
@ -970,7 +1020,8 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
public void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws
|
|
|
|
|
|
|
|
Exception {
|
|
|
|
query.setClearing_status(-1);
|
|
|
|
query.setClearing_status(-1);
|
|
|
|
String clientKey = "exportTransFlow:" + partner.getString("client_id");
|
|
|
|
String clientKey = "exportTransFlow:" + partner.getString("client_id");
|
|
|
|
|
|
|
|
|
|
|
@ -1020,7 +1071,8 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws
|
|
|
|
|
|
|
|
Exception {
|
|
|
|
logger.debug("excel The method======= exportExcel() start.......................");
|
|
|
|
logger.debug("excel The method======= exportExcel() start.......................");
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
@ -1105,7 +1157,8 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportExcelNew(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
public void exportExcelNew(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws
|
|
|
|
|
|
|
|
Exception {
|
|
|
|
logger.debug("excel The method======= exportExcelNew() start.......................");
|
|
|
|
logger.debug("excel The method======= exportExcelNew() start.......................");
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
|
JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id"));
|
|
|
@ -1926,7 +1979,8 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) throws Exception {
|
|
|
|
public void exportExcelAllPartner(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) throws
|
|
|
|
|
|
|
|
Exception {
|
|
|
|
logger.debug("excel The method======= exportExcel() start.......................");
|
|
|
|
logger.debug("excel The method======= exportExcel() start.......................");
|
|
|
|
int clientId1 = partner.getIntValue("client_id");
|
|
|
|
int clientId1 = partner.getIntValue("client_id");
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|