|
@@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
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.AgreementType;
|
|
import com.ydtech.constants.enums.dict.agreement.AgreementType;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.core.page.PageResult;
|
|
import com.ydtech.core.page.PageResult;
|
|
@@ -15,10 +18,7 @@ import com.ydtech.modules.protocol.dao.PtlAgreementMapper;
|
|
|
import com.ydtech.modules.protocol.entity.constants.PtlApiType;
|
|
import com.ydtech.modules.protocol.entity.constants.PtlApiType;
|
|
|
import com.ydtech.modules.protocol.entity.dto.*;
|
|
import com.ydtech.modules.protocol.entity.dto.*;
|
|
|
import com.ydtech.modules.protocol.entity.po.*;
|
|
import com.ydtech.modules.protocol.entity.po.*;
|
|
|
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementAuditVo;
|
|
|
|
|
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementPageVo;
|
|
|
|
|
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementQueryVo;
|
|
|
|
|
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementSaveVo;
|
|
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.vo.*;
|
|
|
import com.ydtech.modules.protocol.service.*;
|
|
import com.ydtech.modules.protocol.service.*;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -57,13 +58,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
|
|
|
|
|
private final PtlAgreementService proxyObject;
|
|
private final PtlAgreementService proxyObject;
|
|
|
|
|
|
|
|
|
|
+ private final PtlNonCarInsuranceProductService ptlNonCarInsuranceProductService;
|
|
|
|
|
|
|
|
private final PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService;
|
|
private final PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService;
|
|
|
|
|
|
|
|
public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService, PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService,
|
|
public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService, PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService,
|
|
|
PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService,
|
|
PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService,
|
|
|
EsmInsCompanyService esmInsCompanyService, PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService,
|
|
EsmInsCompanyService esmInsCompanyService, PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService,
|
|
|
- @Lazy InsCrawlerOrderService insCrawlerOrderController, @Lazy PtlAgreementService proxyObject) {
|
|
|
|
|
|
|
+ @Lazy InsCrawlerOrderService insCrawlerOrderController, @Lazy PtlAgreementService proxyObject,PtlNonCarInsuranceProductService ptlNonCarInsuranceProductService) {
|
|
|
this.ptlAgreementProductCostsService = ptlAgreementProductCostsService;
|
|
this.ptlAgreementProductCostsService = ptlAgreementProductCostsService;
|
|
|
this.ptlAgreementUnderwritingRulesService = ptlAgreementUnderwritingRulesService;
|
|
this.ptlAgreementUnderwritingRulesService = ptlAgreementUnderwritingRulesService;
|
|
|
this.ptlAgreementAttributionService = ptlAgreementAttributionService;
|
|
this.ptlAgreementAttributionService = ptlAgreementAttributionService;
|
|
@@ -72,6 +74,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
this.ptlAgreementNonCarProductCostsService = ptlAgreementNonCarProductCostsService;
|
|
this.ptlAgreementNonCarProductCostsService = ptlAgreementNonCarProductCostsService;
|
|
|
this.insCrawlerOrderController = insCrawlerOrderController;
|
|
this.insCrawlerOrderController = insCrawlerOrderController;
|
|
|
this.proxyObject = proxyObject;
|
|
this.proxyObject = proxyObject;
|
|
|
|
|
+ this.ptlNonCarInsuranceProductService=ptlNonCarInsuranceProductService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -211,6 +214,32 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
ptlAgreementProductCostsService.saveBatchProductCosts(agreementId, agreement.getScheme());
|
|
ptlAgreementProductCostsService.saveBatchProductCosts(agreementId, agreement.getScheme());
|
|
|
// 非车险产品费用
|
|
// 非车险产品费用
|
|
|
ptlAgreementNonCarProductCostsService.saveBatchNonCarProductCosts(agreementId, agreement.getNonCarProductCosts());
|
|
ptlAgreementNonCarProductCostsService.saveBatchNonCarProductCosts(agreementId, agreement.getNonCarProductCosts());
|
|
|
|
|
+ //同步刷新其他协议非车产品费用信息(有待同步协议时,进行同步)
|
|
|
|
|
+ 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&&!"".equals(destAgreement.getAssociationCompaniesId())){
|
|
|
|
|
+ companyId=destAgreement.getAssociationCompaniesId();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<String> companyIdList=esmInsCompanyService.getAllRelationCompanyId(companyId);
|
|
|
|
|
+ //再根据保险公司列表获取所有非车产品列表
|
|
|
|
|
+ List<PtlNonCarInsuranceProduct> productList=ptlNonCarInsuranceProductService.findProductListByCompangIds(companyIdList);
|
|
|
|
|
+ List<PtlAgreementNonCarProductCostsSaveVo> finalList=new ArrayList<>();
|
|
|
|
|
+ //按找出的产品过滤传进来的 费用方案列表
|
|
|
|
|
+ for(PtlNonCarInsuranceProduct tempProductDto:productList){
|
|
|
|
|
+ for(PtlAgreementNonCarProductCostsSaveVo productCostDto:agreement.getNonCarProductCosts()){
|
|
|
|
|
+ if(productCostDto.getProductId().equals(tempProductDto.getProductCode())){
|
|
|
|
|
+ finalList.add(productCostDto);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ptlAgreementNonCarProductCostsService.synNonCarProductCosts(destAgreement,finalList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// 承包规则
|
|
// 承包规则
|
|
|
ptlAgreementUnderwritingRulesService.saveBatchUnderwritingRules(agreementId, agreement.getUnderwritingRules());
|
|
ptlAgreementUnderwritingRulesService.saveBatchUnderwritingRules(agreementId, agreement.getUnderwritingRules());
|
|
|
// 账号添加
|
|
// 账号添加
|
|
@@ -283,5 +312,74 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
return HttpResult.ok("修改成功");
|
|
return HttpResult.ok("修改成功");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<List<PtlAgreementNonCarProductCostsVo>> getNonCarCostsInfo(String agreementId, String companyId){
|
|
|
|
|
+ List<PtlAgreementNonCarProductCostsVo> result=new ArrayList<>();
|
|
|
|
|
+ //先根据传过来的保险公司代码,找上下级所有机构层级对应的非车产品列表
|
|
|
|
|
+ if(companyId!=null&&!"".equals(companyId)){
|
|
|
|
|
+ //先获取相关保险公司列表
|
|
|
|
|
+ List<String> companyIdList=esmInsCompanyService.getAllRelationCompanyId(companyId);
|
|
|
|
|
+ //再根据保险公司列表获取所有非车产品列表
|
|
|
|
|
+ List<PtlNonCarInsuranceProduct> productList=ptlNonCarInsuranceProductService.findProductListByCompangIds(companyIdList);
|
|
|
|
|
+ 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());
|
|
|
|
|
+ costsVo.setCompanyId(tempProductDto.getCompanyId());
|
|
|
|
|
+ EsmInsCompany tempInsCompany=esmInsCompanyService.getById(tempProductDto.getCompanyId());
|
|
|
|
|
+ costsVo.setCompanyName(tempInsCompany.getName());
|
|
|
|
|
+ costsVo.setRiskCode(tempProductDto.getInsuranceCode());
|
|
|
|
|
+ Map<String, DictionaryManagement> m = DictEnumConfig.getDmMap();
|
|
|
|
|
+ DictionaryManagement dictionaryManagement=m.get("nonCarInsuranceCode");
|
|
|
|
|
+ String riskName="";
|
|
|
|
|
+ for(DictionaryData data: dictionaryManagement.getDdList()){
|
|
|
|
|
+ if(tempProductDto.getInsuranceCode().equals(data.getDictValue())){
|
|
|
|
|
+ riskName=data.getDictTag();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ costsVo.setRiskName(riskName);
|
|
|
|
|
+ //然后根据协议ID 查询所有已配置费用的产品进行赋值
|
|
|
|
|
+ if(agreementId!=null&&!"".equals(agreementId)){
|
|
|
|
|
+ //使用协议ID 产品ID 获取已经配置好的信息
|
|
|
|
|
+ PtlAgreementNonCarProductCosts agreementNonCarProductCosts=ptlAgreementNonCarProductCostsService.getNonCarProductCostsInfo(agreementId,tempProductDto.getProductCode());
|
|
|
|
|
+ //赋值已配置的费用比例
|
|
|
|
|
+ if(agreementNonCarProductCosts!=null){
|
|
|
|
|
+ costsVo.setCostsProportion(agreementNonCarProductCosts.getCostsProportion());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ result.add(costsVo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //如果归属保司没选,则直接返回空列表,相当于没查到对应非车产品信息
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok(result);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<List<PtlAgreement>> findRelationAgreement(String companyId){
|
|
|
|
|
+ List<PtlAgreement> resultList=new ArrayList<>();
|
|
|
|
|
+ if(companyId!=null&&!"".equals(companyId)) {
|
|
|
|
|
+ //先获取相关保险公司列表
|
|
|
|
|
+ List<String> companyIdList = esmInsCompanyService.getAllRelationCompanyId(companyId);
|
|
|
|
|
+ if(companyIdList!=null&&companyIdList.size()>0){
|
|
|
|
|
+ for(int i=0;i<companyIdList.size();i++){
|
|
|
|
|
+ String tempCom=companyIdList.get(i);
|
|
|
|
|
+ LambdaQueryWrapper<PtlAgreement> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(PtlAgreement::getValidStatus,"1");
|
|
|
|
|
+ wrapper.and(wq1->wq1.eq(PtlAgreement::getPartnerCompaniesId,tempCom).or(wq2->wq2.eq(PtlAgreement::getAssociationCompaniesId,tempCom)));
|
|
|
|
|
+ resultList.addAll(list(wrapper));
|
|
|
|
|
+ }
|
|
|
|
|
+ for(int j=0;j<resultList.size();j++){
|
|
|
|
|
+ PtlAgreement agreement=resultList.get(j);
|
|
|
|
|
+ String tempCompanyId=agreement.getAssociationCompaniesId()!=null&&!"".equals(agreement.getAssociationCompaniesId())?agreement.getAssociationCompaniesId():agreement.getPartnerCompaniesId();
|
|
|
|
|
+ EsmInsCompany tempCompany= esmInsCompanyService.getById(tempCompanyId);
|
|
|
|
|
+ agreement.setInsuranceCompany(tempCompany.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok(resultList);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|