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
fd7f918a
Commit
fd7f918a
authored
Jan 06, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/test' into test
parents
c264c145
906e0a3f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
279 additions
and
167 deletions
+279
-167
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiExpectedFortuneController.java
+1
-1
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFortuneController.java
+5
-7
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+14
-20
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneUpdateRequest.java
+0
-6
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
+26
-8
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
+7
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
+2
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
+1
-3
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
+19
-12
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
+86
-57
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+95
-28
yd-csf-service/src/main/java/com/yd/csf/service/vo/ExpectedFortuneExportDTO.java
+23
-24
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiExpectedFortuneController.java
View file @
fd7f918a
...
@@ -135,7 +135,7 @@ public class ApiExpectedFortuneController implements ApiExpectedFortuneFeignClie
...
@@ -135,7 +135,7 @@ public class ApiExpectedFortuneController implements ApiExpectedFortuneFeignClie
* @return
* @return
*/
*/
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
@Operation
(
summary
=
"
更新保单发佣
信息"
)
@Operation
(
summary
=
"
修改出账
信息"
)
public
Result
<
Boolean
>
update
(
@RequestBody
ExpectedFortuneUpdateRequest
request
)
{
public
Result
<
Boolean
>
update
(
@RequestBody
ExpectedFortuneUpdateRequest
request
)
{
if
(
request
==
null
||
request
.
getExpectedFortuneBizId
()
==
null
)
{
if
(
request
==
null
||
request
.
getExpectedFortuneBizId
()
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
ErrorCode
.
PARAMS_ERROR
.
getMessage
());
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
ErrorCode
.
PARAMS_ERROR
.
getMessage
());
...
...
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFortuneController.java
View file @
fd7f918a
...
@@ -202,10 +202,9 @@ public class ApiFortuneController {
...
@@ -202,10 +202,9 @@ public class ApiFortuneController {
if
(
CollectionUtils
.
isEmpty
(
fortuneDownloadRequest
.
getFortuneBizIdList
()))
{
if
(
CollectionUtils
.
isEmpty
(
fortuneDownloadRequest
.
getFortuneBizIdList
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"请选择要出账的发佣数据"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"请选择要出账的发佣数据"
);
}
}
try
{
fortuneService
.
downloadAccount
(
fortuneDownloadRequest
,
response
);
fortuneService
.
downloadAccount
(
fortuneDownloadRequest
,
response
);
return
Result
.
success
(
true
);
}
catch
(
Exception
e
)
{
// // 设置响应类型为 JSON,而不是文件流
// // 设置响应类型为 JSON,而不是文件流
// response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
// response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
// response.setContentType(MediaType.APPLICATION_JSON_VALUE);
// response.setContentType(MediaType.APPLICATION_JSON_VALUE);
...
@@ -218,11 +217,10 @@ public class ApiFortuneController {
...
@@ -218,11 +217,10 @@ public class ApiFortuneController {
//
//
// response.getWriter().write(new ObjectMapper().writeValueAsString(errorResult));
// response.getWriter().write(new ObjectMapper().writeValueAsString(errorResult));
log
.
error
(
"生成出账清单失败"
,
e
);
return
Result
.
success
(
true
);
return
Result
.
success
(
false
);
}
}
}
/**
/**
* 分页获取出账列表
* 分页获取出账列表
*
*
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
fd7f918a
...
@@ -466,7 +466,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -466,7 +466,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
true
true
);
);
Array
List
<
ExpectedFortune
>
fortuneList
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
fortuneList
=
new
ArrayList
<>();
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
BeanUtil
.
copyProperties
(
expectedFortuneDto
,
expectedFortune
);
BeanUtil
.
copyProperties
(
expectedFortuneDto
,
expectedFortune
);
...
@@ -475,6 +475,11 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -475,6 +475,11 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
expectedFortune
.
setExpectedFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
()));
expectedFortune
.
setExpectedFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
()));
// 应付款编号
// 应付款编号
expectedFortune
.
setPayableNo
(
this
.
createPayableNo
(
expectedFortune
.
getFortuneBizType
(),
latest
));
expectedFortune
.
setPayableNo
(
this
.
createPayableNo
(
expectedFortune
.
getFortuneBizType
(),
latest
));
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
expectedFortune
.
setUnpaidAmount
(
expectedFortune
.
getAmount
());
expectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
expectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
fortuneList
.
add
(
expectedFortune
);
fortuneList
.
add
(
expectedFortune
);
}
}
iExpectedFortuneService
.
saveOrUpdateBatch
(
fortuneList
);
iExpectedFortuneService
.
saveOrUpdateBatch
(
fortuneList
);
...
@@ -486,26 +491,11 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -486,26 +491,11 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
// 查询数据
// 查询数据
QueryWrapper
<
ExpectedFortune
>
queryWrapper
=
this
.
getQueryWrapper
(
request
);
QueryWrapper
<
ExpectedFortune
>
queryWrapper
=
this
.
getQueryWrapper
(
request
);
List
<
ExpectedFortune
>
fortuneList
=
iExpectedFortuneService
.
list
(
queryWrapper
);
List
<
ExpectedFortune
>
fortuneList
=
iExpectedFortuneService
.
list
(
queryWrapper
);
// 先转换为VO, VO 补充了关联信息(产品计划、产品险种、保险公司、用户)
// 关联保单信息
List
<
ApiExpectedFortunePageResponse
>
expectedFortuneVOList
=
iExpectedFortuneService
.
toVOList
(
fortuneList
);
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
()
.
in
(
Policy:
:
getPolicyNo
,
fortuneList
.
stream
().
map
(
ExpectedFortune:
:
getPolicyNo
).
collect
(
Collectors
.
toList
()))
.
list
();
Map
<
String
,
Policy
>
policyMap
=
policyList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
()));
// 转换为导出DTO
// 转换为导出DTO
List
<
ExpectedFortuneExportDTO
>
exportDataList
=
fortuneList
.
stream
()
List
<
ExpectedFortuneExportDTO
>
exportDataList
=
expectedFortuneVOList
.
stream
()
.
map
(
fortune
->
{
.
map
(
ExpectedFortuneExportDTO:
:
convertToExportDTO
)
ExpectedFortuneExportDTO
dto
=
ExpectedFortuneExportDTO
.
convertToExportDTO
(
fortune
);
// 关联保单信息
Policy
policy
=
policyMap
.
get
(
fortune
.
getPolicyNo
());
if
(!
Objects
.
isNull
(
policy
))
{
dto
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
dto
.
setProductName
(
policy
.
getProductName
());
}
return
dto
;
})
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
// 使用EasyExcel导出
// 使用EasyExcel导出
...
@@ -659,6 +649,10 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -659,6 +649,10 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if
(
expectedFortune
==
null
)
{
if
(
expectedFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计发佣数据不存在"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计发佣数据不存在"
);
}
}
if
(
expectedFortune
.
getPaidAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"当前应付款已有出账金额,不能修改"
);
}
ExpectedFortune
updateExpectedFortune
=
new
ExpectedFortune
();
ExpectedFortune
updateExpectedFortune
=
new
ExpectedFortune
();
BeanUtils
.
copyProperties
(
request
,
updateExpectedFortune
);
BeanUtils
.
copyProperties
(
request
,
updateExpectedFortune
);
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneUpdateRequest.java
View file @
fd7f918a
...
@@ -54,12 +54,6 @@ public class ExpectedFortuneUpdateRequest {
...
@@ -54,12 +54,6 @@ public class ExpectedFortuneUpdateRequest {
private
String
statusDesc
;
private
String
statusDesc
;
/**
/**
* 当前出账金额
*/
@Schema
(
description
=
"当前出账金额"
)
private
BigDecimal
currentPaymentAmount
;
/**
* 出账项目
* 出账项目
*/
*/
@Schema
(
description
=
"出账项目"
)
@Schema
(
description
=
"出账项目"
)
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
View file @
fd7f918a
...
@@ -54,33 +54,39 @@ public class ApiExpectedFortunePageResponse {
...
@@ -54,33 +54,39 @@ public class ApiExpectedFortunePageResponse {
private
String
insuranceCompanyBizId
;
private
String
insuranceCompanyBizId
;
/**
/**
* 保险公司
*/
@Schema
(
description
=
"保险公司"
)
private
String
insuranceCompany
;
/**
* 产品计划 ID
* 产品计划 ID
*/
*/
@Schema
(
description
=
"产品计划 ID"
)
@Schema
(
description
=
"产品计划 ID"
)
private
String
productLaunchBizId
;
private
String
productLaunchBizId
;
/**
/**
*
保单信息
*
产品计划
*/
*/
@Schema
(
description
=
"
policy info
"
)
@Schema
(
description
=
"
产品计划
"
)
private
PolicyInfo
policy
;
private
String
productName
;
/**
/**
* 出账期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
* 出账期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
*/
*/
@Schema
(
description
=
"
fortune period
"
)
@Schema
(
description
=
"
出账期数
"
)
private
Integer
fortunePeriod
;
private
Integer
fortunePeriod
;
/**
/**
* 总期数
* 总期数
*/
*/
@Schema
(
description
=
"
fortune total period
"
)
@Schema
(
description
=
"
总期数
"
)
private
Integer
fortuneTotalPeriod
;
private
Integer
fortuneTotalPeriod
;
/**
/**
* 转介人
名称
* 转介人
*/
*/
@Schema
(
description
=
"转介人
名称
"
)
@Schema
(
description
=
"转介人"
)
private
String
broker
;
private
String
broker
;
/**
/**
...
@@ -194,9 +200,21 @@ public class ApiExpectedFortunePageResponse {
...
@@ -194,9 +200,21 @@ public class ApiExpectedFortunePageResponse {
private
String
ruleItemBizId
;
private
String
ruleItemBizId
;
/**
/**
* 备注
*/
@Schema
(
description
=
"备注"
)
private
String
remark
;
/**
* 创建时间
* 创建时间
*/
*/
@Schema
(
description
=
"
create time
"
)
@Schema
(
description
=
"
创建时间
"
)
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
@Schema
(
description
=
"更新时间"
)
private
LocalDateTime
updateTime
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
View file @
fd7f918a
...
@@ -191,12 +191,18 @@ public class ExpectedFortune implements Serializable {
...
@@ -191,12 +191,18 @@ public class ExpectedFortune implements Serializable {
private
BigDecimal
unpaidAmount
;
private
BigDecimal
unpaidAmount
;
/**
/**
*
发佣比例 已发佣金额/应发佣
金额
*
已出账比例 已出账金额/应出账
金额
*/
*/
@TableField
(
"paid_ratio"
)
@TableField
(
"paid_ratio"
)
private
BigDecimal
paidRatio
;
private
BigDecimal
paidRatio
;
/**
/**
* 待出账比例
*/
@TableField
(
"unpaid_ratio"
)
private
BigDecimal
unpaidRatio
;
/**
* 是否含税 0=No, 1=Yes
* 是否含税 0=No, 1=Yes
*/
*/
@TableField
(
"is_tax"
)
@TableField
(
"is_tax"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
View file @
fd7f918a
...
@@ -32,4 +32,6 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
...
@@ -32,4 +32,6 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
ExpectedFortuneStatisticsVO
getStatistics
(
List
<
Long
>
expectedFortuneIds
);
ExpectedFortuneStatisticsVO
getStatistics
(
List
<
Long
>
expectedFortuneIds
);
IPage
<
ApiExpectedFortunePageResponse
>
getVOPage
(
IPage
<
ExpectedFortune
>
iPage
);
IPage
<
ApiExpectedFortunePageResponse
>
getVOPage
(
IPage
<
ExpectedFortune
>
iPage
);
List
<
ApiExpectedFortunePageResponse
>
toVOList
(
List
<
ExpectedFortune
>
fortuneList
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
View file @
fd7f918a
...
@@ -455,9 +455,6 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -455,9 +455,6 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
public
Boolean
generateFortune
(
GenerateFortuneRequest
generateFortuneRequest
)
{
public
Boolean
generateFortune
(
GenerateFortuneRequest
generateFortuneRequest
)
{
List
<
String
>
commissionBizIdList
=
generateFortuneRequest
.
getCommissionBizIdList
();
List
<
String
>
commissionBizIdList
=
generateFortuneRequest
.
getCommissionBizIdList
();
List
<
Commission
>
commissions
=
this
.
lambdaQuery
().
in
(
Commission:
:
getCommissionBizId
,
commissionBizIdList
).
list
();
List
<
Commission
>
commissions
=
this
.
lambdaQuery
().
in
(
Commission:
:
getCommissionBizId
,
commissionBizIdList
).
list
();
// 根据保单号,期数建立映射关系
Map
<
String
,
Commission
>
policyNoPeriodMap
=
commissions
.
stream
()
.
collect
(
Collectors
.
toMap
(
i
->
i
.
getPolicyNo
()
+
"_"
+
i
.
getCommissionPeriod
(),
commission
->
commission
));
// 校验来佣记录是否存在
// 校验来佣记录是否存在
if
(
CollectionUtils
.
isEmpty
(
commissions
))
{
if
(
CollectionUtils
.
isEmpty
(
commissions
))
{
...
@@ -585,6 +582,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -585,6 +582,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
.
setFortuneBizType
(
"R"
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setAmount
(
expectedFortune
.
getAmount
());
fortune
.
setAmount
(
expectedFortune
.
getAmount
());
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getAmount
());
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
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
View file @
fd7f918a
...
@@ -77,25 +77,32 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
...
@@ -77,25 +77,32 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
if
(
CollUtil
.
isEmpty
(
expectedFortuneList
))
{
if
(
CollUtil
.
isEmpty
(
expectedFortuneList
))
{
return
expectedFortuneVOPage
;
return
expectedFortuneVOPage
;
}
}
// 查询关联的保单信息
List
<
ApiExpectedFortunePageResponse
>
expectedFortuneVOList
=
toVOList
(
expectedFortuneList
);
List
<
String
>
policyNoList
=
expectedFortuneList
.
stream
().
map
(
ExpectedFortune:
:
getPolicyNo
).
collect
(
Collectors
.
toList
());
expectedFortuneVOPage
.
setRecords
(
expectedFortuneVOList
);
QueryWrapper
<
Policy
>
queryWrapper
=
new
QueryWrapper
<>();
return
expectedFortuneVOPage
;
queryWrapper
.
in
(
"policy_no"
,
policyNoList
);
}
List
<
Policy
>
policyInfoList
=
policyService
.
list
(
queryWrapper
);
Map
<
String
,
Policy
>
policyMap
=
policyInfoList
.
stream
().
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
()));
@Override
public
List
<
ApiExpectedFortunePageResponse
>
toVOList
(
List
<
ExpectedFortune
>
expectedFortuneList
)
{
// 关联保单信息
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
()
.
in
(
Policy:
:
getPolicyNo
,
expectedFortuneList
.
stream
().
map
(
ExpectedFortune:
:
getPolicyNo
).
collect
(
Collectors
.
toList
()))
.
list
();
Map
<
String
,
Policy
>
policyMap
=
policyList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
()));
List
<
ApiExpectedFortunePageResponse
>
expectedFortuneVOList
=
expectedFortuneList
.
stream
().
map
(
expectedFortune
->
{
List
<
ApiExpectedFortunePageResponse
>
expectedFortuneVOList
=
expectedFortuneList
.
stream
().
map
(
expectedFortune
->
{
ApiExpectedFortunePageResponse
expectedFortuneVO
=
new
ApiExpectedFortunePageResponse
();
ApiExpectedFortunePageResponse
expectedFortuneVO
=
new
ApiExpectedFortunePageResponse
();
BeanUtils
.
copyProperties
(
expectedFortune
,
expectedFortuneVO
);
BeanUtils
.
copyProperties
(
expectedFortune
,
expectedFortuneVO
);
if
(
policyMap
.
get
(
expectedFortune
.
getPolicyNo
())
!=
null
)
{
Policy
policy
=
policyMap
.
get
(
expectedFortune
.
getPolicyNo
());
PolicyInfo
policyInfo
=
new
PolicyInfo
();
if
(
policy
!=
null
)
{
BeanUtils
.
copyProperties
(
policyMap
.
get
(
expectedFortune
.
getPolicyNo
()),
policyInfo
);
expectedFortuneVO
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
expectedFortuneVO
.
setPolicy
(
policyInfo
);
expectedFortuneVO
.
setProductName
(
policy
.
getProductName
());
expectedFortuneVO
.
setPremium
(
policy
.
getPaymentPremium
());
}
}
return
expectedFortuneVO
;
return
expectedFortuneVO
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
expectedFortuneVOPage
.
setRecords
(
expectedFortuneVOList
);
return
expectedFortuneVOList
;
return
expectedFortuneVOPage
;
}
}
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
View file @
fd7f918a
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
java.math.RoundingMode
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -247,69 +248,97 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -247,69 +248,97 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
completeFortuneAccount
(
CompleteFortuneAccountRequest
completeFortuneAccountRequest
)
{
public
Boolean
completeFortuneAccount
(
CompleteFortuneAccountRequest
req
)
{
/* 1. 参数校验 & 查询 --------------------------------------------------*/
List
<
String
>
fortuneAccountBizIdList
=
completeFortuneAccountRequest
.
getFortuneAccountBizIdList
();
List
<
String
>
accountBizIds
=
req
.
getFortuneAccountBizIdList
();
List
<
FortuneAccount
>
fortuneAccountList
=
this
.
list
(
new
QueryWrapper
<
FortuneAccount
>().
in
(
"fortune_account_biz_id"
,
fortuneAccountBizIdList
));
if
(
CollectionUtils
.
isEmpty
(
accountBizIds
))
{
if
(
CollectionUtils
.
isEmpty
(
fortuneAccountList
))
{
throw
new
BusinessException
(
"出账清单不能为空"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL_ERROR
.
getMessage
());
}
}
List
<
FortuneAccount
>
accountList
=
this
.
lambdaQuery
()
// 当前登录用户
.
in
(
FortuneAccount:
:
getFortuneAccountBizId
,
accountBizIds
)
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
.
list
();
Long
loginUserId
=
currentLoginUser
.
getId
();
Long
loginUserId
=
SecurityUtil
.
getCurrentLoginUser
().
getId
();
// 更新 FortuneAccount 状态为已出账
for
(
FortuneAccount
fortuneAccount
:
fortuneAccountList
)
{
/* 2. 更新 FortuneAccount 状态为已出账 ----------------------------------*/
fortuneAccount
.
setStatus
(
FortuneAccountStatusEnum
.
SENT
.
getItemValue
());
accountList
.
forEach
(
a
->
{
fortuneAccount
.
setFortuneAccountDate
(
new
Date
());
a
.
setStatus
(
FortuneAccountStatusEnum
.
SENT
.
getItemValue
());
fortuneAccount
.
setUpdaterId
(
loginUserId
.
toString
());
a
.
setFortuneAccountDate
(
new
Date
());
fortuneAccount
.
setUpdateTime
(
new
Date
());
a
.
setUpdaterId
(
loginUserId
.
toString
());
a
.
setUpdateTime
(
new
Date
());
});
this
.
updateBatchById
(
accountList
);
/* 3. 取出关联的所有 fortune 并一次性更新为已出账 ------------------------*/
List
<
String
>
accountBizIdList
=
accountList
.
stream
()
.
map
(
FortuneAccount:
:
getFortuneAccountBizId
).
collect
(
Collectors
.
toList
());
List
<
Fortune
>
fortunes
=
fortuneService
.
lambdaQuery
()
.
in
(
Fortune:
:
getFortuneAccountBizId
,
accountBizIdList
)
.
eq
(
Fortune:
:
getStatus
,
FortuneStatusEnum
.
CHECKED
.
getItemValue
())
.
list
();
if
(
CollectionUtils
.
isNotEmpty
(
fortunes
))
{
fortunes
.
forEach
(
f
->
{
f
.
setStatus
(
FortuneStatusEnum
.
SENT
.
getItemValue
());
f
.
setUpdaterId
(
loginUserId
.
toString
());
f
.
setUpdateTime
(
new
Date
());
});
fortuneService
.
updateBatchById
(
fortunes
);
}
}
this
.
updateBatchById
(
fortuneAccountList
);
// 更新 Fortune 状态为已出账
/* 4. 按 expected_fortune 维度重新汇总已出账金额 --------------------------*/
List
<
String
>
accountBizIdList
=
fortuneAccountList
.
stream
().
map
(
FortuneAccount:
:
getFortuneAccountBizId
).
collect
(
Collectors
.
toList
());
// 4.1 收集所有涉及的 expectedFortuneBizId
List
<
Fortune
>
updateFortuneList
=
fortuneService
.
list
(
new
QueryWrapper
<
Fortune
>().
in
(
"fortune_account_biz_id"
,
accountBizIdList
));
Set
<
String
>
expectedIds
=
fortunes
.
stream
()
if
(
CollectionUtils
.
isNotEmpty
(
updateFortuneList
))
{
.
map
(
Fortune:
:
getExpectedFortuneBizId
)
for
(
Fortune
item
:
updateFortuneList
)
{
.
collect
(
Collectors
.
toSet
());
item
.
setStatus
(
FortuneStatusEnum
.
SENT
.
getItemValue
());
if
(
CollectionUtils
.
isEmpty
(
expectedIds
))
{
item
.
setUpdaterId
(
loginUserId
.
toString
());
return
true
;
// 没有对应预计出账,直接结束
item
.
setUpdateTime
(
new
Date
());
}
fortuneService
.
updateBatchById
(
updateFortuneList
);
}
}
// 更新预计出账记录
// 4.2 先锁再算
List
<
String
>
expectedFortuneBizIdList
=
updateFortuneList
.
stream
().
map
(
Fortune:
:
getExpectedFortuneBizId
).
collect
(
Collectors
.
toList
());
List
<
ExpectedFortune
>
expectedList
=
expectedFortuneService
.
lambdaQuery
()
if
(
CollectionUtils
.
isNotEmpty
(
expectedFortuneBizIdList
))
{
.
in
(
ExpectedFortune:
:
getExpectedFortuneBizId
,
expectedIds
)
List
<
ExpectedFortune
>
expectedFortuneList
=
expectedFortuneService
.
list
(
new
QueryWrapper
<
ExpectedFortune
>().
in
(
"expected_fortune_biz_id"
,
expectedFortuneBizIdList
));
.
last
(
"FOR UPDATE"
)
// 预计出账映射
.
list
();
Map
<
String
,
ExpectedFortune
>
expectedFortuneMap
=
expectedFortuneList
.
stream
()
.
collect
(
Collectors
.
toMap
(
ExpectedFortune:
:
getExpectedFortuneBizId
,
Function
.
identity
()));
// 4.3 全量汇总:把同一 expected_fortune 下所有 fortune 的 current_payment_amount 求和
// 遍历本次出账记录,更新预计出账记录
Map
<
String
,
BigDecimal
>
paidMap
=
fortuneService
.
lambdaQuery
()
for
(
Fortune
item
:
updateFortuneList
)
{
.
in
(
Fortune:
:
getExpectedFortuneBizId
,
expectedIds
)
ExpectedFortune
expectedFortune
=
expectedFortuneMap
.
get
(
item
.
getExpectedFortuneBizId
());
.
eq
(
Fortune:
:
getStatus
,
FortuneStatusEnum
.
SENT
.
getItemValue
())
if
(
Objects
.
nonNull
(
expectedFortune
))
{
.
list
()
BigDecimal
amount
=
item
.
getAmount
();
// 本次出账金额
.
stream
()
BigDecimal
paidAmount
=
expectedFortune
.
getPaidAmount
();
// 已出账金额
.
collect
(
Collectors
.
groupingBy
(
Fortune:
:
getExpectedFortuneBizId
,
if
(
expectedFortune
.
getAmount
().
compareTo
(
paidAmount
.
add
(
amount
))
==
0
)
{
Collectors
.
mapping
(
Fortune:
:
getCurrentPaymentAmount
,
// 已出账金额等于预计出账金额,更新状态为完成出账
Collectors
.
reducing
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
))));
expectedFortune
.
setPaidAmount
(
paidAmount
.
add
(
amount
));
expectedFortune
.
setUnpaidAmount
(
BigDecimal
.
ZERO
);
// 4.4 反写 expected_fortune
expectedFortune
.
setStatus
(
FortuneStatusEnum
.
SENT
.
getItemValue
());
expectedList
.
forEach
(
ef
->
{
}
else
{
BigDecimal
totalPaid
=
paidMap
.
getOrDefault
(
ef
.
getExpectedFortuneBizId
(),
BigDecimal
.
ZERO
);
// 已出账金额小于预计出账金额,更新已出账金额
BigDecimal
totalAmount
=
ef
.
getAmount
();
expectedFortune
.
setPaidAmount
(
paidAmount
.
add
(
amount
));
BigDecimal
unpaid
=
totalAmount
.
subtract
(
totalPaid
);
expectedFortune
.
setUnpaidAmount
(
expectedFortune
.
getAmount
().
subtract
(
paidAmount
.
add
(
amount
)));
expectedFortune
.
setUpdaterId
(
loginUserId
.
toString
());
String
newStatus
;
expectedFortune
.
setUpdateTime
(
LocalDateTime
.
now
());
if
(
unpaid
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
}
newStatus
=
FortuneStatusEnum
.
SENT
.
getItemValue
();
// 全部完成
}
}
else
if
(
totalPaid
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
newStatus
=
FortuneStatusEnum
.
PARTIAL_SENT
.
getItemValue
();
// 部分完成
}
else
{
newStatus
=
ef
.
getStatus
();
// 无变化
}
}
// 更新预计出账记录
expectedFortuneService
.
updateBatchById
(
expectedFortuneList
);
expectedFortuneService
.
lambdaUpdate
()
}
.
set
(
ExpectedFortune:
:
getPaidAmount
,
totalPaid
)
.
set
(
ExpectedFortune:
:
getUnpaidAmount
,
unpaid
)
.
set
(
ExpectedFortune:
:
getPaidRatio
,
totalPaid
.
divide
(
totalAmount
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)))
.
set
(
ExpectedFortune:
:
getUnpaidRatio
,
unpaid
.
divide
(
totalAmount
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)))
.
set
(
ExpectedFortune:
:
getStatus
,
newStatus
)
.
set
(
ExpectedFortune:
:
getUpdaterId
,
loginUserId
.
toString
())
.
set
(
ExpectedFortune:
:
getUpdateTime
,
LocalDateTime
.
now
())
.
eq
(
ExpectedFortune:
:
getId
,
ef
.
getId
())
.
update
();
});
return
true
;
return
true
;
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
fd7f918a
...
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
...
@@ -178,43 +179,106 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -178,43 +179,106 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if
(
expectedFortune
==
null
)
{
if
(
expectedFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计出账数据不存在"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计出账数据不存在"
);
}
}
// 如果是部分出账,新增一条待出账的实际出账记录(fortune)
BigDecimal
currentPaymentAmount
=
fortuneUpdateRequest
.
getCurrentPaymentAmount
();
BigDecimal
currentPaymentAmount
=
fortuneUpdateRequest
.
getCurrentPaymentAmount
();
if
(
currentPaymentAmount
!=
null
&&
currentPaymentAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
currentPaymentAmount
.
compareTo
(
expectedFortune
.
getAmount
())
<
0
)
{
if
(
currentPaymentAmount
!=
null
)
{
Fortune
newFortune
=
new
Fortune
();
if
(
currentPaymentAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
BeanUtils
.
copyProperties
(
fortune
,
newFortune
,
"id"
,
"fortuneBizId"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账金额不能小于0"
);
newFortune
.
setAmount
(
expectedFortune
.
getAmount
());
}
newFortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getAmount
().
subtract
(
currentPaymentAmount
));
if
(
currentPaymentAmount
.
compareTo
(
expectedFortune
.
getAmount
())
>
0
)
{
newFortune
.
setStatus
(
FortuneStatusEnum
.
WAIT
.
getItemValue
());
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账金额不能大于应付款金额"
);
newFortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
}
newFortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
if
(
StringUtils
.
isBlank
(
fortuneUpdateRequest
.
getCurrency
()))
{
newFortune
.
setIsPart
(
1
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账币种不能为空"
);
// 设置预计出账日期为次月
}
newFortune
.
setPayoutDate
(
calculateReconciliationYearMonth
(
fortune
));
this
.
save
(
newFortune
);
}
}
BeanUtils
.
copyProperties
(
fortuneUpdateRequest
,
fortune
,
"id"
,
"fortuneBizId"
,
"expectedFortuneBizId"
,
"commissionBizId"
);
// 获取当前登录用户
// 获取当前登录用户
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
// 更新预计出账状态
// 如果传入了金额
expectedFortune
.
setStatus
(
fortuneUpdateRequest
.
getStatus
());
if
(
currentPaymentAmount
!=
null
)
{
expectedFortuneService
.
updateById
(
expectedFortune
);
splitFortune
(
fortune
,
currentPaymentAmount
,
loginUserId
,
fortuneUpdateRequest
);
}
else
{
// 如果未传入金额,仅更新预计出账状态为已出帐
expectedFortuneService
.
lambdaUpdate
()
.
set
(
ExpectedFortune:
:
getStatus
,
fortuneUpdateRequest
.
getStatus
())
.
eq
(
ExpectedFortune:
:
getId
,
expectedFortune
.
getId
())
.
update
();
// 统一更新实际出账数据
BeanUtils
.
copyProperties
(
fortuneUpdateRequest
,
fortune
,
"id"
,
"fortuneBizId"
,
"expectedFortuneBizId"
,
"commissionBizId"
);
// 更新实际出账数据
// 更新实际出账数据
fortune
.
setUpdaterId
(
loginUserId
);
fortune
.
setUpdaterId
(
loginUserId
);
fortune
.
setUpdateTime
(
new
Date
());
fortune
.
setUpdateTime
(
new
Date
());
return
this
.
updateById
(
fortune
);
this
.
updateById
(
fortune
);
}
return
true
;
}
}
private
LocalDate
calculateReconciliationYearMonth
(
Fortune
fortune
)
{
/**
// 设置预计出账日期为次月
* 拆分发放(按本次发放金额拆)
return
LocalDate
.
now
().
plusMonths
(
1
);
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
splitFortune
(
Fortune
main
,
BigDecimal
currentPaymentAmount
,
String
loginUserId
,
FortuneUpdateRequest
fortuneUpdateRequest
)
{
if
(
currentPaymentAmount
==
null
||
currentPaymentAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
throw
new
BusinessException
(
"本次发放金额必须大于0"
);
if
(!
main
.
getStatus
().
equals
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
()))
throw
new
BusinessException
(
"只有可出账记录才能修改金额"
);
BigDecimal
fullAmount
=
main
.
getAmount
();
if
(
currentPaymentAmount
.
compareTo
(
main
.
getCurrentPaymentAmount
())
>
0
)
throw
new
BusinessException
(
"本次发放金额不能大于可出账金额"
);
// 1. 更新主行 = 本次发放金额
main
.
setCurrentPaymentAmount
(
currentPaymentAmount
);
main
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
main
.
setUpdaterId
(
loginUserId
);
main
.
setUpdateTime
(
new
Date
());
// 其他字段更新
if
(
StringUtils
.
isNotBlank
(
fortuneUpdateRequest
.
getCurrency
()))
{
main
.
setCurrency
(
fortuneUpdateRequest
.
getCurrency
());
}
this
.
updateById
(
main
);
// 2. 剩余金额生成新行
BigDecimal
leftAmount
=
fullAmount
.
subtract
(
currentPaymentAmount
);
if
(
leftAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
Fortune
part
=
new
Fortune
();
BeanUtils
.
copyProperties
(
main
,
part
,
"id"
,
"fortuneBizId"
,
"currentPaymentAmount"
,
"status"
,
"isPart"
,
"payoutDate"
);
part
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
part
.
setCurrentPaymentAmount
(
leftAmount
);
part
.
setStatus
(
FortuneStatusEnum
.
WAIT
.
getItemValue
());
part
.
setIsPart
(
1
);
part
.
setPayoutDate
(
LocalDate
.
now
().
plusMonths
(
1
));
// 次月
part
.
setCreatorId
(
loginUserId
);
part
.
setCreateTime
(
new
Date
());
this
.
save
(
part
);
}
// 3. 同步 expected_fortune
ExpectedFortune
ef
=
expectedFortuneService
.
lambdaQuery
()
.
eq
(
ExpectedFortune:
:
getExpectedFortuneBizId
,
main
.
getExpectedFortuneBizId
())
.
one
();
if
(
ef
==
null
)
return
;
BigDecimal
newPaid
=
ef
.
getPaidAmount
()
==
null
?
BigDecimal
.
ZERO
:
ef
.
getPaidAmount
().
add
(
currentPaymentAmount
);
BigDecimal
newUnpaid
=
ef
.
getAmount
().
subtract
(
newPaid
);
String
newStatus
=
newUnpaid
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
"6"
:
"3"
;
expectedFortuneService
.
lambdaUpdate
()
.
set
(
ExpectedFortune:
:
getPaidAmount
,
newPaid
)
.
set
(
ExpectedFortune:
:
getUnpaidAmount
,
newUnpaid
)
.
set
(
ExpectedFortune:
:
getPaidRatio
,
newPaid
.
divide
(
ef
.
getAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)))
.
set
(
ExpectedFortune:
:
getUnpaidRatio
,
newUnpaid
.
divide
(
ef
.
getAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)))
.
set
(
ExpectedFortune:
:
getStatus
,
newStatus
)
.
eq
(
ExpectedFortune:
:
getId
,
ef
.
getId
())
.
update
();
}
}
@Override
@Override
...
@@ -258,6 +322,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -258,6 +322,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if
(!
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
CHECKED
.
getItemValue
()))
{
if
(!
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
CHECKED
.
getItemValue
()))
{
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"未检核,不能生成出账记录; "
);
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"未检核,不能生成出账记录; "
);
}
}
if
(
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
SENT
.
getItemValue
()))
{
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"已完成出账,不能生成出账记录; "
);
}
}
}
if
(
StringUtils
.
isNotBlank
(
validateMsg
.
toString
()))
{
if
(
StringUtils
.
isNotBlank
(
validateMsg
.
toString
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
validateMsg
.
toString
());
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
validateMsg
.
toString
());
...
@@ -294,7 +361,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -294,7 +361,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 计算出账总额
// 计算出账总额
BigDecimal
totalAmount
=
brokerFortunes
.
stream
()
BigDecimal
totalAmount
=
brokerFortunes
.
stream
()
.
map
(
Fortune:
:
getAmount
)
.
map
(
Fortune:
:
get
CurrentPayment
Amount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
accountDTO
.
setAmount
(
totalAmount
);
accountDTO
.
setAmount
(
totalAmount
);
...
@@ -302,7 +369,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -302,7 +369,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
Map
<
String
,
BigDecimal
>
fortuneAmountMap
=
brokerFortunes
.
stream
()
Map
<
String
,
BigDecimal
>
fortuneAmountMap
=
brokerFortunes
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
.
collect
(
Collectors
.
groupingBy
(
Fortune:
:
getFortuneName
,
Fortune:
:
getFortuneName
,
Collectors
.
reducing
(
BigDecimal
.
ZERO
,
Fortune:
:
getAmount
,
BigDecimal:
:
add
)
Collectors
.
reducing
(
BigDecimal
.
ZERO
,
Fortune:
:
get
CurrentPayment
Amount
,
BigDecimal:
:
add
)
));
));
// 设置各个fortune项目的金额
// 设置各个fortune项目的金额
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/ExpectedFortuneExportDTO.java
View file @
fd7f918a
...
@@ -6,6 +6,7 @@ import com.alibaba.excel.annotation.format.DateTimeFormat;
...
@@ -6,6 +6,7 @@ import com.alibaba.excel.annotation.format.DateTimeFormat;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.ContentRowHeight
;
import
com.alibaba.excel.annotation.write.style.ContentRowHeight
;
import
com.alibaba.excel.annotation.write.style.HeadRowHeight
;
import
com.alibaba.excel.annotation.write.style.HeadRowHeight
;
import
com.yd.csf.feign.response.expectedfortune.ApiExpectedFortunePageResponse
;
import
com.yd.csf.service.enums.FortuneStatusEnum
;
import
com.yd.csf.service.enums.FortuneStatusEnum
;
import
com.yd.csf.service.model.ExpectedFortune
;
import
com.yd.csf.service.model.ExpectedFortune
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -111,31 +112,29 @@ public class ExpectedFortuneExportDTO {
...
@@ -111,31 +112,29 @@ public class ExpectedFortuneExportDTO {
/**
/**
* 将对象转换为导出DTO
* 将对象转换为导出DTO
*/
*/
public
static
ExpectedFortuneExportDTO
convertToExportDTO
(
ExpectedFortune
expectedFortune
)
{
public
static
ExpectedFortuneExportDTO
convertToExportDTO
(
ApiExpectedFortunePageResponse
vo
)
{
ExpectedFortuneExportDTO
dto
=
new
ExpectedFortuneExportDTO
();
ExpectedFortuneExportDTO
dto
=
new
ExpectedFortuneExportDTO
();
dto
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
dto
.
setExpectedFortuneBizId
(
vo
.
getExpectedFortuneBizId
());
dto
.
setPayableNo
(
expectedFortune
.
getPayableNo
());
dto
.
setPayableNo
(
vo
.
getPayableNo
());
dto
.
setFortuneBizType
(
"R"
.
equals
(
expectedFortune
.
getFortuneBizType
())
?
"关联保单应付款"
:
"非关联保单应付款"
);
dto
.
setFortuneBizType
(
"R"
.
equals
(
vo
.
getFortuneBizType
())
?
"关联保单应付款"
:
"非关联保单应付款"
);
dto
.
setPolicyNo
(
expectedFortune
.
getPolicyNo
());
dto
.
setPolicyNo
(
vo
.
getPolicyNo
());
dto
.
setPremium
(
expectedFortune
.
getPremium
());
dto
.
setPremium
(
vo
.
getPremium
());
dto
.
setFortunePeriod
(
expectedFortune
.
getFortunePeriod
());
dto
.
setFortunePeriod
(
vo
.
getFortunePeriod
());
dto
.
setFortuneTotalPeriod
(
expectedFortune
.
getFortuneTotalPeriod
());
dto
.
setFortuneTotalPeriod
(
vo
.
getFortuneTotalPeriod
());
dto
.
setBroker
(
expectedFortune
.
getBroker
());
dto
.
setBroker
(
vo
.
getBroker
());
dto
.
setTeam
(
expectedFortune
.
getTeam
());
dto
.
setTeam
(
vo
.
getTeam
());
dto
.
setFortuneName
(
expectedFortune
.
getFortuneName
());
dto
.
setFortuneName
(
vo
.
getFortuneName
());
dto
.
setBrokerRatio
(
expectedFortune
.
getBrokerRatio
());
dto
.
setBrokerRatio
(
vo
.
getBrokerRatio
());
dto
.
setAmount
(
expectedFortune
.
getAmount
());
dto
.
setAmount
(
vo
.
getAmount
());
dto
.
setCurrency
(
expectedFortune
.
getCurrency
());
dto
.
setCurrency
(
vo
.
getCurrency
());
dto
.
setStatus
(
getStatusText
(
expectedFortune
.
getStatus
()));
dto
.
setStatus
(
getStatusText
(
vo
.
getStatus
()));
dto
.
setStatusDesc
(
expectedFortune
.
getStatusDesc
());
dto
.
setStatusDesc
(
vo
.
getStatusDesc
());
dto
.
setPayoutDate
(
Convert
.
toDate
(
expectedFortune
.
getPayoutDate
()));
dto
.
setPayoutDate
(
Convert
.
toDate
(
vo
.
getPayoutDate
()));
dto
.
setActualPayoutDate
(
Convert
.
toDate
(
expectedFortune
.
getActualPayoutDate
()));
dto
.
setActualPayoutDate
(
Convert
.
toDate
(
vo
.
getActualPayoutDate
()));
dto
.
setPaidAmount
(
expectedFortune
.
getPaidAmount
());
dto
.
setPaidAmount
(
vo
.
getPaidAmount
());
dto
.
setUnpaidAmount
(
expectedFortune
.
getUnpaidAmount
());
dto
.
setUnpaidAmount
(
vo
.
getUnpaidAmount
());
dto
.
setPaidRatio
(
expectedFortune
.
getPaidRatio
());
dto
.
setPaidRatio
(
vo
.
getPaidRatio
());
dto
.
setRemark
(
expectedFortune
.
getRemark
());
dto
.
setRemark
(
vo
.
getRemark
());
dto
.
setCreateTime
(
expectedFortune
.
getCreateTime
());
dto
.
setUpdateTime
(
expectedFortune
.
getUpdateTime
());
return
dto
;
return
dto
;
}
}
...
...
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