PaymentTask.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.fs.task;
  2. import com.alibaba.fastjson.JSON;
  3. import com.fs.common.annotation.QuartzRunnable;
  4. import com.fs.pay.pay.domain.OrderResult;
  5. import com.fs.pay.pay.dto.OrderQueryDTO;
  6. import com.fs.pay.pay.service.PayService;
  7. import com.fs.store.domain.FsPayConfig;
  8. import com.fs.store.domain.FsStorePayment;
  9. import com.fs.store.mapper.FsStorePaymentMapper;
  10. import com.fs.store.service.IFsStoreOrderService;
  11. import com.fs.store.service.IFsStorePaymentService;
  12. import com.fs.system.service.ISysConfigService;
  13. import lombok.extern.slf4j.Slf4j;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.stereotype.Service;
  16. import java.util.List;
  17. @Slf4j
  18. @Service("paymentTask")
  19. public class PaymentTask {
  20. @Autowired
  21. private IFsStorePaymentService fsStorePaymentService;
  22. @Autowired
  23. private IFsStoreOrderService fsStoreOrderService;
  24. @Autowired
  25. private FsStorePaymentMapper fsStorePaymentMapper;
  26. @Autowired
  27. private ISysConfigService configService;
  28. @Autowired
  29. private PayService payService;
  30. /**
  31. * 补偿机制,定时反查台州银行
  32. */
  33. @QuartzRunnable(name="台州银行补偿机制")
  34. public void paymentSync() {
  35. fsStorePaymentService.paymentSync();
  36. }
  37. /**
  38. * 超时订单自动取消
  39. */
  40. @QuartzRunnable(name = "超时订单自动取消")
  41. public void orderCancel(){
  42. fsStoreOrderService.orderCancel();
  43. }
  44. /**
  45. * 同步银行参数为空的问题
  46. */
  47. @QuartzRunnable(name = "同步银行参数为空的问题")
  48. public void fixTransactionNull(){
  49. List<FsStorePayment> list = fsStorePaymentMapper.queryNormalData();
  50. for (FsStorePayment fsStorePayment : list) {
  51. String json = configService.selectConfigByKey("store.pay");
  52. FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
  53. OrderQueryDTO orderQueryDTO = new OrderQueryDTO();
  54. orderQueryDTO.setAccount(fsPayConfig.getYbAccount());
  55. orderQueryDTO.setUpOrderId(fsStorePayment.getTradeNo());
  56. OrderResult order = payService.getOrder(orderQueryDTO);
  57. if(order != null) {
  58. fsStorePayment.setBankTransactionId(order.getBankTrxId());
  59. fsStorePayment.setBankSerialNo(order.getBankOrderId());
  60. }
  61. fsStorePaymentMapper.updateFsStorePayment(fsStorePayment);
  62. }
  63. }
  64. }