|
@@ -19,6 +19,7 @@ import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.entity.MallCreateOrderModel;
|
|
|
+import com.ym.mec.common.entity.OrderCancelModel;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.PageUtil;
|
|
@@ -315,7 +316,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Boolean updateOrderStatus(Date date, Map<Integer, HfMerchantConfig> payConfigMap, StudentPaymentOrder payingOrder, Boolean checkTime) throws Exception {
|
|
|
+ public OrderCancelModel updateOrderStatus(Date date, Map<Integer, HfMerchantConfig> payConfigMap, StudentPaymentOrder payingOrder, Boolean checkTime) throws Exception {
|
|
|
if (payConfigMap == null) {
|
|
|
throw new BizException("payConfigMap 不能为空");
|
|
|
}
|
|
@@ -328,6 +329,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
payConfigMap.put(payingOrder.getTenantId(), hfMerchantConfig);
|
|
|
}
|
|
|
+ OrderCancelModel model = new OrderCancelModel();
|
|
|
|
|
|
Map<String, Object> payment = Payment.queryPayment(payingOrder.getTransNo(), hfMerchantConfig.getMerKey());
|
|
|
LOGGER.info("订单[{}]交易主动查询接口返回:{}", payingOrder.getTransNo(), payment);
|
|
@@ -336,27 +338,32 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
rpMap.put("merOrderNo", payingOrder.getOrderNo());
|
|
|
rpMap.put("orderNo", payingOrder.getTransNo());
|
|
|
rpMap.put("channelType", (String) payment.get("pay_channel"));
|
|
|
+ model.setPayChannel((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");
|
|
|
+ model.setStatus(true);
|
|
|
} else if (status.equals("failed") || !checkTime
|
|
|
|| (DateUtil.minutesBetween(DateUtil.addHours(payingOrder.getUpdateTime(), 2),date) > 0)) {
|
|
|
rpMap.put("tradeState", "0");
|
|
|
+ model.setStatus(false);
|
|
|
}
|
|
|
|
|
|
if (status.equals("succeeded") ||
|
|
|
(status.equals("failed") || !checkTime || payingOrder.getCreateTime().before(DateUtil.addMinutes(new Date(), -35)))) {
|
|
|
try {
|
|
|
updateOrder(rpMap); //更新订单
|
|
|
+ model.setSuccess(true);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- return false;
|
|
|
+ model.setSuccess(false);
|
|
|
+ return model;
|
|
|
}
|
|
|
}
|
|
|
- return true;
|
|
|
+ return model;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|