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
7f0a3723
Commit
7f0a3723
authored
Mar 24, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/test' into test
parents
2ca33ebb
573a4dc7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
18 deletions
+89
-18
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
+9
-2
yd-csf-service/src/main/java/com/yd/csf/service/helper/SpeciesConditionMatcher.java
+9
-9
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
+2
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
+69
-6
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
View file @
7f0a3723
...
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -399,11 +400,17 @@ public class ApiCommissionExpectedController {
...
@@ -399,11 +400,17 @@ public class ApiCommissionExpectedController {
@GetMapping
(
"/test_expected_commission"
)
@GetMapping
(
"/test_expected_commission"
)
@Operation
(
summary
=
"测试佣金匹配"
)
@Operation
(
summary
=
"测试佣金匹配"
)
public
Result
<
Boolean
>
testExpectedCommission
(
@RequestParam
(
"policyNo"
)
String
policyNo
)
{
public
Result
<
Boolean
>
testExpectedCommission
(
@RequestParam
(
"policyNo"
)
String
policyNo
,
@RequestParam
(
"effectiveDate"
)
String
effectiveDate
,
@RequestParam
(
"coolingOffEndDate"
)
String
coolingOffEndDate
)
{
if
(
StringUtils
.
isBlank
(
policyNo
))
{
if
(
StringUtils
.
isBlank
(
policyNo
))
{
return
Result
.
fail
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"policyNo不能为空"
);
return
Result
.
fail
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"policyNo不能为空"
);
}
}
commissionExpectedService
.
testExpectedCommission
(
policyNo
);
try
{
commissionExpectedService
.
testExpectedCommission
(
policyNo
,
effectiveDate
,
coolingOffEndDate
);
}
catch
(
IOException
e
)
{
return
Result
.
fail
(
ResultCode
.
FAIL
.
getCode
(),
"读取文件失败"
);
}
return
Result
.
success
(
true
);
return
Result
.
success
(
true
);
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/helper/SpeciesConditionMatcher.java
View file @
7f0a3723
...
@@ -40,11 +40,11 @@ public class SpeciesConditionMatcher {
...
@@ -40,11 +40,11 @@ public class SpeciesConditionMatcher {
/**
/**
* 范围匹配
* 范围匹配
* 支持格式:
* 支持格式:
* - "0-10" 表示
[0, 10]
闭区间
* - "0-10" 表示
(0, 10] 左开右
闭区间
* - "10-" 表示 >
=
10
* - "10-" 表示 > 10
* - "-10" 表示 <= 10
* - "-10" 表示 <= 10
* - "10" 表示等于 10
* - "10" 表示等于 10
* - "0-64岁" 表示
[0, 64]
闭区间
* - "0-64岁" 表示
(0, 64] 左开右
闭区间
*/
*/
private
static
boolean
matchesRange
(
String
conditionValue
,
Object
actualValue
)
{
private
static
boolean
matchesRange
(
String
conditionValue
,
Object
actualValue
)
{
try
{
try
{
...
@@ -59,7 +59,7 @@ public class SpeciesConditionMatcher {
...
@@ -59,7 +59,7 @@ public class SpeciesConditionMatcher {
return
actual
.
compareTo
(
value
)
==
0
;
return
actual
.
compareTo
(
value
)
==
0
;
}
}
String
[]
parts
=
expression
.
split
(
"-"
);
String
[]
parts
=
expression
.
split
(
"-"
,
-
1
);
if
(
parts
.
length
!=
2
)
{
if
(
parts
.
length
!=
2
)
{
return
false
;
return
false
;
}
}
...
@@ -75,14 +75,14 @@ public class SpeciesConditionMatcher {
...
@@ -75,14 +75,14 @@ public class SpeciesConditionMatcher {
BigDecimal
max
=
new
BigDecimal
(
right
);
BigDecimal
max
=
new
BigDecimal
(
right
);
return
actual
.
compareTo
(
max
)
<=
0
;
return
actual
.
compareTo
(
max
)
<=
0
;
}
else
if
(
right
.
isEmpty
())
{
}
else
if
(
right
.
isEmpty
())
{
// "10-" 表示 >
=
10
// "10-" 表示 > 10
BigDecimal
min
=
new
BigDecimal
(
left
);
BigDecimal
min
=
new
BigDecimal
(
left
);
return
actual
.
compareTo
(
min
)
>
=
0
;
return
actual
.
compareTo
(
min
)
>
0
;
}
else
{
}
else
{
// "0-10" 表示
[
0, 10]
// "0-10" 表示
(
0, 10]
BigDecimal
min
=
new
BigDecimal
(
left
);
BigDecimal
min
=
new
BigDecimal
(
left
);
BigDecimal
max
=
new
BigDecimal
(
right
);
BigDecimal
max
=
new
BigDecimal
(
right
);
return
actual
.
compareTo
(
min
)
>
=
0
&&
actual
.
compareTo
(
max
)
<=
0
;
return
actual
.
compareTo
(
min
)
>
0
&&
actual
.
compareTo
(
max
)
<=
0
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
false
;
return
false
;
...
@@ -124,7 +124,7 @@ public class SpeciesConditionMatcher {
...
@@ -124,7 +124,7 @@ public class SpeciesConditionMatcher {
return
"专业投资者"
;
return
"专业投资者"
;
case
"POLICY_CURRENCY"
:
case
"POLICY_CURRENCY"
:
return
"保单币种"
;
return
"保单币种"
;
case
"
PROTECTION
_PERIOD"
:
case
"
GUARANTEE
_PERIOD"
:
return
"保障年期"
;
return
"保障年期"
;
default
:
default
:
return
typeCode
;
return
typeCode
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
View file @
7f0a3723
...
@@ -14,6 +14,7 @@ import com.yd.csf.service.vo.CommissionExpectedVO;
...
@@ -14,6 +14,7 @@ import com.yd.csf.service.vo.CommissionExpectedVO;
import
com.yd.csf.service.vo.ReceivableReportVO
;
import
com.yd.csf.service.vo.ReceivableReportVO
;
import
com.yd.product.feign.response.expectedspecies.ApiExpectedSpeciesListResponse
;
import
com.yd.product.feign.response.expectedspecies.ApiExpectedSpeciesListResponse
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -79,5 +80,5 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
...
@@ -79,5 +80,5 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
*/
*/
IPage
<
ReceivableReportVO
>
receivableReportPage
(
Page
<
ReceivableReportVO
>
page
,
List
<
Long
>
expectedIds
);
IPage
<
ReceivableReportVO
>
receivableReportPage
(
Page
<
ReceivableReportVO
>
page
,
List
<
Long
>
expectedIds
);
void
testExpectedCommission
(
String
policyNo
)
;
void
testExpectedCommission
(
String
policyNo
,
String
effectiveDate
,
String
coolingOffEndDate
)
throws
IOException
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
View file @
7f0a3723
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
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.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
...
@@ -22,6 +24,7 @@ import com.yd.common.utils.RedisUtil;
...
@@ -22,6 +24,7 @@ import com.yd.common.utils.RedisUtil;
import
com.yd.csf.service.component.ReceivableService
;
import
com.yd.csf.service.component.ReceivableService
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.enums.CommissionExpectedStatusEnum
;
import
com.yd.csf.service.enums.CommissionExpectedStatusEnum
;
import
com.yd.csf.service.enums.PolicyStatusEnum
;
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
;
...
@@ -43,13 +46,16 @@ import org.apache.commons.collections4.CollectionUtils;
...
@@ -43,13 +46,16 @@ 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.core.io.ClassPathResource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StreamUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
...
@@ -85,6 +91,8 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -85,6 +91,8 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
private
ApiExchangeRateFeignClient
apiExchangeRateFeignClient
;
private
ApiExchangeRateFeignClient
apiExchangeRateFeignClient
;
@Resource
@Resource
private
ApiInsuranceReconciliationCompanyFeignClient
companyFeignClient
;
private
ApiInsuranceReconciliationCompanyFeignClient
companyFeignClient
;
@Resource
private
CustomerService
customerService
;
// 用于对象转换的ObjectMapper
// 用于对象转换的ObjectMapper
private
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
private
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
...
@@ -817,7 +825,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -817,7 +825,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
map
.
put
(
"PREMIUM"
,
policy
.
getPaymentPremium
());
map
.
put
(
"PREMIUM"
,
policy
.
getPaymentPremium
());
map
.
put
(
"PROFESSIONAL"
,
professionalInvestor
);
map
.
put
(
"PROFESSIONAL"
,
professionalInvestor
);
map
.
put
(
"POLICY_CURRENCY"
,
policy
.
getCurrency
());
map
.
put
(
"POLICY_CURRENCY"
,
policy
.
getCurrency
());
map
.
put
(
"
PROTECTION
_PERIOD"
,
policy
.
getGuaranteePeriod
());
map
.
put
(
"
GUARANTEE
_PERIOD"
,
policy
.
getGuaranteePeriod
());
map
.
put
(
"PROTECTION_PLAN"
,
policy
.
getProductName
());
map
.
put
(
"PROTECTION_PLAN"
,
policy
.
getProductName
());
return
map
;
return
map
;
}
}
...
@@ -990,16 +998,29 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -990,16 +998,29 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
}
}
@Override
@Override
public
void
testExpectedCommission
(
String
policyNo
)
{
public
void
testExpectedCommission
(
String
policyNo
,
String
effectiveDate
,
String
coolingOffEndDate
)
throws
IOException
{
Policy
policy
=
policyService
.
queryOne
(
policyNo
);
Policy
Follow
policyFollow
=
policyFollowService
.
queryOneByPolicyNo
(
policyNo
);
String
productLaunchBizId
=
policy
.
getProductLaunchBizId
();
String
productLaunchBizId
=
policy
Follow
.
getProductLaunchBizId
();
if
(
StringUtils
.
isNotBlank
(
productLaunchBizId
))
{
if
(
StringUtils
.
isNotBlank
(
productLaunchBizId
))
{
Policy
policy
=
convertPolicy
(
policyFollow
,
effectiveDate
,
coolingOffEndDate
);
PolicyFollow
policyFollow
=
policyFollowService
.
queryOneByPolicyNo
(
policyNo
);
String
professionalInvestor
=
policyFollow
.
getProfessionalInvestor
();
String
professionalInvestor
=
policyFollow
.
getProfessionalInvestor
();
List
<
ApiExpectedSpeciesListResponse
>
expectedSpeciesList
=
queryExpectedSpeciesByFeign
(
productLaunchBizId
);
// List<ApiExpectedSpeciesListResponse> expectedSpeciesList = queryExpectedSpeciesByFeign(productLaunchBizId);
List
<
ApiExpectedSpeciesListResponse
>
expectedSpeciesList
=
new
ArrayList
<>();
// 读取text
try
{
ClassPathResource
resource
=
new
ClassPathResource
(
"TestExpectedSpecies.txt"
);
String
text
=
StreamUtils
.
copyToString
(
resource
.
getInputStream
(),
StandardCharsets
.
UTF_8
);
expectedSpeciesList
=
JSONUtil
.
toList
(
text
,
ApiExpectedSpeciesListResponse
.
class
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"初始化预期来佣规格列表失败"
,
e
);
}
if
(
CollUtil
.
isNotEmpty
(
expectedSpeciesList
))
{
if
(
CollUtil
.
isNotEmpty
(
expectedSpeciesList
))
{
// 匹配规格并获取不匹配的条件
// 匹配规格并获取不匹配的条件
CommissionExpectedServiceImpl
.
MatchResult
matchResult
=
matchExpectedSpecies
(
expectedSpeciesList
,
policy
,
professionalInvestor
);
CommissionExpectedServiceImpl
.
MatchResult
matchResult
=
matchExpectedSpecies
(
expectedSpeciesList
,
policy
,
professionalInvestor
);
...
@@ -1017,6 +1038,48 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -1017,6 +1038,48 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
}
}
}
}
private
Policy
convertPolicy
(
PolicyFollow
policyFollow
,
String
effectiveDate
,
String
coolingOffEndDate
)
{
Policy
policy
=
new
Policy
();
BeanUtil
.
copyProperties
(
policyFollow
,
policy
);
policy
.
setPolicyNo
(
policyFollow
.
getPolicyNo
());
policy
.
setPolicyHolderAge
(
calculatePolicyHolderAge
(
policyFollow
.
getCustomerBizId
()));
policy
.
setCoolingOffEndDate
(
policyFollow
.
getCoolingOffEndDate
());
policy
.
setReconciliationCompanyBizId
(
policyFollow
.
getReconciliationCompanyBizId
());
policy
.
setReconciliationCompanyCode
(
policyFollow
.
getReconciliationCompanyCode
());
policy
.
setReconciliationCompany
(
policyFollow
.
getReconciliationCompany
());
policy
.
setInsuranceCompanyBizId
(
policyFollow
.
getInsuranceCompanyBizId
());
policy
.
setInsuranceCompany
(
policyFollow
.
getInsuranceCompany
());
policy
.
setProductName
(
policyFollow
.
getProductName
());
// 更新保单状态为生效
policy
.
setStatus
(
PolicyStatusEnum
.
INFORCE
.
getItemValue
());
// 手动映射不同名的字段
policy
.
setPaymentPremium
(
policyFollow
.
getInitialPremium
());
policy
.
setCurrency
(
policyFollow
.
getPolicyCurrency
());
policy
.
setPaymentTerm
(
policyFollow
.
getIssueNumber
());
log
.
info
(
"effectiveDate:{}"
,
DateUtil
.
parse
(
effectiveDate
,
DatePattern
.
NORM_DATE_PATTERN
));
policy
.
setEffectiveDate
(
DateUtil
.
parse
(
effectiveDate
,
DatePattern
.
NORM_DATE_PATTERN
));
//冷静期结束日期
log
.
info
(
"coolingOffEndDate:{}"
,
DateUtil
.
parse
(
coolingOffEndDate
,
DatePattern
.
NORM_DATE_PATTERN
));
policy
.
setCoolingOffEndDate
(
DateUtil
.
parse
(
coolingOffEndDate
,
DatePattern
.
NORM_DATE_PATTERN
));
return
policy
;
}
private
Integer
calculatePolicyHolderAge
(
String
customerBizId
)
{
Customer
customer
=
customerService
.
getByCustomerBizId
(
customerBizId
);
if
(
customer
==
null
)
{
throw
new
BusinessException
(
"客户不存在"
);
}
if
(
customer
.
getBirthday
()
==
null
)
{
throw
new
BusinessException
(
"客户生日不能为空"
);
}
// 根据生日计算年龄
return
DateUtil
.
ageOfNow
(
customer
.
getBirthday
());
}
}
}
...
...
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