785834757 пре 2 година
родитељ
комит
053c50398a

+ 12 - 0
src/main/java/com/ydtech/modules/protocol/constants/TaxSourceStatusConstants.java

@@ -0,0 +1,12 @@
+package com.ydtech.modules.protocol.constants;
+
+public class TaxSourceStatusConstants {
+
+    public static final String TAX_SOURCE_START = "1";
+    public static final String TAX_SOURCE_STOP = "0";
+
+    //排除部门
+    public static final String EXCLUDE_TYPE_DEPT = "1";
+    //排除车牌
+    public static final String EXCLUDE_TYPE_LICENSE = "2";
+}

+ 84 - 0
src/main/java/com/ydtech/modules/protocol/controller/TaxSourceController.java

@@ -0,0 +1,84 @@
+package com.ydtech.modules.protocol.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+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.base.controller.BaseController;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.protocol.entity.po.PtlNonCarInsuranceProduct;
+import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
+import com.ydtech.modules.protocol.service.PtlAreaLicenseService;
+import com.ydtech.modules.protocol.service.ITaxSourceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.awt.print.Pageable;
+import java.util.List;
+
+@Api(tags = "税源管理")
+@RequestMapping("/tax/manager")
+@RestController
+public class TaxSourceController extends BaseController {
+    @Autowired
+    private PtlAreaLicenseService ptlAreaLicenseService;
+
+    @Autowired
+    private ITaxSourceService taxSourceService;
+
+
+    @GetMapping("/license")
+    @ApiOperation("车牌信息")
+    public HttpResult license() {
+        //只查山西的
+        return HttpResult.ok(ptlAreaLicenseService.getByParentNumber("14"));
+    }
+
+    @GetMapping("/insureCompany")
+    @ApiOperation("获取保险公司")
+    public HttpResult insureCompany(Integer pageNum,Integer pageSize) {
+        PageRequest pageRequest = new PageRequest();
+        pageRequest.setPageNum(pageNum);
+        pageRequest.setPageSize(pageSize);
+        Page page = PageRequest.buildPageRequest(pageRequest);
+        IPage<EsmInsCompany> insureCompany = taxSourceService.getInsureCompany(page);
+        PageResult pageResult = PageResult.buildPageResult(insureCompany);
+        return HttpResult.ok(pageResult);
+    }
+
+    @GetMapping("/agreement")
+    @ApiOperation("获取协议")
+    public HttpResult agreement(String companyId) {
+        String deptId = getDeptId();
+        String userId = getUserId();
+        return HttpResult.ok(taxSourceService.getAgreementByCompanyId(companyId,deptId,userId));
+    }
+
+    @GetMapping("/getTaxSource")
+    @ApiOperation("获取税源")
+    public HttpResult getTaxSource(String companyId){
+        TaxSourceVo taxSourceVos = taxSourceService.getTaxSource(companyId);
+        return HttpResult.ok(taxSourceVos);
+    }
+
+    @GetMapping("/getAllAgreement")
+    @ApiOperation("获取所有协议")
+    public HttpResult getAllAgreement(String license,String volume){
+        String deptId = getDeptId();
+        String userId = getUserId();
+        license = license.substring(0,2);
+        return HttpResult.ok(taxSourceService.getAgreementInsCompany(deptId,userId,license,volume));
+    }
+
+    @PostMapping("/saveTaxSource")
+    @ApiOperation("保存税源")
+    public HttpResult saveTaxSource(@RequestBody TaxSourceVo taxSourceVo) {
+        boolean result = taxSourceService.saveTaxSource(taxSourceVo);
+        return result? HttpResult.ok("保存税源成功"):HttpResult.error("保存税源失败");
+    }
+
+}

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

@@ -18,6 +18,7 @@ public interface PtlAgreementMapper extends BaseMapper<PtlAgreement> {
 
     List<PtlAgreementInsCompanyDto> getAgreementCompany(@Param("localDate") LocalDate localDate, @Param("deptId") String deptId);
 
+
 }
 
 

+ 15 - 0
src/main/java/com/ydtech/modules/protocol/dao/TaxSourceExcludeMapper.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+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 org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface TaxSourceExcludeMapper extends BaseMapper<TaxSourceExcludeDto> {
+
+}

+ 21 - 0
src/main/java/com/ydtech/modules/protocol/dao/TaxSourceMapper.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+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.TaxSourceDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface TaxSourceMapper extends BaseMapper<TaxSourceDto> {
+
+    IPage<EsmInsCompany> getInsureCompany(Page page);
+
+    List<PtlAgreement> getAgreementByCompanyId(String companyId);
+
+}

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

@@ -28,4 +28,10 @@ public class PtlAgreementDto implements Serializable {
     @ApiModelProperty("承保描述")
     private String underwritingDescription;
 
+    @ApiModelProperty("是否是税源")
+    private String isTaxSource;
+
+    @ApiModelProperty("是否分配")
+    private String isAllocation;
+
 }

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

@@ -16,6 +16,15 @@ public class PtlAgreementInsCompanyDto extends EsmInsCompany implements Serializ
 
     private static final long serialVersionUID = -5790993730287966635L;
 
+    @ApiModelProperty("是否排除")
+    private String isExclude;
+
+    @ApiModelProperty("是否税源")
+    private String isTaxSource;
+
+    @ApiModelProperty("税源协议id")
+    private String TaxSourceAgreementId;
+
     @ApiModelProperty("协议信息")
     private List<PtlAgreementDto> agreement;
 

+ 26 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/TaxSourceDto.java

@@ -0,0 +1,26 @@
+package com.ydtech.modules.protocol.entity.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel("税源配置模版")
+@TableName("ptl_tax_source")
+public class TaxSourceDto {
+
+
+    private String id;
+
+    private String license;
+
+    private String agreementId;
+
+    private String insCompanyId;
+
+    private String insCompanyName;
+
+    private String isTaxSource;
+
+
+}

+ 21 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/TaxSourceExcludeDto.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.protocol.entity.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel("税源部门排除")
+@TableName("ptl_tax_source_exclude")
+public class TaxSourceExcludeDto {
+
+
+    private String id;
+
+    private String InsCompanyId;
+
+    private Integer type;
+
+    private String excludeInfo;
+
+}

+ 53 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/TaxSourceVo.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TaxSourceVo {
+
+    /**
+     * 保险公司id
+     */
+    @TableField(value = "ins_company_id")
+    private String insCompanyId;
+    /**
+     * 保险公司名称
+     */
+    @TableField(value = "ins_company_name")
+    private String insCompanyName;
+    /**
+     * 税源配置信息
+     */
+    private List<AgreementTax> agreementTaxList;
+
+    /**
+     * 税源排除的部门
+     */
+    private String[] agreementTaxExcludeDeptList;
+
+    /**
+     * 税源排除的车牌号
+     */
+    private String[] agreementTaxExcludeLicenseList;
+
+    /**
+     * 税源配置信息
+     */
+    @Data
+    public static class AgreementTax{
+        private String agreementId;
+        private String isTaxSource;
+        /**
+         * 车牌号
+         */
+        private String license;
+    }
+
+    @Data
+    public static class AgreementTaxExclude{
+        private String excludeInfo;
+    }
+}

+ 15 - 0
src/main/java/com/ydtech/modules/protocol/service/ITaxSourceExcludeService.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public interface ITaxSourceExcludeService extends IService<TaxSourceExcludeDto> {
+
+}

+ 28 - 0
src/main/java/com/ydtech/modules/protocol/service/ITaxSourceService.java

@@ -0,0 +1,28 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.core.page.PageRequest;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+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.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public interface ITaxSourceService extends IService<TaxSourceDto> {
+
+    IPage<EsmInsCompany> getInsureCompany(Page page);
+
+    List<PtlAgreement> getAgreementByCompanyId(String companyId,String deptId,String userId);
+
+    boolean saveTaxSource(TaxSourceVo taxSourceVo);
+
+    TaxSourceVo getTaxSource(String companyId);
+    List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId,String license,String volume);
+}

+ 25 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceExcludeServiceImpl.java

@@ -0,0 +1,25 @@
+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.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.protocol.dao.TaxSourceExcludeMapper;
+import com.ydtech.modules.protocol.dao.TaxSourceMapper;
+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.vo.TaxSourceVo;
+import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
+import com.ydtech.modules.protocol.service.ITaxSourceService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class TaxSourceExcludeServiceImpl extends ServiceImpl<TaxSourceExcludeMapper, TaxSourceExcludeDto> implements ITaxSourceExcludeService {
+
+}

+ 265 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -0,0 +1,265 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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.github.pagehelper.PageHelper;
+import com.ydtech.constants.sys.SystemConstant;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.core.page.PageRequest;
+import com.ydtech.modules.admin.constants.RoleConstants;
+import com.ydtech.modules.admin.model.SysUserRole;
+import com.ydtech.modules.admin.service.SysUserRoleService;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
+import com.ydtech.modules.protocol.dao.TaxSourceMapper;
+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.vo.TaxSourceVo;
+import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
+import com.ydtech.modules.protocol.service.ITaxSourceService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.utils.idgen.IdGenerate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+@Service
+public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper,TaxSourceDto> implements ITaxSourceService {
+
+    @Autowired
+    PtlAgreementService ptlAgreementService;
+
+    @Autowired
+    ITaxSourceExcludeService taxSourceExcludeService;
+
+    @Autowired
+    InsOrdersService insOrdersService;
+
+    @Autowired
+    SysUserRoleService sysUserRoleService;
+
+    @Autowired
+    EsmInsCompanyService esmInsCompanyService;
+
+
+    @Override
+    public IPage<EsmInsCompany> getInsureCompany(Page page) {
+        return baseMapper.getInsureCompany(page);
+    }
+
+    @Override
+    public List<PtlAgreement> getAgreementByCompanyId(String companyId,String deptId,String userId) {
+        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
+        List<String> agreementIds = new ArrayList<>();
+        for(PtlAgreementInsCompanyDto item : agreementInsCompany){
+            if(item.getId().equals(companyId)){
+                for(PtlAgreementDto agreementDto : item.getAgreement()){
+                    agreementIds.add(agreementDto.getId());
+                }
+            }
+        }
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.in("id",agreementIds);
+        List<PtlAgreement> list = ptlAgreementService.list(queryWrapper);
+        return list;
+    }
+
+    @Override
+    @Transactional
+    public boolean saveTaxSource(TaxSourceVo taxSourceVo) {
+        //删除排除的信息
+        taxSourceExcludeService.remove(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId,taxSourceVo.getInsCompanyId()));
+        //删除税源配置信息
+        baseMapper.delete(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId, taxSourceVo.getInsCompanyId()));
+        //组装税源数据
+        List<TaxSourceDto> dtos = new ArrayList<>();
+        List<TaxSourceExcludeDto> excludeDtos = new ArrayList<>();
+        taxSourceVo.getAgreementTaxList().forEach(agreementTax -> {
+            TaxSourceDto dto = new TaxSourceDto();
+            dto.setId(IdGenerate.nextId());
+            dto.setInsCompanyId(taxSourceVo.getInsCompanyId());
+            dto.setInsCompanyName(taxSourceVo.getInsCompanyName());
+            dto.setAgreementId(agreementTax.getAgreementId());
+            dto.setIsTaxSource(agreementTax.getIsTaxSource());
+            dto.setLicense(agreementTax.getLicense());
+            dtos.add(dto);
+        });
+        //组装排除的部门信息
+        for(String agreementTaxExclude : taxSourceVo.getAgreementTaxExcludeDeptList()){
+            TaxSourceExcludeDto dto = new TaxSourceExcludeDto();
+            dto.setId(IdGenerate.nextId());
+            dto.setType(Integer.parseInt(TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+            dto.setInsCompanyId(taxSourceVo.getInsCompanyId());
+            dto.setExcludeInfo(agreementTaxExclude);
+            excludeDtos.add(dto);
+        }
+//        taxSourceVo.getAgreementTaxExcludeDeptList().forEach(agreementTaxExclude -> {
+//            TaxSourceExcludeDto dto = new TaxSourceExcludeDto();
+//            dto.setId(IdGenerate.nextId());
+//            dto.setType(Integer.parseInt(TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+//            dto.setInsCompanyId(taxSourceVo.getInsCompanyId());
+//            dto.setExcludeInfo(agreementTaxExclude.getExcludeInfo());
+//            excludeDtos.add(dto);
+//        });
+        //组装排除的车牌号信息
+        for (String agreementTaxExclude : taxSourceVo.getAgreementTaxExcludeLicenseList()) {
+            TaxSourceExcludeDto dto = new TaxSourceExcludeDto();
+            dto.setId(IdGenerate.nextId());
+            dto.setType(Integer.parseInt(TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
+            dto.setInsCompanyId(taxSourceVo.getInsCompanyId());
+            dto.setExcludeInfo(agreementTaxExclude);
+            excludeDtos.add(dto);
+        }
+//        taxSourceVo.getAgreementTaxExcludeLicenseList().forEach(agreementTaxExclude -> {
+//            TaxSourceExcludeDto dto = new TaxSourceExcludeDto();
+//            dto.setId(IdGenerate.nextId());
+//            dto.setType(Integer.parseInt(TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
+//            dto.setInsCompanyId(taxSourceVo.getInsCompanyId());
+//            dto.setExcludeInfo(agreementTaxExclude.getExcludeInfo());
+//            excludeDtos.add(dto);
+//        });
+        this.saveBatch(dtos);
+        taxSourceExcludeService.saveBatch(excludeDtos);
+        return true;
+    }
+
+    @Override
+    public TaxSourceVo getTaxSource(String companyId) {
+        TaxSourceVo taxSourceVo = new TaxSourceVo();
+        //税源信息
+        List<TaxSourceDto> taxSourceDto = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId, companyId));
+        //排除的部门信息
+        List<TaxSourceExcludeDto> taxSourceExcludeDepts = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
+                .eq(TaxSourceExcludeDto::getInsCompanyId, companyId)
+                .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+        //排除的车牌号信息
+        List<TaxSourceExcludeDto> taxSourceExcludeLicense = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
+                .eq(TaxSourceExcludeDto::getInsCompanyId, companyId)
+                .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
+
+        taxSourceVo.setInsCompanyId(companyId);
+
+        //税源信息转换
+        List<TaxSourceVo.AgreementTax> agreementTaxList = new ArrayList<>();
+        taxSourceDto.forEach(item -> {
+            TaxSourceVo.AgreementTax agreementTax = new TaxSourceVo.AgreementTax();
+            agreementTax.setAgreementId(item.getAgreementId());
+            agreementTax.setIsTaxSource(item.getIsTaxSource());
+            agreementTax.setLicense(item.getLicense());
+            agreementTaxList.add(agreementTax);
+        });
+        taxSourceVo.setAgreementTaxList(agreementTaxList);
+
+        //部门信息转换
+        List<String> agreementTaxExcludeDepts = new ArrayList<>();
+        taxSourceExcludeDepts.forEach(item -> {
+            agreementTaxExcludeDepts.add(item.getExcludeInfo());
+        });
+        taxSourceVo.setAgreementTaxExcludeDeptList(agreementTaxExcludeDepts.toArray(new String[agreementTaxExcludeDepts.size()]));
+
+        //车牌信息转换
+        List<String> agreementTaxExcludeLicense = new ArrayList<>();
+        taxSourceExcludeLicense.forEach(item -> {
+            agreementTaxExcludeLicense.add(item.getExcludeInfo());
+        });
+        taxSourceVo.setAgreementTaxExcludeLicenseList(agreementTaxExcludeLicense.toArray(new String[agreementTaxExcludeLicense.size()]));
+
+        return taxSourceVo;
+    }
+
+    public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId) {
+        // 领导标志
+        SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
+
+        if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString()) && !RoleConstants.R21.getCode().equals(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
+            deptId = null;
+        }
+
+        List<PtlAgreementInsCompanyDto> agreementCompany = ptlAgreementService.getAgreementCompany(deptId);
+        return agreementCompany;
+    }
+
+    @Override
+    public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId, String license,String volume) {
+        //查出所有协议
+        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
+        //排除的部门信息
+        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;
+    }
+
+
+}

+ 53 - 0
src/main/resources/mapper/modules/protocol/TaxSourceMapper.xml

@@ -0,0 +1,53 @@
+<?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.TaxSourceMapper">
+
+    <resultMap id="CompanyResultMap" type="com.ydtech.modules.esm.model.EsmInsCompany">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="code" column="code" jdbcType="VARCHAR"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+        <result property="namesimple" column="namesimple" jdbcType="VARCHAR"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
+        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="lastUpdateBy" column="last_update_by" jdbcType="VARCHAR"/>
+        <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
+        <result property="cnName" column="cn_name" jdbcType="VARCHAR"/>
+        <result property="type" column="type" jdbcType="TINYINT"/>
+    </resultMap>
+
+    <resultMap id="AgreementResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreement">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
+        <result property="insuranceCompanyId" column="agreement_name" jdbcType="VARCHAR"/>
+        <result property="insuranceCompany" column="insurance_company" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <select id="getInsureCompany" resultMap="CompanyResultMap">
+        SELECT
+            eic.*
+        FROM
+            esm_ins_company eic,
+            ptl_agreement pa
+        WHERE
+            eic.id = pa.insurance_company_id
+        GROUP BY
+            eic.id
+    </select>
+
+    <select id="getAgreementByCompanyId" resultMap="AgreementResultMap">
+        SELECT
+            *
+        FROM
+            ptl_agreement
+        WHERE
+            insurance_company_id = #{companyId}
+    </select>
+
+
+
+</mapper>