|
@@ -1,5 +1,6 @@
|
|
|
package com.ydtech.modules.xxl.handler;
|
|
package com.ydtech.modules.xxl.handler;
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
@@ -10,6 +11,10 @@ import com.ydtech.modules.order.components.gouren.GuorenRequestApiComponent;
|
|
|
import com.ydtech.modules.order.components.huatai.HuaTaiRequestApiComponents;
|
|
import com.ydtech.modules.order.components.huatai.HuaTaiRequestApiComponents;
|
|
|
import com.ydtech.modules.order.components.yongcheng.YongchengRequestApiComponents;
|
|
import com.ydtech.modules.order.components.yongcheng.YongchengRequestApiComponents;
|
|
|
import com.ydtech.modules.order.components.zijin.ZijinRequestApiComponents;
|
|
import com.ydtech.modules.order.components.zijin.ZijinRequestApiComponents;
|
|
|
|
|
+import com.ydtech.modules.order.dao.InsOrdersMapper;
|
|
|
|
|
+import com.ydtech.modules.order.entity.InsOrders;
|
|
|
|
|
+import com.ydtech.modules.order.entity.InsOrdersTrack;
|
|
|
|
|
+import com.ydtech.modules.order.service.InsOrdersTrackService;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
|
import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
|
|
import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
|
|
|
import com.ydtech.modules.xxl.mapper.XxlInsAreaCompanyMapper;
|
|
import com.ydtech.modules.xxl.mapper.XxlInsAreaCompanyMapper;
|
|
@@ -33,6 +38,9 @@ import java.util.Random;
|
|
|
@Component
|
|
@Component
|
|
|
public class QueryStatusHandler {
|
|
public class QueryStatusHandler {
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ InsOrdersMapper insOrdersMapper;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
XxlInsAreaCompanyMapper insAreaCompanyMapper;
|
|
XxlInsAreaCompanyMapper insAreaCompanyMapper;
|
|
|
|
|
|
|
@@ -66,16 +74,18 @@ public class QueryStatusHandler {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
PtlAgreementAttributionService ptlAgreementAttributionService;
|
|
PtlAgreementAttributionService ptlAgreementAttributionService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ InsOrdersTrackService insOrdersTrackService;
|
|
|
|
|
|
|
|
@XxlJob("queryStatusHandler")
|
|
@XxlJob("queryStatusHandler")
|
|
|
public void queryStatus() {
|
|
public void queryStatus() {
|
|
|
Random random = new Random();
|
|
Random random = new Random();
|
|
|
- HashMap<String,Object> components = getComponents();
|
|
|
|
|
- HashMap<String,String> time = get24HourTime();
|
|
|
|
|
|
|
+ HashMap<String, Object> components = getComponents();
|
|
|
|
|
+ HashMap<String, String> time = get24HourTime();
|
|
|
//获取24小时内未支付的订单
|
|
//获取24小时内未支付的订单
|
|
|
List<InsAreaCompany> noPayList = insAreaCompanyMapper.getNoPayList(time.get("startTime"), time.get("endTime"));
|
|
List<InsAreaCompany> noPayList = insAreaCompanyMapper.getNoPayList(time.get("startTime"), time.get("endTime"));
|
|
|
noPayList.forEach(insAreaCompany -> {
|
|
noPayList.forEach(insAreaCompany -> {
|
|
|
- if(insAreaCompany.getAgreementId() != null) {
|
|
|
|
|
|
|
+ if (insAreaCompany.getAgreementId() != null) {
|
|
|
//实例化
|
|
//实例化
|
|
|
try {
|
|
try {
|
|
|
//添加延迟
|
|
//添加延迟
|
|
@@ -87,10 +97,32 @@ public class QueryStatusHandler {
|
|
|
//更新 ins_area_company
|
|
//更新 ins_area_company
|
|
|
insAreaCompany.setInsideOrderStatus(Integer.parseInt(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode()));
|
|
insAreaCompany.setInsideOrderStatus(Integer.parseInt(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode()));
|
|
|
insAreaCompany.setInsidePayTime(queryStatusResult.getPayTime());
|
|
insAreaCompany.setInsidePayTime(queryStatusResult.getPayTime());
|
|
|
|
|
+ //设置支付时间
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ LocalDateTime dateTime = LocalDateTime.parse(queryStatusResult.getPayTime(), formatter);
|
|
|
|
|
+ insAreaCompany.setPayDate(dateTime);
|
|
|
|
|
+ //设置状态为已承保
|
|
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
insAreaCompanyMapper.updateInsideOrder(insAreaCompany);
|
|
insAreaCompanyMapper.updateInsideOrder(insAreaCompany);
|
|
|
|
|
+ InsOrders insOrders = insOrdersMapper.selectOne(new LambdaQueryWrapper<InsOrders>().eq(InsOrders::getOrderno, insAreaCompany.getOrderno()));
|
|
|
|
|
+ //设置主订单为已承保
|
|
|
|
|
+ insOrders.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
|
|
+ insOrdersMapper.updateStatus(insOrders.getOrderno(),InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
|
|
+
|
|
|
|
|
+ //添加轨迹信息
|
|
|
|
|
+ InsOrdersTrack insOrdersTrack = new InsOrdersTrack();
|
|
|
|
|
+ insOrdersTrack.setOrderNo(insAreaCompany.getOrderno());
|
|
|
|
|
+ insOrdersTrack.setInsCompany(insAreaCompany.getInscompany());
|
|
|
|
|
+ insOrdersTrack.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
|
|
+ insOrdersTrack.setSuborder(insAreaCompany.getId());
|
|
|
|
|
+ insOrdersTrack.setOrderStatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
|
|
+ insOrdersTrack.setOperatorId("admin");
|
|
|
|
|
+ insOrdersTrack.setOperator("自动操作");
|
|
|
|
|
+ insOrdersTrack.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ insOrdersTrackService.save(insOrdersTrack);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }catch(Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -98,31 +130,31 @@ public class QueryStatusHandler {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- private HashMap<String,Object> getComponents(){
|
|
|
|
|
- HashMap<String,Object> components = new HashMap<>();
|
|
|
|
|
- components.put("configureParametersComponents",configureParametersComponents);
|
|
|
|
|
- components.put("daJiaRequestApiComponents",daJiaRequestApiComponents);
|
|
|
|
|
- components.put("yongchengRequestApiComponents",yongchengRequestApiComponents);
|
|
|
|
|
- components.put("guorenRequestApiComponent",guorenRequestApiComponent);
|
|
|
|
|
- components.put("huaTaiRequestApiComponents",huaTaiRequestApiComponents);
|
|
|
|
|
- components.put("zhongmeiRequestApiComponents",zhongmeiRequestApiComponents);
|
|
|
|
|
- components.put("zijinRequestApiComponents",zijinRequestApiComponents);
|
|
|
|
|
- components.put("insCrawlerOrderComponents",insCrawlerOrderComponents);
|
|
|
|
|
- components.put("ptlCrawlerApiService",ptlCrawlerApiService);
|
|
|
|
|
- components.put("ptlAgreementAttributionService",ptlAgreementAttributionService);
|
|
|
|
|
|
|
+ private HashMap<String, Object> getComponents() {
|
|
|
|
|
+ HashMap<String, Object> components = new HashMap<>();
|
|
|
|
|
+ components.put("configureParametersComponents", configureParametersComponents);
|
|
|
|
|
+ components.put("daJiaRequestApiComponents", daJiaRequestApiComponents);
|
|
|
|
|
+ components.put("yongchengRequestApiComponents", yongchengRequestApiComponents);
|
|
|
|
|
+ components.put("guorenRequestApiComponent", guorenRequestApiComponent);
|
|
|
|
|
+ components.put("huaTaiRequestApiComponents", huaTaiRequestApiComponents);
|
|
|
|
|
+ components.put("zhongmeiRequestApiComponents", zhongmeiRequestApiComponents);
|
|
|
|
|
+ components.put("zijinRequestApiComponents", zijinRequestApiComponents);
|
|
|
|
|
+ components.put("insCrawlerOrderComponents", insCrawlerOrderComponents);
|
|
|
|
|
+ components.put("ptlCrawlerApiService", ptlCrawlerApiService);
|
|
|
|
|
+ components.put("ptlAgreementAttributionService", ptlAgreementAttributionService);
|
|
|
return components;
|
|
return components;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private HashMap<String,String> get24HourTime(){
|
|
|
|
|
- HashMap<String,String> components = new HashMap<>();
|
|
|
|
|
|
|
+ private HashMap<String, String> get24HourTime() {
|
|
|
|
|
+ HashMap<String, String> components = new HashMap<>();
|
|
|
// 获取当前时间
|
|
// 获取当前时间
|
|
|
LocalDateTime currentTime = LocalDateTime.now();
|
|
LocalDateTime currentTime = LocalDateTime.now();
|
|
|
// 获取前24小时的时间
|
|
// 获取前24小时的时间
|
|
|
LocalDateTime previous24Hours = currentTime.minus(Duration.ofHours(24));
|
|
LocalDateTime previous24Hours = currentTime.minus(Duration.ofHours(24));
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
LocalDateTime current = LocalDateTime.now();
|
|
LocalDateTime current = LocalDateTime.now();
|
|
|
- components.put("startTime",previous24Hours.format(formatter));
|
|
|
|
|
- components.put("endTime",current.format(formatter));
|
|
|
|
|
|
|
+ components.put("startTime", previous24Hours.format(formatter));
|
|
|
|
|
+ components.put("endTime", current.format(formatter));
|
|
|
return components;
|
|
return components;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|