From dcc9529f9339f76a577ae569df26a7a023a04a19 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Tue, 2 Apr 2019 18:12:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=85=B3=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/core/impl/CustomServiceImpl.java | 2 +- .../manage/custom/task/CustomQueryTask.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/custom/task/CustomQueryTask.java diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java index 47694c5e7..96a4b83f3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java @@ -110,7 +110,7 @@ public class CustomServiceImpl implements CustomService { // if (report.getIntValue("report_status") != 2) { // throw new BadRequestException("order can't report"); // } - customSupport.sendCustom(report_id); + customSupport.resendCustom(report_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/task/CustomQueryTask.java b/src/main/java/au/com/royalpay/payment/manage/custom/task/CustomQueryTask.java new file mode 100644 index 000000000..07e30a2f7 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/custom/task/CustomQueryTask.java @@ -0,0 +1,38 @@ +package au.com.royalpay.payment.manage.custom.task; + +import au.com.royalpay.payment.core.CustomSupport; +import au.com.royalpay.payment.core.mappers.PmtCustomReportMapper; +import com.alibaba.fastjson.JSONObject; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @Author: james7whm + * @Date: 2019/4/2 18:11 + */ +@Component +@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true") +public class CustomQueryTask { + @Resource + private CustomSupport customSupport; + + @Resource + private PmtCustomReportMapper pmtCustomReportMapper; + + @Scheduled(cron = "0 0/10 * * * *") + public void customReportQuery(){ + List reports = pmtCustomReportMapper.findCustomReportNotScucess(); + if(!reports.isEmpty()){ + for (JSONObject report:reports) { + //Alipay直接返回成功与否,Wechat返回的结果较多,成功提交至海关后状态才会变为success,因此只有Wechat需要定时查询报关单状态 + if(report.getString("channel").equals("Wechat")){ + customSupport.queryCustomResult(report.getString("report_id")); + } + } + } + } +}