浏览代码

协议 python对接

wks 3 年之前
父节点
当前提交
d0c624b1e3
共有 76 个文件被更改,包括 966 次插入1526 次删除
  1. 20 0
      src/main/java/com/ydtech/modules/order/components/InsCrawlerOrderComponents.java
  2. 1 1
      src/main/java/com/ydtech/modules/order/components/InsOrdersComponents.java
  3. 0 49
      src/main/java/com/ydtech/modules/order/controller/AnShengOrderController.java
  4. 4 1
      src/main/java/com/ydtech/modules/order/controller/CarModelController.java
  5. 0 65
      src/main/java/com/ydtech/modules/order/controller/HengBangOrderController.java
  6. 72 0
      src/main/java/com/ydtech/modules/order/controller/InsCrawlerOrderController.java
  7. 9 1
      src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java
  8. 0 53
      src/main/java/com/ydtech/modules/order/controller/InsuranceCrawlerOrderController.java
  9. 0 44
      src/main/java/com/ydtech/modules/order/controller/RenBaoOrderController.java
  10. 0 53
      src/main/java/com/ydtech/modules/order/controller/YongChengOrderController.java
  11. 6 0
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java
  12. 30 6
      src/main/java/com/ydtech/modules/order/entity/api/zm/constants/InsuranceTypeCorrespondence.java
  13. 8 4
      src/main/java/com/ydtech/modules/order/entity/api/zm/constants/TimeConstants.java
  14. 25 12
      src/main/java/com/ydtech/modules/order/entity/api/zm/constants/TransCode.java
  15. 6 6
      src/main/java/com/ydtech/modules/order/entity/api/zm/request/QuotedPriceRequest.java
  16. 16 0
      src/main/java/com/ydtech/modules/order/entity/crawler/constants/CrawlerVerifyPaymentConstants.java
  17. 23 0
      src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerBaseRequest.java
  18. 47 0
      src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerImageRequest.java
  19. 52 0
      src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerAuditResponse.java
  20. 23 0
      src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerBaseResponse.java
  21. 8 8
      src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerQuoteResponse.java
  22. 16 0
      src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerVerifyPaymentResponse.java
  23. 3 0
      src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteVo.java
  24. 0 7
      src/main/java/com/ydtech/modules/order/service/AnShengOrderService.java
  25. 12 2
      src/main/java/com/ydtech/modules/order/service/BaseOrderService.java
  26. 4 1
      src/main/java/com/ydtech/modules/order/service/CarModelService.java
  27. 0 29
      src/main/java/com/ydtech/modules/order/service/HengBangOrderService.java
  28. 8 0
      src/main/java/com/ydtech/modules/order/service/InsOrdersService.java
  29. 10 0
      src/main/java/com/ydtech/modules/order/service/InsuranceCrawlerOrderService.java
  30. 0 6
      src/main/java/com/ydtech/modules/order/service/RenBaoOrderService.java
  31. 0 1
      src/main/java/com/ydtech/modules/order/service/YongAnOrderService.java
  32. 0 17
      src/main/java/com/ydtech/modules/order/service/YongChengOrderService.java
  33. 1 1
      src/main/java/com/ydtech/modules/order/service/ZhongMeiOrderApiService.java
  34. 0 226
      src/main/java/com/ydtech/modules/order/service/impl/AnShengOrderServiceImpl.java
  35. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/CarModelServiceImpl.java
  36. 0 248
      src/main/java/com/ydtech/modules/order/service/impl/HengBangServiceImpl.java
  37. 243 0
      src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java
  38. 27 17
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  39. 0 20
      src/main/java/com/ydtech/modules/order/service/impl/InsuranceCrawlerOrderServiceImpl.java
  40. 0 311
      src/main/java/com/ydtech/modules/order/service/impl/RenBaoOrderServiceImpl.java
  41. 0 217
      src/main/java/com/ydtech/modules/order/service/impl/YongChengOrderServiceImpl.java
  42. 16 20
      src/main/java/com/ydtech/modules/order/service/impl/ZhongMeiOrderApiServiceImpl.java
  43. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/ZhongMeiOrderServiceImpl.java
  44. 4 4
      src/main/java/com/ydtech/modules/protocol/controller/PtlAgreementController.java
  45. 8 1
      src/main/java/com/ydtech/modules/protocol/controller/PtlInsAttributionTemplateController.java
  46. 7 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java
  47. 8 5
      src/main/java/com/ydtech/modules/protocol/dao/PtlCrawlerApiMapper.java
  48. 7 1
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementAttributionDto.java
  49. 18 0
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementDto.java
  50. 18 0
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementInsCompanyDto.java
  51. 1 1
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementProductCostsSaveDto.java
  52. 2 2
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementUnderwritingRulesSaveDto.java
  53. 5 1
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAttributionTemplateDto.java
  54. 1 1
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreement.java
  55. 10 2
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementAttribution.java
  56. 4 4
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementDept.java
  57. 4 4
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementProductCosts.java
  58. 2 2
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementUnderwritingRules.java
  59. 19 2
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlCrawlerApi.java
  60. 0 6
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlCrawlerApiSaveVo.java
  61. 20 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlInsAttributionTemplateVo.java
  62. 1 1
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementAttributionService.java
  63. 13 6
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementDeptService.java
  64. 3 3
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementProductCostsService.java
  65. 16 7
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java
  66. 4 4
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementUnderwritingRulesService.java
  67. 6 4
      src/main/java/com/ydtech/modules/protocol/service/PtlCrawlerApiService.java
  68. 9 1
      src/main/java/com/ydtech/modules/protocol/service/PtlInsAttributionTemplateService.java
  69. 1 1
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementAttributionServiceImpl.java
  70. 18 9
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementDeptServiceImpl.java
  71. 3 3
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementProductCostsServiceImpl.java
  72. 15 7
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java
  73. 4 4
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementUnderwritingRulesServiceImpl.java
  74. 13 5
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlCrawlerApiServiceImpl.java
  75. 26 7
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlInsAttributionTemplateServiceImpl.java
  76. 4 0
      src/main/java/com/ydtech/modules/protocol/utils/AssertionUtils.java

+ 20 - 0
src/main/java/com/ydtech/modules/order/components/InsCrawlerOrderComponents.java

@@ -0,0 +1,20 @@
+package com.ydtech.modules.order.components;
+
+import com.ydtech.components.RenbaoRequestComponents;
+import org.springframework.stereotype.Component;
+
+@Component
+public class InsCrawlerOrderComponents {
+
+    private final RenbaoRequestComponents renbaoRequestComponents;
+
+    public InsCrawlerOrderComponents(RenbaoRequestComponents renbaoRequestComponents) {
+        this.renbaoRequestComponents = renbaoRequestComponents;
+    }
+
+    public <T, B> B request(String url, String companyName, String apiType, T requestBody, Class<B> responseType) {
+        String message = companyName + apiType;
+        return renbaoRequestComponents.post(url, message, requestBody, responseType);
+    }
+
+}

+ 1 - 1
src/main/java/com/ydtech/modules/order/components/InsOrdersComponents.java

@@ -25,7 +25,7 @@ public class InsOrdersComponents {
      * 通订单号获取报价信息
      *
      * @param orderNo 订单ID
-     * @return
+     * @return BaseQuoteInfoVo
      */
     public BaseQuoteInfoVo getQuoteInfo(String orderNo) {
         insOrdersService.existOrder(orderNo);

+ 0 - 49
src/main/java/com/ydtech/modules/order/controller/AnShengOrderController.java

@@ -1,49 +0,0 @@
-package com.ydtech.modules.order.controller;
-
-import com.ydtech.aop.request.RequestSingleParam;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.order.components.InsOrdersComponents;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.AnShengOrderService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@Api(tags = "安盛天平")
-@RequestMapping("/order/anSheng")
-@RestController
-public class AnShengOrderController {
-
-    private final InsOrdersComponents insOrdersComponents;
-
-    private final AnShengOrderService anShengOrderService;
-
-    public AnShengOrderController(InsOrdersComponents insOrdersComponents, AnShengOrderService anShengOrderService) {
-        this.insOrdersComponents = insOrdersComponents;
-        this.anShengOrderService = anShengOrderService;
-    }
-
-    @PostMapping("/quote")
-    @ApiOperation("报价")
-    public HttpResult quote(@RequestBody BaseQuoteVo<Object> quoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
-        return anShengOrderService.quote(quoteInfo, quoteVo);
-    }
-
-    @PostMapping("/audit")
-    @ApiOperation("核保")
-    public HttpResult audit(@RequestSingleParam(value = "companyId") String companyId) {
-        return this.anShengOrderService.audit(companyId);
-    }
-
-    @PostMapping(value = "/submitImage")
-    @ApiOperation(value = "提交影像信息")
-    public HttpResult submitImage(@RequestSingleParam(value = "orderNo") String orderNo) {
-        return this.anShengOrderService.submitImage(orderNo);
-    }
-
-}

+ 4 - 1
src/main/java/com/ydtech/modules/order/controller/CarModelController.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.controller;
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.ins.model.ya.CarModelDTO;
 import com.ydtech.modules.order.service.CarModelService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -9,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @Api(tags = "车型")
 @RestController
 @RequestMapping("/order/carModel")
@@ -22,7 +25,7 @@ public class CarModelController {
 
     @GetMapping("/vinSearch")
     @ApiOperation("vin码查询")
-    public HttpResult vinSearch(@RequestParam String frameNo) {
+    public HttpResult<List<CarModelDTO>> vinSearch(@RequestParam String frameNo) {
         return carModelService.vinSearch(frameNo);
     }
 

+ 0 - 65
src/main/java/com/ydtech/modules/order/controller/HengBangOrderController.java

@@ -1,65 +0,0 @@
-package com.ydtech.modules.order.controller;
-
-import com.ydtech.aop.request.RequestSingleParam;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.exception.SystemException;
-import com.ydtech.modules.ins.model.hb.HengbangPolicyPrintResponse;
-import com.ydtech.modules.order.components.InsOrdersComponents;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.HengBangOrderService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@Api(tags = "恒邦财险 Spider")
-@RestController
-@RequestMapping("/order/hengBang")
-public class HengBangOrderController {
-
-    private final InsOrdersComponents insOrdersComponents;
-
-    private final HengBangOrderService hengBangOrderService;
-
-    public HengBangOrderController(HengBangOrderService hengBangOrderService, InsOrdersComponents insOrdersComponents) {
-        this.hengBangOrderService = hengBangOrderService;
-        this.insOrdersComponents = insOrdersComponents;
-    }
-
-    @PostMapping("/quote")
-    @ApiOperation("报价")
-    public HttpResult quote(@RequestBody BaseQuoteVo<Object> quoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
-        return hengBangOrderService.quote(quoteInfo, quoteVo);
-    }
-
-    @PostMapping("/audit")
-    @ApiOperation("核保")
-    public HttpResult audit(@RequestSingleParam(value = "companyId") String companyId) {
-        return this.hengBangOrderService.audit(companyId);
-    }
-
-    @PostMapping(value = "/submitImage")
-    @ApiOperation(value = "提交影像信息")
-    public HttpResult submitImage(@RequestSingleParam(value = "quoteno") String quoteno) {
-        try {
-            return this.hengBangOrderService.submitImage(quoteno);
-        } catch (Exception e) {
-            throw new SystemException("提交影像失败");
-        }
-    }
-
-    @PostMapping(value = "/getPolicyPrint")
-    @ApiOperation(value = "获取电子保单")
-    public HengbangPolicyPrintResponse getPolicyPrint(@RequestSingleParam(value = "companyId") String companyId) {
-        try {
-            return this.hengBangOrderService.getPolicyPrint(companyId);
-        } catch (Exception e) {
-            throw new SystemException("获取电子保单失败");
-        }
-    }
-
-}

+ 72 - 0
src/main/java/com/ydtech/modules/order/controller/InsCrawlerOrderController.java

@@ -0,0 +1,72 @@
+package com.ydtech.modules.order.controller;
+
+
+import com.ydtech.aop.request.RequestSingleParam;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.ins.model.vo.QuoteRespVo;
+import com.ydtech.modules.order.components.InsOrdersComponents;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
+import com.ydtech.modules.order.service.InsuranceCrawlerOrderService;
+import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "爬虫对接")
+@RequestMapping("/insurance/crawler")
+@RestController
+public class InsCrawlerOrderController extends BaseController {
+
+    private final InsuranceCrawlerOrderService insuranceCrawlerOrderService;
+
+    private final InsOrdersComponents insOrdersComponents;
+
+    private final PtlAgreementDeptService ptlAgreementDeptService;
+
+    public InsCrawlerOrderController(InsOrdersComponents insOrdersComponents, InsuranceCrawlerOrderService insuranceCrawlerOrderService, PtlAgreementDeptService ptlAgreementDeptService) {
+        this.insOrdersComponents = insOrdersComponents;
+        this.insuranceCrawlerOrderService = insuranceCrawlerOrderService;
+        this.ptlAgreementDeptService = ptlAgreementDeptService;
+    }
+
+    @PostMapping("/quote")
+    @ApiOperation("报价")
+    public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<Object> baseQuoteVo) {
+        // 判断协议是否可以报价
+        ptlAgreementDeptService.agreementIsAuthorized(getDeptId(), baseQuoteVo.getAgreementId());
+        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(baseQuoteVo.getOrderNo());
+        return insuranceCrawlerOrderService.quote(quoteInfo, baseQuoteVo);
+    }
+
+    @PostMapping(value = "/submitImage")
+    @ApiOperation(value = "提交影像信息")
+    public HttpResult<Object> submitImage(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
+        return insuranceCrawlerOrderService.submitImage(subOrderNo);
+    }
+
+    @PostMapping("/audit")
+    @ApiOperation("核保")
+    public HttpResult<Object> audit(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
+        return insuranceCrawlerOrderService.audit(subOrderNo);
+    }
+
+    @PostMapping(value = "/verifyPayment")
+    @ApiOperation(value = "缴费状态查询")
+    public HttpResult verifyPayment(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
+        return insuranceCrawlerOrderService.verifyPayment(subOrderNo);
+    }
+
+//
+//    @PostMapping("/getPolicyPrint")
+//    @ApiOperation(value = "电子保单")
+//    public HttpResult getPolicyPrint(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
+//        return new HttpResult();
+//    }
+
+
+}

+ 9 - 1
src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.aop.request.RequestSingleParam;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.components.InsOrdersComponents;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsAccidentalDriving;
@@ -13,6 +14,7 @@ import com.ydtech.modules.order.entity.vo.*;
 import com.ydtech.modules.order.service.InsAccidentalDrivingService;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.util.ObjectUtils;
@@ -28,7 +30,7 @@ import java.util.List;
 @Api(tags = "订单")
 @RequestMapping("/insurance/order")
 @RestController
-public class InsOrdersController {
+public class InsOrdersController extends BaseController {
 
     private final InsOrdersService insOrdersService;
 
@@ -45,6 +47,12 @@ public class InsOrdersController {
         this.insAccidentalDrivingService = insAccidentalDrivingService;
     }
 
+    @PostMapping("/getAgreementInsCompany")
+    @ApiOperation(value = "获取协议报价保险公司")
+    public HttpResult<List<PtlAgreementInsCompanyDto>> getAgreementInsCompany(){
+        return this.insOrdersService.getAgreementInsCompany(getDeptId());
+    }
+
     @PostMapping("/generateOrder")
     @ApiOperation(value = "生成订单")
     public HttpResult<InsOrders> generateOrder(@Validated @RequestBody BaseQuoteInfoVo quoteInfoVo) {

+ 0 - 53
src/main/java/com/ydtech/modules/order/controller/InsuranceCrawlerOrderController.java

@@ -1,53 +0,0 @@
-package com.ydtech.modules.order.controller;
-
-
-import com.ydtech.aop.request.RequestSingleParam;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.order.entity.vo.AccidentalDrivingVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@Api(tags = "爬虫对接")
-@RequestMapping("/insurance/crawler")
-@RestController
-public class InsuranceCrawlerOrderController {
-
-
-
-    @PostMapping("/quote")
-    @ApiOperation("报价")
-    public HttpResult quote(@RequestBody BaseQuoteVo<AccidentalDrivingVo> zmQuoteVo) {
-        return new HttpResult();
-    }
-
-    @PostMapping(value = "/submitImage")
-    @ApiOperation(value = "提交影像信息")
-    public HttpResult submitImage(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
-        return new HttpResult();
-    }
-
-    @PostMapping("/audit")
-    @ApiOperation("核保")
-    public HttpResult audit(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
-        return new HttpResult();
-    }
-
-    @PostMapping(value = "/verifyPayment")
-    @ApiOperation(value = "缴费状态查询")
-    public HttpResult verifyPayment(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
-        return new HttpResult();
-    }
-
-    @PostMapping("/getPolicyPrint")
-    @ApiOperation(value = "电子保单")
-    public HttpResult getPolicyPrint(@RequestSingleParam(value = "subOrderNo") String subOrderNo) {
-        return new HttpResult();
-    }
-
-
-}

+ 0 - 44
src/main/java/com/ydtech/modules/order/controller/RenBaoOrderController.java

@@ -1,44 +0,0 @@
-package com.ydtech.modules.order.controller;
-
-
-import com.ydtech.aop.request.RequestSingleParam;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.order.components.InsOrdersComponents;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.RenBaoOrderService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@Api(tags = "人保财险 Spider")
-@RestController
-@RequestMapping("/order/renBao")
-public class RenBaoOrderController {
-
-    private final InsOrdersComponents insOrdersComponents;
-
-    private final RenBaoOrderService renBaoOrderService;
-
-    public RenBaoOrderController(InsOrdersComponents insOrdersComponents, RenBaoOrderService renBaoOrderService) {
-        this.insOrdersComponents = insOrdersComponents;
-        this.renBaoOrderService = renBaoOrderService;
-    }
-
-    @PostMapping("/quote")
-    @ApiOperation("报价")
-    public HttpResult quote(@RequestBody BaseQuoteVo<Object> quoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
-        return this.renBaoOrderService.quote(quoteInfo, quoteVo);
-    }
-
-    @PostMapping("/audit")
-    @ApiOperation("核保")
-    public HttpResult audit(@RequestSingleParam(value = "companyId") String companyId) {
-        return this.renBaoOrderService.audit(companyId);
-    }
-
-}

+ 0 - 53
src/main/java/com/ydtech/modules/order/controller/YongChengOrderController.java

@@ -1,53 +0,0 @@
-package com.ydtech.modules.order.controller;
-
-
-import com.ydtech.aop.request.RequestSingleParam;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.ins.model.yc.YongchengPolicyPrintResponse;
-import com.ydtech.modules.order.components.InsOrdersComponents;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.YongChengOrderService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.io.IOException;
-
-@Api(tags = "永诚财险 Spider")
-@RestController
-@RequestMapping("/order/yongCheng")
-public class YongChengOrderController {
-
-    private final InsOrdersComponents insOrdersComponents;
-
-    private final YongChengOrderService yongChengOrderService;
-
-    public YongChengOrderController(InsOrdersComponents insOrdersComponents, YongChengOrderService yongChengOrderService) {
-        this.insOrdersComponents = insOrdersComponents;
-        this.yongChengOrderService = yongChengOrderService;
-    }
-
-    @PostMapping("/quote")
-    @ApiOperation("报价")
-    public HttpResult quote(@RequestBody BaseQuoteVo<Object> quoteVo) {
-        BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
-        return this.yongChengOrderService.quote(quoteInfo, quoteVo);
-    }
-
-    @PostMapping("/audit")
-    @ApiOperation("核保")
-    public HttpResult audit(@RequestSingleParam(value = "companyId") String companyId) {
-        return this.yongChengOrderService.audit(companyId);
-    }
-
-    @PostMapping("/getPolicyPrint")
-    @ApiOperation(value = "电子保单")
-    public YongchengPolicyPrintResponse getPolicyPrint(@RequestSingleParam(value = "companyId") String companyId) throws IOException {
-        return this.yongChengOrderService.getPolicyPrint(companyId);
-    }
-
-}

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java

@@ -33,6 +33,12 @@ public class InsAreaCompany implements Serializable {
      */
     @TableField(value = "orderno")
     private String orderno;
+    /**
+     * 协议id
+     */
+    @TableField(value = "agreement_id")
+    private String agreementId;
+
     /**
      * 订单状态
      */

+ 30 - 6
src/main/java/com/ydtech/modules/order/entity/api/zm/constants/InsuranceTypeCorrespondence.java

@@ -14,29 +14,53 @@ public class InsuranceTypeCorrespondence {
     private InsuranceTypeCorrespondence() {
     }
 
-    public static final String[] JINZHANGGUI_TYPE = {"A", "B", "D3", "D4", "MJ1", "MJ2", "MJ3", "MJ4", "BD", "L", "SY_FJ_YBW1", "SY_FJ_YBW2", "SY_FJ_YBW3"};
+    protected static final String[] JINZHANGGUI_TYPE = {"A", "B", "D3", "D4", "MJ1", "MJ2", "MJ3", "MJ4", "BD", "L", "SY_FJ_YBW1", "SY_FJ_YBW2", "SY_FJ_YBW3"};
 
-    public static final String[] CONNECT_INSURANCE_TYPE = {"01", "02", "041", "044", "501", "502", "5041", "5044", "49", "21", "5302", "5344", "5341"};
+    protected static final String[] CONNECT_INSURANCE_TYPE = {"01", "02", "041", "044", "501", "502", "5041", "5044", "49", "21", "5302", "5344", "5341"};
 
     // 乘客
-    public static final String[] PASSENGER = {"D4", "SY_FJ_YBW2"};
+    protected static final String[] PASSENGER = {"D4", "SY_FJ_YBW2"};
 
     //司机
-    public static final String[] DRIVER = {"D3", "SY_FJ_YBW3"};
+    protected static final String[] DRIVER = {"D3", "SY_FJ_YBW3"};
 
     // 绝对免赔
-    public static final String[] ABSOLUTE_DEDUCTIBLE = {"MJ1", "MJ2", "MJ3", "MJ4"};
+    protected static final String[] ABSOLUTE_DEDUCTIBLE = {"MJ1", "MJ2", "MJ3", "MJ4"};
 
     public static final String MANUAL_UNDERWRITING = "人工复核";
 
     public static final String TRAFFIC = "0507";
     public static final String BUSINESS = "0510";
 
-    public static final Map<String, String> RISK = new HashMap<>();
+    protected static final Map<String, String> RISK = new HashMap<>();
 
     static {
         RISK.put("0507", "0330");
         RISK.put("0510", "0361");
     }
 
+    public static String[] getJinZhangGuiType() {
+        return JINZHANGGUI_TYPE;
+    }
+
+    public static String[] getConnectInsuranceType() {
+        return CONNECT_INSURANCE_TYPE;
+    }
+
+    public static String[] getPassenger() {
+        return PASSENGER;
+    }
+
+    public static String[] getDriver() {
+        return DRIVER;
+    }
+
+    public static String[] getAbsoluteDeductible() {
+        return ABSOLUTE_DEDUCTIBLE;
+    }
+
+    public static Map<String, String> getRisk() {
+        return RISK;
+    }
+
 }

+ 8 - 4
src/main/java/com/ydtech/modules/order/entity/api/zm/constants/TimeConstants.java

@@ -3,13 +3,17 @@ package com.ydtech.modules.order.entity.api.zm.constants;
 /**
  * @author wenks
  * @version 0.0.2
- * @description TODO
+ * @description 时间常量
  * @date 2023/4/23 14:15
  */
-public interface TimeConstants {
+public class TimeConstants {
 
-    String START_TIME = "00:00:00";
+    private TimeConstants() {
+        throw new IllegalStateException("Utility class");
+    }
 
-    String END_TIME = "23:59:59";
+    public static final String START_TIME = "00:00:00";
+
+    public static final String END_TIME = "23:59:59";
 
 }

+ 25 - 12
src/main/java/com/ydtech/modules/order/entity/api/zm/constants/TransCode.java

@@ -6,30 +6,43 @@ package com.ydtech.modules.order.entity.api.zm.constants;
  * @description 交互代码
  * @date 2023/4/25 16:54
  */
-public interface TransCode {
+public class TransCode {
+
+    private TransCode() {
+        throw new IllegalStateException("Utility class");
+    }
 
     //车型查询
-    String MODELS_QUERY = "ModelsQuery";
+   public static final String MODELS_QUERY = "ModelsQuery";
+
     //报价
-    String QUOTE_PRICE = "QuotedPrice";
+    public static final String QUOTE_PRICE = "QuotedPrice";
+
     //提交核保
-    String SUBMIT = "Submit";
+    public static final String SUBMIT = "Submit";
+
     //缴费查询
-    String ORDER_STATUS = "OrderStatus";
+    public static final String ORDER_STATUS = "OrderStatus";
+
     //投保单核保状态查询
-    String SUBMIT_STATUS_QUERY = "SubmitStatusQuery";
+    public static final String SUBMIT_STATUS_QUERY = "SubmitStatusQuery";
 
     // 投保单核保状态 url 参数
-    String SUBMIT_STATUS = "SubmitStatus";
+    public static final String SUBMIT_STATUS = "SubmitStatus";
+
     //电子保单下载
-    String INSURANCE_POLICY_PRINT = "InsurancePolicyPrint";
+    public static final String INSURANCE_POLICY_PRINT = "InsurancePolicyPrint";
+
     //影像上传
-    String UPLOAD_IMAGE = "UploadImage";
+    public static final String UPLOAD_IMAGE = "UploadImage";
+
     //校验是否发送短信验证码
-    String CHECK_SMS_CODE = "CheckSMScode";
+    public static final String CHECK_SMS_CODE = "CheckSMScode";
+
     //校验验证码是否正确
-    String VALID_SMS_CODE = "ValidSMScode";
+    public static final String VALID_SMS_CODE = "ValidSMScode";
+
     //续保查询
-    String RenewalQuery = "RenewalQuery";
+    public static final String RENEWAL_QUERY = "RenewalQuery";
 
 }

+ 6 - 6
src/main/java/com/ydtech/modules/order/entity/api/zm/request/QuotedPriceRequest.java

@@ -290,7 +290,7 @@ public class QuotedPriceRequest extends BaseRequest {
             private String reinsuranceFlag;
 
             public ContractMainDTO(RiskInfoVo riskInfoVo) {
-                this.riskCode = InsuranceTypeCorrespondence.RISK.get(riskInfoVo.getRiskCode());
+                this.riskCode = InsuranceTypeCorrespondence.getRisk().get(riskInfoVo.getRiskCode());
                 String startDate = riskInfoVo.getStartDate();
                 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                 LocalDate localDate = LocalDate.parse(startDate, formatter);
@@ -349,25 +349,25 @@ public class QuotedPriceRequest extends BaseRequest {
                 for (KindInfoVo kindInfoVo : kindInfoVos) {
                     CoverageDTO coverageDTO = new CoverageDTO();
                     String code = kindInfoVo.getKindCode();
-                    int i = ArrayUtil.indexOf(InsuranceTypeCorrespondence.JINZHANGGUI_TYPE, code);
-                    String s = InsuranceTypeCorrespondence.CONNECT_INSURANCE_TYPE[i];
+                    int i = ArrayUtil.indexOf(InsuranceTypeCorrespondence.getJinZhangGuiType(), code);
+                    String s = InsuranceTypeCorrespondence.getConnectInsuranceType()[i];
                     ContractEnum contractEnum = Enum.valueOf(ContractEnum.class, "C_" + s);
                     coverageDTO.kindName = contractEnum.getKindName();
                     coverageDTO.kindCode = contractEnum.getKindCode();
                     coverageDTO.amount = (int) kindInfoVo.getAmount();
                     coverageDTO.unitAmount = (int) kindInfoVo.getUnitAmount();
                     // 司机
-                    if (ArrayUtil.indexOf(InsuranceTypeCorrespondence.DRIVER, code) >= 0) {
+                    if (ArrayUtil.indexOf(InsuranceTypeCorrespondence.getDriver(), code) >= 0) {
                         coverageDTO.quantity = 1;
                         coverageDTO.unitAmount = (int) kindInfoVo.getAmount();
                     }
 
-                    if (ArrayUtil.indexOf(InsuranceTypeCorrespondence.PASSENGER, code) >= 0) {
+                    if (ArrayUtil.indexOf(InsuranceTypeCorrespondence.getPassenger(), code) >= 0) {
                         coverageDTO.quantity = quantity;
                         coverageDTO.amount = (int) kindInfoVo.getUnitAmount() * quantity;
                     }
                     // 绝对免赔
-                    if (ArrayUtil.indexOf(InsuranceTypeCorrespondence.ABSOLUTE_DEDUCTIBLE, code) >= 0) {
+                    if (ArrayUtil.indexOf(InsuranceTypeCorrespondence.getAbsoluteDeductible(), code) >= 0) {
                         coverageDTO.deductible = "-" + kindInfoVo.getDeductibleRate();
                     }
                     list.add(coverageDTO);

+ 16 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/constants/CrawlerVerifyPaymentConstants.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.order.entity.crawler.constants;
+
+/**
+ * 0未缴费,1已缴费
+ */
+public class CrawlerVerifyPaymentConstants {
+
+    private CrawlerVerifyPaymentConstants() {
+        throw new IllegalArgumentException("");
+    }
+
+    public static final int NON_PAYMENT = 0;
+    public static final int PAID = 1;
+
+
+}

+ 23 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerBaseRequest.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.order.entity.crawler.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CrawlerBaseRequest implements Serializable {
+
+    private static final long serialVersionUID = 6644283073237210601L;
+
+    /**
+     * 订单号
+     */
+    @JsonProperty(value = "plyappno")
+    private String orderNo;
+
+}

+ 47 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/request/CrawlerImageRequest.java

@@ -0,0 +1,47 @@
+package com.ydtech.modules.order.entity.crawler.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+@Data
+public class CrawlerImageRequest extends CrawlerBaseRequest {
+
+    private static final long serialVersionUID = -2724505138992272089L;
+
+    @JsonProperty("b64pho_list")
+    private List<B64phoListDTO> b64phoList;
+
+    public CrawlerImageRequest(String insOrderNo, List<B64phoListDTO> b64phoListDTO) {
+        super(insOrderNo);
+        this.b64phoList = b64phoListDTO;
+    }
+
+    public static List<B64phoListDTO> toB64phoListDTO(List<InsTaskImagesBase64> insTaskImagesBase64List){
+        return insTaskImagesBase64List.stream().map(a ->new B64phoListDTO(a.getBase64String(), a.getImageType())).collect(Collectors.toList());
+    }
+
+    @AllArgsConstructor
+    @NoArgsConstructor
+    @Data
+    public static class B64phoListDTO implements Serializable{
+
+        private static final long serialVersionUID = 7315354165469344874L;
+
+        @JsonProperty("image")
+        private String image;
+
+        @JsonProperty("imgtype")
+        private String imageType;
+    }
+
+}

+ 52 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerAuditResponse.java

@@ -0,0 +1,52 @@
+package com.ydtech.modules.order.entity.crawler.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@NoArgsConstructor
+@Data
+public class CrawlerAuditResponse  extends  CrawlerBaseResponse {
+
+    private static final long serialVersionUID = 8990977573134495552L;
+
+    /**
+     * 交强险投保单号
+     */
+    @JsonProperty("JQ_Application")
+    private String jqApplication;
+    /**
+     * 交强险保单号
+     */
+    @JsonProperty("JQ_Policy")
+    private String jqPolicy;
+    /**
+     * 驾意险投保单号
+     */
+    @JsonProperty("JYX_Application")
+    private String jyxApplication;
+    /**
+     * 驾意险保单号
+     */
+    @JsonProperty("JYX_Policy")
+    private String jyxPolicy;
+    /**
+     * 商业险投保单号
+     */
+    @JsonProperty("SY_Application")
+    private String syApplication;
+    /**
+     * 商业险保单号
+     */
+    @JsonProperty("SY_Policy")
+    private String syPolicy;
+
+    /**
+     * 支付二维码
+     */
+    @JsonProperty("pay_url")
+    private String payUrl;
+
+}

+ 23 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerBaseResponse.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.order.entity.crawler.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class CrawlerBaseResponse implements Serializable {
+
+    private static final long serialVersionUID = 5153547298779692588L;
+
+    /**
+     * 状态码
+     */
+    @JsonProperty("code")
+    private Integer code;
+    /**
+     * 核保返回信息
+     */
+    @JsonProperty("message")
+    private String message;
+}

+ 8 - 8
src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerQuoteResponse.java

@@ -7,7 +7,7 @@ import java.io.Serializable;
 import java.util.Map;
 
 @Data
-public class CrawlerQuoteResponse implements Serializable {
+public class CrawlerQuoteResponse extends CrawlerBaseResponse {
 
     private static final long serialVersionUID = -6081722883663574740L;
 
@@ -20,22 +20,22 @@ public class CrawlerQuoteResponse implements Serializable {
      * 车船税价格
      */
     @JsonProperty(value = "carInsureShiptax")
-    private String carInsureShipTax;
+    private Double carInsureShipTax;
     /**
      * 商业险合计价格
      */
     @JsonProperty(value = "busiTotalPremium")
-    private String businessTotalPremium;
+    private Double businessTotalPremium;
     /**
      * 交强险价格
      */
     @JsonProperty(value = "forceCarInsureRisk")
-    private String forceCarInsureRisk;
+    private Double forceCarInsureRisk;
     /**
      * 总价
      */
     @JsonProperty(value = "carInsureMain")
-    private String carInsureMain;
+    private Double carInsureMain;
     /**
      * 订单号
      */
@@ -55,12 +55,12 @@ public class CrawlerQuoteResponse implements Serializable {
          * 历年滞纳金总金额
          */
         @JsonProperty(value = "all_late_fee")
-        private String allLateFee;
+        private Double allLateFee;
         /**
          * 历年欠车船税加滞纳金总价
          */
         @JsonProperty(value = "late_chechuan")
-        private String lateTax;
+        private Double lateTax;
         /**
          * 车船税欠费起始日期
          */
@@ -75,7 +75,7 @@ public class CrawlerQuoteResponse implements Serializable {
          * 历年车船税欠费金额
          */
         @JsonProperty(value = "late_fee")
-        private String lateFee;
+        private Double lateFee;
 
     }
 

+ 16 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerVerifyPaymentResponse.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.order.entity.crawler.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class CrawlerVerifyPaymentResponse extends CrawlerBaseResponse{
+
+    private static final long serialVersionUID = 5344292346551122923L;
+
+    @JsonProperty(value = "state")
+    private Integer state;
+
+}

+ 3 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteVo.java

@@ -14,6 +14,9 @@ public class BaseQuoteVo<T> {
     @ApiModelProperty("保险公司编号")
     private String companyId;
 
+    @ApiModelProperty("协议id")
+    private String agreementId;
+
     @ApiModelProperty("扩展实体")
     private T accidentalDrivingVo;
 

+ 0 - 7
src/main/java/com/ydtech/modules/order/service/AnShengOrderService.java

@@ -1,7 +0,0 @@
-package com.ydtech.modules.order.service;
-
-import com.ydtech.core.page.HttpResult;
-
-public interface AnShengOrderService extends BaseOrderService<Object> {
-    HttpResult submitImage(String orderNo);
-}

+ 12 - 2
src/main/java/com/ydtech/modules/order/service/BaseOrderService.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.service;
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.ins.model.vo.QuoteRespVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
 
@@ -15,13 +16,22 @@ public interface BaseOrderService<T> {
      * @param quoteInfoVo 报价实体
      * @return
      */
-    HttpResult quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<T> t);
+    HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<T> t);
 
     /**
      * 核保
      *
      * @param companyId 子订单号
      */
-    HttpResult audit(String companyId);
+    HttpResult<Object> audit(String companyId);
+
+    /**
+     * 提交影像信息
+     *
+     * @param subOrderNo 子订单好
+     * @return HttpResult
+     */
+    HttpResult<Object> submitImage(String subOrderNo);
+
 
 }

+ 4 - 1
src/main/java/com/ydtech/modules/order/service/CarModelService.java

@@ -1,9 +1,12 @@
 package com.ydtech.modules.order.service;
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.ins.model.ya.CarModelDTO;
+
+import java.util.List;
 
 public interface CarModelService {
 
-    HttpResult vinSearch(String frameNo);
+    HttpResult<List<CarModelDTO>> vinSearch(String frameNo);
 
 }

+ 0 - 29
src/main/java/com/ydtech/modules/order/service/HengBangOrderService.java

@@ -1,29 +0,0 @@
-package com.ydtech.modules.order.service;
-
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.ins.model.hb.HengbangPolicyPrintResponse;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.io.IOException;
-
-public interface HengBangOrderService extends BaseOrderService<Object> {
-
-    /**
-     * 上传影像
-     *
-     * @param quoteno
-     * @return
-     * @throws IOException
-     */
-    HttpResult submitImage(String quoteno) throws IOException;
-
-
-    /**
-     * 获取报价订单
-     *
-     * @param companyId
-     * @return
-     */
-    @Transactional
-    HengbangPolicyPrintResponse getPolicyPrint(String companyId);
-}

+ 8 - 0
src/main/java/com/ydtech/modules/order/service/InsOrdersService.java

@@ -9,6 +9,7 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.modules.order.entity.vo.OrderVo;
 import com.ydtech.modules.order.entity.vo.VerifyOrdersVo;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 
 import java.util.List;
 
@@ -19,6 +20,12 @@ import java.util.List;
  */
 public interface InsOrdersService extends IService<InsOrders> {
 
+    /**
+     * 通过 部门id 获取协议授权权限
+     * @param deptId  部门id
+     * @return HttpResult
+     */
+    HttpResult<List<PtlAgreementInsCompanyDto>> getAgreementInsCompany(String deptId);
 
     /**
      * 通过 vin 码查询订单
@@ -81,4 +88,5 @@ public interface InsOrdersService extends IService<InsOrders> {
      * @return
      */
     HttpResult<InsOrders> verifyOrders(VerifyOrdersVo verifyOrdersVo);
+
 }

+ 10 - 0
src/main/java/com/ydtech/modules/order/service/InsuranceCrawlerOrderService.java

@@ -1,4 +1,14 @@
 package com.ydtech.modules.order.service;
 
+import com.ydtech.core.page.HttpResult;
+
 public interface InsuranceCrawlerOrderService  extends BaseOrderService<Object> {
+
+
+    /**
+     * 缴费状态查询
+     * @param subOrderNo
+     * @return
+     */
+    HttpResult verifyPayment(String subOrderNo);
 }

+ 0 - 6
src/main/java/com/ydtech/modules/order/service/RenBaoOrderService.java

@@ -1,6 +0,0 @@
-package com.ydtech.modules.order.service;
-
-public interface RenBaoOrderService extends BaseOrderService<Object> {
-
-
-}

+ 0 - 1
src/main/java/com/ydtech/modules/order/service/YongAnOrderService.java

@@ -19,5 +19,4 @@ public interface YongAnOrderService extends BaseOrderService<Object> {
 
     String updatePolicy(Map<String, String> paramMap);
 
-    HttpResult submitImage(String companyId);
 }

+ 0 - 17
src/main/java/com/ydtech/modules/order/service/YongChengOrderService.java

@@ -1,17 +0,0 @@
-package com.ydtech.modules.order.service;
-
-
-import com.ydtech.modules.ins.model.yc.YongchengPolicyPrintResponse;
-
-public interface YongChengOrderService extends BaseOrderService<Object> {
-
-    /**
-     * 获取电子保单
-     *
-     * @param companyId
-     * @return
-     */
-    YongchengPolicyPrintResponse getPolicyPrint(String companyId);
-
-
-}

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/ZhongMeiOrderApiService.java

@@ -19,7 +19,7 @@ public interface ZhongMeiOrderApiService extends BaseOrderService<AccidentalDriv
     HttpResult<List<CarModelDTO>> modelsQuery(String modelName);
 
     /**
-     * 提交影信息
+     * 提交影信息
      * @param companyId 子订单编号
      * @return
      */

+ 0 - 226
src/main/java/com/ydtech/modules/order/service/impl/AnShengOrderServiceImpl.java

@@ -1,226 +0,0 @@
-package com.ydtech.modules.order.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.ydtech.components.AnShengRequestComponents;
-import com.ydtech.constants.enums.InsOrderStatus;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.exception.SystemException;
-import com.ydtech.modules.esm.model.EsmInsCompany;
-import com.ydtech.modules.esm.model.InsTaskImage;
-import com.ydtech.modules.esm.service.EsmInsCompanyService;
-import com.ydtech.modules.esm.service.InsTaskImageService;
-import com.ydtech.modules.ins.model.vo.*;
-import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
-import com.ydtech.modules.order.entity.InsAreaCompany;
-import com.ydtech.modules.order.entity.InsOrders;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.entity.vo.as.*;
-import com.ydtech.modules.order.service.AnShengOrderService;
-import com.ydtech.modules.order.service.InsAreaCompanyService;
-import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.utils.CalculateUtils;
-import com.ydtech.utils.idgen.IdGenerate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static com.ydtech.constants.RedisConstant.INS_ANSHENG_KEY;
-
-
-@Service
-public class AnShengOrderServiceImpl implements AnShengOrderService {
-
-    private final AnShengRequestComponents anShengRequestComponents;
-
-    private final StringRedisTemplate redisTemplate;
-
-    private final InsAreaCompanyService insAreaCompanyService;
-
-    private final InsOrdersService insOrdersService;
-
-
-    private final InsTaskImageService insTaskImageService;
-
-    @Autowired
-    private EsmInsCompanyService esmInsCompanyService;
-
-    public AnShengOrderServiceImpl(AnShengRequestComponents anShengRequestComponents, StringRedisTemplate redisTemplate, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, InsTaskImageService insTaskImageService) {
-        this.anShengRequestComponents = anShengRequestComponents;
-        this.redisTemplate = redisTemplate;
-        this.insAreaCompanyService = insAreaCompanyService;
-        this.insOrdersService = insOrdersService;
-        this.insTaskImageService = insTaskImageService;
-    }
-
-    @Override
-    public HttpResult quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<Object> quoteVo) {
-        EsmInsCompany esmInsCompany = esmInsCompanyService.isOpen(quoteVo.getCompanyId());
-        AsQuoteResponse body = anShengRequestComponents.quote(quoteInfoVo, AsQuoteResponse.class);
-        if (body.getCode() == 400) {
-            throw new SystemException(body.getMessage());
-        }
-        // 2.将安盛天平的的token存入redis
-        AsLoginInfoCache asLoginInfoCache = new AsLoginInfoCache(body);
-        String s = JSON.toJSONString(asLoginInfoCache);
-        // 3.将恒邦登录token存入redis
-        redisTemplate.opsForValue().set(INS_ANSHENG_KEY + quoteInfoVo.getOrderNo(), s);
-        String orderNo = quoteInfoVo.getOrderNo();
-        // 4.生成响应信息
-        QuoteRespVo quoteRespVo = getQuoteRespVo(orderNo, body, quoteInfoVo);
-        // 5. 插入报价渠道表
-        return responseOrder(orderNo, body, quoteRespVo, esmInsCompany);
-    }
-
-
-    @Override
-    public HttpResult audit(String companyId) {
-        // 1. 获取登录token
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
-        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
-
-        AsLoginInfoCache loginInfo = getLoginInfo(insAreaCompany.getOrderno());
-        AsAuditResponse body = anShengRequestComponents.audit(loginInfo, AsAuditResponse.class);
-        // 2. 获取订单
-
-        if (body.getCode() == 400) {
-            return HttpResult.error("安盛天平--核保失败:" + body.getMessage());
-        }
-
-        // 4. 更新订单子表
-        insAreaCompany.setAuditid(insOrders.getUserid());
-        insAreaCompany.setPaymentLink(body.getPayPhoto());
-
-        AsAuditResponse.PolicyNoListDTO policyNoListDTO1 = body.getPolicynoList().stream().filter(x -> x.getPlanCodeName() == 1).findFirst().orElse(null);
-        AsAuditResponse.PolicyNoListDTO policyNoListDTO2 = body.getPolicynoList().stream().filter(x -> x.getPlanCodeName() == 2).findFirst().orElse(null);
-        if (!ObjectUtils.isEmpty(policyNoListDTO2)) {
-            insAreaCompany.setJqapplyno(policyNoListDTO2.getPolicyNo());
-            insAreaCompany.setJqapplyno(policyNoListDTO2.getApplyPolicyNo());
-        }
-        if (!ObjectUtils.isEmpty(policyNoListDTO1)) {
-            insAreaCompany.setSyapplyno(policyNoListDTO1.getPolicyNo());
-            insAreaCompany.setSyapplyno(policyNoListDTO1.getApplyPolicyNo());
-        }
-        insAreaCompany.setJqappoint(""); //交强特别约定
-        insAreaCompany.setSyappoint(""); //商业特别约定
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_2.getCode());  //5
-        insAreaCompanyService.updateById(insAreaCompany);
-        insOrdersService.updateByOrderStatus(insOrders.getOrderno(), InsOrderStatus.S_2.getCode());
-        // 5.成功插入轨迹表
-        return HttpResult.ok();
-    }
-
-    @Override
-    public HttpResult submitImage(String orderNo) {
-        InsOrders insOrders = insOrdersService.existOrder(orderNo);
-        AsLoginInfoCache loginInfo = getLoginInfo(insOrders.getOrderno());
-        List<InsTaskImage> insTaskImages = insTaskImageService.selectByTaskId(insOrders.getQuoteno());
-        if (insTaskImages.size() > 0) {
-            AsUploadImageVo asUploadImageVo = new AsUploadImageVo(loginInfo.getToken(), insTaskImages);
-            AsSubmitImageResponse body = anShengRequestComponents.submitImage(asUploadImageVo, AsSubmitImageResponse.class);
-            // 覆盖之前的信息
-            List<Object> phoMessage = body.getPhoMessage();
-            loginInfo.setPhoMessage(phoMessage);
-            String s = JSON.toJSONString(loginInfo);
-            redisTemplate.opsForValue().set(INS_ANSHENG_KEY + insOrders.getOrderno(), s);
-
-            if (body.getCode() == 200) {
-                return HttpResult.ok("成功");
-            }
-            throw new SystemException("上传失败");
-        }
-        throw new SystemException("没有上传成功的影像");
-    }
-
-    private HttpResult responseOrder(String orderNo, AsQuoteResponse response, QuoteRespVo quoteRespVo, EsmInsCompany esmInsCompany) {
-        InsAreaCompany insAreaCompany = new InsAreaCompany();
-        insAreaCompany.setId(IdGenerate.nextId());
-        insAreaCompany.setOrderno(orderNo);
-        insAreaCompany.setReptxt(JSON.parseObject(JSON.toJSONString(response)));
-        insAreaCompany.setJqpremium(BigDecimal.valueOf(response.getForceCarInsureRisk()));
-        insAreaCompany.setSypremium(BigDecimal.valueOf(response.getBusiTotalPremium()));
-        insAreaCompany.setTaxamount(BigDecimal.valueOf(response.getCarInsureShiptax()));
-        insAreaCompany.setSumpremium(BigDecimal.valueOf(response.getCarInsureMain()));
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_0.getCode()); // 1
-        insAreaCompany.setRiskinfo(JSON.parseArray(JSON.toJSONString(quoteRespVo.getRiskList())));
-        insAreaCompany.setKindinfo(JSON.parseArray(JSON.toJSONString(quoteRespVo.getKindList())));
-        insAreaCompany.setCompanyId(esmInsCompany.getId());
-        insAreaCompany.setInscompany(esmInsCompany.getNamesimple());
-        insAreaCompanyService.save(insAreaCompany);
-        insOrdersService.updateByOrderStatus(orderNo, InsOrderStatus.S_0.getCode());
-        quoteRespVo.setCompanyId(insAreaCompany.getId());
-        return HttpResult.ok("成功", quoteRespVo);
-    }
-
-    private QuoteRespVo getQuoteRespVo(String orderNo, AsQuoteResponse response, YaQuoteInfoVo yaQuoteInfoVo) {
-        double jqPremium = response.getForceCarInsureRisk();
-        double syPremium = response.getBusiTotalPremium();
-
-        QuoteRespVo quoteRespVo = new QuoteRespVo();
-        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;
-        Map<String, Double> map = response.getInsuranceType();
-        List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
-
-        for (KindInfoVo kindInfoVo : kindList) {
-            kind = new QuoteKindRespVo();
-            kind.setKindCode(kindInfoVo.getKindCode());
-            kind.setKindName(kindInfoVo.getKindName());
-            kind.setAmount(kindInfoVo.getAmount());
-            kind.setCoveragePremium(map.get(kindInfoVo.getKindCode()));
-            kind.setUnitAmount(kindInfoVo.getUnitAmount());
-            if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
-                kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
-            }
-            kindList1.add(kind);
-        }
-
-        quoteRespVo.setRiskList(riskList1);
-        quoteRespVo.setKindList(kindList1);
-        quoteRespVo.setJqPremium(jqPremium);
-        quoteRespVo.setSyPremium(syPremium);
-        quoteRespVo.setCiSumPermium(CalculateUtils.add(response.getForceCarInsureRisk(), response.getCarInsureShiptax()));//交强险和车船税合计
-        quoteRespVo.setSumPermium(response.getCarInsureMain());//保费合计
-        quoteRespVo.setTaxAmount(response.getCarInsureShiptax());//车船税
-        quoteRespVo.setTotalAdjustRate(1);
-        quoteRespVo.setILogPreUdwMess("0");//评分
-        quoteRespVo.setOrderno(orderNo); //订单号
-        return quoteRespVo;
-    }
-
-    public AsLoginInfoCache getLoginInfo(String orderNo) {
-        String s = redisTemplate.opsForValue().get(INS_ANSHENG_KEY + orderNo);
-        return JSON.parseObject(s, AsLoginInfoCache.class);
-    }
-
-
-}

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/impl/CarModelServiceImpl.java

@@ -26,7 +26,7 @@ public class CarModelServiceImpl implements CarModelService {
     }
 
     @Override
-    public HttpResult vinSearch(String frameNo) {
+    public HttpResult< List<CarModelDTO>> vinSearch(String frameNo) {
         List<CarModelDTO> carModelDTOS = insOrdersService.vinSearch(frameNo);
         if (!carModelDTOS.isEmpty()) {
             return HttpResult.ok(carModelDTOS);

+ 0 - 248
src/main/java/com/ydtech/modules/order/service/impl/HengBangServiceImpl.java

@@ -1,248 +0,0 @@
-package com.ydtech.modules.order.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.ydtech.components.HengbangRequestComponents;
-import com.ydtech.constants.enums.InsOrderStatus;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.exception.SystemException;
-import com.ydtech.modules.esm.model.InsTaskImage;
-import com.ydtech.modules.esm.service.InsTaskImageService;
-import com.ydtech.modules.ins.model.hb.HengbangAuditResponse;
-import com.ydtech.modules.ins.model.hb.HengbangLoginInfo;
-import com.ydtech.modules.ins.model.hb.HengbangPolicyPrintResponse;
-import com.ydtech.modules.ins.model.hb.HengbangQuoteResponse;
-import com.ydtech.modules.ins.model.request.BaseResponse;
-import com.ydtech.modules.ins.model.vo.*;
-import com.ydtech.modules.ins.model.vo.req.InsZmUploadImageVo;
-import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
-import com.ydtech.modules.order.components.InsOrdersComponents;
-import com.ydtech.modules.order.entity.InsAreaCompany;
-import com.ydtech.modules.order.entity.InsOrders;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.HengBangOrderService;
-import com.ydtech.modules.order.service.InsAreaCompanyService;
-import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.utils.CalculateUtils;
-import com.ydtech.utils.idgen.IdGenerate;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.ObjectUtils;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static com.ydtech.constants.RedisConstant.INS_HENGBANG_KEY;
-
-@Service
-public class HengBangServiceImpl implements HengBangOrderService {
-
-    private final HengbangRequestComponents hengbangRequestComponents;
-
-    private final StringRedisTemplate redisTemplate;
-
-    private final InsAreaCompanyService insAreaCompanyService;
-
-    private final InsOrdersService insOrdersService;
-
-    private final InsOrdersComponents insOrdersComponents;
-
-    private final InsTaskImageService insTaskImageService;
-
-    public HengBangServiceImpl(HengbangRequestComponents hengbangRequestComponents, StringRedisTemplate redisTemplate, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, InsOrdersComponents insOrdersComponents, InsTaskImageService insTaskImageService) {
-        this.hengbangRequestComponents = hengbangRequestComponents;
-        this.redisTemplate = redisTemplate;
-        this.insAreaCompanyService = insAreaCompanyService;
-        this.insOrdersService = insOrdersService;
-        this.insOrdersComponents = insOrdersComponents;
-        this.insTaskImageService = insTaskImageService;
-    }
-
-    @Override
-    public HttpResult quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<Object> quoteVo) {
-        HengbangQuoteResponse body = hengbangRequestComponents.quote(quoteInfoVo, HengbangQuoteResponse.class);
-        if (body.getCode() == 400) {
-            throw new SystemException(body.getMessage());
-        }
-        // 2.将恒邦的的token存入redis
-        HengbangLoginInfo hengbangLoginInfo = new HengbangLoginInfo(body.getPlyappno(), body.getRisktype(), body.getToken());
-        String s = JSON.toJSONString(hengbangLoginInfo);
-        // 3.将恒邦登录token存入redis
-        redisTemplate.opsForValue().set(INS_HENGBANG_KEY + quoteInfoVo.getOrderNo(), s);
-        String orderNo = quoteInfoVo.getOrderNo();
-        // 4.生成响应信息
-        QuoteRespVo quoteRespVo = getQuoteRespVo(orderNo, body, quoteInfoVo);
-        // 5. 插入报价渠道表
-        return responseOrder(orderNo, body, quoteRespVo);
-    }
-
-    @Override
-    @Transactional
-    public HttpResult audit(String companyId) {
-        // 1. 获取登录token
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
-        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
-
-        HengbangLoginInfo loginInfo = getLoginInfo(insAreaCompany.getOrderno());
-        HengbangAuditResponse body = hengbangRequestComponents.audit(loginInfo, HengbangAuditResponse.class);
-        // 2. 获取订单
-
-        if (body.getCode() == 400) {
-//            insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.UNDERWRITING_FAILED, order);
-            return HttpResult.error("恒邦--核保失败:" + body.getMessage());
-        }
-
-        // 4. 更新订单子表
-        insAreaCompany.setAuditid(insOrders.getUserid());
-        insAreaCompany.setPaymentLink(body.getPay_url());
-        insAreaCompany.setJqapplyno(body.getEfcProposalNo());
-        insAreaCompany.setSyapplyno(body.getBizProposalNo());
-//        order.setJqapplyno(jqApplyno == null ? "" : jqApplyno);
-//        order.setSyapplyno(syApplyno == null ? "" : syApplyno);
-        insAreaCompany.setJqappoint(""); //交强特别约定
-        insAreaCompany.setSyappoint(""); //商业特别约定
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_2.getCode()); // 5
-        insAreaCompanyService.updateById(insAreaCompany);
-
-        // 5.成功插入轨迹表
-//        insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.UNDERWRITTEN_TO_BE_PAID, order);
-        return HttpResult.ok();
-    }
-
-    @Override
-    public HttpResult submitImage(String quoteno) throws IOException {
-        InsOrders insOrders = insOrdersService.query().eq("quoteno", quoteno).one();
-        HengbangLoginInfo loginInfo = getLoginInfo(insOrders.getOrderno());
-        List<InsTaskImage> insTaskImages = insTaskImageService.selectByTaskId(quoteno);
-        if (insTaskImages.size() > 0) {
-            InsZmUploadImageVo insZmUploadImageVo = new InsZmUploadImageVo(loginInfo.getBusiNo(), loginInfo.getToken(), insTaskImages);
-            BaseResponse body = hengbangRequestComponents.submitImage(insZmUploadImageVo, BaseResponse.class);
-            if (body.getCode() == 200) {
-                return HttpResult.ok("成功");
-            }
-            throw new SystemException("上传失败");
-        }
-        throw new SystemException("没有上传成功的影像");
-    }
-
-    @Override
-    @Transactional
-    public HengbangPolicyPrintResponse getPolicyPrint(String companyId) {
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
-        InsOrders insOrders = insOrdersService.existOrder(insAreaCompany.getOrderno());
-
-
-        String licenseNo = insOrders.getLicenseno();
-        Map<String, Object> map = new HashMap<>();
-        map.put("license", licenseNo);
-        HengbangPolicyPrintResponse response = hengbangRequestComponents.getPolicyPrint(map, HengbangPolicyPrintResponse.class);
-
-        if (response.getCode() == 200) {
-            insAreaCompany.setJqpolicyno(response.getJqxBusiNo());
-            insAreaCompany.setSypolicyno(response.getSyxBusiNo());
-            insAreaCompany.setOrderstatus(InsOrderStatus.S_3.getCode());//已承保
-//        order.setPaytype(payAppNo);
-//        order.setPaytime(payTime);
-            insAreaCompanyService.updateById(insAreaCompany);
-//            insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.PAID, insOrder);
-//            insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.COVERED, insOrder);
-            return response;
-        }
-
-        throw new SystemException("没有查询到保单信息");
-    }
-
-
-    private HttpResult responseOrder(String orderNo, HengbangQuoteResponse response, QuoteRespVo quoteRespVo) {
-        //保存订单信息
-        InsAreaCompany insAreaCompany = new InsAreaCompany();
-        insAreaCompany.setId(IdGenerate.nextId());
-        insAreaCompany.setOrderno(orderNo);
-        insAreaCompany.setReptxt(JSONObject.parseObject(JSONObject.toJSONString(response)));
-        insAreaCompany.setJqpremium(BigDecimal.valueOf(response.getForceCarInsureRisk()));
-        insAreaCompany.setSypremium(BigDecimal.valueOf(response.getBusiTotalPremium()));
-        insAreaCompany.setTaxamount(BigDecimal.valueOf(response.getCarInsureShiptax()));
-        insAreaCompany.setSumpremium(BigDecimal.valueOf(response.getCarInsureMain()));
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_0.getCode());
-        insAreaCompany.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getRiskList())));
-        insAreaCompany.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getKindList())));
-        insAreaCompanyService.save(insAreaCompany);
-        insAreaCompany.setInscompany("恒邦财险");
-        quoteRespVo.setCompanyId(insAreaCompany.getId());
-        return HttpResult.ok("成功", quoteRespVo);
-    }
-
-
-    private QuoteRespVo getQuoteRespVo(String orderNo, HengbangQuoteResponse response, YaQuoteInfoVo yaQuoteInfoVo) {
-        double jqPremium = response.getForceCarInsureRisk();
-        double syPremium = response.getBusiTotalPremium();
-
-        QuoteRespVo quoteRespVo = new QuoteRespVo();
-        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;
-        Map<String, Double> map = response.getInsurance_type();
-        List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
-
-        for (KindInfoVo kindInfoVo : kindList) {
-            kind = new QuoteKindRespVo();
-            kind.setKindCode(kindInfoVo.getKindCode());
-            kind.setKindName(kindInfoVo.getKindName());
-            kind.setAmount(kindInfoVo.getAmount());
-            kind.setCoveragePremium(map.get(kindInfoVo.getKindCode()));
-            kind.setUnitAmount(kindInfoVo.getUnitAmount());
-            if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
-                kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
-            }
-            kindList1.add(kind);
-        }
-
-        quoteRespVo.setRiskList(riskList1);
-        quoteRespVo.setKindList(kindList1);
-        quoteRespVo.setJqPremium(jqPremium);
-        quoteRespVo.setSyPremium(syPremium);
-        quoteRespVo.setCiSumPermium(CalculateUtils.add(response.getForceCarInsureRisk(), response.getCarInsureShiptax()));//交强险和车船税合计
-        quoteRespVo.setSumPermium(response.getCarInsureMain());//保费合计
-        quoteRespVo.setTaxAmount(response.getCarInsureShiptax());//车船税
-        quoteRespVo.setTotalAdjustRate(1);
-        quoteRespVo.setILogPreUdwMess("0");//评分
-        quoteRespVo.setOrderno(orderNo); //订单号
-        return quoteRespVo;
-    }
-
-
-    public HengbangLoginInfo getLoginInfo(String orderNo) {
-        String s = redisTemplate.opsForValue().get(INS_HENGBANG_KEY + orderNo);
-        return JSONObject.parseObject(s, HengbangLoginInfo.class);
-    }
-
-
-}

+ 243 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -0,0 +1,243 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.ydtech.constants.enums.InsOrderStatus;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.ins.model.vo.*;
+import com.ydtech.modules.order.components.InsCrawlerOrderComponents;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.crawler.constants.CrawlerVerifyPaymentConstants;
+import com.ydtech.modules.order.entity.crawler.request.CrawlerBaseRequest;
+import com.ydtech.modules.order.entity.crawler.request.CrawlerImageRequest;
+import com.ydtech.modules.order.entity.crawler.request.CrawlerQuoteRequest;
+import com.ydtech.modules.order.entity.crawler.response.CrawlerAuditResponse;
+import com.ydtech.modules.order.entity.crawler.response.CrawlerBaseResponse;
+import com.ydtech.modules.order.entity.crawler.response.CrawlerQuoteResponse;
+import com.ydtech.modules.order.entity.crawler.response.CrawlerVerifyPaymentResponse;
+import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.order.service.InsTaskImagesService;
+import com.ydtech.modules.order.service.InsuranceCrawlerOrderService;
+import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
+import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
+import com.ydtech.utils.CalculateUtils;
+import com.ydtech.utils.idgen.IdGenerate;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+
+@Service
+public class InsCrawlerOrderServiceImpl implements InsuranceCrawlerOrderService {
+
+    private final PtlAgreementService ptlAgreementService;
+
+    private final PtlCrawlerApiService ptlCrawlerApiService;
+
+    private final InsCrawlerOrderComponents insCrawlerOrderComponents;
+
+    private final PtlAgreementAttributionService ptlAgreementAttributionService;
+
+    private final InsAreaCompanyService insAreaCompanyService;
+
+    private final InsOrdersService insOrdersService;
+
+    private final InsTaskImagesService insTaskImagesService;
+
+    public InsCrawlerOrderServiceImpl(PtlAgreementService ptlAgreementService, PtlCrawlerApiService ptlCrawlerApiService, InsCrawlerOrderComponents insCrawlerOrderComponents, PtlAgreementAttributionService ptlAgreementAttributionService, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, InsTaskImagesService insTaskImagesService) {
+        this.ptlAgreementService = ptlAgreementService;
+        this.ptlCrawlerApiService = ptlCrawlerApiService;
+        this.insCrawlerOrderComponents = insCrawlerOrderComponents;
+        this.ptlAgreementAttributionService = ptlAgreementAttributionService;
+        this.insAreaCompanyService = insAreaCompanyService;
+        this.insOrdersService = insOrdersService;
+        this.insTaskImagesService = insTaskImagesService;
+    }
+
+    @Override
+    public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<Object> t) {
+        // 协议id
+        String agreementId = t.getAgreementId();
+        // 请求地址
+        String apiUrl = ptlCrawlerApiService.getApiUrl(agreementId, String.valueOf(PtlCrawlerApiType.API_2.getCode()));
+        // 账号信息
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(agreementId);
+        CrawlerQuoteRequest crawlerQuoteRequest = (CrawlerQuoteRequest) quoteInfoVo;
+        crawlerQuoteRequest.setUsername(ptlAgreementAttribution.getUsername());
+        String insCompanyName = ptlAgreementAttribution.getInsCompanyName();
+        // 发送请求
+        CrawlerQuoteResponse response = insCrawlerOrderComponents.request(apiUrl,
+                insCompanyName,
+                PtlCrawlerApiType.API_2.getDesc(),
+                crawlerQuoteRequest,
+                CrawlerQuoteResponse.class);
+        QuoteRespVo quoteRespVo = getQuoteRespVo(response, quoteInfoVo);
+        return responseOrder(response, quoteRespVo, agreementId, insCompanyName);
+    }
+
+    @Override
+    public HttpResult<Object> submitImage(String subOrderNo) {
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
+        // 请求地址
+        String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), String.valueOf(PtlCrawlerApiType.API_3.getCode()));
+        List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insAreaCompany.getOrderno());
+        CrawlerImageRequest crawlerImageRequest = new CrawlerImageRequest(insAreaCompany.getInsOrderNo(), CrawlerImageRequest.toB64phoListDTO(insTaskImagesBase64s));
+        // 发送请求
+        CrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl,
+                insAreaCompany.getInscompany(),
+                PtlCrawlerApiType.API_3.getDesc(),
+                crawlerImageRequest,
+                CrawlerBaseResponse.class);
+
+        if (response.getCode() != 200) {
+            throw new SystemException(response.getMessage());
+        }
+
+        return HttpResult.ok("上传成功");
+    }
+
+    @Override
+    public HttpResult<Object> audit(String subOrderNo) {
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
+        // 请求地址
+        String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), String.valueOf(PtlCrawlerApiType.API_4.getCode()));
+        //组装参数
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerAuditResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl,
+                insAreaCompany.getInscompany(),
+                PtlCrawlerApiType.API_4.getDesc(),
+                crawlerBaseRequest,
+                CrawlerAuditResponse.class);
+        if (crawlerAuditResponse.getCode() != 200) {
+            throw new SystemException(crawlerAuditResponse.getMessage());
+        }
+
+        // 投保单号
+        insAreaCompany.setPaymentLink(crawlerAuditResponse.getPayUrl());
+        insAreaCompany.setJqapplyno(crawlerAuditResponse.getJqApplication());
+        insAreaCompany.setSyapplyno(crawlerAuditResponse.getSyApplication());
+        insAreaCompany.setJyapplyno(crawlerAuditResponse.getJyxApplication());
+
+        // 保单号
+        insAreaCompany.setJqpolicyno(crawlerAuditResponse.getJqPolicy());
+        insAreaCompany.setSypolicyno(crawlerAuditResponse.getSyPolicy());
+        insAreaCompany.setJypolicyno(crawlerAuditResponse.getJyxPolicy());
+
+        insAreaCompany.setOrderstatus(InsOrderStatus.S_2.getCode());
+        insAreaCompanyService.updateById(insAreaCompany);
+        insOrdersService.updateByOrderStatus(insAreaCompany.getOrderno(), insAreaCompany.getOrderstatus());
+        return HttpResult.ok("核保成功");
+    }
+
+
+    @Override
+    public HttpResult verifyPayment(String subOrderNo) {
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
+        // 请求地址
+        String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), String.valueOf(PtlCrawlerApiType.API_4.getCode()));
+        //组装参数
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
+        CrawlerVerifyPaymentResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl,
+                insAreaCompany.getInscompany(),
+                PtlCrawlerApiType.API_4.getDesc(),
+                crawlerBaseRequest,
+                CrawlerVerifyPaymentResponse.class);
+//        if(crawlerAuditResponse.getState() == CrawlerVerifyPaymentConstants.)
+
+
+        return null;
+    }
+
+    public QuoteRespVo getQuoteRespVo(CrawlerQuoteResponse response, BaseQuoteInfoVo yaQuoteInfoVo) {
+        String orderNo = yaQuoteInfoVo.getOrderNo();
+        double jqPremium = response.getForceCarInsureRisk();
+        double syPremium = response.getBusinessTotalPremium();
+
+        QuoteRespVo quoteRespVo = new QuoteRespVo();
+        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;
+        Map<String, Double> map = response.getInsuranceType();
+        List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
+        for (KindInfoVo kindInfoVo : kindList) {
+            kind = new QuoteKindRespVo();
+            kind.setKindCode(kindInfoVo.getKindCode());
+            kind.setKindName(kindInfoVo.getKindName());
+            kind.setAmount(kindInfoVo.getAmount());
+            kind.setCoveragePremium(map.get(kindInfoVo.getKindCode()));
+            kind.setUnitAmount(kindInfoVo.getUnitAmount());
+            if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
+                kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
+            }
+            kindList1.add(kind);
+        }
+        quoteRespVo.setRiskList(riskList1);
+        quoteRespVo.setKindList(kindList1);
+        quoteRespVo.setJqPremium(jqPremium);
+        quoteRespVo.setSyPremium(syPremium);
+        quoteRespVo.setCiSumPermium(CalculateUtils.add(response.getForceCarInsureRisk(), response.getCarInsureShipTax()));//交强险和车船税合计
+        quoteRespVo.setSumPermium(response.getCarInsureMain());//保费合计
+        quoteRespVo.setTaxAmount(response.getCarInsureShipTax());//车船税
+        quoteRespVo.setTotalAdjustRate(1);
+        quoteRespVo.setILogPreUdwMess("0");//评分
+        quoteRespVo.setOrderno(orderNo); //订单号
+        return quoteRespVo;
+    }
+
+    private HttpResult<QuoteRespVo> responseOrder(CrawlerQuoteResponse response, QuoteRespVo quoteRespVo, String agreementId, String insCompanyName) {
+        //保存订单信息
+        InsAreaCompany insAreaCompany = new InsAreaCompany();
+        insAreaCompany.setId(IdGenerate.nextId());
+        insAreaCompany.setOrderno(quoteRespVo.getOrderno());
+        insAreaCompany.setReptxt(JSON.parseObject(JSON.toJSONString(response)));
+        insAreaCompany.setJqpremium(BigDecimal.valueOf(response.getForceCarInsureRisk()));
+        insAreaCompany.setSypremium(BigDecimal.valueOf(response.getBusinessTotalPremium()));
+        insAreaCompany.setTaxamount(BigDecimal.valueOf(response.getCarInsureShipTax()));
+        insAreaCompany.setSumpremium(BigDecimal.valueOf(response.getCarInsureMain()));
+        insAreaCompany.setOrderstatus(InsOrderStatus.S_0.getCode()); // 1
+        insAreaCompany.setRiskinfo(JSON.parseArray(JSON.toJSONString(quoteRespVo.getRiskList())));
+        insAreaCompany.setKindinfo(JSON.parseArray(JSON.toJSONString(quoteRespVo.getKindList())));
+        insAreaCompany.setInscompany(insCompanyName);
+        insAreaCompany.setAgreementId(agreementId);
+        // 保险公司订单号
+        insAreaCompany.setInsOrderNo(response.getOrderNo());
+        insAreaCompanyService.save(insAreaCompany);
+        //插入轨迹表 报价中
+        quoteRespVo.setCompanyId(insAreaCompany.getId());
+        return HttpResult.ok("成功", quoteRespVo);
+    }
+
+
+}

+ 27 - 17
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.github.pagehelper.page.PageMethod;
 import com.ydtech.components.OrderComponents;
 import com.ydtech.constants.enums.InsOrderStatus;
 import com.ydtech.core.page.HttpResult;
@@ -35,8 +35,10 @@ import com.ydtech.modules.order.entity.vo.VerifyOrdersVo;
 import com.ydtech.modules.order.entity.vo.ya.YaExtendInfoDto;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.utils.StringUtils;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.utils.idgen.IdGenerate;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
@@ -67,14 +69,24 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     private final SysDeptService sysDeptService;
 
     private final StringRedisTemplate redisTemplate;
+
     private final InsAreaCompanyService insAreaCompanyService;
 
-    public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService, SysDeptService sysDeptService, StringRedisTemplate redisTemplate, InsAreaCompanyService insAreaCompanyService) {
+    private final PtlAgreementService ptlAgreementService;
+
+    public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService, SysDeptService sysDeptService, StringRedisTemplate redisTemplate, InsAreaCompanyService insAreaCompanyService, PtlAgreementService ptlAgreementService) {
         this.orderComponents = orderComponents;
         this.sysUserService = sysUserService;
         this.sysDeptService = sysDeptService;
         this.redisTemplate = redisTemplate;
         this.insAreaCompanyService = insAreaCompanyService;
+        this.ptlAgreementService = ptlAgreementService;
+    }
+
+    @Override
+    public HttpResult<List<PtlAgreementInsCompanyDto>> getAgreementInsCompany(String deptId) {
+        List<PtlAgreementInsCompanyDto> agreementCompany = ptlAgreementService.getAgreementCompany(deptId);
+        return HttpResult.ok(agreementCompany);
     }
 
     @Override
@@ -132,7 +144,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         insOrders.setFrameno(quoteInfoVo.getCarInfo().getFrameNo());
         insOrders.setLicenseno(quoteInfoVo.getCarInfo().getLicenseNo());
         // 2.1 车辆信息
-        insOrders.setCarinfo(JSONObject.parseObject(JSONObject.toJSONString(quoteInfoVo.getCarInfo())));
+        insOrders.setCarinfo(JSON.parseObject(JSON.toJSONString(quoteInfoVo.getCarInfo())));
         insOrders.setUserid(user.getId());
         insOrders.setUsername(user.getName());
         insOrders.setDeptid(user.getDeptId());
@@ -141,9 +153,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         insOrders.setDeptname(dept == null ? "" : dept.getName());
 
         // 2.2 人员信息
-        insOrders.setOwnerinfo(JSONObject.parseObject(JSONObject.toJSONString(quoteInfoVo.getOwnerInfo())));
-        insOrders.setApplyinfo(JSONObject.parseObject(JSONObject.toJSONString(quoteInfoVo.getPolicyHolderInfo())));
-        insOrders.setInsureinfo(JSONObject.parseObject(JSONObject.toJSONString(quoteInfoVo.getInsuredPersonInfo())));
+        insOrders.setOwnerinfo(JSON.parseObject(JSON.toJSONString(quoteInfoVo.getOwnerInfo())));
+        insOrders.setApplyinfo(JSON.parseObject(JSON.toJSONString(quoteInfoVo.getPolicyHolderInfo())));
+        insOrders.setInsureinfo(JSON.parseObject(JSON.toJSONString(quoteInfoVo.getInsuredPersonInfo())));
         insOrders.setInsuredname(quoteInfoVo.getPolicyHolderInfo().getName());
 
         // 2.3 保险信息
@@ -157,7 +169,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 insOrders.setSystartdate(risk.getStartDate());
                 insOrders.setSyenddate(risk.getEndDate());
 
-                if (quoteInfoVo.getKindList().size() == 0) {
+                if (quoteInfoVo.getKindList().isEmpty()) {
                     throw new SystemException("商业险险种未选择,不允许报价");
                 }
 
@@ -166,8 +178,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
 
 
         // 2.3.1 险种信息
-        insOrders.setRisk(JSONObject.parseArray(JSONObject.toJSONString(quoteInfoVo.getRiskList())));
-        insOrders.setKing(JSONObject.parseArray(JSONObject.toJSONString(quoteInfoVo.getKindList())));
+        insOrders.setRisk(JSON.parseArray(JSON.toJSONString(quoteInfoVo.getRiskList())));
+        insOrders.setKing(JSON.parseArray(JSON.toJSONString(quoteInfoVo.getKindList())));
         List<KindInfoVo> kinds = quoteInfoVo.getKindList();
 
         // 2.4 产品信息
@@ -193,7 +205,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         insOrders.setProduct(productname);
         insOrders.setCreatetime(LocalDateTime.now());
         // 3 订单操作
-        if (StringUtils.isNullOrEmpty(quoteInfoVo.getOrderNo())) {
+        if (StringUtils.isEmpty(quoteInfoVo.getOrderNo())) {
             // 存入订单
             String orderno = IdGenerate.nextId();
             insOrders.setOrderno(orderno);
@@ -210,7 +222,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             this.updateById(insOrders);
         }
         // 4 将报价信息存入redis 中
-        String s = JSONObject.toJSONString(quoteInfoVo);
+        String s = JSON.toJSONString(quoteInfoVo);
         redisTemplate.opsForValue().set(QUOTE_INFO_KEY + insOrders.getOrderno(), s, QUOTE_INFO_KEY_TIME, TimeUnit.DAYS);
         return insOrders;
     }
@@ -226,8 +238,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 .between(!ObjectUtils.isEmpty(orderQueryVo.getStartDate()) && !ObjectUtils.isEmpty(orderQueryVo.getEndDate()), "createtime", orderQueryVo.getStartDate(), orderQueryVo.getEndDate())
                 .page(new Page<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize()));
 
-        BasePageResult<InsOrders> listBasePageResult = new BasePageResult<>(orderQueryVo.getPageNum(), page.getSize(), page.getTotal(), page.getPages(), page.getRecords());
-        return listBasePageResult;
+        return new BasePageResult<>(orderQueryVo.getPageNum(), page.getSize(), page.getTotal(), page.getPages(), page.getRecords());
     }
 
     @Override
@@ -235,7 +246,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         if ("admin".equals(orderQueryVo.getUserId())) {
             orderQueryVo.setUserId("");
         }
-        PageHelper.startPage(orderQueryVo.getPageNum(), orderQueryVo.getPageSize());
+        PageMethod.startPage(orderQueryVo.getPageNum(), orderQueryVo.getPageSize());
         List<InsOrders> order = baseMapper.getOrder(orderQueryVo);
 
         if (order.isEmpty()) {
@@ -252,8 +263,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 .selectList(queryWrapper);
         // 3. 包装订单信息
         List<InsOrders> ordersList = pageInfo.getList().stream().peek(insOrder -> insOrder.setInsAreaCompanyList(insAreaCompanies.stream().filter(insAreaCompany -> insAreaCompany.getOrderno().equals(insOrder.getOrderno())).collect(Collectors.toList()))).collect(Collectors.toList());
-        BasePageResult<InsOrders> listBasePageResult = new BasePageResult<>(orderQueryVo.getPageNum(), pageInfo.getSize(), pageInfo.getTotal(), pageInfo.getPages(), ordersList);
-        return listBasePageResult;
+        return new BasePageResult<>(orderQueryVo.getPageNum(), pageInfo.getSize(), pageInfo.getTotal(), pageInfo.getPages(), ordersList);
     }
 
     @Override

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

@@ -1,20 +0,0 @@
-package com.ydtech.modules.order.service.impl;
-
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.InsuranceCrawlerOrderService;
-
-public class InsuranceCrawlerOrderServiceImpl implements InsuranceCrawlerOrderService {
-
-
-    @Override
-    public HttpResult quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<Object> t) {
-        return null;
-    }
-
-    @Override
-    public HttpResult audit(String companyId) {
-        return null;
-    }
-}

+ 0 - 311
src/main/java/com/ydtech/modules/order/service/impl/RenBaoOrderServiceImpl.java

@@ -1,311 +0,0 @@
-package com.ydtech.modules.order.service.impl;
-
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.ydtech.components.RenbaoRequestComponents;
-import com.ydtech.constants.enums.InsOrderStatus;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.exception.SystemException;
-import com.ydtech.modules.ins.convert.RenbaoQuoteResponseConvert;
-import com.ydtech.modules.ins.model.request.RenbaoAuditBody;
-import com.ydtech.modules.ins.model.request.RenbaoQuoteRespVo;
-import com.ydtech.modules.ins.model.request.RenbaoQuoteResponse;
-import com.ydtech.modules.ins.model.vo.*;
-import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
-import com.ydtech.modules.order.entity.InsAreaCompany;
-import com.ydtech.modules.order.entity.InsOrders;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.InsAreaCompanyService;
-import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.modules.order.service.RenBaoOrderService;
-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.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static com.ydtech.constants.RedisConstant.INS_RENBAO_KEY;
-
-@Slf4j
-@Service
-public class RenBaoOrderServiceImpl implements RenBaoOrderService {
-
-    private final RenbaoRequestComponents renbaoRequestComponents;
-
-    private final StringRedisTemplate redisTemplate;
-
-    private final InsAreaCompanyService insAreaCompanyService;
-
-    private final InsOrdersService insOrdersService;
-
-    public RenBaoOrderServiceImpl(RenbaoRequestComponents renbaoRequestComponents, StringRedisTemplate redisTemplate, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService) {
-        this.renbaoRequestComponents = renbaoRequestComponents;
-        this.redisTemplate = redisTemplate;
-        this.insAreaCompanyService = insAreaCompanyService;
-        this.insOrdersService = insOrdersService;
-    }
-
-    @Override
-    public HttpResult quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<Object> quoteVo) {
-
-        // 1.封装人保请求
-        RenbaoQuoteResponse body = renbaoRequestComponents.quote(quoteInfoVo, 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);
-        }
-        // 2.将人保的token存入redis
-        RenbaoAuditBody renbaoAuditBody = RenbaoQuoteResponseConvert.INSTANCE.quote2Audit(body);
-        String s = JSONObject.toJSONString(renbaoAuditBody);
-        String orderNo = quoteInfoVo.getOrderNo();
-        redisTemplate.opsForValue().set(INS_RENBAO_KEY + orderNo, s);
-        RenbaoQuoteRespVo quoteRespVo = getQuoteRespVo(orderNo, Integer.parseInt(quoteInfoVo.getCarInfo().getSeatCount()), body, quoteInfoVo);
-        // 3.插入订单
-        return responseOrder(orderNo, body, quoteRespVo);
-    }
-
-    @Override
-    public HttpResult audit(String companyId) {
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
-        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
-        if (insOrders == null) {
-            return HttpResult.error("订单不存在");
-        }
-
-        // 1.通过redis获取请求人保参数token
-        String s = redisTemplate.opsForValue().get(INS_RENBAO_KEY + insOrders.getOrderno());
-        RenbaoAuditBody response = JSON.parseObject(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");
-        insAreaCompany.setAuditid(insOrders.getUserid());
-        insAreaCompany.setPaymentLink(epolicyUrlImg);
-        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);
-        insAreaCompany.setJqappoint(""); //交强特别约定
-        insAreaCompany.setSyappoint(""); //商业特别约定
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_2.getCode()); // 5
-
-        insAreaCompanyService.updateById(insAreaCompany);
-
-        // 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();
-    }
-
-    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();
-        QuoteKindRespVo respVo = new QuoteKindRespVo();
-
-        // 添加驾意险
-        respVo.setKindCode("JYX");
-        respVo.setKindName("驾意险");
-        respVo.setAmount(response.getKindCode_EAD());
-        respVo.setCoveragePremium(response.getKindCode_csx());
-        kindList1.add(respVo);
-        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.setJqPremium(jqPremium);
-        quoteRespVo.setSyPremium(syPremium);
-        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(String insOrder, RenbaoQuoteResponse response, QuoteRespVo quoteRespVo) {
-        //保存订单信息
-        InsAreaCompany insAreaCompany = new InsAreaCompany();
-        insAreaCompany.setId(IdGenerate.nextId());
-        insAreaCompany.setOrderno(insOrder);
-        insAreaCompany.setReptxt(JSONObject.parseObject(JSONObject.toJSONString(response)));
-        insAreaCompany.setJqpremium(BigDecimal.valueOf(response.getKindCode_jiaoqiang()));
-        insAreaCompany.setSypremium(BigDecimal.valueOf(response.getKindCode_shangye()));
-        insAreaCompany.setTaxamount(BigDecimal.valueOf(response.getKindCode_chechuan()));
-        insAreaCompany.setSumpremium(BigDecimal.valueOf((response.getAll_price())));
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_0.getCode()); // 1
-        insAreaCompany.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getRiskList())));
-        insAreaCompany.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getKindList())));
-//        insAreaCompany.setJypremium(response.getKindCode_EAD());
-        insAreaCompanyService.save(insAreaCompany);
-        insAreaCompany.setInscompany("人保财险");
-        quoteRespVo.setCompanyId(insAreaCompany.getId());
-        return HttpResult.ok("成功", quoteRespVo);
-    }
-
-}

+ 0 - 217
src/main/java/com/ydtech/modules/order/service/impl/YongChengOrderServiceImpl.java

@@ -1,217 +0,0 @@
-package com.ydtech.modules.order.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.ydtech.components.YongchengRequestComponents;
-import com.ydtech.constants.RedisConstant;
-import com.ydtech.constants.enums.InsOrderStatus;
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.exception.SystemException;
-import com.ydtech.modules.ins.model.vo.*;
-import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
-import com.ydtech.modules.ins.model.yc.*;
-import com.ydtech.modules.order.entity.InsAreaCompany;
-import com.ydtech.modules.order.entity.InsOrders;
-import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
-import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
-import com.ydtech.modules.order.service.InsAreaCompanyService;
-import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.modules.order.service.YongChengOrderService;
-import com.ydtech.utils.CalculateUtils;
-import com.ydtech.utils.StringUtils;
-import com.ydtech.utils.idgen.IdGenerate;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-@Service
-public class YongChengOrderServiceImpl implements YongChengOrderService {
-
-    private final StringRedisTemplate redisTemplate;
-
-    private final YongchengRequestComponents yongchengRequestComponents;
-
-    private final InsAreaCompanyService insAreaCompanyService;
-
-    private final InsOrdersService insOrdersService;
-
-    public YongChengOrderServiceImpl(StringRedisTemplate redisTemplate, YongchengRequestComponents yongchengRequestComponents, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService) {
-        this.redisTemplate = redisTemplate;
-        this.yongchengRequestComponents = yongchengRequestComponents;
-        this.insAreaCompanyService = insAreaCompanyService;
-        this.insOrdersService = insOrdersService;
-    }
-
-
-    @Override
-    public HttpResult quote(BaseQuoteInfoVo quoteInfoVo, BaseQuoteVo<Object> quoteVo) {
-        // 1. 请求永诚Spider接口
-        YongchengQuoteResponse body = yongchengRequestComponents.quote(quoteInfoVo, YongchengQuoteResponse.class);
-        if (body.getCode() == 400) {
-            throw new SystemException(body.getResultMsg());
-        }
-        String orderno = quoteInfoVo.getOrderNo();
-        // 2.将数据存入redis中
-        YongchengLoginInfo yongchengLoginInfo = new YongchengLoginInfo(
-                body.getCookies(), body.getLicenseNo(), body.getJqFee(), body.getSyFee(), body.getData(), quoteInfoVo.getCarInfo().getFrameNo()
-        );
-        String s = JSON.toJSONString(yongchengLoginInfo);
-        redisTemplate.opsForValue().set(RedisConstant.INS_YONGCHENG_KEY + orderno, s);
-
-        String orderNo = quoteInfoVo.getOrderNo();
-
-        QuoteRespVo quoteRespVo = getQuoteRespVo(orderNo, body, quoteInfoVo);
-        // 4.插入订单
-        return responseOrder(orderNo, body, quoteRespVo);
-    }
-
-    @Override
-    public HttpResult audit(String companyId) {
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
-        InsOrders orders = insOrdersService.getById(insAreaCompany.getOrderno());
-
-        // 1. 获取登录token
-        YongchengAuditRequest loginInfo = getLoginInfo(orders.getOrderno());
-        YongchengAuditResponse body = yongchengRequestComponents.audit(loginInfo, YongchengAuditResponse.class);
-        // 2. 获取订单
-
-        if (body.getCode() == 400) {
-//            insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.UNDERWRITING_FAILED, order);
-            return HttpResult.error("永城--核保失败:" + body.getMessage());
-        }
-        // 4. 更新订单表
-        insAreaCompany.setAuditid(orders.getUserid());
-        insAreaCompany.setPaymentLink(body.getUrl());
-//        order.setJqapplyno();
-//        order.setSyapplyno();
-//        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);
-        insAreaCompany.setJqappoint(""); //交强特别约定
-        insAreaCompany.setSyappoint(""); //商业特别约定
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_2.getCode()); // 5
-        insAreaCompanyService.updateById(insAreaCompany);
-
-        // 5.成功插入轨迹表
-//        insTaskHistoryComponents.modifyStatus(underwrittenToBePaid, order);
-        return HttpResult.ok();
-    }
-
-
-    @Override
-    public YongchengPolicyPrintResponse getPolicyPrint(String companyId) {
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
-        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
-        String paymentLink = insAreaCompany.getPaymentLink();
-        CustomerInfoVo customerInfoVo = JSONObject.parseObject(paymentLink, CustomerInfoVo.class);
-        YongchengPolicyPrintRequest yongchengPolicyPrintRequest = new YongchengPolicyPrintRequest(customerInfoVo.getIdentifyNumber(), insOrders.getLicenseno());
-        YongchengPolicyPrintResponse body = yongchengRequestComponents.getPolicyPrint(yongchengPolicyPrintRequest, YongchengPolicyPrintResponse.class);
-        if (body.getCode() == 200) {
-            insAreaCompany.setJqpolicyno(body.getJqNumber());
-            insAreaCompany.setSypolicyno(body.getSyNumber());
-            insAreaCompany.setOrderstatus(InsOrderStatus.S_3.getCode());//已承保
-            insAreaCompanyService.updateById(insAreaCompany);
-//            insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.PAID, insOrder);
-//            insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.COVERED, insOrder);
-            return body;
-        }
-        throw new SystemException("没有查询到保单信息");
-    }
-
-    private QuoteRespVo getQuoteRespVo(String orderNo, YongchengQuoteResponse response, YaQuoteInfoVo yaQuoteInfoVo) {
-        double jqPremium = parseDouble(response.getForceCarInsureRisk());
-        double syPremium = parseDouble(response.getBusiTotalPremium());
-        QuoteRespVo quoteRespVo = new QuoteRespVo();
-        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;
-        Map<String, String> map = response.getInsuranceType();
-        List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
-
-        for (KindInfoVo kindInfoVo : kindList) {
-            kind = new QuoteKindRespVo();
-            kind.setKindCode(kindInfoVo.getKindCode());
-            kind.setKindName(kindInfoVo.getKindName());
-            kind.setAmount(kindInfoVo.getAmount());
-            kind.setCoveragePremium(parseDouble(map.get(kindInfoVo.getKindCode())));
-            kind.setUnitAmount(kindInfoVo.getUnitAmount());
-            if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
-                kind.setDeductibleRate(parseDouble(kindInfoVo.getDeductibleRate()));
-            }
-            kindList1.add(kind);
-        }
-
-        quoteRespVo.setRiskList(riskList1);
-        quoteRespVo.setKindList(kindList1);
-        quoteRespVo.setJqPremium(jqPremium);
-        quoteRespVo.setSyPremium(syPremium);
-        quoteRespVo.setCiSumPermium(CalculateUtils.add(parseDouble(response.getForceCarInsureRisk()), parseDouble(response.getCarInsureShiptax())));//交强险和车船税合计
-        quoteRespVo.setSumPermium(parseDouble(response.getCarInsureMain()));//保费合计
-        quoteRespVo.setTaxAmount(parseDouble(response.getCarInsureShiptax()));//车船税
-        quoteRespVo.setTotalAdjustRate(1);
-        quoteRespVo.setILogPreUdwMess("0");//评分
-        quoteRespVo.setOrderno(orderNo); //订单号
-        return quoteRespVo;
-    }
-
-    private HttpResult responseOrder(String orderNo, YongchengQuoteResponse response, QuoteRespVo quoteRespVo) {
-        //保存订单信息
-        InsAreaCompany insAreaCompany = new InsAreaCompany();
-        insAreaCompany.setId(IdGenerate.nextId());
-        insAreaCompany.setOrderno(orderNo);
-        insAreaCompany.setReptxt(JSONObject.parseObject(JSONObject.toJSONString(response)));
-        insAreaCompany.setJqpremium(BigDecimal.valueOf(parseDouble(response.getForceCarInsureRisk())));
-        insAreaCompany.setSypremium(BigDecimal.valueOf(parseDouble(response.getBusiTotalPremium())));
-        insAreaCompany.setTaxamount(BigDecimal.valueOf(parseDouble(response.getCarInsureShiptax())));
-        insAreaCompany.setSumpremium(BigDecimal.valueOf(parseDouble(response.getCarInsureMain())));
-        insAreaCompany.setOrderstatus(InsOrderStatus.S_0.getCode()); // 1
-        insAreaCompany.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getRiskList())));
-        insAreaCompany.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getKindList())));
-        insAreaCompany.setInscompany("永诚财险");
-        insAreaCompanyService.save(insAreaCompany);
-        //插入轨迹表 报价中
-//        insTaskHistoryComponents.modifyStatus(InsTaskHistoryEnum.IN_QUOTATION, insOrder);
-        quoteRespVo.setCompanyId(insAreaCompany.getId());
-        return HttpResult.ok("成功", quoteRespVo);
-    }
-
-    public YongchengLoginInfo getLoginInfo(String orderNo) {
-        String s = redisTemplate.opsForValue().get(RedisConstant.INS_YONGCHENG_KEY + orderNo);
-        return JSONObject.parseObject(s, YongchengLoginInfo.class);
-    }
-
-    public double parseDouble(String s) {
-        if (StringUtils.isNullOrEmpty(s)) {
-            return 0;
-        }
-        return Double.parseDouble(s);
-    }
-}

+ 16 - 20
src/main/java/com/ydtech/modules/order/service/impl/ZhongMeiOrderApiServiceImpl.java

@@ -110,7 +110,7 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
     }
 
     @Override
-    public HttpResult quote(BaseQuoteInfoVo quoteInfo, BaseQuoteVo<AccidentalDrivingVo> zmQuoteVo) {
+    public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, BaseQuoteVo<AccidentalDrivingVo> zmQuoteVo) {
         EsmInsCompany esmInsCompany = esmInsCompanyService.isOpen(zmQuoteVo.getCompanyId());
         CarInfoVo carInfo = quoteInfo.getCarInfo();
         // 1. 查询车型
@@ -154,33 +154,29 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
 
 
     @Override
-    public HttpResult audit(String companyId) {
+    public HttpResult<Object> audit(String companyId) {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
         InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
         JSONObject ownerinfo = insOrders.getApplyinfo();
         CustomerInfoVo customerInfoVo = JSON.toJavaObject(ownerinfo, CustomerInfoVo.class);
         // 1. 第二次 提交核保
         SubmitResponse response = submitForUnderwriting(insAreaCompany.getId(), insOrders.getFrameno(), customerInfoVo);
-        HttpResult httpResult;
         // 2. 人工核保
         if (response.getHead().getReturnMessage().contains(InsuranceTypeCorrespondence.MANUAL_UNDERWRITING)) {
             insAreaCompany.setOrderstatus(InsOrderStatus.S_1.getCode());
-            httpResult = HttpResult.error(response.getHead().getReturnMessage());
-        } else {
-            zhongmeiRequestApiComponents.validationResults(response);
-            // 投保单号
-            insAreaCompany.setPaymentLink(response.getPayUrl());
-            insAreaCompany.setJqapplyno(response.getForceProposalNo());
-            insAreaCompany.setSyapplyno(response.getBizProposalNo());
-            insAreaCompany.setJyapplyno(response.getAccidentProposalNo());
-            insAreaCompany.setInsOrderNo(response.getProposalNo());
-            insAreaCompany.setOrderstatus(InsOrderStatus.S_2.getCode());
-            httpResult = HttpResult.ok("核保成功");
+            return HttpResult.error(response.getHead().getReturnMessage());
         }
-
+        zhongmeiRequestApiComponents.validationResults(response);
+        // 投保单号
+        insAreaCompany.setPaymentLink(response.getPayUrl());
+        insAreaCompany.setJqapplyno(response.getForceProposalNo());
+        insAreaCompany.setSyapplyno(response.getBizProposalNo());
+        insAreaCompany.setJyapplyno(response.getAccidentProposalNo());
+        insAreaCompany.setInsOrderNo(response.getProposalNo());
+        insAreaCompany.setOrderstatus(InsOrderStatus.S_2.getCode());
         insAreaCompanyService.updateById(insAreaCompany);
         insOrdersService.updateByOrderStatus(insAreaCompany.getOrderno(), insAreaCompany.getOrderstatus());
-        return httpResult;
+        return HttpResult.ok("核保成功");
     }
 
     @Override
@@ -289,7 +285,7 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
             throw new SystemException("险种代码不存在");
         }
         InsurancePolicyPrintRequest request = new InsurancePolicyPrintRequest();
-        request.setRiskCode(InsuranceTypeCorrespondence.RISK.get(riskCode));
+        request.setRiskCode(InsuranceTypeCorrespondence.getRisk().get(riskCode));
         request.setPolicyNo(policyNo);
         request.setDocumentType(code);
         InsurancePolicyPrintResponse response = zhongmeiRequestApiComponents.insurancePolicyPrint(request, InsurancePolicyPrintResponse.class);
@@ -365,10 +361,10 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
                 kind.setKindCode(kindInfoVo.getKindCode());
                 kind.setKindName(kindInfoVo.getKindName());
                 kind.setAmount(kindInfoVo.getAmount());
-                int i = ArrayUtil.indexOf(InsuranceTypeCorrespondence.JINZHANGGUI_TYPE, kindInfoVo.getKindCode());
+                int i = ArrayUtil.indexOf(InsuranceTypeCorrespondence.getJinZhangGuiType(), kindInfoVo.getKindCode());
 
                 QuotedPriceResponse.BizPremiumDTO.CoverageListDTO coverageListDTOS = coverageList.stream().filter(
-                                a -> a.getKindCode().equals(InsuranceTypeCorrespondence.CONNECT_INSURANCE_TYPE[i]))
+                                a -> a.getKindCode().equals(InsuranceTypeCorrespondence.getConnectInsuranceType()[i]))
                         .collect(Collectors.toList()).get(0);
 
                 kind.setCoveragePremium(coverageListDTOS.getPremium());
@@ -395,7 +391,7 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
         return quoteRespVo;
     }
 
-    public HttpResult responseOrder(QuotedPriceResponse quotedPriceResponse, QuoteRespVo quoteRespVo, EsmInsCompany esmInsCompanies, SubmitResponse submitResponse) {
+    public HttpResult<QuoteRespVo> responseOrder(QuotedPriceResponse quotedPriceResponse, QuoteRespVo quoteRespVo, EsmInsCompany esmInsCompanies, SubmitResponse submitResponse) {
         //保存订单信息
         String orderNo = quoteRespVo.getOrderno();
         InsAreaCompany insAreaCompany = new InsAreaCompany();

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/impl/ZhongMeiOrderServiceImpl.java

@@ -122,7 +122,7 @@ public class ZhongMeiOrderServiceImpl implements ZhongMeiOrderService {
         List<InsTaskImage> insTaskImages = insTaskImageService.selectByTaskId(insOrders.getQuoteno());
         EsmInsAttribution esmInsAttribution = esmInsAttributionService.getById(insAreaCompany.getAttributionId());
 
-        if (insTaskImages.size() > 0) {
+        if (!insTaskImages.isEmpty()) {
             InsZmUploadImageVo insZmUploadImageVo = new InsZmUploadImageVo(insAreaCompany.getInsOrderNo(), esmInsAttribution.getUsername(), insTaskImages);
             zhongmeiRequestComponents.submitImage(insZmUploadImageVo, new ParameterizedTypeReference<Response<Object>>() {
             });

+ 4 - 4
src/main/java/com/ydtech/modules/protocol/controller/PtlAgreementController.java

@@ -45,26 +45,26 @@ public class PtlAgreementController extends BaseController {
 
     @PutMapping("/{agreementId}")
     @ApiOperation("修改协议")
-    public HttpResult<Object> revise(@PathVariable Long agreementId, @RequestBody PtlAgreementSaveVo agreement) {
+    public HttpResult<Object> revise(@PathVariable String agreementId, @RequestBody PtlAgreementSaveVo agreement) {
         String userName = getUserName();
         return ptlAgreementService.reviseAgreement(userName, agreementId, agreement);
     }
 
     @GetMapping("/{agreementId}")
     @ApiOperation("通过协议id查询所有信息")
-    public HttpResult<PtlAgreementQueryVo> getByAgreementId(@PathVariable Long agreementId) {
+    public HttpResult<PtlAgreementQueryVo> getByAgreementId(@PathVariable String agreementId) {
         return ptlAgreementService.getByAgreementId(agreementId);
     }
 
     @DeleteMapping("/{agreementId}")
     @ApiOperation("删除协议")
-    public HttpResult<Object> delete(@PathVariable Long agreementId) {
+    public HttpResult<Object> delete(@PathVariable String agreementId) {
         return ptlAgreementService.deleteAgreement(agreementId);
     }
 
     @PostMapping("/audit/{agreementId}")
     @ApiOperation("审核协议")
-    public HttpResult<Object> audit(@PathVariable Long agreementId, @RequestBody PtlAgreementAuditVo ptlAgreementAuditVo) {
+    public HttpResult<Object> audit(@PathVariable String agreementId, @RequestBody PtlAgreementAuditVo ptlAgreementAuditVo) {
         return ptlAgreementService.auditAgreement(agreementId, ptlAgreementAuditVo);
     }
 

+ 8 - 1
src/main/java/com/ydtech/modules/protocol/controller/PtlInsAttributionTemplateController.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
+import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateVo;
 import com.ydtech.modules.protocol.service.PtlInsAttributionTemplateService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -22,6 +23,12 @@ public class PtlInsAttributionTemplateController {
         this.ptlInsAttributionTemplateService = ptlInsAttributionTemplateService;
     }
 
+    @GetMapping("/getPtlInsAttributionTemplate")
+    @ApiOperation("通过保险公司id和api类型查询请求模板")
+    public HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(@RequestBody PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo){
+        return ptlInsAttributionTemplateService.getPtlInsAttributionTemplate(ptlInsAttributionTemplateVo);
+    }
+
     @PostMapping
     @ApiOperation("提交模板信息")
     public HttpResult<Object> submit(@RequestBody PtlInsAttributionTemplateSaveVo ptlInsAttributionTemplateSaveVo) {
@@ -30,7 +37,7 @@ public class PtlInsAttributionTemplateController {
 
     @GetMapping("/{id}")
     @ApiOperation("通过id获取模板信息")
-    public HttpResult<PtlInsAttributionTemplate> getByIdObtain(@PathVariable Long id) {
+    public HttpResult<PtlInsAttributionTemplate> getByIdObtain(@PathVariable String id) {
         return ptlInsAttributionTemplateService.getByIdObtain(id);
     }
 

+ 7 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java

@@ -1,7 +1,12 @@
 package com.ydtech.modules.protocol.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import org.apache.ibatis.annotations.Param;
+
+import java.time.LocalDate;
+import java.util.List;
 
 /**
 * @author Administrator
@@ -11,6 +16,8 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 */
 public interface PtlAgreementMapper extends BaseMapper<PtlAgreement> {
 
+    List<PtlAgreementInsCompanyDto> getAgreementCompany(@Param("localDate") LocalDate localDate,@Param("deptId") String deptId);
+
 }
 
 

+ 8 - 5
src/main/java/com/ydtech/modules/protocol/dao/PtlCrawlerApiMapper.java

@@ -2,15 +2,18 @@ package com.ydtech.modules.protocol.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ydtech.modules.protocol.entity.po.PtlCrawlerApi;
+import org.apache.ibatis.annotations.Param;
 
 /**
-* @author Administrator
-* @description 针对表【ptl_crawler_api(python对接接口)】的数据库操作Mapper
-* @createDate 2023-07-03 18:10:03
-* @Entity generator.domain.PtlCrawlerApi
-*/
+ * @author Administrator
+ * @description 针对表【ptl_crawler_api(python对接接口)】的数据库操作Mapper
+ * @createDate 2023-07-03 18:10:03
+ * @Entity generator.domain.PtlCrawlerApi
+ */
 public interface PtlCrawlerApiMapper extends BaseMapper<PtlCrawlerApi> {
 
+    String getApiUrl(@Param("agreementId") String agreementId, @Param("crawlerApiType") String crawlerApiType);
+
 }
 
 

+ 7 - 1
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementAttributionDto.java

@@ -21,7 +21,13 @@ public class PtlAgreementAttributionDto implements Serializable {
      * 协议id
      */
     @ApiModelProperty("协议id")
-    private Integer agreementId;
+    private String agreementId;
+
+    /**
+     * 模板id
+     */
+    @ApiModelProperty("模板id")
+    private String templateId;
 
     /**
      * api类型(1、api对接,2、python对接)

+ 18 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementDto.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocol.entity.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public  class PtlAgreementDto implements Serializable {
+
+    private static final long serialVersionUID = -9099368754131435612L;
+
+    private String id;
+
+    private String agreementName;
+
+    private Integer apiType;
+
+}

+ 18 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementInsCompanyDto.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocol.entity.dto;
+
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class PtlAgreementInsCompanyDto extends EsmInsCompany implements Serializable {
+
+    private static final long serialVersionUID = -5790993730287966635L;
+
+    private List<PtlAgreementDto>  agreement;
+
+}

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementProductCostsSaveDto.java

@@ -20,7 +20,7 @@ public class PtlAgreementProductCostsSaveDto extends PtlAgreementProductCostsBas
     @ApiModelProperty("费用")
     private List<PtlAgreementCostsFactorSaveDto> factor;
 
-    public static List<PtlAgreementProductCosts> toPtlAgreementProductCosts(Long agreementId, List<PltAgreementSchemeSaveDto> scheme) {
+    public static List<PtlAgreementProductCosts> toPtlAgreementProductCosts(String agreementId, List<PltAgreementSchemeSaveDto> scheme) {
         return scheme.stream().map(x -> PtlAgreementProductCosts.toPtlAgreementProductCostsList(agreementId, x.getProductId(), x.getName(), x.getProductCosts()))
                 .flatMap(Collection::stream)
                 .collect(Collectors.toList());

+ 2 - 2
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementUnderwritingRulesSaveDto.java

@@ -20,11 +20,11 @@ public class PtlAgreementUnderwritingRulesSaveDto {
     @ApiModelProperty("规则因子")
     private List<PtlAgreementCostsFactorSaveDto> rulesFactor;
 
-    public static List<PtlAgreementUnderwritingRules> toPtlAgreementUnderwritingRulesList(Long agreementId, List<PtlAgreementUnderwritingRulesSaveDto> underwritingRules) {
+    public static List<PtlAgreementUnderwritingRules> toPtlAgreementUnderwritingRulesList(String agreementId, List<PtlAgreementUnderwritingRulesSaveDto> underwritingRules) {
         return underwritingRules.stream().map(x -> PtlAgreementUnderwritingRulesSaveDto.toPtlAgreementUnderwritingRules(agreementId, x)).collect(Collectors.toList());
     }
 
-    public static PtlAgreementUnderwritingRules toPtlAgreementUnderwritingRules(Long agreementId, PtlAgreementUnderwritingRulesSaveDto ptlAgreementUnderwritingRulesSaveDto) {
+    public static PtlAgreementUnderwritingRules toPtlAgreementUnderwritingRules(String agreementId, PtlAgreementUnderwritingRulesSaveDto ptlAgreementUnderwritingRulesSaveDto) {
         PtlAgreementUnderwritingRules ptlAgreementUnderwritingRules = new PtlAgreementUnderwritingRules();
         ptlAgreementUnderwritingRules.setRulesType(ptlAgreementUnderwritingRulesSaveDto.getRulesType());
         ptlAgreementUnderwritingRules.setAgreementId(agreementId);

+ 5 - 1
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAttributionTemplateDto.java

@@ -4,9 +4,13 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.io.Serializable;
+
 @Data
 @ApiModel("归属配置模版")
-public class PtlAttributionTemplateDto {
+public class PtlAttributionTemplateDto implements Serializable {
+
+    private static final long serialVersionUID = 1000183859846970741L;
 
     @ApiModelProperty(value = "字段")
     private String field;

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreement.java

@@ -21,7 +21,7 @@ public class PtlAgreement implements Serializable {
      * 主键/自增
      */
     @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
+    private String id;
 
     /**
      * 协议类型

+ 10 - 2
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementAttribution.java

@@ -23,11 +23,12 @@ import java.io.Serializable;
 @AllArgsConstructor
 @NoArgsConstructor
 public class PtlAgreementAttribution implements Serializable {
+
     /**
      * 协议id
      */
     @TableId(value = "id")
-    private Long id;
+    private String id;
 
     /**
      * 保险公司ID
@@ -41,6 +42,12 @@ public class PtlAgreementAttribution implements Serializable {
     @TableField(value = "ins_company_name")
     private String insCompanyName;
 
+    /**
+     * 模板id
+     */
+    @TableField(value = "template_id")
+    private String templateId;
+
     /**
      * api类型(1、api对接,2、python对接)
      */
@@ -69,10 +76,11 @@ public class PtlAgreementAttribution implements Serializable {
     private static final long serialVersionUID = 1L;
 
 
-    public PtlAgreementAttribution(Long agreementId, String insCompanyId, String insCompanyName, PtlAgreementAttributionDto ptlAgreementAttributionDto) {
+    public PtlAgreementAttribution(String agreementId, String insCompanyId, String insCompanyName, PtlAgreementAttributionDto ptlAgreementAttributionDto) {
         this.id = agreementId;
         this.insCompanyId = insCompanyId;
         this.insCompanyName = insCompanyName;
+        this.templateId = ptlAgreementAttributionDto.getTemplateId();
         this.apiType = ptlAgreementAttributionDto.getApiType();
         this.fields = JSON.parseArray(JSON.toJSONString(ptlAgreementAttributionDto.getFields()));
         this.username = ptlAgreementAttributionDto.getUsername();

+ 4 - 4
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementDept.java

@@ -26,7 +26,7 @@ public class PtlAgreementDept implements Serializable {
      * 协议id
      */
     @TableField(value = "agreement_id")
-    private Long agreementId;
+    private String agreementId;
 
     /**
      * 部门ID
@@ -37,12 +37,12 @@ public class PtlAgreementDept implements Serializable {
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 
-    public static List<PtlAgreementDept> toPtlAgreementDeptList(Long agreementId, List<String> deptIdList) {
+    public static List<PtlAgreementDept> toPtlAgreementDeptList(String agreementId, List<String> deptIdList) {
         return deptIdList.stream().map(d -> new PtlAgreementDept(agreementId, d)).collect(Collectors.toList());
     }
 
-    public PtlAgreementDept(Long agreementId, String deptId) {
-        this.agreementId = agreementId;
+    public PtlAgreementDept(String agreementId, String deptId) {
+        this.agreementId = String.valueOf(agreementId);
         this.deptId = deptId;
     }
 

+ 4 - 4
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementProductCosts.java

@@ -29,13 +29,13 @@ public class PtlAgreementProductCosts implements Serializable {
      * 主键/自增
      */
     @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
+    private String id;
 
     /**
      * 协议id
      */
     @TableField(value = "agreement_id")
-    private Long agreementId;
+    private String agreementId;
 
     /**
      * 产品id
@@ -107,14 +107,14 @@ public class PtlAgreementProductCosts implements Serializable {
      * @param ptlAgreementProductCostsSaveDtoList 协议费用 Dto list
      * @return List<PtlAgreementProductCosts>
      */
-    public static List<PtlAgreementProductCosts> toPtlAgreementProductCostsList(Long AgreementId, String productId, String productName, List<PtlAgreementProductCostsSaveDto> ptlAgreementProductCostsSaveDtoList) {
+    public static List<PtlAgreementProductCosts> toPtlAgreementProductCostsList(String AgreementId, String productId, String productName, List<PtlAgreementProductCostsSaveDto> ptlAgreementProductCostsSaveDtoList) {
         return ptlAgreementProductCostsSaveDtoList.stream().map(
                 ptlAgreementProductCostsSaveDto ->
                         new PtlAgreementProductCosts(AgreementId, productId, productName, ptlAgreementProductCostsSaveDto)
         ).collect(Collectors.toList());
     }
 
-    public PtlAgreementProductCosts(Long agreementId, String productId, String productName, PtlAgreementProductCostsSaveDto ptlAgreementProductCostsSaveDto) {
+    public PtlAgreementProductCosts(String agreementId, String productId, String productName, PtlAgreementProductCostsSaveDto ptlAgreementProductCostsSaveDto) {
         this.agreementId = agreementId;
         this.productId = productId;
         this.productName = productName;

+ 2 - 2
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementUnderwritingRules.java

@@ -25,13 +25,13 @@ public class PtlAgreementUnderwritingRules implements Serializable {
      * 主键/自增
      */
     @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
+    private String id;
 
     /**
      * 协议id
      */
     @TableField(value = "agreement_id")
-    private Long agreementId;
+    private String agreementId;
 
     /**
      * 规则类型(0满足拒保 1满足承包)

+ 19 - 2
src/main/java/com/ydtech/modules/protocol/entity/po/PtlCrawlerApi.java

@@ -4,19 +4,24 @@ 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 com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
+import com.ydtech.modules.protocol.entity.vo.PtlCrawlerApiSaveVo;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * python对接接口
+ *
  * @TableName ptl_crawler_api
  */
-@TableName(value ="ptl_crawler_api")
+@TableName(value = "ptl_crawler_api")
 @Data
 public class PtlCrawlerApi implements Serializable {
     /**
-     * 
+     *
      */
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
@@ -48,4 +53,16 @@ public class PtlCrawlerApi implements Serializable {
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 
+
+    public static List<PtlCrawlerApi> toPtlCrawlerApiList(Long templateId, List<PtlCrawlerApiSaveVo> ptlCrawlerApiSaveVoList){
+        return ptlCrawlerApiSaveVoList.stream().map(a-> new PtlCrawlerApi(templateId, a)).collect(Collectors.toList());
+    }
+
+    public PtlCrawlerApi(Long templateId, PtlCrawlerApiSaveVo ptlCrawlerApiSaveVo) {
+        this.templateId = templateId;
+        this.apiType = ptlCrawlerApiSaveVo.getApiType();
+        this.apiName = Enum.valueOf(PtlCrawlerApiType.class, "API_" + ptlCrawlerApiSaveVo.getApiType()).getDesc();
+        this.url = ptlCrawlerApiSaveVo.getUrl();
+    }
+
 }

+ 0 - 6
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlCrawlerApiSaveVo.java

@@ -12,15 +12,9 @@ public class PtlCrawlerApiSaveVo implements Serializable {
 
     private static final long serialVersionUID = -8746020505828059226L;
 
-    @ApiModelProperty("模板id")
-    private Long templateId;
-
     @ApiModelProperty("1、归属配置;2、报价;3、影像上传;4、核保;5、缴费查询;6、保单下载;7、非车险查询")
     private Integer apiType;
 
-    @ApiModelProperty("api名称")
-    private String apiName;
-
     @ApiModelProperty("url")
     private String url;
 

+ 20 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlInsAttributionTemplateVo.java

@@ -0,0 +1,20 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class PtlInsAttributionTemplateVo implements Serializable {
+
+    private static final long serialVersionUID = -7074257157706968442L;
+
+    @ApiModelProperty("api类型")
+    private Integer apiType;
+
+    @ApiModelProperty("保险公司ID")
+    private String insCompanyId;
+
+}

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementAttributionService.java

@@ -18,7 +18,7 @@ public interface PtlAgreementAttributionService extends IService<PtlAgreementAtt
      * @param agreementId 协议id
      * @param attribution 协议归属信息
      */
-    void saveAttribution(Long agreementId, String insuranceCompany, PtlAgreementAttributionDto attribution);
+    void saveAttribution(String agreementId, String insuranceCompany, PtlAgreementAttributionDto attribution);
 
 
 }

+ 13 - 6
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementDeptService.java

@@ -16,22 +16,29 @@ public interface PtlAgreementDeptService extends IService<PtlAgreementDept> {
     /**
      * 通过 协议id 批量添加 协议授权部门
      *
-     * @param agreementId  协议id
+     * @param agreementId 协议id
      */
-    void saveBatchDept(Long agreementId, List<String> dept);
+    void saveBatchDept(String agreementId, List<String> dept);
 
 
     /**
      * 通过 协议id 获取 协议授权部门
      *
-     * @param agreementId  协议id
+     * @param agreementId 协议id
      */
-    List<PtlAgreementDept> getByAgreementId(Long agreementId);
+    List<PtlAgreementDept> getByAgreementId(String agreementId);
 
     /**
      * 通过 协议id 删除 协议授权部门
      *
-     * @param agreementId  协议id
+     * @param agreementId 协议id
      */
-    void deleteByAgreementId(Long agreementId);
+    void deleteByAgreementId(String agreementId);
+
+
+    /**
+     * 判断此协议是否授权
+     */
+    void agreementIsAuthorized(String deptId, String agreementId);
+
 }

+ 3 - 3
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementProductCostsService.java

@@ -19,14 +19,14 @@ public interface PtlAgreementProductCostsService extends IService<PtlAgreementPr
      *
      * @param agreementId 协议id
      */
-    void deleteByAgreementId(Long agreementId);
+    void deleteByAgreementId(String agreementId);
 
     /**
      * 根据 协议id 查询协议产品费用
      *
      * @param agreementId 协议id
      */
-    List<PltAgreementSchemeQueryDto> getByAgreementId(Long agreementId);
+    List<PltAgreementSchemeQueryDto> getByAgreementId(String agreementId);
 
     /**
      * 批量提添加产品费用
@@ -34,5 +34,5 @@ public interface PtlAgreementProductCostsService extends IService<PtlAgreementPr
      * @param agreementId 协议id
      * @param scheme      产品
      */
-    void saveBatchProductCosts(Long agreementId, List<PltAgreementSchemeSaveDto> scheme);
+    void saveBatchProductCosts(String agreementId, List<PltAgreementSchemeSaveDto> scheme);
 }

+ 16 - 7
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java

@@ -3,12 +3,15 @@ package com.ydtech.modules.protocol.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageResult;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.entity.vo.PtlAgreementAuditVo;
 import com.ydtech.modules.protocol.entity.vo.PtlAgreementPageVo;
 import com.ydtech.modules.protocol.entity.vo.PtlAgreementQueryVo;
 import com.ydtech.modules.protocol.entity.vo.PtlAgreementSaveVo;
 
+import java.util.List;
+
 /**
  * @author Administrator
  * @description 针对表【ptl_agreement(协议信息表)】的数据库操作Service
@@ -16,13 +19,19 @@ import com.ydtech.modules.protocol.entity.vo.PtlAgreementSaveVo;
  */
 public interface PtlAgreementService extends IService<PtlAgreement> {
 
+    /**
+     * 获取可以报价的 协议 及其保险公司
+     * @return List<PtlAgreementInsCompanyDto>
+     */
+    List<PtlAgreementInsCompanyDto> getAgreementCompany(String deptId);
+
 
     /**
      * 通过协议id 判断是否存在
      *
      * @param agreementId 协议id
      */
-    PtlAgreement ifExistsById(Long agreementId);
+    PtlAgreement ifExistsById(String agreementId);
 
 
     /**
@@ -48,7 +57,7 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      * @param agreementId 协议id
      * @return HttpResult
      */
-    HttpResult<PtlAgreementQueryVo> getByAgreementId(Long agreementId);
+    HttpResult<PtlAgreementQueryVo> getByAgreementId(String agreementId);
 
     /**
      * 删除协议
@@ -56,7 +65,7 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      * @param agreementId 协议id
      * @return HttpResult
      */
-    HttpResult<Object> deleteAgreement(Long agreementId);
+    HttpResult<Object> deleteAgreement(String agreementId);
 
 
     /**
@@ -66,20 +75,20 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      * @param agreement 上传的协议信息
      * @return HttpResult
      */
-    HttpResult<Object> reviseAgreement(String userName, Long agreementId, PtlAgreementSaveVo agreement);
+    HttpResult<Object> reviseAgreement(String userName, String agreementId, PtlAgreementSaveVo agreement);
 
     /**
      * 提交 产品费用 承保规则 账号信息 授权部门
      * @param agreementId 协议id
      * @param agreement 提交内容
      */
-    void saveAssociationInformation(Long agreementId, String insuranceCompany, PtlAgreementSaveVo agreement);
+    void saveAssociationInformation(String agreementId, String insuranceCompany, PtlAgreementSaveVo agreement);
 
     /**
      * 删除关联信息  产品费用 承保规则 账号信息 授权部门
      * @param agreementId 协议id
      */
-    void deleteAssociationInformation(Long agreementId);
+    void deleteAssociationInformation(String agreementId);
 
     /**
      * 审核协议
@@ -87,5 +96,5 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      * @param ptlAgreementAuditVo 审核内容
      * @return
      */
-    HttpResult<Object> auditAgreement(Long agreementId, PtlAgreementAuditVo ptlAgreementAuditVo);
+    HttpResult<Object> auditAgreement(String agreementId, PtlAgreementAuditVo ptlAgreementAuditVo);
 }

+ 4 - 4
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementUnderwritingRulesService.java

@@ -21,7 +21,7 @@ public interface PtlAgreementUnderwritingRulesService extends IService<PtlAgreem
      *
      * @param agreementId 协议id
      */
-    void deleteByAgreementId(Long agreementId);
+    void deleteByAgreementId(String agreementId);
 
     /**
      * 根据 协议id 承保规则查询承保规则
@@ -29,7 +29,7 @@ public interface PtlAgreementUnderwritingRulesService extends IService<PtlAgreem
      * @param agreementId 协议id
      * @return List<PtlAgreementUnderwritingRulesQueryDto>
      */
-    List<PtlAgreementUnderwritingRules> getByAgreementId(Long agreementId);
+    List<PtlAgreementUnderwritingRules> getByAgreementId(String agreementId);
 
     /**
      * 根据协议id批量添加承保规则
@@ -37,7 +37,7 @@ public interface PtlAgreementUnderwritingRulesService extends IService<PtlAgreem
      * @param agreementId       协议id
      * @param underwritingRules 承保规则
      */
-    void saveBatchUnderwritingRules(Long agreementId, List<PtlAgreementUnderwritingRulesSaveDto> underwritingRules);
+    void saveBatchUnderwritingRules(String agreementId, List<PtlAgreementUnderwritingRulesSaveDto> underwritingRules);
 
     /**
      * 通过协议id 和 规则类型 获取 配置规则
@@ -46,7 +46,7 @@ public interface PtlAgreementUnderwritingRulesService extends IService<PtlAgreem
      * @param rulesType   规则类型
      * @return Map<String, PtlFactorDto>
      */
-    Map<String, PtlFactorDto> getMapPtlFactorDto(Long agreementId, Integer rulesType);
+    Map<String, PtlFactorDto> getMapPtlFactorDto(String agreementId, Integer rulesType);
 
 }
 

+ 6 - 4
src/main/java/com/ydtech/modules/protocol/service/PtlCrawlerApiService.java

@@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.protocol.entity.po.PtlCrawlerApi;
 
 /**
-* @author Administrator
-* @description 针对表【ptl_crawler_api(python对接接口)】的数据库操作Service
-* @createDate 2023-07-03 18:10:03
-*/
+ * @author Administrator
+ * @description 针对表【ptl_crawler_api(python对接接口)】的数据库操作Service
+ * @createDate 2023-07-03 18:10:03
+ */
 public interface PtlCrawlerApiService extends IService<PtlCrawlerApi> {
 
+    String getApiUrl(String agreementId, String crawlerApiType);
+
 }

+ 9 - 1
src/main/java/com/ydtech/modules/protocol/service/PtlInsAttributionTemplateService.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
+import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateVo;
 
 /**
  * @author Administrator
@@ -36,7 +37,7 @@ public interface PtlInsAttributionTemplateService extends IService<PtlInsAttribu
      * @param id 保险公司归属信息模板id
      * @return PtlInsAttributionTemplate
      */
-    HttpResult<PtlInsAttributionTemplate> getByIdObtain(Long id);
+    HttpResult<PtlInsAttributionTemplate> getByIdObtain(String id);
 
     /**
      * 分页查询
@@ -61,4 +62,11 @@ public interface PtlInsAttributionTemplateService extends IService<PtlInsAttribu
      * @return PtlInsAttributionTemplate
      */
     HttpResult<Object> revise(String id, PtlInsAttributionTemplateSaveVo ptlInsAttributionTemplateSaveVo);
+
+    /**
+     * 通过保险公司id和api类型查询请求模板
+     * @param ptlInsAttributionTemplateVo 保险公司id和api类型
+     * @return PtlInsAttributionTemplate
+     */
+    HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo);
 }

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementAttributionServiceImpl.java

@@ -25,7 +25,7 @@ public class PtlAgreementAttributionServiceImpl extends ServiceImpl<PtlAgreement
     }
 
     @Override
-    public void saveAttribution(Long agreementId, String insuranceCompany, PtlAgreementAttributionDto attribution) {
+    public void saveAttribution(String agreementId, String insuranceCompany, PtlAgreementAttributionDto attribution) {
         EsmInsCompany esmInsCompany = esmInsCompanyService.getById(insuranceCompany);
         PtlAgreementAttribution ptlAgreementAttribution = new PtlAgreementAttribution(agreementId, esmInsCompany.getId(), esmInsCompany.getNamesimple(), attribution);
         save(ptlAgreementAttribution);

+ 18 - 9
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementDeptServiceImpl.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.protocol.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.protocol.dao.PtlAgreementDeptMapper;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementDept;
 import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
@@ -11,32 +12,40 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.List;
 
 /**
-* @author wenks
-* @description 针对表【ptl_agreement_dept(协议授权部门表)】的数据库操作Service实现
-* @createDate 2023-07-03 09:31:16
-*/
+ * @author wenks
+ * @description 针对表【ptl_agreement_dept(协议授权部门表)】的数据库操作Service实现
+ * @createDate 2023-07-03 09:31:16
+ */
 @Service
 public class PtlAgreementDeptServiceImpl extends ServiceImpl<PtlAgreementDeptMapper, PtlAgreementDept>
-    implements PtlAgreementDeptService {
+        implements PtlAgreementDeptService {
 
     @Override
     @Transactional
-    public void saveBatchDept(Long agreementId, List<String> dept) {
+    public void saveBatchDept(String agreementId, List<String> dept) {
         List<PtlAgreementDept> ptlAgreementDeptList = PtlAgreementDept.toPtlAgreementDeptList(agreementId, dept);
         saveBatch(ptlAgreementDeptList);
     }
 
     @Override
-    public List<PtlAgreementDept> getByAgreementId(Long agreementId) {
+    public List<PtlAgreementDept> getByAgreementId(String agreementId) {
         return list(byAgreementId(agreementId));
     }
 
     @Override
-    public void deleteByAgreementId(Long agreementId) {
+    public void deleteByAgreementId(String agreementId) {
         remove(byAgreementId(agreementId));
     }
 
-    private LambdaQueryWrapper<PtlAgreementDept> byAgreementId(Long agreementId){
+    @Override
+    public void agreementIsAuthorized(String deptId, String agreementId) {
+        List<PtlAgreementDept> list = list(byAgreementId(agreementId).eq(PtlAgreementDept::getDeptId, deptId));
+        if (list.isEmpty()) {
+            throw new SystemException("请联系团队长授权");
+        }
+    }
+
+    private LambdaQueryWrapper<PtlAgreementDept> byAgreementId(String agreementId) {
         LambdaQueryWrapper<PtlAgreementDept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         lambdaQueryWrapper.eq(PtlAgreementDept::getAgreementId, agreementId);
         return lambdaQueryWrapper;

+ 3 - 3
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementProductCostsServiceImpl.java

@@ -26,14 +26,14 @@ public class PtlAgreementProductCostsServiceImpl extends ServiceImpl<PtlAgreemen
         implements PtlAgreementProductCostsService {
 
     @Override
-    public void deleteByAgreementId(Long agreementId) {
+    public void deleteByAgreementId(String agreementId) {
         LambdaQueryWrapper<PtlAgreementProductCosts> costsLambdaQueryWrapper = new LambdaQueryWrapper<>();
         costsLambdaQueryWrapper.eq(PtlAgreementProductCosts::getAgreementId, agreementId);
         baseMapper.delete(costsLambdaQueryWrapper);
     }
 
     @Override
-    public List<PltAgreementSchemeQueryDto> getByAgreementId(Long agreementId) {
+    public List<PltAgreementSchemeQueryDto> getByAgreementId(String agreementId) {
         LambdaQueryWrapper<PtlAgreementProductCosts> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(PtlAgreementProductCosts::getAgreementId, agreementId);
         List<PtlAgreementProductCosts> ptlAgreementProductCosts = baseMapper.selectList(wrapper);
@@ -53,7 +53,7 @@ public class PtlAgreementProductCostsServiceImpl extends ServiceImpl<PtlAgreemen
 
     @Override
     @Transactional
-    public void saveBatchProductCosts(Long agreementId, List<PltAgreementSchemeSaveDto> scheme) {
+    public void saveBatchProductCosts(String agreementId, List<PltAgreementSchemeSaveDto> scheme) {
         List<PtlAgreementProductCosts> ptlAgreementProductCostsList = PtlAgreementProductCostsSaveDto.toPtlAgreementProductCosts(agreementId, scheme);
         boolean b = saveBatch(ptlAgreementProductCostsList);
         AssertionUtils.isSucceed(b, "批量添加产品费用失败");

+ 15 - 7
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -8,6 +8,7 @@ import com.ydtech.core.page.PageResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.protocol.dao.PtlAgreementMapper;
 import com.ydtech.modules.protocol.entity.dto.PltAgreementSchemeQueryDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementSaveDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
@@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -54,13 +56,19 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         this.ptlAgreementDeptService = ptlAgreementDeptService;
     }
 
+    @Override
+    public List<PtlAgreementInsCompanyDto> getAgreementCompany(String deptId) {
+        LocalDate localDate = LocalDate.now();
+        return baseMapper.getAgreementCompany(localDate, deptId);
+    }
+
     @Autowired
     public void setProxyObject(PtlAgreementService proxyObject) {
         this.proxyObject = proxyObject;
     }
 
     @Override
-    public PtlAgreement ifExistsById(Long agreementId) {
+    public PtlAgreement ifExistsById(String agreementId) {
         PtlAgreement ptlAgreement = getById(agreementId);
         if (ObjectUtils.isEmpty(ptlAgreement)) {
             throw new SystemException("协议id 不存在");
@@ -101,7 +109,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
     @Override
-    public HttpResult<PtlAgreementQueryVo> getByAgreementId(Long agreementId) {
+    public HttpResult<PtlAgreementQueryVo> getByAgreementId(String agreementId) {
         PtlAgreement ptlAgreement = proxyObject.ifExistsById(agreementId);
         // 获取产品费用
         List<PltAgreementSchemeQueryDto> schemeQueryDto = ptlAgreementProductCostsService.getByAgreementId(agreementId);
@@ -117,7 +125,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
     @Override
     @Transactional
-    public HttpResult<Object> deleteAgreement(Long agreementId) {
+    public HttpResult<Object> deleteAgreement(String agreementId) {
         proxyObject.ifExistsById(agreementId);
         boolean b = removeById(agreementId);
         AssertionUtils.isSucceed(b, "协议信息删除失败");
@@ -128,7 +136,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
     @Override
     @Transactional
-    public HttpResult<Object> reviseAgreement(String userName, Long agreementId, PtlAgreementSaveVo agreement) {
+    public HttpResult<Object> reviseAgreement(String userName, String agreementId, PtlAgreementSaveVo agreement) {
         PtlAgreementSaveDto agreementSaveDto = agreement.getAgreement();
         PtlAgreement ptlAgreement = proxyObject.ifExistsById(agreementId);
         BeanUtils.copyProperties(agreementSaveDto, ptlAgreement);
@@ -152,7 +160,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
      * @param agreement   协议信息全部实体
      */
     @Override
-    public void saveAssociationInformation(Long agreementId, String insuranceCompany, PtlAgreementSaveVo agreement) {
+    public void saveAssociationInformation(String agreementId, String insuranceCompany, PtlAgreementSaveVo agreement) {
         // 产品费用
         ptlAgreementProductCostsService.saveBatchProductCosts(agreementId, agreement.getScheme());
         // 承包规则
@@ -165,7 +173,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
 
     @Override
-    public void deleteAssociationInformation(Long agreementId) {
+    public void deleteAssociationInformation(String agreementId) {
         // 删除产品费用
         ptlAgreementProductCostsService.deleteByAgreementId(agreementId);
         // 删除承保规则
@@ -177,7 +185,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
     @Override
-    public HttpResult<Object> auditAgreement(Long agreementId, PtlAgreementAuditVo ptlAgreementAuditVo) {
+    public HttpResult<Object> auditAgreement(String agreementId, PtlAgreementAuditVo ptlAgreementAuditVo) {
         PtlAgreement ptlAgreement = proxyObject.ifExistsById(agreementId);
         ptlAgreement.setAuditStatus(ptlAgreementAuditVo.getAuditStatus());
         ptlAgreement.setAuditContent(ptlAgreementAuditVo.getAuditContent());

+ 4 - 4
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementUnderwritingRulesServiceImpl.java

@@ -26,14 +26,14 @@ public class PtlAgreementUnderwritingRulesServiceImpl extends ServiceImpl<PtlAgr
 
 
     @Override
-    public void deleteByAgreementId(Long agreementId) {
+    public void deleteByAgreementId(String agreementId) {
         LambdaQueryWrapper<PtlAgreementUnderwritingRules> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(PtlAgreementUnderwritingRules::getAgreementId, agreementId);
         baseMapper.delete(wrapper);
     }
 
     @Override
-    public List<PtlAgreementUnderwritingRules> getByAgreementId(Long agreementId) {
+    public List<PtlAgreementUnderwritingRules> getByAgreementId(String agreementId) {
         LambdaQueryWrapper<PtlAgreementUnderwritingRules> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(PtlAgreementUnderwritingRules::getAgreementId, agreementId);
         return baseMapper.selectList(wrapper);
@@ -41,14 +41,14 @@ public class PtlAgreementUnderwritingRulesServiceImpl extends ServiceImpl<PtlAgr
 
     @Override
     @Transactional
-    public void saveBatchUnderwritingRules(Long agreementId, List<PtlAgreementUnderwritingRulesSaveDto> underwritingRules) {
+    public void saveBatchUnderwritingRules(String agreementId, List<PtlAgreementUnderwritingRulesSaveDto> underwritingRules) {
         List<PtlAgreementUnderwritingRules> ptlAgreementUnderwritingRulesList = PtlAgreementUnderwritingRulesSaveDto.toPtlAgreementUnderwritingRulesList(agreementId, underwritingRules);
         boolean b = saveBatch(ptlAgreementUnderwritingRulesList);
         AssertionUtils.isSucceed(b, "批量添加协议承保规则失败");
     }
 
     @Override
-    public Map<String, PtlFactorDto> getMapPtlFactorDto(Long agreementId, Integer rulesType) {
+    public Map<String, PtlFactorDto> getMapPtlFactorDto(String agreementId, Integer rulesType) {
         LambdaQueryWrapper<PtlAgreementUnderwritingRules> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(PtlAgreementUnderwritingRules::getAgreementId, agreementId)
                 .eq(PtlAgreementUnderwritingRules::getRulesType, rulesType);

+ 13 - 5
src/main/java/com/ydtech/modules/protocol/service/impl/PtlCrawlerApiServiceImpl.java

@@ -4,16 +4,24 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.modules.protocol.dao.PtlCrawlerApiMapper;
 import com.ydtech.modules.protocol.entity.po.PtlCrawlerApi;
 import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
+import com.ydtech.modules.protocol.utils.AssertionUtils;
 import org.springframework.stereotype.Service;
 
 /**
-* @author Administrator
-* @description 针对表【ptl_crawler_api(python对接接口)】的数据库操作Service实现
-* @createDate 2023-07-03 18:10:03
-*/
+ * @author Administrator
+ * @description 针对表【ptl_crawler_api(python对接接口)】的数据库操作Service实现
+ * @createDate 2023-07-03 18:10:03
+ */
 @Service
 public class PtlCrawlerApiServiceImpl extends ServiceImpl<PtlCrawlerApiMapper, PtlCrawlerApi>
-    implements PtlCrawlerApiService {
+        implements PtlCrawlerApiService {
+
+    @Override
+    public String getApiUrl(String agreementId, String crawlerApiType) {
+        String apiUrl = baseMapper.getApiUrl(agreementId, crawlerApiType);
+        AssertionUtils.isStringEmpty(apiUrl, "请求地址未配置");
+        return apiUrl;
+    }
 
 }
 

+ 26 - 7
src/main/java/com/ydtech/modules/protocol/service/impl/PtlInsAttributionTemplateServiceImpl.java

@@ -10,14 +10,18 @@ import com.ydtech.modules.esm.service.EsmInsCompanyService;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.dao.PtlInsAttributionTemplateMapper;
 import com.ydtech.modules.protocol.entity.constants.PtlApiType;
+import com.ydtech.modules.protocol.entity.po.PtlCrawlerApi;
 import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
+import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateVo;
+import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
 import com.ydtech.modules.protocol.service.PtlInsAttributionTemplateService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -32,8 +36,11 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
 
     private final EsmInsCompanyService esmInsCompanyService;
 
-    public PtlInsAttributionTemplateServiceImpl(EsmInsCompanyService esmInsCompanyService) {
+    private final PtlCrawlerApiService ptlCrawlerApiService;
+
+    public PtlInsAttributionTemplateServiceImpl(EsmInsCompanyService esmInsCompanyService, PtlCrawlerApiService ptlCrawlerApiService) {
         this.esmInsCompanyService = esmInsCompanyService;
+        this.ptlCrawlerApiService = ptlCrawlerApiService;
     }
 
     private PtlInsAttributionTemplateService proxyService;
@@ -53,7 +60,7 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
         lambdaQueryWrapper.eq(PtlInsAttributionTemplate::getApiType, ptlInsAttributionTemplateSaveVo.getApiType())
                 .eq(PtlInsAttributionTemplate::getInsCompanyId, ptlInsAttributionTemplateSaveVo.getInsCompanyId());
         List<PtlInsAttributionTemplate> list = list(lambdaQueryWrapper);
-        if (list.size() > 0) {
+        if (!list.isEmpty()) {
             throw new SystemException("一个保险公司,一种api方式只能配置一种");
         }
 
@@ -61,23 +68,25 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
     }
 
     @Override
-
+    @Transactional
     public HttpResult<Object> submit(PtlInsAttributionTemplateSaveVo ptlInsAttributionTemplateSaveVo) {
         // 一个保险公司,一种api方式只能配置一种
         PtlInsAttributionTemplate ptlInsAttributionTemplate = proxyService.getByApiTypeAndInsCompanyId(ptlInsAttributionTemplateSaveVo);
         boolean save = save(ptlInsAttributionTemplate);
+        AssertionUtils.isSucceed(save, "保险公司归属信息模板添加失败");
 
         // 保存请求链接
-        if (PtlApiType.PTL_API_1.getCode() == ptlInsAttributionTemplateSaveVo.getApiType()) {
-            //TODO
+        if (PtlApiType.PTL_API_2.getCode() == ptlInsAttributionTemplateSaveVo.getApiType()) {
+            List<PtlCrawlerApi> ptlCrawlerApiList = PtlCrawlerApi.toPtlCrawlerApiList(ptlInsAttributionTemplate.getId(), ptlInsAttributionTemplateSaveVo.getApi());
+            boolean b = ptlCrawlerApiService.saveBatch(ptlCrawlerApiList);
+            AssertionUtils.isSucceed(b, "保险公司api请求插入失败");
         }
 
-        AssertionUtils.isSucceed(save, "保险公司归属信息模板添加失败");
         return HttpResult.ok("添加成功");
     }
 
     @Override
-    public HttpResult<PtlInsAttributionTemplate> getByIdObtain(Long id) {
+    public HttpResult<PtlInsAttributionTemplate> getByIdObtain(String id) {
         return HttpResult.ok(getById(id));
     }
 
@@ -107,6 +116,16 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
         return HttpResult.ok("修改成功");
     }
 
+    @Override
+    public HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo) {
+        LambdaQueryWrapper<PtlInsAttributionTemplate> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(PtlInsAttributionTemplate::getInsCompanyId, ptlInsAttributionTemplateVo.getInsCompanyId())
+                .eq(PtlInsAttributionTemplate::getApiType, ptlInsAttributionTemplateVo.getApiType());
+        PtlInsAttributionTemplate ptlInsAttributionTemplate = getOne(wrapper);
+        AssertionUtils.isEmpty(ptlInsAttributionTemplateVo, "保险公司归属信息模板查询失败");
+        return HttpResult.ok(ptlInsAttributionTemplate);
+    }
+
 }
 
 

+ 4 - 0
src/main/java/com/ydtech/modules/protocol/utils/AssertionUtils.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.protocol.utils;
 
 import com.ydtech.exception.SystemException;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.util.ObjectUtils;
 
 /**
@@ -32,5 +33,8 @@ public class AssertionUtils {
         assertion(ObjectUtils.isEmpty(o), message);
     }
 
+    public static void isStringEmpty(String s, String message) {
+        assertion(StringUtils.isEmpty(s), message);
+    }
 
 }