|
|
@@ -3,10 +3,12 @@ package com.fs.hisStore.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.ZonedDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@@ -47,11 +49,16 @@ import com.fs.his.service.IFsUserWxService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.utils.HttpUtil;
|
|
|
import com.fs.hisStore.config.StoreConfig;
|
|
|
+import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
|
import com.fs.hisStore.enums.SysConfigEnum;
|
|
|
import com.fs.hisStore.param.*;
|
|
|
+import com.fs.hisStore.service.IFsStoreOrderScrmService;
|
|
|
+import com.fs.hisStore.vo.FsStorePaymentScrmVo;
|
|
|
import com.fs.hisStore.vo.FsStorePaymentUsetVo;
|
|
|
import com.fs.huifuPay.domain.HuiFuCreateOrder;
|
|
|
+import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
|
|
|
import com.fs.huifuPay.domain.HuifuCreateOrderResult;
|
|
|
+import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayQueryRequest;
|
|
|
import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
|
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
|
import com.fs.pay.pay.config.PayConfig;
|
|
|
@@ -138,6 +145,9 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreOrderScrmService storeOrderService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询支付明细
|
|
|
*
|
|
|
@@ -150,6 +160,15 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
|
|
|
return fsStorePaymentMapper.selectFsStorePaymentById(paymentId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public FsStorePaymentScrmVo selectFsStorePaymentAndFsUserById(Long paymentId) {
|
|
|
+ FsStorePaymentScrmVo vo = fsStorePaymentMapper.selectFsStorePaymentAndFsUserById(paymentId);
|
|
|
+ if (vo!=null && StringUtils.isNotBlank(vo.getPhone())){
|
|
|
+ vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
|
|
|
+ }
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询支付明细列表
|
|
|
*
|
|
|
@@ -1009,6 +1028,99 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String updateFsStorePaymentByDecryptForm(Long paymentId) {
|
|
|
+ FsStorePaymentScrm fsStorePayment = fsStorePaymentMapper.selectFsStorePaymentById(paymentId);
|
|
|
+ logger.info("手动查询单号:" + paymentId + ":" + fsStorePayment);
|
|
|
+ Long orderId = fsStorePayment.getOrderId();
|
|
|
+ FsStoreOrderScrm fsStoreOrder = storeOrderService.selectFsStoreOrderById(orderId);
|
|
|
+ String tradeNo = fsStorePayment.getTradeNo();
|
|
|
+ String payCode = fsStorePayment.getPayCode();
|
|
|
+ String payType = fsStoreOrder.getPayType();
|
|
|
+// if (fsStorePayment.getPayMode().equals("tz")) {
|
|
|
+// payQueryOrder payQueryOrder = new payQueryOrder();
|
|
|
+// payQueryOrder.setOrderFlowNo(payCode);
|
|
|
+// TzBankResult<QueryOrderResult> result = tzBankService.queryOrder(payQueryOrder);
|
|
|
+// logger.info("手动查询内容:" + paymentId + ":" + result);
|
|
|
+// if (result.getRetType().equals("S") && result.getBody().getStatus().equals("90")) {
|
|
|
+// QueryOrderResult body = result.getBody();
|
|
|
+// logger.info("手动回调内容:" + body);
|
|
|
+// if (fsStorePayment.getBusinessType() == 1) {
|
|
|
+// } else if (fsStorePayment.getBusinessType() == 2) {
|
|
|
+// } else if (fsStorePayment.getBusinessType() == 3) {
|
|
|
+// }else if (fsStorePayment.getBusinessType() == 4) {
|
|
|
+// }else if (fsStorePayment.getBusinessType() == 5) {
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (fsStorePayment.getPayMode().equals("yb")) {
|
|
|
+// OrderQueryDTO o = new OrderQueryDTO();
|
|
|
+// o.setUpOrderId(payCode);
|
|
|
+// OrderResult orderResult = ybPayService.getOrder(o);
|
|
|
+//
|
|
|
+// if ("0".equals(orderResult.getState())) {
|
|
|
+// if (orderResult.getStatus().equals("100")) {
|
|
|
+// logger.info("手动查询内容:" + paymentId + ":" + orderResult);
|
|
|
+// if (orderResult.getStatus().equals("100")) {
|
|
|
+// if (fsStorePayment.getBusinessType() == 1) {
|
|
|
+// } else if (fsStorePayment.getBusinessType() == 2) {
|
|
|
+// } else if (fsStorePayment.getBusinessType() == 3) {
|
|
|
+// }else if (fsStorePayment.getBusinessType() == 4) {
|
|
|
+// }else if (fsStorePayment.getBusinessType() == 5) {
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if (fsStorePayment.getPayMode().equals("hf")) {
|
|
|
+ V2TradePaymentScanpayQueryRequest request = new V2TradePaymentScanpayQueryRequest();
|
|
|
+ request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(fsStorePayment.getCreateTime()));
|
|
|
+ request.setOrgHfSeqId(fsStorePayment.getTradeNo());
|
|
|
+ HuiFuQueryOrderResult queryOrderResult = null;
|
|
|
+ try {
|
|
|
+ queryOrderResult = huiFuService.queryOrder(request);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ logger.info("汇付返回"+queryOrderResult);
|
|
|
+ if ("00000000".equals(queryOrderResult.getResp_code())) {
|
|
|
+ if (queryOrderResult.getTrans_stat().equals("S")) {
|
|
|
+ logger.info("手动查询内容:" + paymentId + ":" + request);
|
|
|
+ if (fsStorePayment.getBusinessType() == 1) {
|
|
|
+ } else if (fsStorePayment.getBusinessType() == 2) {
|
|
|
+ //查询订单
|
|
|
+ storeOrderService.payConfirm(Integer.valueOf(payType), orderId, payCode, tradeNo,queryOrderResult.getOut_trans_id(),queryOrderResult.getParty_order_id());
|
|
|
+ } else if (fsStorePayment.getBusinessType() == 3) {
|
|
|
+ } else if (fsStorePayment.getBusinessType() == 4) {
|
|
|
+ }else if (fsStorePayment.getBusinessType() == 5) {
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "同步完成";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void synchronizePayStatus() {
|
|
|
+ FsStorePaymentScrm queryParam = new FsStorePaymentScrm();
|
|
|
+ queryParam.setStatus(0);//未支付
|
|
|
+ queryParam.setBeginTime(DateUtils.addDateDays(-1));
|
|
|
+ queryParam.setEndTime(DateUtils.getDate());
|
|
|
+ List<FsStorePaymentScrm> list = selectFsStorePaymentList(queryParam);
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ List<CompletableFuture<Void>> futures = new ArrayList<>();
|
|
|
+ for (FsStorePaymentScrm fsStorePayment : list) {
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
|
|
+ updateFsStorePaymentByDecryptForm(fsStorePayment.getPaymentId());
|
|
|
+ logger.info("定时任务:同步支付状态,payment_id:{}",fsStorePayment.getPaymentId());
|
|
|
+ });
|
|
|
+ futures.add(future);
|
|
|
+ }
|
|
|
+ CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private boolean uploadShippingInfoToWechat(WxMaService wxService,
|
|
|
FsStorePaymentUsetVo dto,
|
|
|
String uploadTime) {
|