fix 下载文件

master
luoyang 6 years ago
parent 378235e4cf
commit 09c7357fb7

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

@ -20,23 +20,23 @@
<p>{{surcharge.balance|currency:'AUD'}}</p>
</div>
</div>
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
<label class="control-label col-xs-4 col-sm-3">允许手续费账户欠款</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.allow_surcharge_credit" bs-switch
switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)" switch-readonly="true">
</div>
</div>
<!--<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">-->
<!--<label class="control-label col-xs-4 col-sm-3">允许手续费账户欠款</label>-->
<!--<div class="col-sm-6">-->
<!--<input type="checkbox" ng-model="partner.allow_surcharge_credit" bs-switch-->
<!--switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)" switch-readonly="true">-->
<!--</div>-->
<!--</div>-->
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3" style="padding-top:0px">Surcharge Mode:</label>
<div class="col-xs-8 col-sm-6">
<span class="control-label" ng-bind="partner.surcharge_mode"></span>
<p class="text-info">
<i class="fa fa-info"></i>启用到收支分离(distributed)模式,将使消费者支付手续费模式失效
</p>
</div>
</div>
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-4 col-sm-3" style="padding-top:0px">Surcharge Mode:</label>-->
<!--<div class="col-xs-8 col-sm-6">-->
<!--<span class="control-label" ng-bind="partner.surcharge_mode"></span>-->
<!--<p class="text-info">-->
<!--<i class="fa fa-info"></i>启用到收支分离(distributed)模式,将使消费者支付手续费模式失效-->
<!--</p>-->
<!--</div>-->
<!--</div>-->
</div>
<div class="col-sm-4" style="text-align: center" ng-if="code_url">

Loading…
Cancel
Save