Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-csf
Commits
998922da
Commit
998922da
authored
Mar 09, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
d8e51c8c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
65 deletions
+123
-65
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
+123
-65
No files found.
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
View file @
998922da
...
@@ -107,97 +107,155 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
...
@@ -107,97 +107,155 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updatePolicy
(
PolicyUpdateRequest
policyUpdateRequest
)
{
public
Boolean
updatePolicy
(
PolicyUpdateRequest
policyUpdateRequest
)
{
ApiProductPlanMainInfoDto
apiProductPlanMainInfoD
to
=
policyUpdateRequest
.
getApiProductPlanMainInfoDto
();
ApiProductPlanMainInfoDto
d
to
=
policyUpdateRequest
.
getApiProductPlanMainInfoDto
();
if
(
apiProductPlanMainInfoD
to
==
null
)
{
if
(
d
to
==
null
)
{
throw
new
BusinessException
(
"产品计划对象不能为空"
);
throw
new
BusinessException
(
"产品计划对象不能为空"
);
}
}
String
policyBizId
=
policyUpdateRequest
.
getPolicyBizId
();
String
policyBizId
=
policyUpdateRequest
.
getPolicyBizId
();
if
(
StringUtils
.
isBlank
(
policyBizId
))
{
if
(
StringUtils
.
isBlank
(
policyBizId
))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"policyBizId不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"policyBizId不能为空"
);
}
}
Policy
policy
=
this
.
getOne
(
new
QueryWrapper
<
Policy
>().
eq
(
"policy_biz_id"
,
policyBizId
));
Policy
policy
=
this
.
getOne
(
new
QueryWrapper
<
Policy
>().
eq
(
"policy_biz_id"
,
policyBizId
));
if
(
policy
==
null
)
{
if
(
policy
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"保单不存在"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"保单不存在"
);
}
}
BigDecimal
paymentPremium
=
policy
.
getPaymentPremium
();
if
(
paymentPremium
==
null
)
{
throw
new
BusinessException
(
"期交保费不能为空"
);
}
Object
paymentTerm
=
policy
.
getPaymentTerm
();
if
(
paymentTerm
==
null
)
{
throw
new
BusinessException
(
"供款期数不能为空"
);
}
// 手动映射字段,处理类型转换
Date
now
=
new
Date
();
Date
now
=
new
Date
();
// 保单信息
BeanUtils
.
copyProperties
(
apiProductPlanMainInfoDto
,
policy
,
"policyBizId"
,
"id"
);
// 保单基本信息
policy
.
setPaymentPremium
(
apiProductPlanMainInfoDto
.
getEachIssuePremium
());
policy
.
setPolicyBizId
(
policyBizId
);
policy
.
setTotalPaymentPremium
(
calculateTotalPaymentPremium
(
apiProductPlanMainInfoDto
));
policy
.
setProductLaunchBizId
(
dto
.
getProductLaunchBizId
());
policy
.
setIsPrepaid
(
apiProductPlanMainInfoDto
.
getIsPrepay
());
policy
.
setProductName
(
dto
.
getProductLaunchMainName
());
policy
.
setInsuranceCompany
(
dto
.
getCompanyName
());
policy
.
setInsuranceCompanyBizId
(
dto
.
getCompanyId
());
policy
.
setReconciliationCompany
(
dto
.
getReconciliationCompanyName
());
policy
.
setReconciliationCompanyBizId
(
dto
.
getReconciliationCompanyId
());
policy
.
setCurrency
(
dto
.
getPolicyCurrency
());
policy
.
setProductCate
(
dto
.
getInsuranceTypeId
());
policy
.
setPaymentTerm
(
dto
.
getIssueNumber
());
// 保障年期
policy
.
setGuaranteePeriod
(
dto
.
getGuaranteePeriod
());
// 保额
policy
.
setSumInsured
(
parseBigDecimal
(
dto
.
getSumInsured
()));
// 期交保费
BigDecimal
eachIssuePremium
=
parseBigDecimal
(
dto
.
getEachIssuePremium
());
if
(
eachIssuePremium
==
null
)
{
throw
new
BusinessException
(
"每期保费不能为空"
);
}
policy
.
setPaymentPremium
(
eachIssuePremium
);
// 总保费计算
policy
.
setTotalPaymentPremium
(
calculateTotalPaymentPremium
(
dto
));
// 保单征费
policy
.
setPolicyLevy
(
parseString
(
dto
.
getPolicyLevy
()));
// 是否预缴
policy
.
setIsPrepaid
(
parseInteger
(
dto
.
getIsPrepay
()));
// 预缴年期
policy
.
setPrepaidTerm
(
parseInteger
(
dto
.
getPrepaymentPeriod
()));
// 是否回溯
policy
.
setIsBacktrack
(
parseInteger
(
dto
.
getIsTraceable
()));
// 首期付款方式
policy
.
setInitialPaymentMethod
(
dto
.
getInitialPaymentMethod
());
// 续期付款方式
policy
.
setRenewalPaymentMethod
(
dto
.
getRenewalPaymentMethod
());
// 红利分配方式
policy
.
setDividendDistributionMethod
(
dto
.
getDividendDistributionMethod
());
policy
.
setUpdateTime
(
now
);
policy
.
setUpdateTime
(
now
);
//对账公司名称
policy
.
setReconciliationCompany
(
apiProductPlanMainInfoDto
.
getReconciliationCompanyName
());
//对账公司业务id
policy
.
setReconciliationCompanyBizId
(
apiProductPlanMainInfoDto
.
getReconciliationCompanyId
());
policy
.
setProductCate
(
apiProductPlanMainInfoDto
.
getInsuranceTypeId
());
policy
.
setPaymentTerm
(
apiProductPlanMainInfoDto
.
getIssueNumber
());
policy
.
setCurrency
(
apiProductPlanMainInfoDto
.
getPolicyCurrency
());
policy
.
setPaymentPremium
(
apiProductPlanMainInfoDto
.
getEachIssuePremium
());
policy
.
setIsPrepaid
(
apiProductPlanMainInfoDto
.
getIsPrepay
());
policy
.
setPrepaidTerm
(
apiProductPlanMainInfoDto
.
getPrepaymentPeriod
());
policy
.
setIsBacktrack
(
apiProductPlanMainInfoDto
.
getIsTraceable
());
policy
.
setInsuranceCompany
(
apiProductPlanMainInfoDto
.
getCompanyName
());
policy
.
setInsuranceCompanyBizId
(
apiProductPlanMainInfoDto
.
getCompanyId
());
// 更新保单
this
.
updateById
(
policy
);
this
.
updateById
(
policy
);
//更新新单跟进数据
// 更新 PolicyFollow
PolicyFollow
policyFollow
=
policyFollowService
.
queryOneByPolicyBizId
(
policyBizId
);
PolicyFollow
policyFollow
=
policyFollowService
.
queryOneByPolicyBizId
(
policyBizId
);
if
(
policyFollow
==
null
)
{
if
(
policyFollow
==
null
)
{
throw
new
BusinessException
(
"新单跟进信息不存在"
);
throw
new
BusinessException
(
"新单跟进信息不存在"
);
}
}
BeanUtils
.
copyProperties
(
apiProductPlanMainInfoDto
,
policyFollow
);
policyFollow
.
setReconciliationCompanyBizId
(
apiProductPlanMainInfoDto
.
getReconciliationCompanyId
());
//PolicyFollow 字段
policyFollow
.
setReconciliationCompany
(
apiProductPlanMainInfoDto
.
getReconciliationCompanyName
());
policyFollow
.
setProductLaunchBizId
(
dto
.
getProductLaunchBizId
());
policyFollow
.
setProductCate
(
apiProductPlanMainInfoDto
.
getInsuranceTypeName
());
policyFollow
.
setProductName
(
dto
.
getProductLaunchMainName
());
policyFollow
.
setCategoryCode
(
apiProductPlanMainInfoDto
.
getInsuranceTypeCode
());
policyFollow
.
setInsuranceCompany
(
dto
.
getCompanyName
());
policyFollow
.
setInsuranceCategoryBizId
(
apiProductPlanMainInfoDto
.
getInsuranceTypeId
());
policyFollow
.
setInsuranceCompanyBizId
(
dto
.
getCompanyId
());
policyFollow
.
setProductName
(
apiProductPlanMainInfoDto
.
getProductLaunchMainName
());
policyFollow
.
setReconciliationCompany
(
dto
.
getReconciliationCompanyName
());
policyFollow
.
setPrepaidTerm
(
apiProductPlanMainInfoDto
.
getIsPrepay
());
policyFollow
.
setReconciliationCompanyBizId
(
dto
.
getReconciliationCompanyId
());
policyFollow
.
setInsuranceCompanyBizId
(
apiProductPlanMainInfoDto
.
getCompanyId
());
policyFollow
.
setReconciliationCompanyCode
(
null
);
policyFollow
.
setInsuranceCompany
(
apiProductPlanMainInfoDto
.
getCompanyName
());
policyFollow
.
setProductCate
(
dto
.
getInsuranceTypeName
());
if
(
apiProductPlanMainInfoDto
.
getBacktrackDate
()
!=
null
)
{
policyFollow
.
setCategoryCode
(
dto
.
getInsuranceTypeCode
());
policyFollow
.
setRetroactiveDate
(
policyFollow
.
setInsuranceCategoryBizId
(
dto
.
getInsuranceTypeId
());
Date
.
from
(
apiProductPlanMainInfoDto
.
getBacktrackDate
()
policyFollow
.
setIssueNumber
(
dto
.
getIssueNumber
());
.
atZone
(
ZoneId
.
systemDefault
())
policyFollow
.
setGuaranteePeriod
(
parseInteger
(
dto
.
getGuaranteePeriod
()));
.
toInstant
())
policyFollow
.
setSumInsured
(
parseBigDecimal
(
dto
.
getSumInsured
()));
);
policyFollow
.
setPaymentFrequency
(
dto
.
getPaymentFrequency
());
policyFollow
.
setEachIssuePremium
(
eachIssuePremium
);
policyFollow
.
setIsPrepay
(
parseInteger
(
dto
.
getIsPrepay
()));
policyFollow
.
setIsTraceable
(
parseInteger
(
dto
.
getIsTraceable
()));
policyFollow
.
setPrepaidTerm
(
parseInteger
(
dto
.
getPrepaymentPeriod
()));
policyFollow
.
setPolicyCurrency
(
dto
.
getPolicyCurrency
());
policyFollow
.
setInitialPaymentMethod
(
dto
.
getInitialPaymentMethod
());
policyFollow
.
setRenewalPaymentMethod
(
dto
.
getRenewalPaymentMethod
());
policyFollow
.
setDividendDistributionMethod
(
dto
.
getDividendDistributionMethod
());
policyFollow
.
setPolicyLevy
(
parseString
(
dto
.
getPolicyLevy
()));
// 回溯日期处理
if
(
dto
.
getBacktrackDate
()
!=
null
)
{
policyFollow
.
setRetroactiveDate
(
Date
.
from
(
dto
.
getBacktrackDate
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()));
}
else
{
}
else
{
policyFollow
.
setRetroactiveDate
(
null
);
policyFollow
.
setRetroactiveDate
(
null
);
}
}
// // 先删除旧的附加险
policyFollow
.
setUpdateTime
(
now
);
// policyAdditionalService.remove(new QueryWrapper<PolicyAdditional>().eq("policy_biz_id", policyBizId));
policyFollowService
.
updateById
(
policyFollow
);
// // 保单附加险列表
// List<ApiProductPlanAdditionalInfoDto> apiProductPlanAdditionalInfoDtoList = policyUpdateRequest.getApiProductPlanAdditionalInfoDtoList();
// if (CollUtil.isNotEmpty(apiProductPlanAdditionalInfoDtoList)) {
// // 转换为实体类
// List<PolicyAdditional> policyAdditionalList = apiProductPlanAdditionalInfoDtoList.stream().map(additionalDto -> {
// PolicyAdditional policyAdditional = new PolicyAdditional();
// BeanUtils.copyProperties(additionalDto, policyAdditional);
//
// policyAdditional.setPolicyBizId(policyBizId);
// policyAdditional.setPolicyNo(policyNo);
// policyAdditional.setUpdateTime(now);
// policyAdditional.setCreateTime(now);
// return policyAdditional;
// }).collect(Collectors.toList());
// // 批量插入
// policyAdditionalService.saveBatch(policyAdditionalList);
// }
return
true
;
return
true
;
}
}
// 类型转换辅助方法
private
BigDecimal
parseBigDecimal
(
Object
obj
)
{
if
(
obj
==
null
)
return
null
;
if
(
obj
instanceof
BigDecimal
)
return
(
BigDecimal
)
obj
;
if
(
obj
instanceof
String
)
{
String
str
=
((
String
)
obj
).
trim
();
if
(
str
.
isEmpty
())
return
null
;
try
{
return
new
BigDecimal
(
str
);
}
catch
(
NumberFormatException
e
)
{
log
.
warn
(
"解析 BigDecimal 失败: {}"
,
str
);
return
null
;
}
}
if
(
obj
instanceof
Number
)
{
return
BigDecimal
.
valueOf
(((
Number
)
obj
).
doubleValue
());
}
return
null
;
}
private
Integer
parseInteger
(
Object
obj
)
{
if
(
obj
==
null
)
return
null
;
if
(
obj
instanceof
Integer
)
return
(
Integer
)
obj
;
if
(
obj
instanceof
String
)
{
String
str
=
((
String
)
obj
).
trim
();
if
(
str
.
isEmpty
())
return
null
;
try
{
return
Integer
.
valueOf
(
str
);
}
catch
(
NumberFormatException
e
)
{
log
.
warn
(
"解析 Integer 失败: {}"
,
str
);
return
null
;
}
}
if
(
obj
instanceof
Number
)
{
return
((
Number
)
obj
).
intValue
();
}
return
null
;
}
private
String
parseString
(
Object
obj
)
{
if
(
obj
==
null
)
return
null
;
if
(
obj
instanceof
String
)
{
String
str
=
((
String
)
obj
).
trim
();
return
str
.
isEmpty
()
?
null
:
str
;
}
return
obj
.
toString
();
}
private
BigDecimal
calculateTotalPaymentPremium
(
ApiProductPlanMainInfoDto
dto
)
{
private
BigDecimal
calculateTotalPaymentPremium
(
ApiProductPlanMainInfoDto
dto
)
{
// 校验每期保费(必填)
// 校验每期保费(必填)
BigDecimal
eachIssuePremium
=
dto
.
getEachIssuePremium
();
BigDecimal
eachIssuePremium
=
dto
.
getEachIssuePremium
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment