|
|
|
@ -22,6 +22,7 @@ import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
|
|
|
|
|
import au.com.royalpay.payment.tools.defines.TradeType;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
|
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.CurrencyAmountUtils;
|
|
|
|
@ -40,6 +41,8 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
|
|
|
|
import net.sf.jasperreports.engine.export.JRXlsExporter;
|
|
|
|
|
import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;
|
|
|
|
|
import net.sf.jasperreports.export.*;
|
|
|
|
|
import org.apache.commons.csv.CSVFormat;
|
|
|
|
|
import org.apache.commons.csv.CSVPrinter;
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -58,9 +61,7 @@ import org.springframework.ui.Model;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
@ -150,8 +151,10 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
if (manager != null && manager.getInteger("org_id") != null) {
|
|
|
|
|
params.put("org_id", manager.getIntValue("org_id"));
|
|
|
|
|
}
|
|
|
|
|
if(query.getGatewayChild()!=null){
|
|
|
|
|
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
|
|
|
|
|
if (query.getGatewayChild() != null) {
|
|
|
|
|
params.put("trade_type", new ArrayList<Integer>() {{
|
|
|
|
|
add(query.getGatewayChild());
|
|
|
|
|
}});
|
|
|
|
|
}
|
|
|
|
|
PageList<JSONObject> logs = orderMapper.listOrdersByClients(params,
|
|
|
|
|
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
@ -185,8 +188,10 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
if (manager != null && manager.getInteger("org_id") != null) {
|
|
|
|
|
params.put("org_id", manager.getIntValue("org_id"));
|
|
|
|
|
}
|
|
|
|
|
if(query.getGatewayChild()!=null){
|
|
|
|
|
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
|
|
|
|
|
if (query.getGatewayChild() != null) {
|
|
|
|
|
params.put("trade_type", new ArrayList<Integer>() {{
|
|
|
|
|
add(query.getGatewayChild());
|
|
|
|
|
}});
|
|
|
|
|
}
|
|
|
|
|
PageList<JSONObject> logs = orderMapper.listIncrementalOrdersByClients(params,
|
|
|
|
|
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
@ -222,8 +227,10 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
orgManager.checkOrgIds(manager, params);
|
|
|
|
|
if(query.getGatewayChild()!=null){
|
|
|
|
|
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
|
|
|
|
|
if (query.getGatewayChild() != null) {
|
|
|
|
|
params.put("trade_type", new ArrayList<Integer>() {{
|
|
|
|
|
add(query.getGatewayChild());
|
|
|
|
|
}});
|
|
|
|
|
}
|
|
|
|
|
PageList<JSONObject> logs = orderMapper.listOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
|
JSONObject result = PageListUtils.buildPageListResult(logs);
|
|
|
|
@ -246,12 +253,14 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
orgManager.checkOrgIds(manager, params);
|
|
|
|
|
if(query.getGatewayChild()!=null){
|
|
|
|
|
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
|
|
|
|
|
if (query.getGatewayChild() != null) {
|
|
|
|
|
params.put("trade_type", new ArrayList<Integer>() {{
|
|
|
|
|
add(query.getGatewayChild());
|
|
|
|
|
}});
|
|
|
|
|
}
|
|
|
|
|
PageList<JSONObject> logs = orderMapper.listIncrementalOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
|
for (JSONObject log : logs) {
|
|
|
|
|
log.put("rate_value",clientIncrementalMapper.findByChannelAndClientId(log.getIntValue("client_id"),log.getString("source")));
|
|
|
|
|
log.put("rate_value", clientIncrementalMapper.findByChannelAndClientId(log.getIntValue("client_id"), log.getString("source")));
|
|
|
|
|
}
|
|
|
|
|
JSONObject result = PageListUtils.buildPageListResult(logs);
|
|
|
|
|
JSONObject analysis = orderMapper.analysisOrders(params);
|
|
|
|
@ -791,7 +800,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clearing_amount"));
|
|
|
|
|
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(data.getString("settle_amount"));
|
|
|
|
|
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(data.getString("total_surcharge"));
|
|
|
|
|
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(data.getString("incremental_surcharge"),"0.0000"));
|
|
|
|
|
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(data.getString("incremental_surcharge"), "0.0000"));
|
|
|
|
|
row.createCell(14, Cell.CELL_TYPE_STRING).setCellValue(data.getString("tax_amount"));
|
|
|
|
|
row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clearing_time"));
|
|
|
|
|
row.createCell(16, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type").equals("clearing") ? "-" : data.getBigDecimal("exchange_rate").toString());
|
|
|
|
@ -907,9 +916,9 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
cell0.setCellValue(text0);
|
|
|
|
|
cell1.setCellValue(text1);
|
|
|
|
|
cell2.setCellValue(text2);
|
|
|
|
|
if(dataItem.getString("transaction_type").equals("Debit") ){
|
|
|
|
|
if (dataItem.getString("transaction_type").equals("Debit")) {
|
|
|
|
|
cell2.setCellStyle(style3);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
cell2.setCellStyle(style2);
|
|
|
|
|
}
|
|
|
|
|
cell3.setCellValue(text3);
|
|
|
|
@ -971,12 +980,12 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void listSettlementLogExcel(TradeLogQuery query, JSONObject partner,HttpServletResponse response) {
|
|
|
|
|
public void listSettlementLogExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfoByMoniker(partner.getString("client_moniker"));
|
|
|
|
|
int clientId = partner.getIntValue("client_id");
|
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|
|
if(query.getClient_ids()!=null){
|
|
|
|
|
if(query.getClient_ids().length>1){
|
|
|
|
|
if (query.getClient_ids() != null) {
|
|
|
|
|
if (query.getClient_ids().length > 1) {
|
|
|
|
|
query.setClient_ids(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -985,21 +994,21 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
|
|
|
|
|
new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
|
|
|
|
|
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
|
|
|
|
if(query.getClient_ids() ==null){
|
|
|
|
|
addSheet(0,workbook,client,logs);
|
|
|
|
|
if (query.getClient_ids() == null) {
|
|
|
|
|
addSheet(0, workbook, client, logs);
|
|
|
|
|
List<JSONObject> childs = clientMapper.listChildClients(client.getIntValue("client_id"));
|
|
|
|
|
for (int i=0;i<childs.size();i++){
|
|
|
|
|
for (int i = 0; i < childs.size(); i++) {
|
|
|
|
|
params.put("client_id", childs.get(i).getInteger("client_id"));
|
|
|
|
|
PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
|
|
|
|
|
if(childLogs.size()>0){
|
|
|
|
|
addSheet(i+1,workbook, childs.get(i),childLogs);
|
|
|
|
|
if (childLogs.size() > 0) {
|
|
|
|
|
addSheet(i + 1, workbook, childs.get(i), childLogs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0]));
|
|
|
|
|
addSheet(0,workbook,chlidClient,logs);
|
|
|
|
|
addSheet(0, workbook, chlidClient, logs);
|
|
|
|
|
}
|
|
|
|
|
String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() );
|
|
|
|
|
String fileName = "Settlement Log - " + (query.getDatefrom() + "~" + query.getDateto());
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
|
|
|
|
|
OutputStream outputStream = response.getOutputStream();
|
|
|
|
|
try {
|
|
|
|
@ -1013,9 +1022,9 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addSheet(int sheetNum,HSSFWorkbook workbook,JSONObject client,List<JSONObject> logs){
|
|
|
|
|
private void addSheet(int sheetNum, HSSFWorkbook workbook, JSONObject client, List<JSONObject> logs) {
|
|
|
|
|
HSSFSheet sheet = workbook.createSheet();
|
|
|
|
|
workbook.setSheetName(sheetNum,client.getString("client_moniker")+"_excel");
|
|
|
|
|
workbook.setSheetName(sheetNum, client.getString("client_moniker") + "_excel");
|
|
|
|
|
sheet.setDefaultColumnWidth((short) 40);
|
|
|
|
|
HSSFCellStyle style = workbook.createCellStyle();
|
|
|
|
|
style.setFillForegroundColor(HSSFColor.LIGHT_ORANGE.index);
|
|
|
|
@ -1086,7 +1095,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
JSONObject dataItem = logs.get(i);
|
|
|
|
|
HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name"));
|
|
|
|
|
HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker"));
|
|
|
|
|
HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( dataItem.getDate("report_date")));
|
|
|
|
|
HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dataItem.getDate("report_date")));
|
|
|
|
|
HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
|
|
|
|
|
HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
|
|
|
|
|
HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
|
|
|
|
@ -1468,33 +1477,21 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN).toPlainString());
|
|
|
|
|
cell = row.createCell(6, Cell.CELL_TYPE_STRING);
|
|
|
|
|
cell.setCellValue(settle.getString("transaction_type"));
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
|
|
|
|
|
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("transaction_currency"));
|
|
|
|
|
cell = row.createCell(8, Cell.CELL_TYPE_STRING);
|
|
|
|
|
cell.setCellValue(settle.getBigDecimal("display_amount") == null ? ""
|
|
|
|
|
: "Credit".equals(settle.getString("transaction_type"))?
|
|
|
|
|
settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
|
|
|
|
|
"-"+settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
|
|
|
|
|
cell.setCellValue(convertMarkedAmountString(settle, "display_amount"));
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
|
|
|
|
|
cell = row.createCell(9, Cell.CELL_TYPE_STRING);
|
|
|
|
|
cell.setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
|
|
|
|
|
: "Credit".equals(settle.getString("transaction_type"))?
|
|
|
|
|
settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
|
|
|
|
|
"-"+settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
|
|
|
|
|
cell.setCellValue(convertMarkedAmountString(settle, "transaction_amount"));
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
|
|
|
|
|
cell = row.createCell(10, Cell.CELL_TYPE_STRING);
|
|
|
|
|
cell.setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
|
|
|
|
|
: "Credit".equals(settle.getString("transaction_type"))?
|
|
|
|
|
settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
|
|
|
|
|
"-"+settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
|
|
|
|
|
cell.setCellValue(convertMarkedAmountString(settle, "clearing_amount"));
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
|
|
|
|
|
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("rate") == null ? "" : settle.getBigDecimal("rate").toPlainString() + "%");
|
|
|
|
|
cell = row.createCell(12, Cell.CELL_TYPE_STRING);
|
|
|
|
|
cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
|
|
|
|
|
: "Credit".equals(settle.getString("transaction_type"))?
|
|
|
|
|
settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
|
|
|
|
|
"-"+settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
|
|
|
|
|
cell.setCellValue(convertMarkedAmountString(settle, "settle_amount"));
|
|
|
|
|
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
|
|
|
|
|
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("total_surcharge") == null ? ""
|
|
|
|
|
: settle.getBigDecimal("total_surcharge").setScale(2, RoundingMode.DOWN).toPlainString());
|
|
|
|
|
row.createCell(14, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("tax_amount") == null ? ""
|
|
|
|
@ -1524,9 +1521,97 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
wb.write(ous);
|
|
|
|
|
ous.flush();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new ServerErrorException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void exportSettlementLogCSV(TradeLogQuery query, JSONObject partner, HttpServletResponse response) {
|
|
|
|
|
String begin = query.getDatefrom() == null ? "" : query.getDatefrom();
|
|
|
|
|
String end = query.getDateto() == null ? "" : query.getDateto();
|
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|
|
JSONObject params = query.toParams(timezone);
|
|
|
|
|
if (params.get("client_ids") == null) {
|
|
|
|
|
params.put("client_id", partner.getJSONObject("client").getString("client_id"));
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
|
|
|
|
|
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
|
|
|
|
|
clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order")));
|
|
|
|
|
List<JSONObject> settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);
|
|
|
|
|
String[] title = {"order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency",
|
|
|
|
|
"Input Amount", "Total Amount", "Clearing Amount", "Surcharge Rate", "Settle Amount", "Surcharge", "GST", "Remark", "Dev No", "Company Name", "Short Name", "Settlement Date"};
|
|
|
|
|
CSVFormat format = CSVFormat.DEFAULT.withFirstRecordAsHeader().withHeader(title);
|
|
|
|
|
response.setContentType("application/octet-stream;");
|
|
|
|
|
response.addHeader("Content-Disposition",
|
|
|
|
|
"attachment; filename=" + "Merchant_Settlement_Info_" + begin + "_" + end + ".csv");
|
|
|
|
|
try (PrintWriter writer = response.getWriter();
|
|
|
|
|
CSVPrinter printer = new CSVPrinter(writer, format)) {
|
|
|
|
|
JSONObject clearDetailTotal = transactionMapper.getClearDetailTotal(params);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (JSONObject settle : settlementLogDetailList) {
|
|
|
|
|
if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String gateway = settle.getInteger("gateway") != null ? TradeType.fromGatewayNumber(settle.getIntValue("gateway")).getTradeType() : "-";
|
|
|
|
|
String displayAmount = convertMarkedAmountString(settle, "display_amount");
|
|
|
|
|
String transAmt = convertMarkedAmountString(settle, "transaction_amount");
|
|
|
|
|
String clearAmt = convertMarkedAmountString(settle, "clearing_amount");
|
|
|
|
|
String settleAmt = convertMarkedAmountString(settle, "settle_amount");
|
|
|
|
|
JSONObject device = clientDeviceMapper.find(settle.getString("dev_id"));
|
|
|
|
|
String clientDevId = device == null ? "" : device.getString("client_dev_id");
|
|
|
|
|
//print row
|
|
|
|
|
printer.printRecord(
|
|
|
|
|
settle.getString("order_id"),
|
|
|
|
|
settle.getString("client_order_id"),
|
|
|
|
|
settle.getString("transaction_time"),
|
|
|
|
|
settle.getString("channel"),
|
|
|
|
|
gateway,
|
|
|
|
|
settle.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN).toPlainString(),
|
|
|
|
|
settle.getString("transaction_type"),
|
|
|
|
|
settle.getString("transaction_currency"),
|
|
|
|
|
displayAmount,
|
|
|
|
|
transAmt,
|
|
|
|
|
clearAmt,
|
|
|
|
|
settle.getBigDecimal("rate") == null ? "" : settle.getBigDecimal("rate").toPlainString() + "%",
|
|
|
|
|
settleAmt,
|
|
|
|
|
settle.getBigDecimal("total_surcharge") == null ? ""
|
|
|
|
|
: settle.getBigDecimal("total_surcharge").setScale(2, RoundingMode.DOWN).toPlainString(),
|
|
|
|
|
settle.getBigDecimal("tax_amount") == null ? ""
|
|
|
|
|
: settle.getBigDecimal("tax_amount").setScale(2, RoundingMode.DOWN).toPlainString(),
|
|
|
|
|
settle.getString("remark"),
|
|
|
|
|
clientDevId, settle.getString("company_name"),
|
|
|
|
|
settle.getString("short_name"),
|
|
|
|
|
settle.getString("settle_date"));
|
|
|
|
|
}
|
|
|
|
|
String[] analysisRow = {"Total Credit",
|
|
|
|
|
clearDetailTotal.getString("total_payment"),
|
|
|
|
|
"Total Debit",
|
|
|
|
|
clearDetailTotal.getString("total_refund"),
|
|
|
|
|
"Gross Amount",
|
|
|
|
|
clearDetailTotal.getString("gross_amount"),
|
|
|
|
|
"Total Charge",
|
|
|
|
|
clearDetailTotal.getBigDecimal("total_charge").add(clearDetailTotal.getBigDecimal("tax_amount")).toPlainString(),
|
|
|
|
|
"Net Amount",
|
|
|
|
|
clearDetailTotal.getString("clearing_amount")};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printer.printRecord((Object[]) analysisRow);
|
|
|
|
|
writer.flush();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new ServerErrorException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String convertMarkedAmountString(JSONObject settle, String key) {
|
|
|
|
|
if (settle.getBigDecimal(key) == null) {
|
|
|
|
|
return "";
|
|
|
|
|
} else {
|
|
|
|
|
return "Credit".equals(settle.getString("transaction_type")) ?
|
|
|
|
|
settle.getBigDecimal(key).setScale(2, RoundingMode.DOWN).toPlainString() :
|
|
|
|
|
"-" + settle.getBigDecimal(key).setScale(2, RoundingMode.DOWN).toPlainString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1574,7 +1659,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
|
outs.flush();
|
|
|
|
|
outs.close();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new ServerErrorException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|