|
|
@@ -1,5 +1,6 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@@ -49,6 +50,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
@@ -154,6 +156,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
crawlerQuoteRequest.setDiscount(t.getDiscount());
|
|
|
// 是否需要验车
|
|
|
crawlerQuoteRequest.setIsInspect(t.getIsInspect());
|
|
|
+ // 永安商业折扣
|
|
|
+ crawlerQuoteRequest.setYaBusinessDiscount(t.getYaBusinessDiscount());
|
|
|
+ // 恒邦折扣
|
|
|
+ crawlerQuoteRequest.setHopecoefficient(t.getCoefficient());
|
|
|
// 上次订单
|
|
|
if (StringUtils.isNotEmpty(t.getLastCompanyId())) {
|
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getById(t.getLastCompanyId());
|
|
|
@@ -290,6 +296,15 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
}
|
|
|
} else if (t.getCompanyId().equals("PICC000000")) {
|
|
|
quoteRespVo.setPreDiscount(response.getOther().getBiDiscount());
|
|
|
+ } else if (t.getCompanyId().equals("CCIC1000000")) {
|
|
|
+ quoteRespVo.setSyAdjustRate(response.getOther().getHopecoefficient());
|
|
|
+ // 浮动原因 设置为过户车 并保存到主订单上
|
|
|
+ if (quoteRespVo.getReasonNoFluctuation().equals("1")) {
|
|
|
+ InsOrders insOrders = insOrdersService.getById(quoteInfoVo.getOrderNo());
|
|
|
+ JSONObject carinfo = insOrders.getCarinfo();
|
|
|
+ carinfo.put("transferFlag", true);
|
|
|
+ insOrdersService.updateById(insOrders);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//处理订单信息
|
|
|
@@ -588,6 +603,8 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
quoteRespVo.setCifeeFloat(other.getCifeeFloat());
|
|
|
// 商业费用浮动
|
|
|
quoteRespVo.setBifeeFloat(other.getBifeeFloat());
|
|
|
+ // 永安商业折扣
|
|
|
+ quoteRespVo.setYaBusinessDiscount(other.getSyDiscount());
|
|
|
|
|
|
quoteRespVo.setTotalAdjustRate(StringUtils.toDouble(other.getDiscount()));
|
|
|
quoteRespVo.setJqAdjustRate(other.getJqDiscount());
|
|
|
@@ -646,6 +663,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
if(other.getBiDiscount() != null && !other.getBiDiscount().isEmpty()){
|
|
|
quoteRespVo.setPreDiscount(other.getBiDiscount());
|
|
|
}
|
|
|
+ // 大地不浮动原因
|
|
|
+ if(other.getReasonNoFluctuation() != null){
|
|
|
+ quoteRespVo.setReasonNoFluctuation(other.getReasonNoFluctuation());
|
|
|
+ }
|
|
|
return quoteRespVo;
|
|
|
}
|
|
|
|
|
|
@@ -653,14 +674,25 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
PtlAgreementAttribution ptlAgreementAttribution,
|
|
|
InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving,
|
|
|
BaseQuoteInfoVo quoteInfoVo) {
|
|
|
+
|
|
|
+ // 赋值非车份数
|
|
|
+ if (quoteRespVo.getAccidentInfo() != null && !quoteRespVo.getAccidentInfo().isEmpty()) {
|
|
|
+ AccidentResponseVo o = quoteRespVo.getAccidentInfo().get(0);
|
|
|
+ if (Objects.nonNull(o)) {
|
|
|
+ o.setQuantity(String.valueOf(insAreaCompanyAccidentalDriving.getQuantity()));
|
|
|
+ // 爬虫返回的驾意险名称有可能和系统内的不一致 重置下驾意险名称
|
|
|
+ o.setProjectName(insAreaCompanyAccidentalDriving.getRideRiskName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//保存订单信息
|
|
|
InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
|
|
|
-//在修改中
|
|
|
+
|
|
|
+ //在修改中
|
|
|
insAreaCompany.setCarInfo(JSON.toJSONString(quoteInfoVo.getCarInfo()));
|
|
|
insAreaCompany.setOwnerInfo(JSON.toJSONString(quoteInfoVo.getOwnerInfo()));
|
|
|
insAreaCompany.setApplyInfo(JSON.toJSONString(quoteInfoVo.getPolicyHolderInfo()));
|
|
|
insAreaCompany.setInsureInfo(JSON.toJSONString(quoteInfoVo.getInsuredPersonInfo()));
|
|
|
-
|
|
|
insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(quoteRespVo.getTaxArrears())));
|
|
|
|
|
|
// 此单是否需要验车
|
|
|
@@ -724,7 +756,25 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
insAreaCompany.setExtendInfo(extendInfo.toString());
|
|
|
}
|
|
|
|
|
|
+ // 赔付率
|
|
|
+ if(Objects.nonNull(response.getOther().getLossRation())) {
|
|
|
+ quoteRespVo.setLossRation(Double.parseDouble(response.getOther().getLossRation()));
|
|
|
+ insAreaCompany.setLossRation(Double.parseDouble(response.getOther().getLossRation()));
|
|
|
+ }
|
|
|
+ // 交强赔付率
|
|
|
+ if(Objects.nonNull(response.getOther().getJqLossRation())) {
|
|
|
+ quoteRespVo.setJqLossRation(Double.parseDouble(response.getOther().getJqLossRation()));
|
|
|
+ insAreaCompany.setJqLossRation(Double.parseDouble(response.getOther().getJqLossRation()));
|
|
|
+ }
|
|
|
+ // 商业赔付率
|
|
|
+ if(Objects.nonNull(response.getOther().getSyLossRation())) {
|
|
|
+ quoteRespVo.setSyLossRation(Double.parseDouble(response.getOther().getSyLossRation()));
|
|
|
+ insAreaCompany.setSyLossRation(Double.parseDouble(response.getOther().getSyLossRation()));
|
|
|
+ }
|
|
|
|
|
|
+ if(Objects.nonNull(response.getOther().getReasonNoFluctuation())){
|
|
|
+ insAreaCompany.setReasonNoFluctuation(response.getOther().getReasonNoFluctuation());
|
|
|
+ }
|
|
|
|
|
|
insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDriving);
|
|
|
//清空驾意险信息 重新复制
|
|
|
@@ -865,6 +915,12 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
.isEmpty()) ? vo.getJyxInfoList()
|
|
|
.get(0)
|
|
|
.getJyxPolicyUrl() : null;
|
|
|
+
|
|
|
+ if(!CollectionUtils.isEmpty(vo.getJyxInfoList())){
|
|
|
+ CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = vo.getJyxInfoList().get(0);
|
|
|
+ insAreaCompany.setJyPolicyNo(jyxInfoListDTO.getApplication());
|
|
|
+ }
|
|
|
+
|
|
|
InsAreaCompanyExternalPolicy insAreaCompanyExternalPolicy = new InsAreaCompanyExternalPolicy(insAreaCompany.getId(), vo.getJqxPolicyUrl(), vo.getSyxPolicyUrl(), jyPath, vo.getJqxFlagUrl());
|
|
|
return new ReadPdfUrlListDto(insAreaCompanyExternalPolicy, insAreaCompany, null);
|
|
|
}
|
|
|
@@ -1045,7 +1101,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
public JSONObject sendLoginSmsCode(PtlAgreementAttributionDto agreementAttributionDto) {
|
|
|
// InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
|
|
|
PtlAgreementAttribution attribution = ptlAgreementAttributionService.getOne(new LambdaQueryWrapper<PtlAgreementAttribution>()
|
|
|
- .eq(PtlAgreementAttribution::getTemplateId,agreementAttributionDto.getTemplateId()));
|
|
|
+ .eq(PtlAgreementAttribution::getId,agreementAttributionDto.getId()));
|
|
|
|
|
|
PtlAgreementAttributionDto attributionDto = new PtlAgreementAttributionDto();
|
|
|
BeanUtils.copyProperties(attribution, attributionDto);
|
|
|
@@ -1068,6 +1124,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
// 泰山发送验证码
|
|
|
if (attribution.getInsCompanyId().equals("TSBX1000000")){
|
|
|
TsCrawlerLoginRequest crawlerLoginRequest = new TsCrawlerLoginRequest(attributionDto);
|
|
|
+
|
|
|
TsCrawlerBaseResponse tsResponse = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.TSBX.getCode(), "获取验证码",
|
|
|
crawlerLoginRequest, TsCrawlerBaseResponse.class);
|
|
|
if (!tsResponse.getCode().equals(200)) {
|
|
|
@@ -1076,8 +1133,24 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
// 将返回参数放入redis
|
|
|
redisTemplate.opsForValue().set(InsuranceEnum.TSBX.getCode()+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(tsResponse.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
|
|
|
TimeUnit.SECONDS);
|
|
|
+ response = (JSONObject) JSON.toJSON(tsResponse);
|
|
|
+ }
|
|
|
+ // 诚泰发送验证码
|
|
|
+ if (attribution.getInsCompanyId().equals("CHAC1000000")){
|
|
|
+ CtCrawlerLoginRequest crawlerLoginRequest = new CtCrawlerLoginRequest(attributionDto);
|
|
|
+ LinkedHashMap<String,String> other = new LinkedHashMap<>();
|
|
|
+ other.put("phone",agreementAttributionDto.getPhone());
|
|
|
+ crawlerLoginRequest.setOther(other);
|
|
|
+ crawlerLoginRequest.setCheck("zs");
|
|
|
+ response = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.CHAC.getCode(), "获取验证码",
|
|
|
+ crawlerLoginRequest, JSONObject.class);
|
|
|
+ if (!response.getInteger("code").equals(200)) {
|
|
|
+ throw new SystemException(response.getString("message"));
|
|
|
+ }
|
|
|
+ // 将返回参数放入redis
|
|
|
+ redisTemplate.opsForValue().set(InsuranceEnum.CHAC.getCode()+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(response.getString("data")), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
|
|
|
+ TimeUnit.SECONDS);
|
|
|
}
|
|
|
-// if (attribution.getInsCompanyId().equals(""))
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
@@ -1127,6 +1200,30 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
throw new SystemException("验证码已失效!请重新发送!");
|
|
|
}
|
|
|
}
|
|
|
+ else if(companyCode.equals(InsuranceEnum.CHAC.getCode())){
|
|
|
+ CtCrawlerLoginRequest ctCrawlerLoginRequest = new CtCrawlerLoginRequest();
|
|
|
+ ctCrawlerLoginRequest.setUsername(agreement.getAttribution().getUsername());
|
|
|
+ ctCrawlerLoginRequest.setPwd(agreement.getAttribution().getPassword());
|
|
|
+ ctCrawlerLoginRequest.setOther(new LinkedHashMap<>());
|
|
|
+ ctCrawlerLoginRequest.getOther().put("phone",agreement.getAttribution().getPhone());
|
|
|
+ ctCrawlerLoginRequest.getOther().put("mescoed",agreement.getAgreement().getSmsCode());
|
|
|
+ PtlAgreementAttributionDto attribution = agreement.getAttribution();
|
|
|
+ if(CollUtil.isNotEmpty(attribution.getFields())){
|
|
|
+ ctCrawlerLoginRequest.getOther().putAll(attribution.getFields().stream().collect(LinkedHashMap::new, (m, v) -> m.put(v.getField(), v.getValue()), LinkedHashMap::putAll));
|
|
|
+ }
|
|
|
+ ctCrawlerLoginRequest.setCheck("zs");
|
|
|
+ // 组装 Other 信息
|
|
|
+ Map<String,String> otherMap = new HashMap<>();
|
|
|
+ agreement.getAttribution().getFields().forEach(item->{
|
|
|
+ otherMap.put(item.getField(),item.getValue());
|
|
|
+ });
|
|
|
+ JSONObject response = insCrawlerOrderComponents.request(apiUrl, agreement.getAgreement().getPartnerCompaniesId(), "登录",
|
|
|
+ ctCrawlerLoginRequest, JSONObject.class);
|
|
|
+ if (response.getInteger("code") != 200) {
|
|
|
+ throw new SystemException("登录失败:" + response.getString("token"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
else{
|
|
|
// 正常登录流程
|
|
|
}
|