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
070e3f87
Commit
070e3f87
authored
May 19, 2026
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
出账检核-增加币种84
parent
d790d8c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
42 deletions
+36
-42
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+36
-42
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
070e3f87
...
...
@@ -94,6 +94,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
private
ApiExpectedFortuneService
getSelf
()
{
return
applicationContext
.
getBean
(
ApiExpectedFortuneService
.
class
);
}
@Autowired
private
TransactionTemplate
transactionTemplate
;
@Autowired
...
...
@@ -480,28 +481,36 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
ApiAnnouncementCommissionRatioListResponse
announcementRatio
=
announcementRatioList
.
get
(
0
);
String
currency
=
announcementRatio
.
getCurrency
();
log
.
info
(
"结算币种:{}"
,
currency
);
log
.
info
(
"结算币种
(发放币种)
:{}"
,
currency
);
BigDecimal
exchangeRate
=
queryExchangeRateByFeign
(
policyCurrency
,
currency
);
BigDecimal
originalToHkdRate
=
queryExchangeRateByFeign
(
policyCurrency
,
"HKD"
);
log
.
info
(
"结算汇率(原币种 -> 港币汇率):{}"
,
originalToHkdRate
);
log
.
info
(
"结算汇率:{}"
,
exchangeRate
);
BigDecimal
hkdToPayoutRate
=
queryExchangeRateByFeign
(
"HKD"
,
currency
);
log
.
info
(
"港币 -> 发放币种汇率:{}"
,
hkdToPayoutRate
);
for
(
ExpectedFortune
expectedFortune
:
expectedFortuneList
)
{
ExpectedFortune
updateObj
=
new
ExpectedFortune
();
updateObj
.
setId
(
expectedFortune
.
getId
());
//原币种
updateObj
.
setOriginalCurrency
(
c
urrency
);
updateObj
.
setOriginalCurrency
(
policyC
urrency
);
//原币种金额
updateObj
.
setOriginalAmount
(
expectedFortune
.
getRuleAmount
());
//原币种 -> 港币汇率
updateObj
.
setOriginalToHkdRate
(
exchange
Rate
);
updateObj
.
setOriginalToHkdRate
(
originalToHkd
Rate
);
//保单币种
updateObj
.
setRuleCurrency
(
currency
);
//默认保单币种 -> 港币汇率
updateObj
.
setDefaultExchangeRate
(
exchange
Rate
);
updateObj
.
setDefaultExchangeRate
(
originalToHkd
Rate
);
//港币金额(标准发佣金额 * 默认保单币种 -> 港币汇率)
updateObj
.
setHkdAmount
(
expectedFortune
.
getRuleAmount
().
multiply
(
exchangeRate
));
updateObj
.
setHkdAmount
(
expectedFortune
.
getRuleAmount
().
multiply
(
originalToHkdRate
));
//发放币种
updateObj
.
setPayoutCurrency
(
currency
);
//发放币种金额
updateObj
.
setPayoutAmount
(
expectedFortune
.
getHkdAmount
().
multiply
(
hkdToPayoutRate
));
//港币 -> 发放币种汇率
updateObj
.
setHkdToPayoutRate
(
hkdToPayoutRate
);
//默认值
updateObj
.
setPaidAmount
(
BigDecimal
.
ZERO
);
updateObj
.
setPaidRatio
(
BigDecimal
.
ZERO
);
...
...
@@ -621,7 +630,6 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//默认结算汇率、港币金额
String
policyCurrency
=
queryPolicyAndBrokerDtoList
.
get
(
0
).
getCurrency
();
updateHkdAmountBatch
(
expectedFortuneList
,
policyCurrency
,
announcementRatioList
);
;
//执行成功完毕,也要销毁redis缓存
redisUtil
.
deleteObject
(
RedisConstants
.
EXPECTED_FORTUNE
+
policyNo
);
...
...
@@ -633,11 +641,6 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.
policyNo
(
policyNo
)
.
status
(
0
)
.
build
());
//异步处理-构建冷静期定时任务
// log.info("异步处理-构建冷静期定时任务=>请求前入参:{}",JSON.toJSONString(collectResDtos));
// apiExpectedFortuneAsyncService.buildCalmDateTask(collectResDtos,policyNo,exchangeRate);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
//抛出异常,销毁redis缓存
...
...
@@ -706,7 +709,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
List
<
AlgorithmResDto
>>
executeReward
(
ExecuteBillingDto
dto
)
{
public
Result
executeReward
(
ExecuteBillingDto
dto
)
{
QueryPolicyAndBrokerDto
brokerDto
=
dto
.
getPolicyAndBrokerDto
();
//构造销售佣金基本法项目的顺序下标值执行
List
<
Integer
>
executionOrderList
=
new
ArrayList
<>();
...
...
@@ -765,11 +768,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//保险公司业务id
.
insuranceCompanyBizId
(
brokerDto
.
getInsuranceCompanyBizId
())
.
source
(
2
)
//转介人的介绍费占比
.
brokerRatio
(
dto
.
getBrokerRatio
())
.
build
());
return
Result
.
success
(
result
.
getData
()
);
return
Result
.
success
();
}
private
static
LocalDate
calculateExpectedPayoutDate
(
LocalDate
effectiveDate
,
Integer
issueNumber
)
{
...
...
@@ -783,7 +784,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
List
<
AlgorithmResDto
>>
executeBilling
(
ExecuteBillingDto
dto
)
{
public
Result
executeBilling
(
ExecuteBillingDto
dto
)
{
log
.
info
(
"执行 - 销售佣金(销售佣金基本法)——>入参:{}"
,
JSON
.
toJSONString
(
dto
));
QueryPolicyAndBrokerDto
brokerDto
=
dto
.
getPolicyAndBrokerDto
();
//构造销售佣金基本法项目的顺序下标值执行
...
...
@@ -843,10 +844,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//保险公司业务id
.
insuranceCompanyBizId
(
brokerDto
.
getInsuranceCompanyBizId
())
.
source
(
1
)
.
brokerRatio
(
dto
.
getBrokerRatio
())
.
build
());
return
Result
.
success
(
result
.
getData
()
);
return
Result
.
success
();
}
/**
...
...
@@ -868,10 +868,10 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
continue
;
}
log
.
info
(
"生成保单预计发佣表记录——>入参algorithmResDto:{}"
,
JSON
.
toJSONString
(
algorithmResDto
));
//
PolicyBroker policyBroker = policyBrokerService.queryOne(QueryPolicyBrokerDto.builder()
//
.policyNo(fortuneDto.getPolicyNo())
//
.brokerBizId(fortuneDto.getBrokerBizId())
//
.build());
PolicyBroker
policyBroker
=
policyBrokerService
.
queryOne
(
QueryPolicyBrokerDto
.
builder
()
.
policyNo
(
fortuneDto
.
getPolicyNo
())
.
brokerBizId
(
fortuneDto
.
getBrokerBizId
())
.
build
());
ExpectedFortune
fortune
=
new
ExpectedFortune
();
//发佣金额 -> 计算值 - sqlAlgorithmResultDtoList集合里面的计算值和值
// fortune.setAmount(algorithmResDto.getCalculatedValue());
...
...
@@ -915,8 +915,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
fortune
.
setStandardAmount
(
standardAmount
);
// 转介人介绍费占比
// String brokerRatioStr = !Objects.isNull(policyBroker) ? policyBroker.getBrokerRatio() : "100";
String
brokerRatioStr
=
StringUtils
.
isNotBlank
(
fortuneDto
.
getBrokerRatio
())
?
fortuneDto
.
getBrokerRatio
()
:
"100"
;
String
brokerRatioStr
=
!
Objects
.
isNull
(
policyBroker
)
?
policyBroker
.
getBrokerRatio
()
:
"100"
;
fortune
.
setBrokerRatio
(
brokerRatioStr
);
try
{
...
...
@@ -1154,26 +1153,26 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
}
/**
*
保单币种对预计来佣的结算币种
的默认汇率
*
查询币对
的默认汇率
*
* @param
policyCurrency 保单
币种
* @param
currency 预计来佣的结算
币种
* @param
sourceCurrency 源
币种
* @param
targetCurrency 目标
币种
* @return 汇率
*/
private
BigDecimal
queryExchangeRateByFeign
(
String
policyCurrency
,
String
c
urrency
)
{
private
BigDecimal
queryExchangeRateByFeign
(
String
sourceCurrency
,
String
targetC
urrency
)
{
HttpServletRequest
request2
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
token2
=
request2
.
getHeader
(
"Authorization"
);
log
.
info
(
"
保单币种对预计来佣的结算币种
的默认汇率 token==============,{}"
,
token2
);
if
(
policyCurrency
.
equalsIgnoreCase
(
c
urrency
))
{
log
.
info
(
"
查询币对
的默认汇率 token==============,{}"
,
token2
);
if
(
sourceCurrency
.
equalsIgnoreCase
(
targetC
urrency
))
{
return
BigDecimal
.
ONE
;
}
// 调用Feign客户端查询汇率
Result
<
BigDecimal
>
result
=
apiExchangeRateFeignClient
.
getExchangeRate
(
policyCurrency
,
c
urrency
,
""
);
Result
<
BigDecimal
>
result
=
apiExchangeRateFeignClient
.
getExchangeRate
(
sourceCurrency
,
targetC
urrency
,
""
);
if
(
result
!=
null
&&
result
.
getData
()
!=
null
)
{
return
result
.
getData
();
}
else
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"查询币对的默认汇率失败, 币种:"
+
sourceCurrency
+
" -> "
+
targetCurrency
);
}
log
.
info
(
"调用Feign客户端查询汇率=>,{}"
,
JSON
.
toJSONString
(
result
));
return
null
;
}
private
void
validateAdd
(
List
<
ExpectedFortuneAddRequest
>
fortuneAddRequestList
)
{
...
...
@@ -1228,11 +1227,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
@Override
public
Result
<
PayableReportResponse
>
payableReport
(
ApiExpectedFortunePageRequest
request
)
{
//保單持有人(中/英)、签单人、转介人名称(主)查询保单号列表
List
<
String
>
queryPolicyNoList
=
policyFollowService
.
queryPolicyNoList
(
request
.
getPolicyHolder
(),
""
,
""
,
""
);
// 构建查询条件
request
.
setPolicyNoList
(
queryPolicyNoList
);
QueryWrapper
<
ExpectedFortune
>
queryWrapper
=
this
.
getQueryWrapper
(
request
);
// 先查询所有符合条件的记录ID(用于统计)
...
...
@@ -1268,8 +1263,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
Map
<
String
,
PolicyFollow
>
policyFollowMap
=
policyFollowService
.
queryPolicyFollowMap
(
policyNoList
);
List
<
PayableReportVO
>
voList
=
payableReportPage
.
getRecords
().
stream
().
map
(
vo
->
{
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
vo
.
getPolicyNo
());
UserGradeDto
userGradeDto
=
userGradeMap
.
get
(
vo
.
getBrokerBizId
());
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
vo
.
getPolicyNo
());
UserGradeDto
userGradeDto
=
userGradeMap
.
get
(
vo
.
getBrokerBizId
());
vo
.
setCurrency
(
CurrencyEnum
.
toLabel
(
vo
.
getCurrency
()));
if
(
userGradeDto
!=
null
)
{
...
...
@@ -1365,7 +1360,6 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
policyHolder
);
}
queryWrapper
.
in
(
ObjectUtils
.
isNotEmpty
(
request
.
getPolicyNoList
()),
"policy_no"
,
request
.
getPolicyNoList
());
// 按id升序排序
queryWrapper
.
orderByAsc
(
"id"
);
return
queryWrapper
;
...
...
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