|
|
@@ -13,7 +13,6 @@ import com.ydtech.config.DictEnumConfig;
|
|
|
import com.ydtech.constants.InsuranceEnum;
|
|
|
import com.ydtech.constants.enums.dict.DictionaryData;
|
|
|
import com.ydtech.constants.enums.dict.DictionaryManagement;
|
|
|
-import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.constants.enums.dict.agreement.ProductsType;
|
|
|
import com.ydtech.constants.enums.dict.insurance.NatureOfVehicleUse;
|
|
|
@@ -51,6 +50,7 @@ import com.ydtech.modules.order.dao.InsOrdersMapper;
|
|
|
import com.ydtech.modules.order.entity.*;
|
|
|
import com.ydtech.modules.order.entity.crawler.response.CrawlerVerifyPaymentResponse;
|
|
|
import com.ydtech.modules.order.entity.dto.DrivingInsuranceDto;
|
|
|
+import com.ydtech.modules.order.entity.dto.InquiryDetalsQueryDto;
|
|
|
import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
|
|
|
import com.ydtech.modules.order.entity.vo.*;
|
|
|
import com.ydtech.modules.order.entity.vo.guoren.GuoRenQuoteVo;
|
|
|
@@ -1251,4 +1251,197 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
expirationInsure.setRecords(records);
|
|
|
return expirationInsure;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/6/24 18:14
|
|
|
+ * @Description: 通过子订单号查询询价详情信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public InquiryDetalsVo getInquiryDetalsBySubOrderIds(InquiryDetalsQueryDto inquiryDetalsDto) {
|
|
|
+ //通过其中一个子订单id查询主订单的id
|
|
|
+ if(inquiryDetalsDto.getSubOrderNos()==null || inquiryDetalsDto.getSubOrderNos().size()==0){
|
|
|
+ throw new SystemException("子订单号数组为空不能比价");
|
|
|
+ }
|
|
|
+ if(inquiryDetalsDto.getSubOrderNos()!=null && inquiryDetalsDto.getSubOrderNos().size()==1){
|
|
|
+ throw new SystemException("子订单号数据为一个不能比价");
|
|
|
+ }
|
|
|
+ String subOrderNo = inquiryDetalsDto.getSubOrderNos().get(0);
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
|
|
|
+ //主订单信息
|
|
|
+ InsOrders orders = this.getById(insAreaCompany.getOrderno());
|
|
|
+ InsOrderVo insOrderVo = getInsOrderVoDetals(orders);
|
|
|
+ List<List<String>> priceList=new ArrayList<>();
|
|
|
+ List<String> companyList=new ArrayList<>();
|
|
|
+ companyList.add("公司");
|
|
|
+ List<String> jqList=new ArrayList<>();
|
|
|
+ jqList.add("交强险");
|
|
|
+ List<String> syList=new ArrayList<>();
|
|
|
+ syList.add("商业险");
|
|
|
+ List<String> ccList=new ArrayList<>();
|
|
|
+ ccList.add("车船税");
|
|
|
+ List<String> jyList=new ArrayList<>();
|
|
|
+ jyList.add("驾意险");
|
|
|
+ List<String> zbfList=new ArrayList<>();
|
|
|
+ zbfList.add("总保费");
|
|
|
+ List<String> yhjList=new ArrayList<>();
|
|
|
+ yhjList.add("优惠金额");
|
|
|
+ List<String> yhhList=new ArrayList<>();
|
|
|
+ yhhList.add("优惠后");
|
|
|
+ List<String> yhhbjList=new ArrayList<>();
|
|
|
+ List<SubOrderVo> subOrderVos=new ArrayList<>();
|
|
|
+
|
|
|
+ if(inquiryDetalsDto.getSubOrderNos()!=null && inquiryDetalsDto.getSubOrderNos().size()>0){
|
|
|
+ for(String subOrderId :inquiryDetalsDto.getSubOrderNos()){
|
|
|
+ BigDecimal sumyh =BigDecimal.ZERO;
|
|
|
+ InsAreaCompany insAreaCompanySingle = insAreaCompanyService.getById(subOrderId);
|
|
|
+ //查询费用信息
|
|
|
+ InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
|
|
|
+ .eq(InsFeeOrderNew::getInsOrderNo, subOrderNo));
|
|
|
+ if (!Objects.isNull(insFeeOrderNew)) {
|
|
|
+ PtlAgreementProductCostsNew ptlAgreementProductCostsNew =
|
|
|
+ ptlAgreementProductCostsNewService.getById(insFeeOrderNew.getCostsId());
|
|
|
+ FeeOrderNewVo feeOrderNewVo = feeRuleSchemeService.newConvertOrderFeeVoData(insFeeOrderNew, ptlAgreementProductCostsNew);
|
|
|
+ //优惠信息
|
|
|
+ if(feeOrderNewVo!=null && feeOrderNewVo.getExportFee()!=null && feeOrderNewVo.getExportFee().size()>0){
|
|
|
+ sumyh = feeOrderNewVo.getExportFee()
|
|
|
+ .stream()
|
|
|
+ .map(FeeOrderNewVo.ExportFee::getTotalAmount)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SubOrderVo subOrderVo = new SubOrderVo(insAreaCompanySingle.getInscompany(), insAreaCompanySingle.getJqpremium(), getJQRiskList(insAreaCompanySingle),
|
|
|
+ insAreaCompanySingle.getSypremium(), insAreaCompanySingle.getKindinfo()==null?new JSONArray():insAreaCompanySingle.getKindinfo(),
|
|
|
+ insAreaCompanySingle.getTaxamount(), insAreaCompanySingle.getJypremium(), getJYRiskList(insAreaCompanySingle), insAreaCompanySingle.getSumpremium());
|
|
|
+ //保险公司名称
|
|
|
+ companyList.add(insAreaCompanySingle.getInscompany());
|
|
|
+ jqList.add(insAreaCompanySingle.getJqpremium().toString());
|
|
|
+ syList.add(insAreaCompanySingle.getSypremium().toString());
|
|
|
+ ccList.add(insAreaCompanySingle.getTaxamount().toString());
|
|
|
+ jyList.add(insAreaCompanySingle.getJypremium().toString());
|
|
|
+ zbfList.add(insAreaCompanySingle.getSumpremium().toString());
|
|
|
+ yhjList.add(sumyh.toString());
|
|
|
+ //优惠后金额
|
|
|
+ BigDecimal sumyhh = insAreaCompanySingle.getSumpremium().subtract(sumyh);
|
|
|
+ yhhList.add(sumyhh.toString());
|
|
|
+ yhhbjList.add(sumyhh.toString());
|
|
|
+ subOrderVos.add(subOrderVo);
|
|
|
+ }
|
|
|
+ priceList.add(companyList);
|
|
|
+ priceList.add(jqList);
|
|
|
+ priceList.add(syList);
|
|
|
+ priceList.add(ccList);
|
|
|
+ priceList.add(jyList);
|
|
|
+ priceList.add(zbfList);
|
|
|
+ priceList.add(yhjList);
|
|
|
+ priceList.add(yhhList);
|
|
|
+ }
|
|
|
+ //最优惠公司
|
|
|
+ String companyName = getCompanyNameByMinAmount(yhhbjList, companyList);
|
|
|
+ return new InquiryDetalsVo(insOrderVo,subOrderVos,priceList,companyName);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/6/25 9:47
|
|
|
+ * @Description: 获取优惠后最低的公司
|
|
|
+ */
|
|
|
+ private static String getCompanyNameByMinAmount(List<String> yhhbjList, List<String> companyList) {
|
|
|
+ int minIndex=0;
|
|
|
+ if(yhhbjList !=null && yhhbjList.size()>0){
|
|
|
+ String minValue = yhhbjList.get(0);
|
|
|
+ for (int i = 1; i < yhhbjList.size(); i++) {
|
|
|
+ if (minValue.compareTo(yhhbjList.get(i)) > 0) {
|
|
|
+ minIndex = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return companyList.get(minIndex+1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/6/25 9:13
|
|
|
+ * @Description: 获取驾意险信息
|
|
|
+ */
|
|
|
+ private JSONArray getJYRiskList(InsAreaCompany insAreaCompanySingle) {
|
|
|
+ InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving = insAreaCompanyAccidentalDrivingService.getByCompanyId(insAreaCompanySingle.getCompanyId());
|
|
|
+ if (insAreaCompanyAccidentalDriving != null) {
|
|
|
+ List<InsDrivingIntentionInsuranceSon> insDrivingIntentionInsuranceSon = insDrivingIntentionInsuranceService.getInsDrivingIntentionInsuranceSon(
|
|
|
+ insAreaCompanySingle.getCompanyId(),
|
|
|
+ insAreaCompanyAccidentalDriving.getRideRiskCode());
|
|
|
+ if(insDrivingIntentionInsuranceSon.size() == 1 && insDrivingIntentionInsuranceSon.get(0).getPremium() == null) {
|
|
|
+ insDrivingIntentionInsuranceSon.get(0).setPremium(insAreaCompanySingle.getJypremium().toString());
|
|
|
+ }
|
|
|
+ JSONArray accidentInfo = JSON.parseArray(JSON.toJSONString(insDrivingIntentionInsuranceSon));
|
|
|
+ return accidentInfo;
|
|
|
+ }else{
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/6/25 9:06
|
|
|
+ * @Description: 获取交强险险种列表
|
|
|
+ */
|
|
|
+ private static JSONArray getJQRiskList(InsAreaCompany insAreaCompanySingle) {
|
|
|
+ if(insAreaCompanySingle.getProductid().equals(ProductsType.PT_0330.getCode()) ||
|
|
|
+ insAreaCompanySingle.getProductid().equals(ProductsType.PT_0330034001.getCode()) ||
|
|
|
+ insAreaCompanySingle.getProductid().equals(ProductsType.PT_0330034002.getCode())) {
|
|
|
+ return JqInsuranceType.toJsonArray();
|
|
|
+ }else{
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/6/24 18:58
|
|
|
+ * @Description: 返回详情信息
|
|
|
+ */
|
|
|
+ private InsOrderVo getInsOrderVoDetals(InsOrders orders) {
|
|
|
+ JSONObject carinfo = orders.getCarinfo();
|
|
|
+ JSONObject ownerinfo = orders.getOwnerinfo();
|
|
|
+ JSONObject applyinfo = orders.getApplyinfo();
|
|
|
+ JSONObject insureinfo = orders.getInsureinfo();
|
|
|
+ InsOrderVo insOrderVo =new InsOrderVo(StringUtils.isEmpty(orders.getOrderno())?"":orders.getOrderno(),
|
|
|
+ StringUtils.isEmpty(orders.getFrameno())?"":orders.getFrameno(),
|
|
|
+ StringUtils.isEmpty(orders.getLicenseno())?"":orders.getLicenseno(),
|
|
|
+ StringUtils.isEmpty(carinfo.getString("brandName"))?"":carinfo.getString("brandName"),
|
|
|
+ StringUtils.isEmpty(carinfo.getString("engineNo"))?"":carinfo.getString("engineNo"),
|
|
|
+ StringUtils.isEmpty(carinfo.getString("seatCount"))?"":carinfo.getString("seatCount"),
|
|
|
+ StringUtils.isEmpty(ownerinfo.getString("name"))?"":ownerinfo.getString("name"),
|
|
|
+ setNewIdCard(ownerinfo),
|
|
|
+ StringUtils.isEmpty(applyinfo.getString("name"))?"":applyinfo.getString("name"),
|
|
|
+ setNewIdCard(applyinfo),
|
|
|
+ StringUtils.isEmpty(insureinfo.getString("name"))?"":insureinfo.getString("name"),
|
|
|
+ setNewIdCard(insureinfo),
|
|
|
+ StringUtils.isEmpty(orders.getJqstartdate())?"":orders.getJqstartdate(),
|
|
|
+ StringUtils.isEmpty(orders.getJqenddate())?"":orders.getJqenddate(),
|
|
|
+ StringUtils.isEmpty(orders.getSystartdate())?"":orders.getSystartdate(),
|
|
|
+ StringUtils.isEmpty(orders.getSyenddate())?"": orders.getSyenddate());
|
|
|
+ return insOrderVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/9 16:18
|
|
|
+ * @Description: 处理身份证为01返回身份证
|
|
|
+ */
|
|
|
+ private static String setNewIdCard(JSONObject ownerinfo) {
|
|
|
+ String identify="";
|
|
|
+ if(ownerinfo !=null ){
|
|
|
+ String identifyType = ownerinfo.getString("identifyNumber");
|
|
|
+ if(StringUtils.isNotBlank(identifyType)){
|
|
|
+ identify=identifyType.replaceAll("(\\d{4})\\d{10}(\\d{4})", "$1****$2");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return identify;
|
|
|
+ }
|
|
|
}
|