Upd:商户端清算文件,交易流水清算文件,变更显示数据类型样式

master
duLingLing 5 years ago
parent 053b916ea7
commit 57783d16d2

@ -49,6 +49,7 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.joda.time.DateTime;
@ -823,6 +824,15 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
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_" + DateFormatUtils.format(reportDate, "yyyyMMdd"));
int rowNum = 0;
Row row = sheet.createRow(rowNum);
@ -853,18 +863,36 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
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());
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("transaction_type"));
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"));
row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
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() + "%");
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).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);
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail"));
device = clientDeviceMapper.find(settle.getString("dev_id"));
if (device != null)

@ -848,6 +848,20 @@ public class TradeLogServiceImpl implements TradeLogService {
font2.setBoldweight(Font.BOLDWEIGHT_NORMAL);
// 把字体应用到当前的样式
style2.setFont(font2);
HSSFCellStyle style3 = workbook.createCellStyle();
style3.setFillForegroundColor(HSSFColor.WHITE.index);
style3.setFillPattern(CellStyle.SOLID_FOREGROUND);
style3.setBorderBottom(CellStyle.BORDER_THIN);
style3.setBorderLeft(CellStyle.BORDER_THIN);
style3.setBorderRight(CellStyle.BORDER_THIN);
style3.setBorderTop(CellStyle.BORDER_THIN);
style3.setAlignment(CellStyle.ALIGN_CENTER);
HSSFFont font3 = workbook.createFont();
font3.setFontHeightInPoints((short) 12);
font3.setBoldweight(Font.BOLDWEIGHT_NORMAL);
font3.setColor(HSSFColor.RED.index);
style3.setFont(font3);
HSSFRow row0 = sheet.createRow(0);
HSSFCell cell00 = row0.createCell(0);
HSSFCell cell01 = row0.createCell(1);
@ -879,7 +893,6 @@ public class TradeLogServiceImpl implements TradeLogService {
cell0.setCellStyle(style2);
cell1.setCellStyle(style2);
cell2.setCellStyle(style2);
cell3.setCellStyle(style2);
cell4.setCellStyle(style2);
JSONObject dataItem = dataList.get(i);
HSSFRichTextString text0 = new HSSFRichTextString(dataItem.getString("transaction_time"));
@ -894,6 +907,11 @@ public class TradeLogServiceImpl implements TradeLogService {
cell0.setCellValue(text0);
cell1.setCellValue(text1);
cell2.setCellValue(text2);
if(dataItem.getString("transaction_type").equals("Debit") ){
cell2.setCellStyle(style3);
}else{
cell2.setCellStyle(style2);
}
cell3.setCellValue(text3);
cell4.setCellValue(text4);
}
@ -1414,6 +1432,13 @@ public class TradeLogServiceImpl implements TradeLogService {
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_" + begin + "_" + end);
int rowNum = 0;
Row row = sheet.createRow(rowNum);
@ -1441,17 +1466,35 @@ public class TradeLogServiceImpl implements TradeLogService {
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue("-");
}
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN).toPlainString());
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("transaction_type"));
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"));
row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: settle.getBigDecimal("display_amount").setScale(2, RoundingMode.DOWN).toPlainString());
row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: settle.getBigDecimal("transaction_amount").setScale(2, RoundingMode.DOWN).toPlainString());
row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: settle.getBigDecimal("clearing_amount").setScale(2, RoundingMode.DOWN).toPlainString());
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(settle.getBigDecimal("rate") == null ? "" : settle.getBigDecimal("rate").toPlainString() + "%");
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: settle.getBigDecimal("settle_amount").setScale(2, RoundingMode.DOWN).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);
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 ? ""

Loading…
Cancel
Save