|
|
@@ -1,11 +1,7 @@
|
|
|
package com.ydtech.modules.protocol.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.protocol.dao.PtlAgreementUndwrtRulesMapper;
|
|
|
-import com.ydtech.modules.protocol.entity.dto.PltAgreementRuleSaveDto;
|
|
|
-import com.ydtech.modules.protocol.entity.dto.PtlAgreementUndwrtRulesSaveDto;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlAgreementUndwrtRules;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementUndwrtRulesService;
|
|
|
@@ -13,15 +9,11 @@ import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author CXP
|
|
|
- * @description 针对表【ptl_agreement_undwrt_rules(协议产品费用)】的数据库操作Service实现
|
|
|
+ * @description 针对表【ptl_agreement_undwrt_rules(协议承保规则)】的数据库操作Service实现
|
|
|
* @createDate 2023年12月20日22:25:57
|
|
|
*/
|
|
|
@Service
|
|
|
@@ -40,63 +32,20 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PltAgreementRuleSaveDto> getByAgreementId(String agreementId) {
|
|
|
+ public List<PtlAgreementUndwrtRules> getByAgreementId(String agreementId) {
|
|
|
List<PtlAgreementUndwrtRules> ptlAgreementUndwrtRulesList = baseMapper.selectList(getByAgreementIdWrapper(agreementId));
|
|
|
- List<String> productIdList = ptlAgreementUndwrtRulesList.stream()
|
|
|
- .map(PtlAgreementUndwrtRules::getProductId).distinct().collect(Collectors.toList());
|
|
|
-
|
|
|
- List<PltAgreementRuleSaveDto> productCostsSave = new ArrayList<>();
|
|
|
- productIdList.forEach(productId -> {
|
|
|
- List<PtlAgreementUndwrtRules> productCostsList = ptlAgreementUndwrtRulesList.stream().filter(x -> x.getProductId().equals(productId)).collect(Collectors.toList());
|
|
|
- PltAgreementRuleSaveDto pltAgreementRuleSaveDto = new PltAgreementRuleSaveDto(productCostsList);
|
|
|
- productCostsSave.add(pltAgreementRuleSaveDto);
|
|
|
- }
|
|
|
- );
|
|
|
- return productCostsSave;
|
|
|
+ return ptlAgreementUndwrtRulesList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void saveBatchProductCosts(String agreementId, List<PltAgreementRuleSaveDto> scheme) {
|
|
|
- if (scheme != null && !scheme.isEmpty()) {
|
|
|
- List<PtlAgreementUndwrtRules> ptlAgreementUndwrtRulesList = PtlAgreementUndwrtRulesSaveDto.toPtlAgreementUndwrtRules(agreementId, scheme);
|
|
|
+ public void saveBatchProductCosts(String agreementId, List<PtlAgreementUndwrtRules> ptlAgreementUndwrtRulesList) {
|
|
|
+ if (ptlAgreementUndwrtRulesList != null && !ptlAgreementUndwrtRulesList.isEmpty()) {
|
|
|
boolean b = saveBatch(ptlAgreementUndwrtRulesList);
|
|
|
- AssertionUtils.isSucceed(b, "批量添加产品费用失败");
|
|
|
+ AssertionUtils.isSucceed(b, "批量添加承保规则失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public List<PtlAgreementUndwrtRules> selectByCompanyId(String companyId, List<String> filedList) {
|
|
|
- String agreementId = ptlAgreementAttributionService.selectByCompanyId(companyId, filedList);
|
|
|
- List<PtlAgreementUndwrtRules> ptlAgreementProductCosts = baseMapper.selectList(getByAgreementIdWrapper(agreementId));
|
|
|
- if (ptlAgreementProductCosts.isEmpty()) {
|
|
|
- throw new SystemException("未查询到费用配置");
|
|
|
- }
|
|
|
- return ptlAgreementProductCosts;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过协议ID 获取需要进行匹配的费用因子
|
|
|
- * @param busType
|
|
|
- * @param agreementId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<PtlAgreementUndwrtRules> selectVliadFeeFactor(String busType,String agreementId){
|
|
|
- //获取当前时间,用来卡费用方案中有效期区间
|
|
|
- Date date=new Date();
|
|
|
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- String nowDate=sdf.format(date);
|
|
|
- //组织查询条件
|
|
|
- List tempTypes=new ArrayList();
|
|
|
- tempTypes.add(busType);//跟单类型
|
|
|
- tempTypes.add("039999");//兜底类型
|
|
|
- LambdaQueryWrapper<PtlAgreementUndwrtRules> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(PtlAgreementUndwrtRules::getAgreementId, agreementId);
|
|
|
- wrapper.in(PtlAgreementUndwrtRules::getProductId,tempTypes);
|
|
|
- List<PtlAgreementUndwrtRules> ptlAgreementProductCosts = baseMapper.selectList(wrapper);
|
|
|
- return ptlAgreementProductCosts;
|
|
|
- }
|
|
|
|
|
|
}
|