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
a574728d
Commit
a574728d
authored
May 06, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/test' into test_zxm_lengjingqi
parents
546708fa
489667cb
Show whitespace changes
Inline
Side-by-side
Showing
86 changed files
with
4043 additions
and
333 deletions
+4043
-333
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionController.java
+24
-39
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
+77
-7
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFortuneController.java
+59
-39
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiPolicyFollowController.java
+26
-0
yd-csf-api/src/main/java/com/yd/csf/api/dto/ExecuteBillingDto.java
+7
-0
yd-csf-api/src/main/java/com/yd/csf/api/dto/FortuneImportDTO.java
+2
-2
yd-csf-api/src/main/java/com/yd/csf/api/dto/GenerateExpectedFortuneDto.java
+5
-0
yd-csf-api/src/main/java/com/yd/csf/api/dto/QueryCommissionExpectedByPageNewResponse.java
+25
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/ApiCommissionExpectedService.java
+10
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentServiceImpl.java
+8
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiBasicLawCalculateServiceImpl.java
+4
-4
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiCommissionExpectedServiceImpl.java
+87
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+71
-39
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
+15
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumRemittanceServiceImpl.java
+41
-2
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
+15
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/excel/ApiSalarySplitSummaryExcelDto.java
+2
-2
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/premiumremittance/ApiPremiumRemittanceDto.java
+12
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/salarysplit/ApiSalarySplitSummaryPageDto.java
+5
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ApiExpectedFortunePageRequest.java
+8
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneAddRequest.java
+14
-3
yd-csf-feign/src/main/java/com/yd/csf/feign/request/premiumreconciliation/ApiPremiumReconciliationPageRequest.java
+17
-1
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
+7
-1
yd-csf-feign/src/main/java/com/yd/csf/feign/response/policyfollow/ApiPolicyFollowDetailResponse.java
+416
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/response/premiumreconciliation/ApiPremiumReconciliationPageResponse.java
+12
-2
yd-csf-service/src/main/java/com/yd/csf/service/config/CsfMybatisPlusConfig.java
+2
-2
yd-csf-service/src/main/java/com/yd/csf/service/dao/PolicyFollowMapper.java
+11
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedAddDto.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedQueryRequest.java
+24
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/CustomerQueryRequest.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/dto/EditActualPayoutDateRequest.java
+14
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/EditExchangeRateRequest.java
+72
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/FnaQueryRequest.java
+8
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAccountExportDTO.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAddRequest.java
+54
-6
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneDownloadRequest.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneSplitDto.java
+87
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneSplitRequest.java
+25
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/PolicyFollowDto.java
+2
-2
yd-csf-service/src/main/java/com/yd/csf/service/dto/PolicyFollowQueryRequest.java
+22
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/QueryCommissionExchangeRateRequest.java
+14
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/QueryPolicyBrokerDto.java
+5
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/Customer.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
+40
-14
yd-csf-service/src/main/java/com/yd/csf/service/model/Fna.java
+13
-4
yd-csf-service/src/main/java/com/yd/csf/service/model/Fortune.java
+56
-24
yd-csf-service/src/main/java/com/yd/csf/service/model/FortuneAccount.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyInsurant.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyPolicyholder.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
+5
-3
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionService.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneAccountService.java
+2
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneService.java
+7
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
+11
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyBrokerService.java
+4
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyFollowService.java
+8
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyInsurantService.java
+7
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyPolicyholderService.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
+416
-6
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
+27
-12
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CustomerServiceImpl.java
+23
-2
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
+34
-2
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaServiceImpl.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
+61
-14
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+430
-55
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyBrokerServiceImpl.java
+22
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
+360
-3
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyInsurantServiceImpl.java
+37
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyPolicyholderServiceImpl.java
+38
-0
yd-csf-service/src/main/java/com/yd/csf/service/utils/BusinessNoUtils.java
+42
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedExportNewDTO.java
+240
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedNewVO.java
+382
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedStatisticsNewVO.java
+57
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedStatisticsVO.java
+50
-6
yd-csf-service/src/main/java/com/yd/csf/service/vo/FnaVO.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneAccountVO.java
+14
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
+77
-16
yd-csf-service/src/main/java/com/yd/csf/service/vo/PayableReportVO.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowVO.java
+34
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/ReceivableReportVO.java
+27
-0
yd-csf-service/src/main/resources/mappers/CommissionExpectedMapper.xml
+10
-0
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
+9
-4
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
+3
-1
yd-csf-service/src/main/resources/mappers/PolicyFollowMapper.xml
+61
-0
yd-csf-service/src/main/resources/mappers/PremiumReconciliationMapper.xml
+39
-12
yd-csf-service/src/main/resources/mappers/SalarySplitMapper.xml
+4
-2
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionController.java
View file @
a574728d
...
...
@@ -39,6 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
...
...
@@ -469,45 +470,6 @@ public class ApiCommissionController {
return
Result
.
success
(
commissionService
.
getCommissionStatistics
(
commissionStatisticsRequest
.
getCommissionIds
()));
}
/**
* 根据 commissionBizId 获取保单来佣(封装类)
*
* @param commissionBizId
* @return
*/
// @GetMapping("/get/vo")
// @Operation(summary = "根据 policyBizId 获取保单来佣详情")
// public Result<PolicyFollowVO> getPolicyFollowByPolicyBizId(@RequestParam("commissionBizId") String commissionBizId, HttpServletRequest request) {
// if (commissionBizId == null) {
// return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
// }
// // 查询数据库
// PolicyFollow policyFollow = policyFollowService.getByPolicyBizId(policyBizId);
// if (policyFollow == null) {
// return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
// }
//
// // 获取封装类
// return Result.success(policyFollowService.getPolicyFollowVO(policyFollow));
// }
/**
* 分页获取保单来佣列表(仅管理员可用)
*
* @param fnaQueryRequest
* @return
*/
// @PostMapping("/list/page")
// public Result<Page<Customer>> listFnaByPage(@RequestBody FnaQueryRequest fnaQueryRequest) {
// long current = fnaQueryRequest.getPageNo();
// long size = fnaQueryRequest.getPageSize();
// // 查询数据库
// Page<Customer> fnaPage = policyFollowService.page(new Page<>(current, size),
// policyFollowService.getQueryWrapper(fnaQueryRequest));
// return Result.success(fnaPage);
// }
/**
* 来佣检核页面-分页获取保单来佣列表(VO)
*
...
...
@@ -567,4 +529,27 @@ public class ApiCommissionController {
return
Result
.
success
(
commissionService
.
getCommissionVOPage
(
commissionPage
));
}
/**
* 查询入账结算汇率
*
* @param queryCommissionExchangeRateRequest
* @return
*/
@PostMapping
(
"/commission_exchange_rate"
)
@Operation
(
summary
=
"查询入账结算汇率"
)
public
Result
<
BigDecimal
>
commissionExchangeRate
(
@RequestBody
QueryCommissionExchangeRateRequest
queryCommissionExchangeRateRequest
)
{
if
(
queryCommissionExchangeRateRequest
==
null
||
StringUtils
.
isBlank
(
queryCommissionExchangeRateRequest
.
getPolicyNo
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"policyNo 不能为空"
);
}
if
(
queryCommissionExchangeRateRequest
.
getCommissionPeriod
()
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"commissionPeriod 不能为空"
);
}
return
Result
.
success
(
commissionService
.
queryCommissionExchangeRate
(
queryCommissionExchangeRateRequest
.
getPolicyNo
(),
queryCommissionExchangeRateRequest
.
getCommissionPeriod
()
)
);
}
}
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
View file @
a574728d
...
...
@@ -10,8 +10,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.result.Result
;
import
com.yd.csf.api.dto.QueryCommissionExpectedByPageNewResponse
;
import
com.yd.csf.api.dto.QueryCommissionExpectedByPageResponse
;
import
com.yd.csf.api.dto.ReceivableReportResponse
;
import
com.yd.csf.api.service.ApiCommissionExpectedService
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.model.CommissionExpected
;
...
...
@@ -28,7 +30,10 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -36,6 +41,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -64,6 +70,8 @@ public class ApiCommissionExpectedController {
private
PolicyFollowService
policyFollowService
;
@Resource
private
ApiInsuranceReconciliationCompanyFeignClient
companyFeignClient
;
@Autowired
private
ApiCommissionExpectedService
apiCommissionExpectedService
;
/**
* 批量新增预计入账
...
...
@@ -184,13 +192,13 @@ public class ApiCommissionExpectedController {
}
/**
* 应收款管理列表查询
* 应收款管理列表查询
(旧)
*
* @param commissionExpectedQueryRequest
* @return
*/
@PostMapping
(
"/queryCommissionExpectedByPage"
)
@Operation
(
summary
=
"应收款管理列表查询"
)
@Operation
(
summary
=
"应收款管理列表查询
(旧)
"
)
public
Result
<
QueryCommissionExpectedByPageResponse
>
queryCommissionExpectedByPage
(
@RequestBody
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
)
{
long
current
=
commissionExpectedQueryRequest
.
getPageNo
();
long
size
=
commissionExpectedQueryRequest
.
getPageSize
();
...
...
@@ -213,12 +221,44 @@ public class ApiCommissionExpectedController {
}
/**
* 应收款
导出
* 应收款
管理列表查询(新)
*
* @param commissionExpectedQueryRequest
* @return
*/
@PostMapping
(
"/export"
)
@PostMapping
(
"/queryCommissionExpectedByPage/new"
)
@Operation
(
summary
=
"应收款管理列表查询(新)"
)
public
Result
<
QueryCommissionExpectedByPageNewResponse
>
queryCommissionExpectedByPageNew
(
@RequestBody
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
)
{
// 统计信息仍基于所有符合条件的主记录
QueryWrapper
<
CommissionExpected
>
queryWrapper
=
commissionExpectedService
.
getQueryWrapper
(
commissionExpectedQueryRequest
);
List
<
CommissionExpected
>
allExpectedList
=
commissionExpectedService
.
list
(
queryWrapper
);
List
<
Long
>
expectedIds
=
allExpectedList
.
stream
()
.
map
(
CommissionExpected:
:
getId
)
.
collect
(
Collectors
.
toList
());
CommissionExpectedStatisticsVO
statisticsNewVO
=
commissionExpectedService
.
getExpectedStatisticsNew
(
expectedIds
);
// 获取混合分页结果
Page
<
CommissionExpectedNewVO
>
mixedPage
=
commissionExpectedService
.
getCommissionExpectedVONewPage
(
commissionExpectedQueryRequest
,
allExpectedList
);
// 组装返回
QueryCommissionExpectedByPageNewResponse
response
=
new
QueryCommissionExpectedByPageNewResponse
();
response
.
setExpectedStatisticsVO
(
statisticsNewVO
);
response
.
setPage
(
mixedPage
);
return
Result
.
success
(
response
);
}
/**
* 应收款导出(旧)
*
* @param commissionExpectedQueryRequest
* @return
*/
@PostMapping
(
"/export/old"
)
@Operation
(
summary
=
"应收款导出"
)
public
void
exportCommissionExpected
(
@RequestBody
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
if
(
commissionExpectedQueryRequest
==
null
)
{
...
...
@@ -251,6 +291,18 @@ public class ApiCommissionExpectedController {
}
/**
* 应收款导出(新)
*
* @param commissionExpectedQueryRequest
* @return
*/
@PostMapping
(
"/export"
)
@Operation
(
summary
=
"应收款导出"
)
public
void
exportCommissionExpectedNew
(
@RequestBody
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
apiCommissionExpectedService
.
exportCommissionExpectedNew
(
commissionExpectedQueryRequest
,
response
);
}
/**
* 获取保单应收款
*/
@PostMapping
(
"/getExpectedCommissionByProductlaunchId"
)
...
...
@@ -290,7 +342,13 @@ public class ApiCommissionExpectedController {
@PostMapping
(
"/receivable_report"
)
@Operation
(
summary
=
"应收款报表"
)
public
Result
<
ReceivableReportResponse
>
receivableReport
(
@RequestBody
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
)
{
//保單持有人(中/英、繁简/大小写)、签单人、转介人名称(主)、受保人(中/英、繁简/大小写)、查询保单号列表
List
<
String
>
queryPolicyNoList
=
policyFollowService
.
queryPolicyNoList
(
commissionExpectedQueryRequest
.
getPolicyHolder
(),
commissionExpectedQueryRequest
.
getSigner
(),
commissionExpectedQueryRequest
.
getBrokerName
(),
commissionExpectedQueryRequest
.
getInsured
());
// 构建查询条件
commissionExpectedQueryRequest
.
setPolicyNoList
(
queryPolicyNoList
);
QueryWrapper
<
CommissionExpected
>
queryWrapper
=
commissionExpectedService
.
getQueryWrapper
(
commissionExpectedQueryRequest
);
// 先查询所有符合条件的记录ID(用于统计)
...
...
@@ -298,7 +356,7 @@ public class ApiCommissionExpectedController {
List
<
Long
>
allExpectedIdList
=
allCommissionExpectedList
.
stream
().
map
(
CommissionExpected:
:
getId
).
collect
(
Collectors
.
toList
());
// 查询统计数据(基于所有符合条件的记录)
CommissionExpectedStatisticsVO
statisticsVO
=
commissionExpectedService
.
getExpectedStatistics
(
allExpectedIdList
);
CommissionExpectedStatisticsVO
statisticsVO
=
commissionExpectedService
.
getExpectedStatistics
New
(
allExpectedIdList
);
// 应收款报表分页查询 - 按保单号和期数维度统计
Page
<
ReceivableReportVO
>
reportPage
=
new
Page
<>(
commissionExpectedQueryRequest
.
getPageNo
(),
commissionExpectedQueryRequest
.
getPageSize
());
...
...
@@ -307,7 +365,7 @@ public class ApiCommissionExpectedController {
receivableReportPage
=
commissionExpectedService
.
receivableReportPage
(
reportPage
,
allExpectedIdList
);
}
// enrichReceivableReportWithCompanyName(receivableReportPage);
receivableReportPage
=
convert
ProductName
(
receivableReportPage
);
receivableReportPage
=
convert
ReceivableReport
(
receivableReportPage
);
// 组装返回结果
ReceivableReportResponse
response
=
new
ReceivableReportResponse
();
response
.
setStatisticsVO
(
statisticsVO
);
...
...
@@ -315,7 +373,8 @@ public class ApiCommissionExpectedController {
return
Result
.
success
(
response
);
}
public
IPage
<
ReceivableReportVO
>
convertProductName
(
IPage
<
ReceivableReportVO
>
receivableReportPage
)
{
public
IPage
<
ReceivableReportVO
>
convertReceivableReport
(
IPage
<
ReceivableReportVO
>
receivableReportPage
)
{
if
(!
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
receivableReportPage
.
getRecords
()))
{
List
<
String
>
policyNoList
=
receivableReportPage
.
getRecords
().
stream
().
map
(
ReceivableReportVO:
:
getPolicyNo
).
collect
(
Collectors
.
toList
());
List
<
PolicyFollow
>
policyFollowList
=
new
ArrayList
<>();
...
...
@@ -332,6 +391,17 @@ public class ApiCommissionExpectedController {
vo
.
setProductName
(
policyFollow
.
getProductName
());
vo
.
setProductLaunchBizId
(
policyFollow
.
getProductLaunchBizId
());
}
//已入账比例(%)>= 预计入账比例(%) 待入账比例和待入账金额归零
//已入账比例(%)
BigDecimal
paidRatio
=
ObjectUtils
.
defaultIfNull
(
vo
.
getPaidRatio
(),
BigDecimal
.
ZERO
);
//预计入账比例(%)
BigDecimal
commissionRatio
=
ObjectUtils
.
defaultIfNull
(
vo
.
getCommissionRatio
(),
BigDecimal
.
ZERO
);
if
(
paidRatio
.
compareTo
(
commissionRatio
)
>=
0
)
{
//待入账金额(港币)
vo
.
setUnpaidAmount
(
BigDecimal
.
ZERO
);
//待入账比例(%)
vo
.
setUnpaidRatio
(
BigDecimal
.
ZERO
);
}
return
vo
;
}).
collect
(
Collectors
.
toList
());
receivableReportPage
.
setRecords
(
voList
);
...
...
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFortuneController.java
View file @
a574728d
...
...
@@ -37,6 +37,7 @@ import javax.annotation.Resource;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -123,8 +124,8 @@ public class ApiFortuneController {
existingEntity
.
setFortunePeriod
(
updateEntity
.
getFortunePeriod
());
existingEntity
.
setFortuneTotalPeriod
(
updateEntity
.
getFortuneTotalPeriod
());
existingEntity
.
setFortuneName
(
updateEntity
.
getFortuneName
());
existingEntity
.
set
Amount
(
updateEntity
.
get
Amount
());
existingEntity
.
set
Currency
(
updateEntity
.
get
Currency
());
existingEntity
.
set
OriginalAmount
(
updateEntity
.
getOriginal
Amount
());
existingEntity
.
set
OriginalCurrency
(
updateEntity
.
getOriginal
Currency
());
existingEntity
.
setBroker
(
updateEntity
.
getBroker
());
existingEntity
.
setTeam
(
updateEntity
.
getTeam
());
existingEntity
.
setRemark
(
updateEntity
.
getRemark
());
...
...
@@ -194,7 +195,10 @@ public class ApiFortuneController {
@PostMapping
(
"/download/account"
)
public
Result
<
Boolean
>
downloadAccount
(
@RequestBody
FortuneDownloadRequest
fortuneDownloadRequest
,
HttpServletResponse
response
)
throws
IOException
{
if
(
CollectionUtils
.
isEmpty
(
fortuneDownloadRequest
.
getFortuneBizIdList
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"请选择要出账的发佣数据"
);
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"请选择要出账的发佣数据"
);
}
if
(
StringUtils
.
isBlank
(
fortuneDownloadRequest
.
getActualPayoutDate
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"请输入出账年月(实)"
);
}
fortuneService
.
downloadAccount
(
fortuneDownloadRequest
,
response
);
...
...
@@ -412,58 +416,74 @@ public class ApiFortuneController {
}
/**
*
修改出账状态
*
分期出账
*
* @param fortuneS
tatusUpdateRequest
* @param fortuneS
plitRequest 分期出账请求
* @return
*/
@PostMapping
(
"/
update/status
"
)
@Operation
(
summary
=
"
修改出账状态
"
)
public
Result
<
Boolean
>
updateFortuneStatus
(
@RequestBody
FortuneStatusUpdateRequest
fortuneStatusUpdate
Request
)
{
if
(
fortuneS
tatusUpdateRequest
==
null
||
CollectionUtils
.
isEmpty
(
fortuneStatusUpdateRequest
.
getFortuneBizId
List
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
ErrorCode
.
PARAMS_ERROR
.
getMessage
()
);
@PostMapping
(
"/
split
"
)
@Operation
(
summary
=
"
分期出账
"
)
public
Result
<
Boolean
>
splitFortune
(
@RequestBody
FortuneSplitRequest
fortuneSplit
Request
)
{
if
(
fortuneS
plitRequest
==
null
||
CollectionUtils
.
isEmpty
(
fortuneSplitRequest
.
getFortuneSplitDto
List
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"分期出账请求不能为空"
);
}
return
Result
.
success
(
fortuneService
.
updateFortuneStatus
(
fortuneStatusUpdateRequest
));
// 操作数据库
return
Result
.
success
(
fortuneService
.
splitFortune
(
fortuneSplitRequest
));
}
/**
* 修改设置出账年月(实)),设置完成后,更新到应付款管理明细中
*
* @param editActualPayoutDateRequest
* @return
*/
@PostMapping
(
"/edit/actual_payout_date"
)
@Operation
(
summary
=
"修改设置出账年月(实),设置完成后,更新到应付款管理明细中"
)
public
Result
<
Boolean
>
editActualPayoutDate
(
@RequestBody
EditActualPayoutDateRequest
editActualPayoutDateRequest
)
{
if
(
editActualPayoutDateRequest
==
null
||
StringUtils
.
isBlank
(
editActualPayoutDateRequest
.
getFortuneBizId
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"fortuneBizId 不能为空"
);
}
if
(
StringUtils
.
isBlank
(
editActualPayoutDateRequest
.
getActualPayoutDate
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"actualPayoutDate 不能为空"
);
}
return
Result
.
success
(
fortuneService
.
editActualPayoutDate
(
editActualPayoutDateRequest
));
}
/**
*
根据 fortuneBizId 获取保单发佣(封装类)
*
修改结算汇率,设置完成后,更新到应付款管理明细中
*
* @param
fortuneBizId
* @param
editExchangeRateRequest
* @return
*/
// @GetMapping("/get/vo")
// @Operation(summary = "根据 policyBizId 获取保单发佣详情")
// public Result<PolicyFollowVO> getPolicyFollowByPolicyBizId(@RequestParam("fortuneBizId") String fortuneBizId, HttpServletRequest request) {
// if (fortuneBizId == null) {
// return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
// }
// // 查询数据库
// PolicyFollow policyFollow = policyFollowService.getByPolicyBizId(policyBizId);
// if (policyFollow == null) {
// return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
// }
//
// // 获取封装类
// return Result.success(policyFollowService.getPolicyFollowVO(policyFollow));
// }
@PostMapping
(
"/edit/exchange_rate"
)
@Operation
(
summary
=
"修改结算汇率,设置完成后,更新到应付款管理明细中"
)
public
Result
<
Boolean
>
editExchangeRate
(
@RequestBody
EditExchangeRateRequest
editExchangeRateRequest
)
{
if
(
editExchangeRateRequest
==
null
||
StringUtils
.
isBlank
(
editExchangeRateRequest
.
getFortuneBizId
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"fortuneBizId 不能为空"
);
}
if
(
editExchangeRateRequest
.
getExchangeRate
()
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"exchangeRate 不能为空"
);
}
if
(
editExchangeRateRequest
.
getHkdAmount
()
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"hkdAmount 不能为空"
);
}
return
Result
.
success
(
fortuneService
.
editExchangeRate
(
editExchangeRateRequest
));
}
/**
*
分页获取保单发佣列表(仅管理员可用)
*
修改出账状态
*
* @param f
naQuery
Request
* @param f
ortuneStatusUpdate
Request
* @return
*/
// @PostMapping("/list/page")
// public Result<Page<Customer>> listFnaByPage(@RequestBody FnaQueryRequest fnaQueryRequest) {
// long current = fnaQueryRequest.getPageNo();
// long size = fnaQueryRequest.getPageSize();
// // 查询数据库
// Page<Customer> fnaPage = policyFollowService.page(new Page<>(current, size),
// policyFollowService.getQueryWrapper(fnaQueryRequest));
// return Result.success(fnaPage);
// }
@PostMapping
(
"/update/status"
)
@Operation
(
summary
=
"修改出账状态"
)
public
Result
<
Boolean
>
updateFortuneStatus
(
@RequestBody
FortuneStatusUpdateRequest
fortuneStatusUpdateRequest
)
{
if
(
fortuneStatusUpdateRequest
==
null
||
CollectionUtils
.
isEmpty
(
fortuneStatusUpdateRequest
.
getFortuneBizIdList
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
ErrorCode
.
PARAMS_ERROR
.
getMessage
());
}
return
Result
.
success
(
fortuneService
.
updateFortuneStatus
(
fortuneStatusUpdateRequest
));
}
/**
* 出账检核页面-分页获取保单发佣列表(VO)
...
...
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiPolicyFollowController.java
View file @
a574728d
...
...
@@ -27,7 +27,9 @@ import com.yd.csf.api.service.ApiCommissionConditionService;
import
com.yd.csf.api.service.ApiExpectedFortuneService
;
import
com.yd.csf.api.service.ApiPolicyFollowService
;
import
com.yd.csf.feign.request.expectedfortune.ApiGenerateExpectedFortuneRequest
;
import
com.yd.csf.feign.response.appointment.ApiAppointmentDetailResponse
;
import
com.yd.csf.feign.response.expectedfortune.ApiGenerateExpectedFortuneResponse
;
import
com.yd.csf.feign.response.policyfollow.ApiPolicyFollowDetailResponse
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.component.PolicyReportPdfService
;
import
com.yd.csf.service.dto.*
;
...
...
@@ -56,6 +58,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.DataIntegrityViolationException
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -63,6 +66,7 @@ import javax.annotation.Resource;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.constraints.NotBlank
;
import
java.math.BigDecimal
;
import
java.sql.SQLIntegrityConstraintViolationException
;
import
java.text.ParseException
;
...
...
@@ -942,4 +946,25 @@ public class ApiPolicyFollowController {
}
return
Result
.
success
(
policyFollowService
.
updatePolicySecondHolder
(
policySecondHolderUpdateRequest
));
}
/**
* 根据保单号查询新单跟进详情
* @param policyNo
* @return
*/
@GetMapping
(
"/detail"
)
public
Result
<
ApiPolicyFollowDetailResponse
>
detail
(
@RequestParam
(
value
=
"policyNo"
)
String
policyNo
){
return
policyFollowService
.
detail
(
policyNo
);
}
/**
* 更新-新单跟进投保人和受保人的名字冗余字段
* @return
*/
@PutMapping
(
"/update"
)
public
Result
update
(){
return
policyFollowService
.
updateTs
();
}
}
\ No newline at end of file
yd-csf-api/src/main/java/com/yd/csf/api/dto/ExecuteBillingDto.java
View file @
a574728d
...
...
@@ -11,6 +11,8 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
@Data
@Builder
@NoArgsConstructor
...
...
@@ -43,6 +45,11 @@ public class ExecuteBillingDto {
private
Integer
paymentTerm
;
/**
* 介绍费占比
*/
private
String
brokerRatio
;
/**
* 保单和转介人信息
*/
private
QueryPolicyAndBrokerDto
policyAndBrokerDto
;
...
...
yd-csf-api/src/main/java/com/yd/csf/api/dto/FortuneImportDTO.java
View file @
a574728d
...
...
@@ -55,8 +55,8 @@ public class FortuneImportDTO {
entity
.
setFortunePeriod
(
data
.
getFortunePeriod
());
entity
.
setFortuneTotalPeriod
(
data
.
getFortuneTotalPeriod
());
entity
.
setFortuneName
(
data
.
getFortuneName
());
entity
.
setAmount
(
data
.
getAmount
());
entity
.
setCurrency
(
data
.
getCurrency
());
entity
.
set
Original
Amount
(
data
.
getAmount
());
entity
.
set
Original
Currency
(
data
.
getCurrency
());
entity
.
setBroker
(
data
.
getBroker
());
entity
.
setTeam
(
data
.
getTeam
());
entity
.
setRemark
(
data
.
getRemark
());
...
...
yd-csf-api/src/main/java/com/yd/csf/api/dto/GenerateExpectedFortuneDto.java
View file @
a574728d
...
...
@@ -116,6 +116,11 @@ public class GenerateExpectedFortuneDto {
private
BigDecimal
paymentPremium
;
/**
* 介绍费占比
*/
private
String
brokerRatio
;
/**
* 获得积分业务员绑定的基本法列表对应计算值
*/
private
List
<
AlgorithmResDto
>
algorithmResDtoList
;
...
...
yd-csf-api/src/main/java/com/yd/csf/api/dto/QueryCommissionExpectedByPageNewResponse.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
api
.
dto
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.csf.service.vo.CommissionExpectedNewVO
;
import
com.yd.csf.service.vo.CommissionExpectedStatisticsNewVO
;
import
com.yd.csf.service.vo.CommissionExpectedStatisticsVO
;
import
com.yd.csf.service.vo.CommissionExpectedVO
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
@Data
@Schema
(
description
=
"查询预计来佣分页响应"
)
public
class
QueryCommissionExpectedByPageNewResponse
{
/**
* 预计来佣统计信息
*/
// @Schema(description = "预计来佣统计信息")
private
CommissionExpectedStatisticsVO
expectedStatisticsVO
;
/**
* 预计来佣分页列表
*/
// @Schema(description = "预计来佣分页列表")
private
Page
<
CommissionExpectedNewVO
>
page
;
}
yd-csf-api/src/main/java/com/yd/csf/api/service/ApiCommissionExpectedService.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
api
.
service
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.UnsupportedEncodingException
;
public
interface
ApiCommissionExpectedService
{
void
exportCommissionExpectedNew
(
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
;
}
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentServiceImpl.java
View file @
a574728d
...
...
@@ -11,7 +11,9 @@ import com.yd.common.enums.CommonEnum;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.result.Result
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.CodeGenerator
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.csf.api.service.*
;
import
com.yd.csf.feign.dto.appointment.*
;
...
...
@@ -946,6 +948,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
policyInsurant
.
setPolicyBizId
(
policyBizId
);
policyInsurant
.
setPolicyInsurantBizId
(
RandomStringGenerator
.
generateBizId16
(
"policy_insurant"
));
policyInsurant
.
setName
(
apiInsurantInfoDto
.
getNameCn
());
policyInsurant
.
setNameEn
(
apiInsurantInfoDto
.
getNamePyEn
());
policyInsurant
.
setNameSc
(
ChineseTextConverter
.
traditionalToSimplified
(
apiInsurantInfoDto
.
getNameCn
()));
policyInsurant
.
setNameEnLc
(
EnglishTextUtil
.
toLowerCaseSafe
(
apiInsurantInfoDto
.
getNamePyEn
()));
return
policyInsurantService
.
saveOrUpdate
(
policyInsurant
);
}
...
...
@@ -963,6 +968,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
policyPolicyholder
.
setPolicyBizId
(
policyBizId
);
policyPolicyholder
.
setPolicyPolicyholderBizId
(
RandomStringGenerator
.
generateBizId16
(
"policy_policyholder"
));
policyPolicyholder
.
setName
(
apiPolicyholderInfoDto
.
getNameCn
());
policyPolicyholder
.
setNameEn
(
apiPolicyholderInfoDto
.
getNamePyEn
());
policyPolicyholder
.
setNameSc
(
ChineseTextConverter
.
traditionalToSimplified
(
apiPolicyholderInfoDto
.
getNameCn
()));
policyPolicyholder
.
setNameEnLc
(
EnglishTextUtil
.
toLowerCaseSafe
(
apiPolicyholderInfoDto
.
getNamePyEn
()));
return
policyPolicyholderService
.
saveOrUpdate
(
policyPolicyholder
);
}
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiBasicLawCalculateServiceImpl.java
View file @
a574728d
...
...
@@ -317,8 +317,8 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
continue
;
}
Fortune
fortune
=
new
Fortune
();
//发佣金额 -> 计算值 - sqlAlgorithmResultDtoList集合里面的计算值和值
fortune
.
setAmount
(
algorithmResDto
.
getCalculatedValue
());
//
基本法
发佣金额 -> 计算值 - sqlAlgorithmResultDtoList集合里面的计算值和值
fortune
.
set
Rule
Amount
(
algorithmResDto
.
getCalculatedValue
());
//保单发佣批次ID
fortune
.
setBatchBizId
(
fortuneDto
.
getBatchBizId
());
//转介人姓名 (获得积分的业务员)
...
...
@@ -331,8 +331,8 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
//基本法项目配置表唯一业务ID
fortune
.
setRuleItemBizId
(
algorithmResDto
.
getRuleItemBizId
());
//发佣币种
fortune
.
setCurrency
(
fortuneDto
.
getCurrency
());
//
基本法
发佣币种
fortune
.
set
Rule
Currency
(
fortuneDto
.
getCurrency
());
//发佣期数
fortune
.
setFortunePeriod
(
fortuneDto
.
getFortunePeriod
());
//发佣总期数
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiCommissionExpectedServiceImpl.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
api
.
service
.
impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.csf.api.service.ApiCommissionExpectedService
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
com.yd.csf.service.model.CommissionExpected
;
import
com.yd.csf.service.service.CommissionExpectedService
;
import
com.yd.csf.service.service.PolicyFollowService
;
import
com.yd.csf.service.vo.CommissionExpectedExportDTO
;
import
com.yd.csf.service.vo.CommissionExpectedExportNewDTO
;
import
com.yd.csf.service.vo.CommissionExpectedNewVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
public
class
ApiCommissionExpectedServiceImpl
implements
ApiCommissionExpectedService
{
@Resource
private
PolicyFollowService
policyFollowService
;
@Resource
private
CommissionExpectedService
commissionExpectedService
;
/**
* 应收款导出(新)
*
* @param commissionExpectedQueryRequest
* @return
*/
@Override
public
void
exportCommissionExpectedNew
(
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
if
(
commissionExpectedQueryRequest
==
null
)
{
throw
new
RuntimeException
(
"查询参数不能为空"
);
}
// 设置响应头
String
fileName
=
URLEncoder
.
encode
(
"应收款管理数据"
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
//保單持有人(中/英、繁简/大小写)、签单人、转介人名称(主)、受保人(中/英、繁简/大小写)、查询保单号列表
List
<
String
>
queryPolicyNoList
=
policyFollowService
.
queryPolicyNoList
(
commissionExpectedQueryRequest
.
getPolicyHolder
(),
commissionExpectedQueryRequest
.
getSigner
(),
commissionExpectedQueryRequest
.
getBrokerName
(),
commissionExpectedQueryRequest
.
getInsured
());
// 构建查询条件
commissionExpectedQueryRequest
.
setPolicyNoList
(
queryPolicyNoList
);
QueryWrapper
<
CommissionExpected
>
queryWrapper
=
commissionExpectedService
.
getQueryWrapper
(
commissionExpectedQueryRequest
);
// 先查询所有符合条件的记录列表
List
<
CommissionExpected
>
allCommissionExpectedList
=
commissionExpectedService
.
list
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
allCommissionExpectedList
))
{
throw
new
BusinessException
(
"无导出数据"
);
}
commissionExpectedQueryRequest
.
setPageNo
(
1
);
commissionExpectedQueryRequest
.
setPageSize
(
99999999
);
Page
<
CommissionExpectedNewVO
>
page
=
commissionExpectedService
.
getCommissionExpectedVONewPage
(
commissionExpectedQueryRequest
,
allCommissionExpectedList
);
log
.
info
(
"应收款导出=>查询所有符合条件的记录列表=>Page<CommissionExpectedNewVO>:{}"
,
JSON
.
toJSONString
(
page
));
// 转换为导出DTO
List
<
CommissionExpectedExportNewDTO
>
exportDataList
=
page
.
getRecords
().
stream
()
.
map
(
CommissionExpectedExportNewDTO:
:
convertToExportDTO
)
.
collect
(
Collectors
.
toList
());
log
.
info
(
"应收款导出=>转换为导出DTO=>exportDataList:{}"
,
JSON
.
toJSONString
(
exportDataList
));
// 使用EasyExcel导出
try
(
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
response
.
getOutputStream
(),
CommissionExpectedExportNewDTO
.
class
).
build
())
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"应收款数据"
).
build
();
excelWriter
.
write
(
exportDataList
,
writeSheet
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"导出应收款数据失败"
,
e
);
}
}
}
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
a574728d
...
...
@@ -2,6 +2,7 @@ package com.yd.csf.api.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
...
...
@@ -108,13 +109,15 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
@Resource
private
ApiExchangeRateFeignClient
apiExchangeRateFeignClient
;
@Resource
private
Commission
ExpectedService
commissionExpected
Service
;
private
Commission
Service
commission
Service
;
@Resource
private
ApiAnnouncementCommissionRatioFeignClient
apiAnnouncementCommissionRatioFeignClient
;
@Resource
private
FeignResultHelper
feignResultHelper
;
@Resource
private
ApiAnnouncementCommissionRatioFeignClient
ratioFeignClient
;
@Resource
private
FortuneService
fortuneService
;
@Autowired
private
ApiCommissionConditionService
apiCommissionConditionService
;
...
...
@@ -484,19 +487,28 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
log
.
info
(
"结算汇率:{}"
,
exchangeRate
);
for
(
ExpectedFortune
expectedFortune
:
expectedFortuneList
)
{
//设置结算货币
expectedFortune
.
setCurrency
(
currency
);
//设置默认结算汇率
expectedFortune
.
setDefaultExchangeRate
(
exchangeRate
);
//设置港币金额(标准发佣金额 * 默认结算汇率)
expectedFortune
.
setHkdAmount
(
expectedFortune
.
getAmount
().
multiply
(
exchangeRate
));
ExpectedFortune
updateObj
=
new
ExpectedFortune
();
updateObj
.
setId
(
expectedFortune
.
getId
());
//原币种
updateObj
.
setOriginalCurrency
(
currency
);
//原币种金额
updateObj
.
setOriginalAmount
(
expectedFortune
.
getRuleAmount
());
//原币种 -> 港币汇率
updateObj
.
setOriginalToHkdRate
(
exchangeRate
);
//保单币种
updateObj
.
setRuleCurrency
(
currency
);
//默认保单币种 -> 港币汇率
updateObj
.
setDefaultExchangeRate
(
exchangeRate
);
//港币金额(标准发佣金额 * 默认保单币种 -> 港币汇率)
updateObj
.
setHkdAmount
(
expectedFortune
.
getRuleAmount
().
multiply
(
exchangeRate
));
//默认值
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
expectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
expectedFortune
.
setUnpaidAmount
(
expectedFortune
.
getHkdAmount
());
expectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
updateObj
.
setPaidAmount
(
BigDecimal
.
ZERO
);
updateObj
.
setPaidRatio
(
BigDecimal
.
ZERO
);
updateObj
.
setUnpaidAmount
(
expectedFortune
.
getHkdAmount
());
updateObj
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
iExpectedFortuneService
.
updateById
(
expectedFortune
);
iExpectedFortuneService
.
updateById
(
updateObj
);
}
}
}
...
...
@@ -559,6 +571,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.
policyAndBrokerDto
(
brokerDto
)
.
issueNumber
(
i
)
.
paymentTerm
(
paymentTerm
)
.
brokerRatio
(
brokerDto
.
getBrokerRatio
())
.
build
());
//收集计算销售佣金的转介人
AlgorithmCollectResDto
resDto
=
new
AlgorithmCollectResDto
();
...
...
@@ -583,6 +596,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.
policyAndBrokerDto
(
brokerDto
)
.
issueNumber
(
i
)
.
paymentTerm
(
paymentTerm
)
.
brokerRatio
(
brokerDto
.
getBrokerRatio
())
.
build
());
//收集计算非销售佣金的转介人
AlgorithmCollectResDto
resDto1
=
new
AlgorithmCollectResDto
();
...
...
@@ -670,18 +684,25 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//获取当前序号作为起点
int
currentSeq
=
0
;
if
(!
Objects
.
isNull
(
latest
))
{
currentSeq
=
Integer
.
parseInt
(
latest
.
getPayableNo
().
substring
(
12
));
String
payableNo
=
latest
.
getPayableNo
();
currentSeq
=
Integer
.
parseInt
(
payableNo
.
substring
(
payableNo
.
length
()
-
6
));
}
//批量更新应付款编号,每个item递增
ExpectedFortune
expectedFortune
;
List
<
ExpectedFortune
>
updateList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
expectedFortuneList
.
size
();
i
++)
{
expectedFortune
=
expectedFortuneList
.
get
(
i
);
expectedFortune
.
setPayableNo
(
this
.
createPayableNo
(
"R"
,
currentSeq
+
i
+
1
));
expectedFortune
.
setFortuneType
(
GetDictItemListByDictTypeResponse
.
getItemValue
(
dictTypeResponses
,
ExpectedFortune
updateObj
=
new
ExpectedFortune
();
updateObj
.
setId
(
expectedFortune
.
getId
());
updateObj
.
setPayableNo
(
this
.
createPayableNo
(
"R"
,
currentSeq
+
i
+
1
));
updateObj
.
setFortuneType
(
GetDictItemListByDictTypeResponse
.
getItemValue
(
dictTypeResponses
,
"csf_fortune_type"
,
expectedFortune
.
getFortuneName
()));
updateList
.
add
(
updateObj
);
}
iExpectedFortuneService
.
updateBatchById
(
expectedFortun
eList
);
iExpectedFortuneService
.
updateBatchById
(
updat
eList
);
return
expectedFortuneList
;
}
...
...
@@ -752,6 +773,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//保险公司业务id
.
insuranceCompanyBizId
(
brokerDto
.
getInsuranceCompanyBizId
())
.
source
(
2
)
//转介人的介绍费占比
.
brokerRatio
(
dto
.
getBrokerRatio
())
.
build
());
return
Result
.
success
(
result
.
getData
());
...
...
@@ -828,6 +851,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//保险公司业务id
.
insuranceCompanyBizId
(
brokerDto
.
getInsuranceCompanyBizId
())
.
source
(
1
)
.
brokerRatio
(
dto
.
getBrokerRatio
())
.
build
());
return
Result
.
success
(
result
.
getData
());
...
...
@@ -852,10 +876,10 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
continue
;
}
log
.
info
(
"生成保单预计发佣表记录——>入参algorithmResDto:{}"
,
JSON
.
toJSONString
(
algorithmResDto
));
PolicyBroker
policyBroker
=
policyBrokerService
.
queryOne
(
QueryPolicyBrokerDto
.
builder
()
.
policyNo
(
fortuneDto
.
getPolicyNo
())
.
brokerBizId
(
fortuneDto
.
getBrokerBizId
())
.
build
());
//
PolicyBroker policyBroker = policyBrokerService.queryOne(QueryPolicyBrokerDto.builder()
//
.policyNo(fortuneDto.getPolicyNo())
//
.brokerBizId(fortuneDto.getBrokerBizId())
//
.build());
ExpectedFortune
fortune
=
new
ExpectedFortune
();
//发佣金额 -> 计算值 - sqlAlgorithmResultDtoList集合里面的计算值和值
// fortune.setAmount(algorithmResDto.getCalculatedValue());
...
...
@@ -898,7 +922,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
fortune
.
setStandardAmount
(
standardAmount
);
// 转介人介绍费占比
String
brokerRatioStr
=
!
Objects
.
isNull
(
policyBroker
)
?
policyBroker
.
getBrokerRatio
()
:
"100"
;
// String brokerRatioStr = !Objects.isNull(policyBroker) ? policyBroker.getBrokerRatio() : "100";
String
brokerRatioStr
=
StringUtils
.
isNotBlank
(
fortuneDto
.
getBrokerRatio
())
?
fortuneDto
.
getBrokerRatio
()
:
"100"
;
fortune
.
setBrokerRatio
(
brokerRatioStr
);
try
{
...
...
@@ -909,17 +934,20 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
// 计算实际预计发佣金额 = 标准发佣金额 × decimalRatio
BigDecimal
actualAmount
=
standardAmount
.
multiply
(
decimalRatio
);
fortune
.
setAmount
(
actualAmount
);
fortune
.
set
Rule
Amount
(
actualAmount
);
}
catch
(
NumberFormatException
e
)
{
// 如果比例不是有效的数字,使用标准金额
fortune
.
setAmount
(
standardAmount
);
fortune
.
set
Rule
Amount
(
standardAmount
);
}
catch
(
Exception
e
)
{
// 其他异常处理
log
.
error
(
"计算发佣金额异常: {}"
,
brokerRatioStr
,
e
);
fortune
.
setAmount
(
standardAmount
);
fortune
.
set
Rule
Amount
(
standardAmount
);
}
// 创建人
fortune
.
setCreatorName
(
"系统生成"
);
fortuneList
.
add
(
fortune
);
}
}
...
...
@@ -942,6 +970,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
List
<
ExpectedFortune
>
fortuneList
=
iExpectedFortuneService
.
list
(
queryWrapper
);
ExpectedFortuneStatisticsVO
statisticsVO
=
this
.
getStatistics
(
fortuneList
.
stream
().
map
(
ExpectedFortune:
:
getId
).
collect
(
Collectors
.
toList
()));
// 查询实际发佣列表
List
<
Fortune
>
expectedFortuneList
=
fortuneService
.
list
();
// 组装返回结果
ApiExpectedFortunePageResponseVO
response
=
new
ApiExpectedFortunePageResponseVO
();
response
.
setStatisticsVO
(
statisticsVO
);
...
...
@@ -970,15 +1001,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
}
// 查询最新一条有 payableNo 记录
ExpectedFortune
latest
=
iExpectedFortuneService
.
getOne
(
new
QueryWrapper
<
ExpectedFortune
>().
isNotNull
(
"payable_no"
).
orderByDesc
(
"id"
).
last
(
"LIMIT 1"
),
true
);
//获取当前序号作为起点
int
currentSeq
=
0
;
if
(!
Objects
.
isNull
(
latest
))
{
currentSeq
=
Integer
.
parseInt
(
latest
.
getPayableNo
().
substring
(
12
));
}
int
currentSeq
=
iExpectedFortuneService
.
getPayableNoCurrentSeq
();
List
<
ExpectedFortune
>
fortuneList
=
new
ArrayList
<>();
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
...
...
@@ -1004,11 +1027,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
expectedFortune
.
setFortuneName
(
queryByDict
(
expectedFortuneDto
.
getFortuneType
()));
// 应付款编号(序号递增)
expectedFortune
.
setPayableNo
(
this
.
createPayableNo
(
expectedFortune
.
getFortuneBizType
(),
++
currentSeq
));
// 默认结算汇率
expectedFortune
.
setDefaultExchangeRate
(
queryExchangeRateByFeign
(
expectedFortuneDto
.
getCurrency
(),
"HKD"
));
// 计算港币金额
expectedFortune
.
setHkdAmount
(
expectedFortuneDto
.
getAmount
().
multiply
(
expectedFortune
.
getDefaultExchangeRate
()));
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
// 转介人比例默认100%
...
...
@@ -1065,12 +1085,15 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
private
void
validateAdd
(
List
<
ExpectedFortuneAddRequest
>
fortuneAddRequestList
)
{
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getAmount
()))
{
if
(
Objects
.
isNull
(
expectedFortuneDto
.
get
Hkd
Amount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账金额不能为空"
);
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账币种不能为空"
);
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getExchangeRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"结算汇率不能为空"
);
}
}
}
...
...
@@ -1098,7 +1121,11 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
@Override
public
Result
<
PayableReportResponse
>
payableReport
(
ApiExpectedFortunePageRequest
request
)
{
//保單持有人(中/英)、签单人、转介人名称(主)查询保单号列表
List
<
String
>
queryPolicyNoList
=
policyFollowService
.
queryPolicyNoList
(
request
.
getPolicyHolder
(),
""
,
""
,
""
);
// 构建查询条件
request
.
setPolicyNoList
(
queryPolicyNoList
);
QueryWrapper
<
ExpectedFortune
>
queryWrapper
=
this
.
getQueryWrapper
(
request
);
// 先查询所有符合条件的记录ID(用于统计)
...
...
@@ -1213,6 +1240,10 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if
(
request
==
null
)
{
return
queryWrapper
;
}
// 默认查询条件 是否分期出账 1-是 0-否 2-拆分的原纪录
queryWrapper
.
in
(
"is_part"
,
0
,
1
);
// 获取参数
String
payableNo
=
request
.
getPayableNo
();
String
policyNo
=
request
.
getPolicyNo
();
...
...
@@ -1245,6 +1276,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
queryWrapper
.
in
(
ObjectUtils
.
isNotEmpty
(
signerBizIdList
),
"signer_biz_id"
,
signerBizIdList
);
queryWrapper
.
eq
(
StringUtils
.
isNotBlank
(
fortuneBizType
),
"fortune_biz_type"
,
fortuneBizType
);
queryWrapper
.
in
(
ObjectUtils
.
isNotEmpty
(
request
.
getPolicyNoList
()),
"policy_no"
,
request
.
getPolicyNoList
());
// 按id升序排序
queryWrapper
.
orderByAsc
(
"id"
);
return
queryWrapper
;
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
View file @
a574728d
...
...
@@ -14,6 +14,8 @@ import com.yd.common.enums.CommonEnum;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.result.Result
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.csf.api.async.ApiExpectedFortuneAsyncService
;
import
com.yd.csf.api.service.ApiExpectedFortuneService
;
...
...
@@ -129,6 +131,19 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
*/
@Override
public
Result
<
IPage
<
ApiPremiumReconciliationPageResponse
>>
page
(
ApiPremiumReconciliationPageRequest
request
)
{
// 投保人-中文转简体
String
policyHolderNameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
request
.
getPolicyHolder
());
// 投保人-英文转小写
String
policyHolderNameEnLc
=
EnglishTextUtil
.
toLowerCase
(
request
.
getPolicyHolder
());
// 受保人-中文转简体
String
insuredNameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
request
.
getPolicyHolder
());
// 受保人-英文转小写
String
insuredNameEnLc
=
EnglishTextUtil
.
toLowerCase
(
request
.
getPolicyHolder
());
request
.
setPolicyHolderNameSc
(
policyHolderNameSc
);
request
.
setPolicyHolderNameEnLc
(
policyHolderNameEnLc
);
request
.
setInsuredNameSc
(
insuredNameSc
);
request
.
setInsuredNameEnLc
(
insuredNameEnLc
);
Page
<
ApiPremiumReconciliationPageResponse
>
page
=
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
());
IPage
<
ApiPremiumReconciliationPageResponse
>
iPage
=
iPremiumReconciliationService
.
page
(
page
,
request
);
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumRemittanceServiceImpl.java
View file @
a574728d
...
...
@@ -6,6 +6,7 @@ import com.yd.common.enums.CommonEnum;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.result.Result
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.common.utils.UrlPathExtractor
;
import
com.yd.csf.api.service.ApiPremiumRemittanceFileService
;
import
com.yd.csf.api.service.ApiPremiumRemittanceService
;
import
com.yd.csf.feign.dto.premiumremittance.ApiPremiumRemittanceDto
;
...
...
@@ -15,6 +16,9 @@ import com.yd.csf.feign.response.premiumreconciliation.ApiPremiumReconciliationP
import
com.yd.csf.service.dto.PremiumRemittanceDto
;
import
com.yd.csf.service.model.PremiumRemittance
;
import
com.yd.csf.service.service.IPremiumRemittanceService
;
import
com.yd.oss.feign.client.ApiOssFileFeignClient
;
import
com.yd.oss.feign.request.ApiOssFileListRequest
;
import
com.yd.oss.feign.response.ApiOssFileListResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -38,6 +42,9 @@ public class ApiPremiumRemittanceServiceImpl implements ApiPremiumRemittanceServ
@Autowired
private
ApiPremiumRemittanceFileService
apiPremiumRemittanceFileService
;
@Autowired
private
ApiOssFileFeignClient
apiOssFileFeignClient
;
/**
* 分页列表查询-保费对账汇款记录信息
* @param request
...
...
@@ -176,9 +183,41 @@ public class ApiPremiumRemittanceServiceImpl implements ApiPremiumRemittanceServ
ApiPremiumRemittanceDto
remittanceDto
=
new
ApiPremiumRemittanceDto
();
BeanUtils
.
copyProperties
(
dto
,
remittanceDto
);
//支付凭证列表
remittanceDto
.
setPaymentVoucherList
(
StringUtils
.
isNotBlank
(
dto
.
getPaymentVoucher
())
?
Arrays
.
asList
(
dto
.
getPaymentVoucher
().
split
(
";"
).
clone
())
:
new
ArrayList
<>());
ApiOssFileListRequest
request
=
new
ApiOssFileListRequest
();
if
(
StringUtils
.
isNotBlank
(
dto
.
getPaymentVoucher
()))
{
List
<
String
>
fileKeyList
=
UrlPathExtractor
.
extractPaths
(
dto
.
getPaymentVoucher
());
request
.
setFileKeyList
(
fileKeyList
);
Result
<
List
<
ApiOssFileListResponse
>>
result
=
apiOssFileFeignClient
.
list
(
request
);
if
(!
CollectionUtils
.
isEmpty
(
result
.
getData
()))
{
List
<
ApiPremiumRemittanceFileDto
>
paymentVoucherDtoList
=
result
.
getData
().
stream
().
map
(
d
->
{
ApiPremiumRemittanceFileDto
fileDto
=
new
ApiPremiumRemittanceFileDto
();
fileDto
.
setFileName
(
d
.
getOriginalName
());
fileDto
.
setFileUrl
(
d
.
getFileUrl
());
fileDto
.
setFileType
(
d
.
getFileType
());
return
fileDto
;
}).
collect
(
Collectors
.
toList
());
remittanceDto
.
setPaymentVoucherDtoList
(
paymentVoucherDtoList
);
}
}
// remittanceDto.setPaymentVoucherList(StringUtils.isNotBlank(dto.getPaymentVoucher()) ? Arrays.asList(dto.getPaymentVoucher().split(";").clone()) : new ArrayList<>());
//账户证明列表
remittanceDto
.
setAccountVerificationList
(
StringUtils
.
isNotBlank
(
dto
.
getAccountVerification
())
?
Arrays
.
asList
(
dto
.
getAccountVerification
().
split
(
";"
).
clone
())
:
new
ArrayList
<>());
ApiOssFileListRequest
request1
=
new
ApiOssFileListRequest
();
if
(
StringUtils
.
isNotBlank
(
dto
.
getAccountVerification
()))
{
List
<
String
>
fileKeyList
=
UrlPathExtractor
.
extractPaths
(
dto
.
getAccountVerification
());
request1
.
setFileKeyList
(
fileKeyList
);
Result
<
List
<
ApiOssFileListResponse
>>
result
=
apiOssFileFeignClient
.
list
(
request1
);
if
(!
CollectionUtils
.
isEmpty
(
result
.
getData
()))
{
List
<
ApiPremiumRemittanceFileDto
>
accountVerificationDtoList
=
result
.
getData
().
stream
().
map
(
d
->
{
ApiPremiumRemittanceFileDto
fileDto
=
new
ApiPremiumRemittanceFileDto
();
fileDto
.
setFileName
(
d
.
getOriginalName
());
fileDto
.
setFileUrl
(
d
.
getFileUrl
());
fileDto
.
setFileType
(
d
.
getFileType
());
return
fileDto
;
}).
collect
(
Collectors
.
toList
());
remittanceDto
.
setAccountVerificationDtoList
(
accountVerificationDtoList
);
}
}
// remittanceDto.setAccountVerificationList(StringUtils.isNotBlank(dto.getAccountVerification()) ? Arrays.asList(dto.getAccountVerification().split(";").clone()) : new ArrayList<>());
//其他资料列表
List
<
ApiPremiumRemittanceFileDto
>
fileDtoList
=
apiPremiumRemittanceFileService
.
apiPremiumRemittanceFileDtoList
(
dto
.
getPremiumRemittanceBizId
());
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
View file @
a574728d
...
...
@@ -133,6 +133,21 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
if
(
fortuneAccount
==
null
)
{
throw
new
BusinessException
(
"出账记录不存在"
);
}
//统计保存入参的薪资拆分应发记录原币种金额金额之和
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getApiSalarySplitBatchSaveDtoList
()))
{
//入参的薪资拆分应发记录原币种金额金额之和
BigDecimal
total
=
request
.
getApiSalarySplitBatchSaveDtoList
().
stream
()
.
map
(
ApiSalarySplitBatchSaveDto:
:
getFromAmount
)
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//原币种总金额
BigDecimal
fortuneAmount
=
fortuneAccount
.
getHkdAmount
()
!=
null
?
fortuneAccount
.
getHkdAmount
()
:
BigDecimal
.
ZERO
;
//入参的薪资拆分应发记录原币种金额金额之和不能大于原币种总金额
if
(
fortuneAmount
.
compareTo
(
total
)
<
0
)
{
throw
new
BusinessException
(
"拆分的原币种金额之和不能大于原币种总金额"
);
}
}
//薪资拆分应发记录-先删除后新增
iSalarySplitService
.
deleteByFortuneAccountBizId
(
request
.
getFortuneAccountBizId
());
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/excel/ApiSalarySplitSummaryExcelDto.java
View file @
a574728d
...
...
@@ -43,7 +43,7 @@ public class ApiSalarySplitSummaryExcelDto {
@Excel
(
name
=
"本期总出账金额(原币种)"
,
orderNum
=
"12"
)
private
BigDecimal
hkdAmount
;
@Excel
(
name
=
"出账
记录业务id
"
,
orderNum
=
"13"
)
private
String
fortuneAccountBizId
;
@Excel
(
name
=
"出账
业务编号
"
,
orderNum
=
"13"
)
private
String
businessNo
;
}
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/premiumremittance/ApiPremiumRemittanceDto.java
View file @
a574728d
...
...
@@ -86,6 +86,18 @@ public class ApiPremiumRemittanceDto {
private
List
<
String
>
accountVerificationList
;
/**
* 支付凭证列表
*/
// @NotEmpty(message = "支付凭证列表不能为空")
private
List
<
ApiPremiumRemittanceFileDto
>
paymentVoucherDtoList
;
/**
* 账户证明列表
*/
// @NotEmpty(message = "账户证明列表不能为空")
private
List
<
ApiPremiumRemittanceFileDto
>
accountVerificationDtoList
;
/**
* 其他资料列表
*/
private
List
<
ApiPremiumRemittanceFileDto
>
apiPremiumRemittanceFileDtoList
;
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/salarysplit/ApiSalarySplitSummaryPageDto.java
View file @
a574728d
...
...
@@ -24,6 +24,11 @@ public class ApiSalarySplitSummaryPageDto {
private
String
fortuneAccountBizId
;
/**
* 出账业务编号(出账年月 + 转介人内部编号(后6位)(如无,用0补齐)+流水号(6位))
*/
private
String
businessNo
;
/**
* 转介人名称
*/
private
String
brokerName
;
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ApiExpectedFortunePageRequest.java
View file @
a574728d
...
...
@@ -59,4 +59,12 @@ public class ApiExpectedFortunePageRequest extends PageDto {
@Schema
(
description
=
"应付款类型 R-关联保单应付款 U-非关联保单应付款"
)
private
String
fortuneBizType
;
/**
* 保單持有人(中/英)
*/
private
String
policyHolder
;
private
List
<
String
>
PolicyNoList
;
}
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneAddRequest.java
View file @
a574728d
...
...
@@ -76,10 +76,16 @@ public class ExpectedFortuneAddRequest {
private
String
fortuneType
;
/**
*
出账金额
*
结算汇率
*/
@Schema
(
description
=
"出账金额"
)
private
BigDecimal
amount
;
@Schema
(
description
=
"结算汇率"
)
private
BigDecimal
exchangeRate
;
/**
* 出账金额 单位:港币
*/
@Schema
(
description
=
"出账金额 单位:港币"
)
private
BigDecimal
hkdAmount
;
/**
* 出账币种
...
...
@@ -107,4 +113,9 @@ public class ExpectedFortuneAddRequest {
@Schema
(
description
=
"出账状态 0=待出账 1=可出帐,待检核 2=完成出账 3=部分出账 4=保留 5=已失效 6=可出帐,检核完成 7=未找到当前预计发佣对应的来佣, 字典值: csf_expected_fortune_status"
)
private
String
status
;
/**
* 备注
*/
@Schema
(
description
=
"备注"
)
private
String
remark
;
}
yd-csf-feign/src/main/java/com/yd/csf/feign/request/premiumreconciliation/ApiPremiumReconciliationPageRequest.java
View file @
a574728d
...
...
@@ -2,7 +2,9 @@ package com.yd.csf.feign.request.premiumreconciliation;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
com.yd.common.dto.PageDto
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.CustomLocalDateTimeDeserializer
;
import
com.yd.common.utils.EnglishTextUtil
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
...
...
@@ -35,11 +37,16 @@ public class ApiPremiumReconciliationPageRequest extends PageDto {
private
String
appointmentNo
;
/**
* 保單持有人(投保人)
* 保單持有人(投保人)
(中文名/英文名)(繁简/大小写)
*/
private
String
policyHolder
;
/**
* 受保人(保单表)(中文名/英文名)(繁简/大小写)
*/
private
String
insured
;
/**
* 缴费方式
*/
private
String
paymentMethod
;
...
...
@@ -59,6 +66,15 @@ public class ApiPremiumReconciliationPageRequest extends PageDto {
*/
private
String
reconciliationType
;
// 投保人-中文转简体
private
String
policyHolderNameSc
;
// 投保人-英文转小写
private
String
policyHolderNameEnLc
;
// 受保人-中文转简体
private
String
insuredNameSc
;
// 受保人-英文转小写
private
String
insuredNameEnLc
;
/**
* 付款日期
*/
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
View file @
a574728d
...
...
@@ -236,9 +236,15 @@ public class ApiExpectedFortunePageResponse {
private
LocalDateTime
createTime
;
/**
* 更新时间
* 创建人名称
*/
private
String
creatorName
;
/**
* 更新时间(操作时间)
*/
@Schema
(
description
=
"更新时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
updateTime
;
/**
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/response/policyfollow/ApiPolicyFollowDetailResponse.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
feign
.
response
.
policyfollow
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
public
class
ApiPolicyFollowDetailResponse
{
/**
* id
*/
private
Long
id
;
/**
* 新单跟进唯一业务ID
*/
private
String
policyBizId
;
/**
* 保单号
*/
private
String
policyNo
;
/**
* FNA 业务ID
*/
private
String
fnaBizId
;
/**
* 预约信息主表唯一业务ID
*/
private
String
appointmentBizId
;
/**
* 预约编号
*/
private
String
appointmentNo
;
/**
* 客户业务id
*/
private
String
customerBizId
;
/**
* 递交日期
*/
private
Date
submitDate
;
/**
* 客户名称
*/
private
String
customerName
;
/**
* 签单日期
*/
private
Date
signDate
;
/**
* 签单人
*/
private
String
signer
;
/**
* 签单人业务id
*/
private
String
signerBizId
;
/**
* 签单人执业编号
*/
private
String
practiceCode
;
/**
* 签单地点
*/
private
String
signLocation
;
/**
* 缮发日期
*/
private
Date
issueDate
;
/**
* 冷静期结束日期
*/
private
Date
coolingOffEndDate
;
/**
* 冷静期天数
*/
private
Integer
coolingOffDays
;
/**
* 核保日期
*/
private
Date
underwritingDate
;
/**
* 生效日期
*/
private
Date
effectiveDate
;
/**
* 续保日期
*/
private
Date
renewalDate
;
/**
* 保单回执日期
*/
private
Date
receiptDate
;
/**
* 回执状态
*/
private
String
receiptStatus
;
/**
* 是否开通直接支付
*/
private
Integer
directPaymentEnabled
;
/**
* 供款年期
*/
private
Object
issueNumber
;
/**
* 保障期限
*/
private
String
guaranteePeriod
;
/**
* 保额(重疾险)
*/
private
BigDecimal
sumInsured
;
/**
* 付款频率(字典)
*/
private
String
paymentFrequency
;
/**
* 每期保费
*/
private
BigDecimal
eachIssuePremium
;
/**
* 是否预缴: 0-否, 1-是
*/
private
Integer
isPrepay
;
/**
* 是否追溯: 0-否, 1-是
*/
private
Integer
isTraceable
;
/**
* 回溯日期
*/
private
Date
retroactiveDate
;
/**
* 预缴年期
*/
private
Integer
prepaidTerm
;
/**
* 预付额
*/
private
String
prepaidAmount
;
/**
* 折扣后预付额
*/
private
String
prepaidAmountAfterDiscount
;
/**
* 保单截止日期
*/
private
Date
policyExpirationDate
;
/**
* 缴费编号
*/
private
String
paymentNumber
;
/**
* 产品上架信息表唯一业务ID
*/
private
String
productLaunchBizId
;
/**
* 产品名称
*/
private
String
productName
;
/**
* 产品险种
*/
private
String
productCate
;
/**
* 产品险种代码
*/
private
String
categoryCode
;
/**
* 产品险种业务 id
*/
private
String
insuranceCategoryBizId
;
/**
* 保险公司
*/
private
String
insuranceCompany
;
/**
* 保险公司业务id
*/
private
String
insuranceCompanyBizId
;
/**
* 对账公司
*/
private
String
reconciliationCompany
;
/**
* 对账公司编码
*/
private
String
reconciliationCompanyCode
;
/**
* 对账公司业务id
*/
private
String
reconciliationCompanyBizId
;
/**
* 新单跟进状态
*/
private
String
status
;
/**
* 下一步跟进状态列表
*/
private
String
nextStatusList
;
/**
* 保單持有人
*/
private
String
policyHolder
;
/**
* 受保人
*/
private
String
insured
;
/**
* 受保人业务id
*/
private
String
insuredBizId
;
/**
* 受保人年龄
*/
private
Integer
insuredAge
;
/**
* 宽限期
*/
private
Integer
gracePeriod
;
/**
* 是否参加递增保障权益: 0-否, 1-是(字典)
*/
private
Integer
isJoin
;
/**
* 保单币种
*/
private
String
policyCurrency
;
/**
* 首期付款方式(字典)
*/
private
String
initialPaymentMethod
;
/**
* 首期保费(不含徽费,预缴保费)
*/
private
BigDecimal
initialPremium
;
/**
* 首期已缴保费
*/
private
BigDecimal
initialPremiumPaid
;
/**
* 首期待缴保费
*/
private
BigDecimal
initialPremiumDue
;
/**
* 首期缴费总额
*/
private
BigDecimal
initialPremiumTotal
;
/**
* 首期缴费状态
*/
private
String
initialPaymentStatus
;
/**
* 首期保费优惠金额
*/
private
BigDecimal
initialPremiumDiscount
;
/**
* 寄送方式 字典值:1-自提 2-快递
*/
private
String
mailingMethod
;
/**
* 续期付款方式(字典)
*/
private
String
renewalPaymentMethod
;
/**
* 红利方式(字典)
*/
private
String
dividendDistributionMethod
;
/**
* 快递单号
*/
private
String
deliveryNo
;
/**
* 专业投资者: Yes/No
*/
private
String
professionalInvestor
;
/**
* 邮寄物品
*/
private
String
mailingItem
;
/**
* 保单征费
*/
private
String
policyLevy
;
/**
* 最晚缴费日期
*/
private
Date
latestPaymentDate
;
/**
* 经纪公司签收日期
*/
private
Date
brokerSignDate
;
/**
* 保险公司寄出日期
*/
private
Date
insurerMailingDate
;
/**
* 客户签收日期
*/
private
Date
customerSignDate
;
/**
* 附件地址列表 逗号隔开
*/
private
String
attachments
;
/**
* 通用备注
*/
private
String
remark
;
/**
* 删除标识: 0-正常, 1-删除
*/
private
Integer
isDeleted
;
/**
* 创建人ID
*/
private
String
creatorId
;
/**
* 更新人ID
*/
private
String
updaterId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 保单类型: 1-电子, 2-纸质
*/
private
String
policyType
;
}
yd-csf-feign/src/main/java/com/yd/csf/feign/response/premiumreconciliation/ApiPremiumReconciliationPageResponse.java
View file @
a574728d
...
...
@@ -85,16 +85,26 @@ public class ApiPremiumReconciliationPageResponse {
private
String
payingBank
;
/**
* 保單持有人(投保人,保单表)
* 保單持有人(投保人,保单表)
(中文名)
*/
private
String
policyHolder
;
/**
* 受保人(保单表)
* 保單持有人(投保人,保单表)(英文名)
*/
private
String
policyHolderEn
;
/**
* 受保人(保单表)(中文名)
*/
private
String
insured
;
/**
* 受保人(保单表)(英文名)
*/
private
String
insuredEn
;
/**
* 转介人名称(保单转介人表,多个分号分隔)
*/
private
String
brokerName
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/config/CsfMybatisPlusConfig.java
View file @
a574728d
...
...
@@ -51,7 +51,7 @@ public class CsfMybatisPlusConfig {
if
(
authUserDto
!=
null
)
{
//自动注入创建人和创建用户名
this
.
strictInsertFill
(
metaObject
,
"creatorId"
,
String
.
class
,
authUserDto
.
getUserBizId
());
this
.
strictInsertFill
(
metaObject
,
"creatorName"
,
String
.
class
,
authUserDto
.
get
Usern
ame
());
this
.
strictInsertFill
(
metaObject
,
"creatorName"
,
String
.
class
,
authUserDto
.
get
RealN
ame
());
}
}
...
...
@@ -68,7 +68,7 @@ public class CsfMybatisPlusConfig {
if
(
authUserDto
!=
null
)
{
//自动注入更新人和更新用户名
this
.
strictUpdateFill
(
metaObject
,
"updaterId"
,
String
.
class
,
authUserDto
.
getUserBizId
());
this
.
strictUpdateFill
(
metaObject
,
"updaterName"
,
String
.
class
,
authUserDto
.
get
Usern
ame
());
this
.
strictUpdateFill
(
metaObject
,
"updaterName"
,
String
.
class
,
authUserDto
.
get
RealN
ame
());
}
}
};
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dao/PolicyFollowMapper.java
View file @
a574728d
...
...
@@ -5,6 +5,8 @@ import com.yd.csf.service.dto.PolicyReportData;
import
com.yd.csf.service.model.PolicyFollow
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author Zhang Jianan
* @description 针对表【policy_follow(新单跟进表)】的数据库操作Mapper
...
...
@@ -14,6 +16,15 @@ import org.apache.ibatis.annotations.Param;
public
interface
PolicyFollowMapper
extends
BaseMapper
<
PolicyFollow
>
{
PolicyReportData
queryPolicyReportData
(
@Param
(
"policyBizId"
)
String
policyBizId
);
List
<
String
>
queryPolicyNoList
(
@Param
(
"policyHolderSc"
)
String
policyHolderSc
,
@Param
(
"policyHolderEnLc"
)
String
policyHolderEnLc
,
@Param
(
"signer"
)
String
signer
,
@Param
(
"brokerName"
)
String
brokerName
,
@Param
(
"insuredSc"
)
String
insuredSc
,
@Param
(
"insuredEnLc"
)
String
insuredEnLc
);
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedAddDto.java
View file @
a574728d
...
...
@@ -94,6 +94,12 @@ public class CommissionExpectedAddDto {
private
BigDecimal
amount
;
/**
* 结算汇率
*/
@Schema
(
description
=
"结算汇率"
)
private
BigDecimal
exchangeRate
;
/**
* 入账日 (估)
*/
@Schema
(
description
=
"入账日 (估) format:yyyy-MM-dd"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedQueryRequest.java
View file @
a574728d
...
...
@@ -81,4 +81,28 @@ public class CommissionExpectedQueryRequest extends PageDto {
*/
@Schema
(
description
=
"转介人所属团队业务ID"
)
private
String
teamBizId
;
/**
* 保單持有人(中/英、繁简/大小写)
*/
private
String
policyHolder
;
/**
* 受保人(中/英、繁简/大小写)
*/
@Schema
(
description
=
"受保人"
)
private
String
insured
;
/**
* 签单人
*/
private
String
signer
;
/**
* 转介人名称(主)
*/
private
String
brokerName
;
private
List
<
String
>
policyNoList
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/CustomerQueryRequest.java
View file @
a574728d
...
...
@@ -18,7 +18,7 @@ public class CustomerQueryRequest extends PageDto implements Serializable {
/**
* 客户名称
*/
@Schema
(
description
=
"客户名称"
)
@Schema
(
description
=
"客户名称
(中文/英文,繁简/大小写)
"
)
private
String
name
;
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/EditActualPayoutDateRequest.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
@Data
public
class
EditActualPayoutDateRequest
{
@Schema
(
description
=
"出账业务ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
fortuneBizId
;
@Schema
(
description
=
"实际出账年月(实)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
actualPayoutDate
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/EditExchangeRateRequest.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Data
public
class
EditExchangeRateRequest
{
@Schema
(
description
=
"fortuneBizId"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
fortuneBizId
;
/**
* 保单币种金额
*/
@Schema
(
description
=
"保单币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
ruleAmount
;
/**
* 保单币种
*/
@Schema
(
description
=
"保单币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
ruleCurrency
;
/**
* 保单币种→港币汇率(入账检核汇率)
*/
@Schema
(
description
=
"保单币种→港币汇率(入账检核汇率)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
exchangeRate
;
/**
* 原币种
*/
@Schema
(
description
=
"原币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
originalCurrency
;
/**
* 原币种金额
*/
@Schema
(
description
=
"原币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalAmount
;
/**
* 原币种→港币汇率
*/
@Schema
(
description
=
"原币种→港币汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalToHkdRate
;
/**
* 发放币种
*/
@Schema
(
description
=
"发放币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
payoutCurrency
;
/**
* 发放币种金额
*/
@Schema
(
description
=
"发放币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
payoutAmount
;
/**
* 港币→发放币种汇率
*/
@Schema
(
description
=
"港币→发放币种汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdToPayoutRate
;
/**
* 港币金额
*/
@Schema
(
description
=
"港币金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdAmount
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/FnaQueryRequest.java
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
dto
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yd.common.dto.PageDto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
...
...
@@ -69,6 +71,12 @@ public class FnaQueryRequest extends PageDto implements Serializable {
private
String
policyBizId
;
/**
* 创建人名称
*/
@Schema
(
description
=
"创建人名称"
)
private
String
creatorName
;
/**
* 保单号
*/
@Schema
(
description
=
"保单号"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAccountExportDTO.java
View file @
a574728d
...
...
@@ -6,6 +6,7 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -32,6 +33,8 @@ public class FortuneAccountExportDTO implements Serializable {
private
List
<
Fortune
>
fortuneList
;
private
LocalDate
actualPayoutDate
;
// 动态字段,用于存储不同的fortune项目
private
Map
<
String
,
BigDecimal
>
fortuneAmounts
=
new
HashMap
<>();
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAddRequest.java
View file @
a574728d
...
...
@@ -83,16 +83,64 @@ public class FortuneAddRequest implements Serializable {
private
String
fortuneType
;
/**
*
出账
金额
*
保单币种
金额
*/
@Schema
(
description
=
"
出账
金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
a
mount
;
@Schema
(
description
=
"
保单币种
金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
ruleA
mount
;
/**
*
出账
币种
*
保单
币种
*/
@Schema
(
description
=
"出账币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
currency
;
@Schema
(
description
=
"保单币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
ruleCurrency
;
/**
* 保单币种→港币汇率(入账检核汇率)
*/
@Schema
(
description
=
"保单币种→港币汇率(入账检核汇率)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
exchangeRate
;
/**
* 原币种
*/
@Schema
(
description
=
"原币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
originalCurrency
;
/**
* 原币种金额
*/
@Schema
(
description
=
"原币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalAmount
;
/**
* 原币种→港币汇率
*/
@Schema
(
description
=
"原币种→港币汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalToHkdRate
;
/**
* 发放币种
*/
@Schema
(
description
=
"发放币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
payoutCurrency
;
/**
* 发放币种金额
*/
@Schema
(
description
=
"发放币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
payoutAmount
;
/**
* 港币→发放币种汇率
*/
@Schema
(
description
=
"港币→发放币种汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdToPayoutRate
;
/**
* 港币金额
*/
@Schema
(
description
=
"港币金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdAmount
;
/**
* 出账日期
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneDownloadRequest.java
View file @
a574728d
...
...
@@ -10,4 +10,7 @@ public class FortuneDownloadRequest {
@Schema
(
description
=
"发佣数据业务Id列表"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
List
<
String
>
fortuneBizIdList
;
@Schema
(
description
=
"出账年月(实),格式:yyyy-MM,例如:2026-04"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
actualPayoutDate
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneSplitDto.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Data
public
class
FortuneSplitDto
{
/**
* 出账比例
*/
@Schema
(
description
=
"出账比例"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
splitRatio
;
/**
* 保单币种金额
*/
@Schema
(
description
=
"保单币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
ruleAmount
;
/**
* 保单币种
*/
@Schema
(
description
=
"保单币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
ruleCurrency
;
/**
* 保单币种→港币汇率(入账检核汇率)
*/
@Schema
(
description
=
"保单币种→港币汇率(入账检核汇率)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
exchangeRate
;
/**
* 原币种
*/
@Schema
(
description
=
"原币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
originalCurrency
;
/**
* 原币种金额
*/
@Schema
(
description
=
"原币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalAmount
;
/**
* 原币种→港币汇率
*/
@Schema
(
description
=
"原币种→港币汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalToHkdRate
;
/**
* 发放币种
*/
@Schema
(
description
=
"发放币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
payoutCurrency
;
/**
* 发放币种金额
*/
@Schema
(
description
=
"发放币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
payoutAmount
;
/**
* 港币→发放币种汇率
*/
@Schema
(
description
=
"港币→发放币种汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdToPayoutRate
;
/**
* 港币金额
*/
@Schema
(
description
=
"港币金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdAmount
;
/**
* 出账年月(估)
*/
@Schema
(
description
=
"出账年月(估)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
payoutYearMonth
;
/**
* 备注
*/
@Schema
(
description
=
"备注"
)
private
String
remark
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneSplitRequest.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
FortuneSplitRequest
implements
Serializable
{
/**
* 保单出账业务id
*/
@Schema
(
description
=
"保单出账业务id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
fortuneBizId
;
/**
* 分期出账列表
*/
@Schema
(
description
=
"分期出账列表"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
List
<
FortuneSplitDto
>
fortuneSplitDtoList
;
private
static
final
long
serialVersionUID
=
1L
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/PolicyFollowDto.java
View file @
a574728d
...
...
@@ -164,10 +164,10 @@ public class PolicyFollowDto implements Serializable {
@Schema
(
description
=
"下一步跟进状态列表"
)
private
String
nextStatusList
;
@Schema
(
description
=
"保單持有人"
)
@Schema
(
description
=
"保單持有人
(中文)
"
)
private
String
policyHolder
;
@Schema
(
description
=
"受保人"
)
@Schema
(
description
=
"受保人
(中文)
"
)
private
String
insured
;
@Schema
(
description
=
"受保人业务id"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/PolicyFollowQueryRequest.java
View file @
a574728d
...
...
@@ -85,5 +85,26 @@ public class PolicyFollowQueryRequest extends PageDto implements Serializable {
@Schema
(
description
=
"缴费年期"
)
private
Integer
issueNumber
;
/**
* 保單持有人(中(繁/简)/英文(大小写))
*/
private
String
policyHolder
;
/**
* 受保人(中(繁/简)/英文(大小写))
*/
private
String
insured
;
/**
* 签单人
*/
private
String
signer
;
/**
* 转介人名称
*/
private
String
brokerName
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
yd-csf-service/src/main/java/com/yd/csf/service/dto/QueryCommissionExchangeRateRequest.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
@Data
public
class
QueryCommissionExchangeRateRequest
{
@Schema
(
description
=
"保单号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
policyNo
;
@Schema
(
description
=
"佣金期数"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
Integer
commissionPeriod
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/QueryPolicyBrokerDto.java
View file @
a574728d
...
...
@@ -27,4 +27,9 @@ public class QueryPolicyBrokerDto {
* 转介人业务ID(客户端用户表唯一业务ID)
*/
private
String
brokerBizId
;
/**
* 转介人名称
*/
private
String
brokerName
;
}
yd-csf-service/src/main/java/com/yd/csf/service/model/Customer.java
View file @
a574728d
...
...
@@ -34,11 +34,21 @@ public class Customer implements Serializable {
private
String
nameCn
;
/**
* 姓名-中文(简体)
*/
private
String
nameSc
;
/**
* 姓名-(拼音/英文,通过中文自动加载全部大写的拼音)
*/
private
String
namePyEn
;
/**
* 姓名-英文(大小写)
*/
private
String
nameEnLc
;
/**
* 证件类型(字典,下拉选择)
*/
private
String
documentType
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
View file @
a574728d
...
...
@@ -43,6 +43,12 @@ public class ExpectedFortune implements Serializable {
private
String
fortuneBizType
;
/**
* 是否拆分出来的出账 1-是 0-否 2-拆分的原纪录
*/
@TableField
(
"is_part"
)
private
Integer
isPart
;
/**
* 应付款编号
*/
@TableField
(
"payable_no"
)
...
...
@@ -144,17 +150,18 @@ public class ExpectedFortune implements Serializable {
@TableField
(
"standard_amount"
)
private
BigDecimal
standardAmount
;
// ========== 保单币种及金额(基本法币种) ==========
/**
*
实际发佣金额(实际发佣
金额 = 标准发佣金额 * 转介人介绍费占比)
*
保单币种金额(保单币种
金额 = 标准发佣金额 * 转介人介绍费占比)
*/
@TableField
(
"amount"
)
private
BigDecimal
a
mount
;
@TableField
(
"
rule_
amount"
)
private
BigDecimal
ruleA
mount
;
/**
*
发佣
币种
*
保单
币种
*/
@TableField
(
"currency"
)
private
String
c
urrency
;
@TableField
(
"
rule_
currency"
)
private
String
ruleC
urrency
;
/**
* 出账状态 0=待出账 1=可出帐 2=可出帐,待检核 3=部分出账 4=保留 5=已失效 6=可出账, 已检核 7=未找到当前预计发佣对应的来佣 字典值: csf_expected_fortune_status
...
...
@@ -169,12 +176,6 @@ public class ExpectedFortune implements Serializable {
private
String
statusDesc
;
/**
* 本次出账金额
*/
// @TableField("current_payment_amount")
// private BigDecimal currentPaymentAmount;
/**
* 预计出账日期
*/
@TableField
(
"payout_date"
)
...
...
@@ -187,11 +188,30 @@ public class ExpectedFortune implements Serializable {
private
LocalDate
actualPayoutDate
;
/**
* 默认
结算
汇率
* 默认
保单币种
汇率
*/
@TableField
(
"default_exchange_rate"
)
private
BigDecimal
defaultExchangeRate
;
// ========== 原币种及金额 ==========
@TableField
(
"original_currency"
)
private
String
originalCurrency
;
// 原币种
@TableField
(
"original_amount"
)
private
BigDecimal
originalAmount
;
// 原币种金额
@TableField
(
"original_to_hkd_rate"
)
private
BigDecimal
originalToHkdRate
;
// 原币→港币汇率
// ========== 发放币种及金额 ==========
@TableField
(
"payout_currency"
)
private
String
payoutCurrency
;
// 发放币种
@TableField
(
"payout_amount"
)
private
BigDecimal
payoutAmount
;
// 发放币种金额
@TableField
(
"hkd_to_payout_rate"
)
private
BigDecimal
hkdToPayoutRate
;
// 港币→发放币汇率
/**
* 港币预计出账金额
*/
...
...
@@ -261,10 +281,16 @@ public class ExpectedFortune implements Serializable {
/**
* 创建人ID
*/
@TableField
(
value
=
"creator_id"
,
fill
=
FieldFill
.
INSERT
)
@TableField
(
value
=
"creator_id"
)
private
String
creatorId
;
/**
* 创建人名称
*/
@TableField
(
value
=
"creator_name"
)
private
String
creatorName
;
/**
* 更新人ID
*/
@TableField
(
value
=
"updater_id"
,
fill
=
FieldFill
.
UPDATE
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/Fna.java
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -129,11 +126,23 @@ public class Fna implements Serializable {
private
String
creatorId
;
/**
* 创建人名称
*/
@TableField
(
value
=
"creator_name"
,
fill
=
FieldFill
.
INSERT
)
private
String
creatorName
;
/**
* 更新人ID
*/
private
String
updaterId
;
/**
* 更新人名称
*/
@TableField
(
value
=
"updater_name"
,
fill
=
FieldFill
.
UPDATE
)
private
String
updaterName
;
/**
* 创建时间
*/
private
Date
createTime
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/Fortune.java
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 保单
出账
表
* 保单
发佣
表
*
* @TableName fortune
*/
@TableName
(
value
=
"fortune"
)
@Data
public
class
Fortune
implements
Serializable
{
public
class
Fortune
{
/**
* serial id
*/
...
...
@@ -28,7 +28,12 @@ public class Fortune implements Serializable {
private
String
expectedFortuneBizId
;
/**
* 检核年月
* 应付账款编号
*/
private
String
payableNo
;
/**
* 检核年月 yyyy-MM
*/
private
String
reconciliationYearMonth
;
...
...
@@ -38,22 +43,22 @@ public class Fortune implements Serializable {
private
String
fortuneBizType
;
/**
* 是否
部分出账拆分出来的出账记录 0=No, 1=Yes
* 是否
拆分出来的出账 1-是 0-否 2-拆分的原纪录
*/
private
Integer
isPart
;
/**
* 保单
出账
批次ID
* 保单
发佣
批次ID
*/
private
String
batchBizId
;
/**
* 保单
出账
业务id
* 保单
发佣
业务id
*/
private
String
fortuneBizId
;
/**
*
来佣保单
业务id
*
保单来佣
业务id
*/
private
String
commissionBizId
;
...
...
@@ -73,12 +78,12 @@ public class Fortune implements Serializable {
private
String
policyCurrency
;
/**
*
出账
期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
*
发佣
期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
*/
private
Integer
fortunePeriod
;
/**
*
出账
总期数
*
发佣
总期数
*/
private
Integer
fortuneTotalPeriod
;
...
...
@@ -118,26 +123,56 @@ public class Fortune implements Serializable {
private
String
fortuneName
;
/**
*
出账
类型
*
发佣
类型
*/
private
String
fortuneType
;
/**
*
出账
金额
*
保单币种
金额
*/
private
BigDecimal
a
mount
;
private
BigDecimal
ruleA
mount
;
/**
*
出账
币种
*
保单
币种
*/
private
String
c
urrency
;
private
String
ruleC
urrency
;
/**
*
结算汇率
*
保单币种→港币汇率(入账检核汇率)
*/
private
BigDecimal
exchangeRate
;
/**
* 原币种
*/
private
String
originalCurrency
;
/**
* 原币种金额
*/
private
BigDecimal
originalAmount
;
/**
* 原币种→港币汇率
*/
private
BigDecimal
originalToHkdRate
;
/**
* 发放币种
*/
private
String
payoutCurrency
;
/**
* 发放币种金额
*/
private
BigDecimal
payoutAmount
;
/**
* 港币→发放币种汇率
*/
private
BigDecimal
hkdToPayoutRate
;
/**
* 港币金额
*/
private
BigDecimal
hkdAmount
;
...
...
@@ -153,7 +188,7 @@ public class Fortune implements Serializable {
private
BigDecimal
currentPaymentHkdAmount
;
/**
* 本
期
出账比例
* 本
次
出账比例
*/
private
BigDecimal
currentPaymentRatio
;
...
...
@@ -173,12 +208,12 @@ public class Fortune implements Serializable {
private
LocalDate
actualPayoutDate
;
/**
* 检核人
* 检核人
员
*/
private
String
reconciliationOperator
;
/**
* 出账
数据
业务ID
* 出账
记录
业务ID
*/
private
String
fortuneAccountBizId
;
...
...
@@ -193,7 +228,7 @@ public class Fortune implements Serializable {
private
BigDecimal
taxAmount
;
/**
* 税后
出账
* 税后
发佣
*/
private
BigDecimal
netAmount
;
...
...
@@ -253,6 +288,4 @@ public class Fortune implements Serializable {
*/
private
Date
updateTime
;
@TableField
(
exist
=
false
)
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
yd-csf-service/src/main/java/com/yd/csf/service/model/FortuneAccount.java
View file @
a574728d
...
...
@@ -28,6 +28,12 @@ public class FortuneAccount implements Serializable {
private
String
fortuneAccountBizId
;
/**
* 出账业务编号(出账年月 + 转介人内部编号(后6位)(如无,用0补齐)+流水号(6位))
*/
@TableField
(
"business_no"
)
private
String
businessNo
;
/**
* 转介人
*/
private
String
broker
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyInsurant.java
View file @
a574728d
...
...
@@ -64,11 +64,21 @@ public class PolicyInsurant implements Serializable {
private
String
name
;
/**
* 名字-简体(入库名字统一转换简体,方便查询)
*/
private
String
nameSc
;
/**
* 名字-英文
*/
private
String
nameEn
;
/**
* 名字-英文-小写(入库名字英文统一转换小写,方便查询)
*/
private
String
nameEnLc
;
/**
* 性别(字典)
*/
private
String
gender
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyPolicyholder.java
View file @
a574728d
...
...
@@ -59,11 +59,21 @@ public class PolicyPolicyholder implements Serializable {
private
String
name
;
/**
* 名字-简体(入库名字统一转换简体,方便查询)
*/
private
String
nameSc
;
/**
* 名字-英文
*/
private
String
nameEn
;
/**
* 名字-英文-小写(入库名字英文统一转换小写,方便查询)
*/
private
String
nameEnLc
;
/**
* 性别(字典)
*/
private
String
gender
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
View file @
a574728d
...
...
@@ -10,9 +10,7 @@ import com.yd.csf.service.dto.CommissionExpectedUpdateRequest;
import
com.yd.csf.service.model.CommissionExpected
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.vo.CommissionExpectedStatisticsVO
;
import
com.yd.csf.service.vo.CommissionExpectedVO
;
import
com.yd.csf.service.vo.ReceivableReportVO
;
import
com.yd.csf.service.vo.*
;
import
com.yd.product.feign.response.expectedspecies.ApiExpectedSpeciesListResponse
;
import
java.io.IOException
;
...
...
@@ -27,6 +25,8 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
Page
<
CommissionExpectedVO
>
getCommissionExpectedVOPage
(
Page
<
CommissionExpected
>
commissionExpectedPage
);
Page
<
CommissionExpectedNewVO
>
getCommissionExpectedVONewPage
(
CommissionExpectedQueryRequest
request
,
List
<
CommissionExpected
>
allExpectedList
);
/**
* 校验数据
*
...
...
@@ -59,6 +59,8 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
CommissionExpectedStatisticsVO
getExpectedStatistics
(
List
<
Long
>
expectedIds
);
CommissionExpectedStatisticsVO
getExpectedStatisticsNew
(
List
<
Long
>
expectedIds
);
CommissionExpected
getByBizId
(
String
commissionExpectedBizId
);
void
getExpectedCommissionByProductlaunchId
(
Policy
policy
,
String
productLaunchBizId
,
String
insuranceCompanyBizId
,
String
reconciliationCompany
,
String
reconciliationCompanyCode
,
String
reconciliationCompanyBizId
,
String
professionalInvestor
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionService.java
View file @
a574728d
...
...
@@ -11,6 +11,7 @@ import com.yd.csf.service.model.CommissionExpected;
import
com.yd.csf.service.vo.CommissionStatisticsVO
;
import
com.yd.csf.service.vo.CommissionVO
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
...
...
@@ -59,4 +60,13 @@ public interface CommissionService extends IService<Commission> {
boolean
deleteByIdPhysical
(
Long
id
);
Boolean
deleteCommission
(
Commission
oldCommission
);
/**
* 根据保单号和期数查询入账记录的结算汇率
*
* @param policyNo 保单号
* @param commissionPeriod 佣金期数
* @return 结算汇率
*/
BigDecimal
queryCommissionExchangeRate
(
String
policyNo
,
Integer
commissionPeriod
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneAccountService.java
View file @
a574728d
...
...
@@ -7,6 +7,7 @@ import com.yd.csf.service.model.FortuneAccount;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yd.csf.service.vo.FortuneAccountVO
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -21,7 +22,7 @@ public interface FortuneAccountService extends IService<FortuneAccount> {
Page
<
FortuneAccountVO
>
getFortuneAccountVOPage
(
Page
<
FortuneAccount
>
fortunePage
);
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
);
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
,
LocalDate
actualPayoutDate
);
FortuneAccount
getByFortuneAccountBizId
(
String
fortuneAccountBizId
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneService.java
View file @
a574728d
...
...
@@ -40,4 +40,11 @@ public interface FortuneService extends IService<Fortune> {
FortuneStatisticsVO
getFortuneStatistics
(
List
<
Long
>
fortuneIdList
);
Boolean
addFortuneBatch
(
List
<
FortuneAddRequest
>
fortuneAddRequestList
);
Boolean
splitFortune
(
FortuneSplitRequest
fortuneSplitRequest
);
Boolean
editActualPayoutDate
(
EditActualPayoutDateRequest
editActualPayoutDateRequest
);
Boolean
editExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
View file @
a574728d
...
...
@@ -45,4 +45,15 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
IPage
<
PayableReportVO
>
payableReportPage
(
Page
<
PayableReportVO
>
page
,
List
<
Long
>
expectedFortuneIds
);
void
updateBatchByBizId
(
List
<
String
>
expectedFortuneBizIdList
,
String
status
);
ExpectedFortune
getByBizId
(
String
expectedFortuneBizId
);
Integer
getPayableNoCurrentSeq
();
/**
* 生成应付款编号(序号递增) 格式:发佣类型-CSF+年份+序号
* @param fortuneType 发佣类型
* @return 应付款编号
*/
String
getPayableNo
(
String
fortuneType
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyBrokerService.java
View file @
a574728d
...
...
@@ -5,6 +5,7 @@ import com.yd.csf.service.model.PolicyBroker;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Zhang Jianan
...
...
@@ -20,4 +21,7 @@ public interface PolicyBrokerService extends IService<PolicyBroker> {
void
removeByPolicyBizId
(
String
policyBizId
);
List
<
String
>
selectRelatedBrokerBizIds
(
String
clientUserId
);
Map
<
String
,
String
>
queryInternalCodeMap
(
List
<
String
>
brokerBizIdList
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyFollowService.java
View file @
a574728d
...
...
@@ -3,6 +3,8 @@ package com.yd.csf.service.service;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yd.common.result.Result
;
import
com.yd.csf.feign.response.policyfollow.ApiPolicyFollowDetailResponse
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.enums.PolicyFollowStatusEnum
;
import
com.yd.csf.service.model.*
;
...
...
@@ -179,4 +181,10 @@ public interface PolicyFollowService extends IService<PolicyFollow> {
* @return 是否成功
*/
Boolean
updatePolicySecondHolder
(
PolicySecondHolderUpdateRequest
policySecondHolderUpdateRequest
);
Result
<
ApiPolicyFollowDetailResponse
>
detail
(
String
policyNo
);
List
<
String
>
queryPolicyNoList
(
String
policyHolder
,
String
signer
,
String
brokerName
,
String
insured
);
Result
updateTs
();
}
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyInsurantService.java
View file @
a574728d
...
...
@@ -3,6 +3,9 @@ package com.yd.csf.service.service;
import
com.yd.csf.service.dto.PolicyInsurantUpdateRequest
;
import
com.yd.csf.service.model.PolicyInsurant
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
java.util.List
;
/**
* @author Zhang Jianan
...
...
@@ -18,4 +21,8 @@ public interface PolicyInsurantService extends IService<PolicyInsurant> {
*/
boolean
update
(
PolicyInsurantUpdateRequest
policyInsurantUpdateRequest
);
List
<
PolicyInsurant
>
queryList
(
String
policyHolder
);
boolean
updateName
(
String
policyBizId
,
String
name
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyPolicyholderService.java
View file @
a574728d
...
...
@@ -4,6 +4,8 @@ import com.yd.csf.service.dto.PolicyPolicyholderUpdateRequest;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
/**
* @author Zhang Jianan
* @description 针对表【policy_policyholder(保单投保人信息表)】的数据库操作Service
...
...
@@ -19,4 +21,8 @@ public interface PolicyPolicyholderService extends IService<PolicyPolicyholder>
boolean
update
(
PolicyPolicyholderUpdateRequest
policyPolicyholderUpdateRequest
);
PolicyPolicyholder
queryOne
(
String
policyBizId
);
List
<
PolicyPolicyholder
>
queryList
(
String
policyHolder
);
boolean
updateName
(
String
policyBizId
,
String
name
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
View file @
a574728d
...
...
@@ -30,9 +30,7 @@ import com.yd.csf.service.service.*;
import
com.yd.csf.service.dao.CommissionExpectedMapper
;
import
com.yd.csf.service.model.SpeciesCondition
;
import
com.yd.csf.service.helper.SpeciesConditionMatcher
;
import
com.yd.csf.service.vo.CommissionExpectedStatisticsVO
;
import
com.yd.csf.service.vo.CommissionExpectedVO
;
import
com.yd.csf.service.vo.ReceivableReportVO
;
import
com.yd.csf.service.vo.*
;
import
com.yd.insurance.base.feign.client.insurancereconciliationcompany.ApiInsuranceReconciliationCompanyFeignClient
;
import
com.yd.insurance.base.feign.request.insurancereconciliationcompany.ApiInsuranceReconciliationCompanyPageRequest
;
import
com.yd.insurance.base.feign.response.insurancereconciliationcompany.ApiInsuranceReconciliationCompanyPageResponse
;
...
...
@@ -149,6 +147,315 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
return
CommissionExpectedVOPage
;
}
/**
* 应收款管理列表查询
* @param request
* @param allExpectedList
* @return
*/
@Override
public
Page
<
CommissionExpectedNewVO
>
getCommissionExpectedVONewPage
(
CommissionExpectedQueryRequest
request
,
List
<
CommissionExpected
>
allExpectedList
)
{
if
(
CollUtil
.
isEmpty
(
allExpectedList
))
{
return
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
(),
0
);
}
// 批量查询实际佣金记录(按预计来佣业务ID分组)
List
<
String
>
expectedBizIdList
=
allExpectedList
.
stream
()
.
map
(
CommissionExpected:
:
getCommissionExpectedBizId
)
.
collect
(
Collectors
.
toList
());
List
<
Commission
>
allCommissions
=
commissionService
.
lambdaQuery
()
.
in
(
Commission:
:
getCommissionExpectedBizId
,
expectedBizIdList
)
.
orderByAsc
(
Commission:
:
getCreateTime
)
.
list
();
Map
<
String
,
List
<
Commission
>>
commissionMap
=
allCommissions
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
Commission:
:
getCommissionExpectedBizId
));
// 批量查询保单信息(Policy 和 PolicyFollow)
Set
<
String
>
policyNoSet
=
allExpectedList
.
stream
()
.
map
(
CommissionExpected:
:
getPolicyNo
)
.
collect
(
Collectors
.
toSet
());
allCommissions
.
forEach
(
c
->
policyNoSet
.
add
(
c
.
getPolicyNo
()));
policyNoSet
.
remove
(
null
);
Map
<
String
,
Policy
>
policyMap
=
new
HashMap
<>();
Map
<
String
,
PolicyFollow
>
policyFollowMap
=
new
HashMap
<>();
if
(
CollUtil
.
isNotEmpty
(
policyNoSet
))
{
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
()
.
in
(
Policy:
:
getPolicyNo
,
policyNoSet
)
.
list
();
policyMap
=
policyList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
List
<
PolicyFollow
>
policyFollowList
=
policyFollowService
.
lambdaQuery
()
.
in
(
PolicyFollow:
:
getPolicyNo
,
policyNoSet
)
.
list
();
policyFollowMap
=
policyFollowList
.
stream
()
.
collect
(
Collectors
.
toMap
(
PolicyFollow:
:
getPolicyNo
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
}
// 构建完整混合列表
List
<
CommissionExpectedNewVO
>
allMixedRecords
=
new
ArrayList
<>();
for
(
CommissionExpected
expected
:
allExpectedList
)
{
// 主记录
CommissionExpectedNewVO
mainVo
=
buildMainVo
(
expected
,
policyMap
,
policyFollowMap
);
allMixedRecords
.
add
(
mainVo
);
// 子记录
List
<
Commission
>
commissions
=
commissionMap
.
getOrDefault
(
expected
.
getCommissionExpectedBizId
(),
Collections
.
emptyList
());
int
subIndex
=
1
;
for
(
Commission
commission
:
commissions
)
{
CommissionExpectedNewVO
subVo
=
buildSubVo
(
commission
,
policyMap
,
policyFollowMap
,
mainVo
);
subVo
.
setNo
(
mainVo
.
getNo
()
+
"-"
+
subIndex
);
subVo
.
setType
(
2
);
allMixedRecords
.
add
(
subVo
);
subIndex
++;
}
}
// 手动分页
int
pageNo
=
(
int
)
request
.
getPageNo
();
int
pageSize
=
(
int
)
request
.
getPageSize
();
int
total
=
allMixedRecords
.
size
();
int
fromIndex
=
(
pageNo
-
1
)
*
pageSize
;
int
toIndex
=
Math
.
min
(
fromIndex
+
pageSize
,
total
);
List
<
CommissionExpectedNewVO
>
pageRecords
;
if
(
fromIndex
>=
total
)
{
pageRecords
=
Collections
.
emptyList
();
}
else
{
pageRecords
=
allMixedRecords
.
subList
(
fromIndex
,
toIndex
);
}
Page
<
CommissionExpectedNewVO
>
resultPage
=
new
Page
<>(
pageNo
,
pageSize
,
total
);
resultPage
.
setRecords
(
pageRecords
);
// 回填对账公司名称
enrichCommissionExpectedNewVOWithCompanyName
(
resultPage
);
return
resultPage
;
}
/**
* 构建主记录(预计来佣)
*/
private
CommissionExpectedNewVO
buildMainVo
(
CommissionExpected
expected
,
Map
<
String
,
Policy
>
policyMap
,
Map
<
String
,
PolicyFollow
>
policyFollowMap
)
{
CommissionExpectedNewVO
vo
=
new
CommissionExpectedNewVO
();
BeanUtils
.
copyProperties
(
expected
,
vo
);
// 入账年月(估):取预计来佣日期
vo
.
setCommissionDateMonth
(
expected
.
getCommissionDate
());
vo
.
setType
(
1
);
vo
.
setNo
(
StringUtils
.
isNotBlank
(
expected
.
getReceivableNo
())
?
expected
.
getReceivableNo
()
:
expected
.
getCommissionExpectedBizId
());
//入账年月实
vo
.
setCommissionDate
(
null
);
//本次入账比例
vo
.
setRevenueRatio
(
null
);
// 填充保单信息
Policy
policy
=
policyMap
.
get
(
expected
.
getPolicyNo
());
if
(
policy
!=
null
)
{
vo
.
setPremium
(
policy
.
getPaymentPremium
());
vo
.
setPolicyCurrency
(
policy
.
getCurrency
());
vo
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
vo
.
setReconciliationCompany
(
policy
.
getReconciliationCompany
());
}
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
expected
.
getPolicyNo
());
if
(
policyFollow
!=
null
)
{
vo
.
setProductName
(
policyFollow
.
getProductName
());
// vo.setProductLaunchBizId(policyFollow.getProductLaunchBizId());
}
// 累积数据
BigDecimal
paidAmount
=
ObjectUtils
.
defaultIfNull
(
expected
.
getPaidAmount
(),
BigDecimal
.
ZERO
);
BigDecimal
paidRatio
=
ObjectUtils
.
defaultIfNull
(
expected
.
getPaidRatio
(),
BigDecimal
.
ZERO
);
// vo.setPaidRatio(paidRatio);
// vo.setPaidAmount(paidAmount);
vo
.
setRealAmount
(
paidAmount
);
// 实收金额(累积)
vo
.
setExpectedAmount
(
expected
.
getExpectedAmount
());
vo
.
setIssueNumber
(
policyFollow
.
getIssueNumber
()
!=
null
?
Integer
.
parseInt
(
policyFollow
.
getIssueNumber
().
toString
())
:
null
);
// 产品来佣率
BigDecimal
commissionRatio
=
expected
.
getCommissionRatio
();
vo
.
setCommissionRatio
(
commissionRatio
);
if
(
commissionRatio
!=
null
&&
commissionRatio
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
// 实佣率 = paidRatio
vo
.
setRealRate
(
paidRatio
);
// 达成率缺口 = 1 - 总实佣率/产品来佣率
BigDecimal
gap
=
BigDecimal
.
ONE
.
subtract
(
paidRatio
.
divide
(
commissionRatio
,
4
,
RoundingMode
.
HALF_UP
)
);
// gap 可能为负,小于0时取0;然后转换为百分比数值(乘100,保留2位小数)
BigDecimal
gapRate
=
gap
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
?
BigDecimal
.
ZERO
:
gap
.
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
vo
.
setGapRate
(
gapRate
);
// 计算累积已入账比例 = 总实佣率/产品对应来佣率
BigDecimal
totalRevenueRatio
=
paidRatio
.
divide
(
commissionRatio
,
4
,
RoundingMode
.
HALF_UP
);
vo
.
setTotalRevenueRatio
(
totalRevenueRatio
.
multiply
(
BigDecimal
.
valueOf
(
100
))
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
}
else
{
vo
.
setRealRate
(
BigDecimal
.
ZERO
);
vo
.
setGapRate
(
BigDecimal
.
ZERO
);
// 当产品来佣率为零或 null 时,总入账比例无意义,设置为 0
vo
.
setTotalRevenueRatio
(
BigDecimal
.
ZERO
);
}
// 待入账金额
// 待入账金额归零 = 已入账来佣比例(实佣率)>= 产品来佣率
if
(
commissionRatio
!=
null
&&
paidRatio
.
compareTo
(
commissionRatio
)
>=
0
)
{
vo
.
setPendingAmount
(
BigDecimal
.
ZERO
);
// vo.setPendingRatio(BigDecimal.ZERO);
}
else
if
(
commissionRatio
!=
null
)
{
// vo.setPendingRatio(commissionRatio.subtract(paidRatio));
if
(
expected
.
getExpectedAmount
()
!=
null
)
{
//待入账金额 = 预计来佣金额 - 已入账来佣金额
vo
.
setPendingAmount
(
expected
.
getExpectedAmount
().
subtract
(
paidAmount
));
}
}
else
{
// 非关联类型
if
(
expected
.
getAmount
()
!=
null
)
{
BigDecimal
pending
=
expected
.
getAmount
().
subtract
(
paidAmount
);
vo
.
setPendingAmount
(
pending
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
?
BigDecimal
.
ZERO
:
pending
);
}
}
return
vo
;
}
/**
* 构建从记录(实际来佣)
*/
private
CommissionExpectedNewVO
buildSubVo
(
Commission
commission
,
Map
<
String
,
Policy
>
policyMap
,
Map
<
String
,
PolicyFollow
>
policyFollowMap
,
CommissionExpectedNewVO
mainVo
)
{
CommissionExpectedNewVO
vo
=
new
CommissionExpectedNewVO
();
// 从主记录复制公共字段(排除特有字段)
BeanUtils
.
copyProperties
(
mainVo
,
vo
,
"type"
,
"no"
,
"realReconciliationYearMonth"
,
"realCommissionDate"
,
"realExchangeRate"
,
"realAmount"
,
"realCurrentCommissionRatio"
,
"realUpdateTime"
,
"realUpdaterName"
,
"realRate"
,
"gapRate"
,
"revenueRatio"
,
"realRemark"
);
// 基本实际字段
vo
.
setRealReconciliationYearMonth
(
StringUtils
.
isNotBlank
(
commission
.
getReconciliationYearMonth
())
?
commission
.
getReconciliationYearMonth
().
replace
(
"-"
,
""
)
:
""
);
// vo.setRealCommissionDate(commission.getCommissionDate());
vo
.
setRealExchangeRate
(
commission
.
getExchangeRate
());
vo
.
setRealAmount
(
commission
.
getAmount
());
vo
.
setRealCurrentCommissionRatio
(
commission
.
getCurrentCommissionRatio
());
vo
.
setRealUpdateTime
(
commission
.
getUpdateTime
());
vo
.
setRealUpdaterName
(
commission
.
getUpdaterId
());
vo
.
setRealRemark
(
commission
.
getRemark
());
vo
.
setCommissionDate
(
commission
.
getCommissionDate
());
// 覆盖公共业务字段
// vo.setAmount(commission.getAmount());
// vo.setCommissionDate(commission.getCommissionDate());
vo
.
setCommissionPeriod
(
commission
.
getCommissionPeriod
());
vo
.
setCommissionName
(
commission
.
getCommissionName
());
// vo.setCommissionType(commission.getCommissionType());
// vo.setCurrency(commission.getCurrency());
// vo.setRemark(commission.getRemark());
vo
.
setPolicyNo
(
commission
.
getPolicyNo
());
// 重新获取保单信息
Policy
policy
=
policyMap
.
get
(
commission
.
getPolicyNo
());
if
(
policy
!=
null
)
{
vo
.
setPremium
(
policy
.
getPaymentPremium
());
vo
.
setPolicyCurrency
(
policy
.
getCurrency
());
vo
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
vo
.
setReconciliationCompany
(
policy
.
getReconciliationCompany
());
}
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
commission
.
getPolicyNo
());
if
(
policyFollow
!=
null
)
{
vo
.
setProductName
(
policyFollow
.
getProductName
());
// vo.setProductLaunchBizId(policyFollow.getProductLaunchBizId());
}
// 计算比率字段
BigDecimal
currentRatio
=
commission
.
getCurrentCommissionRatio
();
// 本次实佣率
BigDecimal
productRatio
=
mainVo
.
getCommissionRatio
();
// 产品来佣率(从主记录来)
vo
.
setRealRate
(
currentRatio
);
// 实佣率(本次)
if
(
productRatio
!=
null
&&
productRatio
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
// 本次入账比例 = 本次实佣率 / 产品来佣率
BigDecimal
revenue
=
currentRatio
.
divide
(
productRatio
,
4
,
RoundingMode
.
HALF_UP
);
BigDecimal
revenueRatio
=
revenue
.
compareTo
(
BigDecimal
.
ONE
)
>
0
?
BigDecimal
.
ONE
:
revenue
;
vo
.
setRevenueRatio
(
revenueRatio
.
multiply
(
BigDecimal
.
valueOf
(
100
))
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
// 本次达成率缺口 = 1 - (实佣率(本次) / 产品来佣率)
BigDecimal
cumulativePaidRatio
=
currentRatio
!=
null
?
currentRatio
:
BigDecimal
.
ZERO
;
BigDecimal
gap
=
BigDecimal
.
ONE
.
subtract
(
cumulativePaidRatio
.
divide
(
productRatio
,
4
,
RoundingMode
.
HALF_UP
)
);
BigDecimal
gapRate
=
gap
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
?
BigDecimal
.
ZERO
:
gap
.
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
vo
.
setGapRate
(
gapRate
);
}
else
{
vo
.
setRevenueRatio
(
BigDecimal
.
ZERO
);
vo
.
setGapRate
(
BigDecimal
.
ZERO
);
}
return
vo
;
}
/**
* 为混合结果集回填对账公司名称(类似 enrichReceivableReportWithCompanyName)
*/
private
void
enrichCommissionExpectedNewVOWithCompanyName
(
Page
<
CommissionExpectedNewVO
>
page
)
{
if
(
page
==
null
||
CollectionUtils
.
isEmpty
(
page
.
getRecords
()))
{
return
;
}
// 收集所有非空的对账公司 bizId(去重)
List
<
String
>
bizIdList
=
page
.
getRecords
().
stream
()
.
map
(
CommissionExpectedNewVO:
:
getReconciliationCompanyBizId
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
bizIdList
.
isEmpty
())
{
return
;
}
// 调用 Feign 批量查询对账公司信息
ApiInsuranceReconciliationCompanyPageRequest
request
=
new
ApiInsuranceReconciliationCompanyPageRequest
();
request
.
setReconciliationCompanyBizIdList
(
bizIdList
);
request
.
setPageNo
(
1
);
request
.
setPageSize
(
bizIdList
.
size
());
Result
result
=
companyFeignClient
.
page
(
request
);
List
<
ApiInsuranceReconciliationCompanyPageResponse
>
companyList
=
extractCompanyListFromResult
(
result
);
if
(
companyList
.
isEmpty
())
{
return
;
}
// 构建 bizId -> name 映射
Map
<
String
,
String
>
nameMap
=
companyList
.
stream
()
.
filter
(
c
->
StringUtils
.
isNotBlank
(
c
.
getReconciliationCompanyBizId
()))
.
collect
(
Collectors
.
toMap
(
ApiInsuranceReconciliationCompanyPageResponse:
:
getReconciliationCompanyBizId
,
ApiInsuranceReconciliationCompanyPageResponse:
:
getName
,
(
v1
,
v2
)
->
v1
));
// 回填名称
page
.
getRecords
().
forEach
(
vo
->
{
if
(
StringUtils
.
isNotBlank
(
vo
.
getReconciliationCompanyBizId
()))
{
String
name
=
nameMap
.
get
(
vo
.
getReconciliationCompanyBizId
());
if
(
StringUtils
.
isNotBlank
(
name
))
{
vo
.
setReconciliationCompany
(
name
);
}
}
});
}
private
void
enrichReceivableReportWithCompanyName
(
IPage
<
CommissionExpectedVO
>
page
)
{
if
(
page
==
null
||
CollectionUtils
.
isEmpty
(
page
.
getRecords
()))
{
return
;
...
...
@@ -319,6 +626,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
queryWrapper
.
eq
(
ObjectUtils
.
isNotEmpty
(
productLaunchBizId
),
"product_launch_biz_id"
,
productLaunchBizId
);
queryWrapper
.
eq
(
ObjectUtils
.
isNotEmpty
(
commissionBizType
),
"commission_biz_type"
,
commissionBizType
);
queryWrapper
.
in
(
ObjectUtils
.
isNotEmpty
(
statusList
),
"status"
,
statusList
);
queryWrapper
.
in
(
CollectionUtils
.
isNotEmpty
(
commissionExpectedQueryRequest
.
getPolicyNoList
()),
"policy_no"
,
commissionExpectedQueryRequest
.
getPolicyNoList
());
// 范围查询
queryWrapper
.
ge
(
ObjectUtils
.
isNotEmpty
(
commissionDateStart
),
"commission_date"
,
commissionDateStart
);
queryWrapper
.
le
(
ObjectUtils
.
isNotEmpty
(
commissionDateEnd
),
"commission_date"
,
commissionDateEnd
);
...
...
@@ -420,7 +728,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
commissionExpected
.
setPremium
(
policy
.
getPaymentPremium
());
}
else
{
BigDecimal
expectedAmount
=
addDto
.
getAmount
()
.
multiply
(
commissionExpected
.
getDefaul
tExchangeRate
());
.
multiply
(
addDto
.
ge
tExchangeRate
());
commissionExpected
.
setExpectedAmount
(
expectedAmount
);
}
...
...
@@ -462,14 +770,18 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
if
(
StringUtils
.
isBlank
(
request
.
getCommissionType
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账项目类型不能为空"
);
}
// commissionType 只能是数字
if
(!
StringUtils
.
isNumeric
(
request
.
getCommissionType
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账项目类型只能是字典值"
);
}
// commissionName 不能为空
if
(
StringUtils
.
isBlank
(
request
.
getCommissionName
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账项目名称不能为空"
);
}
if
(
StringUtils
.
isBlank
(
request
.
getCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账币种不能为空"
);
}
if
(
request
.
getExchangeRate
()
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"结算汇率不能为空"
);
}
if
(
"R"
.
equals
(
request
.
getCommissionBizType
()))
{
if
(
request
.
getCommissionRatio
()
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"关联保单应收单,佣金比例不能为空"
);
...
...
@@ -597,6 +909,104 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
}
@Override
public
CommissionExpectedStatisticsVO
getExpectedStatisticsNew
(
List
<
Long
>
expectedIds
)
{
// 空集合直接返回空统计
if
(
CollectionUtils
.
isEmpty
(
expectedIds
))
{
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
()
.
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
.
setPendingPaidAmount
(
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
.
setTotalPolicyCount
(
policyNoSet
.
size
());
vo
.
setTotalPremium
(
totalPremium
);
vo
.
setFromTotalPremium
(
fromTotalPremium
);
vo
.
setPolicyNos
(
null
);
// 原字段可能用于其他逻辑,此处置空
return
vo
;
}
/**
* 返回空的统计对象
*/
private
CommissionExpectedStatisticsVO
emptyStatistics
()
{
CommissionExpectedStatisticsVO
vo
=
new
CommissionExpectedStatisticsVO
();
vo
.
setTotalAmount
(
BigDecimal
.
ZERO
);
vo
.
setTotalPaidAmount
(
BigDecimal
.
ZERO
);
vo
.
setPendingPaidAmount
(
BigDecimal
.
ZERO
);
vo
.
setPaidAmountRatio
(
BigDecimal
.
ZERO
);
vo
.
setTotalPolicyCount
(
0
);
vo
.
setTotalPremium
(
BigDecimal
.
ZERO
);
return
vo
;
}
@Override
public
CommissionExpected
getByBizId
(
String
commissionExpectedBizId
)
{
return
this
.
getOne
(
new
QueryWrapper
<
CommissionExpected
>().
eq
(
"commission_expected_biz_id"
,
commissionExpectedBizId
));
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
View file @
a574728d
...
...
@@ -235,7 +235,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
QueryWrapper
<
Policy
>
queryWrapper
=
new
QueryWrapper
<
Policy
>();
queryWrapper
.
in
(
"policy_no"
,
policyNoSet
);
queryWrapper
.
select
(
"policy_no"
,
"payment_premium"
,
"currency"
,
"policy_no"
,
"payment_premium"
,
"currency"
,
"product_launch_biz_id"
,
"product_name"
,
"insurance_company_biz_id"
,
"insurance_company"
,
"reconciliation_company"
,
"reconciliation_company_code"
,
"reconciliation_company_biz_id"
);
...
...
@@ -386,6 +386,9 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
if
(
commission
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"未找到该来佣记录"
);
}
if
(!
Objects
.
equals
(
commission
.
getPolicyNo
(),
commissionUpdateRequest
.
getPolicyNo
()))
{
throw
new
BusinessException
(
"当前保单号不匹配"
);
}
Policy
policy
=
null
;
if
(
StringUtils
.
isNotBlank
(
commissionUpdateRequest
.
getPolicyNo
()))
{
policy
=
policyService
.
lambdaQuery
().
eq
(
Policy:
:
getPolicyNo
,
commission
.
getPolicyNo
()).
one
();
...
...
@@ -642,11 +645,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
}
// 2.3 校验预计发佣记录是否有出账币种、默认结算汇率
for
(
ExpectedFortune
expectedFortune
:
filteredExpectedFortuneList2
)
{
if
(
StringUtils
.
isBlank
(
expectedFortune
.
getCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计发佣记录"
+
expectedFortune
.
getExpectedFortuneBizId
()
+
"未配置出账币种"
);
}
if
(
expectedFortune
.
getDefaultExchangeRate
()
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计发佣记录"
+
expectedFortune
.
getExpectedFortuneBizId
()
+
"未配置默认结算汇率"
);
if
(
StringUtils
.
isBlank
(
expectedFortune
.
getRuleCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计发佣记录"
+
expectedFortune
.
getExpectedFortuneBizId
()
+
"未配置保单币种"
);
}
}
...
...
@@ -699,9 +699,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
fortune
.
setId
(
null
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setExchangeRate
(
expectedFortune
.
getDefaultExchangeRate
());
fortune
.
setAmount
(
expectedFortune
.
getAmount
());
fortune
.
setHkdAmount
(
expectedFortune
.
getHkdAmount
());
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getAmount
());
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getOriginalAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
expectedFortune
.
getHkdAmount
());
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
...
...
@@ -728,6 +727,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
/**
* 保单币种对预计来佣的结算币种的默认汇率
*
* @param policyCurrency 保单币种
* @param currency 预计来佣的结算币种
* @return 汇率
...
...
@@ -849,7 +849,6 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
commission
.
setCommissionBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_COMMISSION
.
getCode
()));
// 关联业务id
if
(
"R"
.
equals
(
request
.
getCommissionBizType
()))
{
if
(
MapUtils
.
isNotEmpty
(
policyMap
))
{
Policy
policy
=
policyMap
.
get
(
request
.
getPolicyNo
());
if
(
policy
!=
null
)
{
commission
.
setReconciliationCompany
(
policy
.
getReconciliationCompany
());
...
...
@@ -867,8 +866,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
commission
.
getPolicyCurrency
())
);
}
else
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"保单不存在, policyNo: "
+
request
.
getPolicyNo
());
}
//
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "保单不存在, policyNo: " + request.getPolicyNo());
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"保单号不存在"
);
}
}
else
{
commission
.
setPolicyNo
(
null
);
...
...
@@ -1112,6 +1111,22 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
return
true
;
}
@Override
public
BigDecimal
queryCommissionExchangeRate
(
String
policyNo
,
Integer
commissionPeriod
)
{
// 查询当前期数入账记录的结算汇率
Commission
commissionRecord
=
this
.
getOne
(
new
QueryWrapper
<
Commission
>()
.
eq
(
"policy_no"
,
policyNo
)
.
eq
(
"commission_period"
,
commissionPeriod
)
.
orderByDesc
(
"commission_date"
)
.
last
(
"LIMIT 1"
)
);
if
(
ObjectUtils
.
isEmpty
(
commissionRecord
))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"保单号为"
+
policyNo
+
"的佣金期数为"
+
commissionPeriod
+
"的入账记录不存在"
);
}
return
commissionRecord
.
getExchangeRate
();
}
/**
* 查询列表
*
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CustomerServiceImpl.java
View file @
a574728d
...
...
@@ -11,6 +11,8 @@ import com.google.gson.reflect.TypeToken;
import
com.yd.base.feign.dto.ApiCertificateDto
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.dao.CustomerMapper
;
...
...
@@ -69,8 +71,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
String
mobile
=
customerQueryRequest
.
getMobile
();
String
email
=
customerQueryRequest
.
getEmail
();
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
name
),
"name_cn"
,
name
)
.
or
().
like
(
StringUtils
.
isNotBlank
(
name
),
"name_py_en"
,
name
);
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
name
);
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
name
);
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
nameSc
),
"name_sc"
,
nameSc
)
.
or
().
like
(
StringUtils
.
isNotBlank
(
nameEnLc
),
"name_en_lc"
,
nameEnLc
);
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
mobile
),
"mobile"
,
mobile
);
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
email
),
"email"
,
email
);
...
...
@@ -139,6 +146,14 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
validCustomer
(
customer
);
customer
.
setCustomerBizId
(
customerBizId
);
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
customerAddRequest
.
getNameCn
());
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
customerAddRequest
.
getNamePyEn
());
customer
.
setNameSc
(
nameSc
);
customer
.
setNameEnLc
(
nameEnLc
);
boolean
result
=
customerService
.
saveOrUpdate
(
customer
);
if
(!
result
)
{
throw
new
BusinessException
(
ErrorCode
.
OPERATION_ERROR
.
getCode
(),
ErrorCode
.
OPERATION_ERROR
.
getMessage
());
...
...
@@ -245,6 +260,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
// 数据校验
customerService
.
validCustomer
(
oldCustomer
);
// 更新主表
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
customerUpdateRequest
.
getNameCn
());
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
customerUpdateRequest
.
getNamePyEn
());
oldCustomer
.
setNameSc
(
nameSc
);
oldCustomer
.
setNameEnLc
(
nameEnLc
);
boolean
result
=
customerService
.
updateById
(
oldCustomer
);
if
(
StringUtils
.
isNotBlank
(
customerUpdateRequest
.
getNamePyEn
()))
{
fnaService
.
updateCustomerNameByCustomerBizId
(
customerUpdateRequest
.
getNamePyEn
(),
customerBizId
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
View file @
a574728d
...
...
@@ -2,6 +2,7 @@ package com.yd.csf.service.service.impl;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.csf.feign.request.expectedfortune.ApiExpectedFortunePageRequest
;
...
...
@@ -19,9 +20,9 @@ import com.yd.csf.service.vo.PayableReportVO;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -141,7 +142,7 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
ApiExpectedFortunePageResponse
vo
=
new
ApiExpectedFortunePageResponse
();
BeanUtils
.
copyProperties
(
ef
,
vo
);
vo
.
setCurrencyName
(
CurrencyEnum
.
toLabel
(
ef
.
getCurrency
())
);
vo
.
setCurrencyName
(
"港币"
);
String
ratio
=
finalBrokerRatioMap
.
get
(
ef
.
getBrokerBizId
());
vo
.
setCommissionRatio
(
ratio
);
...
...
@@ -175,4 +176,35 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
public
void
updateBatchByBizId
(
List
<
String
>
expectedFortuneBizIdList
,
String
status
)
{
baseMapper
.
updateBatchByBizId
(
expectedFortuneBizIdList
,
status
);
}
@Override
public
ExpectedFortune
getByBizId
(
String
expectedFortuneBizId
)
{
return
this
.
getOne
(
new
QueryWrapper
<
ExpectedFortune
>().
eq
(
"expected_fortune_biz_id"
,
expectedFortuneBizId
));
}
@Override
public
Integer
getPayableNoCurrentSeq
()
{
ExpectedFortune
latest
=
this
.
getOne
(
new
QueryWrapper
<
ExpectedFortune
>().
isNotNull
(
"payable_no"
).
orderByDesc
(
"id"
).
last
(
"LIMIT 1"
),
true
);
//获取当前序号作为起点
int
currentSeq
=
0
;
if
(!
Objects
.
isNull
(
latest
))
{
String
payableNo
=
latest
.
getPayableNo
();
currentSeq
=
Integer
.
parseInt
(
payableNo
.
substring
(
payableNo
.
length
()
-
6
));
}
return
currentSeq
;
}
@Override
public
String
getPayableNo
(
String
fortuneType
)
{
Integer
currentSeq
=
getPayableNoCurrentSeq
();
return
String
.
format
(
"%s%s%s"
,
fortuneType
+
"-CSF"
,
LocalDate
.
now
().
getYear
()
%
100
,
currentSeq
+
1
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaServiceImpl.java
View file @
a574728d
...
...
@@ -124,6 +124,7 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
return
queryWrapper
;
}
String
customerName
=
fnaQueryRequest
.
getCustomerName
();
String
creatorName
=
fnaQueryRequest
.
getCreatorName
();
String
appointmentNo
=
fnaQueryRequest
.
getAppointmentNo
();
String
policyBizId
=
fnaQueryRequest
.
getPolicyBizId
();
String
policyNo
=
fnaQueryRequest
.
getPolicyNo
();
...
...
@@ -154,6 +155,8 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
policyBizId
),
"policy_biz_id"
,
policyBizId
);
// 保单号
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
policyNo
),
"policy_no"
,
policyNo
);
// 创建人名称
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
creatorName
),
"creator_name"
,
creatorName
);
String
sortField
=
fnaQueryRequest
.
getSortField
();
String
sortOrder
=
fnaQueryRequest
.
getSortOrder
();
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
View file @
a574728d
...
...
@@ -2,6 +2,7 @@ package com.yd.csf.service.service.impl;
import
java.math.RoundingMode
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -18,15 +19,10 @@ import com.yd.common.utils.RandomStringGenerator;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.enums.FortuneAccountStatusEnum
;
import
com.yd.csf.service.enums.FortuneStatusEnum
;
import
com.yd.csf.service.model.ExpectedFortune
;
import
com.yd.csf.service.model.Fortune
;
import
com.yd.csf.service.model.FortuneAccount
;
import
com.yd.csf.service.model.FortuneAccountEditRecord
;
import
com.yd.csf.service.service.FortuneAccountEditRecordService
;
import
com.yd.csf.service.service.FortuneAccountService
;
import
com.yd.csf.service.model.*
;
import
com.yd.csf.service.service.*
;
import
com.yd.csf.service.dao.FortuneAccountMapper
;
import
com.yd.csf.service.service.FortuneService
;
import
com.yd.csf.service.service.IExpectedFortuneService
;
import
com.yd.csf.service.utils.BusinessNoUtils
;
import
com.yd.csf.service.vo.FortuneAccountVO
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -59,6 +55,9 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
@Resource
private
IExpectedFortuneService
expectedFortuneService
;
@Resource
private
PolicyBrokerService
policyBrokerService
;
private
final
Gson
GSON
=
new
Gson
();
@Override
...
...
@@ -100,6 +99,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
for
(
FortuneAccount
fortuneAccount
:
fortuneAccountList
)
{
FortuneAccountVO
fortuneAccountVO
=
FortuneAccountVO
.
objToVo
(
fortuneAccount
);
fortuneAccountVO
.
setFortuneList
(
GSON
.
fromJson
(
fortuneAccount
.
getContent
(),
new
TypeToken
<
List
<
Map
<
String
,
Object
>>>(){}.
getType
()));
fortuneAccountVO
.
setFortuneAccountMonth
(
fortuneAccount
.
getFortuneAccountDate
());
fortuneAccountVOList
.
add
(
fortuneAccountVO
);
}
...
...
@@ -109,7 +109,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
@Override
@Transactional
(
rollbackFor
=
BusinessException
.
class
)
public
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
)
{
public
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
,
LocalDate
actualPayoutDate
)
{
if
(
CollectionUtils
.
isEmpty
(
accountExportDTOList
))
{
return
;
}
...
...
@@ -117,18 +117,32 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
Long
loginUserId
=
currentLoginUser
.
getId
();
//查询转介人的内部编号列表信息
List
<
String
>
brokerBizIdList
=
accountExportDTOList
.
stream
().
map
(
FortuneAccountExportDTO:
:
getBrokerBizId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
map
=
policyBrokerService
.
queryInternalCodeMap
(
brokerBizIdList
);
List
<
FortuneAccount
>
fortuneAccountList
=
new
ArrayList
<>();
Date
currentDate
=
new
Date
();
String
billingYearMonth
=
actualPayoutDate
!=
null
?
actualPayoutDate
.
format
(
java
.
time
.
format
.
DateTimeFormatter
.
ofPattern
(
"yyyyMM"
))
:
""
;
for
(
FortuneAccountExportDTO
accountExportDTO
:
accountExportDTOList
)
{
FortuneAccount
fortuneAccount
=
new
FortuneAccount
();
fortuneAccount
.
setFortuneAccountBizId
(
RandomStringGenerator
.
generateBizId16
(
"fortune_account"
));
String
internalCode
=
map
.
get
(
accountExportDTO
.
getBrokerBizId
());
// LocalDate payoutDate = accountExportDTO.getActualPayoutDate();
// String billingYearMonth = payoutDate != null
// ? actualPayoutDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyyMM"))
// : "";
String
businessNo
=
BusinessNoUtils
.
generate
(
billingYearMonth
,
internalCode
);
//出账业务编号(出账年月 + 转介人内部编号(后6位)(如无,用0补齐)+流水号(6位))
fortuneAccount
.
setBusinessNo
(
businessNo
);
fortuneAccount
.
setBroker
(
accountExportDTO
.
getBroker
());
fortuneAccount
.
setBrokerBizId
(
accountExportDTO
.
getBrokerBizId
());
fortuneAccount
.
setTeam
(
accountExportDTO
.
getTeam
());
fortuneAccount
.
setTeamBizId
(
accountExportDTO
.
getTeamBizId
());
fortuneAccount
.
setCurrency
(
accountExportDTO
.
getCurrency
());
fortuneAccount
.
setHkdAmount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
setFortuneAccountDate
(
currentDate
);
fortuneAccount
.
setFortuneAccountDate
(
this
.
getActualPayoutDate
(
actualPayoutDate
)
);
// 出账状态默认待出账
fortuneAccount
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
...
...
@@ -186,11 +200,31 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
}
// 更新预计发佣记录的出账状态
if
(
CollectionUtils
.
isNotEmpty
(
expectedFortuneBizIdList
))
{
expectedFortuneService
.
updateBatchByBizId
(
expectedFortuneBizIdList
,
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
// 查询预计发佣记录
List
<
ExpectedFortune
>
expectedFortuneList
=
expectedFortuneService
.
list
(
new
QueryWrapper
<
ExpectedFortune
>()
.
in
(
"expected_fortune_biz_id"
,
expectedFortuneBizIdList
));
List
<
ExpectedFortune
>
updateExpectedFortuneList
=
new
ArrayList
<>();
for
(
ExpectedFortune
expectedFortune
:
expectedFortuneList
)
{
ExpectedFortune
updateExpectedFortune
=
new
ExpectedFortune
();
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
updateExpectedFortune
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
updateExpectedFortune
.
setActualPayoutDate
(
actualPayoutDate
);
updateExpectedFortuneList
.
add
(
updateExpectedFortune
);
}
expectedFortuneService
.
updateBatchById
(
updateExpectedFortuneList
);
}
}
private
Date
getActualPayoutDate
(
LocalDate
actualPayoutDate
)
{
if
(
actualPayoutDate
==
null
)
{
return
null
;
}
return
Date
.
from
(
actualPayoutDate
.
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
());
}
@Override
public
FortuneAccount
getByFortuneAccountBizId
(
String
fortuneAccountBizId
)
{
return
this
.
getOne
(
new
QueryWrapper
<
FortuneAccount
>().
eq
(
"fortune_account_biz_id"
,
fortuneAccountBizId
));
...
...
@@ -222,7 +256,9 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
Long
loginUserId
=
currentLoginUser
.
getId
();
FortuneAccount
fortuneAccount
=
this
.
getByFortuneAccountBizId
(
fortuneAccountUpdateRequest
.
getFortuneAccountBizId
());
String
fortuneAccountBizId
=
fortuneAccountUpdateRequest
.
getFortuneAccountBizId
();
FortuneAccount
fortuneAccount
=
this
.
getByFortuneAccountBizId
(
fortuneAccountBizId
);
if
(
fortuneAccount
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL_ERROR
.
getMessage
());
}
...
...
@@ -235,6 +271,18 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
this
.
updateById
(
fortuneAccount
);
// // 更新关联 expected_fortune、fortune的出账日期
// if (fortuneAccountUpdateRequest.getFortuneAccountDate() != null) {
// List<Fortune> fortuneList = fortuneService.lambdaQuery().eq(Fortune::getFortuneAccountBizId, fortuneAccountBizId).list();
// if (CollectionUtils.isNotEmpty(fortuneList)) {
// Set<String> expectedBizIdSet = fortuneList.stream().map(Fortune::getExpectedFortuneBizId).collect(Collectors.toSet());
// // 查询 expected_fortune 列表
// List<ExpectedFortune> expectedList = expectedFortuneService.lambdaQuery()
// .in(ExpectedFortune::getExpectedFortuneBizId, expectedBizIdSet)
// .list();
//
// }
// }
return
true
;
}
...
...
@@ -285,7 +333,6 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
/* 2. 更新 FortuneAccount 状态为已出账 ----------------------------------*/
accountList
.
forEach
(
a
->
{
a
.
setStatus
(
FortuneStatusEnum
.
SENT
.
getItemValue
());
a
.
setFortuneAccountDate
(
new
Date
());
a
.
setUpdaterId
(
loginUserId
.
toString
());
a
.
setUpdateTime
(
new
Date
());
});
...
...
@@ -361,7 +408,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
.
set
(
ExpectedFortune:
:
getUnpaidRatio
,
unpaid
.
divide
(
totalAmount
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)))
.
set
(
ExpectedFortune:
:
getStatus
,
newStatus
)
.
set
(
ExpectedFortune:
:
getActualPayoutDate
,
new
Date
())
//
.set(ExpectedFortune::getActualPayoutDate, new Date())
.
set
(
ExpectedFortune:
:
getUpdaterId
,
loginUserId
.
toString
())
.
set
(
ExpectedFortune:
:
getUpdateTime
,
LocalDateTime
.
now
())
.
eq
(
ExpectedFortune:
:
getId
,
ef
.
getId
())
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
a574728d
...
...
@@ -12,7 +12,6 @@ import com.google.common.base.Joiner;
import
com.yd.auth.core.dto.AuthUserDto
;
import
com.yd.auth.core.utils.SecurityUtil
;
import
com.yd.base.feign.client.exchangerate.ApiExchangeRateFeignClient
;
import
com.yd.common.constant.RedisConstants
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
...
...
@@ -42,6 +41,7 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.net.URLEncoder
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -78,6 +78,11 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if
(
fortuneQueryRequest
==
null
)
{
return
queryWrapper
;
}
// 默认查询条件 是否分期出账 1-是 0-否 2-拆分的原纪录
queryWrapper
.
in
(
"is_part"
,
0
,
1
);
// 获取参数
String
reconciliationYearMonth
=
fortuneQueryRequest
.
getReconciliationYearMonth
();
List
<
String
>
statusList
=
fortuneQueryRequest
.
getStatusList
();
String
policyNo
=
fortuneQueryRequest
.
getPolicyNo
();
...
...
@@ -360,17 +365,15 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
if
(
CollUtil
.
isNotEmpty
(
fortuneList
))
{
// 按人和币种分组
Map
<
String
,
List
<
Fortune
>>
fortuneMap
=
fortuneList
.
stream
().
collect
(
Collectors
.
groupingBy
(
fortune
->
fortune
.
getBroker
()
+
"_"
+
fortune
.
getCurrency
()));
// 按人和
发放
币种分组
Map
<
String
,
List
<
Fortune
>>
fortuneMap
=
fortuneList
.
stream
().
collect
(
Collectors
.
groupingBy
(
fortune
->
fortune
.
getBroker
()
+
"_"
+
fortune
.
get
Payout
Currency
()));
// 创建按人分组的导出DTO列表
List
<
FortuneAccountExportDTO
>
accountExportDTOList
=
new
ArrayList
<>();
// 收集所有不同的fortune项目名称
Set
<
String
>
allFortuneNames
=
fortuneList
.
stream
()
.
map
(
Fortune:
:
getFortuneName
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
collect
(
Collectors
.
toSet
());
// 设置出账年月(实)
LocalDate
actualPayoutDate
=
LocalDate
.
parse
(
fortuneDownloadRequest
.
getActualPayoutDate
()
+
"-01"
);
fortuneList
.
forEach
(
fortune
->
fortune
.
setActualPayoutDate
(
actualPayoutDate
));
// 处理每个分组的数据
for
(
Map
.
Entry
<
String
,
List
<
Fortune
>>
entry
:
fortuneMap
.
entrySet
())
{
...
...
@@ -388,6 +391,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
accountDTO
.
setTeam
(
brokerFortunes
.
get
(
0
).
getTeam
());
accountDTO
.
setTeamBizId
(
brokerFortunes
.
get
(
0
).
getTeamBizId
());
accountDTO
.
setCurrency
(
currency
);
accountDTO
.
setActualPayoutDate
(
brokerFortunes
.
get
(
0
).
getActualPayoutDate
());
}
// 计算出账总额
...
...
@@ -442,7 +446,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// }
// 写入数据库
fortuneAccountService
.
saveFortuneAccount
(
accountExportDTOList
);
fortuneAccountService
.
saveFortuneAccount
(
accountExportDTOList
,
actualPayoutDate
);
// // 使用try-with-resources确保流正确关闭
// try (ServletOutputStream outputStream = response.getOutputStream()) {
...
...
@@ -521,19 +525,16 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setCommissionExpectedBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setPolicyCurrency
(
expectedFortune
.
getPolicyCurrency
());
fortune
.
setExchangeRate
(
expectedFortune
.
getDefaultExchangeRate
());
fortune
.
setHkdAmount
(
fortuneAddRequest
.
getAmount
().
multiply
(
expectedFortune
.
getDefaultExchangeRate
()));
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getHkdAmount
());
fortune
.
setPayoutDate
(
expectedFortune
.
getPayoutDate
());
}
else
{
fortune
.
setExchangeRate
(
BigDecimal
.
ONE
);
fortune
.
setHkdAmount
(
fortuneAddRequest
.
getAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getHkdAmount
());
}
// 生成发佣业务ID
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
getAmount
());
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
get
Payout
Amount
());
fortune
.
setFortuneName
(
queryByDict
(
fortuneAddRequest
.
getFortuneType
()));
fortune
.
setActualPayoutDate
(
fortuneAddRequest
.
getPayoutDate
());
fortune
.
setIsPart
(
0
);
...
...
@@ -544,38 +545,54 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
private
static
void
valiAddFortune
(
FortuneAddRequest
fortuneAddRequest
)
{
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getFortuneBizType
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"出账类型不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账类型不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getOriginalCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getOriginalAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种金额不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getOriginalToHkdRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种→港币汇率不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getPayoutCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"发放币种不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getPayoutAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"发放币种金额不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
get
Amount
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"出账金额
不能为空"
);
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
get
RuleCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"保单币种
不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
get
Currency
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"出账币种
不能为空"
);
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
get
RuleAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"保单币种金额
不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getExchangeRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"保单币种→港币汇率不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getHkdAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"港币金额不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getFortuneType
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"出账项目不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账项目不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getBrokerBizId
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"转介人不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"转介人不能为空"
);
}
if
(
"R"
.
equals
(
fortuneAddRequest
.
getFortuneBizType
()))
{
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getPolicyNo
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"关联保单应付款,保单号不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"关联保单应付款,保单号不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getFortunePeriod
()))
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"关联保单应付款,佣金期数不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"关联保单应付款,佣金期数不能为空"
);
}
}
}
private
String
queryByDict
(
String
fortuneType
)
{
//查询redis缓存的字典列表信息
List
<
GetDictItemListByDictTypeResponse
>
dictTypeResponses
=
redisUtil
.
getCacheObject
(
RedisConstants
.
DICT_LIST
);
String
fortuneName
=
GetDictItemListByDictTypeResponse
.
getItemLabel
(
dictTypeResponses
,
"csf_fortune_type"
,
fortuneType
);
if
(
ObjectUtils
.
isNotEmpty
(
fortuneName
))
{
return
fortuneName
;
}
Result
<
List
<
GetDictItemListByDictTypeResponse
>>
result
=
apiSysDictFeignClient
.
getDictItemListByDictType
(
"csf_fortune_type"
);
if
(
CollectionUtils
.
isNotEmpty
(
result
.
getData
()))
{
for
(
GetDictItemListByDictTypeResponse
dictItem
:
result
.
getData
())
{
...
...
@@ -721,18 +738,24 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
Fortune
fortune
=
new
Fortune
();
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
fortune
);
// 计算港币金额
fortune
.
setExchangeRate
(
queryExchangeRateByFeign
(
fortuneAddRequest
.
getCurrency
(),
"HKD"
));
fortune
.
setHkdAmount
(
fortuneAddRequest
.
getAmount
().
multiply
(
fortune
.
getExchangeRate
()));
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getHkdAmount
());
// 查询发佣类型名称
String
fortuneName
=
queryByDict
(
fortuneAddRequest
.
getFortuneType
());
fortune
.
setFortuneName
(
fortuneName
);
if
(
"R"
.
equals
(
fortuneAddRequest
.
getFortuneBizType
()))
{
if
(
policyMap
.
get
(
fortuneAddRequest
.
getPolicyNo
())
==
null
)
{
Policy
policy
=
policyMap
.
get
(
fortuneAddRequest
.
getPolicyNo
());
if
(
policy
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
fortuneAddRequest
.
getPolicyNo
()
+
" 保单号不存在"
);
}
ExpectedFortune
expectedFortune
=
expectedFortuneMap
.
get
(
fortuneAddRequest
.
getPolicyNo
()
+
"_"
+
fortuneAddRequest
.
getFortunePeriod
()
+
"_"
+
fortuneAddRequest
.
getFortuneType
());
if
(
expectedFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
fortuneAddRequest
.
getFortuneName
()
+
" 预计出账不存在"
);
// 同步新增预计出账
expectedFortune
=
createExpectedFortune
(
fortuneAddRequest
,
policy
,
fortuneName
);
// 保存
expectedFortuneService
.
save
(
expectedFortune
);
}
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setPolicyCurrency
(
expectedFortune
.
getPolicyCurrency
());
...
...
@@ -749,14 +772,12 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
fortune
.
setStatus
(
FortuneStatusEnum
.
MATCH_FAIL
.
getItemValue
());
fortune
.
setRemark
(
"未找到当前预计发佣对应的来佣"
);
}
// 更新预计出账的数据
processExpectedFortune
(
expectedFortune
,
fortune
,
expectedFortuneUpdateList
);
}
// 生成发佣业务ID
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
getAmount
());
fortune
.
setFortuneName
(
queryByDict
(
fortuneAddRequest
.
getFortuneType
()));
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
getPayoutAmount
());
fortune
.
setActualPayoutDate
(
fortuneAddRequest
.
getPayoutDate
());
fortune
.
setIsPart
(
0
);
fortuneList
.
add
(
fortune
);
...
...
@@ -770,26 +791,380 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
return
true
;
}
private
void
processExpectedFortune
(
ExpectedFortune
expectedFortune
,
Fortune
fortune
,
List
<
ExpectedFortune
>
expectedFortuneUpdateList
)
{
// 出账币种
String
currency
=
fortune
.
getCurrency
();
// 港币出账金额
BigDecimal
hkdAmount
=
fortune
.
getHkdAmount
();
private
ExpectedFortune
createExpectedFortune
(
FortuneAddRequest
fortuneAddRequest
,
Policy
policy
,
String
fortuneName
)
{
// 应付款编号(序号递增)
String
payableNo
=
expectedFortuneService
.
getPayableNo
(
fortuneAddRequest
.
getFortuneType
());
// 创建 expectedFortune
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
expectedFortune
);
// 设置 policy 关联字段
expectedFortune
.
setInsuranceCompanyBizId
(
policy
.
getInsuranceCompanyBizId
());
expectedFortune
.
setProductLaunchBizId
(
policy
.
getProductLaunchBizId
());
expectedFortune
.
setPremium
(
policy
.
getPaymentPremium
());
expectedFortune
.
setPolicyCurrency
(
policy
.
getCurrency
());
// 预计发佣业务id
expectedFortune
.
setExpectedFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
()));
// 预计发佣类型名称
expectedFortune
.
setFortuneName
(
fortuneName
);
// 应付款编号
expectedFortune
.
setPayableNo
(
payableNo
);
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
// 转介人比例默认100%
expectedFortune
.
setBrokerRatio
(
"100"
);
expectedFortune
.
setUnpaidAmount
(
expectedFortune
.
getHkdAmount
());
expectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
expectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
return
expectedFortune
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
splitFortune
(
FortuneSplitRequest
fortuneSplitRequest
)
{
// 1. 参数验证
validSplitFortune
(
fortuneSplitRequest
);
// 2. 查询并验证原始记录
Fortune
originalFortune
=
this
.
getByFortuneBizId
(
fortuneSplitRequest
.
getFortuneBizId
());
if
(
originalFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"原出账记录不存在"
);
}
ExpectedFortune
originalExpectedFortune
=
expectedFortuneService
.
getByBizId
(
originalFortune
.
getExpectedFortuneBizId
());
if
(
originalExpectedFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"对应的预计出账记录不存在"
);
}
if
(
FortuneStatusEnum
.
SENT
.
getItemValue
().
equals
(
originalFortune
.
getStatus
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"已完成出账状态的记录不能分期"
);
}
if
(
originalFortune
.
getIsPart
()
!=
null
&&
originalFortune
.
getIsPart
()
==
1
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"该记录已是分期拆分记录,不能再次分期"
);
}
if
(
StringUtils
.
isNotBlank
(
originalFortune
.
getFortuneAccountBizId
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"该记录已有薪资发放,不能分期"
);
}
List
<
FortuneSplitDto
>
splitList
=
fortuneSplitRequest
.
getFortuneSplitDtoList
();
// 3. 金额验证
BigDecimal
totalSplitOriginalAmount
=
splitList
.
stream
()
.
map
(
FortuneSplitDto:
:
getOriginalAmount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalSplitRatio
=
splitList
.
stream
()
.
map
(
FortuneSplitDto:
:
getSplitRatio
)
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
tolerance
=
new
BigDecimal
(
"0.01"
);
BigDecimal
originalDifference
=
originalFortune
.
getOriginalAmount
().
subtract
(
totalSplitOriginalAmount
).
abs
();
if
(
originalDifference
.
compareTo
(
tolerance
)
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
String
.
format
(
"分期原始金额总和(%s)与原记录原始金额(%s)不匹配"
,
totalSplitOriginalAmount
,
originalFortune
.
getOriginalAmount
()));
}
if
(
totalSplitRatio
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
BigDecimal
ratioDifference
=
new
BigDecimal
(
"100"
).
subtract
(
totalSplitRatio
).
abs
();
if
(
ratioDifference
.
compareTo
(
new
BigDecimal
(
"0.1"
))
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
String
.
format
(
"分期比例总和(%s%%)应为100%%"
,
totalSplitRatio
));
}
}
// 4. 生成新记录
List
<
Fortune
>
newFortuneList
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
newExpectedFortuneList
=
new
ArrayList
<>();
Date
now
=
new
Date
();
LocalDateTime
localDateTime
=
LocalDateTime
.
now
();
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
username
=
currentLoginUser
.
getUsername
();
for
(
int
i
=
0
;
i
<
splitList
.
size
();
i
++)
{
FortuneSplitDto
splitDto
=
splitList
.
get
(
i
);
// 4.1 生成新的 ExpectedFortune
ExpectedFortune
newExpectedFortune
=
new
ExpectedFortune
();
BeanUtils
.
copyProperties
(
originalExpectedFortune
,
newExpectedFortune
,
"id"
,
"expectedFortuneBizId"
,
"amount"
,
"hkdAmount"
,
"paidAmount"
,
"unpaidAmount"
,
"paidRatio"
,
"unpaidRatio"
,
"status"
,
"payoutDate"
,
"actualPayoutDate"
,
"remark"
);
String
newExpectedFortuneBizId
=
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
());
newExpectedFortune
.
setExpectedFortuneBizId
(
newExpectedFortuneBizId
);
// 赋值分期出账信息
BeanUtils
.
copyProperties
(
splitDto
,
newExpectedFortune
);
// 生成应付款编号
String
payableNo
=
originalExpectedFortune
.
getPayableNo
()
+
"_"
+
(
i
+
1
);
newExpectedFortune
.
setPayableNo
(
payableNo
);
newExpectedFortune
.
setDefaultExchangeRate
(
splitDto
.
getExchangeRate
());
newExpectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
newExpectedFortune
.
setUnpaidAmount
(
splitDto
.
getHkdAmount
());
newExpectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
newExpectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
newExpectedFortune
.
setStatus
(
"0"
);
newExpectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
splitDto
.
getPayoutYearMonth
()
+
"-01"
));
String
expectedRemark
=
StringUtils
.
isBlank
(
splitDto
.
getRemark
())
?
""
:
splitDto
.
getRemark
();
if
(
StringUtils
.
isNotBlank
(
originalExpectedFortune
.
getRemark
()))
{
expectedRemark
=
StringUtils
.
isBlank
(
expectedRemark
)
?
originalExpectedFortune
.
getRemark
()
:
originalExpectedFortune
.
getRemark
()
+
"; "
+
expectedRemark
;
}
newExpectedFortune
.
setRemark
(
expectedRemark
);
newExpectedFortune
.
setCreatorId
(
loginUserId
);
newExpectedFortune
.
setCreatorName
(
username
);
newExpectedFortune
.
setCreateTime
(
localDateTime
);
newExpectedFortune
.
setUpdaterId
(
loginUserId
);
newExpectedFortune
.
setUpdateTime
(
localDateTime
);
newExpectedFortuneList
.
add
(
newExpectedFortune
);
// 4.2 生成新的 Fortune
Fortune
newFortune
=
new
Fortune
();
BeanUtils
.
copyProperties
(
originalFortune
,
newFortune
,
"id"
,
"fortuneBizId"
,
"expectedFortuneBizId"
,
"amount"
,
"hkdAmount"
,
"currentPaymentAmount"
,
"currentPaymentHkdAmount"
,
"currentPaymentRatio"
,
"status"
,
"isPart"
,
"payoutDate"
,
"actualPayoutDate"
,
"remark"
);
ExpectedFortune
updateObj
=
new
ExpectedFortune
();
updateObj
.
setId
(
expectedFortune
.
getId
());
updateObj
.
setHkdAmount
(
expectedFortune
.
getHkdAmount
().
add
(
hkdAmount
));
updateObj
.
setUnpaidAmount
(
hkdAmount
.
add
(
expectedFortune
.
getUnpaidAmount
()));
updateObj
.
setUnpaidRatio
(
updateObj
.
getUnpaidAmount
().
divide
(
updateObj
.
getHkdAmount
(),
4
,
RoundingMode
.
HALF_UP
));
newFortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
// 根据预计出账币种计算 expectedFortune.getAmount() 字段
BigDecimal
originalAmount
=
fortune
.
getAmount
();
// 原始币种金额
BigDecimal
exchangeRate
=
queryExchangeRateByFeign
(
currency
,
expectedFortune
.
getCurrency
());
BigDecimal
amount
=
originalAmount
.
multiply
(
exchangeRate
);
// 本次新增出账金额
newFortune
.
setExpectedFortuneBizId
(
newExpectedFortuneBizId
);
updateObj
.
setAmount
(
amount
.
add
(
expectedFortune
.
getAmount
()));
// 赋值分期出账信息
BeanUtils
.
copyProperties
(
splitDto
,
newFortune
);
// 特殊字段
newFortune
.
setCurrentPaymentAmount
(
splitDto
.
getPayoutAmount
());
newFortune
.
setCurrentPaymentHkdAmount
(
splitDto
.
getHkdAmount
());
newFortune
.
setCurrentPaymentRatio
(
splitDto
.
getSplitRatio
());
expectedFortuneUpdateList
.
add
(
updateObj
);
newFortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
newFortune
.
setIsPart
(
1
);
newFortune
.
setPayoutDate
(
newExpectedFortune
.
getPayoutDate
());
String
fortuneRemark
=
StringUtils
.
isBlank
(
splitDto
.
getRemark
())
?
""
:
splitDto
.
getRemark
();
if
(
StringUtils
.
isNotBlank
(
originalFortune
.
getRemark
()))
{
fortuneRemark
=
StringUtils
.
isBlank
(
fortuneRemark
)
?
originalFortune
.
getRemark
()
:
originalFortune
.
getRemark
()
+
"; "
+
fortuneRemark
;
}
newFortune
.
setRemark
(
fortuneRemark
);
newFortune
.
setReconciliationOperator
(
username
);
newFortune
.
setCreatorId
(
loginUserId
);
newFortune
.
setCreateTime
(
now
);
newFortune
.
setUpdaterId
(
loginUserId
);
newFortune
.
setUpdateTime
(
now
);
newFortuneList
.
add
(
newFortune
);
}
// 5.1 设置原始 fortune记录 is_part 为 2,表示该记录已被分期
this
.
lambdaUpdate
()
.
set
(
Fortune:
:
getIsPart
,
2
)
.
eq
(
Fortune:
:
getId
,
originalFortune
.
getId
())
.
update
();
// 5.2 设置原始 expected fortune记录 is_part 为 2,表示该记录已被分期
expectedFortuneService
.
lambdaUpdate
()
.
set
(
ExpectedFortune:
:
getIsPart
,
2
)
.
eq
(
ExpectedFortune:
:
getId
,
originalExpectedFortune
.
getId
())
.
update
();
// 6. 批量保存新记录
boolean
expectedSaveSuccess
=
expectedFortuneService
.
saveBatch
(
newExpectedFortuneList
);
if
(!
expectedSaveSuccess
)
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"分期预计出账记录保存失败"
);
}
boolean
fortuneSaveSuccess
=
this
.
saveBatch
(
newFortuneList
);
if
(!
fortuneSaveSuccess
)
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"分期出账记录保存失败"
);
}
// 7. 返回结果
return
true
;
}
@Override
public
Boolean
editActualPayoutDate
(
EditActualPayoutDateRequest
editActualPayoutDateRequest
)
{
String
fortuneBizId
=
editActualPayoutDateRequest
.
getFortuneBizId
();
Fortune
fortune
=
this
.
getByFortuneBizId
(
fortuneBizId
);
if
(
fortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账记录不存在"
);
}
ExpectedFortune
originalExpectedFortune
=
expectedFortuneService
.
getByBizId
(
fortune
.
getExpectedFortuneBizId
());
if
(
originalExpectedFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"对应的预计出账记录不存在"
);
}
// 计算实际出账日期
LocalDate
actualPayoutDate
=
LocalDate
.
parse
(
editActualPayoutDateRequest
.
getActualPayoutDate
()
+
"-01"
);
// 更新实际出账日期
this
.
lambdaUpdate
()
.
set
(
Fortune:
:
getActualPayoutDate
,
actualPayoutDate
)
.
eq
(
Fortune:
:
getId
,
fortune
.
getId
())
.
update
();
expectedFortuneService
.
lambdaUpdate
()
.
set
(
ExpectedFortune:
:
getActualPayoutDate
,
actualPayoutDate
)
.
eq
(
ExpectedFortune:
:
getId
,
originalExpectedFortune
.
getId
())
.
update
();
return
true
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
editExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
)
{
validEditExchangeRate
(
editExchangeRateRequest
);
String
fortuneBizId
=
editExchangeRateRequest
.
getFortuneBizId
();
Fortune
fortune
=
this
.
getByFortuneBizId
(
fortuneBizId
);
if
(
fortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账记录不存在"
);
}
if
(
FortuneStatusEnum
.
SENT
.
getItemValue
().
equals
(
fortune
.
getStatus
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"已完成出账状态的记录不能修改结算汇率"
);
}
ExpectedFortune
originalExpectedFortune
=
expectedFortuneService
.
getByBizId
(
fortune
.
getExpectedFortuneBizId
());
if
(
originalExpectedFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"对应的预计出账记录不存在"
);
}
// 获取入参
BigDecimal
ruleAmount
=
editExchangeRateRequest
.
getRuleAmount
();
String
ruleCurrency
=
editExchangeRateRequest
.
getRuleCurrency
();
BigDecimal
exchangeRate
=
editExchangeRateRequest
.
getExchangeRate
();
String
originalCurrency
=
editExchangeRateRequest
.
getOriginalCurrency
();
BigDecimal
originalAmount
=
editExchangeRateRequest
.
getOriginalAmount
();
BigDecimal
originalToHkdRate
=
editExchangeRateRequest
.
getOriginalToHkdRate
();
String
payoutCurrency
=
editExchangeRateRequest
.
getPayoutCurrency
();
BigDecimal
payoutAmount
=
editExchangeRateRequest
.
getPayoutAmount
();
BigDecimal
hkdToPayoutRate
=
editExchangeRateRequest
.
getHkdToPayoutRate
();
BigDecimal
hkdAmount
=
editExchangeRateRequest
.
getHkdAmount
();
// 更新 fortune 的字段
this
.
lambdaUpdate
()
.
set
(
Fortune:
:
getRuleAmount
,
ruleAmount
)
.
set
(
Fortune:
:
getRuleCurrency
,
ruleCurrency
)
.
set
(
Fortune:
:
getExchangeRate
,
exchangeRate
)
.
set
(
Fortune:
:
getOriginalCurrency
,
originalCurrency
)
.
set
(
Fortune:
:
getOriginalAmount
,
originalAmount
)
.
set
(
Fortune:
:
getOriginalToHkdRate
,
originalToHkdRate
)
.
set
(
Fortune:
:
getPayoutCurrency
,
payoutCurrency
)
.
set
(
Fortune:
:
getPayoutAmount
,
payoutAmount
)
.
set
(
Fortune:
:
getHkdToPayoutRate
,
hkdToPayoutRate
)
.
set
(
Fortune:
:
getHkdAmount
,
hkdAmount
)
.
eq
(
Fortune:
:
getId
,
fortune
.
getId
())
.
update
();
// 更新 expected fortune 的字段
expectedFortuneService
.
lambdaUpdate
()
.
set
(
ExpectedFortune:
:
getRuleAmount
,
ruleAmount
)
.
set
(
ExpectedFortune:
:
getRuleCurrency
,
ruleCurrency
)
.
set
(
ExpectedFortune:
:
getDefaultExchangeRate
,
exchangeRate
)
.
set
(
ExpectedFortune:
:
getOriginalCurrency
,
originalCurrency
)
.
set
(
ExpectedFortune:
:
getOriginalAmount
,
originalAmount
)
.
set
(
ExpectedFortune:
:
getOriginalToHkdRate
,
originalToHkdRate
)
.
set
(
ExpectedFortune:
:
getPayoutCurrency
,
payoutCurrency
)
.
set
(
ExpectedFortune:
:
getPayoutAmount
,
payoutAmount
)
.
set
(
ExpectedFortune:
:
getHkdToPayoutRate
,
hkdToPayoutRate
)
.
set
(
ExpectedFortune:
:
getHkdAmount
,
hkdAmount
)
.
set
(
ExpectedFortune:
:
getUnpaidAmount
,
hkdAmount
)
.
eq
(
ExpectedFortune:
:
getId
,
originalExpectedFortune
.
getId
())
.
update
();
return
true
;
}
private
void
validEditExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
)
{
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getOriginalCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getOriginalAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种金额不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getOriginalToHkdRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种→港币汇率不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getPayoutCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"发放币种不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getPayoutAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"发放币种金额不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getRuleCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"保单币种不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getRuleAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"保单币种金额不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getExchangeRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"保单币种→港币汇率不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getHkdAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"港币金额不能为空"
);
}
}
private
void
validSplitFortune
(
FortuneSplitRequest
fortuneSplitRequest
)
{
if
(
fortuneSplitRequest
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"分期出账请求不能为空"
);
}
if
(
StringUtils
.
isBlank
(
fortuneSplitRequest
.
getFortuneBizId
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"保单出账业务ID不能为空"
);
}
if
(
CollectionUtils
.
isEmpty
(
fortuneSplitRequest
.
getFortuneSplitDtoList
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"分期配置列表不能为空"
);
}
if
(
fortuneSplitRequest
.
getFortuneSplitDtoList
().
size
()
<
2
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"分期至少需要2条配置"
);
}
List
<
FortuneSplitDto
>
splitList
=
fortuneSplitRequest
.
getFortuneSplitDtoList
();
for
(
int
i
=
0
;
i
<
splitList
.
size
();
i
++)
{
FortuneSplitDto
dto
=
splitList
.
get
(
i
);
if
(
dto
.
getHkdAmount
()
==
null
||
dto
.
getHkdAmount
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"第"
+
(
i
+
1
)
+
"期:港币金额必须大于0"
);
}
if
(
dto
.
getExchangeRate
()
==
null
||
dto
.
getExchangeRate
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"第"
+
(
i
+
1
)
+
"期:汇率必须大于0"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getPayoutYearMonth
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"第"
+
(
i
+
1
)
+
"期:出账年月不能为空"
);
}
}
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyBrokerServiceImpl.java
View file @
a574728d
...
...
@@ -7,10 +7,14 @@ import com.yd.csf.service.model.Policy;
import
com.yd.csf.service.model.PolicyBroker
;
import
com.yd.csf.service.service.PolicyBrokerService
;
import
com.yd.csf.service.dao.PolicyBrokerMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author Zhang Jianan
...
...
@@ -29,6 +33,7 @@ public class PolicyBrokerServiceImpl extends ServiceImpl<PolicyBrokerMapper, Pol
@Override
public
List
<
PolicyBroker
>
queryList
(
QueryPolicyBrokerDto
dto
)
{
List
<
PolicyBroker
>
list
=
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyBroker
>()
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getBrokerName
()),
PolicyBroker:
:
getBrokerName
,
dto
.
getBrokerName
())
.
in
(!
CollectionUtils
.
isEmpty
(
dto
.
getPolicyNoList
()),
PolicyBroker:
:
getPolicyNo
,
dto
.
getPolicyNoList
())
);
return
list
;
...
...
@@ -54,6 +59,23 @@ public class PolicyBrokerServiceImpl extends ServiceImpl<PolicyBrokerMapper, Pol
public
List
<
String
>
selectRelatedBrokerBizIds
(
String
clientUserId
)
{
return
baseMapper
.
selectRelatedBrokerBizIds
(
clientUserId
);
}
@Override
public
Map
<
String
,
String
>
queryInternalCodeMap
(
List
<
String
>
brokerBizIdList
)
{
if
(
CollectionUtils
.
isEmpty
(
brokerBizIdList
))
{
return
Collections
.
emptyMap
();
}
List
<
PolicyBroker
>
list
=
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyBroker
>()
.
select
(
PolicyBroker:
:
getBrokerBizId
,
PolicyBroker:
:
getInternalCode
)
// 只查需要的字段
.
in
(
PolicyBroker:
:
getBrokerBizId
,
brokerBizIdList
)
.
isNotNull
(
PolicyBroker:
:
getInternalCode
)
// 排除 internalCode 为 null 的记录(可选)
);
return
list
.
stream
().
collect
(
Collectors
.
toMap
(
PolicyBroker:
:
getBrokerBizId
,
PolicyBroker:
:
getInternalCode
,
(
v1
,
v2
)
->
v1
// 如果 brokerBizId 可能重复,保留其中一个
));
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
View file @
a574728d
...
...
@@ -18,7 +18,10 @@ import com.yd.common.enums.CommonEnum;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.result.Result
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.csf.feign.response.policyfollow.ApiPolicyFollowDetailResponse
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.enums.FnaStatusEnum
;
...
...
@@ -44,6 +47,8 @@ import org.springframework.dao.DataIntegrityViolationException;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.annotation.Resource
;
import
java.util.*
;
...
...
@@ -125,6 +130,57 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
queryWrapper
.
ge
(
ObjectUtils
.
isNotEmpty
(
signDateStart
),
"sign_date"
,
signDateStart
);
queryWrapper
.
le
(
ObjectUtils
.
isNotEmpty
(
signDateEnd
),
"sign_date"
,
signDateEnd
);
queryWrapper
.
eq
(
ObjectUtils
.
isNotEmpty
(
latestPaymentDate
),
"latest_payment_date"
,
latestPaymentDate
);
//保單持有人(投保人)
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getPolicyHolder
()))
{
List
<
PolicyPolicyholder
>
policyHolderList
=
policyPolicyholderService
.
queryList
(
policyFollowQueryRequest
.
getPolicyHolder
());
List
<
String
>
policyBizIdList
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
policyHolderList
))
{
policyBizIdList
=
policyHolderList
.
stream
()
.
map
(
PolicyPolicyholder:
:
getPolicyBizId
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isNotEmpty
(
policyBizIdList
))
{
queryWrapper
.
in
(
"policy_biz_id"
,
policyBizIdList
);
}
else
{
// 没有匹配的投保人,直接让查询结果为空
queryWrapper
.
apply
(
"1=0"
);
}
}
//受保人
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getInsured
()))
{
List
<
PolicyInsurant
>
policyHolderList
=
policyInsurantService
.
queryList
(
policyFollowQueryRequest
.
getInsured
());
List
<
String
>
policyBizIdList
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
policyHolderList
))
{
policyBizIdList
=
policyHolderList
.
stream
()
.
map
(
PolicyInsurant:
:
getPolicyBizId
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isNotEmpty
(
policyBizIdList
))
{
queryWrapper
.
in
(
"policy_biz_id"
,
policyBizIdList
);
}
else
{
// 没有匹配的受保人,直接让查询结果为空
queryWrapper
.
apply
(
"1=0"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getInsured
()))
queryWrapper
.
like
(
"insured"
,
policyFollowQueryRequest
.
getInsured
());
//签单人
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getSigner
()))
queryWrapper
.
like
(
"signer"
,
policyFollowQueryRequest
.
getSigner
());
//转介人(保单转介人表)
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getBrokerName
()))
{
List
<
PolicyBroker
>
policyBrokerList
=
policyBrokerService
.
queryList
(
QueryPolicyBrokerDto
.
builder
().
brokerName
(
policyFollowQueryRequest
.
getBrokerName
()).
build
());
if
(!
CollectionUtils
.
isEmpty
(
policyBrokerList
))
{
//新单跟进唯一业务ID
List
<
String
>
policyBizIdList
=
policyBrokerList
.
stream
().
map
(
PolicyBroker:
:
getPolicyBizId
).
collect
(
Collectors
.
toList
());
queryWrapper
.
in
(
"policy_biz_id"
,
policyBizIdList
);
}
else
{
// 没有匹配的转介人,直接让查询结果为空
queryWrapper
.
apply
(
"1=0"
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
insuranceCompanyBizIdList
))
{
queryWrapper
.
in
(
"insurance_company_biz_id"
,
insuranceCompanyBizIdList
);
...
...
@@ -142,14 +198,112 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
@Override
public
Page
<
PolicyFollowVO
>
getPolicyFollowVOPage
(
Page
<
PolicyFollow
>
policyFollowPage
)
{
List
<
PolicyFollow
>
policyFollowList
=
policyFollowPage
.
getRecords
();
Page
<
PolicyFollowVO
>
policyFollowVOPage
=
new
Page
<>(
policyFollowPage
.
getCurrent
(),
policyFollowPage
.
getSize
(),
policyFollowPage
.
getTotal
());
Page
<
PolicyFollowVO
>
policyFollowVOPage
=
new
Page
<>(
policyFollowPage
.
getCurrent
(),
policyFollowPage
.
getSize
(),
policyFollowPage
.
getTotal
());
if
(
CollUtil
.
isEmpty
(
policyFollowList
))
{
return
policyFollowVOPage
;
}
// 对象列表 => 封装对象列表
List
<
PolicyFollowVO
>
policyFollowVOList
=
policyFollowList
.
stream
().
map
(
PolicyFollowVO:
:
objToVo
).
collect
(
Collectors
.
toList
());
List
<
PolicyFollowVO
>
voList
=
policyFollowList
.
stream
()
.
map
(
PolicyFollowVO:
:
objToVo
)
.
collect
(
Collectors
.
toList
());
// 批量填充所需字段
fillFiledNames
(
voList
);
return
policyFollowVOPage
.
setRecords
(
policyFollowVOList
);
policyFollowVOPage
.
setRecords
(
voList
);
return
policyFollowVOPage
;
}
/**
* 批量填充所需字段
*/
private
void
fillFiledNames
(
List
<
PolicyFollowVO
>
voList
)
{
// 提取所有 policyBizId
List
<
String
>
bizIds
=
voList
.
stream
()
.
map
(
PolicyFollowVO:
:
getPolicyBizId
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
CollUtil
.
isEmpty
(
bizIds
))
{
return
;
}
// 批量查询转介人(取第一个 brokerName)
List
<
PolicyBroker
>
allBrokers
=
policyBrokerService
.
lambdaQuery
()
.
in
(
PolicyBroker:
:
getPolicyBizId
,
bizIds
)
.
eq
(
PolicyBroker:
:
getIsDeleted
,
0
)
.
orderByAsc
(
PolicyBroker:
:
getId
)
.
list
();
Map
<
String
,
String
>
brokerNameMap
=
allBrokers
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
PolicyBroker:
:
getPolicyBizId
,
LinkedHashMap:
:
new
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
list
->
list
.
get
(
0
).
getBrokerName
()
)
));
// 批量查询投保人(取第一条的中文名、英文名)
List
<
PolicyPolicyholder
>
allPolicyholders
=
policyPolicyholderService
.
lambdaQuery
()
.
in
(
PolicyPolicyholder:
:
getPolicyBizId
,
bizIds
)
.
eq
(
PolicyPolicyholder:
:
getIsDeleted
,
0
)
.
orderByAsc
(
PolicyPolicyholder:
:
getId
)
.
list
();
Map
<
String
,
String
>
holderNameMap
=
allPolicyholders
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
PolicyPolicyholder:
:
getPolicyBizId
,
LinkedHashMap:
:
new
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
list
->
list
.
get
(
0
).
getName
()
// 中文名
)
));
Map
<
String
,
String
>
holderNameEnMap
=
allPolicyholders
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
PolicyPolicyholder:
:
getPolicyBizId
,
LinkedHashMap:
:
new
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
list
->
list
.
get
(
0
).
getNameEn
()
// 英文名
)
));
// 批量查询受保人(取第一条的中文名、英文名)
List
<
PolicyInsurant
>
allInsurants
=
policyInsurantService
.
lambdaQuery
()
.
in
(
PolicyInsurant:
:
getPolicyBizId
,
bizIds
)
.
eq
(
PolicyInsurant:
:
getIsDeleted
,
0
)
.
orderByAsc
(
PolicyInsurant:
:
getId
)
.
list
();
Map
<
String
,
String
>
insurantNameMap
=
allInsurants
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
PolicyInsurant:
:
getPolicyBizId
,
LinkedHashMap:
:
new
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
list
->
list
.
get
(
0
).
getName
()
// 中文名
)
));
Map
<
String
,
String
>
insurantNameEnMap
=
allInsurants
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
PolicyInsurant:
:
getPolicyBizId
,
LinkedHashMap:
:
new
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
list
->
list
.
get
(
0
).
getNameEn
()
// 英文名
)
));
// 统一填充 VO
voList
.
forEach
(
vo
->
{
vo
.
setBrokerName
(
brokerNameMap
.
get
(
vo
.
getPolicyBizId
()));
vo
.
setPolicyHolder
(
holderNameMap
.
get
(
vo
.
getPolicyBizId
()));
vo
.
setPolicyHolderEn
(
holderNameEnMap
.
get
(
vo
.
getPolicyBizId
()));
vo
.
setInsured
(
insurantNameMap
.
get
(
vo
.
getPolicyBizId
()));
vo
.
setInsuredEn
(
insurantNameEnMap
.
get
(
vo
.
getPolicyBizId
()));
});
}
@Override
...
...
@@ -249,6 +403,11 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
.
update
();
}
//更新新单投保人表和新单受保人表的中文名和简体中文名
//更新新单投保人表信息
policyPolicyholderService
.
updateName
(
policyBizId
,
policyFollowDto
.
getPolicyHolder
());
//更新新单受保人表信息
policyInsurantService
.
updateName
(
policyBizId
,
policyFollowDto
.
getPolicyHolder
());
return
true
;
}
...
...
@@ -1138,5 +1297,203 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
}
return
policySecondHolderService
.
updatePolicySecondHolder
(
policySecondHolderUpdateRequest
);
}
/**
* 根据保单号查询新单跟进详情
* @param policyNo
* @return
*/
@Override
public
Result
<
ApiPolicyFollowDetailResponse
>
detail
(
String
policyNo
){
if
(
StringUtils
.
isBlank
(
policyNo
))
{
throw
new
BusinessException
(
"保单号不能为空"
);
}
PolicyFollow
policyFollow
=
this
.
queryOneByPolicyNo
(
policyNo
);
if
(
policyFollow
==
null
)
{
throw
new
BusinessException
(
"新单跟进信息不存在"
);
}
ApiPolicyFollowDetailResponse
response
=
new
ApiPolicyFollowDetailResponse
();
BeanUtils
.
copyProperties
(
policyFollow
,
response
);
return
Result
.
success
(
response
);
}
@Override
public
List
<
String
>
queryPolicyNoList
(
String
policyHolder
,
String
signer
,
String
brokerName
,
String
insured
)
{
// 投保人转换:中文转简体、英文转小写
String
policyHolderSc
=
ChineseTextConverter
.
traditionalToSimplified
(
policyHolder
);
String
policyHolderEnLc
=
EnglishTextUtil
.
toLowerCase
(
policyHolder
);
// 受保人转换:中文转简体、英文转小写
String
insuredSc
=
ChineseTextConverter
.
traditionalToSimplified
(
insured
);
String
insuredEnLc
=
EnglishTextUtil
.
toLowerCase
(
insured
);
return
this
.
baseMapper
.
queryPolicyNoList
(
policyHolderSc
,
policyHolderEnLc
,
signer
,
brokerName
,
insuredSc
,
insuredEnLc
);
}
/**
* 更新-新单跟进投保人和受保人的名字冗余字段
* @return
*/
@Override
public
Result
updateTs
()
{
int
pageSize
=
200
;
// 1. 更新投保人表
updatePolicyholderNameFields
(
pageSize
);
// 2. 更新受保人表
updateInsurantNameFields
(
pageSize
);
// 3. 更新客户表
updateCustomerNameFields
(
pageSize
);
log
.
info
(
"投保人/受保人名字冗余字段更新完成"
);
return
Result
.
success
(
"更新成功"
);
}
/**
* 批量处理 policy_policyholder 的 nameSc 和 nameEnLc
*/
private
void
updatePolicyholderNameFields
(
int
pageSize
)
{
int
pageNo
=
1
;
while
(
true
)
{
Page
<
PolicyPolicyholder
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
Page
<
PolicyPolicyholder
>
resultPage
=
policyPolicyholderService
.
page
(
page
);
List
<
PolicyPolicyholder
>
records
=
resultPage
.
getRecords
();
if
(
CollUtil
.
isEmpty
(
records
))
{
break
;
}
List
<
PolicyPolicyholder
>
toUpdate
=
new
ArrayList
<>();
for
(
PolicyPolicyholder
entity
:
records
)
{
boolean
changed
=
false
;
// 繁体 → 简体
if
(
StringUtils
.
isNotBlank
(
entity
.
getName
()))
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getName
());
if
(!
nameSc
.
equals
(
entity
.
getNameSc
()))
{
entity
.
setNameSc
(
nameSc
);
changed
=
true
;
}
}
// 英文 → 小写
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameEn
()))
{
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
entity
.
getNameEn
());
if
(!
nameEnLc
.
equals
(
entity
.
getNameEnLc
()))
{
entity
.
setNameEnLc
(
nameEnLc
);
changed
=
true
;
}
}
if
(
changed
)
{
entity
.
setUpdateTime
(
new
Date
());
// 可选,记录更新时间
toUpdate
.
add
(
entity
);
}
}
if
(!
toUpdate
.
isEmpty
())
{
policyPolicyholderService
.
updateBatchById
(
toUpdate
);
}
pageNo
++;
}
}
/**
* 批量处理 policy_insurant 的 nameSc 和 nameEnLc
*/
private
void
updateInsurantNameFields
(
int
pageSize
)
{
int
pageNo
=
1
;
while
(
true
)
{
Page
<
PolicyInsurant
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
Page
<
PolicyInsurant
>
resultPage
=
policyInsurantService
.
page
(
page
);
List
<
PolicyInsurant
>
records
=
resultPage
.
getRecords
();
if
(
CollUtil
.
isEmpty
(
records
))
{
break
;
}
List
<
PolicyInsurant
>
toUpdate
=
new
ArrayList
<>();
for
(
PolicyInsurant
entity
:
records
)
{
boolean
changed
=
false
;
if
(
StringUtils
.
isNotBlank
(
entity
.
getName
()))
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getName
());
if
(!
nameSc
.
equals
(
entity
.
getNameSc
()))
{
entity
.
setNameSc
(
nameSc
);
changed
=
true
;
}
}
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameEn
()))
{
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
entity
.
getNameEn
());
if
(!
nameEnLc
.
equals
(
entity
.
getNameEnLc
()))
{
entity
.
setNameEnLc
(
nameEnLc
);
changed
=
true
;
}
}
if
(
changed
)
{
entity
.
setUpdateTime
(
new
Date
());
toUpdate
.
add
(
entity
);
}
}
if
(!
toUpdate
.
isEmpty
())
{
policyInsurantService
.
updateBatchById
(
toUpdate
);
}
pageNo
++;
}
}
/**
* 批量处理 customer 的 nameSc 和 nameEnLc
*/
private
void
updateCustomerNameFields
(
int
pageSize
)
{
int
pageNo
=
1
;
while
(
true
)
{
Page
<
Customer
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
Page
<
Customer
>
resultPage
=
customerService
.
page
(
page
);
List
<
Customer
>
records
=
resultPage
.
getRecords
();
if
(
CollUtil
.
isEmpty
(
records
))
{
break
;
}
List
<
Customer
>
toUpdate
=
new
ArrayList
<>();
for
(
Customer
entity
:
records
)
{
boolean
changed
=
false
;
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameCn
()))
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getNameCn
());
if
(!
nameSc
.
equals
(
entity
.
getNameSc
()))
{
entity
.
setNameSc
(
nameSc
);
changed
=
true
;
}
}
if
(
StringUtils
.
isNotBlank
(
entity
.
getNamePyEn
()))
{
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
entity
.
getNamePyEn
());
if
(!
nameEnLc
.
equals
(
entity
.
getNameEnLc
()))
{
entity
.
setNameEnLc
(
nameEnLc
);
changed
=
true
;
}
}
if
(
changed
)
{
entity
.
setUpdateTime
(
new
Date
());
toUpdate
.
add
(
entity
);
}
}
if
(!
toUpdate
.
isEmpty
())
{
customerService
.
updateBatchById
(
toUpdate
);
}
pageNo
++;
}
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyInsurantServiceImpl.java
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.csf.service.dto.PolicyInsurantUpdateRequest
;
import
com.yd.csf.service.model.PolicyInsurant
;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
com.yd.csf.service.service.PolicyInsurantService
;
import
com.yd.csf.service.dao.PolicyInsurantMapper
;
import
com.yd.csf.service.utils.GSONUtil
;
...
...
@@ -14,7 +19,9 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author Zhang Jianan
...
...
@@ -42,6 +49,36 @@ public class PolicyInsurantServiceImpl extends ServiceImpl<PolicyInsurantMapper,
policyInsurant
.
setUpdateTime
(
new
Date
());
return
this
.
updateById
(
policyInsurant
);
}
@Override
public
List
<
PolicyInsurant
>
queryList
(
String
insured
)
{
// 输入为空时直接返回空列表,避免无意义的全表查询
if
(
StringUtils
.
isBlank
(
insured
))
{
return
Collections
.
emptyList
();
}
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
insured
);
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
insured
);
return
this
.
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyInsurant
>()
.
and
(
wrapper
->
wrapper
.
like
(
StringUtils
.
isNotBlank
(
nameSc
),
PolicyInsurant:
:
getNameSc
,
nameSc
)
.
or
()
.
like
(
StringUtils
.
isNotBlank
(
nameEnLc
),
PolicyInsurant:
:
getNameEnLc
,
nameEnLc
)
)
);
}
@Override
public
boolean
updateName
(
String
policyBizId
,
String
name
)
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
name
);
return
this
.
update
(
new
UpdateWrapper
<
PolicyInsurant
>()
.
set
(
"name"
,
name
)
.
set
(
"name_sc"
,
nameSc
)
.
eq
(
"policy_biz_id"
,
policyBizId
));
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyPolicyholderServiceImpl.java
View file @
a574728d
...
...
@@ -2,19 +2,27 @@ package com.yd.csf.service.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.csf.service.dto.PolicyPolicyholderUpdateRequest
;
import
com.yd.csf.service.enums.FnaStatusEnum
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
com.yd.csf.service.service.PolicyPolicyholderService
;
import
com.yd.csf.service.dao.PolicyPolicyholderMapper
;
import
com.yd.csf.service.utils.GSONUtil
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author Zhang Jianan
...
...
@@ -48,6 +56,36 @@ public class PolicyPolicyholderServiceImpl extends ServiceImpl<PolicyPolicyholde
return
this
.
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
PolicyPolicyholder
>()
.
eq
(
PolicyPolicyholder:
:
getPolicyBizId
,
policyBizId
).
last
(
" limit 1 "
));
}
@Override
public
List
<
PolicyPolicyholder
>
queryList
(
String
policyHolder
)
{
// 输入为空时直接返回空列表,避免无意义的全表查询
if
(
StringUtils
.
isBlank
(
policyHolder
))
{
return
Collections
.
emptyList
();
}
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
policyHolder
);
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
policyHolder
);
return
this
.
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyPolicyholder
>()
.
and
(
wrapper
->
wrapper
.
like
(
StringUtils
.
isNotBlank
(
nameSc
),
PolicyPolicyholder:
:
getNameSc
,
nameSc
)
.
or
()
.
like
(
StringUtils
.
isNotBlank
(
nameEnLc
),
PolicyPolicyholder:
:
getNameEnLc
,
nameEnLc
)
)
);
}
@Override
public
boolean
updateName
(
String
policyBizId
,
String
name
)
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
name
);
return
this
.
update
(
new
UpdateWrapper
<
PolicyPolicyholder
>()
.
set
(
"name"
,
name
)
.
set
(
"name_sc"
,
nameSc
)
.
eq
(
"policy_biz_id"
,
policyBizId
));
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/utils/BusinessNoUtils.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
utils
;
import
java.util.concurrent.ThreadLocalRandom
;
/**
* 业务编号生成工具类
* <p>格式:出账年月 + 转介人内部编号后6位(无则补0) + 6位随机数字</p>
*/
public
class
BusinessNoUtils
{
/**
* 生成业务编号
*
* @param billingYearMonth 出账年月,如 "202604"
* @param referrerInnerNo 转介人内部编号,可为 null 或空字符串
* @return 完整的业务编号字符串
*/
public
static
String
generate
(
String
billingYearMonth
,
String
referrerInnerNo
)
{
String
referrerPart
=
formatReferrerInnerNo
(
referrerInnerNo
);
String
serialPart
=
generateRandomSerial
();
return
billingYearMonth
+
referrerPart
+
serialPart
;
}
// 格式化转介人内部编号:取后6位,不足左补0,无则全0
private
static
String
formatReferrerInnerNo
(
String
referrerInnerNo
)
{
if
(
referrerInnerNo
==
null
||
referrerInnerNo
.
trim
().
isEmpty
())
{
return
"000000"
;
}
String
no
=
referrerInnerNo
.
trim
();
if
(
no
.
length
()
>
6
)
{
return
no
.
substring
(
no
.
length
()
-
6
);
}
return
String
.
format
(
"%6s"
,
no
).
replace
(
' '
,
'0'
);
}
// 生成6位随机数字(000000~999999)
private
static
String
generateRandomSerial
()
{
int
random
=
ThreadLocalRandom
.
current
().
nextInt
(
1000000
);
return
String
.
format
(
"%06d"
,
random
);
}
}
\ No newline at end of file
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedExportNewDTO.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.ContentRowHeight
;
import
com.alibaba.excel.annotation.write.style.HeadRowHeight
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yd.csf.service.model.CommissionExpected
;
import
lombok.Data
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.BeanUtils
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
@ContentRowHeight
(
15
)
@HeadRowHeight
(
20
)
@ColumnWidth
(
20
)
public
class
CommissionExpectedExportNewDTO
{
/**
* 是否实收:1-预计(预计来佣记录) 2-实收(保单来佣表记录)*
*/
@ExcelProperty
(
"是否实收"
)
private
String
typeName
;
/**
* 应收款类型 R=关联保单应收单 U=非关联保单应收单
*/
@ExcelProperty
(
"应收单类型"
)
private
String
commissionBizType
;
/**
* 组编号(应收单编号)*
*/
@ExcelProperty
(
"应收单编号"
)
private
String
no
;
/**
* 预计来佣-保单号
*/
@ExcelProperty
(
"保单号"
)
private
String
policyNo
;
/**
* 预计来佣-对账公司
*/
@ExcelProperty
(
"对账公司"
)
private
String
reconciliationCompany
;
/**
* 预计来佣-入账状态 0=待入账 1=完成入账 2=部分入账 3=已失效
*/
@ExcelProperty
(
"入账状态"
)
private
String
status
;
/**
* 预计来佣-佣金期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
*/
@ExcelProperty
(
"入账期数"
)
private
Integer
commissionPeriod
;
/**
* 预计来佣-总来佣期数
*/
@ExcelProperty
(
"入账总期数"
)
private
Integer
totalPeriod
;
/**
* 预计来佣-来佣名称(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)
*/
@ExcelProperty
(
"入账项目"
)
private
String
commissionName
;
/**
* 预计来佣-入账年月(估) * (预计来佣日期)
*/
@ExcelProperty
(
"入账年月(估)"
)
@DateTimeFormat
(
"yyyyMM"
)
private
Date
commissionDateMonth
;
/**
* 入账检核记录-入账年月实(来佣日期 yyyyMM)
*/
@ExcelProperty
(
"入账年月(实)"
)
@DateTimeFormat
(
"yyyyMM"
)
private
Date
commissionDate
;
/**
* 预计来佣-已入账来佣比例 (%) ( 累积已入账比例 = 预计来佣实佣率realRate/产品对应来佣率)
*/
@ExcelProperty
(
"累积已入账比例"
)
private
BigDecimal
totalRevenueRatio
;
/**
* 预计来佣-预计入账比例 (%)(产品对应来佣率)
*/
@ExcelProperty
(
"产品对应来佣率"
)
private
BigDecimal
commissionRatio
;
/**
* 入账检核记录-实佣率(入账金额/结算汇率/期交保费) *
* 如果这里是否实收是预计:realRate统计当前预计下面的实际来拥记录的实佣率累加和
* 如果这里是否实收是实收:realRate取realCurrentCommissionRatio赋值
*/
@ExcelProperty
(
"实佣率"
)
private
BigDecimal
realRate
;
/**
* 达成率缺口(1-实佣率/产品对应来佣率)*
*/
@ExcelProperty
(
"达成率缺口"
)
private
BigDecimal
gapRate
;
/**
* 入账检核记录-当前结算汇率(结算汇率(实))
*/
@ExcelProperty
(
"结算汇率实"
)
private
BigDecimal
realExchangeRate
;
/**
* 入账检核记录-来佣金额(已入账金额)(预计类型需要统计累计和值)
*/
@ExcelProperty
(
"已入账金额"
)
private
BigDecimal
realAmount
;
/**
* 入账检核记录-入账检核年月 yyyyMM(检核年月)
*/
@ExcelProperty
(
"检核年月"
)
private
String
realReconciliationYearMonth
;
/**
* 入账检核记录-本次入账比例(实佣率/产品对应来佣率)
*/
@ExcelProperty
(
"本次入账比例"
)
private
BigDecimal
revenueRatio
;
/**
* 预计来佣-待入账金额
*/
@ExcelProperty
(
"待入账金额"
)
private
BigDecimal
pendingAmount
;
/**
* 预计来佣-预计入账金额(HKD)
*/
@ExcelProperty
(
"预计入账金额"
)
private
BigDecimal
expectedAmount
;
/**
* 预计来佣-结算汇率(估)
*/
@ExcelProperty
(
"结算汇率估"
)
private
BigDecimal
defaultExchangeRate
;
/**
* 预计来佣-保险公司
*/
@ExcelProperty
(
"保险公司"
)
private
String
insuranceCompany
;
/**
* 预计来佣-产品计划名称
*/
@ExcelProperty
(
"产品计划"
)
private
String
productName
;
/**
* 年期(供款年期)
*/
@ExcelProperty
(
"年期"
)
private
Integer
issueNumber
;
/**
* 预计来佣-保单币种
*/
@ExcelProperty
(
"保单币种"
)
private
String
policyCurrency
;
/**
* 预计来佣-期交保费
*/
@ExcelProperty
(
"期交保费"
)
private
String
premium
;
/**
* 入账检核记录-通用备注
*/
@ExcelProperty
(
"备注"
)
private
String
realRemark
;
/**
* 入账检核记录-更新人名称
*/
@ExcelProperty
(
"操作人"
)
private
String
realUpdaterName
;
/**
* 入账检核记录-更新时间
*/
@ExcelProperty
(
"操作时间"
)
@DateTimeFormat
(
"yyyy-MM-dd HH:mm:ss"
)
@ColumnWidth
(
20
)
private
Date
realUpdateTime
;
/**
* 将对象转换为导出DTO
*/
public
static
CommissionExpectedExportNewDTO
convertToExportDTO
(
CommissionExpectedNewVO
vo
)
{
CommissionExpectedExportNewDTO
dto
=
new
CommissionExpectedExportNewDTO
();
BeanUtils
.
copyProperties
(
vo
,
dto
);
dto
.
setTypeName
(
vo
.
getType
()
==
1
?
"预计"
:
"实收"
);
dto
.
setCommissionBizType
(
"R"
.
equals
(
vo
.
getCommissionBizType
())
?
"关联保单应收单"
:
"非关联保单应收单"
);
dto
.
setStatus
(
getStatusText
(
vo
.
getStatus
()));
dto
.
setPremium
(
vo
.
getPremium
()
!=
null
?
vo
.
getPremium
().
toString
()
:
""
);
return
dto
;
}
/**
* 获取状态文本
*/
public
static
String
getStatusText
(
String
status
)
{
if
(
status
==
null
)
return
"未知"
;
switch
(
status
)
{
case
"0"
:
return
"待入账"
;
case
"1"
:
return
"完成入账"
;
case
"2"
:
return
"部分入账"
;
case
"3"
:
return
"已失效"
;
default
:
return
"未知"
;
}
}
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedNewVO.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yd.csf.service.model.Commission
;
import
com.yd.csf.service.model.CommissionExpected
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.BeanUtils
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
@Data
@Schema
(
description
=
"预计来佣响应"
)
public
class
CommissionExpectedNewVO
implements
Serializable
{
//===========公共字段=============
/**
* 是否实收:1-预计(预计来佣记录) 2-实收(保单来佣表记录)*
*/
private
Integer
type
;
/**
* 组编号(应收单编号)*
*/
private
String
no
;
//===========以下是预计来佣记录=============
/**
* 应收款类型 R=关联保单应收单 U=非关联保单应收单
*/
// @Schema(description = "应收款类型 R=关联保单应收单 U=非关联保单应收单")
private
String
commissionBizType
;
/**
* 预计来佣-保单号
*/
// @Schema(description = "保单号")
private
String
policyNo
;
/**
* 预计来佣-对账公司
*/
// @Schema(description = "对账公司")
private
String
reconciliationCompany
;
/**
* 预计来佣-对账公司业务ID
*/
// @Schema(description = "对账公司业务ID")
private
String
reconciliationCompanyBizId
;
/**
* 预计来佣-入账状态 0=待入账 1=完成入账 2=部分入账 3=已失效
*/
// @Schema(description = "入账状态 0=待入账 1=完成入账 2=部分入账 3=已失效 字典值: csf_expected_commission_status")
private
String
status
;
/**
* 预计来佣-佣金期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
*/
// @Schema(description = "佣金期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)")
private
Integer
commissionPeriod
;
/**
* 预计来佣-总来佣期数
*/
// @Schema(description = "总来佣期数")
private
Integer
totalPeriod
;
/**
* 预计来佣-来佣名称(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)
*/
// @Schema(description = "来佣名称(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)")
private
String
commissionName
;
/**
* 预计来佣-入账年月(估) * (预计来佣日期)
*/
// @Schema(description = "入账年月(估)")
@JsonFormat
(
pattern
=
"yyyyMM"
,
timezone
=
"GMT+8"
)
private
Date
commissionDateMonth
;
/**
* 入账检核记录-入账年月实(来佣日期 yyyyMM)
*/
@JsonFormat
(
pattern
=
"yyyyMM"
,
timezone
=
"GMT+8"
)
private
Date
commissionDate
;
/**
* 预计来佣-已入账来佣比例 (%) ( 累积已入账比例 = 预计来佣实佣率realRate/产品对应来佣率)
*/
// @Schema(description = "已入账来佣比例 (%)")
private
BigDecimal
totalRevenueRatio
;
/**
* 预计来佣-预计入账比例 (%)(产品对应来佣率)
*/
// @Schema(description = "预计入账比例 (%)")
private
BigDecimal
commissionRatio
;
/**
* 入账检核记录-实佣率(入账金额/结算汇率/期交保费) *
* 如果这里是否实收是预计:realRate统计当前预计下面的实际来拥记录的实佣率累加和
* 如果这里是否实收是实收:realRate取realCurrentCommissionRatio赋值
*/
// @Schema(description = "实佣率")
private
BigDecimal
realRate
;
/**
* 达成率缺口(1-实佣率/产品对应来佣率)*
*/
// @Schema(description = "实佣率")
private
BigDecimal
gapRate
;
/**
* 入账检核记录-当前结算汇率(结算汇率(实))
*/
// @Schema(description = "当前结算汇率")
private
BigDecimal
realExchangeRate
;
/**
* 入账检核记录-来佣金额(已入账金额)(预计类型需要统计累计和值)
*/
private
BigDecimal
realAmount
;
/**
* 入账检核记录-入账检核年月 yyyyMM(检核年月)
*/
// @Schema(description = "入账检核年月 yyyyMM")
private
String
realReconciliationYearMonth
;
/**
* 入账检核记录-本次入账比例(实佣率/产品对应来佣率)
*/
private
BigDecimal
revenueRatio
;
/**
* 预计来佣-待入账金额
*/
// @Schema(description = "待入账金额")
private
BigDecimal
pendingAmount
;
/**
* 预计来佣-预计入账金额(HKD)
*/
// @Schema(description = "预计入账金额(HKD)")
private
BigDecimal
expectedAmount
;
/**
* 预计来佣-结算汇率(估)
*/
// @Schema(description = "结算汇率(估)")
private
BigDecimal
defaultExchangeRate
;
/**
* 预计来佣-保险公司
*/
// @Schema(description = "保险公司")
private
String
insuranceCompany
;
/**
* 预计来佣-产品计划名称
*/
// @Schema(description = "产品计划名称")
private
String
productName
;
/**
* 年期(供款年期)
*/
private
Integer
issueNumber
;
/**
* 预计来佣-保单币种
*/
// @Schema(description = "保单币种")
private
String
policyCurrency
;
/**
* 预计来佣-期交保费
*/
// @Schema(description = "期交保费")
private
Object
premium
;
/**
* 入账检核记录-通用备注
*/
// @Schema(description = "备注")
private
String
realRemark
;
/**
* 入账检核记录-更新人名称
*/
private
String
realUpdaterName
;
/**
* 入账检核记录-更新时间
*/
// @Schema(description = "更新时间")
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
realUpdateTime
;
// /**
// * 预计来佣id
// */
// @Schema(description = "预计来佣id")
// private Long id;
//
// /**
// * 预计来佣业务id
// */
// @Schema(description = "预计来佣业务id")
// private String commissionExpectedBizId;
//
// /**
// * 应收账款编号
// */
// @Schema(description = "应收账款编号")
// private String receivableNo;
//
// /**
// * 应收款类型 R=关联保单应收单 U=非关联保单应收单
// */
// @Schema(description = "应收款类型 R=关联保单应收单 U=非关联保单应收单")
// private String commissionBizType;
//
// /**
// * 保险公司业务ID
// */
// @Schema(description = "保险公司业务ID")
// private String insuranceCompanyBizId;
//
// /**
// * 产品上架信息表唯一业务ID
// */
// @Schema(description = "产品计划: 产品上架信息表唯一业务ID")
// private String productLaunchBizId;
//
// /**
// * 来佣类型(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)
// */
// @Schema(description = "来佣类型(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)")
// private String commissionType;
//
// /**
// * 预计入账金额
// */
// @Schema(description = "预计入账金额 HKD(如果不关联保单,就没有预计入账比例,此时记录预计入账金额)")
// private BigDecimal amount;
//
// /**
// * 来佣币种
// */
// @Schema(description = "来佣币种")
// private String currency;
//
// /**
// * 预计来佣日期
// */
// @Schema(description = "预计来佣日期")
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// private Date commissionDate;
//
// /**
// * 设置入账状态-修改理由
// */
// @Schema(description = "设置入账状态-修改理由")
// private String statusDesc;
//
// /**
// * 已入账来佣金额(HKD)
// */
// @Schema(description = "已入账来佣金额(HKD)")
// private BigDecimal paidAmount;
//
// /**
// * 待入账比例
// */
// @Schema(description = "待入账比例")
// private BigDecimal pendingRatio;
//
// /**
// * 已入账来佣列表
// */
// @Schema(description = "已入账来佣列表")
// private List<Commission> commissionList;
//
// /**
// * 通用备注
// */
// @Schema(description = "备注")
// private String remark;
//
// /**
// * 创建人ID
// */
// @Schema(description = "创建人ID")
// private String creatorId;
//
// /**
// * 更新人ID
// */
// @Schema(description = "更新人ID")
// private String updaterId;
//
// /**
// * 创建时间
// */
// @Schema(description = "创建时间")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// private Date createTime;
//
// /**
// * 更新时间
// */
// @Schema(description = "更新时间")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// private Date updateTime;
//
//
// //===========以下是入账检核(保单来佣)记录=============
//
// /**
// * 入账检核记录-来佣日期(入账日实)
// */
// @Schema(description = "来佣日期(入账日实)")
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// private Date realCommissionDate;
//
/**
* 当前来佣比例 (实佣率=实际入账金额/结算汇率/每期保费)(入账比例)
*/
@Schema
(
description
=
"当前来佣比例 (实佣率=实际入账金额/结算汇率/每期保费)"
)
private
BigDecimal
realCurrentCommissionRatio
;
private
static
final
long
serialVersionUID
=
1L
;
// /**
// * 对象转封装类
// *
// * @param commissionExpected
// * @return
// */
// public static CommissionExpectedNewVO objToVo(CommissionExpected commissionExpected) {
// if (commissionExpected == null) {
// return null;
// }
// CommissionExpectedNewVO commissionVO = new CommissionExpectedNewVO();
// BeanUtils.copyProperties(commissionExpected, commissionVO);
//
// BigDecimal paidAmount1 = ObjectUtils.defaultIfNull(commissionExpected.getPaidAmount(), BigDecimal.ZERO);
// BigDecimal paidRatio1 = ObjectUtils.defaultIfNull(commissionExpected.getPaidRatio(), BigDecimal.ZERO);
//
// // 待入账比例、待入账金额
// if (commissionExpected.getCommissionRatio() != null) {
// commissionVO.setPaidRatio(paidRatio1);
// commissionVO.setPendingRatio(commissionExpected.getCommissionRatio().subtract(paidRatio1));
// if (commissionExpected.getExpectedAmount() != null) {
// commissionVO.setPaidAmount(paidAmount1);
// commissionVO.setPendingAmount(commissionExpected.getExpectedAmount().subtract(paidAmount1));
// }
// return commissionVO;
// } else {
// commissionVO.setPaidAmount(paidAmount1);
// commissionVO.setPendingAmount(commissionExpected.getAmount().subtract(paidAmount1));
//
// return commissionVO;
// }
// }
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedStatisticsNewVO.java
0 → 100644
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
vo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* 应收款管理统计VO
*/
@Data
public
class
CommissionExpectedStatisticsNewVO
{
/**
* 预计入账金额(HKD)
*/
// @Schema(description = "预计入账金额(HKD)")
private
BigDecimal
totalAmount
;
/**
* 已入账金额(HKD)
*/
// @Schema(description = "已入账金额(HKD)")
private
BigDecimal
totalPaidAmount
;
/**
* 待入账金额(HKD)
*/
// @Schema(description = "待入账金额(HKD)")
private
BigDecimal
pendingPaidAmount
;
/**
* 已入账比例 %(已入账金额/总金额)
*/
// @Schema(description = "已入账比例 %(已入账金额/总金额)")
private
BigDecimal
paidAmountRatio
;
/**
* 总保单数
*/
// @Schema(description = "总保单数")
private
Integer
totalPolicyCount
;
/**
* 总保费(HKD)
*/
// @Schema(description = "总保费(HKD)")
private
BigDecimal
totalPremium
;
/**
* 原币种总保费
*/
private
BigDecimal
fromTotalPremium
;
@JsonIgnore
private
String
policyNos
;
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedStatisticsVO.java
View file @
a574728d
...
...
@@ -14,39 +14,83 @@ public class CommissionExpectedStatisticsVO {
/**
* 预计入账金额(HKD)
*/
@Schema
(
description
=
"预计入账金额(HKD)"
)
//
@Schema(description = "预计入账金额(HKD)")
private
BigDecimal
totalAmount
;
/**
* 已入账金额(HKD)
*/
@Schema
(
description
=
"已入账金额(HKD)"
)
//
@Schema(description = "已入账金额(HKD)")
private
BigDecimal
totalPaidAmount
;
/**
* 待入账金额(HKD)
*/
@Schema
(
description
=
"待入账金额(HKD)"
)
//
@Schema(description = "待入账金额(HKD)")
private
BigDecimal
pendingPaidAmount
;
/**
* 已入账比例 %(已入账金额/总金额)
*/
@Schema
(
description
=
"已入账比例 %(已入账金额/总金额)"
)
//
@Schema(description = "已入账比例 %(已入账金额/总金额)")
private
BigDecimal
paidAmountRatio
;
/**
* 总保单数
*/
@Schema
(
description
=
"总保单数"
)
//
@Schema(description = "总保单数")
private
Integer
totalPolicyCount
;
/**
* 总保费(HKD)
*/
@Schema
(
description
=
"总保费(HKD)"
)
//
@Schema(description = "总保费(HKD)")
private
BigDecimal
totalPremium
;
/**
* 原币种总保费
*/
private
BigDecimal
fromTotalPremium
;
@JsonIgnore
private
String
policyNos
;
// /**
// * 预计入账金额(HKD)
// */
// @Schema(description = "预计入账金额(HKD)")
// private BigDecimal totalAmount;
//
// /**
// * 已入账金额(HKD)
// */
// @Schema(description = "已入账金额(HKD)")
// private BigDecimal totalPaidAmount;
//
// /**
// * 待入账金额(HKD)
// */
// @Schema(description = "待入账金额(HKD)")
// private BigDecimal pendingPaidAmount;
//
// /**
// * 已入账比例 %(已入账金额/总金额)
// */
// @Schema(description = "已入账比例 %(已入账金额/总金额)")
// private BigDecimal paidAmountRatio;
//
// /**
// * 总保单数
// */
// @Schema(description = "总保单数")
// private Integer totalPolicyCount;
//
// /**
// * 总保费(HKD)
// */
// @Schema(description = "总保费(HKD)")
// private BigDecimal totalPremium;
//
// @JsonIgnore
// private String policyNos;
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/FnaVO.java
View file @
a574728d
...
...
@@ -142,6 +142,12 @@ public class FnaVO implements Serializable {
private
Date
createTime
;
/**
* 创建人名称
*/
@Schema
(
description
=
"创建人名称"
)
private
String
creatorName
;
/**
* 封装类转对象
*
* @param fnaVO
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneAccountVO.java
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yd.csf.service.model.FortuneAccount
;
import
io.swagger.v3.oas.annotations.media.Schema
;
...
...
@@ -26,6 +27,12 @@ public class FortuneAccountVO {
private
String
fortuneAccountBizId
;
/**
* 出账业务编号(出账年月 + 转介人内部编号(后6位)(如无,用0补齐)+流水号(6位))
*/
@Schema
(
description
=
"出账业务编号"
)
private
String
businessNo
;
/**
* 转介人
*/
@Schema
(
description
=
"转介人"
)
...
...
@@ -69,6 +76,13 @@ public class FortuneAccountVO {
private
Date
fortuneAccountDate
;
/**
* 出账月
*/
@Schema
(
description
=
"出账月"
)
@JsonFormat
(
pattern
=
"yyyyMM"
,
timezone
=
"GMT+8"
)
private
Date
fortuneAccountMonth
;
/**
* 出账信息
*/
@Schema
(
description
=
"出账信息"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
View file @
a574728d
...
...
@@ -42,12 +42,24 @@ public class FortuneVO implements Serializable {
private
String
fortuneBizType
;
/**
* 是否拆分出来的出账 1-是 0-否 2-拆分的原纪录
*/
@Schema
(
description
=
"是否拆分出来的出账 1-是 0-否 2-拆分的原纪录"
)
private
Integer
isPart
;
/**
* 预计出账业务ID
*/
@Schema
(
description
=
"预计出账业务ID"
)
private
String
expectedFortuneBizId
;
/**
* 应付账款编号
*/
@Schema
(
description
=
"应付账款编号"
)
private
String
payableNo
;
/**
* 保单号
*/
@Schema
(
description
=
"保单号"
)
...
...
@@ -156,24 +168,60 @@ public class FortuneVO implements Serializable {
private
String
fortuneType
;
/**
*
出账
金额
*
保单币种
金额
*/
@Schema
(
description
=
"
应出账
金额"
)
private
BigDecimal
a
mount
;
@Schema
(
description
=
"
保单币种
金额"
)
private
BigDecimal
ruleA
mount
;
/**
*
出账
币种
*
保单
币种
*/
@Schema
(
description
=
"
出账
币种"
)
private
String
c
urrency
;
@Schema
(
description
=
"
保单
币种"
)
private
String
ruleC
urrency
;
/**
*
结算汇率
*
保单币种→港币汇率(入账检核汇率)
*/
@Schema
(
description
=
"
结算汇率
"
)
@Schema
(
description
=
"
保单币种→港币汇率(入账检核汇率)
"
)
private
BigDecimal
exchangeRate
;
/**
* 原币种
*/
@Schema
(
description
=
"原币种"
)
private
String
originalCurrency
;
/**
* 原币种金额
*/
@Schema
(
description
=
"原币种金额"
)
private
BigDecimal
originalAmount
;
/**
* 原币种→港币汇率
*/
@Schema
(
description
=
"原币种→港币汇率"
)
private
BigDecimal
originalToHkdRate
;
/**
* 发放币种
*/
@Schema
(
description
=
"发放币种"
)
private
String
payoutCurrency
;
/**
* 发放币种金额
*/
@Schema
(
description
=
"发放币种金额"
)
private
BigDecimal
payoutAmount
;
/**
* 港币→发放币种汇率
*/
@Schema
(
description
=
"港币→发放币种汇率"
)
private
BigDecimal
hkdToPayoutRate
;
/**
* 港币出账金额
*/
@Schema
(
description
=
"港币出账金额"
)
...
...
@@ -317,6 +365,7 @@ public class FortuneVO implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
/**
* 对象转封装类
*
...
...
@@ -329,21 +378,33 @@ public class FortuneVO implements Serializable {
}
FortuneVO
fortuneVO
=
new
FortuneVO
();
BeanUtils
.
copyProperties
(
fortune
,
fortuneVO
);
// 计算已出账金额和待出账金额
BigDecimal
currentPaymentHkdAmount
=
"2"
.
equals
(
fortune
.
getStatus
())
?
fortune
.
getCurrentPaymentHkdAmount
()
:
BigDecimal
.
ZERO
;
// 安全获取港币金额,避免 null
BigDecimal
hkdAmount
=
ObjectUtil
.
defaultIfNull
(
fortune
.
getHkdAmount
(),
BigDecimal
.
ZERO
);
// 已出账金额(status=2 时取 currentPaymentHkdAmount,否则为 0)
BigDecimal
currentPaymentHkdAmount
=
"2"
.
equals
(
fortune
.
getStatus
())
?
ObjectUtil
.
defaultIfNull
(
fortune
.
getCurrentPaymentHkdAmount
(),
BigDecimal
.
ZERO
)
:
BigDecimal
.
ZERO
;
fortuneVO
.
setFortunePaidAmount
(
currentPaymentHkdAmount
);
fortuneVO
.
setFortuneUnpaidAmount
(
NumberUtil
.
sub
(
fortune
.
getHkdAmount
(),
currentPaymentHkdAmount
));
// 计算已出账比例
BigDecimal
currentPaymentRatio
=
NumberUtil
.
div
(
currentPaymentHkdAmount
,
fortune
.
getHkdAmount
(),
4
)
fortuneVO
.
setFortuneUnpaidAmount
(
NumberUtil
.
sub
(
hkdAmount
,
currentPaymentHkdAmount
));
// 计算已出账比例,分母为 0 时直接设为 0%
BigDecimal
currentPaymentRatio
;
if
(
hkdAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
currentPaymentRatio
=
BigDecimal
.
ZERO
;
}
else
{
currentPaymentRatio
=
NumberUtil
.
div
(
currentPaymentHkdAmount
,
hkdAmount
,
4
)
.
multiply
(
BigDecimal
.
valueOf
(
100
));
}
fortuneVO
.
setCurrentPaymentRatio
(
currentPaymentRatio
);
// 计算剩余出账比例
fortuneVO
.
setFortuneUnpaidRatio
(
BigDecimal
.
valueOf
(
100
).
subtract
(
currentPaymentRatio
));
fortuneVO
.
setCurrency
(
CurrencyEnum
.
toLabel
(
fortune
.
getCurrency
()));
//
fortuneVO.setCurrency(CurrencyEnum.toLabel(fortune.getCurrency()));
fortuneVO
.
setPolicyCurrency
((
CurrencyEnum
.
toLabel
(
fortune
.
getPolicyCurrency
())));
return
fortuneVO
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/PayableReportVO.java
View file @
a574728d
...
...
@@ -134,4 +134,14 @@ public class PayableReportVO {
*/
@Schema
(
description
=
"产品计划"
)
private
String
productName
;
/**
* 保單持有人(投保人,保单表)(中文名)
*/
private
String
policyHolder
;
/**
* 保單持有人(投保人,保单表)(英文名)
*/
private
String
policyHolderEn
;
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowVO.java
View file @
a574728d
...
...
@@ -9,6 +9,7 @@ import lombok.Data;
import
org.springframework.beans.BeanUtils
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.*
;
/**
...
...
@@ -93,12 +94,24 @@ public class PolicyFollowVO implements Serializable {
private
String
policyHolder
;
/**
* 保單持有人-英文
*/
@Schema
(
description
=
"投保人-英文"
)
private
String
policyHolderEn
;
/**
* 受保人
*/
@Schema
(
description
=
"受保人"
)
private
String
insured
;
/**
* 受保人-英文
*/
@Schema
(
description
=
"受保人-英文"
)
private
String
insuredEn
;
/**
* 受保人业务id
*/
@Schema
(
description
=
"受保人业务id"
)
...
...
@@ -153,6 +166,27 @@ public class PolicyFollowVO implements Serializable {
private
String
mailingItem
;
/**
* 转介人名称(取保单转介人表第一个)
*/
private
String
brokerName
;
/**
* 每期保费
*/
private
BigDecimal
eachIssuePremium
;
/**
* 签单人
*/
private
String
signer
;
/**
* 冷静期结束日期
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
coolingOffEndDate
;
/**
* 对象转封装类
*
* @param policyFollow
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/ReceivableReportVO.java
View file @
a574728d
package
com
.
yd
.
csf
.
service
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
@@ -138,4 +139,30 @@ public class ReceivableReportVO {
*/
@Schema
(
description
=
"保单币种"
)
private
String
policyCurrency
;
/**
* 备注
*/
@Schema
(
description
=
"备注"
)
private
String
remark
;
/**
* 保單持有人(投保人,保单表)(中文名)
*/
private
String
policyHolder
;
/**
* 保單持有人(投保人,保单表)(英文名)
*/
private
String
policyHolderEn
;
/**
* 受保人
*/
private
String
insured
;
/**
* 受保人-英文
*/
private
String
insuredEn
;
}
yd-csf-service/src/main/resources/mappers/CommissionExpectedMapper.xml
View file @
a574728d
...
...
@@ -71,6 +71,11 @@
select
null as receivableNo,
ce.policy_no as policyNo,
(select pp.name from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolder,
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
(select pi.name from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insured,
(select pi.name_en from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insuredEn,
ce.remark,
MAX(ce.reconciliation_company) as reconciliationCompany,
MAX(ce.reconciliation_company_biz_id) as reconciliationCompanyBizId,
ce.commission_period as commissionPeriod,
...
...
@@ -112,6 +117,11 @@
select
ce.receivable_no as receivableNo,
ce.policy_no as policyNo,
(select pp.name from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolder,
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
(select pi.name from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insured,
(select pi.name_en from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insuredEn,
ce.remark,
ce.reconciliation_company as reconciliationCompany,
ce.reconciliation_company_biz_id as reconciliationCompanyBizId,
ce.commission_period as commissionPeriod,
...
...
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
View file @
a574728d
...
...
@@ -48,6 +48,7 @@
#{item}
</foreach>
</if>
AND ef.is_part in (0,1)
</where>
</select>
...
...
@@ -55,6 +56,8 @@
select
null as payable_no,
ef.policy_no as policyNo,
(select pp.name from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolder,
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
MAX(ef.premium) as premium,
MAX(ef.insurance_company_biz_id) as insuranceCompanyBizId,
MAX(p.insurance_company) as insuranceCompany,
...
...
@@ -62,9 +65,9 @@
MAX(p.product_name) as productName,
ef.fortune_period as fortunePeriod,
MAX(ef.fortune_total_period) as fortuneTotalPeriod,
ifnull(sum(ef.amount), 0) as amount,
ifnull(sum(ef.
original_
amount), 0) as amount,
ifnull(sum(ef.hkd_amount), 0) as hkdAmount,
MAX(ef.currency) as currency,
MAX(ef.
original_
currency) as currency,
ifnull(sum(ef.paid_amount), 0) as paidAmount,
ifnull(sum(ef.unpaid_amount), 0) as unpaidAmount,
case when ifnull(sum(ef.hkd_amount), 0) > 0
...
...
@@ -108,6 +111,8 @@
select
ef.payable_no as payable_no,
ef.policy_no as policyNo,
(select pp.name from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolder,
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
ef.premium as premium,
ef.insurance_company_biz_id as insuranceCompanyBizId,
p.insurance_company as insuranceCompany,
...
...
@@ -115,9 +120,9 @@
p.product_name as productName,
ef.fortune_period as fortunePeriod,
ef.fortune_total_period as fortuneTotalPeriod,
ifnull(ef.amount, 0) as amount,
ifnull(ef.
original_
amount, 0) as amount,
ifnull(ef.hkd_amount, 0) as hkdAmount,
ef.currency as currency,
ef.
original_
currency as currency,
ifnull(ef.paid_amount, 0) as paidAmount,
ifnull(ef.unpaid_amount, 0) as unpaidAmount,
case when ifnull(ef.hkd_amount, 0) > 0
...
...
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
View file @
a574728d
...
...
@@ -8,6 +8,7 @@
<id
property=
"id"
column=
"id"
/>
<result
property=
"fortuneBizId"
column=
"fortune_biz_id"
/>
<result
property=
"expectedFortuneBizId"
column=
"expected_fortune_biz_id"
/>
<result
property=
"payableNo"
column=
"payable_no"
/>
<result
property=
"reconciliationYearMonth"
column=
"reconciliation_year_month"
/>
<result
property=
"fortuneBizType"
column=
"fortune_biz_type"
/>
<result
property=
"isPart"
column=
"is_part"
/>
...
...
@@ -51,7 +52,7 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
id,fortune_biz_id,expected_fortune_biz_id,reconciliation_year_month,fortune_biz_type,batch_biz_id,
id,fortune_biz_id,expected_fortune_biz_id,
payable_no,
reconciliation_year_month,fortune_biz_type,batch_biz_id,
commission_biz_id,commission_expected_biz_id,policy_no,policy_currency,fortune_period,fortune_total_period,broker_biz_id,
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,
...
...
@@ -79,6 +80,7 @@
#{fortuneId}
</foreach>
</if>
AND f.is_part in (0,1)
GROUP BY f.policy_no
</select>
...
...
yd-csf-service/src/main/resources/mappers/PolicyFollowMapper.xml
View file @
a574728d
...
...
@@ -130,4 +130,65 @@
left join policy_insurant i on t.policy_biz_id = i.policy_biz_id
where t.policy_biz_id = #{policyBizId}
</select>
<select
id=
"queryPolicyNoList"
resultType=
"java.lang.String"
>
select distinct pf.policy_no
from policy_follow pf
left join policy_policyholder pp
on pf.policy_biz_id = pp.policy_biz_id
and pp.is_deleted = 0
left join policy_insurant pi
on pf.policy_biz_id = pi.policy_biz_id
and pi.is_deleted = 0
left join (
select pb.policy_biz_id, pb.broker_name
from policy_broker pb
inner join (
select policy_biz_id, min(id) as min_id
from policy_broker
where is_deleted = 0
group by policy_biz_id
) t on pb.id = t.min_id
) first_broker
on pf.policy_biz_id = first_broker.policy_biz_id
<where>
pf.is_deleted = 0
<!-- 投保人:简体中文或英文小写,满足其一即可 -->
<if
test=
"(policyHolderSc != null and policyHolderSc != '') or (policyHolderEnLc != null and policyHolderEnLc != '')"
>
and (
<if
test=
"policyHolderSc != null and policyHolderSc != ''"
>
pp.name_sc like concat('%', #{policyHolderSc}, '%')
</if>
<if
test=
"policyHolderSc != null and policyHolderSc != '' and policyHolderEnLc != null and policyHolderEnLc != ''"
>
or
</if>
<if
test=
"policyHolderEnLc != null and policyHolderEnLc != ''"
>
pp.name_en_lc like concat('%', #{policyHolderEnLc}, '%')
</if>
)
</if>
<!-- 受保人:简体中文或英文小写,满足其一即可 -->
<if
test=
"(insuredSc != null and insuredSc != '') or (insuredEnLc != null and insuredEnLc != '')"
>
and (
<if
test=
"insuredSc != null and insuredSc != ''"
>
pi.name_sc like concat('%', #{insuredSc}, '%')
</if>
<if
test=
"insuredSc != null and insuredSc != '' and insuredEnLc != null and insuredEnLc != ''"
>
or
</if>
<if
test=
"insuredEnLc != null and insuredEnLc != ''"
>
pi.name_en_lc like concat('%', #{insuredEnLc}, '%')
</if>
)
</if>
<if
test=
"signer != null and signer != ''"
>
and pf.signer like concat('%', #{signer}, '%')
</if>
<if
test=
"brokerName != null and brokerName != ''"
>
and first_broker.broker_name like concat('%', #{brokerName}, '%')
</if>
</where>
</select>
</mapper>
yd-csf-service/src/main/resources/mappers/PremiumReconciliationMapper.xml
View file @
a574728d
...
...
@@ -22,8 +22,10 @@
pr.recognized_currency,
prm_total.payer,
prm_total.paying_bank,
p.policy_holder,
p.insured,
pp.name AS policyHolder,
pp.name_en AS policyHolderEn,
pi.name AS insured,
pi.name_en AS insuredEn,
pb.broker_name AS brokerName,
pr.create_time,
pr.update_time,
...
...
@@ -31,6 +33,8 @@
FROM premium_reconciliation pr
LEFT JOIN policy p ON p.policy_no = pr.policy_no AND p.is_deleted = 0
LEFT JOIN policy_follow pf ON pf.policy_no = pr.policy_no AND pf.is_deleted = 0
LEFT JOIN policy_policyholder pp ON pp.policy_biz_id = pf.policy_biz_id AND pp.is_deleted = 0
LEFT JOIN policy_insurant pi ON pi.policy_biz_id = pf.policy_biz_id AND pi.is_deleted = 0
LEFT JOIN (
SELECT
premium_reconciliation_biz_id,
...
...
@@ -71,9 +75,6 @@
<if
test=
"request.appointmentNo != null and request.appointmentNo != ''"
>
AND pf.appointment_no LIKE CONCAT('%', #{request.appointmentNo}, '%')
</if>
<if
test=
"request.policyHolder != null and request.policyHolder != ''"
>
AND p.policy_holder LIKE CONCAT('%', #{request.policyHolder}, '%')
</if>
<if
test=
"request.paymentMethod != null and request.paymentMethod != ''"
>
AND prm_total.payment_method LIKE CONCAT('%', #{request.paymentMethod}, '%')
</if>
...
...
@@ -86,13 +87,38 @@
<if
test=
"request.reconciliationType != null and request.reconciliationType != ''"
>
AND pr.reconciliation_type = #{request.reconciliationType}
</if>
<choose>
<when
test=
"request.paymentDate != null"
>
AND prm_total.premium_reconciliation_biz_id IS NOT NULL
</when>
<otherwise>
</otherwise>
</choose>
<!-- 投保人查询:支持中文繁/简体和英文大小写 -->
<if
test=
"request.policyHolderNameSc != null and request.policyHolderNameSc != ''
or request.policyHolderNameEnLc != null and request.policyHolderNameEnLc != ''"
>
AND (
<if
test=
"request.policyHolderNameSc != null and request.policyHolderNameSc != ''"
>
pp.name LIKE CONCAT('%', #{request.policyHolderNameSc}, '%')
</if>
<if
test=
"request.policyHolderNameSc != null and request.policyHolderNameSc != ''
and request.policyHolderNameEnLc != null and request.policyHolderNameEnLc != ''"
>
OR
</if>
<if
test=
"request.policyHolderNameEnLc != null and request.policyHolderNameEnLc != ''"
>
pp.name_en LIKE CONCAT('%', #{request.policyHolderNameEnLc}, '%')
</if>
)
</if>
<!-- 受保人查询:支持中文繁/简体和英文大小写 -->
<if
test=
"request.insuredNameSc != null and request.insuredNameSc != ''
or request.insuredNameEnLc != null and request.insuredNameEnLc != ''"
>
AND (
<if
test=
"request.insuredNameSc != null and request.insuredNameSc != ''"
>
pi.name LIKE CONCAT('%', #{request.insuredNameSc}, '%')
</if>
<if
test=
"request.insuredNameSc != null and request.insuredNameSc != ''
and request.insuredNameEnLc != null and request.insuredNameEnLc != ''"
>
OR
</if>
<if
test=
"request.insuredNameEnLc != null and request.insuredNameEnLc != ''"
>
pi.name_en LIKE CONCAT('%', #{request.insuredNameEnLc}, '%')
</if>
)
</if>
ORDER BY pr.create_time DESC
</select>
</mapper>
\ No newline at end of file
yd-csf-service/src/main/resources/mappers/SalarySplitMapper.xml
View file @
a574728d
...
...
@@ -29,7 +29,8 @@
fa.amount,
fa.hkd_amount,
fa.currency,
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month,
fa.business_no
from salary_split ss
inner join fortune_account fa
on ss.fortune_account_biz_id = fa.fortune_account_biz_id
...
...
@@ -105,7 +106,8 @@
fa.amount,
fa.hkd_amount,
fa.currency,
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month,
fa.business_no
from salary_split ss
inner join fortune_account fa
on ss.fortune_account_biz_id = fa.fortune_account_biz_id
...
...
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