|
|
@ -304,6 +304,28 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
|
|
|
|
return cleanLog;
|
|
|
|
return cleanLog;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public JSONObject getCleanLogTransactionsOfMergeSettle(int clientId, String reportDate, JSONObject manager) {
|
|
|
|
|
|
|
|
JSONObject clearClient = clearingDetailMapper.listReportOfMergeSettle(reportDate, clientId);
|
|
|
|
|
|
|
|
if (clearClient == null) {
|
|
|
|
|
|
|
|
throw new NotFoundException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(clientId);
|
|
|
|
|
|
|
|
Assert.notNull(client, "Client ID invalid");
|
|
|
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
|
|
|
List<JSONObject> transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,clientId,
|
|
|
|
|
|
|
|
new PageBounds(Order.formString("order_id.asc")));
|
|
|
|
|
|
|
|
clearClient.put("report", transactions);
|
|
|
|
|
|
|
|
List<JSONObject> channels = clearingDetailAnalysisMapper.listReportChannelsOfMergeSettle(reportDate, clientId);
|
|
|
|
|
|
|
|
JSONObject channelsObj = new JSONObject();
|
|
|
|
|
|
|
|
for (JSONObject channel : channels) {
|
|
|
|
|
|
|
|
channelsObj.put(channel.getString("channel"), channel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
clearClient.put("channels", channelsObj);
|
|
|
|
|
|
|
|
clearClient.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
|
|
|
return clearClient;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, JSONObject> getDayAndChannelOfAnalysisMap(int detailId, String channel, JSONObject manager) {
|
|
|
|
public Map<String, JSONObject> getDayAndChannelOfAnalysisMap(int detailId, String channel, JSONObject manager) {
|
|
|
|
JSONObject cleanLog = clearingDetailMapper.findByDetailId(detailId);
|
|
|
|
JSONObject cleanLog = clearingDetailMapper.findByDetailId(detailId);
|
|
|
@ -850,6 +872,40 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
|
|
|
|
return clearClient;
|
|
|
|
return clearClient;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public JSONObject listClearingTransactionsByMergeSettle(int client_id, String reportDate, JSONObject partner) {
|
|
|
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
|
|
|
|
Assert.notNull(client, "Client not exists");
|
|
|
|
|
|
|
|
int parent_client_id = client.getIntValue("parent_client_id");
|
|
|
|
|
|
|
|
if (partner.get("client_id") != null) {
|
|
|
|
|
|
|
|
if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) {
|
|
|
|
|
|
|
|
throw new ForbiddenException("No Permission");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject clearClient = clearingDetailMapper.listReportOfMergeSettle(reportDate, client_id);
|
|
|
|
|
|
|
|
if (clearClient == null) {
|
|
|
|
|
|
|
|
throw new NotFoundException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<JSONObject> transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,client_id,
|
|
|
|
|
|
|
|
new PageBounds(Order.formString("order_id.asc")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String timezone_client = client.getString("timezone");
|
|
|
|
|
|
|
|
if (timezone_client != null) {
|
|
|
|
|
|
|
|
transactions.parallelStream().forEach(p -> {
|
|
|
|
|
|
|
|
TimeZoneUtils.switchTimeZone(p, timezone_client, "transaction_time");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
clearClient.put("report", transactions);
|
|
|
|
|
|
|
|
List<JSONObject> channels = clearingDetailAnalysisMapper.listReportChannelsOfMergeSettle(reportDate, client_id);
|
|
|
|
|
|
|
|
JSONObject channelsObj = new JSONObject();
|
|
|
|
|
|
|
|
for (JSONObject channel : channels) {
|
|
|
|
|
|
|
|
channelsObj.put(channel.getString("channel"), channel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
clearClient.put("channels", channelsObj);
|
|
|
|
|
|
|
|
clearClient.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
|
|
|
return clearClient;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel, JSONObject partner) {
|
|
|
|
public Map<String, JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel, JSONObject partner) {
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
@ -862,6 +918,19 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
|
|
|
|
return getDayAnalysisMap(clearingDetailId, channel, client);
|
|
|
|
return getDayAnalysisMap(clearingDetailId, channel, client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Map<String, JSONObject> channelAndDayOfMergeSettleAnalysis(int client_id, String reportDate, String channel, JSONObject partner) {
|
|
|
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
|
|
|
|
Assert.notNull(client, "Client not exists");
|
|
|
|
|
|
|
|
int parent_client_id = client.getIntValue("parent_client_id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) {
|
|
|
|
|
|
|
|
throw new ForbiddenException("No Permission");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject parentClient = clientManager.getClientInfo(parent_client_id);
|
|
|
|
|
|
|
|
return getDayAnalysisMapOfMergeSettle(reportDate, channel, parentClient);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, JSONObject> getDayAnalysisMap(String clearingDetailId, String channel, JSONObject client) {
|
|
|
|
private Map<String, JSONObject> getDayAnalysisMap(String clearingDetailId, String channel, JSONObject client) {
|
|
|
|
List<JSONObject> transactions = transactionMapper.listTransactionsOfClearingOrder(Integer.parseInt(clearingDetailId),
|
|
|
|
List<JSONObject> transactions = transactionMapper.listTransactionsOfClearingOrder(Integer.parseInt(clearingDetailId),
|
|
|
|
new PageBounds(Order.formString("order_id.asc")));
|
|
|
|
new PageBounds(Order.formString("order_id.asc")));
|
|
|
@ -907,6 +976,51 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
|
|
|
|
return dayAnalysisMap;
|
|
|
|
return dayAnalysisMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, JSONObject> getDayAnalysisMapOfMergeSettle(String reportDate, String channel, JSONObject client) {
|
|
|
|
|
|
|
|
List<JSONObject> transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate, client.getIntValue("client_id"),
|
|
|
|
|
|
|
|
new PageBounds(Order.formString("order_id.asc")));
|
|
|
|
|
|
|
|
String timezone_client = client.getString("timezone");
|
|
|
|
|
|
|
|
if (!channel.equals("null")) {
|
|
|
|
|
|
|
|
transactions = transactions.stream().filter(t -> t.getString("channel").equals(channel)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> dateKeysList = new ArrayList<>();
|
|
|
|
|
|
|
|
dateKeysList.add("transaction_time");
|
|
|
|
|
|
|
|
if (timezone_client != null) {
|
|
|
|
|
|
|
|
transactions.parallelStream().forEach(p -> {
|
|
|
|
|
|
|
|
TimeZoneUtils.switchTimeZone(p, timezone_client, "transaction_time");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
TimeZoneUtils.switchTimeZoneToString(transactions, timezone_client, TimeZoneUtils.PATTERN_DATE, dateKeysList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<JSONObject>> dayTransactionsMap = transactions.stream().collect(Collectors.groupingBy(x -> x.getString("transaction_time").substring(0, 10)));
|
|
|
|
|
|
|
|
Map<String, JSONObject> dayAnalysisMap = new TreeMap<>();
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<JSONObject>> entry : dayTransactionsMap.entrySet()) {
|
|
|
|
|
|
|
|
JSONObject analysis = new JSONObject();
|
|
|
|
|
|
|
|
List<JSONObject> transactionsOfDay = entry.getValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal total_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("clearing_amount")).map(t -> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
BigDecimal total_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("clearing_amount")).map(t -> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
BigDecimal total_charge_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("total_surcharge")).map(t -> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
BigDecimal total_charge_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("total_surcharge")).map(t -> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
BigDecimal net_amount_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("settle_amount")).map(t -> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
BigDecimal net_amount_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("settle_amount")).map(t -> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
BigDecimal tax_amount_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("tax_amount")).map(t -> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
BigDecimal tax_amount_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("tax_amount")).map(t -> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal tax_amount = tax_amount_credit.subtract(tax_amount_debit);
|
|
|
|
|
|
|
|
analysis.put("total_credit", total_credit.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
analysis.put("total_debit", total_debit.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
analysis.put("net_amount", net_amount_credit.subtract(net_amount_debit).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
analysis.put("clearing_amount", net_amount_credit.subtract(net_amount_debit).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
analysis.put("tax_amount", tax_amount.setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
analysis.put("total_surcharge", total_charge_credit.subtract(total_charge_debit).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
analysis.put("total_charge", total_charge_credit.subtract(total_charge_debit).add(tax_amount).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
analysis.put("gross_amount", total_credit.subtract(total_debit).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
|
|
dayAnalysisMap.put(entry.getKey(), analysis);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return dayAnalysisMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) {
|
|
|
|
public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) {
|
|
|
|
OutputStream ous = null;
|
|
|
|
OutputStream ous = null;
|
|
|
@ -1028,6 +1142,126 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void exportTransactionsByReportDate(String reportDate, JSONObject partner, HttpServletResponse resp) {
|
|
|
|
|
|
|
|
OutputStream ous = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
JSONObject clearTransation = listClearingTransactionsByMergeSettle(partner.getIntValue("client_id"), reportDate, partner);
|
|
|
|
|
|
|
|
resp.setContentType("application/octet-stream;");
|
|
|
|
|
|
|
|
resp.addHeader("Content-Disposition",
|
|
|
|
|
|
|
|
"attachment; filename=" + "Merchant_Settlement_Info_" + reportDate + ".xlsx");
|
|
|
|
|
|
|
|
ous = resp.getOutputStream();
|
|
|
|
|
|
|
|
Workbook wb = new XSSFWorkbook();
|
|
|
|
|
|
|
|
Cell cell = null;
|
|
|
|
|
|
|
|
Font font = wb.createFont();
|
|
|
|
|
|
|
|
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
|
|
|
|
|
|
|
font.setFontHeightInPoints((short) 10);
|
|
|
|
|
|
|
|
CellStyle analysisStyle = wb.createCellStyle();
|
|
|
|
|
|
|
|
analysisStyle.setFont(font);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//红色字体提示
|
|
|
|
|
|
|
|
Font font2 = wb.createFont();
|
|
|
|
|
|
|
|
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
|
|
|
|
|
|
|
font2.setFontHeightInPoints((short) 10);
|
|
|
|
|
|
|
|
font2.setColor(HSSFColor.RED.index);
|
|
|
|
|
|
|
|
CellStyle analysisStyle2 = wb.createCellStyle();
|
|
|
|
|
|
|
|
analysisStyle2.setFont(font2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + reportDate);
|
|
|
|
|
|
|
|
int rowNum = 0;
|
|
|
|
|
|
|
|
Row row = sheet.createRow(rowNum);
|
|
|
|
|
|
|
|
String[] title = {"order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency",
|
|
|
|
|
|
|
|
"Input Amount", "Total Amount", "Clearing Amount(AUD)", "Sruchange Rate", "Surcharge(AUD)", "GST(AUD)", "Settle Amount(AUD)", "Remark", "Dev No", "Dev Remark"};
|
|
|
|
|
|
|
|
String[] analysis = {"Total Credit(AUD)", "Total Debit(AUD)", "Gross Amount(AUD)", "Total GST(AUD)", "Total Charge(AUD)", "Net Amount(AUD)"};
|
|
|
|
|
|
|
|
for (int i = 0; i < title.length; i++) {
|
|
|
|
|
|
|
|
row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject channels = clearTransation.getJSONObject("channels");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Object o : clearTransation.getJSONArray("report")) {
|
|
|
|
|
|
|
|
JSONObject settle = (JSONObject) o;
|
|
|
|
|
|
|
|
if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
row = sheet.createRow(++rowNum);
|
|
|
|
|
|
|
|
row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_id"));
|
|
|
|
|
|
|
|
row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("client_order_id"));
|
|
|
|
|
|
|
|
Calendar calendar = (Calendar) settle.get("transaction_time");
|
|
|
|
|
|
|
|
row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(DateFormatUtils.format(calendar, "yyyy-MM-dd HH:mm:ss", calendar.getTimeZone()));
|
|
|
|
|
|
|
|
row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("channel"));
|
|
|
|
|
|
|
|
if (settle.getInteger("gateway") != null) {
|
|
|
|
|
|
|
|
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(TradeType.fromGatewayNumber(settle.getIntValue("gateway")).getTradeType());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue("-");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, BigDecimal.ROUND_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);
|
|
|
|
|
|
|
|
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 = 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 = 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);
|
|
|
|
|
|
|
|
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(channels.getString(settle.getString("channel")) == null ? ""
|
|
|
|
|
|
|
|
: channels.getJSONObject(settle.getString("channel")).getBigDecimal("rate").toPlainString() + "%");
|
|
|
|
|
|
|
|
//手续费 + gst
|
|
|
|
|
|
|
|
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("total_surcharge") == null ? ""
|
|
|
|
|
|
|
|
: settle.getBigDecimal("total_surcharge").setScale(2, RoundingMode.DOWN).toPlainString());
|
|
|
|
|
|
|
|
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("tax_amount") == null ? ""
|
|
|
|
|
|
|
|
: settle.getBigDecimal("tax_amount").setScale(2, RoundingMode.DOWN).toPlainString());
|
|
|
|
|
|
|
|
cell = row.createCell(14, 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);
|
|
|
|
|
|
|
|
row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail"));
|
|
|
|
|
|
|
|
String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-");
|
|
|
|
|
|
|
|
JSONObject device = clientDeviceMapper.find(settle.getString("dev_id"));
|
|
|
|
|
|
|
|
String clientDevRemark = "-";
|
|
|
|
|
|
|
|
if (device != null) {
|
|
|
|
|
|
|
|
clientDevId = device.getString("client_dev_id");
|
|
|
|
|
|
|
|
clientDevRemark = device.getString("remark");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
row.createCell(16, Cell.CELL_TYPE_STRING).setCellValue(clientDevId);
|
|
|
|
|
|
|
|
row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(clientDevRemark);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
row = sheet.createRow(++rowNum);
|
|
|
|
|
|
|
|
for (int i = 0; i < analysis.length; i++) {
|
|
|
|
|
|
|
|
cell = row.createCell(i, Cell.CELL_TYPE_STRING);
|
|
|
|
|
|
|
|
cell.setCellStyle(analysisStyle);
|
|
|
|
|
|
|
|
cell.setCellValue(analysis[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
row = sheet.createRow(++rowNum);
|
|
|
|
|
|
|
|
row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("total_payment"));
|
|
|
|
|
|
|
|
row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("total_refund"));
|
|
|
|
|
|
|
|
row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("gross_amount"));
|
|
|
|
|
|
|
|
row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("tax_amount"));
|
|
|
|
|
|
|
|
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("total_charge"));
|
|
|
|
|
|
|
|
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(clearTransation.getString("clearing_amount"));
|
|
|
|
|
|
|
|
wb.write(ous);
|
|
|
|
|
|
|
|
ous.flush();
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
IOUtils.closeQuietly(ous);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<JSONObject> getSettlementMonthReport(int year, int monthOfYear) {
|
|
|
|
public List<JSONObject> getSettlementMonthReport(int year, int monthOfYear) {
|
|
|
|
return clearingLogMapper.getSettlementMonthReport(year, monthOfYear);
|
|
|
|
return clearingLogMapper.getSettlementMonthReport(year, monthOfYear);
|
|
|
|