Kaynağa Gözat

Merge remote-tracking branch 'origin/test' into test

wks 2 yıl önce
ebeveyn
işleme
1baea24852
16 değiştirilmiş dosya ile 892 ekleme ve 0 silme
  1. 92 0
      src/main/java/com/ydtech/modules/order/controller/DrivingInsuranceController.java
  2. 11 0
      src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceMapper.java
  3. 12 0
      src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceSonMapper.java
  4. 12 0
      src/main/java/com/ydtech/modules/order/dao/PtlAgreementNonCarProductRuleMapper.java
  5. 74 0
      src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsurance.java
  6. 58 0
      src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsuranceSon.java
  7. 126 0
      src/main/java/com/ydtech/modules/order/entity/PtlAgreementNonCarProductRule.java
  8. 24 0
      src/main/java/com/ydtech/modules/order/entity/vo/DrivingInsuranceQueryVo.java
  9. 92 0
      src/main/java/com/ydtech/modules/order/entity/vo/InsDrivingIntentionInsuranceVo.java
  10. 29 0
      src/main/java/com/ydtech/modules/order/entity/vo/NoCarInsuranceQueryVo.java
  11. 35 0
      src/main/java/com/ydtech/modules/order/entity/vo/QuoteAccidentalDrivingVo.java
  12. 31 0
      src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceService.java
  13. 20 0
      src/main/java/com/ydtech/modules/order/service/PtlAgreementNonCarProductRuleService.java
  14. 133 0
      src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceServiceImpl.java
  15. 60 0
      src/main/java/com/ydtech/modules/order/service/impl/PtlAgreementNonCarProductRuleServiceImpl.java
  16. 83 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementNonCarProductRule.java

+ 92 - 0
src/main/java/com/ydtech/modules/order/controller/DrivingInsuranceController.java

@@ -0,0 +1,92 @@
+package com.ydtech.modules.order.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.core.page.PageRequest;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.ins.model.guoren.CarModelResp;
+import com.ydtech.modules.ins.model.vo.CarInfoVo;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+import com.ydtech.modules.order.entity.vo.DrivingInsuranceQueryVo;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
+import com.ydtech.modules.order.service.PtlAgreementNonCarProductRuleService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api(tags = "驾意险 API")
+@RestController
+@RequestMapping("/api/drivingInsurance")
+@RequiredArgsConstructor
+public class DrivingInsuranceController extends BaseController {
+
+    @Autowired
+    private InsDrivingIntentionInsuranceService insDrivingIntentionInsuranceService;
+
+    @Autowired
+    private PtlAgreementNonCarProductRuleService ptlAgreementNonCarProductRuleService;
+
+    @ApiOperation(value = "获取驾意险信息")
+    @PostMapping("/getDrivingInsurance")
+    public HttpResult<List<InsDrivingIntentionInsuranceVo>> getDrivingInsurance(@RequestBody NoCarInsuranceQueryVo insuranceQueryVo) {
+        List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = insDrivingIntentionInsuranceService.getInsDrivingIntentionInsuranceVo(insuranceQueryVo);
+        return HttpResult.ok(insDrivingIntentionInsuranceVo);
+    }
+
+    @ApiOperation(value = "添加驾意险规则")
+    @PostMapping("/addDrivingInsurance")
+    public HttpResult addDrivingInsurance(@RequestBody PtlAgreementNonCarProductRule ptlAgreementNonCarProductRule) {
+        boolean save = ptlAgreementNonCarProductRuleService.save(ptlAgreementNonCarProductRule);
+        return save ? HttpResult.ok("添加成功") : HttpResult.error("添加失败");
+    }
+
+    @ApiOperation(value = "查看驾意险规则")
+    @PostMapping("/catDrivingInsuranceRule")
+    public HttpResult catDrivingInsuranceRule(@RequestBody DrivingInsuranceQueryVo drivingInsuranceQueryVo){
+        Page<T> Page = buildPageRequest(drivingInsuranceQueryVo.getPageDto());
+        Page drivingInsuranceRule = ptlAgreementNonCarProductRuleService.getDrivingInsuranceRule(Page, drivingInsuranceQueryVo);
+        return HttpResult.ok(buildPageResponse(drivingInsuranceRule));
+    }
+
+    @ApiOperation(value = "驾意险规则详情")
+    @GetMapping("/getDrivingInsuranceRuleDetail")
+    public HttpResult getDrivingInsuranceRuleDetail(@RequestParam String id) {
+        PtlAgreementNonCarProductRule ptlAgreementNonCarProductRule = ptlAgreementNonCarProductRuleService.getById(id);
+        if(Integer.parseInt(ptlAgreementNonCarProductRule.getParentId()) > 0){
+            PtlAgreementNonCarProductRule byParentId = ptlAgreementNonCarProductRuleService.getByParentId(ptlAgreementNonCarProductRule.getParentId());
+            ptlAgreementNonCarProductRule.setParentId(byParentId.getParentId());
+            ptlAgreementNonCarProductRule.setParentName(byParentId.getParentName());
+        }
+        return HttpResult.ok(ptlAgreementNonCarProductRule);
+    }
+
+    @ApiOperation(value = "修改驾意险规则")
+    @PostMapping("/updateDrivingInsurance")
+    public HttpResult updateDrivingInsurance(@RequestBody PtlAgreementNonCarProductRule ptlAgreementNonCarProductRule) {
+        boolean update = ptlAgreementNonCarProductRuleService.updateById(ptlAgreementNonCarProductRule);
+        return update ? HttpResult.ok("修改成功") : HttpResult.error("修改失败");
+    }
+
+    @ApiOperation(value = "删除驾意险规则")
+    @PostMapping("/deleteDrivingInsurance")
+    public HttpResult deleteDrivingInsurance(@RequestBody PtlAgreementNonCarProductRule ptlAgreementNonCarProductRule) {
+        boolean remove = ptlAgreementNonCarProductRuleService.removeById(ptlAgreementNonCarProductRule);
+        return remove ? HttpResult.ok("删除成功") : HttpResult.error("删除失败");
+    }
+
+
+    @ApiOperation(value = "根据规则获取驾意险信息")
+    @PostMapping(value = "getDrivingInsuranceRule")
+    public HttpResult<List<InsDrivingIntentionInsuranceVo>> getDrivingInsuranceRule(@RequestBody NoCarInsuranceQueryVo insuranceQueryVo) {
+        List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = insDrivingIntentionInsuranceService.getInsDrivingIntentionInsuranceRule(insuranceQueryVo);
+        return HttpResult.ok(insDrivingIntentionInsuranceVo);
+    }
+}

+ 11 - 0
src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceMapper.java

@@ -0,0 +1,11 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Mapper
+ */
+public interface InsDrivingIntentionInsuranceMapper extends BaseMapper<InsDrivingIntentionInsurance> {
+
+}

+ 12 - 0
src/main/java/com/ydtech/modules/order/dao/InsDrivingIntentionInsuranceSonMapper.java

@@ -0,0 +1,12 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Mapper
+ */
+public interface InsDrivingIntentionInsuranceSonMapper extends BaseMapper<InsDrivingIntentionInsuranceSon> {
+
+}

+ 12 - 0
src/main/java/com/ydtech/modules/order/dao/PtlAgreementNonCarProductRuleMapper.java

@@ -0,0 +1,12 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Mapper
+ */
+public interface PtlAgreementNonCarProductRuleMapper extends BaseMapper<PtlAgreementNonCarProductRule> {
+
+}

+ 74 - 0
src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsurance.java

@@ -0,0 +1,74 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 驾意险实体类
+ */
+@TableName(value = "ins_driving_intention_insurance")
+@Data
+public class InsDrivingIntentionInsurance implements Serializable {
+
+
+    private static final long serialVersionUID = 2549373518435897775L;
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+
+    /**
+     * 父id
+     */
+    @TableField(value = "parent_id")
+    private Integer parentId;
+
+    @TableField(value = "company_id")
+    private String companyId;
+
+    /**
+     * 产品名称
+     */
+    @TableField(value = "project_name")
+    private String projectName;
+
+    /**
+     * 产品code
+     */
+    @TableField(value = "project_code")
+    private String projectCode;
+
+    /**
+     * 附加code
+     */
+    @TableField(value = "risk_code")
+    private String riskCode;
+
+    /**
+     * 座位数
+     */
+    @TableField(value = "seat_num")
+    private String seatNum;
+
+    /**
+     * 保额
+     */
+    @TableField(value = "sum_amount")
+    private String sumAmount;
+
+    /**
+     * 保费
+     */
+    @TableField(value = "sum_premium")
+    private String sumPremium;
+
+
+}

+ 58 - 0
src/main/java/com/ydtech/modules/order/entity/InsDrivingIntentionInsuranceSon.java

@@ -0,0 +1,58 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 驾意险详细险种实体类
+ */
+@TableName(value = "ins_driving_intention_insurance_son")
+@Data
+public class InsDrivingIntentionInsuranceSon implements Serializable {
+
+
+    private static final long serialVersionUID = 2549373518435897776L;
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+
+    /**
+     * 父id
+     */
+    @TableField(value = "driving_code_id")
+    private String drivingCodeId;
+
+    /**
+     * 产品名称
+     */
+    @TableField(value = "code")
+    private String code;
+
+    /**
+     * 产品code
+     */
+    @TableField(value = "name")
+    private String name;
+
+    /**
+     * 保额
+     */
+    @TableField(value = "amount")
+    private String amount;
+
+    /**
+     * 保费
+     */
+    @TableField(value = "premium")
+    private String premium;
+    
+
+}

+ 126 - 0
src/main/java/com/ydtech/modules/order/entity/PtlAgreementNonCarProductRule.java

@@ -0,0 +1,126 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 驾意险规则实体类
+ */
+@TableName(value = "ptl_agreement_non_car_product_rule")
+@Data
+public class PtlAgreementNonCarProductRule implements Serializable {
+
+
+    private static final long serialVersionUID = 2549373518435897775L;
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+
+    /**
+     * 父id
+     */
+    @ApiModelProperty(value = "协议id")
+    @TableField(value = "agreement_id")
+    private String agreementId;
+
+    @ApiModelProperty(value = "父产品id")
+    @TableField(value = "parent_id")
+    private String parentId;
+
+    @ApiModelProperty(value = "父产品名称")
+    @TableField(value = "parent_name")
+    private String parentName;
+
+    /**
+     * 非车产品id
+     */
+    @ApiModelProperty(value = "非车产品id")
+    @TableField(value = "product_id")
+    private String productId;
+
+    /**
+     * 产品名称
+     */
+    @ApiModelProperty(value = "非车产品名称")
+    @TableField(value = "product_name")
+    private String productName;
+
+    /**
+     * 产品code
+     */
+    @ApiModelProperty(value = "非车规则描述")
+    @TableField(value = "rule_desc")
+    private String ruleDesc;
+
+    /**
+     * 规则启动时间
+     */
+    @ApiModelProperty(value = "规则始期")
+    @TableField(value = "rule_start_date")
+    private String ruleStartDate;
+
+    /**
+     * 规则终止时间
+     */
+    @ApiModelProperty(value = "规则止期")
+    @TableField(value = "rule_end_date")
+    private String ruleEndDate;
+
+    /**
+     * 座位数
+     */
+    @ApiModelProperty(value = "座位数值")
+    @TableField(value = "seat_num_min")
+    private String seatNumMin;
+
+    /**
+     * 座位数
+     */
+    @ApiModelProperty(value = "座位数值")
+    @TableField(value = "seat_num_max")
+    private String seatNumMax;
+
+    /**
+     * 使用性质
+     */
+    @ApiModelProperty(value = "使用性质")
+    @TableField(value = "use_nature")
+    private String useNature;
+
+    /**
+     * 三者保额
+     */
+    @ApiModelProperty(value = "三者保额")
+    @TableField(value = "third_party_lnsurance_min")
+    private String thirdPartyLnsuranceMin;
+
+    /**
+     * 三者保额
+     */
+    @ApiModelProperty(value = "三者保额")
+    @TableField(value = "third_party_lnsurance_max")
+    private String thirdPartyLnsuranceMax;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty(value = "排序 越小越靠前")
+    @TableField(value = "sort")
+    private String sort;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private String createTime;
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/order/entity/vo/DrivingInsuranceQueryVo.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.order.entity.vo;
+
+import com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 驾意险的查询VO
+ */
+@Data
+public class DrivingInsuranceQueryVo extends PageRequest {
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "协议id")
+    private String agreementId;
+
+    @ApiModelProperty(value = "规则起期")
+    private String ruleStartTime;
+
+    @ApiModelProperty(value = "规则止期")
+    private String ruleEndTime;
+}

+ 92 - 0
src/main/java/com/ydtech/modules/order/entity/vo/InsDrivingIntentionInsuranceVo.java

@@ -0,0 +1,92 @@
+package com.ydtech.modules.order.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class InsDrivingIntentionInsuranceVo {
+
+    /**
+     *  id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+
+    /**
+     * 父id
+     */
+    @TableField(value = "parent_id")
+    private Integer parentId;
+
+    /**
+     * 产品名称
+     */
+    @ApiModelProperty(value = "产品名称")
+    private String projectName;
+
+    /**
+     * 产品code
+     */
+    @ApiModelProperty(value = "产品code")
+    private String projectCode;
+
+    @ApiModelProperty(value = "附加code")
+    private String riskCode;
+
+    /**
+     * 座位数
+     */
+    @ApiModelProperty(value = "座位数")
+    private String seatNum;
+
+    /**
+     * 保额
+     */
+    @ApiModelProperty(value = "保额")
+    private String sumAmount;
+
+    /**
+     * 保费
+     */
+    @ApiModelProperty(value = "保费")
+    private String sumPremium;
+
+    @ApiModelProperty(value = "是否默认")
+    private Boolean isDefault;
+
+    @ApiModelProperty(value = "份数")
+    private String quantity;
+
+    /**
+     * children对象
+     */
+    @ApiModelProperty(value = "children对象")
+    private List<InsDrivingIntentionInsuranceVo> children;
+
+    @ApiModelProperty(value = "son对象")
+    private List<InsDrivingIntentionInsuranceSon> son;
+
+
+
+    public InsDrivingIntentionInsuranceVo(InsDrivingIntentionInsurance insDrivingIntentionInsurance) {
+        this.id = insDrivingIntentionInsurance.getId();
+        this.parentId = insDrivingIntentionInsurance.getParentId();
+        this.projectName = insDrivingIntentionInsurance.getProjectName();
+        this.projectCode = insDrivingIntentionInsurance.getProjectCode();
+        this.riskCode = insDrivingIntentionInsurance.getRiskCode();
+        this.seatNum = insDrivingIntentionInsurance.getSeatNum();
+        this.sumAmount = insDrivingIntentionInsurance.getSumAmount();
+        this.sumPremium = insDrivingIntentionInsurance.getSumPremium();
+    }
+}

+ 29 - 0
src/main/java/com/ydtech/modules/order/entity/vo/NoCarInsuranceQueryVo.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.order.entity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 驾意险的查询VO
+ */
+@Data
+public class NoCarInsuranceQueryVo {
+
+    @ApiModelProperty(value = "协议id")
+    private String agreementId;
+
+    @ApiModelProperty(value = "公司code")
+    private String companyCode;
+
+    @ApiModelProperty(value = "座位数")
+    private String seatNum;
+
+    @ApiModelProperty(value = "规则座位数")
+    private String ruleSeatNum;
+
+    @ApiModelProperty(value = "规则使用性质")
+    private String ruleUseNature;
+
+    @ApiModelProperty(value = "规则三者保额")
+    private String ruleThirdPartyInsurance;
+}

+ 35 - 0
src/main/java/com/ydtech/modules/order/entity/vo/QuoteAccidentalDrivingVo.java

@@ -0,0 +1,35 @@
+package com.ydtech.modules.order.entity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 报价 驾意险Vo
+ */
+@Data
+public class QuoteAccidentalDrivingVo {
+
+    @ApiModelProperty("parentId")
+    private String parentId;
+
+    @ApiModelProperty("商品号")
+    private String goodsCode;
+
+    @ApiModelProperty("份数")
+    private int quantity;
+
+    @ApiModelProperty("商品名称")
+    private String goodsName;
+
+//    @ApiModelProperty("产品代码")
+//    private String prodCode;
+//
+//    @ApiModelProperty("险种代码")
+//    private String riskCode;
+
+    @ApiModelProperty("保额")
+    private String amount;
+
+    @ApiModelProperty("保费")
+    private String premium;
+}

+ 31 - 0
src/main/java/com/ydtech/modules/order/service/InsDrivingIntentionInsuranceService.java

@@ -0,0 +1,31 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsCopyFeeOrder;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+
+import java.util.List;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Service
+ */
+public interface InsDrivingIntentionInsuranceService extends IService<InsDrivingIntentionInsurance> {
+
+    /**
+     * 根据查询条件获取驾意险信息
+     * @param insuranceVo
+     * @return
+     */
+    List<InsDrivingIntentionInsuranceVo> getInsDrivingIntentionInsuranceVo(NoCarInsuranceQueryVo insuranceVo);
+
+    /**
+     * 根据规则获取驾意险信息
+     * @param insuranceVo
+     * @return
+     */
+    List<InsDrivingIntentionInsuranceVo> getInsDrivingIntentionInsuranceRule(NoCarInsuranceQueryVo insuranceVo);
+
+    InsDrivingIntentionInsurance getByParentId(Integer parentId);
+}

+ 20 - 0
src/main/java/com/ydtech/modules/order/service/PtlAgreementNonCarProductRuleService.java

@@ -0,0 +1,20 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+import com.ydtech.modules.order.entity.vo.DrivingInsuranceQueryVo;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+
+import java.util.List;
+
+/**
+ * 针对表【ins_driving_intention_insurance(驾意险)】的数据库操作Service
+ */
+public interface PtlAgreementNonCarProductRuleService extends IService<PtlAgreementNonCarProductRule> {
+    Page getDrivingInsuranceRule(Page page, DrivingInsuranceQueryVo drivingInsuranceQueryVo);
+
+    PtlAgreementNonCarProductRule getByParentId(String parentId);
+}

+ 133 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsDrivingIntentionInsuranceServiceImpl.java

@@ -0,0 +1,133 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceSonMapper;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.order.service.InsCrawlerOrderService;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
+import com.ydtech.modules.order.service.PtlAgreementNonCarProductRuleService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 驾意险服务实现类
+ */
+@Service
+public class InsDrivingIntentionInsuranceServiceImpl extends ServiceImpl<InsDrivingIntentionInsuranceMapper, InsDrivingIntentionInsurance>
+        implements InsDrivingIntentionInsuranceService {
+
+    @Autowired
+    private PtlAgreementService ptlAgreementService;
+
+    @Autowired
+    private InsDrivingIntentionInsuranceSonMapper sonMapper;
+
+    @Autowired
+    private PtlAgreementNonCarProductRuleService ptlAgreementNonCarProductRuleService;
+
+    /**
+     * 根据查询条件获取驾意险信息
+     * @param insuranceVo
+     * @return
+     */
+    @Override
+    public List<InsDrivingIntentionInsuranceVo> getInsDrivingIntentionInsuranceVo(NoCarInsuranceQueryVo insuranceVo) {
+        LambdaQueryWrapper<InsDrivingIntentionInsurance> query = new LambdaQueryWrapper<InsDrivingIntentionInsurance>();
+
+        if(insuranceVo.getAgreementId() != null){
+            PtlAgreement byAgreementIdNew = ptlAgreementService.getByAgreementIdNew(insuranceVo.getAgreementId());
+            query.eq(InsDrivingIntentionInsurance::getCompanyId, byAgreementIdNew.getInsuranceCompanyId());
+        }else{
+            query.eq(InsDrivingIntentionInsurance::getCompanyId, insuranceVo.getCompanyCode());
+        }
+        if(insuranceVo.getSeatNum() != null) {
+            query.eq(InsDrivingIntentionInsurance::getSeatNum, insuranceVo.getSeatNum());
+        }
+        List<InsDrivingIntentionInsurance> insDrivingIntentionInsurances = baseMapper.selectList(query);
+        List<String> collect = insDrivingIntentionInsurances.stream().map(InsDrivingIntentionInsurance::getProjectCode).collect(Collectors.toList());
+
+        List<InsDrivingIntentionInsuranceSon> insDrivingIntentionInsuranceSons = sonMapper.selectList(new LambdaQueryWrapper<InsDrivingIntentionInsuranceSon>()
+                .in(InsDrivingIntentionInsuranceSon::getDrivingCodeId, collect));
+
+        //组装驾意险信息
+        List<InsDrivingIntentionInsurance> baseDriving = insDrivingIntentionInsurances.stream().filter(x -> x.getParentId() == 0).collect(Collectors.toList());
+        List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = baseDriving.stream()
+                .map(InsDrivingIntentionInsuranceVo::new)
+                .collect(Collectors.toList());
+
+        insDrivingIntentionInsuranceVo.forEach(x -> {
+            x.setSon(insDrivingIntentionInsuranceSons.stream().filter(y -> y.getDrivingCodeId().equals(x.getProjectCode())).collect(Collectors.toList()));
+            List<InsDrivingIntentionInsurance> children = insDrivingIntentionInsurances.stream().filter(y -> y.getParentId() == x.getId()).collect(Collectors.toList());
+            List<InsDrivingIntentionInsuranceVo> childrenVo = children.stream()
+                    .map(InsDrivingIntentionInsuranceVo::new)
+                    .collect(Collectors.toList());
+            childrenVo.forEach(y -> {
+                y.setSon(insDrivingIntentionInsuranceSons.stream().filter(z -> z.getDrivingCodeId().equals(y.getProjectCode())).collect(Collectors.toList()));
+            });
+            x.setChildren(childrenVo);
+        });
+
+        return insDrivingIntentionInsuranceVo;
+    }
+
+    /**
+     * 根据规则获取驾意险信息
+     * @param insuranceVo
+     * @return
+     */
+    @Override
+    public List<InsDrivingIntentionInsuranceVo> getInsDrivingIntentionInsuranceRule(NoCarInsuranceQueryVo insuranceVo) {
+        LambdaQueryWrapper<PtlAgreementNonCarProductRule> query = new LambdaQueryWrapper<PtlAgreementNonCarProductRule>();
+        if(insuranceVo.getCompanyCode() != null){
+            List<PtlAgreement> byCompanyCode = ptlAgreementService.getByCompanyCode(insuranceVo.getCompanyCode());
+            List<String> collect = byCompanyCode.stream().map(x -> x.getId()).collect(Collectors.toList());
+            query.in(PtlAgreementNonCarProductRule::getAgreementId, collect);
+        }else {
+            query.eq(PtlAgreementNonCarProductRule::getAgreementId, insuranceVo.getAgreementId());
+        }
+        query.le(PtlAgreementNonCarProductRule::getSeatNumMin, insuranceVo.getRuleSeatNum());
+        query.ge(PtlAgreementNonCarProductRule::getSeatNumMax, insuranceVo.getRuleSeatNum());
+        query.eq(PtlAgreementNonCarProductRule::getUseNature, insuranceVo.getRuleUseNature());
+        if(insuranceVo.getRuleThirdPartyInsurance() != null) {
+            query.ge(PtlAgreementNonCarProductRule::getThirdPartyLnsuranceMin, insuranceVo.getRuleThirdPartyInsurance());
+            query.le(PtlAgreementNonCarProductRule::getThirdPartyLnsuranceMax, insuranceVo.getRuleThirdPartyInsurance());
+        }
+        query.orderBy(true, true, PtlAgreementNonCarProductRule::getSort);
+        List<PtlAgreementNonCarProductRule> list = ptlAgreementNonCarProductRuleService.list(query);
+        List<InsDrivingIntentionInsuranceVo> insDrivingIntentionInsuranceVo = getInsDrivingIntentionInsuranceVo(insuranceVo);
+        if(!list.isEmpty()){
+            //遍历顶级
+            insDrivingIntentionInsuranceVo.stream()
+                    .filter(item -> item.getProjectCode().toString().equals(list.get(0).getParentId()))
+                    .findFirst()
+                    .ifPresent(item -> item.setIsDefault(true));
+            //遍历下级
+            insDrivingIntentionInsuranceVo.stream()
+                    .flatMap(item -> item.getChildren().stream())
+                    .filter(child -> child.getProjectCode().toString().equals(list.get(0).getProductId()))
+                    .findFirst()
+                    .ifPresent(child -> child.setIsDefault(true));
+        }
+        return insDrivingIntentionInsuranceVo;
+    }
+
+    @Override
+    public InsDrivingIntentionInsurance getByParentId(Integer parentId) {
+        return baseMapper.selectOne(new LambdaQueryWrapper<InsDrivingIntentionInsurance>().eq(InsDrivingIntentionInsurance::getParentId, parentId));
+    }
+}

+ 60 - 0
src/main/java/com/ydtech/modules/order/service/impl/PtlAgreementNonCarProductRuleServiceImpl.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceMapper;
+import com.ydtech.modules.order.dao.InsDrivingIntentionInsuranceSonMapper;
+import com.ydtech.modules.order.dao.PtlAgreementNonCarProductRuleMapper;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsurance;
+import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
+import com.ydtech.modules.order.entity.PtlAgreementNonCarProductRule;
+import com.ydtech.modules.order.entity.vo.DrivingInsuranceQueryVo;
+import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
+import com.ydtech.modules.order.entity.vo.NoCarInsuranceQueryVo;
+import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
+import com.ydtech.modules.order.service.PtlAgreementNonCarProductRuleService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 驾意险服务实现类
+ */
+@Service
+public class PtlAgreementNonCarProductRuleServiceImpl extends ServiceImpl<PtlAgreementNonCarProductRuleMapper, PtlAgreementNonCarProductRule>
+        implements PtlAgreementNonCarProductRuleService {
+
+    @Autowired
+    private PtlAgreementService ptlAgreementService;
+
+    @Autowired
+    private InsDrivingIntentionInsuranceSonMapper sonMapper;
+
+
+    @Override
+    public Page getDrivingInsuranceRule(Page page, DrivingInsuranceQueryVo drivingInsuranceQueryVo) {
+        LambdaQueryWrapper<PtlAgreementNonCarProductRule> wrapper = new LambdaQueryWrapper<>();
+        if(drivingInsuranceQueryVo.getId() != null){
+            wrapper.eq(PtlAgreementNonCarProductRule::getId, drivingInsuranceQueryVo.getId());
+        }
+        if(drivingInsuranceQueryVo.getAgreementId() != null){
+            wrapper.eq(PtlAgreementNonCarProductRule::getAgreementId, drivingInsuranceQueryVo.getAgreementId());
+        }
+        if(drivingInsuranceQueryVo.getRuleStartTime() != null && drivingInsuranceQueryVo.getRuleEndTime() != null){
+            wrapper.ge(PtlAgreementNonCarProductRule::getRuleStartDate, drivingInsuranceQueryVo.getRuleStartTime());
+            wrapper.le(PtlAgreementNonCarProductRule::getRuleEndDate, drivingInsuranceQueryVo.getRuleEndTime());
+        }
+
+        return baseMapper.selectPage(page, wrapper);
+    }
+
+    @Override
+    public PtlAgreementNonCarProductRule getByParentId(String parentId) {
+        return baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreementNonCarProductRule>().eq(PtlAgreementNonCarProductRule::getParentId, parentId));
+    }
+}

+ 83 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementNonCarProductRule.java

@@ -0,0 +1,83 @@
+package com.ydtech.modules.protocols.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 协议非车险产品规则
+ *
+ * @TableName ptl_agreement_non_car_product_rule
+ */
+@TableName(value = "ptl_agreement_non_car_product_rule")
+@Data
+public class PtlAgreementNonCarProductRule implements Serializable {
+    /**
+     * 主键/自增
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 协议id
+     */
+    @TableField(value = "agreement_id")
+    private String agreementId;
+
+    /**
+     * 产品id
+     */
+    @TableField(value = "product_id")
+    private String productId;
+
+    /**
+     * 产品名称
+     */
+    @TableField(value = "product_name")
+    private String productName;
+
+    /**
+     * 费用描述
+     */
+    @TableField(value = "rule_desc")
+    private String ruleDesc;
+
+    /**
+     * 规则起期
+     */
+    @TableField(value = "rule_start_date")
+    private LocalDateTime ruleStartDate;
+
+    /**
+     * 规则止期
+     */
+    @TableField(value = "rule_end_date")
+    private LocalDateTime ruleEndDate;
+
+    @ApiModelProperty(value = "座位数")
+    @TableField(value = "seat_num")
+    private Integer seatNum;
+
+    @ApiModelProperty(value = "车辆性质")
+    @TableField(value = "use_nature")
+    private String useNature;
+
+    @ApiModelProperty(value = "三者保额")
+    @TableField(value = "third_party_lnsurance")
+    private String thirdPartyLnsurance;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time")
+    private String createTime;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+}