|
@@ -49,9 +49,10 @@ public class PayServiceImpl implements PayService {
|
|
|
*/
|
|
|
String merNo = "10001720";
|
|
|
|
|
|
+ JsonModel model = JsonModel.newInstance();
|
|
|
+
|
|
|
@Override
|
|
|
public JsonModel checkoutCounter(Integer orderId) {
|
|
|
- JsonModel model = JsonModel.newInstance();
|
|
|
if (null == orderId) {
|
|
|
return model.error("参数异常");
|
|
|
}
|
|
@@ -66,10 +67,12 @@ public class PayServiceImpl implements PayService {
|
|
|
BigDecimal receiptAmount = BigDecimal.ZERO;
|
|
|
if (null != discernReceiptList && discernReceiptList.size() > 0) {
|
|
|
for (DiscernReceiptVo discernReceipt : discernReceiptList) {
|
|
|
- receiptAmount = receiptAmount.add(discernReceipt.getAssociateAmount());
|
|
|
if ("2".equals(discernReceipt.getPayWay())) {
|
|
|
return model.error("线下支付过只能走线下");
|
|
|
}
|
|
|
+ if ("3".equals(discernReceipt.getReceiptStatus())) {
|
|
|
+ receiptAmount = receiptAmount.add(discernReceipt.getAssociateAmount());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
order.setReceiptAmount(receiptAmount);
|
|
@@ -87,7 +90,6 @@ public class PayServiceImpl implements PayService {
|
|
|
|
|
|
@Override
|
|
|
public synchronized JsonModel pay(Payment payment, HttpServletRequest request) {
|
|
|
- JsonModel model = JsonModel.newInstance();
|
|
|
JSONObject result = null;
|
|
|
OrderVo order = payDao.findOrder(payment.getOrderId());
|
|
|
if (null == order) {
|
|
@@ -238,6 +240,8 @@ public class PayServiceImpl implements PayService {
|
|
|
//(收款买家)收款状态:1待收款、2部分收款、3已收款
|
|
|
order.setReceiptStatus("2");
|
|
|
}
|
|
|
+ //更新付款次数
|
|
|
+ order.setPaySuccessCounter(order.getPaySuccessCounter() + 1);
|
|
|
payDao.updateSelective(order);
|
|
|
//修改支付链接状态
|
|
|
OrderPayLinkVo orderPayLink = payDao.findOrderPayLink(order.getOrderID(), amount);
|
|
@@ -289,7 +293,6 @@ public class PayServiceImpl implements PayService {
|
|
|
|
|
|
@Override
|
|
|
public JsonModel payLink(OrderPayLinkVo orderPayLink) {
|
|
|
- JsonModel model = JsonModel.newInstance();
|
|
|
if (null == orderPayLink) {
|
|
|
return model.error("参数异常");
|
|
|
}
|
|
@@ -360,4 +363,42 @@ public class PayServiceImpl implements PayService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public JsonModel payWhetherSuccess(Integer orderId, Integer paySuccessCounter) {
|
|
|
+ OrderVo order = payDao.findOrder(orderId);
|
|
|
+ if (order.getPaySuccessCounter().equals(paySuccessCounter)) {
|
|
|
+ return model.error(-2, "支付失败");
|
|
|
+ } else if (order.getPaySuccessCounter() > paySuccessCounter) {
|
|
|
+ return model.success("支付成功");
|
|
|
+ } else {
|
|
|
+ return model.error("支付异常>>>>>>>" + order);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JsonModel findOrderStatus(String mbOrderId) {
|
|
|
+ // 时间戳
|
|
|
+ long time = System.currentTimeMillis() / 1000;
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("merAccount", merAccount);
|
|
|
+ json.put("mbOrderId", mbOrderId);
|
|
|
+ json.put("time", time);
|
|
|
+ String sign = PayUtils.buildSign(json, merKey);
|
|
|
+ json.put("sign", sign);
|
|
|
+ String data = "";
|
|
|
+ try {
|
|
|
+ data = PayUtils.buildDataPrivate(json, merKey);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ JSONObject result = PayUtils.httpGet("https://platform.mhxxkj.com/paygateway/mbpay/order/query/v1_1", merAccount, data);
|
|
|
+ String code = result.getString("code");
|
|
|
+ if (!"000000".equals(code)) {
|
|
|
+ String msg = result.getString("msg");
|
|
|
+ log.info("第三方查询订单失败>>>>>>>msg:" + msg);
|
|
|
+ return model.error(msg);
|
|
|
+ }
|
|
|
+ return model.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|