报关定时任务

master
james.zhao 6 years ago
parent 73a3ee88b4
commit dcc9529f93

@ -110,7 +110,7 @@ public class CustomServiceImpl implements CustomService {
// if (report.getIntValue("report_status") != 2) { // if (report.getIntValue("report_status") != 2) {
// throw new BadRequestException("order can't report"); // throw new BadRequestException("order can't report");
// } // }
customSupport.sendCustom(report_id); customSupport.resendCustom(report_id);
} }

@ -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<JSONObject> 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"));
}
}
}
}
}
Loading…
Cancel
Save