|
@@ -25,6 +25,7 @@ import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Random;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 状态查询 并更新内部状态 定时任务
|
|
* 状态查询 并更新内部状态 定时任务
|
|
@@ -68,7 +69,7 @@ public class QueryStatusHandler {
|
|
|
|
|
|
|
|
@XxlJob("queryStatusHandler")
|
|
@XxlJob("queryStatusHandler")
|
|
|
public void queryStatus() {
|
|
public void queryStatus() {
|
|
|
-
|
|
|
|
|
|
|
+ Random random = new Random();
|
|
|
HashMap<String,Object> components = getComponents();
|
|
HashMap<String,Object> components = getComponents();
|
|
|
HashMap<String,String> time = get24HourTime();
|
|
HashMap<String,String> time = get24HourTime();
|
|
|
//获取24小时内未支付的订单
|
|
//获取24小时内未支付的订单
|
|
@@ -76,15 +77,21 @@ public class QueryStatusHandler {
|
|
|
noPayList.forEach(insAreaCompany -> {
|
|
noPayList.forEach(insAreaCompany -> {
|
|
|
if(insAreaCompany.getAgreementId() != null) {
|
|
if(insAreaCompany.getAgreementId() != null) {
|
|
|
//实例化
|
|
//实例化
|
|
|
- BaseQueryStatusService queryStatusService = QueryStatusFactory.getQueryStatusService(components,insAreaCompany.getCompanyId());
|
|
|
|
|
- if (queryStatusService != null) {
|
|
|
|
|
- QueryStatusResult queryStatusResult = queryStatusService.queryStatus(insAreaCompany);
|
|
|
|
|
- if (queryStatusResult.getStatus()) {
|
|
|
|
|
- //更新 ins_area_company
|
|
|
|
|
- insAreaCompany.setInsideOrderStatus(Integer.parseInt(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode()));
|
|
|
|
|
- insAreaCompany.setInsidePayTime(queryStatusResult.getPayTime());
|
|
|
|
|
- insAreaCompanyMapper.updateById(insAreaCompany);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ //添加延迟
|
|
|
|
|
+ Thread.sleep((random.nextInt(5) + 1) * 1000);
|
|
|
|
|
+ BaseQueryStatusService queryStatusService = QueryStatusFactory.getQueryStatusService(components, insAreaCompany.getCompanyId());
|
|
|
|
|
+ if (queryStatusService != null) {
|
|
|
|
|
+ QueryStatusResult queryStatusResult = queryStatusService.queryStatus(insAreaCompany);
|
|
|
|
|
+ if (queryStatusResult.getStatus()) {
|
|
|
|
|
+ //更新 ins_area_company
|
|
|
|
|
+ insAreaCompany.setInsideOrderStatus(Integer.parseInt(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode()));
|
|
|
|
|
+ insAreaCompany.setInsidePayTime(queryStatusResult.getPayTime());
|
|
|
|
|
+ insAreaCompanyMapper.updateById(insAreaCompany);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ }catch(Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|