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
7b08b78e
Commit
7b08b78e
authored
May 06, 2026
by
jianan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refs/heads/test_zjn' into test
parents
976f5fa0
432acea3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
269 additions
and
38 deletions
+269
-38
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+50
-13
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
+26
-24
yd-csf-service/src/main/java/com/yd/csf/service/dao/ExpectedFortuneMapper.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
+16
-0
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
+156
-0
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
7b08b78e
...
...
@@ -968,22 +968,59 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
@Override
public
Result
<
ApiExpectedFortunePageResponseVO
>
list
(
ApiExpectedFortunePageRequest
request
)
{
Page
<
ExpectedFortune
>
page
=
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
());
// 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
);
}
QueryWrapper
<
ExpectedFortune
>
queryWrapper
=
this
.
getQueryWrapper
(
request
);
IPage
<
ExpectedFortune
>
iPage
=
iExpectedFortuneService
.
page
(
page
,
queryWrapper
);
// 查询统计数据
List
<
ExpectedFortune
>
fortuneList
=
iExpectedFortuneService
.
list
(
queryWrapper
);
ExpectedFortuneStatisticsVO
statisticsVO
=
this
.
getStatistics
(
fortuneList
.
stream
().
map
(
ExpectedFortune:
:
getId
).
collect
(
Collectors
.
toList
()));
long
startTime
=
System
.
currentTimeMillis
();
try
{
// 2. 构建查询条件
QueryWrapper
<
ExpectedFortune
>
queryWrapper
=
this
.
getQueryWrapper
(
request
);
// 3. 查询分页列表(UNION ALL 查询,包含预计发佣和实际发佣)
IPage
<
ApiExpectedFortunePageResponse
>
iPage
=
iExpectedFortuneService
.
queryListNew
(
request
.
getPageNo
(),
request
.
getPageSize
(),
queryWrapper
);
// 查询实际发佣列表
List
<
Fortune
>
expectedFortuneList
=
fortuneService
.
list
(
);
// 4. 查询统计数据(使用 SQL 聚合,不加载明细)
ExpectedFortuneStatisticsVO
statisticsVO
=
iExpectedFortuneService
.
queryListStatistics
(
queryWrapper
);
// 组装返回结果
ApiExpectedFortunePageResponseVO
response
=
new
ApiExpectedFortunePageResponseVO
();
response
.
setStatisticsVO
(
statisticsVO
);
response
.
setPage
(
iExpectedFortuneService
.
getVOPage
(
iPage
));
return
Result
.
success
(
response
);
// 计算已出账比例
BigDecimal
totalAmount
=
statisticsVO
.
getTotalExpectedAmount
();
BigDecimal
totalPaidAmount
=
statisticsVO
.
getTotalPaidAmount
();
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. 组装返回结果
ApiExpectedFortunePageResponseVO
response
=
new
ApiExpectedFortunePageResponseVO
();
response
.
setStatisticsVO
(
statisticsVO
);
response
.
setPage
(
iPage
);
// 恢复分页数据
log
.
info
(
"查询应付款管理列表完成, 耗时: {}ms, 页码: {}, 页大小: {}, 总记录数: {}"
,
System
.
currentTimeMillis
()
-
startTime
,
request
.
getPageNo
(),
request
.
getPageSize
(),
iPage
.
getTotal
());
return
Result
.
success
(
response
);
}
catch
(
Exception
e
)
{
log
.
error
(
"查询应付款管理列表失败"
,
e
);
return
Result
.
fail
(
ResultCode
.
FAIL
.
getCode
(),
"查询失败: "
+
e
.
getMessage
());
}
}
@Override
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
View file @
7b08b78e
...
...
@@ -18,6 +18,12 @@ public class ApiExpectedFortunePageResponse {
private
Long
id
;
/**
* 是否实际出账:1-预计出账 2-实际出账
*/
@Schema
(
description
=
"是否实际出账:1-预计出账 2-实际出账"
)
private
Integer
type
;
/**
* 预计出账表唯一业务id
*/
@Schema
(
description
=
"expected fortune biz id"
)
...
...
@@ -131,23 +137,19 @@ public class ApiExpectedFortunePageResponse {
@Schema
(
description
=
"转介人介绍费占比"
)
private
String
brokerRatio
;
/**
* 标准出佣金额
*/
@Schema
(
description
=
"标准出佣金额"
)
private
BigDecimal
standardAmount
;
// ========== 保单币种及金额(基本法币种) ==========
/**
*
应出账金额(预计发佣
金额 = 标准发佣金额 * 转介人介绍费占比)
*
保单币种金额(保单币种
金额 = 标准发佣金额 * 转介人介绍费占比)
*/
@Schema
(
description
=
"
应出账金额(预计发佣
金额 = 标准发佣金额 * 转介人介绍费占比)"
)
private
BigDecimal
a
mount
;
@Schema
(
description
=
"
保单币种金额(保单币种
金额 = 标准发佣金额 * 转介人介绍费占比)"
)
private
BigDecimal
ruleA
mount
;
/**
*
出账
币种
*
保单
币种
*/
@Schema
(
description
=
"
出账
币种"
)
private
String
c
urrency
;
@Schema
(
description
=
"
保单
币种"
)
private
String
ruleC
urrency
;
/**
* 出账币种名称
...
...
@@ -156,15 +158,15 @@ public class ApiExpectedFortunePageResponse {
private
String
currencyName
;
/**
*
默认结算
汇率
*
保单币种 -> 港币
汇率
*/
@Schema
(
description
=
"
默认结算
汇率"
)
private
BigDecimal
defaultE
xchangeRate
;
@Schema
(
description
=
"
保单币种 -> 港币
汇率"
)
private
BigDecimal
e
xchangeRate
;
/**
*
港币预计
出账金额
*
HKD应
出账金额
*/
@Schema
(
description
=
"
港币预计
出账金额"
)
@Schema
(
description
=
"
HKD应
出账金额"
)
private
BigDecimal
hkdAmount
;
/**
...
...
@@ -180,23 +182,23 @@ public class ApiExpectedFortunePageResponse {
private
String
statusDesc
;
/**
*
预计出账日期
*
出账年月(估)
*/
@Schema
(
description
=
"
预计出账日期
"
)
@JsonFormat
(
pattern
=
"yyyy-MM
-dd
"
,
timezone
=
"GMT+8"
)
@Schema
(
description
=
"
出账年月(估)
"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
LocalDate
payoutDate
;
/**
*
实际出账日期
*
出账年月(实)
*/
@Schema
(
description
=
"
实际出账日期
"
)
@JsonFormat
(
pattern
=
"yyyy-MM
-dd
"
,
timezone
=
"GMT+8"
)
@Schema
(
description
=
"
出账年月(实)
"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
LocalDate
actualPayoutDate
;
/**
* 已出账金额
* 已出账金额
(HKD)
*/
@Schema
(
description
=
"已出账金额"
)
@Schema
(
description
=
"已出账金额
(HKD)
"
)
private
BigDecimal
paidAmount
;
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dao/ExpectedFortuneMapper.java
View file @
7b08b78e
package
com
.
yd
.
csf
.
service
.
dao
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.csf.feign.request.expectedfortune.ApiExpectedFortunePageRequest
;
...
...
@@ -44,4 +45,13 @@ public interface ExpectedFortuneMapper extends BaseMapper<ExpectedFortune> {
* @param status 出账状态
*/
void
updateBatchByBizId
(
@Param
(
"expectedFortuneBizIdList"
)
List
<
String
>
expectedFortuneBizIdList
,
@Param
(
"status"
)
String
status
);
IPage
<
ApiExpectedFortunePageResponse
>
queryListNew
(
Integer
pageNo
,
Integer
pageSize
,
@Param
(
"ew"
)
QueryWrapper
<
ExpectedFortune
>
queryWrapper
);
/**
* 查询预计发佣和实际发佣的统计数据(使用 SQL 聚合)
* @param queryWrapper 查询条件
* @return 统计信息
*/
ExpectedFortuneStatisticsVO
queryListStatistics
(
@Param
(
"ew"
)
QueryWrapper
<
ExpectedFortune
>
queryWrapper
);
}
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
View file @
7b08b78e
...
...
@@ -188,7 +188,7 @@ public class ExpectedFortune implements Serializable {
private
LocalDate
actualPayoutDate
;
/**
* 默认保单币种汇率
* 默认保单币种
-> 港币
汇率
*/
@TableField
(
"default_exchange_rate"
)
private
BigDecimal
defaultExchangeRate
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
View file @
7b08b78e
package
com
.
yd
.
csf
.
service
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.csf.feign.request.expectedfortune.ApiExpectedFortunePageRequest
;
...
...
@@ -56,4 +57,13 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
* @return 应付款编号
*/
String
getPayableNo
(
String
fortuneType
);
IPage
<
ApiExpectedFortunePageResponse
>
queryListNew
(
Integer
pageNo
,
Integer
pageSize
,
QueryWrapper
<
ExpectedFortune
>
queryWrapper
);
/**
* 查询预计发佣和实际发佣的统计数据(使用 SQL 聚合)
* @param queryWrapper 查询条件
* @return 统计信息
*/
ExpectedFortuneStatisticsVO
queryListStatistics
(
QueryWrapper
<
ExpectedFortune
>
queryWrapper
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
View file @
7b08b78e
...
...
@@ -211,4 +211,20 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
LocalDate
.
now
().
getYear
()
%
100
,
currentSeq
+
1
);
}
@Override
public
IPage
<
ApiExpectedFortunePageResponse
>
queryListNew
(
Integer
pageNo
,
Integer
pageSize
,
QueryWrapper
<
ExpectedFortune
>
queryWrapper
)
{
return
this
.
baseMapper
.
queryListNew
(
pageNo
,
pageSize
,
queryWrapper
);
}
@Override
public
ExpectedFortuneStatisticsVO
queryListStatistics
(
QueryWrapper
<
ExpectedFortune
>
queryWrapper
)
{
ExpectedFortuneStatisticsVO
statistics
=
this
.
baseMapper
.
queryListStatistics
(
queryWrapper
);
if
(
statistics
==
null
)
{
return
new
ExpectedFortuneStatisticsVO
();
}
return
statistics
;
}
}
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
View file @
7b08b78e
...
...
@@ -149,4 +149,160 @@
and ef.is_deleted = 0
</where>
</select>
<select
id=
"queryListNew"
resultType=
"com.yd.csf.feign.response.expectedfortune.ApiExpectedFortunePageResponse"
>
<bind
name=
"offset"
value=
"(pageNo - 1) * pageSize"
/>
SELECT
ef.id,
ef.expected_fortune_biz_id,
ef.fortune_biz_type,
ef.is_part,
ef.payable_no,
ef.policy_no,
ef.premium,
ef.policy_currency,
ef.insurance_company_biz_id,
ef.product_launch_biz_id,
ef.fortune_period,
ef.fortune_total_period,
ef.broker,
ef.broker_biz_id,
ef.team,
ef.team_biz_id,
ef.fortune_name,
ef.fortune_type,
ef.broker_ratio,
ef.rule_amount,
ef.rule_currency,
ef.status,
ef.status_desc,
ef.payout_date,
ef.actual_payout_date,
ef.default_exchange_rate,
ef.original_currency,
ef.original_amount,
ef.original_to_hkd_rate,
ef.payout_currency,
ef.payout_amount,
ef.hkd_to_payout_rate,
ef.hkd_amount,
ef.paid_amount,
ef.unpaid_amount,
ef.paid_ratio,
ef.unpaid_ratio,
ef.is_tax,
ef.tax_amount,
ef.net_amount,
ef.rule_item_biz_id,
ef.remark,
ef.create_time,
ef.creator_name,
ef.update_time,
1 as type
FROM expected_fortune ef
<where>
ef.is_deleted = 0
AND ef.is_part IN (0, 1)
<if
test=
"ew != null"
>
<if
test=
"ew.sqlSegment != null and ew.sqlSegment != ''"
>
AND ${ew.sqlSegment}
</if>
</if>
</where>
UNION ALL
SELECT
f.id,
f.expected_fortune_biz_id,
f.fortune_biz_type,
f.is_part,
f.payable_no,
f.policy_no,
f.premium,
f.policy_currency,
NULL as insurance_company_biz_id,
NULL as product_launch_biz_id,
f.fortune_period,
f.fortune_total_period,
f.broker,
f.broker_biz_id,
f.team,
f.team_biz_id,
f.fortune_name,
f.fortune_type,
NULL as broker_ratio,
f.rule_amount,
f.rule_currency,
f.status,
NULL as status_desc,
f.payout_date,
f.actual_payout_date,
f.exchange_rate as default_exchange_rate,
f.original_currency,
f.original_amount,
f.original_to_hkd_rate,
f.payout_currency,
f.payout_amount,
f.hkd_to_payout_rate,
f.hkd_amount,
f.current_payment_amount as paid_amount,
0 as unpaid_amount,
f.current_payment_ratio as paid_ratio,
0 as unpaid_ratio,
f.is_tax,
f.tax_amount,
f.net_amount,
NULL as rule_item_biz_id,
f.remark,
f.create_time,
NULL as creator_name,
f.update_time,
2 as type
FROM fortune f
<where>
f.is_deleted = 0
AND f.is_part IN (0, 1)
<if
test=
"ew != null"
>
<if
test=
"ew.sqlSegment != null and ew.sqlSegment != ''"
>
AND ${ew.sqlSegment}
</if>
</if>
</where>
ORDER BY id ASC
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select
id=
"queryListStatistics"
resultType=
"com.yd.csf.service.vo.ExpectedFortuneStatisticsVO"
>
SELECT
COALESCE(SUM(ef.hkd_amount), 0) AS totalExpectedAmount,
COALESCE(SUM(ef.paid_amount), 0) AS totalPaidAmount,
COALESCE(SUM(ef.unpaid_amount), 0) AS totalUnpaidAmount,
COALESCE(
(SELECT SUM(p.total_payment_premium) * MAX(ef2.default_exchange_rate)
FROM expected_fortune ef2
LEFT JOIN policy p ON ef2.policy_no = p.policy_no
WHERE ef2.is_deleted = 0 AND ef2.is_part IN (0, 1)
<if
test=
"ew != null"
>
<if
test=
"ew.sqlSegment != null and ew.sqlSegment != ''"
>
AND ${ew.sqlSegment}
</if>
</if>
), 0
) AS totalPremiumAmount,
COUNT(DISTINCT ef.policy_no) AS totalPolicyCount
FROM expected_fortune ef
<where>
ef.is_deleted = 0
AND ef.is_part IN (0, 1)
<if
test=
"ew != null"
>
<if
test=
"ew.sqlSegment != null and ew.sqlSegment != ''"
>
AND ${ew.sqlSegment}
</if>
</if>
</where>
</select>
</mapper>
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