|
@@ -1,504 +1,504 @@
|
|
|
-package com.ydtech.modules.ins.service.impl;
|
|
|
|
|
-
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
-import com.ydtech.components.OrderComponents;
|
|
|
|
|
-import com.ydtech.components.RenbaoRequestComponents;
|
|
|
|
|
-import com.ydtech.core.page.HttpResult;
|
|
|
|
|
-import com.ydtech.exception.SystemException;
|
|
|
|
|
-import com.ydtech.modules.admin.model.SysDept;
|
|
|
|
|
-import com.ydtech.modules.admin.model.SysUser;
|
|
|
|
|
-import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
|
|
-import com.ydtech.modules.admin.service.SysUserService;
|
|
|
|
|
-import com.ydtech.modules.esm.model.EsmAgreement;
|
|
|
|
|
-import com.ydtech.modules.esm.model.EsmAgreementProd;
|
|
|
|
|
-import com.ydtech.modules.esm.service.*;
|
|
|
|
|
-import com.ydtech.modules.ins.convert.RenbaoCarModelConvert;
|
|
|
|
|
-import com.ydtech.modules.ins.convert.RenbaoQuoteResponseConvert;
|
|
|
|
|
-import com.ydtech.modules.ins.model.InsOrder;
|
|
|
|
|
-import com.ydtech.modules.ins.model.InsTaskHistory;
|
|
|
|
|
-import com.ydtech.modules.ins.model.request.*;
|
|
|
|
|
-import com.ydtech.modules.ins.model.vo.*;
|
|
|
|
|
-import com.ydtech.modules.ins.model.ya.*;
|
|
|
|
|
-import com.ydtech.modules.ins.service.*;
|
|
|
|
|
-import com.ydtech.utils.idgen.IdGenerate;
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
-import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
|
|
-
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
|
-import java.util.*;
|
|
|
|
|
-
|
|
|
|
|
-import static com.ydtech.constants.RedisConstant.INS_RENBAO_KEY;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-@Slf4j
|
|
|
|
|
-@Service
|
|
|
|
|
-public class InsRenbaoServiceImpl implements InsRenbaoService {
|
|
|
|
|
-
|
|
|
|
|
- private final StringRedisTemplate redisTemplate;
|
|
|
|
|
- private final InsOrderService insOrderService;
|
|
|
|
|
- private final SysUserService sysUserService;
|
|
|
|
|
- private final SysDeptService sysDeptService;
|
|
|
|
|
- private final EsmAgreementService esmAgreementService;
|
|
|
|
|
- private final EsmAgreementProdService esmAgreementProdService;
|
|
|
|
|
- private final InsTaskHistoryService insTaskHistoryService;
|
|
|
|
|
- private static final ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
- private final OrderComponents orderComponents;
|
|
|
|
|
- private final RenbaoRequestComponents renbaoRequestComponents;
|
|
|
|
|
-
|
|
|
|
|
- public InsRenbaoServiceImpl(StringRedisTemplate redisTemplate, InsOrderService insOrderService, SysUserService sysUserService, SysDeptService sysDeptService, EsmAgreementService esmAgreementService, EsmAgreementProdService esmAgreementProdService, InsTaskHistoryService insTaskHistoryService, OrderComponents orderComponents, RenbaoRequestComponents renbaoRequestComponents) {
|
|
|
|
|
- this.redisTemplate = redisTemplate;
|
|
|
|
|
- this.insOrderService = insOrderService;
|
|
|
|
|
- this.sysUserService = sysUserService;
|
|
|
|
|
- this.sysDeptService = sysDeptService;
|
|
|
|
|
- this.esmAgreementService = esmAgreementService;
|
|
|
|
|
- this.esmAgreementProdService = esmAgreementProdService;
|
|
|
|
|
- this.renbaoRequestComponents = renbaoRequestComponents;
|
|
|
|
|
- this.insTaskHistoryService = insTaskHistoryService;
|
|
|
|
|
- this.orderComponents = orderComponents;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public HttpResult licensePlateQuery(String licensePlate) throws Exception {
|
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
|
- map.put("license", licensePlate);
|
|
|
|
|
- RenbaoCarSearchResponse body = renbaoRequestComponents.licensePlateQuery(map, RenbaoCarSearchResponse.class);
|
|
|
|
|
- if (body == null) {
|
|
|
|
|
- throw new SystemException("人保接口请求失败");
|
|
|
|
|
- }
|
|
|
|
|
- if (body.getError() != null) {
|
|
|
|
|
- throw new SystemException("人保查询车型失败");
|
|
|
|
|
- }
|
|
|
|
|
- RenbaoCarInfos carInfos = body.getCarInfos();
|
|
|
|
|
- RenbaoCarModel result = carInfos.getResult().get(0);
|
|
|
|
|
-
|
|
|
|
|
- // 调用永安车型具体查询
|
|
|
|
|
- CarModelDTO carModelDTO = RenbaoCarModelConvert.INSTANCE.renbaoCar2YonganCar(result);
|
|
|
|
|
- Map<String, Object> map1 = new HashMap<>();
|
|
|
|
|
- map1.put("licenseNo", carInfos.getLicenseNo());
|
|
|
|
|
- map1.put("frameNo", carInfos.getFrameNo());
|
|
|
|
|
- map1.put("engineNo", carInfos.getEngineNo());
|
|
|
|
|
- map1.put("carModel", carModelDTO);
|
|
|
|
|
- return HttpResult.ok(map1);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public HttpResult modelsQuery(CarModel_Req carModelReq) {
|
|
|
|
|
- if (StringUtils.isEmpty(carModelReq.getModelName())) {
|
|
|
|
|
- throw new SystemException("车辆信息不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- String modelName = carModelReq.getModelName();
|
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
|
- map.put("brandname", modelName);
|
|
|
|
|
- RenbaoBrandSearchResponse body = renbaoRequestComponents.modelsQuery(map, RenbaoBrandSearchResponse.class);
|
|
|
|
|
- if (body == null) {
|
|
|
|
|
- throw new SystemException("人保接口请求失败");
|
|
|
|
|
- }
|
|
|
|
|
- if (body.getError() != null) {
|
|
|
|
|
- throw new SystemException("人保查询车型失败");
|
|
|
|
|
- }
|
|
|
|
|
- List<RenbaoCarModel> result = body.getResult();
|
|
|
|
|
- List<CarModelDTO> carModel = RenbaoCarModelConvert.INSTANCE.map(result);
|
|
|
|
|
- return HttpResult.ok(carModel);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public HttpResult quote(YaQuoteInfoVo yaQuoteInfoVo) throws JsonProcessingException {
|
|
|
|
|
-
|
|
|
|
|
- // 1.生成订单信息
|
|
|
|
|
- InsOrder insOrder = geneOrder(yaQuoteInfoVo);
|
|
|
|
|
- // 2.封装人保请求
|
|
|
|
|
- RenbaoQuoteResponse body = renbaoRequestComponents.quote(yaQuoteInfoVo, RenbaoQuoteResponse.class);
|
|
|
|
|
- if (body == null) {
|
|
|
|
|
- throw new SystemException("人保接口请求失败");
|
|
|
|
|
- }
|
|
|
|
|
- log.info(body.toString());
|
|
|
|
|
- if (body.getToken() == null) {
|
|
|
|
|
- String message = "人保--报价失败:" + body.getError();
|
|
|
|
|
- log.info(message);
|
|
|
|
|
- return HttpResult.error(message);
|
|
|
|
|
- }
|
|
|
|
|
- // 3.将人保的token存入redis
|
|
|
|
|
- RenbaoAuditBody renbaoAuditBody = RenbaoQuoteResponseConvert.INSTANCE.quote2Audit(body);
|
|
|
|
|
- String s = objectMapper.writeValueAsString(renbaoAuditBody);
|
|
|
|
|
- redisTemplate.opsForValue().set(INS_RENBAO_KEY + insOrder.getOrderno(), s);
|
|
|
|
|
-
|
|
|
|
|
- RenbaoQuoteRespVo quoteRespVo = getQuoteRespVo(insOrder.getOrderno(), Integer.parseInt(yaQuoteInfoVo.getCarInfo().getSeatCount()), body, yaQuoteInfoVo);
|
|
|
|
|
- // 4.插入订单
|
|
|
|
|
- return responseOrder(insOrder, body, quoteRespVo);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public HttpResult audit(String orderno) throws IOException {
|
|
|
|
|
- InsOrder order = insOrderService.selectByPk(orderno);
|
|
|
|
|
- if (order == null) {
|
|
|
|
|
- return HttpResult.error("订单不存在");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 1.通过redis获取请求人保参数token
|
|
|
|
|
- String s = redisTemplate.opsForValue().get(INS_RENBAO_KEY + order.getOrderno());
|
|
|
|
|
- RenbaoAuditBody response = objectMapper.readValue(s, RenbaoAuditBody.class);
|
|
|
|
|
- // 2.请求人保核保接口
|
|
|
|
|
-// List<InsTaskImage> insTaskImages = insTaskImageService.selectByTaskId(orderno);
|
|
|
|
|
-// response.setInsTaskImageList(insTaskImages);
|
|
|
|
|
- Map body = renbaoRequestComponents.audit(response, Map.class);
|
|
|
|
|
- if (body == null) {
|
|
|
|
|
- throw new SystemException("人保接口请求失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 3.核保不通过插入轨迹表
|
|
|
|
|
- if (StringUtils.isEmpty(body.get("epolicyUrlImg"))) {
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
- history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
- history.setCompany(order.getInscompany());
|
|
|
|
|
- history.setTaskid(order.getOrderno());
|
|
|
|
|
- history.setOperatorid(order.getUserid());
|
|
|
|
|
- history.setOperator(order.getUsername());
|
|
|
|
|
- history.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
- history.setStatus("4");
|
|
|
|
|
- history.setRemark("核保不通过");
|
|
|
|
|
- insTaskHistoryService.insert(history);
|
|
|
|
|
- return HttpResult.error("人保--核保失败:" + body.get("error"));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 4. 更新订单表
|
|
|
|
|
- String epolicyUrlImg = (String) body.get("epolicyUrlImg");
|
|
|
|
|
- order.setAuditid(order.getUserid());
|
|
|
|
|
- order.setPaymenttype(epolicyUrlImg);
|
|
|
|
|
-// order.setOrderstatus(orderstatus);
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- order.setSubmittime(sdf.format(new Date()));
|
|
|
|
|
-// order.setJqapplyno(jqApplyno == null ? "" : jqApplyno);
|
|
|
|
|
-// order.setSyapplyno(syApplyno == null ? "" : syApplyno);
|
|
|
|
|
- order.setJqappoint(""); //交强特别约定
|
|
|
|
|
- order.setSyappoint(""); //商业特别约定
|
|
|
|
|
- order.setOrderstatus("5");
|
|
|
|
|
- insOrderService.update(order);
|
|
|
|
|
-
|
|
|
|
|
- // 5.成功插入轨迹表
|
|
|
|
|
- InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
- history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
- history.setCompany(order.getInscompany());
|
|
|
|
|
- history.setTaskid(order.getOrderno());
|
|
|
|
|
- history.setOperatorid(order.getUserid());
|
|
|
|
|
- history.setOperator(order.getUsername());
|
|
|
|
|
- history.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
- history.setStatus(order.getOrderstatus());
|
|
|
|
|
- history.setRemark("已核保待缴费");
|
|
|
|
|
- insTaskHistoryService.insert(history);
|
|
|
|
|
- return HttpResult.ok();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生成订单信息
|
|
|
|
|
- *
|
|
|
|
|
- * @param record
|
|
|
|
|
- * @return InsOrder
|
|
|
|
|
- */
|
|
|
|
|
- protected InsOrder geneOrder(YaQuoteInfoVo record) {
|
|
|
|
|
- InsOrder insOrder = new InsOrder();
|
|
|
|
|
- String orderno = IdGenerate.nextId();
|
|
|
|
|
- insOrder.setOrderno(orderno);
|
|
|
|
|
- insOrder.setQuoteno(String.valueOf(record.getQuoteno()));
|
|
|
|
|
- insOrder.setOrderstatus("0"); // 0 报价 1 待核保 2 已核保待缴费 3 核保退回 4 核保不通过
|
|
|
|
|
- insOrder.setFrameNo(record.getCarInfo().getFrameNo());
|
|
|
|
|
- insOrder.setLicenseNo(record.getCarInfo().getLicenseNo());
|
|
|
|
|
-
|
|
|
|
|
- insOrder.setCarinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getCarInfo())));
|
|
|
|
|
- SysUser user = sysUserService.getById(record.getUserId());
|
|
|
|
|
- if (user == null) {
|
|
|
|
|
- throw new SystemException("userId不存在");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isEmpty(record.getCarInfo().getFrameNo())) {
|
|
|
|
|
- throw new SystemException("车架号不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- // 关闭订单 不含当前报价号
|
|
|
|
|
- InsOrder orderObj = insOrderService.queryQuoteno(new Object[]{record.getUserId(), record.getCarInfo().getFrameNo(), record.getQuoteno()});
|
|
|
|
|
- if (orderObj != null) {
|
|
|
|
|
- List<InsOrder> listo = insOrderService.selectList(" where quoteno=?", new Object[]{orderObj.getQuoteno()});
|
|
|
|
|
- String status = "0";
|
|
|
|
|
- for (InsOrder order : listo) {
|
|
|
|
|
- if (!"0".equals(order.getOrderstatus())) {
|
|
|
|
|
- status = order.getOrderstatus();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- //0报价中 1待核保 2已核保 3核保退回 4核保不通过 5已核保待缴费 6已缴费 7已承保 99已关闭
|
|
|
|
|
- if ("0".equals(status)) {//关闭订单
|
|
|
|
|
- insOrderService.closeOrder(orderObj.getOrderno(), "99");
|
|
|
|
|
- } else if (!"99".equals(status)) {
|
|
|
|
|
- throw new SystemException("此车辆已提交核保,重新报价请先关闭订单,任务号:" + orderObj.getQuoteno());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- insOrder.setUserid(user.getId());
|
|
|
|
|
- insOrder.setUsername(user.getName());
|
|
|
|
|
- insOrder.setDeptid(user.getDeptId());
|
|
|
|
|
- SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
|
|
- insOrder.setDeptname(dept == null ? "" : dept.getName());
|
|
|
|
|
-
|
|
|
|
|
- double retailRate = orderComponents.countRetail(user.getDeptId(), user.getId());
|
|
|
|
|
-
|
|
|
|
|
- insOrder.setOwnerinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getOwnerInfo())));
|
|
|
|
|
- insOrder.setApplyinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getPolicyHolderInfo())));
|
|
|
|
|
- insOrder.setInsureinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getInsuredPersonInfo())));
|
|
|
|
|
-
|
|
|
|
|
- insOrder.setInsuredname(record.getPolicyHolderInfo().getName());
|
|
|
|
|
-
|
|
|
|
|
- List<RiskInfoVo> risks = record.getRiskList();
|
|
|
|
|
- for (RiskInfoVo risk : risks) {
|
|
|
|
|
- if ("0507".equals(risk.getRiskCode())) {//交强
|
|
|
|
|
- insOrder.setJqstartdate(risk.getStartDate());
|
|
|
|
|
- insOrder.setJqenddate(risk.getEndDate());
|
|
|
|
|
- }
|
|
|
|
|
- if ("0510".equals(risk.getRiskCode())) {//商业
|
|
|
|
|
- insOrder.setSystartdate(risk.getStartDate());
|
|
|
|
|
- insOrder.setSyenddate(risk.getEndDate());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- List<KindInfoVo> kinds = record.getKindList();
|
|
|
|
|
- String productId = "";
|
|
|
|
|
- String productname = "";
|
|
|
|
|
-
|
|
|
|
|
- List<EsmAgreement> agreements = esmAgreementService.selectList(" where t.agreestatus='1' and t.insure1 like ? " + "and exists (select 1 from esm_agreement_prod t2 where t.id=t2.agreeid and t2.authcomcode like ?)", new Object[]{"000001%", "%" + user.getDeptId() + "%"});
|
|
|
|
|
- if (agreements.size() == 0) {
|
|
|
|
|
- throw new SystemException("不存在有效协议或机构" + user.getDeptId() + "未授权");
|
|
|
|
|
- }
|
|
|
|
|
- String agreeid = agreements.get(0).getId();
|
|
|
|
|
- insOrder.setAgreeid(agreeid);
|
|
|
|
|
- //匹配协议,获取费用
|
|
|
|
|
- StringBuffer whereStr = new StringBuffer();
|
|
|
|
|
- List params = new ArrayList();// where t.agreeid=? and t.productid in ()
|
|
|
|
|
- whereStr.append("where t.agreeid=? ");
|
|
|
|
|
- params.add(agreeid);
|
|
|
|
|
- if (risks.size() == 1 && "0507".equals(risks.get(0).getRiskCode())) {
|
|
|
|
|
- productId = "ZG01001";
|
|
|
|
|
- productname = "单交强";
|
|
|
|
|
- whereStr.append(" and t.productid=?");
|
|
|
|
|
- params.add(productId);
|
|
|
|
|
- } else if (risks.size() == 1 && kinds.size() == 1 && "B".equals(kinds.get(0).getKindCode())) {
|
|
|
|
|
- productId = "ZG01002";
|
|
|
|
|
- productname = "单三者";
|
|
|
|
|
- whereStr.append(" and t.productid=?");
|
|
|
|
|
- params.add(productId);
|
|
|
|
|
- } else if (risks.size() == 1) {
|
|
|
|
|
- productId = "ZG01003";
|
|
|
|
|
- productname = "单商业";
|
|
|
|
|
- whereStr.append(" and t.productid=?");
|
|
|
|
|
- params.add(productId);
|
|
|
|
|
- } else if (risks.size() == 2 && kinds.size() == 1 && "B".equals(kinds.get(0).getKindCode())) {
|
|
|
|
|
- productId = "ZG01004";
|
|
|
|
|
- productname = "交强+三者";
|
|
|
|
|
- whereStr.append(" and t.productid in (?,?)");
|
|
|
|
|
- params.add("ZG01004");
|
|
|
|
|
- params.add("ZG01005");
|
|
|
|
|
- } else {
|
|
|
|
|
- productId = "ZG01006";
|
|
|
|
|
- productname = "交强+商业";
|
|
|
|
|
- whereStr.append(" and t.productid in (?,?)");
|
|
|
|
|
- params.add("ZG01006");
|
|
|
|
|
- params.add("ZG01007");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- insOrder.setProductid(productId);
|
|
|
|
|
- insOrder.setProduct(productname);
|
|
|
|
|
- List<EsmAgreementProd> agreementProds = esmAgreementProdService.selectList(whereStr.toString(), params.toArray());
|
|
|
|
|
- for (EsmAgreementProd prod : agreementProds) {
|
|
|
|
|
- if ("ZG01001".equals(prod.getProductid()) || "ZG01004".equals(prod.getProductid()) || "ZG01006".equals(prod.getProductid())) {
|
|
|
|
|
- insOrder.setFeerate(prod.getProductrate());//交强手续费比例
|
|
|
|
|
- insOrder.setJqdiscountrate(prod.getFeerate() - retailRate); //交强优惠比例=业务员绩效-分销费用
|
|
|
|
|
- } else {
|
|
|
|
|
- insOrder.setDisrate(prod.getProductrate()); //商业手续费比例
|
|
|
|
|
- insOrder.setSydiscountrate(prod.getFeerate() - retailRate); //商业优惠比例=业务员绩效-分销费用
|
|
|
|
|
- }
|
|
|
|
|
- insOrder.setProductid(prod.getId());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- insOrder.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(record.getRiskList())));
|
|
|
|
|
- insOrder.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(record.getKindList())));
|
|
|
|
|
- SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
-
|
|
|
|
|
- insOrder.setInscompany("人保财险");
|
|
|
|
|
- insOrder.setCreatetime(sdfm.format(new Date()));
|
|
|
|
|
-
|
|
|
|
|
- return insOrder;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- private RenbaoQuoteRespVo getQuoteRespVo(String orderNo, int seatCount, RenbaoQuoteResponse response, YaQuoteInfoVo yaQuoteInfoVo) {
|
|
|
|
|
-
|
|
|
|
|
- double jqPremium = response.getKindCode_jiaoqiang();
|
|
|
|
|
- double syPremium = response.getKindCode_shangye();
|
|
|
|
|
-
|
|
|
|
|
- RenbaoQuoteRespVo quoteRespVo = new RenbaoQuoteRespVo();
|
|
|
|
|
-
|
|
|
|
|
- List<QuoteRiskRespVo> riskList1 = new ArrayList<>();
|
|
|
|
|
- List<QuoteKindRespVo> kindList1 = new ArrayList<>();
|
|
|
|
|
- List<RiskInfoVo> riskList = yaQuoteInfoVo.getRiskList();
|
|
|
|
|
- for (RiskInfoVo riskInfoVo : riskList) {
|
|
|
|
|
-
|
|
|
|
|
- if ("0507".equals(riskInfoVo.getRiskCode()) && jqPremium != 0) {
|
|
|
|
|
- QuoteRiskRespVo risk = new QuoteRiskRespVo();
|
|
|
|
|
- risk.setRiskCode("0507");
|
|
|
|
|
- risk.setRiskName("机动车交通事故责任强制保险");
|
|
|
|
|
- risk.setPremium(jqPremium);
|
|
|
|
|
- risk.setStartDate(riskInfoVo.getStartDate());
|
|
|
|
|
- risk.setEndDate(riskInfoVo.getEndDate());
|
|
|
|
|
- riskList1.add(risk);
|
|
|
|
|
- }
|
|
|
|
|
- if ("0510".equals(riskInfoVo.getRiskCode()) && syPremium != 0) {
|
|
|
|
|
- QuoteRiskRespVo risk = new QuoteRiskRespVo();
|
|
|
|
|
- risk.setRiskCode("0510");
|
|
|
|
|
- risk.setRiskName("机动车商业保险");
|
|
|
|
|
- risk.setPremium(syPremium);
|
|
|
|
|
- risk.setStartDate(riskInfoVo.getStartDate());
|
|
|
|
|
- risk.setEndDate(riskInfoVo.getEndDate());
|
|
|
|
|
- riskList1.add(risk);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- QuoteKindRespVo kind;
|
|
|
|
|
- List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
|
|
|
|
|
- for (KindInfoVo kindInfoVo : kindList) {
|
|
|
|
|
- if ("A".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("A");
|
|
|
|
|
- kind.setKindName("车辆损失保险");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_csx());
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("B".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("B");
|
|
|
|
|
- kind.setKindName("第三者责任险");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_dsz());
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("D3".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("D3");
|
|
|
|
|
- kind.setKindName("司机责任险");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_cssj());
|
|
|
|
|
- kind.setUnitAmount(kindInfoVo.getUnitAmount());
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("D4".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- int seat = seatCount - 1;
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("D4");
|
|
|
|
|
- kind.setKindName("乘客责任险");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount() / seat);
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_csck());
|
|
|
|
|
- kind.setQuantity(String.valueOf(seat));
|
|
|
|
|
- kind.setUnitAmount(kindInfoVo.getUnitAmount());
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("MJ1".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("MJ1");
|
|
|
|
|
- kind.setKindName("绝对免赔率特约险(车损)");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_mplcs());
|
|
|
|
|
- kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("MJ2".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("MJ2");
|
|
|
|
|
- kind.setKindName("绝对免赔率特约险(三者)");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_dsz());
|
|
|
|
|
- kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("MJ3".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("MJ3");
|
|
|
|
|
- kind.setKindName("绝对免赔率特约险(司机)");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_sj());
|
|
|
|
|
- kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("MJ4".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("MJ4");
|
|
|
|
|
- kind.setKindName("绝对免赔率特约险(乘客)");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_ck());
|
|
|
|
|
- kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("L".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("L");
|
|
|
|
|
- kind.setKindName("车身划痕损失险");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_huahen());
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- if ("BD".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
- kind = new QuoteKindRespVo();
|
|
|
|
|
- kind.setKindCode("BD");
|
|
|
|
|
- kind.setKindName("法定节假日限额翻倍险");
|
|
|
|
|
- kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
- kind.setCoveragePremium(response.getKindCode_fdfb());
|
|
|
|
|
- kindList1.add(kind);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- quoteRespVo.setDrivingAccidentPremium(response.getKindCode_EAD());
|
|
|
|
|
- quoteRespVo.setRiskList(riskList1);
|
|
|
|
|
- quoteRespVo.setKindList(kindList1);
|
|
|
|
|
-
|
|
|
|
|
- quoteRespVo.setCiSumPermium(response.getKindCode_jiaoqiang() + response.getKindCode_chechuan());//交强险和车船税合计
|
|
|
|
|
- quoteRespVo.setSumPermium(response.getAll_price());//保费合计
|
|
|
|
|
- quoteRespVo.setTaxAmount(response.getKindCode_chechuan());//车船税
|
|
|
|
|
- quoteRespVo.setTotalAdjustRate(1);
|
|
|
|
|
- quoteRespVo.setILogPreUdwMess("0");//评分
|
|
|
|
|
- quoteRespVo.setOrderno(orderNo); //订单号
|
|
|
|
|
- return quoteRespVo;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- private HttpResult responseOrder(InsOrder insOrder, RenbaoQuoteResponse response, QuoteRespVo quoteRespVo) {
|
|
|
|
|
- //保存订单信息
|
|
|
|
|
- insOrder.setJqpremium(response.getKindCode_jiaoqiang());
|
|
|
|
|
- insOrder.setSypremium(response.getKindCode_shangye());
|
|
|
|
|
- insOrder.setTaxamount(response.getKindCode_chechuan());
|
|
|
|
|
- insOrder.setSumpremium(response.getAll_price());
|
|
|
|
|
- insOrder.setQuotestatus("1");
|
|
|
|
|
- insOrder.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getRiskList())));
|
|
|
|
|
- insOrder.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getKindList())));
|
|
|
|
|
- insOrder.setJypremium(response.getKindCode_EAD());
|
|
|
|
|
- insOrderService.insert(insOrder);
|
|
|
|
|
-
|
|
|
|
|
- //插入轨迹表
|
|
|
|
|
- InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
- history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
- history.setCompany(insOrder.getInscompany());
|
|
|
|
|
- history.setTaskid(insOrder.getOrderno());
|
|
|
|
|
- history.setOperatorid(insOrder.getUserid());
|
|
|
|
|
- history.setOperator(insOrder.getUsername());
|
|
|
|
|
- SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- history.setCreatetime(sdfm.format(new Date()));
|
|
|
|
|
- history.setOperator(insOrder.getUsername());
|
|
|
|
|
- history.setStatus("0");
|
|
|
|
|
- history.setRemark("报价中");
|
|
|
|
|
- insTaskHistoryService.insert(history);
|
|
|
|
|
-
|
|
|
|
|
- return HttpResult.ok("成功", quoteRespVo);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+//package com.ydtech.modules.ins.service.impl;
|
|
|
|
|
+//
|
|
|
|
|
+//import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+//import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
+//import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
+//import com.ydtech.components.OrderComponents;
|
|
|
|
|
+//import com.ydtech.components.RenbaoRequestComponents;
|
|
|
|
|
+//import com.ydtech.core.page.HttpResult;
|
|
|
|
|
+//import com.ydtech.exception.SystemException;
|
|
|
|
|
+//import com.ydtech.modules.admin.model.SysDept;
|
|
|
|
|
+//import com.ydtech.modules.admin.model.SysUser;
|
|
|
|
|
+//import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
|
|
+//import com.ydtech.modules.admin.service.SysUserService;
|
|
|
|
|
+//import com.ydtech.modules.esm.model.EsmAgreement;
|
|
|
|
|
+//import com.ydtech.modules.esm.model.EsmAgreementProd;
|
|
|
|
|
+//import com.ydtech.modules.esm.service.*;
|
|
|
|
|
+//import com.ydtech.modules.ins.convert.RenbaoCarModelConvert;
|
|
|
|
|
+//import com.ydtech.modules.ins.convert.RenbaoQuoteResponseConvert;
|
|
|
|
|
+//import com.ydtech.modules.ins.model.InsOrder;
|
|
|
|
|
+//import com.ydtech.modules.ins.model.InsTaskHistory;
|
|
|
|
|
+//import com.ydtech.modules.ins.model.request.*;
|
|
|
|
|
+//import com.ydtech.modules.ins.model.vo.*;
|
|
|
|
|
+//import com.ydtech.modules.ins.model.ya.*;
|
|
|
|
|
+//import com.ydtech.modules.ins.service.*;
|
|
|
|
|
+//import com.ydtech.utils.idgen.IdGenerate;
|
|
|
|
|
+//import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+//import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
+//import org.springframework.stereotype.Service;
|
|
|
|
|
+//import org.springframework.util.StringUtils;
|
|
|
|
|
+//
|
|
|
|
|
+//import java.io.IOException;
|
|
|
|
|
+//import java.text.SimpleDateFormat;
|
|
|
|
|
+//import java.util.*;
|
|
|
|
|
+//
|
|
|
|
|
+//import static com.ydtech.constants.RedisConstant.INS_RENBAO_KEY;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//@Slf4j
|
|
|
|
|
+//@Service
|
|
|
|
|
+//public class InsRenbaoServiceImpl implements InsRenbaoService {
|
|
|
|
|
+//
|
|
|
|
|
+// private final StringRedisTemplate redisTemplate;
|
|
|
|
|
+// private final InsOrderService insOrderService;
|
|
|
|
|
+// private final SysUserService sysUserService;
|
|
|
|
|
+// private final SysDeptService sysDeptService;
|
|
|
|
|
+// private final EsmAgreementService esmAgreementService;
|
|
|
|
|
+// private final EsmAgreementProdService esmAgreementProdService;
|
|
|
|
|
+// private final InsTaskHistoryService insTaskHistoryService;
|
|
|
|
|
+// private static final ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
+// private final OrderComponents orderComponents;
|
|
|
|
|
+// private final RenbaoRequestComponents renbaoRequestComponents;
|
|
|
|
|
+//
|
|
|
|
|
+// public InsRenbaoServiceImpl(StringRedisTemplate redisTemplate, InsOrderService insOrderService, SysUserService sysUserService, SysDeptService sysDeptService, EsmAgreementService esmAgreementService, EsmAgreementProdService esmAgreementProdService, InsTaskHistoryService insTaskHistoryService, OrderComponents orderComponents, RenbaoRequestComponents renbaoRequestComponents) {
|
|
|
|
|
+// this.redisTemplate = redisTemplate;
|
|
|
|
|
+// this.insOrderService = insOrderService;
|
|
|
|
|
+// this.sysUserService = sysUserService;
|
|
|
|
|
+// this.sysDeptService = sysDeptService;
|
|
|
|
|
+// this.esmAgreementService = esmAgreementService;
|
|
|
|
|
+// this.esmAgreementProdService = esmAgreementProdService;
|
|
|
|
|
+// this.renbaoRequestComponents = renbaoRequestComponents;
|
|
|
|
|
+// this.insTaskHistoryService = insTaskHistoryService;
|
|
|
|
|
+// this.orderComponents = orderComponents;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public HttpResult licensePlateQuery(String licensePlate) throws Exception {
|
|
|
|
|
+// Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+// map.put("license", licensePlate);
|
|
|
|
|
+// RenbaoCarSearchResponse body = renbaoRequestComponents.licensePlateQuery(map, RenbaoCarSearchResponse.class);
|
|
|
|
|
+// if (body == null) {
|
|
|
|
|
+// throw new SystemException("人保接口请求失败");
|
|
|
|
|
+// }
|
|
|
|
|
+// if (body.getError() != null) {
|
|
|
|
|
+// throw new SystemException("人保查询车型失败");
|
|
|
|
|
+// }
|
|
|
|
|
+// RenbaoCarInfos carInfos = body.getCarInfos();
|
|
|
|
|
+// RenbaoCarModel result = carInfos.getResult().get(0);
|
|
|
|
|
+//
|
|
|
|
|
+// // 调用永安车型具体查询
|
|
|
|
|
+// CarModelDTO carModelDTO = RenbaoCarModelConvert.INSTANCE.renbaoCar2YonganCar(result);
|
|
|
|
|
+// Map<String, Object> map1 = new HashMap<>();
|
|
|
|
|
+// map1.put("licenseNo", carInfos.getLicenseNo());
|
|
|
|
|
+// map1.put("frameNo", carInfos.getFrameNo());
|
|
|
|
|
+// map1.put("engineNo", carInfos.getEngineNo());
|
|
|
|
|
+// map1.put("carModel", carModelDTO);
|
|
|
|
|
+// return HttpResult.ok(map1);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public HttpResult modelsQuery(CarModel_Req carModelReq) {
|
|
|
|
|
+// if (StringUtils.isEmpty(carModelReq.getModelName())) {
|
|
|
|
|
+// throw new SystemException("车辆信息不能为空");
|
|
|
|
|
+// }
|
|
|
|
|
+// String modelName = carModelReq.getModelName();
|
|
|
|
|
+// Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+// map.put("brandname", modelName);
|
|
|
|
|
+// RenbaoBrandSearchResponse body = renbaoRequestComponents.modelsQuery(map, RenbaoBrandSearchResponse.class);
|
|
|
|
|
+// if (body == null) {
|
|
|
|
|
+// throw new SystemException("人保接口请求失败");
|
|
|
|
|
+// }
|
|
|
|
|
+// if (body.getError() != null) {
|
|
|
|
|
+// throw new SystemException("人保查询车型失败");
|
|
|
|
|
+// }
|
|
|
|
|
+// List<RenbaoCarModel> result = body.getResult();
|
|
|
|
|
+// List<CarModelDTO> carModel = RenbaoCarModelConvert.INSTANCE.map(result);
|
|
|
|
|
+// return HttpResult.ok(carModel);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public HttpResult quote(YaQuoteInfoVo yaQuoteInfoVo) throws JsonProcessingException {
|
|
|
|
|
+//
|
|
|
|
|
+// // 1.生成订单信息
|
|
|
|
|
+// InsOrder insOrder = geneOrder(yaQuoteInfoVo);
|
|
|
|
|
+// // 2.封装人保请求
|
|
|
|
|
+// RenbaoQuoteResponse body = renbaoRequestComponents.quote(yaQuoteInfoVo, RenbaoQuoteResponse.class);
|
|
|
|
|
+// if (body == null) {
|
|
|
|
|
+// throw new SystemException("人保接口请求失败");
|
|
|
|
|
+// }
|
|
|
|
|
+// log.info(body.toString());
|
|
|
|
|
+// if (body.getToken() == null) {
|
|
|
|
|
+// String message = "人保--报价失败:" + body.getError();
|
|
|
|
|
+// log.info(message);
|
|
|
|
|
+// return HttpResult.error(message);
|
|
|
|
|
+// }
|
|
|
|
|
+// // 3.将人保的token存入redis
|
|
|
|
|
+// RenbaoAuditBody renbaoAuditBody = RenbaoQuoteResponseConvert.INSTANCE.quote2Audit(body);
|
|
|
|
|
+// String s = objectMapper.writeValueAsString(renbaoAuditBody);
|
|
|
|
|
+// redisTemplate.opsForValue().set(INS_RENBAO_KEY + insOrder.getOrderno(), s);
|
|
|
|
|
+//
|
|
|
|
|
+// RenbaoQuoteRespVo quoteRespVo = getQuoteRespVo(insOrder.getOrderno(), Integer.parseInt(yaQuoteInfoVo.getCarInfo().getSeatCount()), body, yaQuoteInfoVo);
|
|
|
|
|
+// // 4.插入订单
|
|
|
|
|
+// return responseOrder(insOrder, body, quoteRespVo);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public HttpResult audit(String orderno) throws IOException {
|
|
|
|
|
+// InsOrder order = insOrderService.selectByPk(orderno);
|
|
|
|
|
+// if (order == null) {
|
|
|
|
|
+// return HttpResult.error("订单不存在");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// // 1.通过redis获取请求人保参数token
|
|
|
|
|
+// String s = redisTemplate.opsForValue().get(INS_RENBAO_KEY + order.getOrderno());
|
|
|
|
|
+// RenbaoAuditBody response = objectMapper.readValue(s, RenbaoAuditBody.class);
|
|
|
|
|
+// // 2.请求人保核保接口
|
|
|
|
|
+//// List<InsTaskImage> insTaskImages = insTaskImageService.selectByTaskId(orderno);
|
|
|
|
|
+//// response.setInsTaskImageList(insTaskImages);
|
|
|
|
|
+// Map body = renbaoRequestComponents.audit(response, Map.class);
|
|
|
|
|
+// if (body == null) {
|
|
|
|
|
+// throw new SystemException("人保接口请求失败");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// // 3.核保不通过插入轨迹表
|
|
|
|
|
+// if (StringUtils.isEmpty(body.get("epolicyUrlImg"))) {
|
|
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+// InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
+// history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
+// history.setCompany(order.getInscompany());
|
|
|
|
|
+// history.setTaskid(order.getOrderno());
|
|
|
|
|
+// history.setOperatorid(order.getUserid());
|
|
|
|
|
+// history.setOperator(order.getUsername());
|
|
|
|
|
+// history.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
+// history.setStatus("4");
|
|
|
|
|
+// history.setRemark("核保不通过");
|
|
|
|
|
+// insTaskHistoryService.insert(history);
|
|
|
|
|
+// return HttpResult.error("人保--核保失败:" + body.get("error"));
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// // 4. 更新订单表
|
|
|
|
|
+// String epolicyUrlImg = (String) body.get("epolicyUrlImg");
|
|
|
|
|
+// order.setAuditid(order.getUserid());
|
|
|
|
|
+// order.setPaymenttype(epolicyUrlImg);
|
|
|
|
|
+//// order.setOrderstatus(orderstatus);
|
|
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+// order.setSubmittime(sdf.format(new Date()));
|
|
|
|
|
+//// order.setJqapplyno(jqApplyno == null ? "" : jqApplyno);
|
|
|
|
|
+//// order.setSyapplyno(syApplyno == null ? "" : syApplyno);
|
|
|
|
|
+// order.setJqappoint(""); //交强特别约定
|
|
|
|
|
+// order.setSyappoint(""); //商业特别约定
|
|
|
|
|
+// order.setOrderstatus("5");
|
|
|
|
|
+// insOrderService.update(order);
|
|
|
|
|
+//
|
|
|
|
|
+// // 5.成功插入轨迹表
|
|
|
|
|
+// InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
+// history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
+// history.setCompany(order.getInscompany());
|
|
|
|
|
+// history.setTaskid(order.getOrderno());
|
|
|
|
|
+// history.setOperatorid(order.getUserid());
|
|
|
|
|
+// history.setOperator(order.getUsername());
|
|
|
|
|
+// history.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
+// history.setStatus(order.getOrderstatus());
|
|
|
|
|
+// history.setRemark("已核保待缴费");
|
|
|
|
|
+// insTaskHistoryService.insert(history);
|
|
|
|
|
+// return HttpResult.ok();
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /**
|
|
|
|
|
+// * 生成订单信息
|
|
|
|
|
+// *
|
|
|
|
|
+// * @param record
|
|
|
|
|
+// * @return InsOrder
|
|
|
|
|
+// */
|
|
|
|
|
+// protected InsOrder geneOrder(YaQuoteInfoVo record) {
|
|
|
|
|
+// InsOrder insOrder = new InsOrder();
|
|
|
|
|
+// String orderno = IdGenerate.nextId();
|
|
|
|
|
+// insOrder.setOrderno(orderno);
|
|
|
|
|
+// insOrder.setQuoteno(String.valueOf(record.getQuoteno()));
|
|
|
|
|
+// insOrder.setOrderstatus("0"); // 0 报价 1 待核保 2 已核保待缴费 3 核保退回 4 核保不通过
|
|
|
|
|
+// insOrder.setFrameNo(record.getCarInfo().getFrameNo());
|
|
|
|
|
+// insOrder.setLicenseNo(record.getCarInfo().getLicenseNo());
|
|
|
|
|
+//
|
|
|
|
|
+// insOrder.setCarinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getCarInfo())));
|
|
|
|
|
+// SysUser user = sysUserService.getById(record.getUserId());
|
|
|
|
|
+// if (user == null) {
|
|
|
|
|
+// throw new SystemException("userId不存在");
|
|
|
|
|
+// }
|
|
|
|
|
+// if (StringUtils.isEmpty(record.getCarInfo().getFrameNo())) {
|
|
|
|
|
+// throw new SystemException("车架号不能为空");
|
|
|
|
|
+// }
|
|
|
|
|
+// // 关闭订单 不含当前报价号
|
|
|
|
|
+// InsOrder orderObj = insOrderService.queryQuoteno(new Object[]{record.getUserId(), record.getCarInfo().getFrameNo(), record.getQuoteno()});
|
|
|
|
|
+// if (orderObj != null) {
|
|
|
|
|
+// List<InsOrder> listo = insOrderService.selectList(" where quoteno=?", new Object[]{orderObj.getQuoteno()});
|
|
|
|
|
+// String status = "0";
|
|
|
|
|
+// for (InsOrder order : listo) {
|
|
|
|
|
+// if (!"0".equals(order.getOrderstatus())) {
|
|
|
|
|
+// status = order.getOrderstatus();
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// //0报价中 1待核保 2已核保 3核保退回 4核保不通过 5已核保待缴费 6已缴费 7已承保 99已关闭
|
|
|
|
|
+// if ("0".equals(status)) {//关闭订单
|
|
|
|
|
+// insOrderService.closeOrder(orderObj.getOrderno(), "99");
|
|
|
|
|
+// } else if (!"99".equals(status)) {
|
|
|
|
|
+// throw new SystemException("此车辆已提交核保,重新报价请先关闭订单,任务号:" + orderObj.getQuoteno());
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// insOrder.setUserid(user.getId());
|
|
|
|
|
+// insOrder.setUsername(user.getName());
|
|
|
|
|
+// insOrder.setDeptid(user.getDeptId());
|
|
|
|
|
+// SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
|
|
+// insOrder.setDeptname(dept == null ? "" : dept.getName());
|
|
|
|
|
+//
|
|
|
|
|
+// double retailRate = orderComponents.countRetail(user.getDeptId(), user.getId());
|
|
|
|
|
+//
|
|
|
|
|
+// insOrder.setOwnerinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getOwnerInfo())));
|
|
|
|
|
+// insOrder.setApplyinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getPolicyHolderInfo())));
|
|
|
|
|
+// insOrder.setInsureinfo(JSONObject.parseObject(JSONObject.toJSONString(record.getInsuredPersonInfo())));
|
|
|
|
|
+//
|
|
|
|
|
+// insOrder.setInsuredname(record.getPolicyHolderInfo().getName());
|
|
|
|
|
+//
|
|
|
|
|
+// List<RiskInfoVo> risks = record.getRiskList();
|
|
|
|
|
+// for (RiskInfoVo risk : risks) {
|
|
|
|
|
+// if ("0507".equals(risk.getRiskCode())) {//交强
|
|
|
|
|
+// insOrder.setJqstartdate(risk.getStartDate());
|
|
|
|
|
+// insOrder.setJqenddate(risk.getEndDate());
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("0510".equals(risk.getRiskCode())) {//商业
|
|
|
|
|
+// insOrder.setSystartdate(risk.getStartDate());
|
|
|
|
|
+// insOrder.setSyenddate(risk.getEndDate());
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// List<KindInfoVo> kinds = record.getKindList();
|
|
|
|
|
+// String productId = "";
|
|
|
|
|
+// String productname = "";
|
|
|
|
|
+//
|
|
|
|
|
+// List<EsmAgreement> agreements = esmAgreementService.selectList(" where t.agreestatus='1' and t.insure1 like ? " + "and exists (select 1 from esm_agreement_prod t2 where t.id=t2.agreeid and t2.authcomcode like ?)", new Object[]{"000001%", "%" + user.getDeptId() + "%"});
|
|
|
|
|
+// if (agreements.size() == 0) {
|
|
|
|
|
+// throw new SystemException("不存在有效协议或机构" + user.getDeptId() + "未授权");
|
|
|
|
|
+// }
|
|
|
|
|
+// String agreeid = agreements.get(0).getId();
|
|
|
|
|
+// insOrder.setAgreeid(agreeid);
|
|
|
|
|
+// //匹配协议,获取费用
|
|
|
|
|
+// StringBuffer whereStr = new StringBuffer();
|
|
|
|
|
+// List params = new ArrayList();// where t.agreeid=? and t.productid in ()
|
|
|
|
|
+// whereStr.append("where t.agreeid=? ");
|
|
|
|
|
+// params.add(agreeid);
|
|
|
|
|
+// if (risks.size() == 1 && "0507".equals(risks.get(0).getRiskCode())) {
|
|
|
|
|
+// productId = "ZG01001";
|
|
|
|
|
+// productname = "单交强";
|
|
|
|
|
+// whereStr.append(" and t.productid=?");
|
|
|
|
|
+// params.add(productId);
|
|
|
|
|
+// } else if (risks.size() == 1 && kinds.size() == 1 && "B".equals(kinds.get(0).getKindCode())) {
|
|
|
|
|
+// productId = "ZG01002";
|
|
|
|
|
+// productname = "单三者";
|
|
|
|
|
+// whereStr.append(" and t.productid=?");
|
|
|
|
|
+// params.add(productId);
|
|
|
|
|
+// } else if (risks.size() == 1) {
|
|
|
|
|
+// productId = "ZG01003";
|
|
|
|
|
+// productname = "单商业";
|
|
|
|
|
+// whereStr.append(" and t.productid=?");
|
|
|
|
|
+// params.add(productId);
|
|
|
|
|
+// } else if (risks.size() == 2 && kinds.size() == 1 && "B".equals(kinds.get(0).getKindCode())) {
|
|
|
|
|
+// productId = "ZG01004";
|
|
|
|
|
+// productname = "交强+三者";
|
|
|
|
|
+// whereStr.append(" and t.productid in (?,?)");
|
|
|
|
|
+// params.add("ZG01004");
|
|
|
|
|
+// params.add("ZG01005");
|
|
|
|
|
+// } else {
|
|
|
|
|
+// productId = "ZG01006";
|
|
|
|
|
+// productname = "交强+商业";
|
|
|
|
|
+// whereStr.append(" and t.productid in (?,?)");
|
|
|
|
|
+// params.add("ZG01006");
|
|
|
|
|
+// params.add("ZG01007");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// insOrder.setProductid(productId);
|
|
|
|
|
+// insOrder.setProduct(productname);
|
|
|
|
|
+// List<EsmAgreementProd> agreementProds = esmAgreementProdService.selectList(whereStr.toString(), params.toArray());
|
|
|
|
|
+// for (EsmAgreementProd prod : agreementProds) {
|
|
|
|
|
+// if ("ZG01001".equals(prod.getProductid()) || "ZG01004".equals(prod.getProductid()) || "ZG01006".equals(prod.getProductid())) {
|
|
|
|
|
+// insOrder.setFeerate(prod.getProductrate());//交强手续费比例
|
|
|
|
|
+// insOrder.setJqdiscountrate(prod.getFeerate() - retailRate); //交强优惠比例=业务员绩效-分销费用
|
|
|
|
|
+// } else {
|
|
|
|
|
+// insOrder.setDisrate(prod.getProductrate()); //商业手续费比例
|
|
|
|
|
+// insOrder.setSydiscountrate(prod.getFeerate() - retailRate); //商业优惠比例=业务员绩效-分销费用
|
|
|
|
|
+// }
|
|
|
|
|
+// insOrder.setProductid(prod.getId());
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// insOrder.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(record.getRiskList())));
|
|
|
|
|
+// insOrder.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(record.getKindList())));
|
|
|
|
|
+// SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+//
|
|
|
|
|
+// insOrder.setInscompany("人保财险");
|
|
|
|
|
+// insOrder.setCreatetime(sdfm.format(new Date()));
|
|
|
|
|
+//
|
|
|
|
|
+// return insOrder;
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// private RenbaoQuoteRespVo getQuoteRespVo(String orderNo, int seatCount, RenbaoQuoteResponse response, YaQuoteInfoVo yaQuoteInfoVo) {
|
|
|
|
|
+//
|
|
|
|
|
+// double jqPremium = response.getKindCode_jiaoqiang();
|
|
|
|
|
+// double syPremium = response.getKindCode_shangye();
|
|
|
|
|
+//
|
|
|
|
|
+// RenbaoQuoteRespVo quoteRespVo = new RenbaoQuoteRespVo();
|
|
|
|
|
+//
|
|
|
|
|
+// List<QuoteRiskRespVo> riskList1 = new ArrayList<>();
|
|
|
|
|
+// List<QuoteKindRespVo> kindList1 = new ArrayList<>();
|
|
|
|
|
+// List<RiskInfoVo> riskList = yaQuoteInfoVo.getRiskList();
|
|
|
|
|
+// for (RiskInfoVo riskInfoVo : riskList) {
|
|
|
|
|
+//
|
|
|
|
|
+// if ("0507".equals(riskInfoVo.getRiskCode()) && jqPremium != 0) {
|
|
|
|
|
+// QuoteRiskRespVo risk = new QuoteRiskRespVo();
|
|
|
|
|
+// risk.setRiskCode("0507");
|
|
|
|
|
+// risk.setRiskName("机动车交通事故责任强制保险");
|
|
|
|
|
+// risk.setPremium(jqPremium);
|
|
|
|
|
+// risk.setStartDate(riskInfoVo.getStartDate());
|
|
|
|
|
+// risk.setEndDate(riskInfoVo.getEndDate());
|
|
|
|
|
+// riskList1.add(risk);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("0510".equals(riskInfoVo.getRiskCode()) && syPremium != 0) {
|
|
|
|
|
+// QuoteRiskRespVo risk = new QuoteRiskRespVo();
|
|
|
|
|
+// risk.setRiskCode("0510");
|
|
|
|
|
+// risk.setRiskName("机动车商业保险");
|
|
|
|
|
+// risk.setPremium(syPremium);
|
|
|
|
|
+// risk.setStartDate(riskInfoVo.getStartDate());
|
|
|
|
|
+// risk.setEndDate(riskInfoVo.getEndDate());
|
|
|
|
|
+// riskList1.add(risk);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// QuoteKindRespVo kind;
|
|
|
|
|
+// List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
|
|
|
|
|
+// for (KindInfoVo kindInfoVo : kindList) {
|
|
|
|
|
+// if ("A".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("A");
|
|
|
|
|
+// kind.setKindName("车辆损失保险");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_csx());
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("B".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("B");
|
|
|
|
|
+// kind.setKindName("第三者责任险");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_dsz());
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("D3".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("D3");
|
|
|
|
|
+// kind.setKindName("司机责任险");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_cssj());
|
|
|
|
|
+// kind.setUnitAmount(kindInfoVo.getUnitAmount());
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("D4".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// int seat = seatCount - 1;
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("D4");
|
|
|
|
|
+// kind.setKindName("乘客责任险");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount() / seat);
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_csck());
|
|
|
|
|
+// kind.setQuantity(String.valueOf(seat));
|
|
|
|
|
+// kind.setUnitAmount(kindInfoVo.getUnitAmount());
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("MJ1".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("MJ1");
|
|
|
|
|
+// kind.setKindName("绝对免赔率特约险(车损)");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_mplcs());
|
|
|
|
|
+// kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("MJ2".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("MJ2");
|
|
|
|
|
+// kind.setKindName("绝对免赔率特约险(三者)");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_dsz());
|
|
|
|
|
+// kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("MJ3".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("MJ3");
|
|
|
|
|
+// kind.setKindName("绝对免赔率特约险(司机)");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_sj());
|
|
|
|
|
+// kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("MJ4".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("MJ4");
|
|
|
|
|
+// kind.setKindName("绝对免赔率特约险(乘客)");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_ck());
|
|
|
|
|
+// kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("L".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("L");
|
|
|
|
|
+// kind.setKindName("车身划痕损失险");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_huahen());
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// if ("BD".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
|
|
+// kind.setKindCode("BD");
|
|
|
|
|
+// kind.setKindName("法定节假日限额翻倍险");
|
|
|
|
|
+// kind.setAmount(kindInfoVo.getAmount());
|
|
|
|
|
+// kind.setCoveragePremium(response.getKindCode_fdfb());
|
|
|
|
|
+// kindList1.add(kind);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// quoteRespVo.setDrivingAccidentPremium(response.getKindCode_EAD());
|
|
|
|
|
+// quoteRespVo.setRiskList(riskList1);
|
|
|
|
|
+// quoteRespVo.setKindList(kindList1);
|
|
|
|
|
+//
|
|
|
|
|
+// quoteRespVo.setCiSumPermium(response.getKindCode_jiaoqiang() + response.getKindCode_chechuan());//交强险和车船税合计
|
|
|
|
|
+// quoteRespVo.setSumPermium(response.getAll_price());//保费合计
|
|
|
|
|
+// quoteRespVo.setTaxAmount(response.getKindCode_chechuan());//车船税
|
|
|
|
|
+// quoteRespVo.setTotalAdjustRate(1);
|
|
|
|
|
+// quoteRespVo.setILogPreUdwMess("0");//评分
|
|
|
|
|
+// quoteRespVo.setOrderno(orderNo); //订单号
|
|
|
|
|
+// return quoteRespVo;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// private HttpResult responseOrder(InsOrder insOrder, RenbaoQuoteResponse response, QuoteRespVo quoteRespVo) {
|
|
|
|
|
+// //保存订单信息
|
|
|
|
|
+// insOrder.setJqpremium(response.getKindCode_jiaoqiang());
|
|
|
|
|
+// insOrder.setSypremium(response.getKindCode_shangye());
|
|
|
|
|
+// insOrder.setTaxamount(response.getKindCode_chechuan());
|
|
|
|
|
+// insOrder.setSumpremium(response.getAll_price());
|
|
|
|
|
+// insOrder.setQuotestatus("1");
|
|
|
|
|
+// insOrder.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getRiskList())));
|
|
|
|
|
+// insOrder.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getKindList())));
|
|
|
|
|
+// insOrder.setJypremium(response.getKindCode_EAD());
|
|
|
|
|
+// insOrderService.insert(insOrder);
|
|
|
|
|
+//
|
|
|
|
|
+// //插入轨迹表
|
|
|
|
|
+// InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
+// history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
+// history.setCompany(insOrder.getInscompany());
|
|
|
|
|
+// history.setTaskid(insOrder.getOrderno());
|
|
|
|
|
+// history.setOperatorid(insOrder.getUserid());
|
|
|
|
|
+// history.setOperator(insOrder.getUsername());
|
|
|
|
|
+// SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+// history.setCreatetime(sdfm.format(new Date()));
|
|
|
|
|
+// history.setOperator(insOrder.getUsername());
|
|
|
|
|
+// history.setStatus("0");
|
|
|
|
|
+// history.setRemark("报价中");
|
|
|
|
|
+// insTaskHistoryService.insert(history);
|
|
|
|
|
+//
|
|
|
|
|
+// return HttpResult.ok("成功", quoteRespVo);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//}
|