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
9e224425
Commit
9e224425
authored
May 21, 2026
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应付明细7
parent
34effecd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
31 deletions
+52
-31
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+31
-12
yd-csf-service/src/main/java/com/yd/csf/service/dao/ExpectedFortuneMapper.java
+2
-2
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
+3
-3
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
+2
-2
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
+14
-12
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
9e224425
...
...
@@ -1232,25 +1232,44 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
@Override
public
Result
<
PayableReportResponse
>
payableReport
(
ApiExpectedFortunePageRequest
request
)
{
// 构建查询条件
// 1. 参数校验
if
(
request
==
null
)
{
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"查询参数不能为空"
);
}
if
(
request
.
getPageNo
()
==
null
||
request
.
getPageNo
()
<
1
)
{
request
.
setPageNo
(
1
);
}
if
(
request
.
getPageSize
()
==
null
||
request
.
getPageSize
()
<
1
)
{
request
.
setPageSize
(
10
);
}
// 2. 构建查询条件(复用 getQueryWrapper,与 /list 共用同一套条件)
QueryWrapper
<
ExpectedFortune
>
queryWrapper
=
this
.
getQueryWrapper
(
request
);
// 先查询所有符合条件的记录ID(用于统计)
List
<
ExpectedFortune
>
allFortuneList
=
iExpectedFortuneService
.
list
(
queryWrapper
);
List
<
Long
>
allFortuneIdList
=
allFortuneList
.
stream
().
map
(
ExpectedFortune:
:
getId
).
collect
(
Collectors
.
toList
());
// 3. 移除 QueryWrapper 中的排序,避免在 UNION ALL 的子查询中出现 ORDER BY
queryWrapper
.
getExpression
().
getOrderBy
().
clear
();
//
查询统计数据(基于所有符合条件的记录
)
ExpectedFortuneStatisticsVO
statisticsVO
=
this
.
getStatistics
(
allFortuneIdList
);
//
4. 查询统计数据(直接传递 QueryWrapper,在 SQL 中聚合计算,不再加载明细到内存
)
ExpectedFortuneStatisticsVO
statisticsVO
=
iExpectedFortuneService
.
queryListStatistics
(
queryWrapper
);
// 应付款报表分页查询 - 按保单号和期数维度统计
Page
<
PayableReportVO
>
reportPage
=
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
());
IPage
<
PayableReportVO
>
payableReportPage
=
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
());
if
(!
CollectionUtils
.
isEmpty
(
allFortuneIdList
))
{
payableReportPage
=
iExpectedFortuneService
.
payableReportPage
(
reportPage
,
allFortuneIdList
);
// 计算待出账金额和已出账比例
BigDecimal
totalAmount
=
statisticsVO
.
getTotalExpectedAmount
();
BigDecimal
totalPaidAmount
=
statisticsVO
.
getTotalPaidAmount
();
statisticsVO
.
setTotalUnpaidAmount
(
totalAmount
.
subtract
(
totalPaidAmount
));
BigDecimal
divided
=
BigDecimal
.
ZERO
;
if
(
totalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
divided
=
totalPaidAmount
.
divide
(
totalAmount
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
));
}
statisticsVO
.
setPaidAmountRatio
(
divided
);
// 5. 应付款报表分页查询(按保单号和期数维度统计,直接传递 QueryWrapper)
Page
<
PayableReportVO
>
reportPage
=
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
());
IPage
<
PayableReportVO
>
payableReportPage
=
iExpectedFortuneService
.
payableReportPage
(
reportPage
,
queryWrapper
);
// 6. 数据补充(转介人等级、保单持有人、产品名称等信息)
payableReportPage
=
convertPayableReportVO
(
payableReportPage
);
// 组装返回结果
// 7. 组装返回结果
PayableReportResponse
response
=
new
PayableReportResponse
();
response
.
setStatisticsVO
(
statisticsVO
);
response
.
setPage
(
payableReportPage
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dao/ExpectedFortuneMapper.java
View file @
9e224425
...
...
@@ -33,11 +33,11 @@ public interface ExpectedFortuneMapper extends BaseMapper<ExpectedFortune> {
/**
* 应付款报表 - 按保单号和期数维度统计(分页)
* @param page 分页参数
* @param
expectedFortuneIds 预计发佣ID列表
* @param
queryWrapper 查询条件
* @return 应付款报表VO分页列表
*/
IPage
<
PayableReportVO
>
payableReportPage
(
@Param
(
"page"
)
Page
<
PayableReportVO
>
page
,
@Param
(
"e
xpectedFortuneIds"
)
List
<
Long
>
expectedFortuneIds
);
@Param
(
"e
w"
)
QueryWrapper
<
ExpectedFortune
>
queryWrapper
);
/**
* 更新预计发佣记录的出账状态
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
View file @
9e224425
...
...
@@ -40,11 +40,11 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
/**
* 应付款报表 - 按保单号和期数维度统计(分页)
*
* @param page
分页参数
* @param
expectedFortuneIds 预计发佣ID列表
* @param page 分页参数
* @param
queryWrapper 查询条件
* @return 应付款报表VO分页列表
*/
IPage
<
PayableReportVO
>
payableReportPage
(
Page
<
PayableReportVO
>
page
,
List
<
Long
>
expectedFortuneIds
);
IPage
<
PayableReportVO
>
payableReportPage
(
Page
<
PayableReportVO
>
page
,
QueryWrapper
<
ExpectedFortune
>
queryWrapper
);
void
updateBatchByBizId
(
List
<
String
>
expectedFortuneBizIdList
,
String
status
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
View file @
9e224425
...
...
@@ -258,8 +258,8 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
}
@Override
public
IPage
<
PayableReportVO
>
payableReportPage
(
Page
<
PayableReportVO
>
page
,
List
<
Long
>
expectedFortuneIds
)
{
return
baseMapper
.
payableReportPage
(
page
,
expectedFortuneIds
);
public
IPage
<
PayableReportVO
>
payableReportPage
(
Page
<
PayableReportVO
>
page
,
QueryWrapper
<
ExpectedFortune
>
queryWrapper
)
{
return
baseMapper
.
payableReportPage
(
page
,
queryWrapper
);
}
@Override
...
...
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
View file @
9e224425
...
...
@@ -87,13 +87,14 @@
left join policy_follow pf on ef.policy_no = pf.policy_no
<where>
ef.fortune_biz_type = 'R'
<if
test=
"expectedFortuneIds != null and expectedFortuneIds.size > 0"
>
and ef.id in
<foreach
collection=
"expectedFortuneIds"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
and ef.is_deleted = 0
AND ef.is_part in (0,1)
<if
test=
"ew != null and ew.sqlSegment != null and ew.sqlSegment != ''"
>
AND ef.id IN (
SELECT ef2.id FROM expected_fortune ef2
WHERE ${ew.sqlSegment}
)
</if>
</where>
group by ef.policy_no, ef.fortune_period
union all
...
...
@@ -130,13 +131,14 @@
left join policy p on ef.policy_no = p.policy_no
<where>
ef.fortune_biz_type = 'U'
<if
test=
"expectedFortuneIds != null and expectedFortuneIds.size > 0"
>
and ef.id in
<foreach
collection=
"expectedFortuneIds"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
and ef.is_deleted = 0
AND ef.is_part in (0,1)
<if
test=
"ew != null and ew.sqlSegment != null and ew.sqlSegment != ''"
>
AND ef.id IN (
SELECT ef2.id FROM expected_fortune ef2
WHERE ${ew.sqlSegment}
)
</if>
</where>
</select>
...
...
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