|
|
@@ -48,9 +48,7 @@ import com.fs.his.domain.*;
|
|
|
import com.fs.his.dto.PayConfigDTO;
|
|
|
import com.fs.his.enums.PaymentMethodEnum;
|
|
|
import com.fs.his.mapper.*;
|
|
|
-import com.fs.his.param.FsStorePaymentParam;
|
|
|
-import com.fs.his.param.PayOrderParam;
|
|
|
-import com.fs.his.param.WxSendRedPacketParam;
|
|
|
+import com.fs.his.param.*;
|
|
|
import com.fs.his.service.IFsInquiryOrderService;
|
|
|
|
|
|
import com.fs.his.param.WxSendRedPacketParam;
|
|
|
@@ -217,6 +215,9 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
|
|
|
@Value("${cloud_host.company_name}")
|
|
|
private String signProjectName;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsStorePaymentErrorMapper fsStorePaymentErrorMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 红包账户锁
|
|
|
*/
|
|
|
@@ -1648,6 +1649,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
|
|
|
return "SUCCESS";
|
|
|
}
|
|
|
|
|
|
+ long TWENTY_DAYS_IN_MILLIS = 1728000000L;// 使用毫秒判断,20天 = 20 * 24 * 60 * 60 * 1000 毫秒
|
|
|
@Override
|
|
|
public void synchronizePayStatus() {
|
|
|
FsStorePayment queryParam = new FsStorePayment();
|
|
|
@@ -1659,7 +1661,44 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
|
|
|
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
|
|
for (FsStorePayment fsStorePayment : list) {
|
|
|
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
|
|
- updateFsStorePaymentByDecryptForm(fsStorePayment.getPaymentId());
|
|
|
+ try {
|
|
|
+ updateFsStorePaymentByDecryptForm(fsStorePayment.getPaymentId());
|
|
|
+ //查询是否改为已支付
|
|
|
+ FsStorePayment finalPayment = fsStorePaymentMapper.selectFsStorePaymentByPaymentId(fsStorePayment.getPaymentId());
|
|
|
+ try {
|
|
|
+ Date createTime = finalPayment.getCreateTime();
|
|
|
+ Date now = new Date();
|
|
|
+ long value = now.getTime() - createTime.getTime();
|
|
|
+ if(finalPayment.getStatus() == 0
|
|
|
+ && finalPayment.getBusinessType() == 3
|
|
|
+ && (value > TWENTY_DAYS_IN_MILLIS)
|
|
|
+ && finalPayment.getBusinessId() != null){
|
|
|
+ //套餐包超过20天取消订单
|
|
|
+ FsPackageOrderCancelParam param = new FsPackageOrderCancelParam();
|
|
|
+ param.setOrderId(Long.valueOf(finalPayment.getBusinessId()));
|
|
|
+ packageOrderService.cancel(param);
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ logger.info("定时任务:同步支付状态超时取消订单失败,payment_id:{}",fsStorePayment.getPaymentId());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ //添加失败记录
|
|
|
+ FsStorePaymentError fsStorePaymentError = new FsStorePaymentError();
|
|
|
+ fsStorePaymentError.setOrderFlowNo(fsStorePayment.getTradeNo());
|
|
|
+ String businessId = fsStorePayment.getBusinessId();
|
|
|
+ fsStorePaymentError.setBusinessType(fsStorePayment.getBusinessType());
|
|
|
+ fsStorePaymentError.setMsg(e.getMessage());
|
|
|
+ fsStorePaymentError.setStatus(0);
|
|
|
+ fsStorePaymentError.setCreateTime(new Date());
|
|
|
+ if (businessId != null && fsStorePayment.getBusinessType() == 3) {
|
|
|
+ fsStorePaymentError.setOrderId(Long.valueOf(businessId));
|
|
|
+ FsPackageOrder fsPackageOrder = packageOrderService.selectFsPackageOrderByOrderId(Long.valueOf(businessId));
|
|
|
+ if (fsPackageOrder != null) {
|
|
|
+ fsStorePaymentError.setOrderNo(fsPackageOrder.getOrderSn());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ fsStorePaymentErrorMapper.insertFsStorePaymentError(fsStorePaymentError);
|
|
|
+ }
|
|
|
logger.info("定时任务:同步支付状态,payment_id:{}",fsStorePayment.getPaymentId());
|
|
|
});
|
|
|
futures.add(future);
|