diff --git a/pom.xml b/pom.xml
index e19cdf6ca..ac7e5c35d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
4.0.0
manage
- 1.3.59
+ 1.3.60
UTF-8
1.8.0
diff --git a/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java b/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java
index 9e18eaa75..0332dd1e4 100644
--- a/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java
@@ -47,4 +47,11 @@ public class PartnerInvoiceController {
params.put("client_moniker",client.getString("client_moniker"));
return params;
}
+
+ @GetMapping(value = "/trans_flow/pdf/{clientMoniker}")
+ public void exportTransFlowPDF(@PathVariable String clientMoniker,TradeLogQuery query,HttpServletResponse httpResponse) throws Exception {
+ JSONObject partner = new JSONObject();
+ partner.put("client_moniker",clientMoniker);
+ tradeLogService.exportTransFlowApi(query,partner,httpResponse);
+ }
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java
index 2f45b373e..a325c662c 100644
--- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java
@@ -36,6 +36,8 @@ public interface TradeLogService {
void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception;
+ void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception;
+
void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception;
void exportExcelNew(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception;
diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java
index bb8c094d5..0e7bf4bd6 100644
--- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java
@@ -23,6 +23,7 @@ import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
+import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
@@ -130,6 +131,8 @@ public class TradeLogServiceImpl implements TradeLogService {
private ClientDeviceMapper clientDeviceMapper;
@Resource
private MerchantInfoProvider merchantInfoProvider;
+ @Resource
+ private Locker locker;
// @Value("classpath:/jasper/trans_flow.jasper")
// @Value("classpath:/jasper/trans_flow_new.jasper")
@@ -713,6 +716,44 @@ public class TradeLogServiceImpl implements TradeLogService {
}
}
+ @Override
+ public void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception {
+ query.setClearing_status(-1);
+ String clientKey = "exportTransFlow:" + partner.getString("client_id");
+
+ JSONObject client = clientManager.getClientInfoByMoniker(partner.getString("client_moniker"));
+ if (client == null) {
+ throw new InvalidShortIdException();
+ }
+ partner.put("client_id",client.getIntValue("client_id"));
+ partner.put("client",client);
+
+ long internal = 0;
+ try{
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
+ long start = formatter.parse(query.getDatefrom()).getTime();
+ long end= formatter.parse(query.getDateto()).getTime();
+ internal = (end-start)/(1000*60*60*24);
+ }catch (Exception e){
+ throw new ServerErrorException("查询参数格式不正确");
+ }
+
+ if(internal > 90){
+ throw new ServerErrorException("最大查询区间为90天,请确认查询区间");
+ }
+
+ try{
+ if (!locker.lock(clientKey, 300_000)) {
+ throw new ServerErrorException("其他Invoice正在生成中,请稍后再试");
+ }
+ exportTransFlow( query, partner, response);
+ }
+ finally {
+ locker.unlock(clientKey);
+ }
+ }
+
+
private void scaleDecimalVal(JSONObject obj, String key, String currency) {
BigDecimal decimal = obj.getBigDecimal(key);
if (decimal == null) {