feat: expand terminal report export fields

This commit is contained in:
2026-05-12 23:31:25 +07:00
parent 582353e277
commit 280e748538
4 changed files with 876 additions and 561 deletions

View File

@ -55,15 +55,50 @@ public class ReportServiceBean implements ReportService {
private SimpleDateFormat shortDateFormat = new SimpleDateFormat("yyMMdd");
private SimpleDateFormat fullDateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
private static final String[] TERMINAL_REPORT_HEADERS = {
"sn", "imei", "terminal_id", "merchant_id", "merchant_name1", "merchant_name2", "merchant_name3",
"feature_sale", "feature_sale_tip", "feature_sale_redemption", "feature_card_verification",
"feature_sale_completion", "feature_installment", "feature_sale_fare_non_fare", "feature_manual_key_in",
"feature_qris", "feature_contactless", "random_pin_keypad", "beep_pin_keypad", "auto_logon",
"next_logon", "installment1_options", "installment2_options", "installment3_options", "state",
"app_version", "launcher_version", "vfs_version", "vfss_version", "ECR_version", "ROM_version",
"security_patch_version", "update_ts", "last_diagnostic_time", "last_heartbeat_time", "latitude",
"longitude", "sam_available", "wifi_name", "wifi_strength", "cell_name", "cell_type",
"cell_strength", "push_logon", "host_report", "host_logging",
"feature_sale_nfc", "feature_refund_nfc", "feature_sale_with_bripoin", "feature_release_card_ver",
"feature_void", "feature_settlement", "feature_reprint", "feature_report", "feature_qris_generate",
"feature_qris_pay", "feature_qris_refund", "feature_qris_report", "feature_brizzi_info",
"feature_brizzi_info_deposit", "feature_brizzi_update_deposit", "feature_brizzi_topup",
"feature_brizzi_topup_deposit", "feature_brizzi_sale", "feature_brizzi_settlement",
"feature_brizzi_void", "feature_brizzi_init", "feature_brizzi_card_info", "feature_brizzi_log",
"feature_brizzi_reprint", "feature_brizzi_report", "feature_re_eng_qris",
"feature_contactless_qris_tap", "firmware_version", "hardware_version", "android_os_version",
"device_model", "vf_service_version", "utms_version", "vf_service_app_version",
"vf_system_service_version", "bit_sdk_version", "fms_bri_version"
};
private static final String[] ACK_REPORT_HEADERS = {
"sn", "status", "last_init", "last_init_aid", "last_init_contactless_aid",
"last_init_capk", "last_init_terminal", "last_init_cards"
};
@Override
public ExportReportBean exportReport(ReportType reportType, ExportType exportType) throws Exception {
if(reportType == null) {
throw new IllegalArgumentException("Report type is required");
}
if(exportType == null) {
throw new IllegalArgumentException("Export type is required");
}
switch(reportType) {
case DIAGNOSTIC_REPORT:
return exportTerminalReport(exportType);
case ACK_REPORT:
return exportAckReport(exportType);
default:
throw new IllegalArgumentException("Unsupported report type: " + reportType);
}
return null;
}
/**
@ -74,225 +109,24 @@ public class ReportServiceBean implements ReportService {
*/
private ExportReportBean exportTerminalReport(ExportType type) throws Exception {
ExportReportBean report = new ExportReportBean();
try {
report.setFilename(dateFormat.format(new Date()) + "_terminal_report" + (type == ExportType.CSV ? ".csv" : ".xlsx"));
report.setFilename(dateFormat.format(new Date()) + "_terminal_report" + getReportExtension(type));
StringWriter sw = new StringWriter();
Workbook workbook = null;
Sheet sheet = null;
StringWriter sw = new StringWriter();
Workbook workbook = null;
Sheet sheet = null;
CellStyle detailStyle = null;
CellStyle dateStyle = null;
try {
if(type == ExportType.CSV) {
// headers
sw.append("sn,imei,terminal_id,merchant_id,merchant_name1,merchant_name2,merchant_name3,feature_sale,feature_sale_tip,feature_sale_redemption,feature_card_verification,feature_sale_completion,feature_installment,feature_sale_fare_non_fare,feature_manual_key_in,feature_qris,feature_contactless,random_pin_keypad,beep_pin_keypad,auto_logon,next_logon,installment1_options,installment2_options,installment3_options,state,app_version,launcher_version,vfs_version,vfss_version,ECR_version,ROM_version,security_patch_version,update_ts,last_diagnostic_time,last_heartbeat_time,latitude,longitude,sam_available,wifi_ssid,wifi_strength,cell_name,cell_type,cell_strength,push_logon,host_report,host_logging").append("\n");
writeCsvRow(sw, TERMINAL_REPORT_HEADERS);
} else if(type == ExportType.XLS) {
workbook = new XSSFWorkbook();
sheet = workbook.createSheet("Diagnostic Report");
Row header = sheet.createRow(0);
CellStyle headerStyle = workbook.createCellStyle();
XSSFFont font = ((XSSFWorkbook) workbook).createFont();
font.setFontName("Calibri");
font.setFontHeightInPoints((short) 11);
font.setBold(true);
headerStyle.setFont(font);
Cell headerCell = header.createCell(0);
headerCell.setCellValue("sn");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(1);
headerCell.setCellValue("imei");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(2);
headerCell.setCellValue("terminal_id");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(3);
headerCell.setCellValue("merchant_id");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(4);
headerCell.setCellValue("merchant_name1");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(5);
headerCell.setCellValue("merchant_name2");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(6);
headerCell.setCellValue("merchant_name3");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(7);
headerCell.setCellValue("feature_sale");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(8);
headerCell.setCellValue("feature_sale_tip");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(9);
headerCell.setCellValue("feature_sale_redemption");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(10);
headerCell.setCellValue("feature_card_verification");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(11);
headerCell.setCellValue("feature_sale_completion");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(12);
headerCell.setCellValue("feature_installment");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(13);
headerCell.setCellValue("feature_sale_fare_non_fare");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(14);
headerCell.setCellValue("feature_manual_key_in");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(15);
headerCell.setCellValue("feature_qris");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(16);
headerCell.setCellValue("feature_contactless");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(17);
headerCell.setCellValue("random_pin_keypad");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(18);
headerCell.setCellValue("beep_pin_keypad");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(19);
headerCell.setCellValue("auto_logon");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(20);
headerCell.setCellValue("next_logon");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(21);
headerCell.setCellValue("installment1_options");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(22);
headerCell.setCellValue("installment2_options");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(23);
headerCell.setCellValue("installment3_options");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(24);
headerCell.setCellValue("state");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(25);
headerCell.setCellValue("app_version");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(26);
headerCell.setCellValue("launcher_version");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(27);
headerCell.setCellValue("vfs_version");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(28);
headerCell.setCellValue("vfss_version");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(29);
headerCell.setCellValue("ECR_version");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(30);
headerCell.setCellValue("ROM_version");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(31);
headerCell.setCellValue("security_patch_version");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(32);
headerCell.setCellValue("update_ts");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(33);
headerCell.setCellValue("last_diagnostic_time");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(34);
headerCell.setCellValue("last_heartbeat_time");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(35);
headerCell.setCellValue("latitude");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(36);
headerCell.setCellValue("longitude");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(37);
headerCell.setCellValue("sam_available");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(38);
headerCell.setCellValue("wifi_name");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(39);
headerCell.setCellValue("wifi_strength");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(40);
headerCell.setCellValue("cell_name");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(41);
headerCell.setCellValue("cell_type");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(42);
headerCell.setCellValue("cell_strength");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(43);
headerCell.setCellValue("push_logon");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(44);
headerCell.setCellValue("host_report");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(45);
headerCell.setCellValue("host_logging");
headerCell.setCellStyle(headerStyle);
}
// reusable - detail style : that's why defined here
CellStyle detailStyle = null;
if(type == ExportType.XLS) {
// reusable - detail style : that's why defined here
detailStyle = workbook.createCellStyle();
CreationHelper createHelper = workbook.getCreationHelper();
detailStyle.setDataFormat(
createHelper.createDataFormat().getFormat("yyyy-mm-dd hh:mm:ss"));
XSSFFont font = ((XSSFWorkbook) workbook).createFont();
font.setFontName("Calibri");
font.setFontHeightInPoints((short) 11);
detailStyle.setFont(font);
writeHeader(sheet.createRow(0), createHeaderStyle(workbook), TERMINAL_REPORT_HEADERS);
detailStyle = createDetailStyle(workbook);
dateStyle = createDateStyle(workbook);
} else {
throw new IllegalArgumentException("Unsupported export type: " + type);
}
// query
@ -306,14 +140,23 @@ public class ReportServiceBean implements ReportService {
"feature_qris, feature_contactless, random_pin_keypad, beep_pin_keypad, auto_logon, next_logon, " +
"installment1_options, installment2_options, installment3_options, state, app_version, launcher_version, " +
"vfs_version, vfss_version," +
"null ecr_version,rom_version,sp_version," +
"ecr_version,rom_version,sp_version," +
"update_ts, last_diagnostic_time, last_heartbeat_time, " +
"latitude,longitude, " +
"wifi_name,wifi_strength, " +
"cell_name,cell_type,cell_strength, " +
"push_logon,host_report,host_logging, " +
"installed_apps_string, " +
"sam_available " +
"sam_available, " +
"feature_sale_nfc,feature_refund_nfc,feature_sale_with_bripoin,feature_release_card_ver, " +
"feature_void,feature_settlement,feature_reprint,feature_report,feature_qris_generate, " +
"feature_qris_pay,feature_qris_refund,feature_qris_report,feature_brizzi_info, " +
"feature_brizzi_info_deposit,feature_brizzi_update_deposit,feature_brizzi_topup, " +
"feature_brizzi_topup_deposit,feature_brizzi_sale,feature_brizzi_settlement, " +
"feature_brizzi_void,feature_brizzi_init,feature_brizzi_card_info,feature_brizzi_log, " +
"feature_brizzi_reprint,feature_brizzi_report,feature_re_eng_qris,feature_contactless_qris_tap, " +
"firmware_version,hardware_version,android_os_version,device_model,vf_service_version, " +
"utms_version,vf_service_app_version,vf_system_service_version,bit_sdk_version,fms_bri_version " +
"FROM public.tms_v_terminal_report");
List list = query.getResultList();
int rowNum = 0;
@ -368,6 +211,43 @@ public class ReportServiceBean implements ReportService {
Boolean hostLogging = (Boolean) row[44];
String installedAppString = (String) row[45];
Boolean samAvailable = (Boolean) row[46];
Boolean featureSaleNfc = (Boolean) row[47];
Boolean featureRefundNfc = (Boolean) row[48];
Boolean featureSaleWithBripoin = (Boolean) row[49];
Boolean featureReleaseCardVer = (Boolean) row[50];
Boolean featureVoid = (Boolean) row[51];
Boolean featureSettlement = (Boolean) row[52];
Boolean featureReprint = (Boolean) row[53];
Boolean featureReport = (Boolean) row[54];
Boolean featureQrisGenerate = (Boolean) row[55];
Boolean featureQrisPay = (Boolean) row[56];
Boolean featureQrisRefund = (Boolean) row[57];
Boolean featureQrisReport = (Boolean) row[58];
Boolean featureBrizziInfo = (Boolean) row[59];
Boolean featureBrizziInfoDeposit = (Boolean) row[60];
Boolean featureBrizziUpdateDeposit = (Boolean) row[61];
Boolean featureBrizziTopup = (Boolean) row[62];
Boolean featureBrizziTopupDeposit = (Boolean) row[63];
Boolean featureBrizziSale = (Boolean) row[64];
Boolean featureBrizziSettlement = (Boolean) row[65];
Boolean featureBrizziVoid = (Boolean) row[66];
Boolean featureBrizziInit = (Boolean) row[67];
Boolean featureBrizziCardInfo = (Boolean) row[68];
Boolean featureBrizziLog = (Boolean) row[69];
Boolean featureBrizziReprint = (Boolean) row[70];
Boolean featureBrizziReport = (Boolean) row[71];
Boolean featureReEngQris = (Boolean) row[72];
Boolean featureContactlessQristap = (Boolean) row[73];
String firmwareVersion = (String) row[74];
String hardwareVersion = (String) row[75];
String androidOsVersion = (String) row[76];
String deviceModel = (String) row[77];
String vfServiceVersion = (String) row[78];
String utmsVersion = (String) row[79];
String vfServiceAppVersion = (String) row[80];
String vfSystemServiceVersion = (String) row[81];
String bitSdkVersion = (String) row[82];
String fmsBriVersion = (String) row[83];
if(installedAppString != null) {
Map[] maps = gson.fromJson(installedAppString, Map[].class);
for(Map map : maps) {
@ -378,240 +258,31 @@ public class ReportServiceBean implements ReportService {
}
}
Object[] values = {
sn, imei, terminalId, merchantId, merchantName1, merchantName2, merchantName3,
featureSale, featureSaleTip, featureSaleRedemption, featureCardVerification,
featureSaleCompletion, featureInstallment, featureSaleFareNonFare, featureManualKeyIn,
featureQris, featureContactless, randomPinKeypad, beepPinKeypad, autoLogon,
nextLogon, installment1Options, installment2Options, installment3Options, state,
appVersion, launcherVersion, vsfVersion, vfssVersion, ecrVersion, romVersion,
securityPatchVersion, updateTs, lastDiagnosticTime, lastHeartbeatTime, latitude,
longitude, samAvailable, wifiName, wifiStrength, cellName, cellType, cellStrength,
pushLogon, hostReport, hostLogging,
featureSaleNfc, featureRefundNfc, featureSaleWithBripoin, featureReleaseCardVer,
featureVoid, featureSettlement, featureReprint, featureReport, featureQrisGenerate,
featureQrisPay, featureQrisRefund, featureQrisReport, featureBrizziInfo,
featureBrizziInfoDeposit, featureBrizziUpdateDeposit, featureBrizziTopup,
featureBrizziTopupDeposit, featureBrizziSale, featureBrizziSettlement,
featureBrizziVoid, featureBrizziInit, featureBrizziCardInfo, featureBrizziLog,
featureBrizziReprint, featureBrizziReport, featureReEngQris, featureContactlessQristap,
firmwareVersion, hardwareVersion, androidOsVersion, deviceModel, vfServiceVersion,
utmsVersion, vfServiceAppVersion, vfSystemServiceVersion, bitSdkVersion, fmsBriVersion
};
if (type == ExportType.CSV) {
sw.append(sn).append(",");
sw.append(imei).append(",");
sw.append(terminalId).append(",");
sw.append(merchantId).append(",");
sw.append(merchantName1).append(",");
sw.append(merchantName2).append(",");
sw.append(merchantName3).append(",");
sw.append(normalizeBoolean(featureSale)).append(",");
sw.append(normalizeBoolean(featureSaleTip)).append(",");
sw.append(normalizeBoolean(featureSaleRedemption)).append(",");
sw.append(normalizeBoolean(featureCardVerification)).append(",");
sw.append(normalizeBoolean(featureSaleCompletion)).append(",");
sw.append(normalizeBoolean(featureInstallment)).append(",");
sw.append(normalizeBoolean(featureSaleFareNonFare)).append(",");
sw.append(normalizeBoolean(featureManualKeyIn)).append(",");
sw.append(normalizeBoolean(featureQris)).append(",");
sw.append(normalizeBoolean(featureContactless)).append(",");
sw.append(normalizeBoolean(randomPinKeypad)).append(",");
sw.append(normalizeBoolean(beepPinKeypad)).append(",");
sw.append(normalizeBoolean(autoLogon)).append(",");
sw.append(normalizeInteger(nextLogon)).append(",");
sw.append(wrap(installment1Options)).append(",");
sw.append(wrap(installment2Options)).append(",");
sw.append(wrap(installment3Options)).append(",");
sw.append(state).append(",");
sw.append(appVersion).append(",");
sw.append(launcherVersion).append(",");
sw.append(vsfVersion).append(",");
sw.append(vfssVersion).append(",");
sw.append(ecrVersion).append(",");
sw.append(romVersion).append(",");
sw.append(securityPatchVersion).append(",");
sw.append(updateTs != null ? fullDateTimeFormat.format(updateTs) : null).append(",");
sw.append(lastDiagnosticTime != null ? fullDateTimeFormat.format(lastDiagnosticTime) : null).append(",");
sw.append(lastHeartbeatTime != null ? fullDateTimeFormat.format(lastHeartbeatTime) : null).append(",");
sw.append(normalizeDouble(latitude)).append(",");
sw.append(normalizeDouble(longitude)).append(",");
sw.append(normalizeBoolean(samAvailable)).append(",");
sw.append(wifiName).append(",");
sw.append(normalizeInteger(wifiStrength)).append(",");
sw.append(cellName).append(",");
sw.append(cellType).append(",");
sw.append(normalizeInteger(cellStrength)).append(",");
sw.append(normalizeInteger(pushLogon)).append(",");
sw.append(normalizeBoolean(hostReport)).append(",");
sw.append(normalizeBoolean(hostLogging));
sw.append("\n");
writeCsvRow(sw, values);
} else if(type == ExportType.XLS) {
Row detail = sheet.createRow(rowNum+1);
Cell detailCell = detail.createCell(0);
detailCell.setCellValue(sn);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(1);
detailCell.setCellValue(imei);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(2);
detailCell.setCellValue(terminalId);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(3);
detailCell.setCellValue(merchantId);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(4);
detailCell.setCellValue(merchantName1);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(5);
detailCell.setCellValue(merchantName2);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(6);
detailCell.setCellValue(merchantName3);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(7);
detailCell.setCellValue(normalizeBoolean(featureSale));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(8);
detailCell.setCellValue(normalizeBoolean(featureSaleTip));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(9);
detailCell.setCellValue(normalizeBoolean(featureSaleRedemption));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(10);
detailCell.setCellValue(normalizeBoolean(featureCardVerification));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(11);
detailCell.setCellValue(normalizeBoolean(featureSaleCompletion));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(12);
detailCell.setCellValue(normalizeBoolean(featureInstallment));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(13);
detailCell.setCellValue(normalizeBoolean(featureSaleFareNonFare));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(14);
detailCell.setCellValue(normalizeBoolean(featureManualKeyIn));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(15);
detailCell.setCellValue(normalizeBoolean(featureQris));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(16);
detailCell.setCellValue(normalizeBoolean(featureContactless));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(17);
detailCell.setCellValue(normalizeBoolean(randomPinKeypad));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(18);
detailCell.setCellValue(normalizeBoolean(beepPinKeypad));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(19);
detailCell.setCellValue(normalizeBoolean(autoLogon));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(20);
detailCell.setCellValue(normalizeInteger(nextLogon));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(21);
detailCell.setCellValue(installment1Options);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(22);
detailCell.setCellValue(installment2Options);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(23);
detailCell.setCellValue(installment3Options);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(24);
detailCell.setCellValue(state);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(25);
detailCell.setCellValue(appVersion);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(26);
detailCell.setCellValue(launcherVersion);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(27);
detailCell.setCellValue(vsfVersion);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(28);
detailCell.setCellValue(vfssVersion);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(29);
detailCell.setCellValue(ecrVersion);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(30);
detailCell.setCellValue(romVersion);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(31);
detailCell.setCellValue(securityPatchVersion);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(32);
detailCell.setCellValue(normalizeTimestamp(updateTs));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(33);
detailCell.setCellValue(normalizeTimestamp(lastDiagnosticTime));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(34);
detailCell.setCellValue(normalizeTimestamp(lastHeartbeatTime));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(35);
detailCell.setCellValue(normalizeDouble(latitude));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(36);
detailCell.setCellValue(normalizeDouble(longitude));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(37);
detailCell.setCellValue(normalizeBoolean(samAvailable));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(38);
detailCell.setCellValue(wifiName);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(39);
detailCell.setCellValue(normalizeInteger(wifiStrength));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(40);
detailCell.setCellValue(cellName);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(41);
detailCell.setCellValue(cellType);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(42);
detailCell.setCellValue(normalizeInteger(cellStrength));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(43);
detailCell.setCellValue(normalizeInteger(pushLogon));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(44);
detailCell.setCellValue(normalizeBoolean(hostReport));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(45);
detailCell.setCellValue(normalizeBoolean(hostLogging));
detailCell.setCellStyle(detailStyle);
writeExcelRow(sheet.createRow(rowNum + 1), detailStyle, dateStyle, values);
}
rowNum++;
@ -622,16 +293,17 @@ public class ReportServiceBean implements ReportService {
if(type == ExportType.CSV) {
report.setFileContent(sw.toString().getBytes());
sw.close();
} else if(type == ExportType.XLS) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
workbook.write(baos);
workbook.close();
report.setFileContent(baos.toByteArray());
}
} finally {
sw.close();
if(workbook != null) {
workbook.close();
}
}
return report;
}
@ -644,72 +316,24 @@ public class ReportServiceBean implements ReportService {
*/
private ExportReportBean exportAckReport(ExportType type) throws Exception {
ExportReportBean report = new ExportReportBean();
try {
report.setFilename(dateFormat.format(new Date()) + "_ack_report" + (type == ExportType.CSV ? ".csv" : ".xlsx"));
report.setFilename(dateFormat.format(new Date()) + "_ack_report" + getReportExtension(type));
StringWriter sw = new StringWriter();
Workbook workbook = null;
Sheet sheet = null;
StringWriter sw = new StringWriter();
Workbook workbook = null;
Sheet sheet = null;
CellStyle detailStyle = null;
CellStyle dateStyle = null;
try {
if(type == ExportType.CSV) {
// headers
sw.append("sn,status,last_init,last_init_aid,last_init_contactless_aid,last_init_capk,last_init_terminal,last_init_cards").append("\n");
writeCsvRow(sw, ACK_REPORT_HEADERS);
} else if(type == ExportType.XLS) {
workbook = new XSSFWorkbook();
sheet = workbook.createSheet("Ack Report");
Row header = sheet.createRow(0);
CellStyle headerStyle = workbook.createCellStyle();
XSSFFont font = ((XSSFWorkbook) workbook).createFont();
font.setFontName("Calibri");
font.setFontHeightInPoints((short) 11);
font.setBold(true);
headerStyle.setFont(font);
Cell headerCell = header.createCell(0);
headerCell.setCellValue("sn");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(1);
headerCell.setCellValue("status");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(2);
headerCell.setCellValue("last_init");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(3);
headerCell.setCellValue("last_init_aid");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(4);
headerCell.setCellValue("last_init_contactless_aid");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(5);
headerCell.setCellValue("last_init_capk");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(6);
headerCell.setCellValue("last_init_terminal");
headerCell.setCellStyle(headerStyle);
headerCell = header.createCell(7);
headerCell.setCellValue("last_init_cards");
headerCell.setCellStyle(headerStyle);
}
CellStyle detailStyle = null;
if(type == ExportType.XLS) {
// reusable - detail style : that's why defined here
detailStyle = workbook.createCellStyle();
CreationHelper createHelper = workbook.getCreationHelper();
detailStyle.setDataFormat(
createHelper.createDataFormat().getFormat("yyyy-mm-dd hh:mm:ss"));
XSSFFont font = ((XSSFWorkbook) workbook).createFont();
font.setFontName("Calibri");
font.setFontHeightInPoints((short) 11);
detailStyle.setFont(font);
writeHeader(sheet.createRow(0), createHeaderStyle(workbook), ACK_REPORT_HEADERS);
detailStyle = createDetailStyle(workbook);
dateStyle = createDateStyle(workbook);
} else {
throw new IllegalArgumentException("Unsupported export type: " + type);
}
// query
@ -733,50 +357,15 @@ public class ReportServiceBean implements ReportService {
Timestamp lastInitTerminal = (Timestamp) row[6];
Timestamp lastInitCards = (Timestamp) row[7];
Object[] values = {
sn, status, lastInitTs, lastInitAid, lastInitContactlessAid,
lastInitCapk, lastInitTerminal, lastInitCards
};
if (type == ExportType.CSV) {
sw.append(sn).append(",");
sw.append(status).append(",");
sw.append(lastInitTs != null ? fullDateTimeFormat.format(lastInitTs) : null).append(",");
sw.append(lastInitAid != null ? fullDateTimeFormat.format(lastInitAid) : null).append(",");
sw.append(lastInitContactlessAid != null ? fullDateTimeFormat.format(lastInitContactlessAid) : null).append(",");
sw.append(lastInitCapk != null ? fullDateTimeFormat.format(lastInitCapk) : null).append(",");
sw.append(lastInitTerminal != null ? fullDateTimeFormat.format(lastInitTerminal) : null).append(",");
sw.append(lastInitCards != null ? fullDateTimeFormat.format(lastInitCards) : null).append(",");
sw.append("\n");
writeCsvRow(sw, values);
} else if(type == ExportType.XLS) {
Row detail = sheet.createRow(rowNum+1);
Cell detailCell = detail.createCell(0);
detailCell.setCellValue(sn);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(1);
detailCell.setCellValue(status);
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(2);
detailCell.setCellValue(normalizeTimestamp(lastInitTs));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(3);
detailCell.setCellValue(normalizeTimestamp(lastInitAid));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(4);
detailCell.setCellValue(normalizeTimestamp(lastInitContactlessAid));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(5);
detailCell.setCellValue(normalizeTimestamp(lastInitCapk));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(6);
detailCell.setCellValue(normalizeTimestamp(lastInitTerminal));
detailCell.setCellStyle(detailStyle);
detailCell = detail.createCell(7);
detailCell.setCellValue(normalizeTimestamp(lastInitCards));
detailCell.setCellStyle(detailStyle);
writeExcelRow(sheet.createRow(rowNum + 1), detailStyle, dateStyle, values);
}
rowNum++;
@ -787,16 +376,17 @@ public class ReportServiceBean implements ReportService {
if(type == ExportType.CSV) {
report.setFileContent(sw.toString().getBytes());
sw.close();
} else if(type == ExportType.XLS) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
workbook.write(baos);
workbook.close();
report.setFileContent(baos.toByteArray());
}
} finally {
sw.close();
if(workbook != null) {
workbook.close();
}
}
return report;
}
@ -1619,6 +1209,110 @@ public class ReportServiceBean implements ReportService {
return report;
}
private String getReportExtension(ExportType type) {
if(type == ExportType.CSV) {
return ".csv";
}
if(type == ExportType.XLS) {
return ".xlsx";
}
throw new IllegalArgumentException("Unsupported export type: " + type);
}
private CellStyle createHeaderStyle(Workbook workbook) {
CellStyle headerStyle = workbook.createCellStyle();
Font font = workbook.createFont();
font.setFontName("Calibri");
font.setFontHeightInPoints((short) 11);
font.setBold(true);
headerStyle.setFont(font);
return headerStyle;
}
private CellStyle createDetailStyle(Workbook workbook) {
CellStyle detailStyle = workbook.createCellStyle();
Font font = workbook.createFont();
font.setFontName("Calibri");
font.setFontHeightInPoints((short) 11);
detailStyle.setFont(font);
return detailStyle;
}
private CellStyle createDateStyle(Workbook workbook) {
CellStyle dateStyle = createDetailStyle(workbook);
CreationHelper createHelper = workbook.getCreationHelper();
dateStyle.setDataFormat(createHelper.createDataFormat().getFormat("yyyy-mm-dd hh:mm:ss"));
return dateStyle;
}
private void writeHeader(Row row, CellStyle headerStyle, String[] headers) {
for(int i = 0; i < headers.length; i++) {
Cell cell = row.createCell(i);
cell.setCellValue(headers[i]);
cell.setCellStyle(headerStyle);
}
}
private void writeCsvRow(StringWriter writer, Object[] values) {
for(int i = 0; i < values.length; i++) {
if(i > 0) {
writer.append(",");
}
writer.append(toCsvValue(values[i]));
}
writer.append("\n");
}
private String toCsvValue(Object value) {
if(value == null) {
return "";
}
String text;
if(value instanceof Timestamp) {
text = fullDateTimeFormat.format((Timestamp) value);
} else if(value instanceof Date) {
text = fullDateTimeFormat.format((Date) value);
} else {
text = String.valueOf(value);
}
if(text.contains(",") || text.contains("\"") || text.contains("\n") || text.contains("\r")) {
return "\"" + text.replace("\"", "\"\"") + "\"";
}
return text;
}
private void writeExcelRow(Row row, CellStyle detailStyle, CellStyle dateStyle, Object[] values) {
for(int i = 0; i < values.length; i++) {
writeExcelCell(row.createCell(i), detailStyle, dateStyle, values[i]);
}
}
private void writeExcelCell(Cell cell, CellStyle detailStyle, CellStyle dateStyle, Object value) {
if(value == null) {
cell.setCellStyle(detailStyle);
return;
}
if(value instanceof Timestamp) {
cell.setCellValue(normalizeTimestamp((Timestamp) value));
cell.setCellStyle(dateStyle);
} else if(value instanceof Date) {
cell.setCellValue((Date) value);
cell.setCellStyle(dateStyle);
} else if(value instanceof Boolean) {
cell.setCellValue((Boolean) value);
cell.setCellStyle(detailStyle);
} else if(value instanceof Number) {
cell.setCellValue(((Number) value).doubleValue());
cell.setCellStyle(detailStyle);
} else {
cell.setCellValue(String.valueOf(value));
cell.setCellStyle(detailStyle);
}
}
private String normalizeBoolean(Boolean bool) {
return bool == null ? "" : String.valueOf(bool.booleanValue());
}

View File

@ -134,9 +134,138 @@ public class TerminalReport extends BaseStringIdEntity {
@Column(name = "host_logging")
protected Boolean hostLogging;
@Column(name = "apps")
@Column(name = "installed_apps_string")
protected String apps;
@Column(name = "feature_sale_nfc")
protected Boolean featureSaleNfc;
@Column(name = "feature_refund_nfc")
protected Boolean featureRefundNfc;
@Column(name = "feature_sale_with_bripoin")
protected Boolean featureSaleWithBripoin;
@Column(name = "feature_release_card_ver")
protected Boolean featureReleaseCardVer;
@Column(name = "feature_void")
protected Boolean featureVoid;
@Column(name = "feature_settlement")
protected Boolean featureSettlement;
@Column(name = "feature_reprint")
protected Boolean featureReprint;
@Column(name = "feature_report")
protected Boolean featureReport;
@Column(name = "feature_qris_generate")
protected Boolean featureQrisGenerate;
@Column(name = "feature_qris_pay")
protected Boolean featureQrisPay;
@Column(name = "feature_qris_refund")
protected Boolean featureQrisRefund;
@Column(name = "feature_qris_report")
protected Boolean featureQrisReport;
@Column(name = "feature_brizzi_info")
protected Boolean featureBrizziInfo;
@Column(name = "feature_brizzi_info_deposit")
protected Boolean featureBrizziInfoDeposit;
@Column(name = "feature_brizzi_update_deposit")
protected Boolean featureBrizziUpdateDeposit;
@Column(name = "feature_brizzi_topup")
protected Boolean featureBrizziTopup;
@Column(name = "feature_brizzi_topup_deposit")
protected Boolean featureBrizziTopupDeposit;
@Column(name = "feature_brizzi_sale")
protected Boolean featureBrizziSale;
@Column(name = "feature_brizzi_settlement")
protected Boolean featureBrizziSettlement;
@Column(name = "feature_brizzi_void")
protected Boolean featureBrizziVoid;
@Column(name = "feature_brizzi_init")
protected Boolean featureBrizziInit;
@Column(name = "feature_brizzi_card_info")
protected Boolean featureBrizziCardInfo;
@Column(name = "feature_brizzi_log")
protected Boolean featureBrizziLog;
@Column(name = "feature_brizzi_reprint")
protected Boolean featureBrizziReprint;
@Column(name = "feature_brizzi_report")
protected Boolean featureBrizziReport;
@Column(name = "feature_re_eng_qris")
protected Boolean featureReEngQris;
@Column(name = "feature_contactless_qris_tap")
protected Boolean featureContactlessQristap;
@Column(name = "ecr_version")
protected String ecrVersion;
@Column(name = "rom_version")
protected String romVersion;
@Column(name = "sp_version")
protected String spVersion;
@Column(name = "firmware_version")
protected String firmwareVersion;
@Column(name = "hardware_version")
protected String hardwareVersion;
@Column(name = "android_os_version")
protected String androidOsVersion;
@Column(name = "device_model")
protected String deviceModel;
@Column(name = "vf_service_version")
protected String vfServiceVersion;
@Column(name = "utms_version")
protected String utmsVersion;
@Column(name = "vf_service_app_version")
protected String vfServiceAppVersion;
@Column(name = "vf_system_service_version")
protected String vfSystemServiceVersion;
@Column(name = "bit_sdk_version")
protected String bitSdkVersion;
@Column(name = "fms_bri_version")
protected String fmsBriVersion;
@Column(name = "update_ts")
protected Date updateTs;
@Column(name = "latitude")
protected Double latitude;
@Column(name = "longitude")
protected Double longitude;
public String getVfssVersion() {
return vfssVersion;
}
@ -474,4 +603,348 @@ public class TerminalReport extends BaseStringIdEntity {
public void setSamAvailable(Boolean samAvailable) {
this.samAvailable = samAvailable;
}
public Boolean getFeatureSaleNfc() {
return featureSaleNfc;
}
public void setFeatureSaleNfc(Boolean featureSaleNfc) {
this.featureSaleNfc = featureSaleNfc;
}
public Boolean getFeatureRefundNfc() {
return featureRefundNfc;
}
public void setFeatureRefundNfc(Boolean featureRefundNfc) {
this.featureRefundNfc = featureRefundNfc;
}
public Boolean getFeatureSaleWithBripoin() {
return featureSaleWithBripoin;
}
public void setFeatureSaleWithBripoin(Boolean featureSaleWithBripoin) {
this.featureSaleWithBripoin = featureSaleWithBripoin;
}
public Boolean getFeatureReleaseCardVer() {
return featureReleaseCardVer;
}
public void setFeatureReleaseCardVer(Boolean featureReleaseCardVer) {
this.featureReleaseCardVer = featureReleaseCardVer;
}
public Boolean getFeatureVoid() {
return featureVoid;
}
public void setFeatureVoid(Boolean featureVoid) {
this.featureVoid = featureVoid;
}
public Boolean getFeatureSettlement() {
return featureSettlement;
}
public void setFeatureSettlement(Boolean featureSettlement) {
this.featureSettlement = featureSettlement;
}
public Boolean getFeatureReprint() {
return featureReprint;
}
public void setFeatureReprint(Boolean featureReprint) {
this.featureReprint = featureReprint;
}
public Boolean getFeatureReport() {
return featureReport;
}
public void setFeatureReport(Boolean featureReport) {
this.featureReport = featureReport;
}
public Boolean getFeatureQrisGenerate() {
return featureQrisGenerate;
}
public void setFeatureQrisGenerate(Boolean featureQrisGenerate) {
this.featureQrisGenerate = featureQrisGenerate;
}
public Boolean getFeatureQrisPay() {
return featureQrisPay;
}
public void setFeatureQrisPay(Boolean featureQrisPay) {
this.featureQrisPay = featureQrisPay;
}
public Boolean getFeatureQrisRefund() {
return featureQrisRefund;
}
public void setFeatureQrisRefund(Boolean featureQrisRefund) {
this.featureQrisRefund = featureQrisRefund;
}
public Boolean getFeatureQrisReport() {
return featureQrisReport;
}
public void setFeatureQrisReport(Boolean featureQrisReport) {
this.featureQrisReport = featureQrisReport;
}
public Boolean getFeatureBrizziInfo() {
return featureBrizziInfo;
}
public void setFeatureBrizziInfo(Boolean featureBrizziInfo) {
this.featureBrizziInfo = featureBrizziInfo;
}
public Boolean getFeatureBrizziInfoDeposit() {
return featureBrizziInfoDeposit;
}
public void setFeatureBrizziInfoDeposit(Boolean featureBrizziInfoDeposit) {
this.featureBrizziInfoDeposit = featureBrizziInfoDeposit;
}
public Boolean getFeatureBrizziUpdateDeposit() {
return featureBrizziUpdateDeposit;
}
public void setFeatureBrizziUpdateDeposit(Boolean featureBrizziUpdateDeposit) {
this.featureBrizziUpdateDeposit = featureBrizziUpdateDeposit;
}
public Boolean getFeatureBrizziTopup() {
return featureBrizziTopup;
}
public void setFeatureBrizziTopup(Boolean featureBrizziTopup) {
this.featureBrizziTopup = featureBrizziTopup;
}
public Boolean getFeatureBrizziTopupDeposit() {
return featureBrizziTopupDeposit;
}
public void setFeatureBrizziTopupDeposit(Boolean featureBrizziTopupDeposit) {
this.featureBrizziTopupDeposit = featureBrizziTopupDeposit;
}
public Boolean getFeatureBrizziSale() {
return featureBrizziSale;
}
public void setFeatureBrizziSale(Boolean featureBrizziSale) {
this.featureBrizziSale = featureBrizziSale;
}
public Boolean getFeatureBrizziSettlement() {
return featureBrizziSettlement;
}
public void setFeatureBrizziSettlement(Boolean featureBrizziSettlement) {
this.featureBrizziSettlement = featureBrizziSettlement;
}
public Boolean getFeatureBrizziVoid() {
return featureBrizziVoid;
}
public void setFeatureBrizziVoid(Boolean featureBrizziVoid) {
this.featureBrizziVoid = featureBrizziVoid;
}
public Boolean getFeatureBrizziInit() {
return featureBrizziInit;
}
public void setFeatureBrizziInit(Boolean featureBrizziInit) {
this.featureBrizziInit = featureBrizziInit;
}
public Boolean getFeatureBrizziCardInfo() {
return featureBrizziCardInfo;
}
public void setFeatureBrizziCardInfo(Boolean featureBrizziCardInfo) {
this.featureBrizziCardInfo = featureBrizziCardInfo;
}
public Boolean getFeatureBrizziLog() {
return featureBrizziLog;
}
public void setFeatureBrizziLog(Boolean featureBrizziLog) {
this.featureBrizziLog = featureBrizziLog;
}
public Boolean getFeatureBrizziReprint() {
return featureBrizziReprint;
}
public void setFeatureBrizziReprint(Boolean featureBrizziReprint) {
this.featureBrizziReprint = featureBrizziReprint;
}
public Boolean getFeatureBrizziReport() {
return featureBrizziReport;
}
public void setFeatureBrizziReport(Boolean featureBrizziReport) {
this.featureBrizziReport = featureBrizziReport;
}
public Boolean getFeatureReEngQris() {
return featureReEngQris;
}
public void setFeatureReEngQris(Boolean featureReEngQris) {
this.featureReEngQris = featureReEngQris;
}
public Boolean getFeatureContactlessQristap() {
return featureContactlessQristap;
}
public void setFeatureContactlessQristap(Boolean featureContactlessQristap) {
this.featureContactlessQristap = featureContactlessQristap;
}
public String getEcrVersion() {
return ecrVersion;
}
public void setEcrVersion(String ecrVersion) {
this.ecrVersion = ecrVersion;
}
public String getRomVersion() {
return romVersion;
}
public void setRomVersion(String romVersion) {
this.romVersion = romVersion;
}
public String getSpVersion() {
return spVersion;
}
public void setSpVersion(String spVersion) {
this.spVersion = spVersion;
}
public String getFirmwareVersion() {
return firmwareVersion;
}
public void setFirmwareVersion(String firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
public String getHardwareVersion() {
return hardwareVersion;
}
public void setHardwareVersion(String hardwareVersion) {
this.hardwareVersion = hardwareVersion;
}
public String getAndroidOsVersion() {
return androidOsVersion;
}
public void setAndroidOsVersion(String androidOsVersion) {
this.androidOsVersion = androidOsVersion;
}
public String getDeviceModel() {
return deviceModel;
}
public void setDeviceModel(String deviceModel) {
this.deviceModel = deviceModel;
}
public String getVfServiceVersion() {
return vfServiceVersion;
}
public void setVfServiceVersion(String vfServiceVersion) {
this.vfServiceVersion = vfServiceVersion;
}
public String getUtmsVersion() {
return utmsVersion;
}
public void setUtmsVersion(String utmsVersion) {
this.utmsVersion = utmsVersion;
}
public String getVfServiceAppVersion() {
return vfServiceAppVersion;
}
public void setVfServiceAppVersion(String vfServiceAppVersion) {
this.vfServiceAppVersion = vfServiceAppVersion;
}
public String getVfSystemServiceVersion() {
return vfSystemServiceVersion;
}
public void setVfSystemServiceVersion(String vfSystemServiceVersion) {
this.vfSystemServiceVersion = vfSystemServiceVersion;
}
public String getBitSdkVersion() {
return bitSdkVersion;
}
public void setBitSdkVersion(String bitSdkVersion) {
this.bitSdkVersion = bitSdkVersion;
}
public String getFmsBriVersion() {
return fmsBriVersion;
}
public void setFmsBriVersion(String fmsBriVersion) {
this.fmsBriVersion = fmsBriVersion;
}
public Date getUpdateTs() {
return updateTs;
}
public void setUpdateTs(Date updateTs) {
this.updateTs = updateTs;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
}

View File

@ -269,6 +269,48 @@ TerminalReport.cellStrength=Cell Strength
TerminalReport.wifiName=Wifi SSID
TerminalReport.wifiStrength=Wifi Strength
TerminalReport.samAvailable=SAM Available
TerminalReport.featureSaleNfc=Sale NFC
TerminalReport.featureRefundNfc=Refund NFC
TerminalReport.featureSaleWithBripoin=Sale with BRIPoin
TerminalReport.featureReleaseCardVer=Release CardVer
TerminalReport.featureVoid=Void
TerminalReport.featureSettlement=Settlement
TerminalReport.featureReprint=Reprint
TerminalReport.featureReport=Report
TerminalReport.featureQrisGenerate=QRIS Generate
TerminalReport.featureQrisPay=QRIS Pay
TerminalReport.featureQrisRefund=QRIS Refund
TerminalReport.featureQrisReport=QRIS Report
TerminalReport.featureBrizziInfo=Brizzi Info
TerminalReport.featureBrizziInfoDeposit=Brizzi Info Deposit
TerminalReport.featureBrizziUpdateDeposit=Brizzi Update Deposit
TerminalReport.featureBrizziTopup=Brizzi Topup
TerminalReport.featureBrizziTopupDeposit=Brizzi Topup Deposit
TerminalReport.featureBrizziSale=Brizzi Sale
TerminalReport.featureBrizziSettlement=Brizzi Settlement
TerminalReport.featureBrizziVoid=Brizzi Void
TerminalReport.featureBrizziInit=Brizzi Init
TerminalReport.featureBrizziCardInfo=Brizzi Card Info
TerminalReport.featureBrizziLog=Brizzi Log
TerminalReport.featureBrizziReprint=Brizzi Reprint
TerminalReport.featureBrizziReport=Brizzi Report
TerminalReport.featureReEngQris=Rest API/ISO QRIS
TerminalReport.featureContactlessQristap=QRIS TAP Contactless
TerminalReport.ecrVersion=ECR Version
TerminalReport.romVersion=ROM Version
TerminalReport.spVersion=Security Patch Version
TerminalReport.firmwareVersion=Firmware Version
TerminalReport.hardwareVersion=Hardware Version
TerminalReport.androidOsVersion=Android OS Version
TerminalReport.deviceModel=Device Model
TerminalReport.vfServiceVersion=VF Service Version
TerminalReport.utmsVersion=UTMS Version
TerminalReport.vfServiceAppVersion=VF Service App Version
TerminalReport.vfSystemServiceVersion=VF System Service Version
TerminalReport.bitSdkVersion=BIT SDK Version
TerminalReport.fmsBriVersion=FMS BRI Version
TerminalReport.latitude=Latitude
TerminalReport.longitude=Longitude
TerminalGroupImport=Terminal group import
TerminalGroupImport.sn=Sn
TerminalGroupImport.tid=Tid

View File

@ -0,0 +1,106 @@
CREATE OR REPLACE VIEW public.tms_v_terminal_report
AS SELECT tt.sn,
tt.imei,
tte.terminal_id,
tte.merchant_id,
tte.merchant_name1,
tte.merchant_name2,
tte.merchant_name3,
tte.feature_sale,
tte.feature_sale_tip,
tte.feature_sale_redemption,
tte.feature_card_verification,
tte.feature_sale_completion,
tte.feature_installment,
tte.feature_sale_fare_non_fare,
tte.feature_manual_key_in,
tte.feature_qris,
tte.feature_contactless,
tte.random_pin_keypad,
tte.beep_pin_keypad,
tte.auto_logon,
tte.next_logon,
tte.installment1_options,
tte.installment2_options,
tte.installment3_options,
CASE
WHEN tt.heartbeat_status = 3 THEN 'DISCONNECTED'::text
WHEN tt.heartbeat_status = 2 THEN 'OFFLINE'::text
WHEN tt.heartbeat_status = 1 THEN 'ONLINE'::text
ELSE 'DISCONNECTED'::text
END AS state,
tt.app_version,
tt.launcher_version,
tt.vfs_version,
tt.vfss_version,
tt.update_ts,
tt.last_diagnostic_time,
tt.last_heartbeat_time,
tt.latitude,
tt.longitude,
tt.cell_name,
tt.cell_type,
tt.cell_strength,
tt.wifi_name,
tt.wifi_strength,
tte.push_logon,
tte.host_report,
tte.host_logging,
diag.device_info_ext::json ->> 'romVer'::text AS rom_version,
diag.device_info_ext::json ->> 'SPVer'::text AS sp_version,
diag.installed_apps_string,
diag.sam_available,
tte.feature_sale_nfc,
tte.feature_refund_nfc,
tte.feature_sale_with_bripoin,
tte.feature_release_card_ver,
tte.feature_void,
tte.feature_settlement,
tte.feature_reprint,
tte.feature_report,
tte.feature_qris_generate,
tte.feature_qris_pay,
tte.feature_qris_refund,
tte.feature_qris_report,
tte.feature_brizzi_info,
tte.feature_brizzi_info_deposit,
tte.feature_brizzi_update_deposit,
tte.feature_brizzi_topup,
tte.feature_brizzi_topup_deposit,
tte.feature_brizzi_sale,
tte.feature_brizzi_settlement,
tte.feature_brizzi_void,
tte.feature_brizzi_init,
tte.feature_brizzi_card_info,
tte.feature_brizzi_log,
tte.feature_brizzi_reprint,
tte.feature_brizzi_report,
tte.feature_re_eng_qris,
tte.feature_contactless_qris_tap,
diag.device_info_ext::json ->> 'firmwareVer'::text AS firmware_version,
diag.device_info_ext::json ->> 'hardwareVer'::text AS hardware_version,
diag.device_info_ext::json ->> 'androidOsVer'::text AS android_os_version,
diag.device_info_ext::json ->> 'deviceModel'::text AS device_model,
diag.device_info_ext::json ->> 'VFSerivceVer'::text AS vf_service_version,
app_versions.ecr_version,
app_versions.utms_version,
app_versions.vf_service_app_version,
app_versions.vf_system_service_version,
app_versions.bit_sdk_version,
app_versions.fms_bri_version
FROM tms_terminal tt
JOIN tms_merchant tm ON tm.id = tt.merchant_id
JOIN tms_device_profile tdp ON tdp.id = tt.profile_id
JOIN tms_terminal_link ttl ON ttl.terminal_id = tt.id
JOIN tmsext_terminal_ext tte ON ttl.terminal_ext_id = tte.id AND tte.delete_ts IS NULL
LEFT JOIN tms_diagnostic_info diag ON tt.last_diagnostic_id = diag.id AND diag.create_ts <= now()
LEFT JOIN LATERAL (
SELECT max(app_item ->> 'version'::text) FILTER (WHERE app_item ->> 'package_name'::text = 'com.vfi.id.ecr') AS ecr_version,
max(app_item ->> 'version'::text) FILTER (WHERE app_item ->> 'package_name'::text = 'com.unified.launcher') AS utms_version,
max(app_item ->> 'version'::text) FILTER (WHERE app_item ->> 'package_name'::text = 'com.vfi.smartpos.deviceservice') AS vf_service_app_version,
max(app_item ->> 'version'::text) FILTER (WHERE app_item ->> 'package_name'::text = 'com.vfi.smartpos.system_service') AS vf_system_service_version,
max(app_item ->> 'version'::text) FILTER (WHERE app_item ->> 'package_name'::text = 'id.bitcorp.middlewareservice') AS bit_sdk_version,
max(app_item ->> 'version'::text) FILTER (WHERE app_item ->> 'package_name'::text = 'com.briit.brimobile') AS fms_bri_version
FROM json_array_elements(COALESCE(NULLIF(diag.installed_apps_string, ''), '[]')::json) app_item
) app_versions ON true
WHERE tt.delete_ts IS NULL;