|
|
@@ -11,6 +11,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.jzg.commons.constants.ProductsType;
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
import com.jzg.commons.constants.quote.enums.base.InsuranceImageEnum;
|
|
|
+import com.jzg.commons.entity.orders.po.InsOrders;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrdersCarUserInfo;
|
|
|
import com.jzg.commons.entity.po.SysUploadFiles;
|
|
|
import com.jzg.commons.entity.quote.vo.AttributionInformationVo;
|
|
|
@@ -621,8 +622,71 @@ public class HengBangCrawlerRequestImpl implements HengBangCrawlerRequest {
|
|
|
HttpHeaders headers = hbCrawlerRequestComponent.getHeaders(attributionInformationVo.getUsername(), attributionInformationVo.getPassword());
|
|
|
HengBangCrawlerConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(HengBangCrawlerConfigureParameters.class, attributionInformationVo.getConfigInfo());
|
|
|
|
|
|
+ OrderStatusResultVo orderStatusResultVo = new OrderStatusResultVo();
|
|
|
HbCrawlerOrderStateResponse orderStateResponse = hbCrawlerRequestComponent.orderState(parameters.getLicenseNo(), parameters.getAppTime(), attributionInformationVo.getUsername(), headers);
|
|
|
- return null;
|
|
|
+ if (orderStateResponse == null || CollUtil.isEmpty(orderStateResponse.getContent())) {
|
|
|
+ return orderStatusResultVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取订单信息
|
|
|
+ HbCrawlerOrder hbCrawlerOrder = hbCrawlerOrderService.findByOrdersNo(orderStatusVo.getOrder().getOrdersNo());
|
|
|
+ InsOrders insOrders = orderStatusVo.getInsOrders();
|
|
|
+
|
|
|
+ // 匹配交强和商业投保单的记录(按投保单号一一对应)
|
|
|
+ HbCrawlerOrderStateResponse.ContentDTO ciContent = orderStateResponse.getContent().stream()
|
|
|
+ .filter(item -> hbCrawlerOrder != null && StringUtils.hasLength(hbCrawlerOrder.getCiProposalNo()) && hbCrawlerOrder.getCiProposalNo().equals(item.getPROPOSALNO()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ HbCrawlerOrderStateResponse.ContentDTO biContent = orderStateResponse.getContent().stream()
|
|
|
+ .filter(item -> hbCrawlerOrder != null && StringUtils.hasLength(hbCrawlerOrder.getBiProposalNo()) && hbCrawlerOrder.getBiProposalNo().equals(item.getPROPOSALNO()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+
|
|
|
+ // 获取交强和商业的保单号
|
|
|
+ String ciPolicyNo = ciContent != null ? ciContent.getPOLICYNO() : null;
|
|
|
+ String biPolicyNo = biContent != null ? biContent.getPOLICYNO() : null;
|
|
|
+ boolean ciHasPolicy = StringUtils.hasLength(ciPolicyNo);
|
|
|
+ boolean biHasPolicy = StringUtils.hasLength(biPolicyNo);
|
|
|
+
|
|
|
+ // 核保是否通过(待提核:-1;审核通过:1,3,5;下发修改:2;拒保:4;承保确认:6;初始状态:0)
|
|
|
+ boolean ciAuditPassed = ciContent != null && isAuditPassed(ciContent.getUNDERWRITESTATUS());
|
|
|
+ boolean biAuditPassed = biContent != null && isAuditPassed(biContent.getUNDERWRITESTATUS());
|
|
|
+
|
|
|
+ // 待核保状态 → 核保通过 → 待缴费(与API版逻辑保持一致)
|
|
|
+ if (insOrders != null && InsOrderStatusEnum.WAIT_AUDIT.getCode().equals(insOrders.getOrderStatus())) {
|
|
|
+ // 单交 / 单商 / 交商 任一核保通过即转为待缴费
|
|
|
+ boolean jqBoo = ciContent != null && biContent == null && ciAuditPassed;
|
|
|
+ boolean syBoo = biContent != null && ciContent == null && biAuditPassed;
|
|
|
+ boolean jqSyBoo = ciContent != null && biContent != null && ciAuditPassed && biAuditPassed;
|
|
|
+ if (jqBoo || syBoo || jqSyBoo) {
|
|
|
+ orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.PAY_PENDING);
|
|
|
+ PaymentLinkVo paymentLinkVo = new PaymentLinkVo();
|
|
|
+ paymentLinkVo.setOrder(orderStatusVo.getOrder());
|
|
|
+ PaymentLinkResultsVo paymentLinkResultsVo = getPaymentLink(paymentLinkVo);
|
|
|
+ orderStatusResultVo.setPaymentLink(paymentLinkResultsVo.getPaymentLink());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保单号存在 → 已承保/已出单
|
|
|
+ if (ciHasPolicy || biHasPolicy) {
|
|
|
+ if (ciHasPolicy) {
|
|
|
+ orderStatusResultVo.setJqPolicyno(ciPolicyNo);
|
|
|
+ orderStatusResultVo.setJqApplyNo(hbCrawlerOrder.getCiProposalNo());
|
|
|
+ }
|
|
|
+ if (biHasPolicy) {
|
|
|
+ orderStatusResultVo.setSyPolicyno(biPolicyNo);
|
|
|
+ orderStatusResultVo.setSyApplyNo(hbCrawlerOrder.getBiProposalNo());
|
|
|
+ }
|
|
|
+ orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.UNDERWRITED);
|
|
|
+ }
|
|
|
+
|
|
|
+ return orderStatusResultVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 核保是否通过
|
|
|
+ * 恒邦状态:待提核-1;审核通过1,3,5;下发修改2;拒保4;承保确认6;初始状态0
|
|
|
+ */
|
|
|
+ private boolean isAuditPassed(String underWriteStatus) {
|
|
|
+ return "1".equals(underWriteStatus) || "3".equals(underWriteStatus) || "5".equals(underWriteStatus);
|
|
|
}
|
|
|
|
|
|
|