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
d68a8580
Commit
d68a8580
authored
Jan 09, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/test' into test
parents
3c1f1598
f2b15108
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
101 additions
and
105 deletions
+101
-105
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/CommissionExpected.java
+5
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/Fortune.java
+5
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
+2
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
+29
-41
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
+5
-2
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+19
-25
yd-csf-service/src/main/java/com/yd/csf/service/vo/ExpectedFortuneExportDTO.java
+3
-3
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
+18
-27
yd-csf-service/src/main/resources/mappers/CommissionExpectedMapper.xml
+2
-1
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
+10
-6
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
d68a8580
...
@@ -511,6 +511,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -511,6 +511,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getAmount
()))
{
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账金额不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账金额不能为空"
);
}
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账币种不能为空"
);
}
}
}
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/CommissionExpected.java
View file @
d68a8580
...
@@ -48,6 +48,11 @@ public class CommissionExpected implements Serializable {
...
@@ -48,6 +48,11 @@ public class CommissionExpected implements Serializable {
private
String
policyNo
;
private
String
policyNo
;
/**
/**
* 期交保费
*/
private
BigDecimal
premium
;
/**
* 保险公司业务id
* 保险公司业务id
*/
*/
private
String
insuranceCompanyBizId
;
private
String
insuranceCompanyBizId
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/Fortune.java
View file @
d68a8580
...
@@ -169,6 +169,11 @@ public class Fortune implements Serializable {
...
@@ -169,6 +169,11 @@ public class Fortune implements Serializable {
private
LocalDate
actualPayoutDate
;
private
LocalDate
actualPayoutDate
;
/**
/**
* 检核人
*/
private
String
reconciliationOperator
;
/**
* 出账数据业务ID
* 出账数据业务ID
*/
*/
private
String
fortuneAccountBizId
;
private
String
fortuneAccountBizId
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
View file @
d68a8580
...
@@ -292,6 +292,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -292,6 +292,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
// 设置关联字段
// 设置关联字段
commissionExpected
.
setInsuranceCompanyBizId
(
policy
.
getInsuranceCompanyBizId
());
commissionExpected
.
setInsuranceCompanyBizId
(
policy
.
getInsuranceCompanyBizId
());
commissionExpected
.
setProductLaunchBizId
(
policy
.
getProductLaunchBizId
());
commissionExpected
.
setProductLaunchBizId
(
policy
.
getProductLaunchBizId
());
commissionExpected
.
setPremium
(
policy
.
getPaymentPremium
());
}
else
{
}
else
{
BigDecimal
expectedAmount
=
addDto
.
getAmount
()
BigDecimal
expectedAmount
=
addDto
.
getAmount
()
.
multiply
(
commissionExpected
.
getDefaultExchangeRate
());
.
multiply
(
commissionExpected
.
getDefaultExchangeRate
());
...
@@ -407,6 +408,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -407,6 +408,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
.
multiply
(
commissionExpected
.
getDefaultExchangeRate
())
.
multiply
(
commissionExpected
.
getDefaultExchangeRate
())
.
divide
(
BigDecimal
.
valueOf
(
100
),
4
,
RoundingMode
.
HALF_UP
)
.
divide
(
BigDecimal
.
valueOf
(
100
),
4
,
RoundingMode
.
HALF_UP
)
);
);
commissionExpected
.
setPremium
(
policy
.
getPaymentPremium
());
}
else
{
}
else
{
commissionExpected
.
setExpectedAmount
(
commissionExpected
.
setExpectedAmount
(
commissionExpectedUpdateRequest
.
getAmount
()
commissionExpectedUpdateRequest
.
getAmount
()
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
View file @
d68a8580
...
@@ -45,7 +45,6 @@ import java.math.BigDecimal;
...
@@ -45,7 +45,6 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.function.Supplier
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -537,15 +536,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -537,15 +536,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
List
<
ExpectedFortune
>
expectedFortuneList
=
iExpectedFortuneService
.
lambdaQuery
()
List
<
ExpectedFortune
>
expectedFortuneList
=
iExpectedFortuneService
.
lambdaQuery
()
.
in
(
ExpectedFortune:
:
getPolicyNo
,
policyNoSet
)
.
in
(
ExpectedFortune:
:
getPolicyNo
,
policyNoSet
)
.
list
();
.
list
();
// 1.2 根据保单号和期数筛选符合的预计发佣记录
// 1.2 根据期数筛选符合的预计发佣记录
Set
<
Integer
>
commissionPeriodSet
=
commissions
.
stream
().
map
(
Commission:
:
getCommissionPeriod
).
collect
(
Collectors
.
toSet
());
List
<
ExpectedFortune
>
filteredExpectedFortuneList1
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
filteredExpectedFortuneList1
=
new
ArrayList
<>();
for
(
Commission
commission
:
commissions
)
{
for
(
ExpectedFortune
expectedFortune
:
expectedFortuneList
)
{
String
policyNo
=
commission
.
getPolicyNo
();
if
(
commissionPeriodSet
.
contains
(
expectedFortune
.
getFortunePeriod
()))
{
Integer
commissionPeriod
=
commission
.
getCommissionPeriod
();
filteredExpectedFortuneList1
.
add
(
expectedFortune
);
for
(
ExpectedFortune
expectedFortune
:
expectedFortuneList
)
{
if
(
expectedFortune
.
getPolicyNo
().
equals
(
policyNo
)
&&
expectedFortune
.
getFortunePeriod
().
equals
(
commissionPeriod
))
{
filteredExpectedFortuneList1
.
add
(
expectedFortune
);
}
}
}
}
}
if
(
CollectionUtils
.
isEmpty
(
filteredExpectedFortuneList1
))
{
if
(
CollectionUtils
.
isEmpty
(
filteredExpectedFortuneList1
))
{
...
@@ -629,7 +625,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -629,7 +625,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
Map
<
String
,
Commission
>
commissionByPolicyPeriod
=
commissionList
.
stream
()
Map
<
String
,
Commission
>
commissionByPolicyPeriod
=
commissionList
.
stream
()
.
collect
(
Collectors
.
toMap
(
.
collect
(
Collectors
.
toMap
(
commission
->
buildPolicyPeriodKey
(
commission
.
getPolicyNo
(),
commission
.
getCommissionPeriod
()),
commission
->
buildPolicyPeriodKey
(
commission
.
getPolicyNo
(),
commission
.
getCommissionPeriod
()),
Function
.
identity
()
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
// 遇到重复时使用新值
));
));
Date
now
=
new
Date
();
Date
now
=
new
Date
();
...
@@ -639,9 +636,13 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -639,9 +636,13 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
BeanUtils
.
copyProperties
(
expectedFortune
,
fortune
);
BeanUtils
.
copyProperties
(
expectedFortune
,
fortune
);
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setId
(
null
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setExchangeRate
(
queryDefaultExchangeRate
(
fortune
.
getCurrency
()));
fortune
.
setAmount
(
expectedFortune
.
getAmount
());
fortune
.
setAmount
(
expectedFortune
.
getAmount
());
fortune
.
setHkdAmount
(
expectedFortune
.
getAmount
().
multiply
(
fortune
.
getExchangeRate
()));
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getAmount
());
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getCurrentPaymentAmount
().
multiply
(
fortune
.
getExchangeRate
()));
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
fortune
.
setIsPart
(
0
);
fortune
.
setIsPart
(
0
);
...
@@ -665,6 +666,24 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -665,6 +666,24 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
private
BigDecimal
queryDefaultExchangeRate
(
String
currency
)
{
if
(
StringUtils
.
isBlank
(
currency
))
{
return
BigDecimal
.
ONE
;
}
if
(
"HKD"
.
equalsIgnoreCase
(
currency
))
{
return
BigDecimal
.
valueOf
(
1
);
}
Result
<
List
<
GetDictItemListByDictTypeResponse
>>
result
=
apiSysDictFeignClient
.
getDictItemListByDictType
(
"csf_exchange_rate_hkd"
);
if
(
org
.
apache
.
commons
.
collections4
.
CollectionUtils
.
isNotEmpty
(
result
.
getData
()))
{
for
(
GetDictItemListByDictTypeResponse
dictItem
:
result
.
getData
())
{
if
(
StringUtils
.
equalsIgnoreCase
(
dictItem
.
getItemLabel
(),
currency
))
{
return
new
BigDecimal
(
dictItem
.
getItemValue
());
}
}
}
return
BigDecimal
.
ONE
;
}
/**
/**
* 构建保单号+期次的唯一键
* 构建保单号+期次的唯一键
*/
*/
...
@@ -672,37 +691,6 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -672,37 +691,6 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
return
(
policyNo
==
null
?
""
:
policyNo
)
+
"|"
+
(
period
==
null
?
""
:
period
.
toString
());
return
(
policyNo
==
null
?
""
:
policyNo
)
+
"|"
+
(
period
==
null
?
""
:
period
.
toString
());
}
}
private
void
calculateCurrentFortune
(
Fortune
fortune
,
List
<
Fortune
>
policyPaidFortuneList
)
{
// 根据转介人分组
Map
<
String
,
List
<
Fortune
>>
brokerFortuneMap
=
policyPaidFortuneList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
Fortune:
:
getBrokerBizId
));
// 当前转介人已发薪资
List
<
Fortune
>
brokerFortuneList
=
brokerFortuneMap
.
getOrDefault
(
fortune
.
getBrokerBizId
(),
new
ArrayList
<>());
// 计算当前佣金条目已发薪资
BigDecimal
brokerPaidAmount
=
brokerFortuneList
.
stream
()
.
filter
(
item
->
StringUtils
.
equals
(
item
.
getFortuneName
(),
fortune
.
getFortuneName
())
&&
item
.
getFortunePeriod
().
equals
(
fortune
.
getFortunePeriod
()))
.
map
(
Fortune:
:
getNetAmount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
// 计算当前发佣金额,需要扣减已发薪资
fortune
.
setAmount
(
fortune
.
getAmount
().
subtract
(
brokerPaidAmount
));
}
private
void
matchCommission
(
Fortune
fortune
,
List
<
Commission
>
commissionList
)
{
for
(
Commission
commission
:
commissionList
)
{
if
(
StringUtils
.
equals
(
commission
.
getPolicyNo
(),
fortune
.
getPolicyNo
())
&&
commission
.
getCommissionPeriod
().
equals
(
fortune
.
getFortunePeriod
())
&&
commission
.
getCommissionName
().
equals
(
fortune
.
getFortuneName
())
)
{
fortune
.
setCommissionBizId
(
commission
.
getCommissionBizId
());
}
else
{
fortune
.
setStatus
(
FortuneStatusEnum
.
MATCH_FAIL
.
getItemValue
());
fortune
.
setRemark
(
"未找到当前预计发佣对应的来佣"
);
}
}
}
@Override
@Override
public
Commission
getByCommissionBizId
(
String
commissionBizId
)
{
public
Commission
getByCommissionBizId
(
String
commissionBizId
)
{
return
this
.
getOne
(
new
QueryWrapper
<
Commission
>().
eq
(
"commission_biz_id"
,
commissionBizId
));
return
this
.
getOne
(
new
QueryWrapper
<
Commission
>().
eq
(
"commission_biz_id"
,
commissionBizId
));
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
View file @
d68a8580
...
@@ -67,6 +67,9 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -67,6 +67,9 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
return
queryWrapper
;
return
queryWrapper
;
}
}
List
<
String
>
statusList
=
fortuneAccountQueryRequest
.
getStatusList
();
List
<
String
>
statusList
=
fortuneAccountQueryRequest
.
getStatusList
();
if
(
CollectionUtils
.
isEmpty
(
statusList
))
{
statusList
=
Collections
.
singletonList
(
"6"
);
}
List
<
String
>
brokerBizIdList
=
fortuneAccountQueryRequest
.
getBrokerBizIdList
();
List
<
String
>
brokerBizIdList
=
fortuneAccountQueryRequest
.
getBrokerBizIdList
();
List
<
String
>
teamBizIdList
=
fortuneAccountQueryRequest
.
getTeamBizIdList
();
List
<
String
>
teamBizIdList
=
fortuneAccountQueryRequest
.
getTeamBizIdList
();
queryWrapper
.
in
(
CollectionUtils
.
isNotEmpty
(
brokerBizIdList
),
"broker_biz_id"
,
brokerBizIdList
);
queryWrapper
.
in
(
CollectionUtils
.
isNotEmpty
(
brokerBizIdList
),
"broker_biz_id"
,
brokerBizIdList
);
...
@@ -124,7 +127,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -124,7 +127,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
fortuneAccount
.
setAmount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
setAmount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
setFortuneAccountDate
(
currentDate
);
fortuneAccount
.
setFortuneAccountDate
(
currentDate
);
// 出账状态默认待出账
// 出账状态默认待出账
fortuneAccount
.
setStatus
(
Fortune
AccountStatusEnum
.
CANSEN
D
.
getItemValue
());
fortuneAccount
.
setStatus
(
Fortune
StatusEnum
.
CHECKE
D
.
getItemValue
());
// 转换为List<Map<String, Object>>
// 转换为List<Map<String, Object>>
Map
<
String
,
BigDecimal
>
fortuneAmounts
=
accountExportDTO
.
getFortuneAmounts
();
Map
<
String
,
BigDecimal
>
fortuneAmounts
=
accountExportDTO
.
getFortuneAmounts
();
...
@@ -263,7 +266,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -263,7 +266,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
/* 2. 更新 FortuneAccount 状态为已出账 ----------------------------------*/
/* 2. 更新 FortuneAccount 状态为已出账 ----------------------------------*/
accountList
.
forEach
(
a
->
{
accountList
.
forEach
(
a
->
{
a
.
setStatus
(
Fortune
Account
StatusEnum
.
SENT
.
getItemValue
());
a
.
setStatus
(
FortuneStatusEnum
.
SENT
.
getItemValue
());
a
.
setFortuneAccountDate
(
new
Date
());
a
.
setFortuneAccountDate
(
new
Date
());
a
.
setUpdaterId
(
loginUserId
.
toString
());
a
.
setUpdaterId
(
loginUserId
.
toString
());
a
.
setUpdateTime
(
new
Date
());
a
.
setUpdateTime
(
new
Date
());
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
d68a8580
...
@@ -76,9 +76,6 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -76,9 +76,6 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
}
String
reconciliationYearMonth
=
fortuneQueryRequest
.
getReconciliationYearMonth
();
String
reconciliationYearMonth
=
fortuneQueryRequest
.
getReconciliationYearMonth
();
List
<
String
>
statusList
=
fortuneQueryRequest
.
getStatusList
();
List
<
String
>
statusList
=
fortuneQueryRequest
.
getStatusList
();
if
(
CollectionUtils
.
isEmpty
(
statusList
))
{
statusList
=
Collections
.
singletonList
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
}
String
policyNo
=
fortuneQueryRequest
.
getPolicyNo
();
String
policyNo
=
fortuneQueryRequest
.
getPolicyNo
();
List
<
String
>
insuranceCompanyBizIdList
=
fortuneQueryRequest
.
getInsuranceCompanyBizIdList
();
List
<
String
>
insuranceCompanyBizIdList
=
fortuneQueryRequest
.
getInsuranceCompanyBizIdList
();
List
<
String
>
productLaunchBizIdList
=
fortuneQueryRequest
.
getProductLaunchBizIdList
();
List
<
String
>
productLaunchBizIdList
=
fortuneQueryRequest
.
getProductLaunchBizIdList
();
...
@@ -116,21 +113,16 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -116,21 +113,16 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
List
<
FortuneVO
>
fortuneVOList
=
new
ArrayList
<>();
List
<
FortuneVO
>
fortuneVOList
=
new
ArrayList
<>();
Set
<
String
>
expectedFortuneBizIdSet
=
new
HashSet
<>();
Set
<
String
>
expectedFortuneBizIdSet
=
new
HashSet
<>();
Set
<
String
>
commissionBizIdSet
=
new
HashSet
<>();
Set
<
String
>
policyNoSet
=
new
HashSet
<>();
Set
<
String
>
policyNoSet
=
new
HashSet
<>();
for
(
Fortune
fortune
:
fortuneList
)
{
for
(
Fortune
fortune
:
fortuneList
)
{
FortuneVO
fortuneVO
=
FortuneVO
.
objToVo
(
fortune
);
FortuneVO
fortuneVO
=
FortuneVO
.
objToVo
(
fortune
);
fortuneVOList
.
add
(
fortuneVO
);
fortuneVOList
.
add
(
fortuneVO
);
expectedFortuneBizIdSet
.
add
(
fortune
.
getExpectedFortuneBizId
());
expectedFortuneBizIdSet
.
add
(
fortune
.
getExpectedFortuneBizId
());
commissionBizIdSet
.
add
(
fortune
.
getCommissionBizId
());
policyNoSet
.
add
(
fortune
.
getPolicyNo
());
policyNoSet
.
add
(
fortune
.
getPolicyNo
());
}
}
// 1.关联查询来佣信息
List
<
Commission
>
commissionList
=
commissionService
.
list
(
new
QueryWrapper
<
Commission
>().
in
(
"commission_biz_id"
,
commissionBizIdSet
));
Map
<
String
,
Commission
>
commissionMap
=
commissionList
.
stream
().
collect
(
Collectors
.
toMap
(
Commission:
:
getCommissionBizId
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
Set
<
String
>
commissionExpectedBizIdSet
=
commissionList
.
stream
().
map
(
Commission
:
:
getCommissionExpectedBizId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
commissionExpectedBizIdSet
=
fortuneList
.
stream
().
map
(
Fortune
:
:
getCommissionExpectedBizId
).
collect
(
Collectors
.
toSet
());
// 1
.1
关联查询来佣预期信息
// 1 关联查询来佣预期信息
List
<
CommissionExpected
>
commissionExpectedList
=
commissionExpectedService
.
lambdaQuery
()
List
<
CommissionExpected
>
commissionExpectedList
=
commissionExpectedService
.
lambdaQuery
()
.
in
(
CommissionExpected:
:
getCommissionExpectedBizId
,
commissionExpectedBizIdSet
)
.
in
(
CommissionExpected:
:
getCommissionExpectedBizId
,
commissionExpectedBizIdSet
)
.
select
(
CommissionExpected:
:
getCommissionExpectedBizId
,
CommissionExpected:
:
getPaidAmount
,
CommissionExpected:
:
getPaidRatio
)
.
select
(
CommissionExpected:
:
getCommissionExpectedBizId
,
CommissionExpected:
:
getPaidAmount
,
CommissionExpected:
:
getPaidRatio
)
...
@@ -149,15 +141,12 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -149,15 +141,12 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
Map
<
String
,
ExpectedFortune
>
expectedFortuneMap
=
expectedFortuneList
.
stream
().
collect
(
Collectors
.
toMap
(
ExpectedFortune:
:
getExpectedFortuneBizId
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
Map
<
String
,
ExpectedFortune
>
expectedFortuneMap
=
expectedFortuneList
.
stream
().
collect
(
Collectors
.
toMap
(
ExpectedFortune:
:
getExpectedFortuneBizId
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
fortuneVOList
.
forEach
(
fortuneVO
->
{
fortuneVOList
.
forEach
(
fortuneVO
->
{
String
commissionBizId
=
fortuneVO
.
getCommissionBizId
();
String
commissionBizId
=
fortuneVO
.
getCommissionExpectedBizId
();
Commission
commission
=
commissionMap
.
get
(
commissionBizId
);
// 设置来佣金额和比例
if
(
commission
!=
null
)
{
CommissionExpected
commissionExpected
=
commissionExpectedMap
.
get
(
commissionBizId
);
// 设置来佣金额和比例
if
(
commissionExpected
!=
null
)
{
CommissionExpected
commissionExpected
=
commissionExpectedMap
.
get
(
commission
.
getCommissionExpectedBizId
());
fortuneVO
.
setCommissionPaidAmount
(
commissionExpected
.
getPaidAmount
());
if
(
commissionExpected
!=
null
)
{
fortuneVO
.
setCommissionPaidRatio
(
commissionExpected
.
getPaidRatio
());
fortuneVO
.
setCommissionPaidAmount
(
commissionExpected
.
getPaidAmount
());
fortuneVO
.
setCommissionPaidRatio
(
commissionExpected
.
getPaidRatio
());
}
}
}
// 设置保单信息
// 设置保单信息
...
@@ -167,11 +156,6 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -167,11 +156,6 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
fortuneVO
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
fortuneVO
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
fortuneVO
.
setProductName
(
policy
.
getProductName
());
fortuneVO
.
setProductName
(
policy
.
getProductName
());
}
}
// 设置预计出账信息
ExpectedFortune
expectedFortune
=
expectedFortuneMap
.
get
(
fortuneVO
.
getExpectedFortuneBizId
());
if
(
expectedFortune
!=
null
)
{
FortuneVO
.
calculateByExpectedFortune
(
fortuneVO
,
expectedFortune
);
}
});
});
fortuneVOPage
.
setRecords
(
fortuneVOList
);
fortuneVOPage
.
setRecords
(
fortuneVOList
);
...
@@ -225,6 +209,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -225,6 +209,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
// 检核人
fortune
.
setReconciliationOperator
(
currentLoginUser
.
getUsername
());
// 如果传入了金额
// 如果传入了金额
if
(
currentPaymentAmount
!=
null
)
{
if
(
currentPaymentAmount
!=
null
)
{
splitFortune
(
fortune
,
currentPaymentAmount
,
expectedFortune
,
loginUserId
,
fortuneUpdateRequest
);
splitFortune
(
fortune
,
currentPaymentAmount
,
expectedFortune
,
loginUserId
,
fortuneUpdateRequest
);
...
@@ -583,8 +570,15 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -583,8 +570,15 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
else
{
}
else
{
fortuneStatistics
=
fortuneStatisticsList
.
get
(
0
);
fortuneStatistics
=
fortuneStatisticsList
.
get
(
0
);
}
}
if
(
fortuneStatistics
.
getAvailableOutAmount
()
==
null
)
{
fortuneStatistics
.
setAvailableOutAmount
(
BigDecimal
.
ZERO
);
}
// 计算差额
// 计算差额
fortuneStatistics
.
setDifferenceAmount
(
fortuneStatistics
.
getPendingOutAmount
().
subtract
(
fortuneStatistics
.
getAvailableOutAmount
()));
if
(
fortuneStatistics
.
getPendingOutAmount
()
!=
null
&&
fortuneStatistics
.
getAvailableOutAmount
()
!=
null
)
{
fortuneStatistics
.
setDifferenceAmount
(
fortuneStatistics
.
getPendingOutAmount
().
subtract
(
fortuneStatistics
.
getAvailableOutAmount
()));
}
else
{
fortuneStatistics
.
setDifferenceAmount
(
BigDecimal
.
ZERO
);
}
return
fortuneStatistics
;
return
fortuneStatistics
;
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/ExpectedFortuneExportDTO.java
View file @
d68a8580
...
@@ -33,15 +33,15 @@ public class ExpectedFortuneExportDTO {
...
@@ -33,15 +33,15 @@ public class ExpectedFortuneExportDTO {
@ExcelProperty
(
"保单号"
)
@ExcelProperty
(
"保单号"
)
private
String
policyNo
;
private
String
policyNo
;
@ExcelProperty
(
"出账状态"
)
private
String
status
;
@ExcelProperty
(
"转介人名称"
)
@ExcelProperty
(
"转介人名称"
)
private
String
broker
;
private
String
broker
;
@ExcelProperty
(
"团队名称"
)
@ExcelProperty
(
"团队名称"
)
private
String
team
;
private
String
team
;
@ExcelProperty
(
"出账状态"
)
private
String
status
;
@ExcelProperty
(
"出账币种"
)
@ExcelProperty
(
"出账币种"
)
private
String
currency
;
private
String
currency
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
View file @
d68a8580
...
@@ -77,6 +77,12 @@ public class FortuneVO implements Serializable {
...
@@ -77,6 +77,12 @@ public class FortuneVO implements Serializable {
private
String
commissionBizId
;
private
String
commissionBizId
;
/**
/**
* 来佣预期业务id
*/
@Schema
(
description
=
"来佣预期业务id"
)
private
String
commissionExpectedBizId
;
/**
* 已入账来佣金额(HKD)
* 已入账来佣金额(HKD)
*/
*/
@Schema
(
description
=
"已入账来佣金额(HKD)"
)
@Schema
(
description
=
"已入账来佣金额(HKD)"
)
...
@@ -155,18 +161,6 @@ public class FortuneVO implements Serializable {
...
@@ -155,18 +161,6 @@ public class FortuneVO implements Serializable {
private
String
currency
;
private
String
currency
;
/**
/**
* 已出账金额
*/
@Schema
(
description
=
"已出账金额"
)
private
BigDecimal
fortunePaidAmount
;
/**
* 待出账金额
*/
@Schema
(
description
=
"剩余出账金额"
)
private
BigDecimal
fortuneUnpaidAmount
;
/**
* 本期出账金额
* 本期出账金额
*/
*/
@Schema
(
description
=
"本期出账金额"
)
@Schema
(
description
=
"本期出账金额"
)
...
@@ -259,6 +253,12 @@ public class FortuneVO implements Serializable {
...
@@ -259,6 +253,12 @@ public class FortuneVO implements Serializable {
private
String
creatorId
;
private
String
creatorId
;
/**
/**
* 操作人
*/
@Schema
(
description
=
"操作人"
)
private
String
reconciliationOperator
;
/**
* 更新人ID
* 更新人ID
*/
*/
@Schema
(
description
=
"更新人ID"
)
@Schema
(
description
=
"更新人ID"
)
...
@@ -292,22 +292,13 @@ public class FortuneVO implements Serializable {
...
@@ -292,22 +292,13 @@ public class FortuneVO implements Serializable {
}
}
FortuneVO
fortuneVO
=
new
FortuneVO
();
FortuneVO
fortuneVO
=
new
FortuneVO
();
BeanUtils
.
copyProperties
(
fortune
,
fortuneVO
);
BeanUtils
.
copyProperties
(
fortune
,
fortuneVO
);
// 待出账比例
if
(
fortuneVO
.
getCurrentPaymentRatio
()
!=
null
)
{
fortuneVO
.
setFortuneUnpaidRatio
(
BigDecimal
.
valueOf
(
100
).
subtract
(
fortuneVO
.
getCurrentPaymentRatio
()));
}
else
{
fortuneVO
.
setFortuneUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
}
return
fortuneVO
;
return
fortuneVO
;
}
}
public
static
void
calculateByExpectedFortune
(
FortuneVO
fortuneVO
,
ExpectedFortune
expectedFortune
)
{
BigDecimal
amount
=
expectedFortune
.
getAmount
();
BigDecimal
paidAmount
=
expectedFortune
.
getPaidAmount
();
if
(
amount
!=
null
&&
paidAmount
!=
null
)
{
fortuneVO
.
setAmount
(
amount
);
fortuneVO
.
setFortunePaidAmount
(
paidAmount
);
BigDecimal
unpaidAmount
=
amount
.
subtract
(
paidAmount
);
fortuneVO
.
setFortuneUnpaidAmount
(
unpaidAmount
);
fortuneVO
.
setFortuneUnpaidRatio
(
unpaidAmount
.
divide
(
amount
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)));
}
}
}
}
yd-csf-service/src/main/resources/mappers/CommissionExpectedMapper.xml
View file @
d68a8580
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<result
property=
"receivableNo"
column=
"receivable_no"
/>
<result
property=
"receivableNo"
column=
"receivable_no"
/>
<result
property=
"commissionBizType"
column=
"commission_biz_type"
/>
<result
property=
"commissionBizType"
column=
"commission_biz_type"
/>
<result
property=
"policyNo"
column=
"policy_no"
/>
<result
property=
"policyNo"
column=
"policy_no"
/>
<result
property=
"premium"
column=
"premium"
/>
<result
property=
"insuranceCompanyBizId"
column=
"insurance_company_biz_id"
/>
<result
property=
"insuranceCompanyBizId"
column=
"insurance_company_biz_id"
/>
<result
property=
"productLaunchBizId"
column=
"product_launch_biz_id"
/>
<result
property=
"productLaunchBizId"
column=
"product_launch_biz_id"
/>
<result
property=
"reconciliationCompany"
column=
"reconciliation_company"
/>
<result
property=
"reconciliationCompany"
column=
"reconciliation_company"
/>
...
@@ -40,7 +41,7 @@
...
@@ -40,7 +41,7 @@
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id,commission_expected_biz_id,receivable_no,commission_biz_type,
id,commission_expected_biz_id,receivable_no,commission_biz_type,
policy_no,insurance_company_biz_id,product_launch_biz_id,
policy_no,
premium,
insurance_company_biz_id,product_launch_biz_id,
reconciliation_company,reconciliation_company_code,reconciliation_company_biz_id,commission_period,
reconciliation_company,reconciliation_company_code,reconciliation_company_biz_id,commission_period,
total_period,commission_name,commission_type,commission_ratio,amount,currency,default_exchange_rate,expected_amount,
total_period,commission_name,commission_type,commission_ratio,amount,currency,default_exchange_rate,expected_amount,
commission_date,status,status_desc,paid_amount,paid_ratio,remark,is_deleted,creator_id,
commission_date,status,status_desc,paid_amount,paid_ratio,remark,is_deleted,creator_id,
...
...
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
View file @
d68a8580
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
<result
property=
"status"
column=
"status"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"payoutDate"
column=
"payout_date"
/>
<result
property=
"payoutDate"
column=
"payout_date"
/>
<result
property=
"actualPayoutDate"
column=
"actual_payout_date"
/>
<result
property=
"actualPayoutDate"
column=
"actual_payout_date"
/>
<result
property=
"reconciliationOperator"
column=
"reconciliation_operator"
/>
<result
property=
"isTax"
column=
"is_tax"
/>
<result
property=
"isTax"
column=
"is_tax"
/>
<result
property=
"taxAmount"
column=
"tax_amount"
/>
<result
property=
"taxAmount"
column=
"tax_amount"
/>
<result
property=
"netAmount"
column=
"net_amount"
/>
<result
property=
"netAmount"
column=
"net_amount"
/>
...
@@ -53,7 +54,7 @@
...
@@ -53,7 +54,7 @@
commission_biz_id,commission_expected_biz_id,policy_no,fortune_period,fortune_total_period,broker_biz_id,
commission_biz_id,commission_expected_biz_id,policy_no,fortune_period,fortune_total_period,broker_biz_id,
team_biz_id,grade_commission_rate,share_rate,fortune_name,fortune_type,is_part,
team_biz_id,grade_commission_rate,share_rate,fortune_name,fortune_type,is_part,
amount,currency,exchange_rate,hkd_amount,current_payment_amount,current_payment_hkd_amount,current_payment_ratio,status,payout_date,actual_payout_date,is_tax,
amount,currency,exchange_rate,hkd_amount,current_payment_amount,current_payment_hkd_amount,current_payment_ratio,status,payout_date,actual_payout_date,is_tax,
tax_amount,net_amount,salary_biz_id,base_rule_biz_id,settlement_biz_id,
tax_amount,net_amount,salary_biz_id,base_rule_biz_id,settlement_biz_id,
reconciliation_operator,
calculation_formula,remark,is_deleted,creator_id,updater_id,
calculation_formula,remark,is_deleted,creator_id,updater_id,
create_time,update_time
create_time,update_time
</sql>
</sql>
...
@@ -63,13 +64,16 @@
...
@@ -63,13 +64,16 @@
f.policy_no,
f.policy_no,
SUM(CASE WHEN f.is_part = '0' THEN f.hkd_amount ELSE 0 END) AS amount,
SUM(CASE WHEN f.is_part = '0' THEN f.hkd_amount ELSE 0 END) AS amount,
SUM(CASE WHEN f.status = '2' THEN f.current_payment_hkd_amount ELSE 0 END) AS sentAmount,
SUM(CASE WHEN f.status = '2' THEN f.current_payment_hkd_amount ELSE 0 END) AS sentAmount,
SUM(CASE WHEN f.status = '0' THEN f.current_payment_hkd_amount ELSE 0 END) AS pendingOutAmount,
IFNULL(
SUM(CASE WHEN f.status = '6' THEN f.current_payment_hkd_amount ELSE 0 END) AS availableOutAmount,
(select sum(hkd_amount)
from expected_fortune where status = '0' and policy_no = f.policy_no
),0) AS pendingOutAmount,
SUM(CASE WHEN f.status in ('6','1') THEN f.current_payment_hkd_amount ELSE 0 END) AS availableOutAmount,
COUNT(DISTINCT f.policy_no) AS totalPolicyCount,
COUNT(DISTINCT f.policy_no) AS totalPolicyCount,
MAX(c
.hk
d_amount) AS totalInAmount,
MAX(c
e.expecte
d_amount) AS totalInAmount,
MAX(c.premium) AS totalPremium
MAX(c
e
.premium) AS totalPremium
FROM fortune f
FROM fortune f
LEFT JOIN commission
c ON f.commission_biz_id = c.commission
_biz_id
LEFT JOIN commission
_expected ce ON f.commission_expected_biz_id = ce.commission_expected
_biz_id
WHERE 1 = 1
WHERE 1 = 1
<if
test=
"fortuneIdList != null and fortuneIdList.size() > 0"
>
<if
test=
"fortuneIdList != null and fortuneIdList.size() > 0"
>
AND f.id IN
AND f.id IN
...
...
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