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
47748a80
Commit
47748a80
authored
Mar 19, 2026
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
来佣率分隔符拆分读取佣率
parent
f22d7605
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
327 additions
and
116 deletions
+327
-116
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
+8
-1
yd-csf-service/src/main/java/com/yd/csf/service/dto/PolicyFollowDto.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/helper/SpeciesConditionMatcher.java
+133
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyFollow.java
+5
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/SpeciesCondition.java
+47
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
+113
-92
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
+2
-20
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowDetailVO.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowVO.java
+6
-0
yd-csf-service/src/main/resources/mappers/PolicyFollowMapper.xml
+3
-2
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
View file @
47748a80
...
@@ -247,13 +247,20 @@ public class ApiCommissionExpectedController {
...
@@ -247,13 +247,20 @@ public class ApiCommissionExpectedController {
if
(
policy
==
null
)
{
if
(
policy
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"保单不存在"
);
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"保单不存在"
);
}
}
PolicyFollow
policyFollow
=
policyFollowService
.
lambdaQuery
().
eq
(
PolicyFollow:
:
getPolicyNo
,
request
.
getPolicyNo
()).
one
();
if
(
policyFollow
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"新单跟进不存在"
);
}
commissionExpectedService
.
getExpectedCommissionByProductlaunchId
(
commissionExpectedService
.
getExpectedCommissionByProductlaunchId
(
policy
,
policy
,
request
.
getProductLaunchBizId
(),
request
.
getProductLaunchBizId
(),
request
.
getInsuranceCompanyBizId
(),
request
.
getInsuranceCompanyBizId
(),
request
.
getReconciliationCompany
(),
request
.
getReconciliationCompany
(),
request
.
getReconciliationCompanyCode
(),
request
.
getReconciliationCompanyCode
(),
request
.
getReconciliationCompanyBizId
());
request
.
getReconciliationCompanyBizId
(),
policyFollow
.
getProfessionalInvestor
());
return
Result
.
success
(
true
);
return
Result
.
success
(
true
);
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/PolicyFollowDto.java
View file @
47748a80
...
@@ -239,4 +239,7 @@ public class PolicyFollowDto implements Serializable {
...
@@ -239,4 +239,7 @@ public class PolicyFollowDto implements Serializable {
@Schema
(
description
=
"保单类型: 1-电子, 2-纸质"
)
@Schema
(
description
=
"保单类型: 1-电子, 2-纸质"
)
private
String
policyType
;
private
String
policyType
;
@Schema
(
description
=
"专业投资者: Yes/No"
)
private
String
professionalInvestor
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/helper/SpeciesConditionMatcher.java
0 → 100644
View file @
47748a80
package
com
.
yd
.
csf
.
service
.
helper
;
import
org.apache.commons.lang3.StringUtils
;
import
java.math.BigDecimal
;
/**
* 规格条件匹配器
*/
public
class
SpeciesConditionMatcher
{
/**
* 判断条件是否匹配
* @param typeCode 条件类型代码
* @param conditionValue 配置的条件值
* @param actualValue 实际值
* @return true-匹配,false-不匹配
*/
public
static
boolean
matches
(
String
typeCode
,
String
conditionValue
,
Object
actualValue
)
{
if
(
StringUtils
.
isBlank
(
conditionValue
)
||
actualValue
==
null
)
{
return
false
;
}
String
actualValueStr
=
String
.
valueOf
(
actualValue
);
// 范围匹配类型
if
(
"AGE"
.
equals
(
typeCode
)
||
"PREMIUM"
.
equals
(
typeCode
))
{
return
matchesRange
(
conditionValue
,
actualValue
);
}
// 精确匹配类型(包括专业投资者,不区分大小写)
if
(
"PI"
.
equals
(
typeCode
))
{
return
conditionValue
.
equalsIgnoreCase
(
actualValueStr
);
}
// 其他类型精确匹配
return
conditionValue
.
equals
(
actualValueStr
);
}
/**
* 范围匹配
* 支持格式:
* - "0-10" 表示 [0, 10] 闭区间
* - "10-" 表示 >= 10
* - "-10" 表示 <= 10
* - "10" 表示等于 10
* - "0-64岁" 表示 [0, 64] 闭区间
*/
private
static
boolean
matchesRange
(
String
conditionValue
,
Object
actualValue
)
{
try
{
BigDecimal
actual
=
toBigDecimal
(
actualValue
);
// 解析范围表达式
String
expression
=
conditionValue
.
replace
(
"岁"
,
""
).
trim
();
if
(!
expression
.
contains
(
"-"
))
{
// 单个值 "10"
BigDecimal
value
=
new
BigDecimal
(
expression
);
return
actual
.
compareTo
(
value
)
==
0
;
}
String
[]
parts
=
expression
.
split
(
"-"
);
if
(
parts
.
length
!=
2
)
{
return
false
;
}
String
left
=
parts
[
0
].
trim
();
String
right
=
parts
[
1
].
trim
();
if
(
left
.
isEmpty
()
&&
right
.
isEmpty
())
{
// "-" 无效
return
false
;
}
else
if
(
left
.
isEmpty
())
{
// "-10" 表示 <= 10
BigDecimal
max
=
new
BigDecimal
(
right
);
return
actual
.
compareTo
(
max
)
<=
0
;
}
else
if
(
right
.
isEmpty
())
{
// "10-" 表示 >= 10
BigDecimal
min
=
new
BigDecimal
(
left
);
return
actual
.
compareTo
(
min
)
>=
0
;
}
else
{
// "0-10" 表示 [0, 10]
BigDecimal
min
=
new
BigDecimal
(
left
);
BigDecimal
max
=
new
BigDecimal
(
right
);
return
actual
.
compareTo
(
min
)
>=
0
&&
actual
.
compareTo
(
max
)
<=
0
;
}
}
catch
(
Exception
e
)
{
return
false
;
}
}
/**
* 将对象转换为 BigDecimal
*/
private
static
BigDecimal
toBigDecimal
(
Object
value
)
{
if
(
value
instanceof
BigDecimal
)
{
return
(
BigDecimal
)
value
;
}
if
(
value
instanceof
Number
)
{
return
new
BigDecimal
(
value
.
toString
());
}
// 处理 "0-64岁" 格式,提取第一个数字
String
str
=
String
.
valueOf
(
value
).
replace
(
"岁"
,
""
).
trim
();
if
(
str
.
contains
(
"-"
))
{
str
=
str
.
split
(
"-"
)[
0
];
}
return
new
BigDecimal
(
str
);
}
/**
* 获取条件名称
*/
public
static
String
getConditionName
(
String
typeCode
)
{
switch
(
typeCode
)
{
case
"PAYMENT_TERM"
:
return
"供款年期"
;
case
"RECONCILIATION_COMPANY"
:
return
"出单经纪公司"
;
case
"AGE"
:
return
"投保年龄"
;
case
"PREMIUM"
:
return
"期缴保费"
;
case
"PROFESSIONAL_INVESTOR"
:
return
"专业投资者"
;
case
"POLICY_CURRENCY"
:
return
"保单币种"
;
case
"PROTECTION_PERIOD"
:
return
"保障年期"
;
default
:
return
typeCode
;
}
}
}
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyFollow.java
View file @
47748a80
...
@@ -355,6 +355,11 @@ public class PolicyFollow implements Serializable {
...
@@ -355,6 +355,11 @@ public class PolicyFollow implements Serializable {
private
String
deliveryNo
;
private
String
deliveryNo
;
/**
/**
* 专业投资者: Yes/No
*/
private
String
professionalInvestor
;
/**
* 邮寄物品
* 邮寄物品
*/
*/
private
String
mailingItem
;
private
String
mailingItem
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/SpeciesCondition.java
0 → 100644
View file @
47748a80
package
com
.
yd
.
csf
.
service
.
model
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
/**
* 规格条件模型
*/
@Data
public
class
SpeciesCondition
{
/**
* 规格类型业务ID
*/
@JsonProperty
(
"speciesTypeBizId"
)
private
String
speciesTypeBizId
;
/**
* 条件类型编码
*/
@JsonProperty
(
"typeCode"
)
private
String
typeCode
;
/**
* 条件类型名称
*/
@JsonProperty
(
"typeName"
)
private
String
typeName
;
/**
* 条件值
*/
@JsonProperty
(
"value"
)
private
String
value
;
/**
* 是否为演示
*/
@JsonProperty
(
"isIllustration"
)
private
String
isIllustration
;
/**
* 演示URL
*/
@JsonProperty
(
"illustrationUrl"
)
private
String
illustrationUrl
;
}
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
View file @
47748a80
...
@@ -59,7 +59,7 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
...
@@ -59,7 +59,7 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
CommissionExpected
getByBizId
(
String
commissionExpectedBizId
);
CommissionExpected
getByBizId
(
String
commissionExpectedBizId
);
void
getExpectedCommissionByProductlaunchId
(
Policy
policy
,
String
productLaunchBizId
,
String
insuranceCompanyBizId
,
String
reconciliationCompany
,
String
reconciliationCompanyCode
,
String
reconciliationCompanyBizId
);
void
getExpectedCommissionByProductlaunchId
(
Policy
policy
,
String
productLaunchBizId
,
String
insuranceCompanyBizId
,
String
reconciliationCompany
,
String
reconciliationCompanyCode
,
String
reconciliationCompanyBizId
,
String
professionalInvestor
);
List
<
ApiExpectedSpeciesListResponse
>
queryExpectedSpeciesByFeign
(
String
productLaunchBizId
);
List
<
ApiExpectedSpeciesListResponse
>
queryExpectedSpeciesByFeign
(
String
productLaunchBizId
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
View file @
47748a80
...
@@ -25,6 +25,8 @@ import com.yd.csf.service.enums.CommissionExpectedStatusEnum;
...
@@ -25,6 +25,8 @@ import com.yd.csf.service.enums.CommissionExpectedStatusEnum;
import
com.yd.csf.service.model.*
;
import
com.yd.csf.service.model.*
;
import
com.yd.csf.service.service.*
;
import
com.yd.csf.service.service.*
;
import
com.yd.csf.service.dao.CommissionExpectedMapper
;
import
com.yd.csf.service.dao.CommissionExpectedMapper
;
import
com.yd.csf.service.model.SpeciesCondition
;
import
com.yd.csf.service.helper.SpeciesConditionMatcher
;
import
com.yd.csf.service.vo.CommissionExpectedStatisticsVO
;
import
com.yd.csf.service.vo.CommissionExpectedStatisticsVO
;
import
com.yd.csf.service.vo.CommissionExpectedVO
;
import
com.yd.csf.service.vo.CommissionExpectedVO
;
import
com.yd.csf.service.vo.ReceivableReportVO
;
import
com.yd.csf.service.vo.ReceivableReportVO
;
...
@@ -35,14 +37,12 @@ import com.yd.product.feign.client.announcementcommissionratio.ApiAnnouncementCo
...
@@ -35,14 +37,12 @@ import com.yd.product.feign.client.announcementcommissionratio.ApiAnnouncementCo
import
com.yd.product.feign.client.expectedspecies.ApiExpectedSpeciesFeignClient
;
import
com.yd.product.feign.client.expectedspecies.ApiExpectedSpeciesFeignClient
;
import
com.yd.product.feign.request.expectedspecies.ApiExpectedSpeciesListRequest
;
import
com.yd.product.feign.request.expectedspecies.ApiExpectedSpeciesListRequest
;
import
com.yd.product.feign.response.expectedspecies.ApiExpectedSpeciesListResponse
;
import
com.yd.product.feign.response.expectedspecies.ApiExpectedSpeciesListResponse
;
import
com.yd.user.feign.client.sysdict.ApiSysDictFeignClient
;
import
com.yd.user.feign.response.sysdict.GetDictItemListByDictTypeResponse
;
import
com.yd.user.feign.response.sysdict.GetDictItemListByDictTypeResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -75,8 +75,6 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -75,8 +75,6 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
private
CommissionService
commissionService
;
private
CommissionService
commissionService
;
@Resource
@Resource
private
ReceivableService
receivableService
;
private
ReceivableService
receivableService
;
@Autowired
private
ApiSysDictFeignClient
apiSysDictFeignClient
;
@Resource
@Resource
private
ApiExpectedSpeciesFeignClient
apiExpectedSpeciesFeignClient
;
private
ApiExpectedSpeciesFeignClient
apiExpectedSpeciesFeignClient
;
@Resource
@Resource
...
@@ -597,7 +595,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -597,7 +595,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
getExpectedCommissionByProductlaunchId
(
Policy
policy
,
String
productLaunchBizId
,
public
void
getExpectedCommissionByProductlaunchId
(
Policy
policy
,
String
productLaunchBizId
,
String
insuranceCompanyBizId
,
String
reconciliationCompany
,
String
reconciliationCompanyCode
,
String
reconciliationCompanyBizId
)
{
String
insuranceCompanyBizId
,
String
reconciliationCompany
,
String
reconciliationCompanyCode
,
String
reconciliationCompanyBizId
,
String
professionalInvestor
)
{
String
policyNo
=
policy
.
getPolicyNo
();
String
policyNo
=
policy
.
getPolicyNo
();
if
(
ObjectUtils
.
isEmpty
(
policyNo
))
{
if
(
ObjectUtils
.
isEmpty
(
policyNo
))
{
throw
new
BusinessException
(
"保单号不能为空"
);
throw
new
BusinessException
(
"保单号不能为空"
);
...
@@ -632,16 +630,14 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -632,16 +630,14 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
List
<
CommissionExpected
>
commissionExpectedList
=
new
ArrayList
<>();
List
<
CommissionExpected
>
commissionExpectedList
=
new
ArrayList
<>();
if
(
CollUtil
.
isNotEmpty
(
expectedSpeciesList
))
{
if
(
CollUtil
.
isNotEmpty
(
expectedSpeciesList
))
{
// 匹配规格并获取不匹配的条件
// 匹配规格并获取不匹配的条件
MatchResult
matchResult
=
matchExpectedSpecies
(
MatchResult
matchResult
=
matchExpectedSpecies
(
expectedSpeciesList
,
policy
,
professionalInvestor
);
expectedSpeciesList
,
paymentTerm
,
reconciliationCompanyBizId
,
policyHolderAge
,
paymentPremium
,
effectiveDate
,
policy
);
if
(
matchResult
.
getMatchedList
().
isEmpty
())
{
if
(
matchResult
.
getMatchedList
().
isEmpty
())
{
String
errorMsg
=
matchResult
.
getUnmatchedConditions
().
isEmpty
()
String
errorMsg
=
matchResult
.
getUnmatchedConditions
().
isEmpty
()
?
"未查询到
对应供款年期的佣金
规格"
?
"未查询到
预计来佣
规格"
:
"未查询到
对应供款年期的佣金
规格,不匹配条件:"
+
String
.
join
(
"、"
,
matchResult
.
getUnmatchedConditions
());
:
"未查询到
预计来佣
规格,不匹配条件:"
+
String
.
join
(
"、"
,
matchResult
.
getUnmatchedConditions
());
log
.
info
(
"未查询到
对应供款年期的佣金
规格,当前规格:{}"
,
JSONUtil
.
toJsonStr
(
expectedSpeciesList
));
log
.
info
(
"未查询到
预计来佣
规格,当前规格:{}"
,
JSONUtil
.
toJsonStr
(
expectedSpeciesList
));
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
errorMsg
);
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
errorMsg
);
}
}
...
@@ -727,61 +723,129 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -727,61 +723,129 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
* 匹配预计规格并返回不匹配的条件
* 匹配预计规格并返回不匹配的条件
*
*
* @param expectedSpeciesList 预计规格列表
* @param expectedSpeciesList 预计规格列表
* @param paymentTerm 供款年期
* @param policy 保单对象
* @param reconciliationCompanyId 对账公司ID
* @param policyHolderAge 保单持有人年龄
* @param paymentPremium 年缴保费
* @return 匹配结果
* @return 匹配结果
*/
*/
private
MatchResult
matchExpectedSpecies
(
List
<
ApiExpectedSpeciesListResponse
>
expectedSpeciesList
,
private
MatchResult
matchExpectedSpecies
(
String
paymentTerm
,
String
reconciliationCompanyId
,
List
<
ApiExpectedSpeciesListResponse
>
expectedSpeciesList
,
Integer
policyHolderAge
,
BigDecimal
paymentPremium
,
Date
effectiveDate
,
Policy
policy
)
{
Policy
policy
,
String
professionalInvestor
)
{
List
<
String
>
unmatchedConditions
=
new
ArrayList
<>();
List
<
String
>
unmatchedConditions
=
new
ArrayList
<>();
List
<
ApiExpectedSpeciesListResponse
>
currentList
=
expectedSpeciesList
;
// 检查供款年期
// 1. 生效日期独立验证(第一步)
currentList
=
filterAndCheck
(
currentList
,
Date
effectiveDate
=
policy
.
getEffectiveDate
();
i
->
paymentTerm
.
equals
(
i
.
getPaymentTerm
()),
List
<
ApiExpectedSpeciesListResponse
>
validDateList
=
filterAndCheck
(
unmatchedConditions
,
"供款年期["
+
paymentTerm
+
"]"
);
expectedSpeciesList
,
if
(
unmatchedConditions
.
size
()
>
0
)
{
i
->
isEffective
(
i
.
getEffectiveStart
(),
i
.
getEffectiveEnd
(),
effectiveDate
),
unmatchedConditions
,
"生效日期["
+
DateUtil
.
format
(
effectiveDate
,
"yyyy-MM-dd"
)
+
"]"
);
if
(!
unmatchedConditions
.
isEmpty
())
{
return
new
MatchResult
(
Collections
.
emptyList
(),
unmatchedConditions
);
return
new
MatchResult
(
Collections
.
emptyList
(),
unmatchedConditions
);
}
}
// 检查对账公司
if
(
validDateList
.
isEmpty
())
{
currentList
=
filterAndCheck
(
currentList
,
return
new
MatchResult
(
Collections
.
emptyList
(),
Collections
.
emptyList
());
i
->
reconciliationCompanyId
.
equals
(
i
.
getReconciliationCompany
()),
unmatchedConditions
,
"对账公司["
+
policy
.
getReconciliationCompany
()
+
"]"
);
if
(
unmatchedConditions
.
size
()
>
0
)
{
return
new
MatchResult
(
Collections
.
emptyList
(),
unmatchedConditions
);
}
}
// 检查年龄
// 2. 获取第一个规格的条件模板
currentList
=
filterAndCheck
(
currentList
,
String
firstSpeciesJson
=
validDateList
.
get
(
0
).
getSpeciesJson
();
i
->
containsValue
(
i
.
getSpeciesJson
(),
"AGE"
,
Convert
.
toStr
(
policyHolderAge
)),
List
<
SpeciesCondition
>
conditionTemplates
=
parseSpeciesJson
(
firstSpeciesJson
);
unmatchedConditions
,
"年龄["
+
policyHolderAge
+
"]"
);
if
(
unmatchedConditions
.
size
()
>
0
)
{
log
.
info
(
"当前佣金匹配条件: {}"
,
JSONUtil
.
toJsonStr
(
conditionTemplates
));
return
new
MatchResult
(
Collections
.
emptyList
(),
unmatchedConditions
);
if
(
conditionTemplates
.
isEmpty
())
{
// 没有配置任何条件,返回所有日期验证通过的规格
return
new
MatchResult
(
validDateList
,
Collections
.
emptyList
());
}
}
// 检查保费
// 4. 构建实际值映射
currentList
=
filterAndCheck
(
currentList
,
Map
<
String
,
Object
>
actualValues
=
buildActualValuesMap
(
policy
,
professionalInvestor
);
i
->
containsValue
(
i
.
getSpeciesJson
(),
"PREMIUM"
,
Convert
.
toStr
(
paymentPremium
)),
unmatchedConditions
,
"保费["
+
paymentPremium
+
"]"
);
// 检查生效日期
// 5. 逐个条件类型进行过滤
log
.
info
(
"检查生效日期的effectiveDate生效日期:{}"
,
effectiveDate
);
List
<
ApiExpectedSpeciesListResponse
>
currentList
=
validDateList
;
currentList
=
filterAndCheck
(
currentList
,
i
->
isEffective
(
i
.
getEffectiveStart
(),
i
.
getEffectiveEnd
(),
effectiveDate
),
for
(
SpeciesCondition
conditionTemplate
:
conditionTemplates
)
{
unmatchedConditions
,
"生效日期["
+
DateUtil
.
format
(
effectiveDate
,
"yyyy-MM-dd"
)
+
"]"
);
String
typeCode
=
conditionTemplate
.
getTypeCode
();
log
.
info
(
"检查生效日期的currentList:{}"
,
JSON
.
toJSONString
(
currentList
));
Object
actualValue
=
actualValues
.
get
(
typeCode
);
log
.
info
(
"检查生效日期的unmatchedConditions:{}"
,
JSON
.
toJSONString
(
unmatchedConditions
));
if
(
unmatchedConditions
.
size
()
>
0
)
{
String
conditionDesc
=
String
.
format
(
"%s[%s]"
,
return
new
MatchResult
(
Collections
.
emptyList
(),
unmatchedConditions
);
SpeciesConditionMatcher
.
getConditionName
(
typeCode
),
actualValue
);
currentList
=
filterBySpeciesCondition
(
currentList
,
typeCode
,
actualValue
,
unmatchedConditions
,
conditionDesc
);
if
(!
unmatchedConditions
.
isEmpty
())
{
return
new
MatchResult
(
Collections
.
emptyList
(),
unmatchedConditions
);
}
}
}
return
new
MatchResult
(
currentList
,
unmatchedConditions
);
return
new
MatchResult
(
currentList
,
unmatchedConditions
);
}
}
/**
* 解析speciesJson
*/
private
List
<
SpeciesCondition
>
parseSpeciesJson
(
String
speciesJson
)
{
if
(
speciesJson
==
null
||
speciesJson
.
trim
().
isEmpty
())
{
return
Collections
.
emptyList
();
}
try
{
return
objectMapper
.
readValue
(
speciesJson
,
new
TypeReference
<
List
<
SpeciesCondition
>>()
{});
}
catch
(
IOException
e
)
{
log
.
error
(
"解析speciesJson失败: {}"
,
speciesJson
,
e
);
return
Collections
.
emptyList
();
}
}
/**
* 构建实际值映射
*/
private
Map
<
String
,
Object
>
buildActualValuesMap
(
Policy
policy
,
String
professionalInvestor
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"PAYMENT_TERM"
,
policy
.
getPaymentTerm
()
!=
null
?
String
.
valueOf
(
policy
.
getPaymentTerm
())
:
null
);
map
.
put
(
"RECONCILIATION_COMPANY"
,
policy
.
getReconciliationCompanyBizId
());
map
.
put
(
"AGE"
,
policy
.
getPolicyHolderAge
());
map
.
put
(
"PREMIUM"
,
policy
.
getPaymentPremium
());
map
.
put
(
"PI"
,
professionalInvestor
);
map
.
put
(
"POLICY_CURRENCY"
,
policy
.
getCurrency
());
map
.
put
(
"PROTECTION_PERIOD"
,
policy
.
getGuaranteePeriod
());
return
map
;
}
/**
* 根据species条件过滤列表
*/
private
List
<
ApiExpectedSpeciesListResponse
>
filterBySpeciesCondition
(
List
<
ApiExpectedSpeciesListResponse
>
list
,
String
typeCode
,
Object
actualValue
,
List
<
String
>
unmatchedConditions
,
String
conditionDesc
)
{
List
<
ApiExpectedSpeciesListResponse
>
filtered
=
list
.
stream
()
.
filter
(
item
->
{
List
<
SpeciesCondition
>
conditions
=
parseSpeciesJson
(
item
.
getSpeciesJson
());
if
(
conditions
.
isEmpty
())
return
false
;
return
conditions
.
stream
()
.
anyMatch
(
c
->
typeCode
.
equals
(
c
.
getTypeCode
())
&&
SpeciesConditionMatcher
.
matches
(
typeCode
,
c
.
getValue
(),
actualValue
));
})
.
collect
(
Collectors
.
toList
());
if
(
filtered
.
isEmpty
())
{
unmatchedConditions
.
add
(
conditionDesc
);
}
return
filtered
;
}
private
boolean
isEffective
(
LocalDateTime
effectiveStart
,
LocalDateTime
effectiveEnd
,
Date
effectiveDate
)
{
private
boolean
isEffective
(
LocalDateTime
effectiveStart
,
LocalDateTime
effectiveEnd
,
Date
effectiveDate
)
{
LocalDateTime
effectiveDateLocal
=
effectiveDate
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
();
LocalDateTime
effectiveDateLocal
=
effectiveDate
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
();
return
effectiveDateLocal
.
isAfter
(
effectiveStart
)
&&
effectiveDateLocal
.
isBefore
(
effectiveEnd
);
return
effectiveDateLocal
.
isAfter
(
effectiveStart
)
&&
effectiveDateLocal
.
isBefore
(
effectiveEnd
);
...
@@ -809,49 +873,6 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -809,49 +873,6 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
return
filtered
;
return
filtered
;
}
}
private
static
boolean
containsValue
(
String
json
,
String
targetKey
,
String
targetValue
)
{
if
(
json
==
null
||
json
.
trim
().
isEmpty
())
return
false
;
try
{
List
<
Map
<
String
,
Object
>>
params
=
objectMapper
.
readValue
(
json
,
new
TypeReference
<
List
<
Map
<
String
,
Object
>>>()
{});
// AGE 和 PREMIUM 使用最小值匹配(targetValue >= value)
if
(
targetKey
.
equals
(
"AGE"
)
||
targetKey
.
equals
(
"PREMIUM"
))
{
return
params
.
stream
().
anyMatch
(
p
->
{
Object
value
=
p
.
get
(
"value"
);
if
(
value
==
null
)
{
return
false
;
}
// 转换为 BigDecimal
BigDecimal
threshold
;
if
(
value
instanceof
BigDecimal
)
{
threshold
=
(
BigDecimal
)
value
;
}
else
if
(
value
instanceof
Number
)
{
threshold
=
BigDecimal
.
valueOf
(((
Number
)
value
).
doubleValue
());
}
else
if
(
value
instanceof
String
)
{
try
{
threshold
=
new
BigDecimal
((
String
)
value
);
}
catch
(
NumberFormatException
e
)
{
return
false
;
}
}
else
{
return
false
;
}
// 判断是否大于等于最小值
return
new
BigDecimal
(
targetValue
).
compareTo
(
threshold
)
>=
0
;
});
}
// 其他字段使用等于匹配
else
{
return
params
.
stream
().
anyMatch
(
p
->
targetValue
.
equals
(
p
.
get
(
"value"
)));
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
@Override
@Override
public
List
<
ApiExpectedSpeciesListResponse
>
queryExpectedSpeciesByFeign
(
String
productLaunchBizId
)
{
public
List
<
ApiExpectedSpeciesListResponse
>
queryExpectedSpeciesByFeign
(
String
productLaunchBizId
)
{
ApiExpectedSpeciesListRequest
apiExpectedSpeciesListRequest
=
new
ApiExpectedSpeciesListRequest
();
ApiExpectedSpeciesListRequest
apiExpectedSpeciesListRequest
=
new
ApiExpectedSpeciesListRequest
();
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
View file @
47748a80
...
@@ -527,25 +527,6 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -527,25 +527,6 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
//冷静期结束日期
//冷静期结束日期
policy
.
setCoolingOffEndDate
(
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
!=
null
?
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
:
policy
.
getCoolingOffEndDate
());
policy
.
setCoolingOffEndDate
(
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
!=
null
?
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
:
policy
.
getCoolingOffEndDate
());
// if (ObjectUtils.isEmpty(policy.getInsuranceCompany()) || ObjectUtils.isEmpty(policy.getInsuranceCompanyBizId())) {
// // 获取保单产品信息,填充对账公司相关字段
// PolicyProductInfo productInfo = getPolicyProductInfo(policyFollow.getProductLaunchBizId());
// if (productInfo != null) {
// if (ObjectUtils.isNotEmpty(productInfo.getInsuranceCompany())) {
// policy.setInsuranceCompany(productInfo.getInsuranceCompany());
// }
// if (ObjectUtils.isNotEmpty(productInfo.getInsuranceCompanyBizId())) {
// policy.setInsuranceCompanyBizId(productInfo.getInsuranceCompanyBizId());
// }
// if (ObjectUtils.isNotEmpty(productInfo.getReconciliationCompanyBizId())) {
// policy.setReconciliationCompany(productInfo.getReconciliationCompany());
// }
// if (ObjectUtils.isNotEmpty(productInfo.getReconciliationCompanyBizId())) {
// policy.setReconciliationCompanyBizId(productInfo.getReconciliationCompanyBizId());
// }
// }
// }
// 保存保单
// 保存保单
policyService
.
updateById
(
policy
);
policyService
.
updateById
(
policy
);
...
@@ -1013,7 +994,8 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1013,7 +994,8 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
insuranceCompanyBizId
,
insuranceCompanyBizId
,
reconciliationCompany
,
reconciliationCompany
,
reconciliationCompanyCode
,
reconciliationCompanyCode
,
reconciliationCompanyBizId
reconciliationCompanyBizId
,
policyFollow
.
getProfessionalInvestor
()
);
);
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowDetailVO.java
View file @
47748a80
...
@@ -514,6 +514,12 @@ public class PolicyFollowDetailVO implements Serializable {
...
@@ -514,6 +514,12 @@ public class PolicyFollowDetailVO implements Serializable {
@Schema
(
description
=
"保单类型: 1-电子, 2-纸质"
)
@Schema
(
description
=
"保单类型: 1-电子, 2-纸质"
)
private
String
policyType
;
private
String
policyType
;
/**
* 专业投资者: Yes/No
*/
@Schema
(
description
=
"专业投资者: Yes/No"
)
private
String
professionalInvestor
;
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowVO.java
View file @
47748a80
...
@@ -141,6 +141,12 @@ public class PolicyFollowVO implements Serializable {
...
@@ -141,6 +141,12 @@ public class PolicyFollowVO implements Serializable {
private
String
policyType
;
private
String
policyType
;
/**
/**
* 专业投资者: Yes/No
*/
@Schema
(
description
=
"专业投资者: Yes/No"
)
private
String
professionalInvestor
;
/**
* 邮寄物品
* 邮寄物品
*/
*/
@Schema
(
description
=
"邮寄物品"
)
@Schema
(
description
=
"邮寄物品"
)
...
...
yd-csf-service/src/main/resources/mappers/PolicyFollowMapper.xml
View file @
47748a80
...
@@ -75,6 +75,7 @@
...
@@ -75,6 +75,7 @@
<result
property=
"brokerSignDate"
column=
"broker_sign_date"
/>
<result
property=
"brokerSignDate"
column=
"broker_sign_date"
/>
<result
property=
"insurerMailingDate"
column=
"insurer_mailing_date"
/>
<result
property=
"insurerMailingDate"
column=
"insurer_mailing_date"
/>
<result
property=
"customerSignDate"
column=
"customer_sign_date"
/>
<result
property=
"customerSignDate"
column=
"customer_sign_date"
/>
<result
property=
"professionalInvestor"
column=
"professional_investor"
/>
<result
property=
"attachments"
column=
"attachments"
/>
<result
property=
"attachments"
column=
"attachments"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"isDeleted"
column=
"is_deleted"
/>
<result
property=
"isDeleted"
column=
"is_deleted"
/>
...
@@ -99,8 +100,8 @@
...
@@ -99,8 +100,8 @@
initial_premium,initial_premium_total,initial_payment_status,initial_premium_discount,
initial_premium,initial_premium_total,initial_payment_status,initial_premium_discount,
mailing_method,renewal_payment_method,dividend_distribution_method,delivery_no,
mailing_method,renewal_payment_method,dividend_distribution_method,delivery_no,
policy_levy,initial_premium_paid,initial_premium_due,latest_payment_date,broker_sign_date,
policy_levy,initial_premium_paid,initial_premium_due,latest_payment_date,broker_sign_date,
insurer_mailing_date,customer_sign_date,attachments,remark,is_deleted,
insurer_mailing_date,customer_sign_date,
professional_investor,
attachments,remark,is_deleted,
creator_id,updater_id,create_time,update_time,policy_type
creator_id,updater_id,create_time,update_time,policy_type
,is_join
</sql>
</sql>
<select
id=
"queryPolicyReportData"
resultType=
"com.yd.csf.service.dto.PolicyReportData"
>
<select
id=
"queryPolicyReportData"
resultType=
"com.yd.csf.service.dto.PolicyReportData"
>
...
...
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