|
|
@ -609,6 +609,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
// File jasperFile = trans_flow.getFile();
|
|
|
|
// File jasperFile = trans_flow.getFile();
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(Integer.parseInt(query.getClient_ids()[0]));
|
|
|
|
if (!transFlow.getJSONArray("data").isEmpty()) {
|
|
|
|
if (!transFlow.getJSONArray("data").isEmpty()) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<JSONObject> dataList = (List<JSONObject>) transFlow.get("data");
|
|
|
|
List<JSONObject> dataList = (List<JSONObject>) transFlow.get("data");
|
|
|
@ -621,9 +622,9 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
|
|
|
|
: DateFormatUtils.format(new Date(), "dd/MM/yyyy"));
|
|
|
|
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + "~"
|
|
|
|
parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + "~"
|
|
|
|
+ parmerters.getString("dateTo"));
|
|
|
|
+ parmerters.getString("dateTo"));
|
|
|
|
parmerters.put("partnerCode", partner.getString("client_moniker"));
|
|
|
|
parmerters.put("partnerCode", client.getString("client_moniker"));
|
|
|
|
parmerters.put("clientName", partner.getJSONObject("client").getString("company_name"));
|
|
|
|
parmerters.put("clientName", client.getString("company_name"));
|
|
|
|
parmerters.put("clientAddress", partner.getJSONObject("client").getString("address"));
|
|
|
|
parmerters.put("clientAddress", client.getString("address"));
|
|
|
|
parmerters.put("balance", analysis.getDoubleValue("balance"));
|
|
|
|
parmerters.put("balance", analysis.getDoubleValue("balance"));
|
|
|
|
parmerters.put("logo", logo.getInputStream());
|
|
|
|
parmerters.put("logo", logo.getInputStream());
|
|
|
|
parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO));
|
|
|
|
parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO));
|
|
|
@ -645,7 +646,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList);
|
|
|
|
JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList);
|
|
|
|
response.setContentType("application/pdf");
|
|
|
|
response.setContentType("application/pdf");
|
|
|
|
String fileName = partner.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", "");
|
|
|
|
String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", "");
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
|
|
|
|
OutputStream outs = response.getOutputStream();
|
|
|
|
OutputStream outs = response.getOutputStream();
|
|
|
|
byte[] bytes = JasperRunManager.runReportToPdf(trans_flow.getInputStream(), parmerters, jrDataSource);
|
|
|
|
byte[] bytes = JasperRunManager.runReportToPdf(trans_flow.getInputStream(), parmerters, jrDataSource);
|
|
|
@ -676,6 +677,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
public void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
logger.debug("excel The method======= exportExcel() start.......................");
|
|
|
|
logger.debug("excel The method======= exportExcel() start.......................");
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(Integer.parseInt(query.getClient_ids()[0]));
|
|
|
|
// JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
// JSONObject analysis = transFlow.getJSONObject("analysis");
|
|
|
|
if (transFlow.getJSONArray("data").size() > 0) {
|
|
|
|
if (transFlow.getJSONArray("data").size() > 0) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -701,7 +703,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) ? query.getDatefrom() : "");
|
|
|
|
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) ? query.getDatefrom() : "");
|
|
|
|
parmerters.put("dateTo", StringUtils.isNotBlank(query.getDateto()) ? query.getDateto() : DateFormatUtils.format(new Date(), "yyyyMMdd"));
|
|
|
|
parmerters.put("dateTo", StringUtils.isNotBlank(query.getDateto()) ? query.getDateto() : DateFormatUtils.format(new Date(), "yyyyMMdd"));
|
|
|
|
parmerters.put("partnerCode", partner.getString("client_moniker"));
|
|
|
|
parmerters.put("partnerCode", client.getString("client_moniker"));
|
|
|
|
// parmerters.put("actual_fee", analysis.containsKey("actual_fee") ?
|
|
|
|
// parmerters.put("actual_fee", analysis.containsKey("actual_fee") ?
|
|
|
|
// analysis.getBigDecimal("actual_fee") : 0);
|
|
|
|
// analysis.getBigDecimal("actual_fee") : 0);
|
|
|
|
JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList);
|
|
|
|
JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList);
|
|
|
@ -758,6 +760,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
public void exportExcelNew(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
public void exportExcelNew(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
|
|
|
|
logger.debug("excel The method======= exportExcelNew() start.......................");
|
|
|
|
logger.debug("excel The method======= exportExcelNew() start.......................");
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
JSONObject transFlow = listPartnerTransFlow(query, partner);
|
|
|
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(Integer.parseInt(query.getClient_ids()[0]));
|
|
|
|
if (transFlow.getJSONArray("data").size() > 0) {
|
|
|
|
if (transFlow.getJSONArray("data").size() > 0) {
|
|
|
|
List<JSONObject> dataList = (List<JSONObject>) transFlow.get("data");
|
|
|
|
List<JSONObject> dataList = (List<JSONObject>) transFlow.get("data");
|
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
@ -849,7 +852,7 @@ public class TradeLogServiceImpl implements TradeLogService {
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
JSONObject parmerters = new JSONObject();
|
|
|
|
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) ? query.getDatefrom() : "");
|
|
|
|
parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) ? query.getDatefrom() : "");
|
|
|
|
parmerters.put("dateTo", StringUtils.isNotBlank(query.getDateto()) ? query.getDateto() : DateFormatUtils.format(new Date(), "yyyyMMdd"));
|
|
|
|
parmerters.put("dateTo", StringUtils.isNotBlank(query.getDateto()) ? query.getDateto() : DateFormatUtils.format(new Date(), "yyyyMMdd"));
|
|
|
|
parmerters.put("partnerCode", partner.getString("client_moniker"));
|
|
|
|
parmerters.put("partnerCode", client.getString("client_moniker"));
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
String fileName = StringUtils.isEmpty(parmerters.getString("dateFrom")) ? parmerters.getString("dateTo")
|
|
|
|
String fileName = StringUtils.isEmpty(parmerters.getString("dateFrom")) ? parmerters.getString("dateTo")
|
|
|
|
: (parmerters.getString("dateFrom") + "~" + parmerters.getString("dateTo"));
|
|
|
|
: (parmerters.getString("dateFrom") + "~" + parmerters.getString("dateTo"));
|
|
|
|