|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.store.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -18,7 +19,10 @@ import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.service.ICompanyService;
|
|
|
import com.fs.company.service.ICompanyUserService;
|
|
|
+import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
|
|
|
import com.fs.huifuPay.dto.*;
|
|
|
+import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayQueryRequest;
|
|
|
+import com.fs.huifuPay.service.HuiFuService;
|
|
|
import com.fs.pay.pay.util.PayUtil;
|
|
|
import com.fs.store.domain.*;
|
|
|
import com.fs.store.service.IFsStoreOrderService;
|
|
@@ -316,7 +320,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService
|
|
|
public void paymentSync() {
|
|
|
List<FsStorePayment> fsStorePayments = fsStorePaymentMapper.queryPendingDelayState();
|
|
|
for (FsStorePayment fsStorePayment : fsStorePayments) {
|
|
|
- queryYb(fsStorePayment);
|
|
|
+ queryHf(fsStorePayment);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -415,6 +419,38 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HuiFuService huiFuService;
|
|
|
+ @Override
|
|
|
+ public boolean queryHf(FsStorePayment fsStorePayment) {
|
|
|
+
|
|
|
+ V2TradePaymentScanpayQueryRequest request = new V2TradePaymentScanpayQueryRequest();
|
|
|
+ request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(fsStorePayment.getCreateTime()));
|
|
|
+ request.setOrgHfSeqId(fsStorePayment.getTradeNo());
|
|
|
+ HuiFuQueryOrderResult huiFuQueryOrderResult;
|
|
|
+ try {
|
|
|
+ huiFuQueryOrderResult = huiFuService.queryOrder(request);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ logger.info("汇付返回"+huiFuQueryOrderResult);
|
|
|
+ if ("00000000".equals(huiFuQueryOrderResult.getResp_code())) {
|
|
|
+ if (huiFuQueryOrderResult.getTrans_stat().equals("S")) {
|
|
|
+ // 如果查询支付成功 更新订单状态
|
|
|
+ String bankTrxId = huiFuQueryOrderResult.getOut_trans_id();
|
|
|
+ String bankOrderId = huiFuQueryOrderResult.getParty_order_id();
|
|
|
+ orderService.payConfirm(1,fsStorePayment.getOrderId(), fsStorePayment.getPayCode(),
|
|
|
+ fsStorePayment.getTradeNo(),bankTrxId, bankOrderId);
|
|
|
+ return true;
|
|
|
+ } else if(huiFuQueryOrderResult.getTrans_stat().equals("F")){
|
|
|
+ fsStorePayment.setStatus(-2);
|
|
|
+ this.updateFsStorePayment(fsStorePayment);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public boolean updateYbBankSerial(FsStorePayment fsStorePayment) {
|
|
|
// 查询易宝
|