diff --git a/pom.xml b/pom.xml
index 03f139d51..327110e37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,11 +5,11 @@
au.com.royalpay.payment
payment-parent
- 2.2.11
+ 2.2.12
4.0.0
manage
- 2.3.66
+ 2.3.67
UTF-8
2.4.0
diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java
index b81534c34..f3a58c6c3 100644
--- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java
@@ -14,6 +14,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
@@ -21,6 +22,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +54,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
private WxPayClient wxPayClient;
@Resource
private SysWxMerchantApplyMapper sysWxMerchantApplyMapper;
- private Logger logger = LoggerFactory.getLogger(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private RoyalThreadPoolExecutor royalThreadPoolExecutor;
@@ -60,7 +62,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
@Override
public JSONObject listClients(HttpServletResponse httpResponse, JSONObject manager, AliExcel query) {
OutputStream ous = null;
- try {
+ try (Workbook wb = new HSSFWorkbook()) {
JSONObject params = query.toJsonParam();
List partners = clientMapper.passPartners(params);
httpResponse.setContentType("application/octet-stream;");
@@ -69,7 +71,6 @@ public class AliforexcelServiceImpl implements AliforexcelService {
String codedFileName = java.net.URLEncoder.encode(fileName, "UTF-8");
httpResponse.addHeader("Content-Disposition", "attachment; filename=" + codedFileName + query.getDatefrom() + "~" + query.getDateto() + ".xls");
ous = httpResponse.getOutputStream();
- HSSFWorkbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("支付宝进件专用");
sheet.createFreezePane(1, 2);
sheet.setDefaultColumnWidth((short) 25);
@@ -103,6 +104,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
} catch (IOException e) {
+ logger.error(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(ous);
}
@@ -167,7 +169,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
result.put("success_register_merchant", registerSuccessMerchant);
result.put("fail_register_merchant", registerFailMerchant);
result.put("less_info_merchant", lessInfoMerchant);
- logger.info("-------AlipayOnline Gms end----fail_register_merchant" + registerFailMerchant.toString());
+ logger.info("-------AlipayOnline Gms end----fail_register_merchant{}", registerFailMerchant.toString());
return result;
}
@@ -188,7 +190,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
params.put("merchant_remark", client.getString("client_moniker"));
params.put("website", client.getString("company_website"));
params.put("merchant_introduction", client.getString("short_name"));
- SubMerchantInfo subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfo.class);
+ SubMerchantInfo subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfo.class);
params.put("merchant_id", client.getString("merchant_id"));
params.put("client_id", client.getString("client_id"));
params.put("create_time", new Date());
@@ -204,7 +206,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
throw new BadRequestException(elem.elementText("return_msg"));
}
} catch (Exception e) {
-
+ logger.error(e.getMessage(), e);
}
});
});
diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java
index 2590040df..320036d49 100644
--- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java
@@ -1,12 +1,8 @@
package au.com.royalpay.payment.manage.dev.web;
-import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment;
-import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient;
-import au.com.royalpay.payment.channels.rpay.runtime.RpayClient;
-import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
import au.com.royalpay.payment.core.PaymentApi;
+import au.com.royalpay.payment.core.PaymentDevHelper;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
-import au.com.royalpay.payment.core.exceptions.OrderNotExistsException;
import au.com.royalpay.payment.core.mappers.PmtCustomReportMapper;
import au.com.royalpay.payment.manage.analysis.core.ATOReportService;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
@@ -31,31 +27,23 @@ import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
-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.NotFoundException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
-import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
-import au.com.royalpay.payment.tools.utils.XmlFormatUtils;
-import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
-import org.dom4j.Element;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.ui.Model;
-import org.springframework.util.Assert;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -68,7 +56,6 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.math.RoundingMode;
-import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -81,7 +68,7 @@ import java.util.List;
@RestController
@RequestMapping("/dev")
public class TestController {
- private Logger logger = LoggerFactory.getLogger(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private OrderMapper orderMapper;
@Resource
@@ -103,12 +90,6 @@ public class TestController {
@Resource
private PaymentApi paymentApi;
@Resource
- private WxPayClient wxPayClient;
- @Resource
- private AlipayClient alipayClient;
- @Resource
- private RpayClient rpayClient;
- @Resource
private TradeLogService tradeLogService;
@Resource
private RetailAppService retailAppService;
@@ -124,16 +105,13 @@ public class TestController {
private SysClientLegalPersonMapper sysClientLegalPersonMapper;
@Resource
private TradeSecureService tradeSecureService;
- private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
@Resource
private DashboardService dashboardService;
@Resource
- private SynchronizedScheduler synchronizedScheduler;
+ private PaymentDevHelper paymentDevHelper;
@Resource
private PmtCustomReportMapper pmtCustomReportsMapper;
- @Resource
- private MongoTemplate mongoTemplate;
@ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception {
@@ -268,7 +246,7 @@ public class TestController {
String orderChannel = StringUtils.defaultIfEmpty(order.getString("order_channel"), order.getString("channel"));
paymentApi.checkOrderStatus(order.getString("order_id"), orderChannel, true);
} catch (Exception e) {
- logger.error("fix transaction error:" + order.getString("order_id"));
+ logger.error("fix transaction error:{}", order.getString("order_id"));
}
}
@@ -280,7 +258,7 @@ public class TestController {
String orderChannel = StringUtils.defaultIfEmpty(order.getString("order_channel"), order.getString("channel"));
paymentApi.checkOrderStatus(order.getString("order_id"), orderChannel, true);
} catch (Exception e) {
- logger.error("fix transaction error:" + order.getString("order_id"));
+ logger.error("fix transaction error:{}", order.getString("order_id"));
}
}
List refunds = refundMapper.listConfirmedRefundsWithNoTransactions();
@@ -290,71 +268,17 @@ public class TestController {
}
@ManagerMapping(value = "/orders/{orderId}/detail", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
- public JSONObject checkOrderDetail(@PathVariable String orderId) throws URISyntaxException, IOException {
- JSONObject order = orderMapper.find(orderId);
- if (order == null) {
- throw new OrderNotExistsException();
- }
- String channel = StringUtils.defaultIfEmpty(order.getString("order_channel"), order.getString("channel"));
+ public JSONObject checkOrderDetail(@PathVariable String orderId) {
JSONObject res = new JSONObject();
- switch (channel) {
- case "Wechat":
- Element elem = wxPayClient.checkOrderStatus(orderId, order.getString("merchant_id"), order.getString("sub_merchant_id"));
- String xmlStr = XmlFormatUtils.formatXml(elem);
- res.put("xml", xmlStr);
- break;
- case "Alipay":
- elem = alipayClient.checkRetailOrderStatusByOrderId(orderId, AlipayEnvironment.getEnv().getAlipayRetailMerchant().getPid());
- xmlStr = XmlFormatUtils.formatXml(elem);
- res.put("xml", xmlStr);
- break;
- case "AlipayOnline":
- elem = alipayClient.checkOnlineOrderStatusByOrderId(orderId, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid());
- xmlStr = XmlFormatUtils.formatXml(elem);
- res.put("xml", xmlStr);
- break;
- case "Rpay":
- JSONObject orderInfo = rpayClient.queryOrderStatus(orderId);
- String rpayjson = JSON.toJSONString(orderInfo, SerializerFeature.PrettyFormat);
- res.put("xml", rpayjson);
- break;
- default:
- throw new BadRequestException("Not Support channel:" + channel);
- }
+ res.put("xml", paymentDevHelper.devCheckOrder(orderId));
return res;
}
@ManagerMapping(value = "/order_refunds/{refundId}/detail", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public JSONObject checkRefundDetail(@PathVariable String refundId) {
- JSONObject refundOrder = refundMapper.findByOutRefundId(refundId);
- if (refundOrder == null) {
- throw new BadRequestException("退款单不存在");
- }
- JSONObject order = orderMapper.find(refundOrder.getString("order_id"));
- Assert.notNull(order, "order not exists");
- String channel = order.getString("order_channel");
JSONObject res = new JSONObject();
- TradeType type = TradeType.fromGatewayNumber(order.getIntValue("gateway"));
- switch (channel) {
- case "Wechat":
- Element elem = wxPayClient.checkRefundStatus(refundId, order.getString("merchant_id"), order.getString("sub_merchant_id"));
- String xml = XmlFormatUtils.formatXml(elem);
- res.put("xml", xml);
- break;
- case "Alipay":
- elem = alipayClient.retailRefund(type, refundOrder.getBigDecimal("refund_exchange_rate"), refundOrder, AlipayEnvironment.getEnv().getAlipayRetailMerchant().getPid());
- String xmlStr = XmlFormatUtils.formatXml(elem);
- res.put("xml", xmlStr);
- break;
- case "AlipayOnline":
- elem = alipayClient.onlineRefund(refundOrder, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid(), type == TradeType.GATEWAY_H5);
- xmlStr = XmlFormatUtils.formatXml(elem);
- res.put("xml", xmlStr);
- break;
- default:
- throw new BadRequestException("Not Support channel:" + channel);
- }
+ res.put("xml", paymentDevHelper.devCheckRefund(refundId));
return res;
}
@@ -403,17 +327,6 @@ public class TestController {
clientManager.updateAllPartnerPassword("PINE");
}
-// @ManagerMapping(value = "/getPineAccoutPasswd", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
-// public List getPineAccountPasswd() {
-// Query query = new Query();
-// List accountInfos = mongoTemplate.find(query,TestMerchantAccountInfo.class);
-// List accounts = new ArrayList<>();
-// for (TestMerchantAccountInfo accountInfo : accountInfos) {
-// accounts.add(accountInfo.toJSON());
-// }
-// return accounts;
-// }
-
@ManagerMapping(value = "/secure/hanyin_reports/{date}", role = ManagerRole.DEVELOPER, method = RequestMethod.GET)
public void downloadHanyinSecureReports(@PathVariable String date, @RequestParam(defaultValue = "false") boolean upload, HttpServletResponse resp) {
tradeSecureService.manualDownloadHanyinSecureReport(DateTime.parse(date).toDate(), upload, resp);
@@ -530,20 +443,7 @@ public class TestController {
@ManagerMapping(value = "/custom_declare_check/{reportId}/detail", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public JSONObject checkCustomDeclareOrderDetail(@PathVariable String reportId) {
- JSONObject report = pmtCustomReportsMapper.findCustomReport(reportId);
- if (report == null || report.isEmpty()) {
- throw new NotFoundException("Report Not Exists");
- }
- JSONObject order = orderMapper.find(report.getString("order_id"));
- String declareResp;
-
- if (StringUtils.equals("Wechat", report.getString("channel"))) {
- declareResp = XmlFormatUtils.formatXml(wxPayClient.declareCustomQuery(order.getString("merchant_id"), report, null, false));
- } else if (StringUtils.equals("Alipay", report.getString("channel"))) {
- declareResp = XmlFormatUtils.formatXml(alipayClient.queryCustomStatus(order.getString("merchant_id"), report, null, false));
- } else {
- throw new BadRequestException("Invalid Channel:" + report.getString("channel"));
- }
+ String declareResp = paymentDevHelper.devQueryCustomsReport(reportId);
JSONObject res = new JSONObject();
res.put("xml", declareResp);
return res;
@@ -585,18 +485,19 @@ public class TestController {
public void sendSecurePaySettleFile(@RequestParam String dateStr) {
tradeSecureService.sendSecurePaySettleFile(dateStr);
}
+
@GetMapping(value = "/securepay/invoice/file")
public void sendSecurePayInvoiceFile() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
//获取前一个月第一天
Calendar calendar1 = Calendar.getInstance();
calendar1.add(Calendar.MONTH, -1);
- calendar1.set(Calendar.DAY_OF_MONTH,1);
+ calendar1.set(Calendar.DAY_OF_MONTH, 1);
String firstDay = sdf.format(calendar1.getTime());
//获取前一个月最后一天
Calendar calendar2 = Calendar.getInstance();
calendar2.set(Calendar.DAY_OF_MONTH, 0);
String lastDay = sdf.format(calendar2.getTime());
- tradeSecureService.sendSecurePayInvoiceFile(firstDay,lastDay);
+ tradeSecureService.sendSecurePayInvoiceFile(firstDay, lastDay);
}
}