|
|
|
@ -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) {
|
|
|
|
|