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
211b316e
Commit
211b316e
authored
Jun 11, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into prod
parents
2dbc395a
492c4f21
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
209 additions
and
66 deletions
+209
-66
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
+2
-1
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
+10
-8
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/excel/ApiSalarySplitSummaryExcelDto.java
+13
-13
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/salarysplit/ApiSalarySplitSummaryPageDto.java
+2
-2
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAccountExportDTO.java
+7
-4
yd-csf-service/src/main/java/com/yd/csf/service/model/FortuneAccount.java
+5
-5
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
+140
-14
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
+3
-2
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+11
-7
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneAccountVO.java
+9
-3
yd-csf-service/src/main/resources/mappers/FortuneAccountMapper.xml
+3
-3
yd-csf-service/src/main/resources/mappers/SalarySplitMapper.xml
+4
-4
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
View file @
211b316e
...
...
@@ -425,7 +425,8 @@ public class ApiCommissionExpectedController {
commissionExpectedQueryRequest
.
setPolicyNoList
(
queryPolicyNoList
);
commissionExpectedQueryRequest
.
setQueryFlag
(
queryFlag
);
QueryWrapper
<
CommissionExpected
>
queryWrapper
=
commissionExpectedService
.
getQueryWrapper
(
commissionExpectedQueryRequest
);
//显式选择需要的字段
queryWrapper
.
select
(
"expected_amount"
,
"paid_amount"
,
"paid_ratio"
,
"commission_ratio"
,
"policy_no"
,
"status"
);
// 先查询所有符合条件的记录ID(用于统计)
List
<
CommissionExpected
>
allCommissionExpectedList
=
commissionExpectedService
.
list
(
queryWrapper
);
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
View file @
211b316e
...
...
@@ -133,8 +133,8 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
// 查询统计信息
ApiSalarySplitStatisticsDto
statisticsDto
=
new
ApiSalarySplitStatisticsDto
();
FortuneAccount
fortuneAccount
=
fortuneAccountService
.
queryOne
(
request
.
getFortuneAccountBizId
());
//
出账
币种
statisticsDto
.
setBeSplitCurrency
(
fortuneAccount
!=
null
?
fortuneAccount
.
getCurrency
()
:
""
);
//
发放
币种
statisticsDto
.
setBeSplitCurrency
(
fortuneAccount
!=
null
?
fortuneAccount
.
get
Payout
Currency
()
:
""
);
BigDecimal
beSplitAmount
=
BigDecimal
.
ZERO
;
if
(
fortuneAccount
!=
null
)
{
...
...
@@ -147,7 +147,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
fortuneAmount
=
fortuneAccount
.
get
HkdAmount
()
!=
null
?
fortuneAccount
.
getHkd
Amount
()
:
BigDecimal
.
ZERO
;
BigDecimal
fortuneAmount
=
fortuneAccount
.
get
PayoutAmount
()
!=
null
?
fortuneAccount
.
getPayout
Amount
()
:
BigDecimal
.
ZERO
;
beSplitAmount
=
fortuneAmount
.
subtract
(
splitTotal
);
if
(
beSplitAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
beSplitAmount
=
BigDecimal
.
ZERO
;
// 防止负数
...
...
@@ -231,7 +231,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
}
// 3. 计算剩余可拆金额(账户总额 - 本次拟拆分总额)
BigDecimal
fortuneAmount
=
fortuneAccount
.
get
HkdAmount
()
!=
null
?
fortuneAccount
.
getHkd
Amount
()
:
BigDecimal
.
ZERO
;
BigDecimal
fortuneAmount
=
fortuneAccount
.
get
PayoutAmount
()
!=
null
?
fortuneAccount
.
getPayout
Amount
()
:
BigDecimal
.
ZERO
;
BigDecimal
beSplitAmount
=
fortuneAmount
.
subtract
(
splitTotal
);
if
(
beSplitAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
beSplitAmount
=
BigDecimal
.
ZERO
;
// 防止负数
...
...
@@ -239,7 +239,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
// 4. 封装响应
ApiQueryRemainingResponse
response
=
new
ApiQueryRemainingResponse
();
response
.
setCurrency
(
fortuneAccount
.
getCurrency
());
response
.
setCurrency
(
fortuneAccount
.
get
Payout
Currency
());
response
.
setFromAmount
(
beSplitAmount
);
return
Result
.
success
(
response
);
}
...
...
@@ -260,7 +260,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
//原币种金额
convertRequest
.
setAmount
(
request
.
getFromAmount
());
//原币种
convertRequest
.
setFromCurrency
(
fortuneAccount
.
getCurrency
());
convertRequest
.
setFromCurrency
(
fortuneAccount
.
get
Payout
Currency
());
//目标币种
convertRequest
.
setToCurrency
(
request
.
getToCurrency
());
//调用远程转换接口
...
...
@@ -296,11 +296,13 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
// 查询数据
List
<
ApiSalarySplitSummaryPageDto
>
dataList
=
iSalarySplitService
.
summaryList
(
request
);
log
.
info
(
"导出-薪资拆分应发信息汇总列表:dataList,{}"
,
JSON
.
toJSONString
(
dataList
));
Map
<
String
,
String
>
map
=
getBillOrgDict
();
List
<
ApiSalarySplitSummaryExcelDto
>
excelDtoList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
excelDtoList
=
dataList
.
stream
().
map
(
dto
->
{
ApiSalarySplitSummaryExcelDto
excelDto
=
new
ApiSalarySplitSummaryExcelDto
();
BeanUtils
.
copyProperties
(
dto
,
excelDto
);
excelDto
.
setBillOrg
(
map
!=
null
?
map
.
get
(
dto
.
getBillOrg
())
:
""
);
return
excelDto
;
}).
collect
(
Collectors
.
toList
());
}
...
...
@@ -309,9 +311,9 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
ExportParam
exportParam
=
new
ExportParam
();
// 指定需要导出的字段(字段名必须与 DTO 中的属性名一致)
exportParam
.
setFieldNames
(
Arrays
.
asList
(
"salarySplitNo"
,
"businessNo"
,
"brokerName"
,
"team"
,
"fromAmount"
,
"salarySplitNo"
,
"businessNo"
,
"brokerName"
,
"
internalNumber"
,
"
team"
,
"fromAmount"
,
"currency"
,
"exchangeRate"
,
"toAmount"
,
"toCurrency"
,
"fortuneAccountMonth"
,
"billOrg"
,
"
hkdA
mount"
"fortuneAccountMonth"
,
"billOrg"
,
"
a
mount"
));
exportParam
.
setFileName
(
"薪资拆分应发信息汇总"
);
exportParam
.
setUploadToOss
(
true
);
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/excel/ApiSalarySplitSummaryExcelDto.java
View file @
211b316e
...
...
@@ -10,40 +10,40 @@ public class ApiSalarySplitSummaryExcelDto {
@Excel
(
name
=
"发放编号"
,
orderNum
=
"1"
)
private
String
salarySplitNo
;
@Excel
(
name
=
"业务编号"
,
orderNum
=
"
1
"
)
@Excel
(
name
=
"业务编号"
,
orderNum
=
"
2
"
)
private
String
businessNo
;
@Excel
(
name
=
"转介人"
,
orderNum
=
"
2
"
)
@Excel
(
name
=
"转介人"
,
orderNum
=
"
3
"
)
private
String
brokerName
;
@Excel
(
name
=
"内部编号"
,
orderNum
=
"
3
"
)
@Excel
(
name
=
"内部编号"
,
orderNum
=
"
4
"
)
private
String
internalNumber
;
@Excel
(
name
=
"所属团队"
,
orderNum
=
"
4
"
)
@Excel
(
name
=
"所属团队"
,
orderNum
=
"
5
"
)
private
String
team
;
@Excel
(
name
=
"原币种金额"
,
orderNum
=
"
5
"
)
@Excel
(
name
=
"原币种金额"
,
orderNum
=
"
6
"
)
private
BigDecimal
fromAmount
;
@Excel
(
name
=
"原币种"
,
orderNum
=
"
6
"
)
@Excel
(
name
=
"原币种"
,
orderNum
=
"
7
"
)
private
String
currency
;
@Excel
(
name
=
"汇率(原币种->目标币种)"
,
orderNum
=
"
7
"
)
@Excel
(
name
=
"汇率(原币种->目标币种)"
,
orderNum
=
"
8
"
)
private
BigDecimal
exchangeRate
;
@Excel
(
name
=
"目标金额"
,
orderNum
=
"
8
"
)
@Excel
(
name
=
"目标金额"
,
orderNum
=
"
9
"
)
private
BigDecimal
toAmount
;
@Excel
(
name
=
"目标币种"
,
orderNum
=
"
9
"
)
@Excel
(
name
=
"目标币种"
,
orderNum
=
"
10
"
)
private
String
toCurrency
;
@Excel
(
name
=
"出账月(实)"
,
orderNum
=
"1
0
"
)
@Excel
(
name
=
"出账月(实)"
,
orderNum
=
"1
1
"
)
private
String
fortuneAccountMonth
;
@Excel
(
name
=
"出账机构"
,
orderNum
=
"1
1
"
)
@Excel
(
name
=
"出账机构"
,
orderNum
=
"1
2
"
)
private
String
billOrg
;
@Excel
(
name
=
"本期总出账金额(原币种)"
,
orderNum
=
"1
2
"
)
private
BigDecimal
hkdA
mount
;
@Excel
(
name
=
"本期总出账金额(原币种)"
,
orderNum
=
"1
3
"
)
private
BigDecimal
a
mount
;
}
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/salarysplit/ApiSalarySplitSummaryPageDto.java
View file @
211b316e
...
...
@@ -94,7 +94,7 @@ public class ApiSalarySplitSummaryPageDto {
private
String
status
;
/**
* 出账总额
* 出账总额
(发放币种金额总额)
*/
private
BigDecimal
amount
;
...
...
@@ -104,7 +104,7 @@ public class ApiSalarySplitSummaryPageDto {
private
BigDecimal
hkdAmount
;
/**
* 出账币种(
原
币种)
* 出账币种(
发放
币种)
*/
private
String
currency
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAccountExportDTO.java
View file @
211b316e
...
...
@@ -25,11 +25,14 @@ public class FortuneAccountExportDTO implements Serializable {
private
String
teamBizId
;
@ExcelProperty
(
"
出账
币种"
)
private
String
c
urrency
;
@ExcelProperty
(
"
发放
币种"
)
private
String
payoutC
urrency
;
@ExcelProperty
(
"出账总额"
)
private
BigDecimal
amount
;
@ExcelProperty
(
"发放金额"
)
private
BigDecimal
payoutAmount
;
@ExcelProperty
(
"出账港币总额"
)
private
BigDecimal
hkdAmount
;
private
List
<
Fortune
>
fortuneList
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/FortuneAccount.java
View file @
211b316e
...
...
@@ -54,17 +54,17 @@ public class FortuneAccount implements Serializable {
private
String
teamBizId
;
/**
*
出账
币种
*
发放
币种
*/
private
String
c
urrency
;
private
String
payoutC
urrency
;
/**
*
出账总
额
*
发放金
额
*/
private
BigDecimal
a
mount
;
private
BigDecimal
payoutA
mount
;
/**
* 港币
出账
金额
* 港币金额
*/
private
BigDecimal
hkdAmount
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
View file @
211b316e
...
...
@@ -15,6 +15,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.yd.base.feign.client.exchangerate.ApiExchangeRateFeignClient
;
import
com.yd.base.feign.dto.ApiQueryBatchExchangeRateDTO
;
import
com.yd.base.feign.request.exchangerate.ApiQueryBatchExchangeRateRequest
;
import
com.yd.base.feign.response.exchangerate.ApiQueryBatchExchangeRateResponse
;
import
com.yd.common.constant.CommonConstant
;
import
com.yd.common.constant.RedisConstants
;
import
com.yd.common.enums.ResultCode
;
...
...
@@ -969,34 +972,118 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
return
commissionStatistics
;
}
// @Override
// public CommissionExpectedStatisticsVO getExpectedStatisticsNew(List<CommissionExpected> allExpectedList) {
// // 空集合直接返回空统计
// if (CollectionUtils.isEmpty(allExpectedList)) {
// return emptyStatistics();
// }
//
// // 查询所有记录(包含失效状态)
//// List<CommissionExpected> allExpectedList = this.listByIds(expectedIds);
//// if (CollectionUtils.isEmpty(allExpectedList)) {
//// return emptyStatistics();
//// }
//
// // 过滤掉已失效的记录(status = "3")
// List<CommissionExpected> validList = allExpectedList.stream()
// .filter(e -> !"3".equals(e.getStatus()))
// .collect(Collectors.toList());
//
// if (validList.isEmpty()) {
// return emptyStatistics();
// }
//
// // 手动聚合计算
// BigDecimal totalAmount = BigDecimal.ZERO;
// BigDecimal totalPaidAmount = BigDecimal.ZERO;
// //累计已入账来佣比例(同保单多个入账项目累计的实佣率)
// BigDecimal totalPaidRatio = BigDecimal.ZERO;
// //累计来佣比例(同保单多个入账项目累计的产品来佣率)
// BigDecimal totalCommissionRatio = BigDecimal.ZERO;
// Set<String> policyNoSet = new HashSet<>();
//
// for (CommissionExpected expected : validList) {
// totalAmount = totalAmount.add(ObjectUtils.defaultIfNull(expected.getExpectedAmount(), BigDecimal.ZERO));
// totalPaidAmount = totalPaidAmount.add(ObjectUtils.defaultIfNull(expected.getPaidAmount(), BigDecimal.ZERO));
// totalPaidRatio = totalPaidRatio.add(ObjectUtils.defaultIfNull(expected.getPaidRatio(), BigDecimal.ZERO));
// totalCommissionRatio = totalCommissionRatio.add(ObjectUtils.defaultIfNull(expected.getCommissionRatio(), BigDecimal.ZERO));
// if (StringUtils.isNotBlank(expected.getPolicyNo())) {
// policyNoSet.add(expected.getPolicyNo());
// }
// }
//
// // 计算总保费(HKD)
// BigDecimal totalPremium = BigDecimal.ZERO;
// BigDecimal fromTotalPremium = BigDecimal.ZERO;
// if (CollectionUtils.isNotEmpty(policyNoSet)) {
// List<Policy> policyList = policyService.lambdaQuery()
// .select(Policy::getPolicyNo,
// Policy::getTotalPaymentPremium,
// Policy::getCurrency)
// .in(Policy::getPolicyNo, policyNoSet)
// .list();
// if (CollectionUtils.isNotEmpty(policyList)) {
// for (Policy policy : policyList) {
// // 获取保单币种到港币的汇率
// BigDecimal rate = queryExchangeRateByFeign(policy.getCurrency(), "HKD");
// if (rate == null) rate = BigDecimal.ONE;
// totalPremium = totalPremium.add(policy.getTotalPaymentPremium().multiply(rate));
// fromTotalPremium = fromTotalPremium.add(policy.getTotalPaymentPremium());
// }
// }
// }
//
// // 组装返回对象
// CommissionExpectedStatisticsVO vo = new CommissionExpectedStatisticsVO();
// vo.setTotalAmount(totalAmount);
// vo.setTotalPaidAmount(totalPaidAmount);
// vo.setPendingPaidAmountS(totalAmount.subtract(totalPaidAmount));
//
// if (totalAmount.compareTo(BigDecimal.ZERO) > 0) {
// BigDecimal ratio = totalPaidAmount.divide(totalAmount, 4, RoundingMode.HALF_UP)
// .multiply(BigDecimal.valueOf(100));
// vo.setPaidAmountRatio(ratio);
// } else {
// vo.setPaidAmountRatio(BigDecimal.ZERO);
// }
//
// // 待入账金额归零 = 已入账来佣比例(累计实佣率)>= 累计产品来佣率
//// if (totalPaidRatio.compareTo(totalCommissionRatio) >= 0){
//// vo.setPendingPaidAmount(BigDecimal.ZERO);
//// }
// vo.setPendingPaidAmount(totalAmount);
// vo.setTotalPolicyCount(policyNoSet.size());
// vo.setTotalPremium(totalPremium);
// vo.setFromTotalPremium(fromTotalPremium);
// vo.setPolicyNos(null); // 原字段可能用于其他逻辑,此处置空
// return vo;
// }
@Override
public
CommissionExpectedStatisticsVO
getExpectedStatisticsNew
(
List
<
CommissionExpected
>
allExpectedList
)
{
// 空集合直接返回空统计
long
t0
=
System
.
currentTimeMillis
();
log
.
info
(
"getExpectedStatisticsNew 开始, 输入大小: {}"
,
allExpectedList
==
null
?
0
:
allExpectedList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
allExpectedList
))
{
return
emptyStatistics
();
}
// 查询所有记录(包含失效状态)
// List<CommissionExpected> allExpectedList = this.listByIds(expectedIds);
// if (CollectionUtils.isEmpty(allExpectedList)) {
// return emptyStatistics();
// }
// 过滤掉已失效的记录(status = "3")
long
t1
=
System
.
currentTimeMillis
();
List
<
CommissionExpected
>
validList
=
allExpectedList
.
stream
()
.
filter
(
e
->
!
"3"
.
equals
(
e
.
getStatus
()))
.
collect
(
Collectors
.
toList
());
log
.
info
(
"过滤 status=3 耗时: {} ms, 有效数量: {}"
,
System
.
currentTimeMillis
()
-
t1
,
validList
.
size
());
if
(
validList
.
isEmpty
())
{
return
emptyStatistics
();
}
long
t2
=
System
.
currentTimeMillis
();
// 手动聚合计算
BigDecimal
totalAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalPaidAmount
=
BigDecimal
.
ZERO
;
//累计已入账来佣比例(同保单多个入账项目累计的实佣率)
BigDecimal
totalPaidRatio
=
BigDecimal
.
ZERO
;
//累计来佣比例(同保单多个入账项目累计的产品来佣率)
BigDecimal
totalCommissionRatio
=
BigDecimal
.
ZERO
;
Set
<
String
>
policyNoSet
=
new
HashSet
<>();
...
...
@@ -1009,25 +1096,64 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
policyNoSet
.
add
(
expected
.
getPolicyNo
());
}
}
log
.
info
(
"内存聚合耗时: {} ms, 保单数: {}"
,
System
.
currentTimeMillis
()
-
t2
,
policyNoSet
.
size
());
// 计算总保费(HKD)
long
t3
=
System
.
currentTimeMillis
();
// 计算总保费
BigDecimal
totalPremium
=
BigDecimal
.
ZERO
;
BigDecimal
fromTotalPremium
=
BigDecimal
.
ZERO
;
if
(
CollectionUtils
.
isNotEmpty
(
policyNoSet
))
{
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
()
.
select
(
Policy:
:
getPolicyNo
,
Policy:
:
getTotalPaymentPremium
,
Policy:
:
getCurrency
)
.
in
(
Policy:
:
getPolicyNo
,
policyNoSet
)
.
list
();
log
.
info
(
"查询保单信息耗时: {} ms, 结果数量: {}"
,
System
.
currentTimeMillis
()
-
t3
,
policyList
.
size
());
if
(
CollectionUtils
.
isNotEmpty
(
policyList
))
{
// 1. 收集所有需要查询的币种(去重)
Set
<
String
>
currencies
=
policyList
.
stream
()
.
map
(
Policy:
:
getCurrency
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
collect
(
Collectors
.
toSet
());
// 2. 构建批量查询请求(币种 -> HKD)
ApiQueryBatchExchangeRateRequest
batchRequest
=
new
ApiQueryBatchExchangeRateRequest
();
List
<
ApiQueryBatchExchangeRateDTO
>
dtoList
=
new
ArrayList
<>();
for
(
String
currency
:
currencies
)
{
ApiQueryBatchExchangeRateDTO
dto
=
new
ApiQueryBatchExchangeRateDTO
();
dto
.
setBaseCurrency
(
currency
);
dto
.
setTargetCurrency
(
"HKD"
);
dtoList
.
add
(
dto
);
}
batchRequest
.
setRateDTOList
(
dtoList
);
// 3. 调用批量汇率接口
Result
<
ApiQueryBatchExchangeRateResponse
>
batchResult
=
apiExchangeRateFeignClient
.
queryBatchExchangeRate
(
batchRequest
);
Map
<
String
,
BigDecimal
>
rateMap
=
new
HashMap
<>();
if
(
batchResult
!=
null
&&
batchResult
.
getCode
()
==
200
&&
batchResult
.
getData
()
!=
null
)
{
List
<
ApiQueryBatchExchangeRateDTO
>
resultList
=
batchResult
.
getData
().
getRateDTOList
();
for
(
ApiQueryBatchExchangeRateDTO
result
:
resultList
)
{
if
(
result
.
getExchangeRate
()
!=
null
)
{
rateMap
.
put
(
result
.
getBaseCurrency
(),
result
.
getExchangeRate
());
}
}
}
// 4. 循环计算总保费,从 map 中取汇率
long
t4
=
System
.
currentTimeMillis
();
for
(
Policy
policy
:
policyList
)
{
// 获取保单币种到港币的汇率
BigDecimal
rate
=
queryExchangeRateByFeign
(
policy
.
getCurrency
(),
"HKD"
);
if
(
rate
==
null
)
rate
=
BigDecimal
.
ONE
;
BigDecimal
rate
=
rateMap
.
getOrDefault
(
policy
.
getCurrency
(),
BigDecimal
.
ONE
);
totalPremium
=
totalPremium
.
add
(
policy
.
getTotalPaymentPremium
().
multiply
(
rate
));
fromTotalPremium
=
fromTotalPremium
.
add
(
policy
.
getTotalPaymentPremium
());
}
log
.
info
(
"汇率计算及保费累加耗时: {} ms"
,
System
.
currentTimeMillis
()
-
t4
);
}
}
// 组装返回对象
CommissionExpectedStatisticsVO
vo
=
new
CommissionExpectedStatisticsVO
();
vo
.
setTotalAmount
(
totalAmount
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
View file @
211b316e
...
...
@@ -167,8 +167,9 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
fortuneAccount
.
setBrokerBizId
(
accountExportDTO
.
getBrokerBizId
());
fortuneAccount
.
setTeam
(
accountExportDTO
.
getTeam
());
fortuneAccount
.
setTeamBizId
(
accountExportDTO
.
getTeamBizId
());
fortuneAccount
.
setCurrency
(
accountExportDTO
.
getCurrency
());
fortuneAccount
.
setHkdAmount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
setPayoutCurrency
(
accountExportDTO
.
getPayoutCurrency
());
fortuneAccount
.
setPayoutAmount
(
accountExportDTO
.
getPayoutAmount
());
fortuneAccount
.
setHkdAmount
(
accountExportDTO
.
getHkdAmount
());
fortuneAccount
.
setFortuneAccountDate
(
this
.
getActualPayoutDate
(
accountExportDTO
.
getActualPayoutDate
()));
// 出账状态默认待出账
fortuneAccount
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
211b316e
...
...
@@ -431,7 +431,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
for
(
Map
.
Entry
<
String
,
List
<
Fortune
>>
entry
:
fortuneMap
.
entrySet
())
{
String
broker
=
entry
.
getKey
().
split
(
"_"
)[
0
];
String
actualPayoutDate
=
entry
.
getKey
().
split
(
"_"
)[
1
];
String
c
urrency
=
entry
.
getKey
().
split
(
"_"
)[
2
];
String
payoutC
urrency
=
entry
.
getKey
().
split
(
"_"
)[
2
];
List
<
Fortune
>
brokerFortunes
=
entry
.
getValue
();
FortuneAccountExportDTO
accountDTO
=
new
FortuneAccountExportDTO
();
...
...
@@ -443,15 +443,19 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if
(
CollUtil
.
isNotEmpty
(
brokerFortunes
))
{
accountDTO
.
setTeam
(
brokerFortunes
.
get
(
0
).
getTeam
());
accountDTO
.
setTeamBizId
(
brokerFortunes
.
get
(
0
).
getTeamBizId
());
accountDTO
.
set
Currency
(
c
urrency
);
accountDTO
.
set
PayoutCurrency
(
payoutC
urrency
);
accountDTO
.
setActualPayoutDate
(
LocalDate
.
parse
(
actualPayoutDate
));
}
// 计算出账总额
BigDecimal
totalAmount
=
brokerFortunes
.
stream
()
.
map
(
Fortune:
:
getCurrentPaymentHkdAmount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
accountDTO
.
setAmount
(
totalAmount
);
// 计算出账港币总额、发放币种总额
BigDecimal
totalHkdAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalPayoutAmount
=
BigDecimal
.
ZERO
;
for
(
Fortune
fortune
:
brokerFortunes
)
{
totalHkdAmount
=
totalHkdAmount
.
add
(
fortune
.
getCurrentPaymentHkdAmount
());
totalPayoutAmount
=
totalPayoutAmount
.
add
(
fortune
.
getPayoutAmount
());
}
accountDTO
.
setHkdAmount
(
totalHkdAmount
);
accountDTO
.
setPayoutAmount
(
totalPayoutAmount
);
// 按fortune项目分组并累加金额
Map
<
String
,
BigDecimal
>
fortuneAmountMap
=
brokerFortunes
.
stream
()
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneAccountVO.java
View file @
211b316e
...
...
@@ -51,10 +51,16 @@ public class FortuneAccountVO {
private
String
team
;
/**
*
出账
币种
*
发放
币种
*/
@Schema
(
description
=
"出账币种"
)
private
String
currency
;
@Schema
(
description
=
"发放币种"
)
private
String
payoutCurrency
;
/**
* 发放金额
*/
@Schema
(
description
=
"发放金额"
)
private
BigDecimal
payoutAmount
;
/**
* 港币出账金额
...
...
yd-csf-service/src/main/resources/mappers/FortuneAccountMapper.xml
View file @
211b316e
...
...
@@ -11,8 +11,8 @@
<result
property=
"brokerBizId"
column=
"broker_biz_id"
/>
<result
property=
"team"
column=
"team"
/>
<result
property=
"teamBizId"
column=
"team_biz_id"
/>
<result
property=
"
currency"
column=
"
currency"
/>
<result
property=
"
amount"
column=
"
amount"
/>
<result
property=
"
payoutCurrency"
column=
"payout_
currency"
/>
<result
property=
"
payoutAmount"
column=
"payout_
amount"
/>
<result
property=
"hkdAmount"
column=
"hkd_amount"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"fortuneAccountDate"
column=
"fortune_account_date"
/>
...
...
@@ -27,7 +27,7 @@
<sql
id=
"Base_Column_List"
>
id,fortune_account_biz_id,broker,broker_biz_id,team,team_biz_id,
currency,
amount,hkd_amount,status,fortune_account_date,content,remark,
payout_currency,payout_
amount,hkd_amount,status,fortune_account_date,content,remark,
is_deleted,creator_id,updater_id,create_time,update_time
</sql>
</mapper>
yd-csf-service/src/main/resources/mappers/SalarySplitMapper.xml
View file @
211b316e
...
...
@@ -26,9 +26,9 @@
fa.fortune_account_date,
ss.bill_org,
fa.status,
fa.amount,
fa.
payout_amount as
amount,
fa.hkd_amount,
fa.currency,
fa.
payout_currency as
currency,
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month,
fa.business_no
from salary_split ss
...
...
@@ -109,9 +109,9 @@
fa.fortune_account_date,
ss.bill_org,
fa.status,
fa.amount,
fa.
payout_amount as
amount,
fa.hkd_amount,
fa.currency,
fa.
payout_currency as
currency,
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month,
fa.business_no
from salary_split ss
...
...
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