Ver código fonte

Revert "1.保险公司判断修改 2.连接池配置修改"

This reverts commit 4df335d4
wks 2 anos atrás
pai
commit
f17c9e744a
18 arquivos alterados com 281 adições e 712 exclusões
  1. 8 11
      src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java
  2. 0 62
      src/main/java/com/ydtech/modules/protocol/controller/PtlSchedulingController.java
  3. 25 42
      src/main/java/com/ydtech/modules/protocol/controller/TaxSourceController.java
  4. 0 18
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementSchedulingConfigMapper.java
  5. 1 14
      src/main/java/com/ydtech/modules/protocol/dao/TaxSourceMapper.java
  6. 0 121
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementSchedulingConfig.java
  7. 0 37
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementSchedulingConfigSaveVo.java
  8. 0 33
      src/main/java/com/ydtech/modules/protocol/entity/vo/QuoteAgreementVo.java
  9. 0 19
      src/main/java/com/ydtech/modules/protocol/entity/vo/SubstituteRecordingAgreementVo.java
  10. 9 32
      src/main/java/com/ydtech/modules/protocol/service/ITaxSourceService.java
  11. 0 37
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementSchedulingConfigService.java
  12. 3 13
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java
  13. 0 53
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementSchedulingConfigServiceImpl.java
  14. 46 41
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java
  15. 182 105
      src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java
  16. 0 19
      src/main/java/com/ydtech/modules/protocol/utils/EnableUtils.java
  17. 0 20
      src/main/resources/mapper/modules/protocol/PtlAgreementSchedulingConfigMapper.xml
  18. 7 35
      src/main/resources/mapper/modules/protocol/TaxSourceMapper.xml

+ 8 - 11
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -34,11 +34,12 @@ import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
 import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
-import com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig;
 import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
-import com.ydtech.modules.protocol.service.*;
+import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
+import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
 import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
-import com.ydtech.modules.protocol.utils.EnableUtils;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.utils.StringUtils;
@@ -68,6 +69,8 @@ public class QuoteVerificationAspect {
 
     private final InsOrdersComponents insOrdersComponents;
 
+    private final TaxSourceServiceImpl taxSourceService;
+
     private final EsmInsCompanyService esmInsCompanyService;
 
     private final InsAreaCompanyService insAreaCompanyService;
@@ -95,8 +98,6 @@ public class QuoteVerificationAspect {
 
     private final PtlAgreementService ptlAgreementService;
 
-    private final PtlAgreementSchedulingConfigService ptlAgreementSchedulingConfigService;
-
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result) {
         //计算费用因子
@@ -150,7 +151,6 @@ public class QuoteVerificationAspect {
                 String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
                 String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
                 String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
-                int systemType = ((BaseQuoteVo<?>) arg).getSystemType();
                 //由于前台未传userid判断不了,从主订单表获取用户id和机构id保证待客录单和录单员录单的信息一致
                 /**
                 String deptId = ((BaseQuoteVo<?>) arg).getDeptId();
@@ -215,15 +215,12 @@ public class QuoteVerificationAspect {
                      //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
                }else{
                     //不在排除部门内进行默认判断
-                    PtlAgreementSchedulingConfig config = ptlAgreementSchedulingConfigService.getByCompanyId(companyId);
-                    boolean enable = EnableUtils.isEnable(systemType, config.getPcStart(), config.getAppStart());
-
-                    if(enable && isExclude){
+                    if(isExclude){
                         //走正常协议判断是错误的   判断是否有默认配置,如果有不可能进来,前台报错
                         List<PtlTaxSourceNew> taxSourceDtoList = ptlTaxSourceNewMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
                                 .eq(PtlTaxSourceNew::getInsCompanyId, companyId)
                                 .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
-                        if(taxSourceDtoList!=null && !taxSourceDtoList.isEmpty()){
+                        if(taxSourceDtoList!=null && taxSourceDtoList.size()>0){
                             //throw new SystemException("配置默认协议且部门未排除应走默认逻辑,操作错误,请联系管理员!!");
                           //强制走默认状态
                             String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);

+ 0 - 62
src/main/java/com/ydtech/modules/protocol/controller/PtlSchedulingController.java

@@ -1,62 +0,0 @@
-package com.ydtech.modules.protocol.controller;
-
-import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.esm.model.EsmInsCompany;
-import com.ydtech.modules.esm.service.EsmInsCompanyService;
-import com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig;
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementSchedulingConfigSaveVo;
-import com.ydtech.modules.protocol.service.PtlAgreementSchedulingConfigService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Arrays;
-
-@Api(tags = "协议调度配置")
-@RestController
-@RequestMapping("/ptl/scheduling")
-@RequiredArgsConstructor
-public class PtlSchedulingController {
-
-    private final PtlAgreementSchedulingConfigService ptlAgreementSchedulingConfigService;
-
-    private final EsmInsCompanyService esmInsCompanyService;
-
-    @PostMapping
-    @ApiOperation("新增/修改 协议调度")
-    public HttpResult<Object> save(@RequestBody PtlAgreementSchedulingConfigSaveVo ptlAgreementSchedulingConfigSaveVo) {
-        ptlAgreementSchedulingConfigService.allocation(ptlAgreementSchedulingConfigSaveVo);
-        return HttpResult.ok("操作成功");
-    }
-
-    @GetMapping("/{companyId}")
-    @ApiOperation("获取配置信息")
-    public HttpResult<PtlAgreementSchedulingConfigSaveVo> get(@PathVariable String companyId) {
-        EsmInsCompany esmInsCompany = esmInsCompanyService.getById(companyId);
-
-        // 空数据加入保险公司
-        PtlAgreementSchedulingConfig ptlAgreementSchedulingConfig = ptlAgreementSchedulingConfigService.getByCompanyId(companyId);
-        if (ObjectUtils.isEmpty(ptlAgreementSchedulingConfig)) {
-            ptlAgreementSchedulingConfig = new PtlAgreementSchedulingConfig();
-            ptlAgreementSchedulingConfig.setCompanyId(esmInsCompany.getId());
-            ptlAgreementSchedulingConfig.setCompanyName(esmInsCompany.getName());
-        }
-
-        // 重新处理数据
-        PtlAgreementSchedulingConfigSaveVo ptlAgreementSchedulingConfigSaveVo = new PtlAgreementSchedulingConfigSaveVo();
-        BeanUtils.copyProperties(ptlAgreementSchedulingConfig, ptlAgreementSchedulingConfigSaveVo);
-
-        if (StringUtils.isNotEmpty(ptlAgreementSchedulingConfig.getProductsCode())) {
-            String[] split = ptlAgreementSchedulingConfig.getProductsCode().split(",");
-            ptlAgreementSchedulingConfigSaveVo.setProductsCode(Arrays.asList(split));
-        }
-
-        return HttpResult.ok(ptlAgreementSchedulingConfigSaveVo);
-    }
-
-
-}

+ 25 - 42
src/main/java/com/ydtech/modules/protocol/controller/TaxSourceController.java

@@ -5,38 +5,30 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.core.page.PageResult;
-import com.ydtech.modules.admin.model.SysUser;
-import com.ydtech.modules.admin.service.SysUserService;
 import com.ydtech.modules.base.controller.BaseController;
-import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
-import com.ydtech.modules.protocol.entity.dto.PtlAgreementSchedulingDto;
-import com.ydtech.modules.protocol.entity.vo.QuoteAgreementVo;
-import com.ydtech.modules.protocol.entity.vo.SubstituteRecordingAgreementVo;
+import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
 import com.ydtech.modules.protocol.service.ITaxSourceService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocol.service.PtlAreaLicenseService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-
-@Api(tags = "协议调度管理")
+@Api(tags = "税源管理")
 @RequestMapping("/tax/manager")
 @RestController
-@RequiredArgsConstructor
 public class TaxSourceController extends BaseController {
+    @Autowired
+    private PtlAreaLicenseService ptlAreaLicenseService;
 
-    private final PtlAreaLicenseService ptlAreaLicenseService;
-
-    private final ITaxSourceService taxSourceService;
+    @Autowired
+    private ITaxSourceService taxSourceService;
 
-    private final PtlAgreementService ptlAgreementService;
+    @Autowired
+    private PtlAgreementService ptlAgreementService;
 
-    private final SysUserService sysUserService;
 
     @GetMapping("/license")
     @ApiOperation("车牌信息")
@@ -47,14 +39,13 @@ public class TaxSourceController extends BaseController {
 
     @GetMapping("/insureCompany")
     @ApiOperation("获取保险公司")
-    public HttpResult<PageResult<PtlAgreementSchedulingDto>> insureCompany(Integer pageNum, Integer pageSize, String companyId) {
+    public HttpResult insureCompany(Integer pageNum,Integer pageSize) {
         PageRequest pageRequest = new PageRequest();
         pageRequest.setPageNum(pageNum);
         pageRequest.setPageSize(pageSize);
-
-        Page<PtlAgreementSchedulingDto> page = PageRequest.buildPageRequest(pageRequest);
-        IPage<PtlAgreementSchedulingDto> insureCompany = taxSourceService.getInsureCompany(page, companyId);
-        PageResult<PtlAgreementSchedulingDto> pageResult = PageResult.buildPageResult(insureCompany);
+        Page page = PageRequest.buildPageRequest(pageRequest);
+        IPage<EsmInsCompany> insureCompany = taxSourceService.getInsureCompany(page);
+        PageResult pageResult = PageResult.buildPageResult(insureCompany);
         return HttpResult.ok(pageResult);
     }
 
@@ -63,29 +54,27 @@ public class TaxSourceController extends BaseController {
     public HttpResult agreement(String companyId) {
         String deptId = getDeptId();
         String userId = getUserId();
-        return HttpResult.ok(taxSourceService.getAgreementByCompanyId(companyId, deptId, userId));
+        return HttpResult.ok(taxSourceService.getAgreementByCompanyId(companyId,deptId,userId));
     }
 
     @GetMapping("/getTaxSource")
     @ApiOperation("获取税源")
-    public HttpResult getTaxSource(String companyId) {
+    public HttpResult getTaxSource(String companyId){
         TaxSourceVo taxSourceVos = taxSourceService.getTaxSource(companyId);
         return HttpResult.ok(taxSourceVos);
     }
 
-    @PostMapping("/getAllAgreement")
-    @ApiOperation("获取保险公司协议列表(车险录单)")
-    public HttpResult<List<PtlAgreementInsCompanyDto>> getAllAgreement(@RequestBody QuoteAgreementVo quoteAgreementVo) {
+    @GetMapping("/getAllAgreement")
+    @ApiOperation("获取所有协议")
+    public HttpResult getAllAgreement(){
         String deptId = getDeptId();
         String userId = getUserId();
-        List<PtlAgreementSchedulingDto> ptlAgreementScheduling = taxSourceService.getPtlAgreementScheduling();
-        List<PtlAgreementInsCompanyDto> allAgreement = taxSourceService.getAllAgreement(deptId, userId, quoteAgreementVo, ptlAgreementScheduling);
-        return HttpResult.ok(allAgreement);
+        return HttpResult.ok(taxSourceService.getAllAgreement(deptId,userId));
     }
 
     @GetMapping("/getExternalAgreement")
     @ApiOperation("获取外部协议")
-    public HttpResult getExternalAgreement() {
+    public HttpResult getExternalAgreement(){
         return HttpResult.ok(ptlAgreementService.getExternalAgreement());
     }
 
@@ -93,18 +82,12 @@ public class TaxSourceController extends BaseController {
     @ApiOperation("保存税源")
     public HttpResult saveTaxSource(@RequestBody TaxSourceVo taxSourceVo) {
         boolean result = taxSourceService.saveTaxSource(taxSourceVo);
-        return result ? HttpResult.ok("保存税源成功") : HttpResult.error("保存税源失败");
+        return result? HttpResult.ok("保存税源成功"):HttpResult.error("保存税源失败");
     }
 
-    @PostMapping("/getAllAgreementByUserId")
-    @ApiOperation("获取保险公司协议列表(代课录单)")
-    public HttpResult<List<PtlAgreementInsCompanyDto>> getAllAgreementByUserId(@RequestBody SubstituteRecordingAgreementVo substituteRecordingAgreementVo) {
-        QuoteAgreementVo quoteAgreementVo = new QuoteAgreementVo();
-        BeanUtils.copyProperties(substituteRecordingAgreementVo, quoteAgreementVo);
-        SysUser user = sysUserService.getById(substituteRecordingAgreementVo.getUserId());
-        List<PtlAgreementSchedulingDto> ptlAgreementScheduling = taxSourceService.getPtlAgreementScheduling();
-        List<PtlAgreementInsCompanyDto> allAgreement = taxSourceService.getAllAgreement(user.getDeptId(), user.getId(), quoteAgreementVo, ptlAgreementScheduling);
-        return HttpResult.ok(allAgreement);
+    @GetMapping("/getAllAgreementByUserId")
+    @ApiOperation("通过用户id获取所有协议")
+    public HttpResult getAllAgreementByUserId(String userId){
+        return HttpResult.ok(taxSourceService.getAllAgreementByUserId(userId));
     }
-
 }

+ 0 - 18
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementSchedulingConfigMapper.java

@@ -1,18 +0,0 @@
-package com.ydtech.modules.protocol.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig;
-
-/**
-* @author Administrator
-* @description 针对表【ptl_agreement_scheduling_config(协议调度配置(过滤保险公司))】的数据库操作Mapper
-* @createDate 2024-07-22 11:32:12
-* @Entity com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig
-*/
-public interface PtlAgreementSchedulingConfigMapper extends BaseMapper<PtlAgreementSchedulingConfig> {
-
-}
-
-
-
-

+ 1 - 14
src/main/java/com/ydtech/modules/protocol/dao/TaxSourceMapper.java

@@ -5,30 +5,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.modules.esm.model.EsmInsCompany;
-import com.ydtech.modules.protocol.entity.dto.PtlAgreementSchedulingDto;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 @Mapper
 public interface TaxSourceMapper extends BaseMapper<TaxSourceDto> {
 
-    /**
-     * 获取协议调度保险公司
-     *
-     * @param page 分页信息
-     * @return 协议调度保险公司列表
-     */
-    IPage<PtlAgreementSchedulingDto> getInsureCompany(Page<PtlAgreementSchedulingDto> page, @Param("companyId") String companyId);
+    IPage<EsmInsCompany> getInsureCompany(Page page);
 
     List<PtlAgreement> getAgreementByCompanyId(String companyId);
 
-    /**
-     * 获取全部协议调度保险公司
-     * @return 协议调度保险公司列表
-     */
-    List<PtlAgreementSchedulingDto> getPtlAgreementScheduling();
 }

+ 0 - 121
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementSchedulingConfig.java

@@ -1,121 +0,0 @@
-package com.ydtech.modules.protocol.entity.po;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import java.io.Serializable;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.apache.commons.lang3.ObjectUtils;
-
-/**
- * 协议调度配置(过滤保险公司)
- *
- * @TableName ptl_agreement_scheduling_config
- */
-@TableName(value = "ptl_agreement_scheduling_config")
-@Data
-@ApiModel("协议调度配置")
-public class PtlAgreementSchedulingConfig implements Serializable {
-
-    /**
-     * 主键 id
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
-
-    /**
-     * 保险公司id
-     */
-    @TableField(value = "company_id")
-    private String companyId;
-
-    /**
-     * 保险公司名称
-     */
-    @TableField(value = "company_name")
-    private String companyName;
-
-    /**
-     * APP是否启动(0不启动 1启动)
-     */
-    @TableField(value = "app_start")
-    private Integer appStart;
-
-    /**
-     * PC是否启动(0不启动 1启动)
-     */
-    @TableField(value = "pc_start")
-    private Integer pcStart;
-
-    /**
-     * 单交0330、单商034001、单三034002、交三0330034002、交商0330034001
-     */
-    @TableField(value = "products_code")
-    private String productsCode;
-
-    @TableField(exist = false)
-    private static final long serialVersionUID = 1L;
-
-    public Integer getAppStart() {
-        return appStart == null ? 0 : appStart;
-    }
-
-    public Integer getPcStart() {
-        return pcStart == null ? 0 : pcStart;
-    }
-
-    @Override
-    public boolean equals(Object that) {
-        if (this == that) {
-            return true;
-        }
-        if (that == null) {
-            return false;
-        }
-        if (getClass() != that.getClass()) {
-            return false;
-        }
-        PtlAgreementSchedulingConfig other = (PtlAgreementSchedulingConfig) that;
-        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
-                && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
-                && (this.getCompanyName() == null ? other.getCompanyName() == null : this.getCompanyName().equals(other.getCompanyName()))
-                && (this.getAppStart() == null ? other.getAppStart() == null : this.getAppStart().equals(other.getAppStart()))
-                && (this.getPcStart() == null ? other.getPcStart() == null : this.getPcStart().equals(other.getPcStart()))
-                && (this.getProductsCode() == null ? other.getProductsCode() == null : this.getProductsCode().equals(other.getProductsCode()));
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
-        result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
-        result = prime * result + ((getCompanyName() == null) ? 0 : getCompanyName().hashCode());
-        result = prime * result + ((getAppStart() == null) ? 0 : getAppStart().hashCode());
-        result = prime * result + ((getPcStart() == null) ? 0 : getPcStart().hashCode());
-        result = prime * result + ((getProductsCode() == null) ? 0 : getProductsCode().hashCode());
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getClass().getSimpleName());
-        sb.append(" [");
-        sb.append("Hash = ").append(hashCode());
-        sb.append(", id=").append(id);
-        sb.append(", companyId=").append(companyId);
-        sb.append(", companyName=").append(companyName);
-        sb.append(", appStart=").append(appStart);
-        sb.append(", pcStart=").append(pcStart);
-        sb.append(", productsCode=").append(productsCode);
-        sb.append(", serialVersionUID=").append(serialVersionUID);
-        sb.append("]");
-        return sb.toString();
-    }
-}

+ 0 - 37
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementSchedulingConfigSaveVo.java

@@ -1,37 +0,0 @@
-package com.ydtech.modules.protocol.entity.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@ApiModel("配置信息")
-public class PtlAgreementSchedulingConfigSaveVo {
-
-    @ApiModelProperty("主键id")
-    private Integer id;
-
-    @ApiModelProperty("保险公司id")
-    private String companyId;
-
-    @ApiModelProperty("保险公司名称")
-    private String companyName;
-
-    @ApiModelProperty("APP是否启动(0不启动 1启动)")
-    private Integer appStart;
-
-    @ApiModelProperty("PC是否启动(0不启动 1启动)")
-    private Integer pcStart;
-
-    @ApiModelProperty("单交0330、单商034001、单三034002、交三0330034002、交商0330034001")
-    private List<String> productsCode;
-
-
-}

+ 0 - 33
src/main/java/com/ydtech/modules/protocol/entity/vo/QuoteAgreementVo.java

@@ -1,33 +0,0 @@
-package com.ydtech.modules.protocol.entity.vo;
-
-
-import com.ydtech.modules.ins.model.vo.KindInfoVo;
-import com.ydtech.modules.ins.model.vo.RiskInfoVo;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serializable;
-import java.util.List;
-
-
-@Data
-@ApiModel("车险录单协议获取实体")
-@AllArgsConstructor
-@NoArgsConstructor
-public class QuoteAgreementVo implements Serializable {
-
-    private static final long serialVersionUID = -3246967636374112126L;
-
-    @ApiModelProperty("系统类型 1 pc 2 app")
-    private int systemType;
-
-    @ApiModelProperty("险种列表")
-    private List<RiskInfoVo> riskList;
-
-    @ApiModelProperty("商业险险种列表")
-    private List<KindInfoVo> kindList;
-
-}

+ 0 - 19
src/main/java/com/ydtech/modules/protocol/entity/vo/SubstituteRecordingAgreementVo.java

@@ -1,19 +0,0 @@
-package com.ydtech.modules.protocol.entity.vo;
-
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-
-@NoArgsConstructor
-@EqualsAndHashCode(callSuper = true)
-@AllArgsConstructor
-@Data
-public class SubstituteRecordingAgreementVo extends QuoteAgreementVo{
-
-    private static final long serialVersionUID = 7564602257117457870L;
-
-    private String userId;
-
-}

+ 9 - 32
src/main/java/com/ydtech/modules/protocol/service/ITaxSourceService.java

@@ -5,30 +5,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
-import com.ydtech.modules.protocol.entity.dto.PtlAgreementSchedulingDto;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
-import com.ydtech.modules.protocol.entity.vo.QuoteAgreementVo;
-import com.ydtech.modules.protocol.entity.vo.SubstituteRecordingAgreementVo;
 import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
 
 import java.util.List;
 
 public interface ITaxSourceService extends IService<TaxSourceDto> {
 
-    /**
-     * 协议调度获取保险公司列表
-     * @param page 分页信息
-     * @return 分页结果
-     */
-    IPage<PtlAgreementSchedulingDto> getInsureCompany(Page<PtlAgreementSchedulingDto> page, String companyId);
-
-    /**
-     * 协议调度获取全部保险公司列表
-     * @return
-     */
-    List<PtlAgreementSchedulingDto> getPtlAgreementScheduling();
-
+    IPage<EsmInsCompany> getInsureCompany(Page page);
 
     List<PtlAgreement> getAgreementByCompanyId(String companyId,String deptId,String userId);
 
@@ -37,22 +22,14 @@ public interface ITaxSourceService extends IService<TaxSourceDto> {
     TaxSourceVo getTaxSource(String companyId);
 //    List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId,String license,String volume);
 
-    /**
-     * 车险录单获取保险公司协议
-     * @param deptId 机构id
-     * @param userId 用户id
-     * @param quoteAgreementVo 险种信息
-     * @return 协议列表
-     */
-    List<PtlAgreementInsCompanyDto> getAllAgreement(String deptId, String userId, QuoteAgreementVo quoteAgreementVo, List<PtlAgreementSchedulingDto> ptlAgreementScheduling);
+    List<PtlAgreementInsCompanyDto> getAllAgreement(String deptId, String userId);
 
     String getAgreementId(String deptId, String userId, String companyId, String license, String volume, String productid);
-
-//    /**
-//     *  @version
-//     *  @author: hxl
-//     *  @Date: 2024/4/18 10:17
-//     *  @Description: 通过用户id查询关联的协议
-//     */
-//    List<PtlAgreementInsCompanyDto> getAllAgreementByUserId(SubstituteRecordingAgreementVo quoteAgreementVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/18 10:17
+     *  @Description: 通过用户id查询关联的协议
+     */
+    List<PtlAgreementInsCompanyDto> getAllAgreementByUserId(String userId);
 }

+ 0 - 37
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementSchedulingConfigService.java

@@ -1,37 +0,0 @@
-package com.ydtech.modules.protocol.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig;
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementSchedulingConfigSaveVo;
-
-import java.util.List;
-
-/**
- * @author wks
- * @description 针对表【ptl_agreement_scheduling_config(协议调度配置(过滤保险公司))】的数据库操作Service
- * @createDate 2024-07-22 11:32:12
- */
-public interface PtlAgreementSchedulingConfigService extends IService<PtlAgreementSchedulingConfig> {
-
-    /**
-     * 新增协议调度配置信息
-     *
-     * @param ptlAgreementSchedulingConfigSaveVo 调度协议配置信息
-     * @return 成功 失败
-     */
-    void allocation(PtlAgreementSchedulingConfigSaveVo ptlAgreementSchedulingConfigSaveVo);
-
-    /**
-     * 通过保险公司id获取配置信息
-     * @param companyId 保险公司id
-     * @return 配置信息
-     */
-    default PtlAgreementSchedulingConfig getByCompanyId(String companyId) {
-        return lambdaQuery()
-                .eq(PtlAgreementSchedulingConfig::getCompanyId, companyId)
-                .one();
-
-    }
-
-
-}

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

@@ -2,7 +2,6 @@ package com.ydtech.modules.protocol.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.esm.model.EsmInsCompany;
@@ -16,7 +15,6 @@ import com.ydtech.modules.protocol.entity.vo.*;
 
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * @author wenks
@@ -32,7 +30,6 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      */
     List<PtlAgreementInsCompanyDto> getAgreementCompany(String deptId);
 
-
     /**
      * 获取可以报价的 可录入外部订单的协议
      *
@@ -41,6 +38,9 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      */
     List<PtlAgreementInsCompanyDto> getAgreementCompanyExternal(String deptId);
 
+    PtlAgreementInsCompanyDto getAgreementCompany(String deptId, String companyId);
+
+
     /**
      * 通过协议id 判断是否存在
      *
@@ -269,14 +269,4 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      */
     List<PtlAgreement> getAllAgreement(String agreementId);
 
-    /**
-     * 获取保险公司
-     *
-     * @param deptId       机构id
-     * @param companyMap  保险公司列表
-     * @param productsType 险种信息
-     * @return
-     */
-    List<PtlAgreementInsCompanyDto> getAgreementCompany(String deptId, Map<String, Boolean> companyMap, ProductsType productsType);
-
 }

+ 0 - 53
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementSchedulingConfigServiceImpl.java

@@ -1,53 +0,0 @@
-package com.ydtech.modules.protocol.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ydtech.modules.protocol.dao.PtlAgreementSchedulingConfigMapper;
-import com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig;
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementSchedulingConfigSaveVo;
-import com.ydtech.modules.protocol.service.PtlAgreementSchedulingConfigService;
-import com.ydtech.modules.protocol.utils.AssertionUtils;
-import org.apache.commons.lang3.ObjectUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * @author wks
- * @description 针对表【ptl_agreement_scheduling_config(协议调度配置(过滤保险公司))】的数据库操作Service实现
- * @createDate 2024-07-22 11:32:12
- */
-@Service
-public class PtlAgreementSchedulingConfigServiceImpl extends ServiceImpl<PtlAgreementSchedulingConfigMapper, PtlAgreementSchedulingConfig>
-        implements PtlAgreementSchedulingConfigService {
-
-    @Override
-    public void allocation(PtlAgreementSchedulingConfigSaveVo ptlAgreementSchedulingConfigSaveVo) {
-        // 拼接字符串
-        PtlAgreementSchedulingConfig ptlAgreementSchedulingConfig = new PtlAgreementSchedulingConfig();
-        BeanUtils.copyProperties(ptlAgreementSchedulingConfigSaveVo, ptlAgreementSchedulingConfig);
-        List<String> productsCode = ptlAgreementSchedulingConfigSaveVo.getProductsCode();
-        String s = String.join(",", productsCode);
-        ptlAgreementSchedulingConfig.setProductsCode(s);
-
-        // 修改
-        Integer id = ptlAgreementSchedulingConfig.getId();
-        if (ObjectUtils.isNotEmpty(id)) {
-            int updateResult = this.baseMapper.updateById(ptlAgreementSchedulingConfig);
-            AssertionUtils.isSucceed(updateResult > 0, "修改配置失败");
-        } else {
-            // 新增
-            PtlAgreementSchedulingConfig config = this.getByCompanyId(ptlAgreementSchedulingConfig.getCompanyId());
-            AssertionUtils.isNotEmpty(config, "修改配置失败");
-            int insertResult = this.baseMapper.insert(ptlAgreementSchedulingConfig);
-            AssertionUtils.isSucceed(insertResult > 0, "新增配置失败");
-        }
-
-    }
-
-}
-
-
-
-

+ 46 - 41
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.config.DictEnumConfig;
 import com.ydtech.constants.enums.dict.DictionaryData;
 import com.ydtech.constants.enums.dict.DictionaryManagement;
-import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
@@ -31,10 +30,11 @@ import com.ydtech.utils.idgen.IdGenerate;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.beans.factory.annotation.Value;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -78,13 +78,18 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
     private final PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService;
 
-    private final PtlAgreementDeptHistoryService ptlAgreementDeptHistoryService;
+    @Autowired
+    private PtlAgreementDeptHistoryService ptlAgreementDeptHistoryService;
+
+
+    @Autowired
+    private PtlAgreementMapper ptlAgreementMapper;
 
-    private final PtlAgreementMapper ptlAgreementMapper;
 
     @Value("${python.check}")
     private String pythonCheck;
 
+
     public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService,
                                    PtlAgreementAttributionService ptlAgreementAttributionService,
                                    PtlAgreementDeptService ptlAgreementDeptService,
@@ -96,7 +101,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
                                    PtlAgreementHistoryService ptlAgreementHistoryService,
                                    PtlAgreementProductCostsHistoryService ptlAgreementProductCostsHistoryService,
                                    PtlAgreementUndwrtRulesHistoryService ptlAgreementUndwrtRulesHistoryService,
-                                   PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService, PtlAgreementDeptHistoryService ptlAgreementDeptHistoryService, PtlAgreementMapper ptlAgreementMapper) {
+                                   PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService) {
         this.ptlAgreementProductCostsService = ptlAgreementProductCostsService;
         this.ptlAgreementAttributionService = ptlAgreementAttributionService;
         this.ptlAgreementDeptService = ptlAgreementDeptService;
@@ -110,8 +115,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         this.ptlAgreementProductCostsHistoryService = ptlAgreementProductCostsHistoryService;
         this.ptlAgreementUndwrtRulesHistoryService = ptlAgreementUndwrtRulesHistoryService;
         this.ptlAgreementAttributionHistoryService = ptlAgreementAttributionHistoryService;
-        this.ptlAgreementDeptHistoryService = ptlAgreementDeptHistoryService;
-        this.ptlAgreementMapper = ptlAgreementMapper;
     }
 
 
@@ -130,6 +133,16 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
             }
         }
 
+        List<String> agreementIdList = agreementCompany.stream()
+                .flatMap(x -> x.getAgreement().stream().map(PtlAgreementDto::getId))
+                .collect(Collectors.toList());
+
+        /*Map<String, List<String>> licenseNoList = ptlAgreementUndwrtRulesService.getByLicenseNo(agreementIdList);
+
+        agreementCompany.forEach(
+                x -> x.getAgreement().forEach(a -> a.setLicenseNo(licenseNoList.get(a.getId())))
+        );*/
+
         return agreementCompany;
     }
 
@@ -141,13 +154,31 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         for (PtlAgreementInsCompanyDto ptlAgreementInsCompanyDto : agreementCompany) {
             List<PtlAgreementDto> agreement = ptlAgreementInsCompanyDto.getAgreement();
             for (PtlAgreementDto ptlAgreementDto : agreement) {
-                if (ptlAgreementDto.getProductsCode() != null && !ptlAgreementDto.getProductsCode().isEmpty()) {
+                if (ptlAgreementDto.getProductsCode() != null && !ptlAgreementDto.getProductsCode().equals("")) {
                     String[] split = ptlAgreementDto.getProductsCode().split(",");
                     ptlAgreementDto.setProductsCodes(split);
                 }
             }
         }
 
+        List<String> agreementIdList = agreementCompany.stream()
+                .flatMap(x -> x.getAgreement().stream().map(PtlAgreementDto::getId))
+                .collect(Collectors.toList());
+
+        /*Map<String, List<String>> licenseNoList = ptlAgreementUndwrtRulesService.getByLicenseNo(agreementIdList);
+
+        agreementCompany.forEach(
+                x -> x.getAgreement().forEach(a -> a.setLicenseNo(licenseNoList.get(a.getId())))
+        );*/
+
+        return agreementCompany;
+    }
+
+
+    @Override
+    public PtlAgreementInsCompanyDto getAgreementCompany(String deptId, String companyId) {
+        LocalDate localDate = LocalDate.now();
+        PtlAgreementInsCompanyDto agreementCompany = baseMapper.getAgreementCompanyByCompanyId(localDate, deptId, companyId);
         return agreementCompany;
     }
 
@@ -279,14 +310,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Transactional
     public HttpResult<Object> saveAgreementNonCarProductCosts(PtlAgreementNonVehicleProductCostsVo agreement, String userName) {
         //同步刷新其他协议非车产品费用信息(有待同步协议时,进行同步)
-        if (agreement.getSyncAgreementIds() != null && !agreement.getSyncAgreementIds().isEmpty()) {
+        if (agreement.getSyncAgreementIds() != null && agreement.getSyncAgreementIds().size() > 0) {
             for (int i = 0; i < agreement.getSyncAgreementIds().size(); i++) {
                 String tempAgreementId = agreement.getSyncAgreementIds().get(i);
                 PtlAgreement destAgreement = getById(tempAgreementId);
                 //根据归属保司,找出本级和上级 所有产品代码
                 //先获取相关保险公司列表
                 String companyId = destAgreement.getPartnerCompaniesId();
-                if (destAgreement.getAssociationCompaniesId() != null && !destAgreement.getAssociationCompaniesId().isEmpty()) {
+                if (destAgreement.getAssociationCompaniesId() != null && !"".equals(destAgreement.getAssociationCompaniesId())) {
                     companyId = destAgreement.getAssociationCompaniesId();
                 }
                 List<String> companyIdList = esmInsCompanyService.getAllRelationCompanyId(companyId);
@@ -523,12 +554,11 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         boolean b = removeById(agreementId);
         AssertionUtils.isSucceed(b, "协议信息删除失败");
         // 关联表删除
-        // proxyObject.deleteAssociationInformation(agreementId);
+        proxyObject.deleteAssociationInformation(agreementId);
         // 添加 历史记录表
         //生成批次号
         String batchNo = IdGenerate.nextId();
         List<PtlAgreementDept> dept = byAgreementId.getData().getDept();
-
         ArrayList<PtlAgreementDeptHistory> histories = new ArrayList<>();
         for (PtlAgreementDept ptlAgreementDept : dept) {
             PtlAgreementDeptHistory deptHistory = new PtlAgreementDeptHistory();
@@ -537,7 +567,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
             deptHistory.setBatch(batchNo);
         }
         ptlAgreementDeptHistoryService.saveBatch(histories);
-
         PtlAgreementHistory ptlAgreementHistory = new PtlAgreementHistory(batchNo, userName, HistoryStatusConstants.HISTORY_TYPE_ADD,
                 byAgreementId.getData().getAgreement());
         ptlAgreementHistory.setStartDate(byAgreementId.getData().getAgreement().getStartDate().format(DateTimeFormatter.ofPattern("yyyy" +
@@ -548,7 +577,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreementHistory.setId(IdGenerate.nextId());
         ptlAgreementHistory.setOperatorType("delete");
         ptlAgreementHistoryService.saveAgreementHistory(ptlAgreementHistory);
-
         PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, agreementId,
                 byAgreementId.getData().getAgreement().getInsuranceCompanyId(),
                 byAgreementId.getData().getAgreement().getInsuranceCompany(),
@@ -558,7 +586,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         if (StringUtils.isNotEmpty(ptlAgreementAttributionHistory.getTemplateId())) {
             ptlAgreementAttributionHistoryService.save(ptlAgreementAttributionHistory);
         }
-
         return HttpResult.ok("删除成功");
     }
 
@@ -682,13 +709,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     public HttpResult<List<PtlAgreementNonCarProductCostsVo>> getNonCarCostsInfo(String agreementId, String companyId) {
         List<PtlAgreementNonCarProductCostsVo> result = new ArrayList<>();
         //先根据传过来的保险公司代码,找上下级所有机构层级对应的非车产品列表
-        if (companyId != null && !companyId.isEmpty()) {
+        if (companyId != null && !"".equals(companyId)) {
             //先获取相关保险公司列表
             List<String> companyIdList = esmInsCompanyService.getAllRelationCompanyId(companyId);
             //再根据保险公司列表获取所有非车产品列表
             List<PtlNonCarInsuranceProduct> productList = ptlNonCarInsuranceProductService.findProductListByCompangIds(companyIdList);
-            if (productList != null && !productList.isEmpty()) {
-                for (PtlNonCarInsuranceProduct tempProductDto : productList) {
+            if (productList != null && productList.size() > 0) {
+                for (int i = 0; i < productList.size(); i++) {
+                    PtlNonCarInsuranceProduct tempProductDto = productList.get(i);
                     PtlAgreementNonCarProductCostsVo costsVo = new PtlAgreementNonCarProductCostsVo();
                     costsVo.setProductId(tempProductDto.getProductCode());
                     costsVo.setProductName(tempProductDto.getProductName());
@@ -850,27 +878,4 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
                 .eq(PtlAgreement::getInsuranceCompanyId, ptlAgreement.getInsuranceCompanyId()));
     }
 
-    @Override
-    public List<PtlAgreementInsCompanyDto> getAgreementCompany(String deptId, Map<String, Boolean> companyMap, ProductsType productsType) {
-        LocalDate localDate = LocalDate.now();
-        List<PtlAgreementInsCompanyDto> agreementCompany = baseMapper.getAgreementCompany(localDate, deptId);
-        return agreementCompany.stream()
-                // 过滤协议
-                .peek(x -> {
-                    if (companyMap.get(x.getId()) != null && companyMap.get(x.getId())) {
-                        List<PtlAgreementDto> agreementDtoList = x.getAgreement().stream().filter(agreement -> {
-                            if (ObjectUtils.isNotEmpty(productsType) && StringUtils.isNotEmpty(agreement.getProductsCode())) {
-                                String[] split = agreement.getProductsCode().split(",");
-                                return Arrays.stream(split).anyMatch(element -> productsType.getCode().equals(element));
-                            }
-                            return false;
-                        }).collect(Collectors.toList());
-                        x.setAgreement(agreementDtoList);
-                    }
-                })
-                // 过滤保险公司
-                .filter(x -> companyMap.get(x.getId()) != null && companyMap.get(x.getId()) && x.getAgreement() != null && !x.getAgreement().isEmpty())
-                .collect(Collectors.toList());
-
-    }
 }

+ 182 - 105
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -5,60 +5,70 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ydtech.constants.enums.InsuranceRisk;
-import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.constants.sys.SystemConstant;
 import com.ydtech.modules.admin.constants.RoleConstants;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.SysUserRole;
 import com.ydtech.modules.admin.service.SysUserRoleService;
 import com.ydtech.modules.admin.service.SysUserService;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
+import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
 import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
 import com.ydtech.modules.protocol.dao.TaxSourceMapper;
-import com.ydtech.modules.protocol.entity.dto.*;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
+import com.ydtech.modules.protocol.entity.dto.TaxSourceDto;
+import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
-import com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig;
 import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
-import com.ydtech.modules.protocol.entity.vo.QuoteAgreementVo;
-import com.ydtech.modules.protocol.entity.vo.SubstituteRecordingAgreementVo;
 import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
 import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
 import com.ydtech.modules.protocol.service.ITaxSourceService;
-import com.ydtech.modules.protocol.service.PtlAgreementSchedulingConfigService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
-import com.ydtech.modules.protocol.utils.EnableUtils;
 import com.ydtech.utils.idgen.IdGenerate;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import java.util.stream.Collectors;
 
 @Service
-@RequiredArgsConstructor
 public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSourceDto> implements ITaxSourceService {
 
-    private final PtlAgreementService ptlAgreementService;
+    @Autowired
+    PtlAgreementService ptlAgreementService;
 
-    private final ITaxSourceExcludeService taxSourceExcludeService;
+    @Autowired
+    ITaxSourceExcludeService taxSourceExcludeService;
+
+    @Autowired
+    InsOrdersService insOrdersService;
+
+    @Autowired
+    SysUserRoleService sysUserRoleService;
+
+    @Autowired
+    EsmInsCompanyService esmInsCompanyService;
+
+    @Autowired
+    SysUserService sysUserService;
+
+    @Autowired
+    private PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
 
-    private final SysUserRoleService sysUserRoleService;
 
-    private final PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
 
-    @Override
-    public IPage<PtlAgreementSchedulingDto> getInsureCompany(Page<PtlAgreementSchedulingDto> page, String companyId) {
-        return baseMapper.getInsureCompany(page, companyId);
-    }
 
     @Override
-    public List<PtlAgreementSchedulingDto> getPtlAgreementScheduling() {
-        return baseMapper.getPtlAgreementScheduling();
+    public IPage<EsmInsCompany> getInsureCompany(Page page) {
+        return baseMapper.getInsureCompany(page);
     }
 
     @Override
@@ -188,7 +198,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
         // 领导标志
         SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
 
-        if (userRole != null && Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString()) && !RoleConstants.R21.getCode().equals(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
+        if (userRole!=null && Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString()) && !RoleConstants.R21.getCode().equals(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
             deptId = null;
         }
 
@@ -196,6 +206,95 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
         return agreementCompany;
     }
 
+    public PtlAgreementInsCompanyDto getAgreementInsCompany(String deptId, String userId, String companyId) {
+        // 领导标志
+        SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
+
+        if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString()) && !RoleConstants.R21.getCode().equals(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
+            deptId = null;
+        }
+
+        PtlAgreementInsCompanyDto agreementCompany = ptlAgreementService.getAgreementCompany(deptId, companyId);
+        return agreementCompany;
+    }
+
+//    @Override
+//    public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId, String license,
+//    String volume) {
+//        //查出所有协议
+//        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
+//        if(license != null && volume != null) {
+//            //排除的部门信息
+//            List<TaxSourceExcludeDto> excludeDepts = taxSourceExcludeService.list(new
+//            LambdaQueryWrapper<TaxSourceExcludeDto>().eq
+//            (TaxSourceExcludeDto::getExcludeInfo, deptId)
+//                    .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+//
+//            agreementInsCompany.forEach(item ->
+//                    excludeDepts.stream()
+//                            .filter(taxSourceDto -> item.getId().equals(taxSourceDto.getInsCompanyId()) &&
+//                            taxSourceDto.getExcludeInfo
+//                            ().equals(deptId))
+//                            .findFirst()
+//                            .ifPresent(taxSourceDto -> item.setIsExclude(TaxSourceStatusConstants.TAX_SOURCE_START))
+//            );
+//            //查找排除的车牌号
+//            List<TaxSourceExcludeDto> licenseExclude = taxSourceExcludeService.list(new
+//            LambdaQueryWrapper<TaxSourceExcludeDto>().eq
+//            (TaxSourceExcludeDto::getExcludeInfo, license)
+//                    .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
+//            agreementInsCompany.forEach(item -> {
+//                licenseExclude.forEach(taxSourceDto -> {
+//                    if (item.getId().equals(taxSourceDto.getInsCompanyId())) {
+//                        if (license.equals(taxSourceDto.getExcludeInfo())) {
+//                            //排除
+//                            item.setIsExclude(TaxSourceStatusConstants.TAX_SOURCE_START);
+//                        }
+//                    }
+//                });
+//            });
+//
+//            //查找配置的默认项
+//            List<TaxSourceDto> taxSourceDefaultDtos = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>()
+//                    .eq(TaxSourceDto::getLicense, license));
+//            //设置协议的默认项
+//            agreementInsCompany.forEach(item -> {
+//                taxSourceDefaultDtos.forEach(taxSourceDto -> {
+//                    if (item.getId().equals(taxSourceDto.getInsCompanyId())) {
+//                        item.getAgreement().forEach(agreement -> {
+//                            if (agreement.getId().equals(taxSourceDto.getAgreementId())) {
+//                                agreement.setIsAllocation(TaxSourceStatusConstants.TAX_SOURCE_START);
+//                            }
+//                        });
+//                    }
+//                });
+//            });
+//            //判断汽车排量是否大于1升
+//            if (Float.parseFloat(volume) >= 1) {
+//                //查找是否配置税源
+//                List<TaxSourceDto> taxSourceDtos = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq
+//                (TaxSourceDto::getIsTaxSource, "1"));
+//                //设置税源参数
+//                agreementInsCompany.forEach(item -> {
+//                    if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
+//                        taxSourceDtos.forEach(taxSourceDto -> {
+//                            if (item.getId().equals(taxSourceDto.getInsCompanyId())) {
+//                                item.getAgreement().forEach(agreement -> {
+//                                    if (agreement.getId().equals(taxSourceDto.getAgreementId())) {
+//                                        agreement.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
+//                                        item.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
+//                                        item.setTaxSourceAgreementId(taxSourceDto.getAgreementId());
+//                                    }
+//                                });
+//                            }
+//                        });
+//                    }
+//                });
+//            }
+//        }
+//        return agreementInsCompany;
+//    }
+
     /**
      * 返回是否是税源
      *
@@ -204,53 +303,34 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
      * @return
      */
     @Override
-    public List<PtlAgreementInsCompanyDto> getAllAgreement(String deptId, String userId, QuoteAgreementVo quoteAgreementVo, List<PtlAgreementSchedulingDto> ptlAgreementScheduling) {
-
-        // 获取险种配置信息
-        ProductsType productsType = InsuranceRisk.determineInsuranceInformation(quoteAgreementVo.getKindList(), quoteAgreementVo.getRiskList());
-
-        // 险种过滤map
-        Map<String, Boolean> collectMap = ptlAgreementScheduling.stream().collect(
-                Collectors.toMap(PtlAgreementSchedulingDto::getId, x -> {
-                    if (ObjectUtils.isNotEmpty(productsType) && StringUtils.isNotEmpty(x.getProductsCode())) {
-                        String[] split = x.getProductsCode().split(",");
-                        return Arrays.stream(split).anyMatch(element -> productsType.getCode().equals(element));
-                    }
-                    return false;
-                }));
-
+    public List<PtlAgreementInsCompanyDto> getAllAgreement(String deptId, String userId) {
         //查出所有协议
-        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId, collectMap, productsType);
-        List<PtlTaxSourceNew> taxSourceDtos = ptlTaxSourceNewMapper.findDefaultAllAttrLink();
-
-        // 默认协议的协议编码
-        Map<String, String> map = taxSourceDtos.stream()
-                .collect(Collectors.toMap(PtlTaxSourceNew::getInsCompanyId, PtlTaxSourceNew::getAgreementId));
-
-        // 是否启用Map
-        Map<String, Boolean> systemTypeMap = ptlAgreementScheduling.stream().collect(
-                Collectors.toMap(PtlAgreementSchedulingDto::getId, x -> EnableUtils.isEnable(quoteAgreementVo.getSystemType(), x.getPcStart(), x.getAppStart())));
+        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
 
-        //设置协议调度
-        return agreementInsCompany.stream().peek(item -> {
-            String agreementId = map.get(item.getId());
-            if (systemTypeMap.get(item.getId()) != null && systemTypeMap.get(item.getId()) && StringUtils.isNotEmpty(agreementId)) {
-                item.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
-                item.setTaxSourceAgreementId(agreementId);
+        //查找是否配置税源    原逻辑注释掉
+        //List<TaxSourceDto> taxSourceDtos =
+        //        baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
+        //修改协议的默认   add by hxl   2024-05-27
+        List<PtlTaxSourceNew> taxSourceDtos = ptlTaxSourceNewMapper.findDefaultAllAttrLink();
+        //设置税源参数
+        agreementInsCompany.forEach(item -> {
+            if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
+                taxSourceDtos.forEach(taxSourceDto -> {
+                    if (item.getId().equals(taxSourceDto.getInsCompanyId())) {
+                        item.getAgreement().forEach(agreement -> {
+                            if (agreement.getId().equals(taxSourceDto.getAgreementId())) {
+                                agreement.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
+                                item.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
+                                item.setTaxSourceAgreementId(taxSourceDto.getAgreementId());
+                            }
+                        });
+                    }
+                });
             }
-        }).collect(Collectors.toList());
-    }
-
-    private List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId, Map<String, Boolean> companyMap, ProductsType productsType) {
-        // 领导标志
-        SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
-        if (userRole != null && Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString()) && !RoleConstants.R21.getCode().equals(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
-            deptId = null;
-        }
-        return ptlAgreementService.getAgreementCompany(deptId, companyMap, productsType);
+        });
+        return agreementInsCompany;
     }
 
-
     /**
      * 根据税源获取协议id
      *
@@ -273,7 +353,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
                 baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
                         companyId));
 
-        if (taxSourceDtoList.isEmpty()) {
+        if(taxSourceDtoList.isEmpty()){
             return resultId;
         }
 
@@ -305,7 +385,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
         // 税源
         List<TaxSourceDto> collect = taxSourceDtoList.stream().filter(x -> x.getIsTaxSource().equals("1")).collect(Collectors.toList());
         TaxSourceDto taxSourceDtos = null;
-        if (!collect.isEmpty()) {
+        if(!collect.isEmpty()){
             taxSourceDtos = collect.get(0);
         }
 
@@ -317,49 +397,46 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
 
         // 不包含险种 随机其他保险公司
 
-        if (taxSourceDtos != null && taxSourceDtos.getAgreementId().equals(resultId) && taxSourceDtos.getInsuranceRepertoire().contains(productid + ",")) {
+        if (taxSourceDtos != null && taxSourceDtos.getAgreementId().equals(resultId) && taxSourceDtos.getInsuranceRepertoire().contains(productid+",")) {
             resultId = taxSourceDtos.getBanishAgreementId();
         }
 
         return resultId;
     }
-
-//    /**
-//     * @version
-//     * @author: hxl
-//     * @Date: 2024/4/18 10:18
-//     * @Description: 通过用户id查询关联的协议
-//     */
-//    @Override
-//    public List<PtlAgreementInsCompanyDto> getAllAgreementByUserId(SubstituteRecordingAgreementVo quoteAgreementVo) {
-//        String userId = quoteAgreementVo.getUserId();
-//        SysUser user = sysUserService.getById(userId);
-//        //查出当前用户管理所有协议
-//
-//        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(user.getDeptId(), userId);
-//        //查找是否配置税源   注释掉原先的逻辑
-//
-//        //修改协议的默认   add by hxl   2024-05-27
-//        List<PtlTaxSourceNew> taxSourceDtos = ptlTaxSourceNewMapper.findDefaultAllAttrLink();
-//        //设置税源参数
-//        agreementInsCompany.forEach(item -> {
-//            if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
-//                taxSourceDtos.forEach(taxSourceDto -> {
-//                    if (item.getId().equals(taxSourceDto.getInsCompanyId())) {
-//                        item.getAgreement().forEach(agreement -> {
-//                            if (agreement.getId().equals(taxSourceDto.getAgreementId())) {
-//                                agreement.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
-//                                item.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
-//                                item.setTaxSourceAgreementId(taxSourceDto.getAgreementId());
-//                            }
-//                        });
-//                    }
-//                });
-//            }
-//        });
-//
-//        return agreementInsCompany;
-//    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/18 10:18
+     *  @Description: 通过用户id查询关联的协议
+     */
+    @Override
+    public List<PtlAgreementInsCompanyDto> getAllAgreementByUserId(String userId) {
+        SysUser user = sysUserService.getById(userId);
+        //查出当前用户管理所有协议
+        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(user.getDeptId(), userId);
+        //查找是否配置税源   注释掉原先的逻辑
+       // List<TaxSourceDto> taxSourceDtos =
+           //     baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
+        //修改协议的默认   add by hxl   2024-05-27
+        List<PtlTaxSourceNew> taxSourceDtos = ptlTaxSourceNewMapper.findDefaultAllAttrLink();
+        //设置税源参数
+        agreementInsCompany.forEach(item -> {
+            if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
+                taxSourceDtos.forEach(taxSourceDto -> {
+                    if (item.getId().equals(taxSourceDto.getInsCompanyId())) {
+                        item.getAgreement().forEach(agreement -> {
+                            if (agreement.getId().equals(taxSourceDto.getAgreementId())) {
+                                agreement.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
+                                item.setIsTaxSource(TaxSourceStatusConstants.TAX_SOURCE_START);
+                                item.setTaxSourceAgreementId(taxSourceDto.getAgreementId());
+                            }
+                        });
+                    }
+                });
+            }
+        });
+        return agreementInsCompany;
+    }
 
 
 }

+ 0 - 19
src/main/java/com/ydtech/modules/protocol/utils/EnableUtils.java

@@ -1,19 +0,0 @@
-package com.ydtech.modules.protocol.utils;
-
-
-public class EnableUtils {
-
-    private EnableUtils() {
-        throw new IllegalStateException("AssertionUtils class");
-    }
-
-    public static boolean isEnable(int systemType, int pcStart, int appStart) {
-        if (pcStart > 0 && systemType == 1) {
-            return true;
-        } else {
-            return appStart > 0 && systemType == 2;
-        }
-    }
-
-}
-

+ 0 - 20
src/main/resources/mapper/modules/protocol/PtlAgreementSchedulingConfigMapper.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ydtech.modules.protocol.dao.PtlAgreementSchedulingConfigMapper">
-
-    <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig">
-            <id property="id" column="id" jdbcType="INTEGER"/>
-            <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
-            <result property="companyName" column="company_name" jdbcType="VARCHAR"/>
-            <result property="appStart" column="app_start" jdbcType="TINYINT"/>
-            <result property="pcStart" column="pc_start" jdbcType="TINYINT"/>
-            <result property="productsCode" column="products_code" jdbcType="VARCHAR"/>
-    </resultMap>
-
-    <sql id="Base_Column_List">
-        id,company_id,company_name,
-        app_start,pc_start,products_code
-    </sql>
-</mapper>

+ 7 - 35
src/main/resources/mapper/modules/protocol/TaxSourceMapper.xml

@@ -27,29 +27,16 @@
         <result property="insuranceCompany" column="insurance_company" jdbcType="VARCHAR"/>
     </resultMap>
 
-    <resultMap id="SchedulingCompanyResultMap" type="com.ydtech.modules.protocol.entity.dto.PtlAgreementSchedulingDto">
-        <id property="id" column="id" jdbcType="VARCHAR"/>
-        <result property="name" column="name" jdbcType="VARCHAR"/>
-        <result property="pcStart" column="pc_start" jdbcType="INTEGER"/>
-        <result property="appStart" column="app_start" jdbcType="INTEGER"/>
-        <result property="productsCode" column="products_code" jdbcType="VARCHAR"/>
-    </resultMap>
-
-    <select id="getInsureCompany" resultMap="SchedulingCompanyResultMap">
+    <select id="getInsureCompany" resultMap="CompanyResultMap">
         SELECT
-        eic.id, eic.name, pasc.pc_start, pasc.app_start, pasc.products_code
+            eic.*
         FROM
-        esm_ins_company eic
-        left join ptl_agreement pa on pa.insurance_company_id = eic.id
-        left join ptl_agreement_scheduling_config pasc on pasc.company_id = eic.id
-        where eic.parent_id = '0' and pa.insurance_company_id = eic.id
-        <if test="companyId != '' and companyId  != null ">
-            and eic.id = #{companyId}
-        </if>
-
+            esm_ins_company eic,
+            ptl_agreement pa
+        WHERE
+            eic.id = pa.insurance_company_id
         GROUP BY
-        eic.id,
-        pasc.id
+            eic.id
     </select>
 
     <select id="getAgreementByCompanyId" resultMap="AgreementResultMap">
@@ -61,19 +48,4 @@
             insurance_company_id = #{companyId}
     </select>
 
-    <select id="getPtlAgreementScheduling"
-            resultType="com.ydtech.modules.protocol.entity.dto.PtlAgreementSchedulingDto">
-        SELECT
-        eic.id, eic.name, pasc.pc_start, pasc.app_start, pasc.products_code
-        FROM
-        esm_ins_company eic
-        left join ptl_agreement pa on pa.insurance_company_id = eic.id
-        left join ptl_agreement_scheduling_config pasc on pasc.company_id = eic.id
-        where eic.parent_id = '0' and pa.insurance_company_id = eic.id
-        GROUP BY
-        eic.id,
-        pasc.id
-    </select>
-
-
 </mapper>