master
yixian 5 years ago
parent 243c2f4ea2
commit 107584b01e

@ -10,6 +10,7 @@ import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.exceptions.OrderNotExistsException;
import au.com.royalpay.payment.manage.analysis.core.ATOReportService;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.manage.analysis.core.PlatformClearService;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
@ -25,6 +26,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection;
import au.com.royalpay.payment.manage.system.core.TradeSecureService;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts;
@ -55,6 +57,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.util.Assert;
import org.springframework.util.MimeTypeUtils;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
@ -65,8 +68,10 @@ import javax.validation.Valid;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -88,6 +93,8 @@ public class TestController implements ApplicationEventPublisherAware {
@Resource
private ClientMapper clientMapper;
@Resource
private ATOReportService atoReportService;
@Resource
private NotifyErrorLogMapper notifyErrorLogMapper;
@Value("${app.agreetemplate.classic.path}")
private String pdfPath;
@ -538,4 +545,17 @@ public class TestController implements ApplicationEventPublisherAware {
});
}
@GetMapping("/reports/ato_reports/royalpay_ato_report_{year}.bttps")
@ReadOnlyConnection
public void downloadATOReport(@PathVariable String year, HttpServletResponse resp) throws IOException {
DateTime from = DateTime.parse(year + "-07-01");
DateTime to = from.plusYears(1).plusDays(-1);
String atoReport = atoReportService.exportBTTPSFile(from.toDate(), to.toDate());
resp.setContentType(MimeTypeUtils.APPLICATION_OCTET_STREAM_VALUE);
try (OutputStream out = resp.getOutputStream()) {
out.write(atoReport.getBytes(StandardCharsets.UTF_8));
out.flush();
}
}
}

Loading…
Cancel
Save