|
@@ -94,7 +94,7 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
@Override
|
|
|
public void queryOrderStatus() throws Exception {
|
|
|
yqPayQuery();
|
|
|
- //adaPayQuery();
|
|
|
+ adaPayQuery();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -151,52 +151,52 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// private void adaPayQuery() throws Exception {
|
|
|
-// List<ExamRegistrationPayment> orders = examRegistrationPaymentDao.getOrdersByStatus("ING", "ADAPAY");
|
|
|
-// if (orders.size() == 0) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<String> orderNoList = new ArrayList<String>();
|
|
|
-//
|
|
|
-// for (ExamRegistrationPayment order : orders) {
|
|
|
-// if (order.getTransNo() == null) {
|
|
|
-// orderNoList.add(order.getOrderNo());
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// Map<String, Object> payment = Payment.queryPayment(order.getTransNo());
|
|
|
-// Map<String, String> rpMap = new HashMap<>();
|
|
|
-// rpMap.put("merOrderNo", order.getOrderNo());
|
|
|
-// rpMap.put("orderNo", (String) payment.get("id"));
|
|
|
-// rpMap.put("channelType", (String) payment.get("pay_channel"));
|
|
|
-// String status = (String) payment.get("status");
|
|
|
-// if (payment.containsKey("error_msg")) {
|
|
|
-// rpMap.put("remarks", (String) payment.get("error_msg"));
|
|
|
-// }
|
|
|
-// if (status.equals("succeeded")) {
|
|
|
-// rpMap.put("tradeState", "1");
|
|
|
-// }
|
|
|
-// if (status.equals("failed")) {
|
|
|
-// rpMap.put("tradeState", "0");
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (rpMap.containsKey("tradeState")) {
|
|
|
-// try {
|
|
|
-// updateOrder(rpMap); //更新订单
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (status.equals("pending")) {
|
|
|
-// orderNoList.add(order.getOrderNo());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// closeOrders(orderNoList);
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
+ private void adaPayQuery() throws Exception {
|
|
|
+ List<ExamRegistrationPayment> orders = examRegistrationPaymentDao.getOrdersByStatus("ING", "ADAPAY");
|
|
|
+ if (orders.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> orderNoList = new ArrayList<String>();
|
|
|
+
|
|
|
+ for (ExamRegistrationPayment order : orders) {
|
|
|
+ if (order.getTransNo() == null) {
|
|
|
+ orderNoList.add(order.getOrderNo());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, Object> payment = Payment.queryPayment(order.getTransNo());
|
|
|
+ Map<String, String> rpMap = new HashMap<>();
|
|
|
+ rpMap.put("orderNo", order.getOrderNo());
|
|
|
+ rpMap.put("transNo", (String) payment.get("id"));
|
|
|
+ rpMap.put("channelType", (String) payment.get("pay_channel"));
|
|
|
+ String status = (String) payment.get("status");
|
|
|
+ if (payment.containsKey("error_msg")) {
|
|
|
+ rpMap.put("memo", (String) payment.get("error_msg"));
|
|
|
+ }
|
|
|
+ if (status.equals("succeeded")) {
|
|
|
+ rpMap.put("transStatus", "SUCCESS");
|
|
|
+ }
|
|
|
+ if (status.equals("failed")) {
|
|
|
+ rpMap.put("transStatus", "FAILED");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rpMap.containsKey("tradeState")) {
|
|
|
+ try {
|
|
|
+ updateOrder(rpMap); //更新订单
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (status.equals("pending")) {
|
|
|
+ orderNoList.add(order.getOrderNo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ closeOrders(orderNoList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void closeOrders(List<String> orderNoList) throws Exception {
|
|
|
if (orderNoList.size() == 0) {
|
|
|
return;
|