|
@@ -30,6 +30,7 @@ import com.ydtech.modules.order.entity.po.SysQuoteRecord;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
import com.ydtech.modules.order.service.*;
|
|
import com.ydtech.modules.order.service.*;
|
|
|
|
|
+import com.ydtech.modules.order.utils.QrCodeGenerator;
|
|
|
import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
|
|
import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
|
|
|
import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
|
|
import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
|
|
|
import com.ydtech.modules.protocol.entity.dto.PtlAttributionTemplateDto;
|
|
import com.ydtech.modules.protocol.entity.dto.PtlAttributionTemplateDto;
|
|
@@ -50,8 +51,12 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
|
|
+import javax.imageio.ImageIO;
|
|
|
|
|
+import java.awt.image.BufferedImage;
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
|
+import java.net.URL;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -338,7 +343,15 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
// 请求地址
|
|
// 请求地址
|
|
|
String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_4);
|
|
String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_4);
|
|
|
//组装参数
|
|
//组装参数
|
|
|
- CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
|
|
|
|
|
|
|
+ CrawlerBaseRequest crawlerBaseRequest;
|
|
|
|
|
+ if(insAreaCompany.getCompanyId().equals("ZKIC1000000")) {
|
|
|
|
|
+ String extendInfoStr = String.valueOf(insAreaCompany.getExtendInfo());
|
|
|
|
|
+ JSONObject extendInfo = JSONObject.parseObject(extendInfoStr);
|
|
|
|
|
+ crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),
|
|
|
|
|
+ ptlAgreementAttribution.getUsername(), extendInfo.getString("proposalCheckNo"));
|
|
|
|
|
+ }else {
|
|
|
|
|
+ crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
|
|
|
|
|
+ }
|
|
|
CrawlerAuditResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
|
|
CrawlerAuditResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
|
|
|
PtlCrawlerApiType.API_4.getDesc(), crawlerBaseRequest, CrawlerAuditResponse.class);
|
|
PtlCrawlerApiType.API_4.getDesc(), crawlerBaseRequest, CrawlerAuditResponse.class);
|
|
|
|
|
|
|
@@ -651,6 +664,13 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
|
|
|
|
|
// 保险公司订单号
|
|
// 保险公司订单号
|
|
|
insAreaCompany.setInsOrderNo(response.getOrderNo());
|
|
insAreaCompany.setInsOrderNo(response.getOrderNo());
|
|
|
|
|
+ // 紫金 爬虫 添加订单id 到扩展字段中
|
|
|
|
|
+ if(insAreaCompany.getApiType() == 2 && insAreaCompany.getCompanyId().equals("ZKIC1000000")){
|
|
|
|
|
+ JSONObject extendInfo = new JSONObject();
|
|
|
|
|
+ extendInfo.put("proposalCheckNo",response.getOther().getProposalCheckNo());
|
|
|
|
|
+ insAreaCompany.setExtendInfo(extendInfo.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDriving);
|
|
insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDriving);
|
|
|
//清空驾意险信息 重新复制
|
|
//清空驾意险信息 重新复制
|
|
|
// quoteRespVo.getAccident().clear();
|
|
// quoteRespVo.getAccident().clear();
|
|
@@ -924,4 +944,58 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
throw new SystemException("验证码已失效!请重新发送!");
|
|
throw new SystemException("验证码已失效!请重新发送!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean yaSendCode(String companyId,String smsCode) {
|
|
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
|
|
|
|
|
+ PtlAgreementAttribution attribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
|
|
|
|
|
+ PtlAgreementAttributionDto attributionDto = new PtlAgreementAttributionDto();
|
|
|
|
|
+ BeanUtils.copyProperties(attribution, attributionDto);
|
|
|
|
|
+ String apiUrl = ptlCrawlerApiService.getByTemplateId(attributionDto.getTemplateId(), PtlCrawlerApiType.API_12);
|
|
|
|
|
+ YaCrawlerSendSmsCodeRequest crawlerSendSmsCodeRequest = new YaCrawlerSendSmsCodeRequest(attributionDto,insAreaCompany.getInsOrderNo(),"" );
|
|
|
|
|
+ YaCrawlerSendSmsCodeResponse response = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.TSBX.getCode(), "获取验证码",
|
|
|
|
|
+ crawlerSendSmsCodeRequest, YaCrawlerSendSmsCodeResponse.class);
|
|
|
|
|
+ if (response.getCode() == 200){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public YaCrawlerVerifyCodeResponse yaVerifyCode(String companyId,String smsCode) throws Exception {
|
|
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
|
|
|
|
|
+ PtlAgreementAttribution attribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
|
|
|
|
|
+ PtlAgreementAttributionDto attributionDto = new PtlAgreementAttributionDto();
|
|
|
|
|
+ BeanUtils.copyProperties(attribution, attributionDto);
|
|
|
|
|
+ String apiUrl = ptlCrawlerApiService.getByTemplateId(attributionDto.getTemplateId(), PtlCrawlerApiType.API_13);
|
|
|
|
|
+ YaCrawlerSendSmsCodeRequest crawlerSendSmsCodeRequest = new YaCrawlerSendSmsCodeRequest(attributionDto,insAreaCompany.getInsOrderNo(),smsCode );
|
|
|
|
|
+ YaCrawlerVerifyCodeResponse response = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.TSBX.getCode(), "校验验证码",
|
|
|
|
|
+ crawlerSendSmsCodeRequest, YaCrawlerVerifyCodeResponse.class);
|
|
|
|
|
+ if (response.getCode() == 200){
|
|
|
|
|
+ //回写订单数据
|
|
|
|
|
+ insAreaCompany.setJqapplyno(response.getJQ_Policy());
|
|
|
|
|
+ insAreaCompany.setSyapplyno(response.getSY_Policy());
|
|
|
|
|
+ BufferedImage bufferedImage = ImageFromUrl(response.getPay_url());
|
|
|
|
|
+ if (bufferedImage != null) {
|
|
|
|
|
+ String pay_url = QrCodeGenerator.decodeQrCode(bufferedImage);
|
|
|
|
|
+ insAreaCompany.setPaymentLink(pay_url);
|
|
|
|
|
+ }
|
|
|
|
|
+ insAreaCompanyService.updateById(insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return response;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public BufferedImage ImageFromUrl(String urlAddr) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ URL url = new URL(urlAddr); // 网络图片URL
|
|
|
|
|
+ BufferedImage image = ImageIO.read(url);
|
|
|
|
|
+ return image;
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|