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
49a2a946
Commit
49a2a946
authored
Jul 10, 2026
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成可出帐问题修复
parent
48970f07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
11 deletions
+44
-11
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
+44
-11
No files found.
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
View file @
49a2a946
...
@@ -616,6 +616,18 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -616,6 +616,18 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"未找到对应的来佣记录,请先创建来佣记录"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"未找到对应的来佣记录,请先创建来佣记录"
);
}
}
// 获取所有检核年月
Set
<
String
>
reconciliationYearMonthSet
=
commissions
.
stream
()
.
map
(
Commission:
:
getReconciliationYearMonth
)
.
collect
(
Collectors
.
toSet
());
// 校验检核年月是否一致
if
(
reconciliationYearMonthSet
.
size
()
!=
1
)
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"请选择相同的检核年月"
);
}
// 本次检核年月
String
reconciliationYearMonth
=
reconciliationYearMonthSet
.
iterator
().
next
();
for
(
Commission
commission
:
commissions
)
{
for
(
Commission
commission
:
commissions
)
{
if
(
"U"
.
equals
(
commission
.
getCommissionBizType
()))
{
if
(
"U"
.
equals
(
commission
.
getCommissionBizType
()))
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"非关联保单应收单,不能点击生成可出账记录"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"非关联保单应收单,不能点击生成可出账记录"
);
...
@@ -651,38 +663,53 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -651,38 +663,53 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"未找到保单对应的预计发佣记录,请先创建预计发佣记录"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"未找到保单对应的预计发佣记录,请先创建预计发佣记录"
);
}
}
// 2. 根据本次
发佣期数,删除未出账的
记录
// 2. 根据本次
涉及的预计发佣记录,查询相关的 fortune
记录
List
<
Fortune
>
fortuneList
=
fortuneService
.
lambdaQuery
()
List
<
Fortune
>
fortuneList
=
fortuneService
.
lambdaQuery
()
.
in
(
Fortune:
:
getStatus
,
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
(),
FortuneStatusEnum
.
WAIT
.
getItemValue
())
.
in
(
Fortune:
:
getExpectedFortuneBizId
,
filteredExpectedFortuneList1
.
stream
().
map
(
ExpectedFortune:
:
getExpectedFortuneBizId
).
collect
(
Collectors
.
toList
()))
.
in
(
Fortune:
:
getExpectedFortuneBizId
,
filteredExpectedFortuneList1
.
stream
().
map
(
ExpectedFortune:
:
getExpectedFortuneBizId
).
collect
(
Collectors
.
toList
()))
.
list
();
.
list
();
// 2.1 对 fortune 记录进行分类,已出账、已分期、手动加的记录不能删除,其他记录删除后根据预计发佣记录重新生成
List
<
Fortune
>
deleteList
=
new
ArrayList
<>();
List
<
Fortune
>
keepList
=
new
ArrayList
<>();
for
(
Fortune
fortune
:
fortuneList
)
{
if
(
FortuneStatusEnum
.
SENT
.
getItemValue
().
equals
(
fortune
.
getStatus
())
||
!
"系统生成"
.
equals
(
fortune
.
getReconciliationOperator
())
||
1
==
fortune
.
getIsPart
())
{
keepList
.
add
(
fortune
);
}
else
{
deleteList
.
add
(
fortune
);
}
}
// 2.1 物理删除
// 2.1 物理删除
if
(
CollectionUtils
.
isNotEmpty
(
fortun
eList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
delet
eList
))
{
fortuneService
.
removeByIdsPhysical
(
fortun
eList
.
stream
().
map
(
Fortune:
:
getId
).
collect
(
Collectors
.
toList
()));
fortuneService
.
removeByIdsPhysical
(
delet
eList
.
stream
().
map
(
Fortune:
:
getId
).
collect
(
Collectors
.
toList
()));
}
}
// 2.2 筛选出未出账的记录
// 2.2 keepList 的记录,不重新生成
Set
<
String
>
keepExpectedFortuneBizIdSet
=
keepList
.
stream
().
map
(
Fortune:
:
getExpectedFortuneBizId
).
collect
(
Collectors
.
toSet
());
// 2.3 筛选出需要重新生成的记录
List
<
ExpectedFortune
>
filteredExpectedFortuneList2
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
filteredExpectedFortuneList2
=
new
ArrayList
<>();
for
(
ExpectedFortune
expectedFortune
:
filteredExpectedFortuneList1
)
{
for
(
ExpectedFortune
expectedFortune
:
filteredExpectedFortuneList1
)
{
// 如果
有已出账
记录,跳过
// 如果
是 keep
记录,跳过
if
(
FortuneStatusEnum
.
SENT
.
getItemValue
().
equals
(
expectedFortune
.
getStatus
()))
{
if
(
keepExpectedFortuneBizIdSet
.
contains
(
expectedFortune
.
getExpectedFortuneBizId
()))
{
continue
;
continue
;
}
}
filteredExpectedFortuneList2
.
add
(
expectedFortune
);
filteredExpectedFortuneList2
.
add
(
expectedFortune
);
}
}
// 2.
3
校验预计发佣记录是否有出账币种、默认结算汇率
// 2.
4
校验预计发佣记录是否有出账币种、默认结算汇率
for
(
ExpectedFortune
expectedFortune
:
filteredExpectedFortuneList2
)
{
for
(
ExpectedFortune
expectedFortune
:
filteredExpectedFortuneList2
)
{
if
(
StringUtils
.
isBlank
(
expectedFortune
.
getRuleCurrency
()))
{
if
(
StringUtils
.
isBlank
(
expectedFortune
.
getRuleCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计发佣记录"
+
expectedFortune
.
getExpectedFortuneBizId
()
+
"未配置保单币种"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计发佣记录"
+
expectedFortune
.
getExpectedFortuneBizId
()
+
"未配置保单币种"
);
}
}
}
}
// 2.
4
根据保单号、期数查询入账检核汇率
// 2.
5
根据保单号、期数查询入账检核汇率
Map
<
String
,
BigDecimal
>
exchangeRateMap
=
this
.
queryCommissionExchangeRateMap
(
commissions
);
Map
<
String
,
BigDecimal
>
exchangeRateMap
=
this
.
queryCommissionExchangeRateMap
(
commissions
);
// 3. 构建实际的初始发佣记录(使用入账检核汇率)
// 3. 构建实际的初始发佣记录(使用入账检核汇率)
List
<
Fortune
>
newFortuneList
=
buildNewFortunes
(
filteredExpectedFortuneList2
,
commissions
,
exchangeRateMap
);
List
<
Fortune
>
newFortuneList
=
buildNewFortunes
(
filteredExpectedFortuneList2
,
commissions
,
exchangeRateMap
,
reconciliationYearMonth
);
// 4. 保存发佣记录
// 4. 保存发佣记录
saveNewFortunes
(
newFortuneList
);
saveNewFortunes
(
newFortuneList
);
...
@@ -740,7 +767,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -740,7 +767,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
*/
*/
private
List
<
Fortune
>
buildNewFortunes
(
List
<
ExpectedFortune
>
expectedFortuneList
,
private
List
<
Fortune
>
buildNewFortunes
(
List
<
ExpectedFortune
>
expectedFortuneList
,
List
<
Commission
>
commissionList
,
List
<
Commission
>
commissionList
,
Map
<
String
,
BigDecimal
>
exchangeRateMap
)
{
Map
<
String
,
BigDecimal
>
exchangeRateMap
,
String
reconciliationYearMonth
)
{
if
(
CollectionUtils
.
isEmpty
(
expectedFortuneList
))
{
if
(
CollectionUtils
.
isEmpty
(
expectedFortuneList
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
...
@@ -774,6 +802,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -774,6 +802,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setId
(
null
);
fortune
.
setId
(
null
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setReconciliationYearMonth
(
reconciliationYearMonth
);
// 优先使用入账检核汇率,如果没有则使用默认汇率
// 优先使用入账检核汇率,如果没有则使用默认汇率
String
key
=
buildPolicyPeriodKey
(
expectedFortune
.
getPolicyNo
(),
expectedFortune
.
getFortunePeriod
());
String
key
=
buildPolicyPeriodKey
(
expectedFortune
.
getPolicyNo
(),
expectedFortune
.
getFortunePeriod
());
...
@@ -1099,6 +1128,10 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -1099,6 +1128,10 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
if
(
StringUtils
.
isBlank
(
request
.
getCommissionType
()))
{
if
(
StringUtils
.
isBlank
(
request
.
getCommissionType
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账项目类型不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账项目类型不能为空"
);
}
}
// 检核年月不能为空
if
(
StringUtils
.
isBlank
(
request
.
getReconciliationYearMonth
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"检核年月不能为空"
);
}
// commissionType 只能是数字
// commissionType 只能是数字
if
(!
StringUtils
.
isNumeric
(
request
.
getCommissionType
()))
{
if
(!
StringUtils
.
isNumeric
(
request
.
getCommissionType
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账项目类型只能是字典值"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账项目类型只能是字典值"
);
...
...
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