|
@@ -2,6 +2,7 @@ package com.jzg.organization.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
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;
|
|
@@ -22,6 +23,8 @@ import com.jzg.organization.mapper.SysUserMapper;
|
|
|
import com.jzg.organization.service.*;
|
|
import com.jzg.organization.service.*;
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -35,12 +38,13 @@ import java.util.stream.Collectors;
|
|
|
/**
|
|
/**
|
|
|
* @author dongxin
|
|
* @author dongxin
|
|
|
* @description 针对表【ptl_agreement(协议信息表)】的数据库操作Service实现
|
|
* @description 针对表【ptl_agreement(协议信息表)】的数据库操作Service实现
|
|
|
-* @createDate 2025-02-18 10:49:25
|
|
|
|
|
|
|
+* @date 2025-02-18 10:49:25
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, PtlAgreement>
|
|
public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, PtlAgreement>
|
|
|
implements PtlAgreementService {
|
|
implements PtlAgreementService {
|
|
|
|
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(PtlAgreementServiceImpl.class);
|
|
|
@Value("${minio.bucket-name}")
|
|
@Value("${minio.bucket-name}")
|
|
|
private String bucketName;
|
|
private String bucketName;
|
|
|
|
|
|
|
@@ -79,8 +83,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private PtlAgreementCostExternalService ptlAgreementCostExternalService;
|
|
private PtlAgreementCostExternalService ptlAgreementCostExternalService;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 协议分页查询
|
|
|
|
|
+ * @param param 协议相关信息,页面查询条件
|
|
|
|
|
+ * @return Page<AgreementVo> 协议列表
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
public Page<AgreementVo> queryPage(AgreementParam param) {
|
|
public Page<AgreementVo> queryPage(AgreementParam param) {
|
|
|
|
|
+ log.info("查询协议列表: AgreementParam=[{}]", JSONUtil.toJsonStr(param));
|
|
|
param.setSystemCode(baseController.getUserSystemCode());
|
|
param.setSystemCode(baseController.getUserSystemCode());
|
|
|
Page<AgreementVo> page = baseMapper.queryPage(param.getPage(), param);
|
|
Page<AgreementVo> page = baseMapper.queryPage(param.getPage(), param);
|
|
|
List<AgreementVo> agreementVos = page.getRecords();
|
|
List<AgreementVo> agreementVos = page.getRecords();
|
|
@@ -159,7 +169,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
public AgreementVo isExistById(String id) {
|
|
public AgreementVo isExistById(String id) {
|
|
|
AgreementVo agreementVo = baseMapper.queryById(id);
|
|
AgreementVo agreementVo = baseMapper.queryById(id);
|
|
|
if (ObjectUtils.isEmpty(agreementVo)) {
|
|
if (ObjectUtils.isEmpty(agreementVo)) {
|
|
|
- throw new SystemException("协议id不存在!");
|
|
|
|
|
|
|
+ log.info("协议id不存在:id=[{}]",id);
|
|
|
|
|
+ throw new SystemException("协议id不存在!id=" + id);
|
|
|
}
|
|
}
|
|
|
return agreementVo;
|
|
return agreementVo;
|
|
|
}
|
|
}
|
|
@@ -187,7 +198,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
|
|
|
|
|
// 获取保险公司信息
|
|
// 获取保险公司信息
|
|
|
HttpResult<EsmInsCompany> result = companyClient.findById(param.getCompanyId());
|
|
HttpResult<EsmInsCompany> result = companyClient.findById(param.getCompanyId());
|
|
|
- String companyCode = "";
|
|
|
|
|
|
|
+ String companyCode;
|
|
|
if(result.getCode() == 200 && Objects.nonNull(result.getData())){
|
|
if(result.getCode() == 200 && Objects.nonNull(result.getData())){
|
|
|
companyCode = result.getData().getCompanyCode();
|
|
companyCode = result.getData().getCompanyCode();
|
|
|
}else{
|
|
}else{
|
|
@@ -278,7 +289,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
agreementCostService.removeByIds(costIds);
|
|
agreementCostService.removeByIds(costIds);
|
|
|
|
|
|
|
|
// 删除费用关联的规则
|
|
// 删除费用关联的规则
|
|
|
- if(costIds.size() > 0) {
|
|
|
|
|
|
|
+ if(!costIds.isEmpty()) {
|
|
|
agreementCostRuleService.remove(new LambdaQueryWrapper<PtlAgreementCostRule>()
|
|
agreementCostRuleService.remove(new LambdaQueryWrapper<PtlAgreementCostRule>()
|
|
|
.in(PtlAgreementCostRule::getPtlAgreementCostId, costIds));
|
|
.in(PtlAgreementCostRule::getPtlAgreementCostId, costIds));
|
|
|
}
|
|
}
|
|
@@ -354,8 +365,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
costGroup.put(ptlAgreementCost.getCoverRuleId(), costGroupList);
|
|
costGroup.put(ptlAgreementCost.getCoverRuleId(), costGroupList);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /** 复制承保规则和费用 **/
|
|
|
|
|
|
|
+ // 复制承保规则和费用
|
|
|
this.copyRuleAndCost(costGroup,costIds,costList,newAgreement);
|
|
this.copyRuleAndCost(costGroup,costIds,costList,newAgreement);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -394,8 +404,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
Collectors.groupingBy(PtlAgreementCostType::getPtlAgreementCostId));
|
|
Collectors.groupingBy(PtlAgreementCostType::getPtlAgreementCostId));
|
|
|
|
|
|
|
|
costGroup.forEach((key, value) -> {
|
|
costGroup.forEach((key, value) -> {
|
|
|
-
|
|
|
|
|
- /** 1-承保规则复制 **/
|
|
|
|
|
|
|
+ //1-承保规则复制
|
|
|
PtlAgreementUndwrtRules agreementUndwrtRules = rulesMap.get(key);
|
|
PtlAgreementUndwrtRules agreementUndwrtRules = rulesMap.get(key);
|
|
|
PtlAgreementUndwrtRules newAgreementUndwrtRules = new PtlAgreementUndwrtRules();
|
|
PtlAgreementUndwrtRules newAgreementUndwrtRules = new PtlAgreementUndwrtRules();
|
|
|
BeanUtils.copyProperties(agreementUndwrtRules,newAgreementUndwrtRules);
|
|
BeanUtils.copyProperties(agreementUndwrtRules,newAgreementUndwrtRules);
|
|
@@ -421,7 +430,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
agreementUndwrtRulesAttrLinkService.saveBatch(links);
|
|
agreementUndwrtRulesAttrLinkService.saveBatch(links);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** 2-费用复制 **/
|
|
|
|
|
|
|
+ // 2-费用复制
|
|
|
List<PtlAgreementCost> agreementCostList = costGroup.get(key);
|
|
List<PtlAgreementCost> agreementCostList = costGroup.get(key);
|
|
|
if(CollUtil.isNotEmpty(agreementCostList)) {
|
|
if(CollUtil.isNotEmpty(agreementCostList)) {
|
|
|
agreementCostList.forEach(agreementCost -> {
|
|
agreementCostList.forEach(agreementCost -> {
|
|
@@ -459,7 +468,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
|
|
|
|
|
// 获取保险公司信息
|
|
// 获取保险公司信息
|
|
|
HttpResult<EsmInsCompany> result = companyClient.findById(param.getCompanyId());
|
|
HttpResult<EsmInsCompany> result = companyClient.findById(param.getCompanyId());
|
|
|
- String companyCode = "";
|
|
|
|
|
|
|
+ String companyCode;
|
|
|
if(result.getCode() == 200 && Objects.nonNull(result.getData())){
|
|
if(result.getCode() == 200 && Objects.nonNull(result.getData())){
|
|
|
companyCode = result.getData().getCompanyCode();
|
|
companyCode = result.getData().getCompanyCode();
|
|
|
}else{
|
|
}else{
|