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
60a764a9
Commit
60a764a9
authored
Mar 10, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into prod
parents
fbf2e40f
63e7a263
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
1535 additions
and
183 deletions
+1535
-183
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
+1
-1
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCustomerController.java
+34
-5
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFnaCustomerController.java
+106
-0
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFnaFormController.java
+0
-1
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAdditionalServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentReferrerServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentServiceImpl.java
+7
-1
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentUserSignServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiBeneficiaryServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+110
-31
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiInsurantServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPolicyholderServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
+91
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiProductPlanServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSecondHolderServiceImpl.java
+3
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/appointment/ApiProductPlanMainInfoDto.java
+5
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/request/premiumreconciliation/ApiPremiumReconciliationResultEditRequest.java
+12
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
+5
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/response/premiumreconciliation/ApiPremiumReconciliationPageResponse.java
+6
-1
yd-csf-service/src/main/java/com/yd/csf/service/dao/ConditionConfigMapper.java
+9
-0
yd-csf-service/src/main/java/com/yd/csf/service/dao/FnaCustomerMapper.java
+18
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/ChangePolicyFollowStatusRequest.java
+12
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/CustomerAddRequest.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/CustomerUpdateRequest.java
+7
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneUpdateRequest.java
+8
-2
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/FnaCustomer.java
+346
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/FortuneAccount.java
+5
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/Policy.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyFollow.java
+7
-1
yd-csf-service/src/main/java/com/yd/csf/service/model/ProductPlan.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/FnaCustomerService.java
+19
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/IConditionConfigService.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyFollowService.java
+2
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
+19
-18
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ConditionConfigServiceImpl.java
+7
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CustomerServiceImpl.java
+75
-27
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
+52
-19
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaCustomerServiceImpl.java
+126
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
+2
-2
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+47
-17
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
+15
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
+170
-42
yd-csf-service/src/main/java/com/yd/csf/service/vo/CustomerVO.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneAccountVO.java
+3
-3
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
+24
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowDetailVO.java
+20
-0
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowVO.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyVO.java
+1
-1
yd-csf-service/src/main/resources/mappers/CommissionMapper.xml
+1
-1
yd-csf-service/src/main/resources/mappers/ConditionConfigMapper.xml
+16
-0
yd-csf-service/src/main/resources/mappers/FnaCustomerMapper.xml
+89
-0
yd-csf-service/src/main/resources/mappers/FortuneAccountMapper.xml
+5
-1
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
+2
-5
yd-csf-service/src/main/resources/mappers/PremiumReconciliationMapper.xml
+2
-2
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
View file @
60a764a9
...
...
@@ -355,7 +355,7 @@ public class ApiCommissionExpectedController {
page
.
getRecords
().
forEach
(
vo
->
{
if
(
StringUtils
.
isNotBlank
(
vo
.
getReconciliationCompanyBizId
()))
{
String
name
=
nameMap
.
get
(
vo
.
getReconciliationCompanyBizId
());
if
(
StringUtils
.
isNotBlank
(
name
)
&&
!
"CSF"
.
equals
(
name
)
)
{
if
(
StringUtils
.
isNotBlank
(
name
))
{
vo
.
setReconciliationCompany
(
name
);
}
}
...
...
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCustomerController.java
View file @
60a764a9
...
...
@@ -2,6 +2,8 @@ package com.yd.csf.api.controller;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.base.feign.client.relobjectcertificate.ApiRelObjectCertificateFeignClient
;
import
com.yd.base.feign.request.relobjectcertificate.ApiRelObjectCertificateListAddRequest
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
...
...
@@ -15,7 +17,6 @@ import com.yd.csf.service.dto.CustomerQueryRequest;
import
com.yd.csf.service.dto.CustomerUpdateRequest
;
import
com.yd.csf.service.model.Customer
;
import
com.yd.csf.service.service.CustomerService
;
import
com.yd.csf.service.service.ITaxationService
;
import
com.yd.csf.service.vo.CustomerVO
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -45,6 +46,8 @@ public class ApiCustomerController {
private
CustomerService
customerService
;
@Resource
private
ApiTaxationService
apiTaxationService
;
@Resource
private
ApiRelObjectCertificateFeignClient
apiRelObjectCertificateFeignClient
;
/**
* 创建客户
...
...
@@ -55,10 +58,12 @@ public class ApiCustomerController {
*/
@Operation
(
summary
=
"创建客户"
)
@PostMapping
(
"/add"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Map
<
String
,
Object
>>
addCustomer
(
@RequestBody
CustomerAddRequest
customerAddRequest
,
HttpServletRequest
request
)
{
if
(
customerAddRequest
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
ErrorCode
.
PARAMS_ERROR
.
getMessage
());
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
ResultCode
.
PARAMS_ERROR
.
getMessage
());
}
if
(
ObjectUtils
.
isEmpty
(
customerAddRequest
.
getFnaBizId
()))
{
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"fnaBizId不能为空"
);
}
Map
<
String
,
Object
>
resultMap
=
customerService
.
addCustomer
(
customerAddRequest
);
...
...
@@ -80,6 +85,17 @@ public class ApiCustomerController {
.
apiTaxationDtoList
(
apiTaxationDtoList
)
.
build
());
}
// 添加客户证件列表信息
if
(
CollUtil
.
isNotEmpty
(
customerAddRequest
.
getApiCertificateDtoList
()))
{
apiRelObjectCertificateFeignClient
.
addRelObjectCertificateList
(
ApiRelObjectCertificateListAddRequest
.
builder
()
.
objectBizId
(
customerBizId
)
.
objectName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getName
())
.
objectTableName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
objectType
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
apiCertificateDtoList
(
customerAddRequest
.
getApiCertificateDtoList
())
.
build
());
}
return
Result
.
success
(
resultMap
);
}
...
...
@@ -118,11 +134,13 @@ public class ApiCustomerController {
*/
@PostMapping
(
"/update"
)
@Operation
(
summary
=
"更新客户信息"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Boolean
>
updateCustomer
(
@RequestBody
CustomerUpdateRequest
customerUpdateRequest
)
{
String
customerBizId
=
customerUpdateRequest
.
getCustomerBizId
();
if
(
ObjectUtils
.
isEmpty
(
customerBizId
))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
ErrorCode
.
PARAMS_ERROR
.
getMessage
());
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"customerBizId不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
customerUpdateRequest
.
getFnaBizId
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"fnaBizId不能为空"
);
}
boolean
result
=
customerService
.
updateCustomer
(
customerUpdateRequest
);
...
...
@@ -144,6 +162,17 @@ public class ApiCustomerController {
.
build
());
}
// 添加客户证件列表信息
if
(
CollUtil
.
isNotEmpty
(
customerUpdateRequest
.
getApiCertificateDtoList
()))
{
apiRelObjectCertificateFeignClient
.
addRelObjectCertificateList
(
ApiRelObjectCertificateListAddRequest
.
builder
()
.
objectBizId
(
customerBizId
)
.
objectName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getName
())
.
objectTableName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
objectType
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
apiCertificateDtoList
(
customerUpdateRequest
.
getApiCertificateDtoList
())
.
build
());
}
return
Result
.
success
(
result
);
}
...
...
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFnaCustomerController.java
0 → 100644
View file @
60a764a9
package
com
.
yd
.
csf
.
api
.
controller
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.result.Result
;
import
com.yd.csf.api.service.ApiTaxationService
;
import
com.yd.csf.service.model.FnaCustomer
;
import
com.yd.csf.service.service.CustomerService
;
import
com.yd.csf.service.service.FnaCustomerService
;
import
com.yd.csf.service.vo.CustomerVO
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
/**
* fna_customer接口
*
* @author jianan
* @since 2025-07-31
*/
@RestController
@RequestMapping
(
"/fna_customer"
)
@Tag
(
name
=
"fna_customer接口"
)
public
class
ApiFnaCustomerController
{
@Resource
private
FnaCustomerService
fnaCustomerService
;
@Resource
private
CustomerService
customerService
;
@Resource
private
ApiTaxationService
apiTaxationService
;
/**
* 删除fna
*
* @param deleteRequest
* @param request
* @return
*/
// @PostMapping("/delete")
// public Result<Boolean> deleteFna(@RequestBody DeleteRequest deleteRequest, HttpServletRequest request) {
// if (deleteRequest == null || deleteRequest.getId() <= 0) {
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
// }
// User user = userService.getLoginUser(request);
// long id = deleteRequest.getId();
// // 判断是否存在
// Customer oldFna = customerService.getById(id);
// ThrowUtils.throwIf(oldFna == null, ErrorCode.NOT_FOUND_ERROR);
// // 仅本人或管理员可删除
// if (!oldFna.getUserId().equals(user.getId()) && !userService.isAdmin(request)) {
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
// }
// // 操作数据库
// boolean result = customerService.removeById(id);
// ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
// return Result.success(true);
// }
/**
* 根据 fnaBizId 获取客户(封装类)
*
* @param fnaBizId
* @return
*/
@GetMapping
(
"/get/vo"
)
@Operation
(
summary
=
"根据 fnaBizId 获取客户详情"
)
public
Result
<
CustomerVO
>
getCustomerVOByCustomerBizId
(
@RequestParam
(
"fnaBizId"
)
String
fnaBizId
,
HttpServletRequest
request
)
{
if
(
fnaBizId
==
null
)
{
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"fnaBizId 不能为空"
);
}
// 查询数据库
FnaCustomer
fnaCustomer
=
fnaCustomerService
.
lambdaQuery
()
.
eq
(
FnaCustomer:
:
getFnaBizId
,
fnaBizId
)
.
one
();
if
(
fnaCustomer
==
null
)
{
return
Result
.
fail
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL_ERROR
.
getMessage
());
}
// 获取客户封装类
return
Result
.
success
(
fnaCustomerService
.
getCustomerVO
(
fnaCustomer
));
}
/**
* 分页获取客户列表(仅管理员可用)
*
* @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 = customerService.page(new Page<>(current, size),
// customerService.getQueryWrapper(fnaQueryRequest));
// return Result.success(fnaPage);
// }
}
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFnaFormController.java
View file @
60a764a9
package
com
.
yd
.
csf
.
api
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yd.auth.core.dto.AuthUserDto
;
import
com.yd.auth.core.utils.SecurityUtil
;
import
com.yd.common.enums.CommonEnum
;
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAdditionalServiceImpl.java
View file @
60a764a9
...
...
@@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -148,6 +149,7 @@ public class ApiAdditionalServiceImpl implements ApiAdditionalService {
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
batchAddAdditionalData
(
ApiProductPlanInfoDto
productPlanInfoDto
,
String
planBizId
)
{
if
(
Objects
.
isNull
(
productPlanInfoDto
)
||
(
!
Objects
.
isNull
(
productPlanInfoDto
)
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentReferrerServiceImpl.java
View file @
60a764a9
...
...
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
...
...
@@ -31,6 +32,7 @@ public class ApiAppointmentReferrerServiceImpl implements ApiAppointmentReferrer
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
saveAppointmentReferrerList
(
List
<
ApiAppointmentReferrerDto
>
referrerDtoList
,
String
appointmentBizId
)
{
if
(
CollectionUtils
.
isEmpty
(
referrerDtoList
))
{
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentServiceImpl.java
View file @
60a764a9
...
...
@@ -719,6 +719,12 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
follow
.
setInsuranceCompany
(
apiProductPlanMainInfoDto
.
getCompanyName
());
// 保险公司业务ID(从产品计划获取的公司ID)
follow
.
setInsuranceCompanyBizId
(
apiProductPlanMainInfoDto
.
getCompanyId
());
// 对账公司
follow
.
setReconciliationCompany
(
apiProductPlanMainInfoDto
.
getReconciliationCompanyName
());
// 对账公司业务ID(从产品计划获取的对账公司ID)
follow
.
setReconciliationCompanyBizId
(
apiProductPlanMainInfoDto
.
getReconciliationCompanyId
());
follow
.
setReconciliationCompanyCode
(
apiProductPlanMainInfoDto
.
getReconciliationCompanyCode
());
// 币种
follow
.
setPolicyCurrency
(
apiProductPlanMainInfoDto
.
getPolicyCurrency
());
// 供款年期
...
...
@@ -727,7 +733,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
}
// 保障期限
if
(
StringUtils
.
isNotBlank
(
apiProductPlanMainInfoDto
.
getGuaranteePeriod
()))
{
follow
.
setGuaranteePeriod
(
Integer
.
parseInt
(
apiProductPlanMainInfoDto
.
getGuaranteePeriod
()
));
follow
.
setGuaranteePeriod
(
apiProductPlanMainInfoDto
.
getGuaranteePeriod
(
));
}
// 保额(重疾险)
follow
.
setSumInsured
(
apiProductPlanMainInfoDto
.
getSumInsured
());
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentUserSignServiceImpl.java
View file @
60a764a9
...
...
@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
...
...
@@ -33,6 +34,7 @@ public class ApiAppointmentUserSignServiceImpl implements ApiAppointmentUserSign
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
saveAppointmentUserSignList
(
List
<
ApiAppointmentUserSignDto
>
userSignDtoList
,
String
appointmentBizId
)
{
if
(
CollectionUtils
.
isEmpty
(
userSignDtoList
))
{
return
Result
.
success
();
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiBeneficiaryServiceImpl.java
View file @
60a764a9
...
...
@@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -145,6 +146,7 @@ public class ApiBeneficiaryServiceImpl implements ApiBeneficiaryService {
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
batchAddBeneficiaryData
(
List
<
ApiBeneficiaryInfoDto
>
apiBeneficiaryInfoDtoList
,
String
appointmentBizId
)
{
if
(
CollectionUtils
.
isEmpty
(
apiBeneficiaryInfoDtoList
)){
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
60a764a9
...
...
@@ -2,6 +2,9 @@ package com.yd.csf.api.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
...
...
@@ -11,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.*
;
import
com.yd.common.exception.BusinessException
;
...
...
@@ -21,7 +25,6 @@ import com.yd.csf.api.dto.*;
import
com.yd.csf.api.service.ApiBasicLawCalculateService
;
import
com.yd.csf.api.service.ApiExpectedFortuneLogService
;
import
com.yd.csf.api.service.ApiExpectedFortuneService
;
import
com.yd.csf.feign.dto.appointmentfile.ItineraryDto
;
import
com.yd.csf.feign.request.expectedfortune.*
;
import
com.yd.csf.feign.response.expectedfortune.ApiExpectedFortunePageResponse
;
import
com.yd.csf.feign.response.expectedfortune.ApiGenerateExpectedFortuneResponse
;
...
...
@@ -34,6 +37,9 @@ import com.yd.csf.service.service.*;
import
com.yd.csf.service.vo.ExpectedFortuneExportDTO
;
import
com.yd.csf.service.vo.ExpectedFortuneStatisticsVO
;
import
com.yd.csf.service.vo.PayableReportVO
;
import
com.yd.product.feign.client.announcementcommissionratio.ApiAnnouncementCommissionRatioFeignClient
;
import
com.yd.product.feign.request.announcementcommissionratio.ApiAnnouncementCommissionRatioListRequest
;
import
com.yd.product.feign.response.announcementcommissionratio.ApiAnnouncementCommissionRatioListResponse
;
import
com.yd.user.feign.client.clientuser.ApiClientUserFeignClient
;
import
com.yd.user.feign.client.sysdict.ApiSysDictFeignClient
;
import
com.yd.user.feign.response.sysdict.GetDictItemListByDictTypeResponse
;
...
...
@@ -56,10 +62,13 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
static
com
.
ibm
.
icu
.
impl
.
ValidIdentifiers
.
Datatype
.
currency
;
@Slf4j
@Service
public
class
ApiExpectedFortuneServiceImpl
implements
ApiExpectedFortuneService
{
...
...
@@ -91,6 +100,12 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
private
ApiSysDictFeignClient
apiSysDictFeignClient
;
@Resource
private
PolicyFollowService
policyFollowService
;
@Resource
private
ApiExchangeRateFeignClient
apiExchangeRateFeignClient
;
@Resource
private
CommissionExpectedService
commissionExpectedService
;
@Resource
private
ApiAnnouncementCommissionRatioFeignClient
apiAnnouncementCommissionRatioFeignClient
;
/**
* 生成预计发佣
...
...
@@ -304,7 +319,16 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
}
}
//批量设置应付款编号、发佣类型
updatePayableNoBatch
(
policyNo
);
List
<
ExpectedFortune
>
expectedFortuneList
=
updatePayableNoBatch
(
policyNo
);
//默认结算汇率、港币金额
if
(
CollUtil
.
isNotEmpty
(
queryPolicyAndBrokerDtoList
))
{
log
.
info
(
"queryPolicyAndBrokerDtoList: {}"
,
queryPolicyAndBrokerDtoList
);
QueryPolicyAndBrokerDto
queryPolicyAndBrokerDto
=
queryPolicyAndBrokerDtoList
.
get
(
0
);
updateHkdAmountBatch
(
expectedFortuneList
,
queryPolicyAndBrokerDto
);
}
//执行成功完毕,也要销毁redis缓存
redisUtil
.
deleteObject
(
RedisConstants
.
EXPECTED_FORTUNE
+
policyNo
);
...
...
@@ -333,6 +357,53 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
});
}
private
void
updateHkdAmountBatch
(
List
<
ExpectedFortune
>
expectedFortuneList
,
QueryPolicyAndBrokerDto
queryPolicyAndBrokerDto
)
{
//查询结算币种
ApiAnnouncementCommissionRatioListRequest
request
=
new
ApiAnnouncementCommissionRatioListRequest
();
request
.
setProductLaunchBizId
(
queryPolicyAndBrokerDto
.
getPlanBizId
());
//localDate转换为Date
request
.
setEffectiveDate
(
Date
.
from
(
queryPolicyAndBrokerDto
.
getEffectiveDate
().
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()));
request
.
setPaymentTerm
(
String
.
valueOf
(
queryPolicyAndBrokerDto
.
getPaymentTerm
()));
Result
<
List
<
ApiAnnouncementCommissionRatioListResponse
>>
result
=
apiAnnouncementCommissionRatioFeignClient
.
list
(
request
);
log
.
info
(
"查询结算币种->入参request:{},出参result:{}"
,
JSON
.
toJSONString
(
request
),
JSON
.
toJSONString
(
result
));
if
(
result
.
getCode
()
==
200
)
{
// 使用 Map 来处理数据
Object
data
=
result
.
getData
();
// 将数据转换为JSONObject进行解析
JSONArray
announcementRatioList
=
JSONUtil
.
parseArray
(
data
);
//查询默认结算汇率
if
(!
announcementRatioList
.
isEmpty
())
{
JSONObject
announcementRatio
=
announcementRatioList
.
get
(
0
,
JSONObject
.
class
);
String
currency
=
announcementRatio
.
getStr
(
"currency"
);
log
.
info
(
"结算币种:{}"
,
currency
);
BigDecimal
exchangeRate
=
queryExchangeRateByFeign
(
queryPolicyAndBrokerDto
.
getCurrency
(),
currency
);
log
.
info
(
"结算汇率:{}"
,
exchangeRate
);
for
(
ExpectedFortune
expectedFortune
:
expectedFortuneList
)
{
//设置结算货币
expectedFortune
.
setCurrency
(
currency
);
//设置默认结算汇率
expectedFortune
.
setDefaultExchangeRate
(
exchangeRate
);
//设置港币金额(标准发佣金额 * 默认结算汇率)
expectedFortune
.
setHkdAmount
(
expectedFortune
.
getAmount
().
multiply
(
exchangeRate
));
iExpectedFortuneService
.
updateById
(
expectedFortune
);
}
}
else
{
log
.
error
(
"查询结算币种失败,未查询到默认结算汇率->入参request:{},出参result:{}"
,
JSON
.
toJSONString
(
request
),
JSON
.
toJSONString
(
result
));
}
}
else
{
log
.
error
(
"查询结算币种失败,入参request:{},出参result:{}"
,
JSON
.
toJSONString
(
request
),
JSON
.
toJSONString
(
result
));
}
}
@Override
public
Result
executeSync
(
List
<
QueryPolicyAndBrokerDto
>
queryPolicyAndBrokerDtoList
,
List
<
CommissionRuleBinding
>
commissionRuleBindingList
,
String
policyNo
)
{
return
null
;
...
...
@@ -380,7 +451,17 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
}
}
//批量设置应付款编号
updatePayableNoBatch
(
policyNo
);
List
<
ExpectedFortune
>
expectedFortuneList
=
updatePayableNoBatch
(
policyNo
);
//默认结算汇率、港币金额
if
(
ObjectUtils
.
isNotEmpty
(
queryPolicyAndBrokerDtoList
))
{
log
.
info
(
"------------------------开始计算默认结算汇率、港币金额----------------------"
);
QueryPolicyAndBrokerDto
queryPolicyAndBrokerDto
=
queryPolicyAndBrokerDtoList
.
get
(
0
);
updateHkdAmountBatch
(
expectedFortuneList
,
queryPolicyAndBrokerDto
);
}
//执行成功完毕,也要销毁redis缓存
redisUtil
.
deleteObject
(
RedisConstants
.
EXPECTED_FORTUNE
+
policyNo
);
...
...
@@ -425,7 +506,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
return
commissionRuleBindingList
;
}
private
void
updatePayableNoBatch
(
String
policyNo
)
{
private
List
<
ExpectedFortune
>
updatePayableNoBatch
(
String
policyNo
)
{
// 查询最新一条有 payableNo 记录
ExpectedFortune
latest
=
iExpectedFortuneService
.
getOne
(
new
QueryWrapper
<
ExpectedFortune
>().
isNotNull
(
"payable_no"
).
orderByDesc
(
"id"
).
last
(
"LIMIT 1"
),
...
...
@@ -452,6 +533,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
"csf_fortune_type"
,
expectedFortune
.
getFortuneName
()));
}
iExpectedFortuneService
.
updateBatchById
(
expectedFortuneList
);
return
expectedFortuneList
;
}
/**
...
...
@@ -629,8 +712,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
fortune
.
setExpectedFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
()));
//基本法项目配置表唯一业务ID
fortune
.
setRuleItemBizId
(
algorithmResDto
.
getRuleItemBizId
());
//
发佣
币种
fortune
.
setCurrency
(
fortuneDto
.
getCurrency
());
//
保单
币种
fortune
.
set
Policy
Currency
(
fortuneDto
.
getCurrency
());
//发佣期数
fortune
.
setFortunePeriod
(
fortuneDto
.
getFortunePeriod
());
//发佣总期数
...
...
@@ -639,8 +722,6 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
fortune
.
setPolicyNo
(
fortuneDto
.
getPolicyNo
());
//预计发佣日期
fortune
.
setPayoutDate
(
fortuneDto
.
getPayoutDate
());
//默认结算汇率
fortune
.
setDefaultExchangeRate
(
queryDefaultExchangeRate
(
fortune
.
getCurrency
()));
// 标准发佣金额 -> 计算值
BigDecimal
standardAmount
=
algorithmResDto
.
getCalculatedValue
();
...
...
@@ -659,8 +740,6 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
// 计算实际预计发佣金额 = 标准发佣金额 × decimalRatio
BigDecimal
actualAmount
=
standardAmount
.
multiply
(
decimalRatio
);
fortune
.
setAmount
(
actualAmount
);
// 计算港币金额
fortune
.
setHkdAmount
(
actualAmount
.
multiply
(
fortune
.
getDefaultExchangeRate
()));
}
catch
(
NumberFormatException
e
)
{
// 如果比例不是有效的数字,使用标准金额
...
...
@@ -755,7 +834,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
// 应付款编号(序号递增)
expectedFortune
.
setPayableNo
(
this
.
createPayableNo
(
expectedFortune
.
getFortuneBizType
(),
++
currentSeq
));
// 默认结算汇率
expectedFortune
.
setDefaultExchangeRate
(
queryDefaultExchangeRate
(
expectedFortune
.
getCurrency
()));
expectedFortune
.
setDefaultExchangeRate
(
queryExchangeRateByFeign
(
expectedFortune
.
getPolicyCurrency
(),
expectedFortune
.
getCurrency
()));
// 计算港币金额
expectedFortune
.
setHkdAmount
(
expectedFortune
.
getAmount
().
multiply
(
expectedFortune
.
getDefaultExchangeRate
()));
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
...
...
@@ -790,27 +870,22 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
return
null
;
}
private
BigDecimal
queryDefaultExchangeRate
(
String
currency
)
{
if
(
"HKD"
.
equalsIgnoreCase
(
currency
))
{
return
BigDecimal
.
valueOf
(
1
);
}
//查询redis缓存的字典列表信息
List
<
GetDictItemListByDictTypeResponse
>
dictTypeResponses
=
redisUtil
.
getCacheObject
(
RedisConstants
.
DICT_LIST
);
String
defaultExchangeRaye
=
GetDictItemListByDictTypeResponse
.
getItemLabel
(
dictTypeResponses
,
"csf_exchange_rate_hkd"
,
currency
);
if
(
ObjectUtils
.
isNotEmpty
(
defaultExchangeRaye
))
{
return
new
BigDecimal
(
defaultExchangeRaye
);
/**
* 保单币种对预计来佣的结算币种的默认汇率
* @param policyCurrency 保单币种
* @param currency 预计来佣的结算币种
* @return 汇率
*/
private
BigDecimal
queryExchangeRateByFeign
(
String
policyCurrency
,
String
currency
)
{
if
(
policyCurrency
.
equalsIgnoreCase
(
currency
))
{
return
BigDecimal
.
ONE
;
}
Result
<
List
<
GetDictItemListByDictTypeResponse
>>
result
=
apiSysDictFeignClient
.
getDictItemListByDictType
(
"csf_exchange_rate_hkd"
);
if
(
org
.
apache
.
commons
.
collections4
.
CollectionUtils
.
isNotEmpty
(
result
.
getData
()))
{
for
(
GetDictItemListByDictTypeResponse
dictItem
:
result
.
getData
())
{
if
(
StringUtils
.
equalsIgnoreCase
(
dictItem
.
getItemLabel
(),
currency
))
{
return
new
BigDecimal
(
dictItem
.
getItemValue
());
}
}
// 调用Feign客户端查询汇率
Result
<
BigDecimal
>
result
=
apiExchangeRateFeignClient
.
getExchangeRate
(
policyCurrency
,
currency
,
""
);
if
(
result
!=
null
&&
result
.
getData
()
!=
null
)
{
return
result
.
getData
();
}
return
BigDecimal
.
ONE
;
return
null
;
}
private
void
validateAdd
(
List
<
ExpectedFortuneAddRequest
>
fortuneAddRequestList
)
{
...
...
@@ -1057,7 +1132,11 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
// 默认结算汇率
if
(
updateExpectedFortune
.
getDefaultExchangeRate
()
==
null
)
{
updateExpectedFortune
.
setDefaultExchangeRate
(
queryDefaultExchangeRate
(
updateExpectedFortune
.
getCurrency
()));
updateExpectedFortune
.
setDefaultExchangeRate
(
queryExchangeRateByFeign
(
updateExpectedFortune
.
getPolicyCurrency
(),
updateExpectedFortune
.
getCurrency
()
));
}
// 计算港币金额
updateExpectedFortune
.
setHkdAmount
(
updateExpectedFortune
.
getAmount
().
multiply
(
updateExpectedFortune
.
getDefaultExchangeRate
()));
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiInsurantServiceImpl.java
View file @
60a764a9
...
...
@@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
...
...
@@ -123,6 +124,7 @@ public class ApiInsurantServiceImpl implements ApiInsurantService {
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Insurant
>
addInsurantData
(
ApiInsurantInfoDto
dto
,
String
appointmentBizId
)
{
if
(
Objects
.
isNull
(
dto
)){
//为空设置,方便新建暂存公用方法
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPolicyholderServiceImpl.java
View file @
60a764a9
...
...
@@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
...
...
@@ -115,6 +116,7 @@ public class ApiPolicyholderServiceImpl implements ApiPolicyholderService {
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Policyholder
>
addPolicyholderData
(
ApiPolicyholderInfoDto
dto
,
String
appointmentBizId
)
{
if
(
Objects
.
isNull
(
dto
)){
//为空设置,方便新建暂存公用方法
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
View file @
60a764a9
package
com
.
yd
.
csf
.
api
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.base.feign.client.bank.ApiBankFeignClient
;
...
...
@@ -42,7 +44,11 @@ import com.yd.csf.service.service.CommissionExpectedService;
import
com.yd.csf.service.service.IPremiumReconciliationService
;
import
com.yd.csf.service.service.PolicyFollowService
;
import
com.yd.csf.service.service.PolicyService
;
import
com.yd.csf.service.vo.ReceivableReportVO
;
import
com.yd.feign.config.FeignTokenInterceptor
;
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
;
import
com.yd.product.feign.response.expectedspecies.ApiExpectedSpeciesListResponse
;
import
com.yd.user.feign.client.sysdict.ApiSysDictFeignClient
;
import
com.yd.user.feign.request.sysdict.GetDictTypeListRequest
;
...
...
@@ -102,6 +108,9 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
@Resource
private
ApiExpectedFortuneService
apiExpectedFortuneService
;
@Resource
private
ApiInsuranceReconciliationCompanyFeignClient
companyFeignClient
;
@Autowired
private
ApplicationContext
applicationContext
;
...
...
@@ -503,9 +512,87 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
log
.
info
(
"共更新了 {} 条记录的付款金额"
,
updatedCount
);
}
//转换对账公司名称
enrichReceivableReportWithCompanyName
(
iPage
);
return
Result
.
success
(
iPage
);
}
private
void
enrichReceivableReportWithCompanyName
(
IPage
<
ApiPremiumReconciliationPageResponse
>
page
)
{
if
(
page
==
null
||
org
.
apache
.
commons
.
collections4
.
CollectionUtils
.
isEmpty
(
page
.
getRecords
()))
{
return
;
}
// 收集所有非空的对账公司 bizId(去重)
List
<
String
>
bizIdList
=
page
.
getRecords
().
stream
()
.
map
(
ApiPremiumReconciliationPageResponse:
:
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
List
<
ApiInsuranceReconciliationCompanyPageResponse
>
extractCompanyListFromResult
(
Result
result
)
{
if
(
result
==
null
||
result
.
getCode
()
!=
200
||
result
.
getData
()
==
null
)
{
return
Collections
.
emptyList
();
}
Object
data
=
result
.
getData
();
try
{
// 将 data 转为 JSON 字符串再解析为 Map,以便提取 records
Map
<
String
,
Object
>
dataMap
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
data
),
new
TypeReference
<
Map
<
String
,
Object
>>()
{});
Object
recordsObj
=
dataMap
.
get
(
"records"
);
if
(
recordsObj
instanceof
List
)
{
List
<?>
recordsList
=
(
List
<?>)
recordsObj
;
List
<
ApiInsuranceReconciliationCompanyPageResponse
>
companyList
=
new
ArrayList
<>();
for
(
Object
item
:
recordsList
)
{
// 将每个元素转换为目标类型
ApiInsuranceReconciliationCompanyPageResponse
company
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
item
),
ApiInsuranceReconciliationCompanyPageResponse
.
class
);
companyList
.
add
(
company
);
}
return
companyList
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"解析公司列表失败"
,
e
);
}
return
Collections
.
emptyList
();
}
// 辅助类
private
static
class
ConvertInfo
{
String
reconciliationBizId
;
...
...
@@ -1118,6 +1205,10 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
statusRequest
.
setUnderwritingDate
(
request
.
getUnderwritingDate
());
statusRequest
.
setPolicyBizId
(
policyFollow
.
getPolicyBizId
());
statusRequest
.
setStatus
(
"TAKE_EFFECT"
);
//保单截止日期
statusRequest
.
setPolicyExpirationDate
(
request
.
getPolicyExpirationDate
());
//冷静期结束日期
statusRequest
.
setCoolingOffEndDate
(
request
.
getCoolingOffEndDate
());
//遍历保单转介人列表信息 -> 调用基本法算出预计发佣列表
// 通过代理对象调用
// getSelf().execute(statusRequest,token);
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiProductPlanServiceImpl.java
View file @
60a764a9
...
...
@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -115,6 +116,7 @@ public class ApiProductPlanServiceImpl implements ApiProductPlanService {
* @param appointmentBizId
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
ProductPlan
>
addProductPlanData
(
ApiProductPlanInfoDto
productPlanInfoDto
,
String
appointmentBizId
)
{
if
(
Objects
.
isNull
(
productPlanInfoDto
))
{
//为空设置,方便新建暂存公用方法
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSecondHolderServiceImpl.java
View file @
60a764a9
...
...
@@ -15,6 +15,8 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Objects
;
/**
...
...
@@ -71,6 +73,7 @@ public class ApiSecondHolderServiceImpl implements ApiSecondHolderService {
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
SecondHolder
>
addSecondHolderData
(
ApiSecondHolderInfoDto
dto
,
String
appointmentBizId
)
{
if
(
Objects
.
isNull
(
dto
)){
//为空设置,方便新建暂存公用方法
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/appointment/ApiProductPlanMainInfoDto.java
View file @
60a764a9
...
...
@@ -38,6 +38,11 @@ public class ApiProductPlanMainInfoDto {
private
String
reconciliationCompanyName
;
/**
* 出单经纪公司(对账公司)编码
*/
private
String
reconciliationCompanyCode
;
/**
* 保险险种ID(产品上架信息绑定的保险险种参数)
*/
private
String
insuranceTypeId
;
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/request/premiumreconciliation/ApiPremiumReconciliationResultEditRequest.java
View file @
60a764a9
...
...
@@ -60,4 +60,16 @@ public class ApiPremiumReconciliationResultEditRequest {
*/
private
String
status
;
/**
* 冷静期结束日期
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
coolingOffEndDate
;
/**
* 保单截止日期
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
policyExpirationDate
;
}
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
View file @
60a764a9
...
...
@@ -229,4 +229,9 @@ public class ApiExpectedFortunePageResponse {
@Schema
(
description
=
"更新时间"
)
private
LocalDateTime
updateTime
;
/**
* 发佣率(对应职级)
*/
@Schema
(
description
=
"发佣率(对应职级)"
)
private
String
commissionRatio
;
}
yd-csf-feign/src/main/java/com/yd/csf/feign/response/premiumreconciliation/ApiPremiumReconciliationPageResponse.java
View file @
60a764a9
...
...
@@ -110,7 +110,12 @@ public class ApiPremiumReconciliationPageResponse {
private
LocalDateTime
updateTime
;
/**
* 对账公司(保单表)
* 对账公司ID(保单跟进表)
*/
private
String
reconciliationCompanyBizId
;
/**
* 对账公司名称
*/
private
String
reconciliationCompany
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dao/ConditionConfigMapper.java
View file @
60a764a9
...
...
@@ -7,6 +7,8 @@ import com.yd.csf.feign.response.conditionconfig.ApiConditionConfigPageResponse;
import
com.yd.csf.service.model.ConditionConfig
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -20,4 +22,11 @@ public interface ConditionConfigMapper extends BaseMapper<ConditionConfig> {
IPage
<
ApiConditionConfigPageResponse
>
page
(
@Param
(
"page"
)
Page
<
ApiConditionConfigPageResponse
>
page
,
@Param
(
"request"
)
ApiConditionConfigPageRequest
request
);
/**
* 根据业务员ID列表查询每个业务员对应的基础销售积分比例
* @param brokerBizIds 业务员ID列表
* @return 包含 brokerBizId 和 conditional_value 的 Map 列表
*/
List
<
Map
<
String
,
Object
>>
selectBrokerRatioByBizIds
(
@Param
(
"list"
)
List
<
String
>
brokerBizIds
);
}
yd-csf-service/src/main/java/com/yd/csf/service/dao/FnaCustomerMapper.java
0 → 100644
View file @
60a764a9
package
com
.
yd
.
csf
.
service
.
dao
;
import
com.yd.csf.service.model.FnaCustomer
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* @author Zhang Jianan
* @description 针对表【fna_customer(客户信息表)】的数据库操作Mapper
* @createDate 2026-03-09 10:45:37
* @Entity com.yd.csf.service.model.FnaCustomer
*/
public
interface
FnaCustomerMapper
extends
BaseMapper
<
FnaCustomer
>
{
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/ChangePolicyFollowStatusRequest.java
View file @
60a764a9
package
com
.
yd
.
csf
.
service
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -38,4 +40,14 @@ public class ChangePolicyFollowStatusRequest {
*/
@Schema
(
description
=
"跟进信息"
)
private
String
message
;
/**
* 冷静期结束日期
*/
private
Date
coolingOffEndDate
;
/**
* 保单截止日期
*/
private
Date
policyExpirationDate
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/CustomerAddRequest.java
View file @
60a764a9
...
...
@@ -16,6 +16,12 @@ import java.util.List;
@Data
public
class
CustomerAddRequest
implements
Serializable
{
/**
* fna业务id
*/
@Schema
(
description
=
"fna业务id"
)
private
String
fnaBizId
;
/**
* 姓名-中文
*/
@Schema
(
description
=
"姓名-中文"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/CustomerUpdateRequest.java
View file @
60a764a9
...
...
@@ -15,6 +15,13 @@ import java.util.List;
*/
@Data
public
class
CustomerUpdateRequest
implements
Serializable
{
/**
* fna业务id
*/
@Schema
(
description
=
"fna业务id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
fnaBizId
;
/**
* 客户主表业务唯一id
*/
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneUpdateRequest.java
View file @
60a764a9
...
...
@@ -84,8 +84,14 @@ public class FortuneUpdateRequest implements Serializable {
/**
* 本期出账金额
*/
@Schema
(
description
=
"本期出账金额"
)
private
BigDecimal
currentPaymentAmount
;
// @Schema(description = "本期出账金额")
// private BigDecimal currentPaymentAmount;
/**
* 本期出账港币金额
*/
@Schema
(
description
=
"本期出账港币金额"
)
private
BigDecimal
currentPaymentHkdAmount
;
/**
* 出账币种
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/ExpectedFortune.java
View file @
60a764a9
...
...
@@ -137,6 +137,12 @@ public class ExpectedFortune implements Serializable {
private
String
brokerRatio
;
/**
* 转介人职级比例
*/
@TableField
(
"broker_level_ratio"
)
private
BigDecimal
brokerLevelRatio
;
/**
* 标准发佣金额
*/
@TableField
(
"standard_amount"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/FnaCustomer.java
0 → 100644
View file @
60a764a9
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 客户信息表
*
* @TableName fna_customer
*/
@TableName
(
value
=
"fna_customer"
)
@Data
public
class
FnaCustomer
implements
Serializable
{
/**
* id
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* fna客户唯一业务ID
*/
private
String
fnaCustomerBizId
;
/**
* customer唯一业务ID
*/
private
String
customerBizId
;
/**
* fna唯一业务ID
*/
private
String
fnaBizId
;
/**
* 姓名-中文
*/
private
String
nameCn
;
/**
* 姓名-(拼音/英文,通过中文自动加载全部大写的拼音)
*/
private
String
namePyEn
;
/**
* 证件类型(字典,下拉选择)
*/
private
String
documentType
;
/**
* 证件号码
*/
private
String
idNumber
;
/**
* 性别(字典,如果是身份证,自动获取性别和生日)
*/
private
String
gender
;
/**
* 出生日期(生日,如果是身份证,自动获取性别和生日)
*/
private
Date
birthday
;
/**
* 年龄(通过生日自动获取年龄)
*/
private
String
age
;
/**
* 国籍(下拉选择)
*/
private
String
nationality
;
/**
* 出生地
*/
private
String
birthplace
;
/**
* 是否拥有其他国家公民身份(如美国、日本等): 0-否, 1-是(字典)
*/
private
String
isOtherCountry
;
/**
* 税务国家
*/
private
Object
taxList
;
/**
* 吸烟情况(字典)
*/
private
String
smokingStatus
;
/**
* 婚姻情况(字典)
*/
private
String
maritalStatus
;
/**
* 教育程度(字典)
*/
private
String
educationLevel
;
/**
* 是否退休(字典)
*/
private
String
isRetirement
;
/**
* 退休年龄(如已退休,再显示)
*/
private
String
retirementAge
;
/**
* 身高(CM)
*/
private
String
height
;
/**
* 体重(KG)
*/
private
String
weight
;
/**
* BMI指数(根据身高和体重自动计算)
*/
private
String
bmi
;
/**
* 风险偏好(字典,下拉选择)
*/
private
String
riskAppetite
;
/**
* 受供养人数目(通过FNA带入)
*/
private
Integer
dependentsNum
;
/**
* 移动电话区号
*/
private
String
mobileCode
;
/**
* 移动电话
*/
private
String
mobile
;
/**
* 住宅电话区号
*/
private
String
residenceMobileCode
;
/**
* 住宅电话
*/
private
String
residenceMobile
;
/**
* 固定电话区号
*/
private
String
landlineCode
;
/**
* 固定电话
*/
private
String
landline
;
/**
* 邮箱
*/
private
String
email
;
/**
* 证件地址
*/
private
String
certificateAddress
;
/**
* 通讯地址
*/
private
String
mailingAddress
;
/**
* 居住地址(住宅地址)
*/
private
String
residentialAddress
;
/**
* 通讯地址邮政编号
*/
private
String
mailingAddressCode
;
/**
* 就业情况(字典,下拉选择)
*/
private
String
employmentStatus
;
/**
* 公司/学校名称
*/
private
String
csName
;
/**
* 行业
*/
private
String
industry
;
/**
* 现时每月收入(HKD)
*/
private
BigDecimal
currentMonthlyIncome
;
/**
* 总工作年期
*/
private
BigDecimal
totalWorkingYears
;
/**
* 受雇于现职年期
*/
private
BigDecimal
currentTenure
;
/**
* 职位
*/
private
String
position
;
/**
* 公司地址
*/
private
String
companyAddress
;
/**
* 公司电话区号
*/
private
String
companyMobileCode
;
/**
* 公司电话
*/
private
String
companyMobile
;
/**
* 公司地址邮政编号
*/
private
String
companyAddressCode
;
/**
* 平均每月收入(HKD)
*/
private
BigDecimal
monthIncome
;
/**
* 平均每月支出(HKD)
*/
private
BigDecimal
monthExpenditure
;
/**
* 总流动资产(HKD)
*/
private
BigDecimal
totalCurrentAssets
;
/**
* 总负债额(HKD)
*/
private
BigDecimal
totalDebt
;
/**
* 旅行(字典)
*/
private
String
travel
;
/**
* 运动(字典,下拉选择)
*/
private
String
exercise
;
/**
* 游戏(字典,下拉选择)
*/
private
String
game
;
/**
* 电影/戏剧(字典,下拉选择)
*/
private
String
movieDrama
;
/**
* 美食(输入)
*/
private
String
delicacy
;
/**
* 地址列表(json串)
*/
private
String
addressList
;
/**
*
*/
private
Object
certificateList
;
/**
* 通用备注
*/
private
String
remark
;
/**
* 删除标识: 0-正常, 1-删除
*/
private
Integer
isDeleted
;
/**
* 创建人ID
*/
private
String
creatorId
;
/**
* 更新人ID
*/
private
String
updaterId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
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 @
60a764a9
...
...
@@ -49,6 +49,11 @@ public class FortuneAccount implements Serializable {
private
BigDecimal
amount
;
/**
* 港币出账金额
*/
private
BigDecimal
hkdAmount
;
/**
* 出账状态 可出账、待出账、已出账
*/
private
String
status
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/Policy.java
View file @
60a764a9
...
...
@@ -10,9 +10,12 @@ import java.math.BigDecimal;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* 保单表
*
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyFollow.java
View file @
60a764a9
...
...
@@ -7,10 +7,14 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* 新单跟进表
*
...
...
@@ -143,7 +147,7 @@ public class PolicyFollow implements Serializable {
/**
* 保障期限
*/
private
Integer
guaranteePeriod
;
private
String
guaranteePeriod
;
/**
* 保额(重疾险)
...
...
@@ -422,4 +426,5 @@ public class PolicyFollow implements Serializable {
@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/ProductPlan.java
View file @
60a764a9
...
...
@@ -69,6 +69,12 @@ public class ProductPlan implements Serializable {
private
String
reconciliationCompanyName
;
/**
* 出单经纪公司(对账公司)编码 TODO
*/
@TableField
(
"reconciliation_company_code"
)
private
String
reconciliationCompanyCode
;
/**
* 保险险种ID(产品上架信息绑定的保险险种参数)
*/
@TableField
(
"insurance_type_id"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/FnaCustomerService.java
0 → 100644
View file @
60a764a9
package
com
.
yd
.
csf
.
service
.
service
;
import
com.yd.csf.service.model.FnaCustomer
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yd.csf.service.vo.CustomerVO
;
/**
* @author Zhang Jianan
* @description 针对表【fna_customer(客户信息表)】的数据库操作Service
* @createDate 2026-03-09 10:45:37
*/
public
interface
FnaCustomerService
extends
IService
<
FnaCustomer
>
{
void
validCustomer
(
FnaCustomer
fnaCustomer
);
int
queryDependentsNum
(
String
fnaBizId
);
CustomerVO
getCustomerVO
(
FnaCustomer
fnaCustomer
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/IConditionConfigService.java
View file @
60a764a9
...
...
@@ -9,6 +9,7 @@ import com.yd.csf.service.model.ConditionConfig;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -23,6 +24,8 @@ public interface IConditionConfigService extends IService<ConditionConfig> {
IPage
<
ApiConditionConfigPageResponse
>
page
(
Page
<
ApiConditionConfigPageResponse
>
page
,
ApiConditionConfigPageRequest
request
);
List
<
Map
<
String
,
Object
>>
selectBrokerRatioByBizIds
(
List
<
String
>
brokerBizIds
);
ConditionConfig
queryOne
(
String
conditionBizId
);
List
<
ConditionConfig
>
queryList
(
ConditionConfigDto
dto
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyFollowService.java
View file @
60a764a9
...
...
@@ -63,6 +63,8 @@ public interface PolicyFollowService extends IService<PolicyFollow> {
PolicyFollow
queryOneByPolicyNo
(
String
policyNo
);
PolicyFollow
queryOneByPolicyBizId
(
String
policyBizId
);
/**
* 保存首期缴费信息
*/
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
View file @
60a764a9
...
...
@@ -183,7 +183,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
page
.
getRecords
().
forEach
(
vo
->
{
if
(
StringUtils
.
isNotBlank
(
vo
.
getReconciliationCompanyBizId
()))
{
String
name
=
nameMap
.
get
(
vo
.
getReconciliationCompanyBizId
());
if
(
StringUtils
.
isNotBlank
(
name
)
&&
!
"CSF"
.
equals
(
name
)
)
{
if
(
StringUtils
.
isNotBlank
(
name
))
{
vo
.
setReconciliationCompany
(
name
);
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
View file @
60a764a9
...
...
@@ -9,6 +9,7 @@ import cn.hutool.core.collection.CollUtil;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yd.base.feign.client.exchangerate.ApiExchangeRateFeignClient
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
...
...
@@ -81,8 +82,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
private
TransactionTemplate
transactionTemplate
;
@Resource
private
ReceivableService
receivableService
;
@
Autowired
private
Api
SysDictFeignClient
apiSysDict
FeignClient
;
@
Resource
private
Api
ExchangeRateFeignClient
apiExchangeRate
FeignClient
;
@Resource
private
ApiInsuranceReconciliationCompanyFeignClient
apiInsuranceReconciliationCompanyFeignClient
;
...
...
@@ -677,11 +678,11 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setId
(
null
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setExchangeRate
(
queryDefaultExchangeRate
(
fortune
.
getCurrency
()
));
fortune
.
setExchangeRate
(
expectedFortune
.
getDefaultExchangeRate
(
));
fortune
.
setAmount
(
expectedFortune
.
getAmount
());
fortune
.
setHkdAmount
(
expectedFortune
.
get
Amount
().
multiply
(
fortune
.
getExchangeRate
()
));
fortune
.
setHkdAmount
(
expectedFortune
.
get
HkdAmount
(
));
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getCurrentPaymentAmount
().
multiply
(
fortune
.
getExchangeRate
()
));
fortune
.
setCurrentPaymentHkdAmount
(
expectedFortune
.
getHkdAmount
(
));
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
fortune
.
setIsPart
(
0
);
...
...
@@ -705,22 +706,22 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
.
collect
(
Collectors
.
toList
());
}
private
BigDecimal
queryDefaultExchangeRate
(
String
currency
)
{
if
(
StringUtils
.
isBlank
(
currency
))
{
/**
* 保单币种对预计来佣的结算币种的默认汇率
* @param policyCurrency 保单币种
* @param currency 预计来佣的结算币种
* @return 汇率
*/
private
BigDecimal
queryExchangeRateByFeign
(
String
policyCurrency
,
String
currency
)
{
if
(
policyCurrency
.
equalsIgnoreCase
(
currency
))
{
return
BigDecimal
.
ONE
;
}
if
(
"HKD"
.
equalsIgnoreCase
(
currency
))
{
return
BigDecimal
.
valueOf
(
1
);
}
Result
<
List
<
GetDictItemListByDictTypeResponse
>>
result
=
apiSysDictFeignClient
.
getDictItemListByDictType
(
"csf_exchange_rate_hkd"
);
if
(
CollectionUtils
.
isNotEmpty
(
result
.
getData
()))
{
for
(
GetDictItemListByDictTypeResponse
dictItem
:
result
.
getData
())
{
if
(
StringUtils
.
equalsIgnoreCase
(
dictItem
.
getItemLabel
(),
currency
))
{
return
new
BigDecimal
(
dictItem
.
getItemValue
());
}
}
// 调用Feign客户端查询汇率
Result
<
BigDecimal
>
result
=
apiExchangeRateFeignClient
.
getExchangeRate
(
policyCurrency
,
currency
,
""
);
if
(
result
!=
null
&&
result
.
getData
()
!=
null
)
{
return
result
.
getData
();
}
return
BigDecimal
.
ONE
;
return
null
;
}
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ConditionConfigServiceImpl.java
View file @
60a764a9
...
...
@@ -12,10 +12,12 @@ import com.yd.csf.service.model.FormulaConfig;
import
com.yd.csf.service.service.IConditionConfigService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -34,6 +36,11 @@ public class ConditionConfigServiceImpl extends ServiceImpl<ConditionConfigMappe
return
baseMapper
.
page
(
page
,
request
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
selectBrokerRatioByBizIds
(
List
<
String
>
brokerBizIds
){
return
baseMapper
.
selectBrokerRatioByBizIds
(
brokerBizIds
);
}
/**
* 查询单个对象
* @param conditionBizId
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CustomerServiceImpl.java
View file @
60a764a9
...
...
@@ -8,8 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
com.yd.base.feign.client.relobjectcertificate.ApiRelObjectCertificateFeignClient
;
import
com.yd.base.feign.request.relobjectcertificate.ApiRelObjectCertificateListAddRequest
;
import
com.yd.base.feign.dto.ApiCertificateDto
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.utils.RandomStringGenerator
;
...
...
@@ -17,17 +16,21 @@ import com.yd.csf.service.common.ErrorCode;
import
com.yd.csf.service.dao.CustomerMapper
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.model.Customer
;
import
com.yd.csf.service.model.FnaCustomer
;
import
com.yd.csf.service.model.FnaForm
;
import
com.yd.csf.service.service.CustomerService
;
import
com.yd.csf.service.service.FnaCustomerService
;
import
com.yd.csf.service.service.FnaFormService
;
import
com.yd.csf.service.service.FnaService
;
import
com.yd.csf.service.utils.GSONUtil
;
import
com.yd.csf.service.utils.ValidateUtil
;
import
com.yd.csf.service.vo.CustomerVO
;
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.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.*
;
...
...
@@ -46,15 +49,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
@Resource
private
CustomerService
customerService
;
@Resource
private
FnaService
fnaService
;
@Resource
private
FnaFormService
fnaFormService
;
@Resource
private
ApiRelObjectCertificateFeignClient
apiRelObjectCertificateFeignClient
;
private
FnaCustomerService
fnaCustomerService
;
@Override
public
CustomerVO
getCustomerVO
(
Customer
customer
)
{
...
...
@@ -97,14 +98,21 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Map
<
String
,
Object
>
addCustomer
(
CustomerAddRequest
customerAddRequest
)
{
// 校验 请求 对象中,参数是否全部为空
if
(
ValidateUtil
.
isAllFieldsNull
(
customerAddRequest
))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
ErrorCode
.
PARAMS_ERROR
.
getMessage
());
}
// 检查字段 certificate_list,根据证件类型、证件号码查询客户是否存在
Customer
customer
=
queryByCertificate
(
customerAddRequest
.
getApiCertificateDtoList
());
if
(
customer
==
null
)
{
customer
=
new
Customer
();
}
// 客户主表信息
Customer
customer
=
new
Customer
();
BeanUtils
.
copyProperties
(
customerAddRequest
,
customer
,
"addressList"
,
"apiCertificateDtoList"
);
BeanUtils
.
copyProperties
(
customerAddRequest
,
customer
,
"addressList"
,
"apiTaxationDtoList"
,
"apiCertificateDtoList"
);
// 地址列表
if
(
CollUtil
.
isNotEmpty
(
customerAddRequest
.
getAddressList
()))
{
customer
.
setAddressList
(
GSON
.
toJson
(
customerAddRequest
.
getAddressList
()));
...
...
@@ -122,20 +130,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
// 客户主表业务唯一id
customer
.
setCustomerBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
()));
boolean
result
=
customerService
.
save
(
customer
);
boolean
result
=
customerService
.
save
OrUpdate
(
customer
);
if
(!
result
)
{
throw
new
BusinessException
(
ErrorCode
.
OPERATION_ERROR
.
getCode
(),
ErrorCode
.
OPERATION_ERROR
.
getMessage
());
}
// 添加客户证件列表信息
if
(
CollUtil
.
isNotEmpty
(
customerAddRequest
.
getApiCertificateDtoList
()))
{
apiRelObjectCertificateFeignClient
.
addRelObjectCertificateList
(
ApiRelObjectCertificateListAddRequest
.
builder
()
.
objectBizId
(
customer
.
getCustomerBizId
())
.
objectName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getName
())
.
objectTableName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
objectType
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
apiCertificateDtoList
(
customerAddRequest
.
getApiCertificateDtoList
())
.
build
());
// 保存 fna_customer
FnaCustomer
fnaCustomer
=
new
FnaCustomer
();
BeanUtils
.
copyProperties
(
customer
,
fnaCustomer
);
fnaCustomer
.
setFnaBizId
(
customerAddRequest
.
getFnaBizId
());
fnaCustomer
.
setFnaCustomerBizId
(
RandomStringGenerator
.
generateBizId16
(
"fna_customer"
));
result
=
fnaCustomerService
.
saveOrUpdate
(
fnaCustomer
);
if
(!
result
)
{
throw
new
BusinessException
(
ErrorCode
.
OPERATION_ERROR
.
getCode
(),
ErrorCode
.
OPERATION_ERROR
.
getMessage
());
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
@@ -143,6 +150,50 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
return
map
;
}
private
Customer
queryByCertificate
(
List
<
ApiCertificateDto
>
certificateList
)
{
if
(
CollUtil
.
isNotEmpty
(
certificateList
))
{
for
(
ApiCertificateDto
certificate
:
certificateList
)
{
if
(
StringUtils
.
isNotBlank
(
certificate
.
getDocumentType
())
&&
StringUtils
.
isNotBlank
(
certificate
.
getIdNumber
()))
{
// 查询所有有 certificateList 的客户
List
<
Customer
>
existingCustomers
=
customerService
.
lambdaQuery
()
.
isNotNull
(
Customer:
:
getCertificateList
)
.
ne
(
Customer:
:
getCertificateList
,
""
)
.
list
();
if
(
CollUtil
.
isNotEmpty
(
existingCustomers
))
{
for
(
Customer
existingCustomer
:
existingCustomers
)
{
if
(
ObjectUtils
.
isNotEmpty
(
existingCustomer
.
getCertificateList
()))
{
try
{
// 解析 JSON 中的证件列表
List
<
ApiCertificateDto
>
certList
=
GSON
.
fromJson
(
(
String
)
existingCustomer
.
getCertificateList
(),
new
TypeToken
<
List
<
ApiCertificateDto
>>()
{}.
getType
()
);
if
(
CollUtil
.
isNotEmpty
(
certList
))
{
for
(
ApiCertificateDto
cert
:
certList
)
{
String
docType
=
cert
.
getDocumentType
();
String
idNum
=
cert
.
getIdNumber
();
// 比对证件类型和证件号码
if
(
certificate
.
getDocumentType
().
equals
(
docType
)
&&
certificate
.
getIdNumber
().
equals
(
idNum
))
{
return
existingCustomer
;
}
}
}
}
catch
(
Exception
e
)
{
// JSON 解析失败,跳过该客户
}
}
}
}
}
}
}
return
null
;
}
@Override
public
void
validCustomer
(
Customer
customer
)
{
if
(
StringUtils
.
isBlank
(
customer
.
getNamePyEn
()))
{
...
...
@@ -160,6 +211,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateCustomer
(
CustomerUpdateRequest
customerUpdateRequest
)
{
// 判断是否存在
String
customerBizId
=
customerUpdateRequest
.
getCustomerBizId
();
...
...
@@ -189,15 +241,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
fnaService
.
updateCustomerNameByCustomerBizId
(
customerUpdateRequest
.
getNamePyEn
(),
customerBizId
);
}
// 添加客户证件列表信息
if
(
CollUtil
.
isNotEmpty
(
customerUpdateRequest
.
getApiCertificateDtoList
()))
{
apiRelObjectCertificateFeignClient
.
addRelObjectCertificateList
(
ApiRelObjectCertificateListAddRequest
.
builder
()
.
objectBizId
(
customerBizId
)
.
objectName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getName
())
.
objectTableName
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
objectType
(
CommonEnum
.
UID_TYPE_CUSTOMER
.
getCode
())
.
apiCertificateDtoList
(
customerUpdateRequest
.
getApiCertificateDtoList
())
.
build
());
// 更新 fna_customer 表
FnaCustomer
fnaCustomer
=
fnaCustomerService
.
lambdaQuery
().
eq
(
FnaCustomer:
:
getFnaBizId
,
customerBizId
).
one
();
if
(
fnaCustomer
!=
null
)
{
BeanUtils
.
copyProperties
(
oldCustomer
,
fnaCustomer
,
"id"
,
"fna_customer_biz_id"
,
"fnaBizId"
,
"customerBizId"
);
fnaCustomerService
.
updateById
(
fnaCustomer
);
}
return
true
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
View file @
60a764a9
...
...
@@ -10,6 +10,7 @@ import com.yd.csf.service.model.ExpectedFortune;
import
com.yd.csf.service.dao.ExpectedFortuneMapper
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.model.PolicyFollow
;
import
com.yd.csf.service.service.IConditionConfigService
;
import
com.yd.csf.service.service.IExpectedFortuneService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yd.csf.service.service.PolicyFollowService
;
...
...
@@ -20,8 +21,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -42,6 +42,9 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
@Resource
private
PolicyFollowService
policyFollowService
;
@Resource
private
IConditionConfigService
iConditionConfigService
;
@Override
public
IPage
<
ApiExpectedFortunePageResponse
>
page
(
Page
<
ApiExpectedFortunePageResponse
>
page
,
ApiExpectedFortunePageRequest
request
)
{
...
...
@@ -88,35 +91,65 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
@Override
public
List
<
ApiExpectedFortunePageResponse
>
toVOList
(
List
<
ExpectedFortune
>
expectedFortuneList
)
{
// 关联保单信息
if
(
CollUtil
.
isEmpty
(
expectedFortuneList
))
{
return
Collections
.
emptyList
();
}
// 收集所有 brokerBizId
List
<
String
>
brokerBizIds
=
expectedFortuneList
.
stream
()
.
map
(
ExpectedFortune:
:
getBrokerBizId
)
.
filter
(
Objects:
:
nonNull
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
brokerRatioMap
=
new
HashMap
<>();
if
(
CollUtil
.
isNotEmpty
(
brokerBizIds
))
{
List
<
Map
<
String
,
Object
>>
ratioList
=
iConditionConfigService
.
selectBrokerRatioByBizIds
(
brokerBizIds
);
brokerRatioMap
=
ratioList
.
stream
()
.
filter
(
map
->
map
.
get
(
"conditional_value"
)
!=
null
)
.
collect
(
Collectors
.
toMap
(
map
->
(
String
)
map
.
get
(
"brokerBizId"
),
map
->
(
String
)
map
.
get
(
"conditional_value"
),
(
v1
,
v2
)
->
v1
));
}
List
<
String
>
policyNos
=
expectedFortuneList
.
stream
()
.
map
(
ExpectedFortune:
:
getPolicyNo
)
.
collect
(
Collectors
.
toList
());
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
()
.
in
(
Policy:
:
getPolicyNo
,
expectedFortuneList
.
stream
().
map
(
ExpectedFortune:
:
getPolicyNo
).
collect
(
Collectors
.
toList
()))
.
list
();
.
in
(
Policy:
:
getPolicyNo
,
policyNos
).
list
();
List
<
PolicyFollow
>
policyFollowList
=
policyFollowService
.
lambdaQuery
()
.
in
(
PolicyFollow:
:
getPolicyNo
,
expectedFortuneList
.
stream
().
map
(
ExpectedFortune:
:
getPolicyNo
).
collect
(
Collectors
.
toList
()))
.
list
();
.
in
(
PolicyFollow:
:
getPolicyNo
,
policyNos
).
list
();
Map
<
String
,
Policy
>
policyMap
=
policyList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
()));
Map
<
String
,
PolicyFollow
>
policyFollowMap
=
policyFollowList
.
stream
()
.
collect
(
Collectors
.
toMap
(
PolicyFollow:
:
getPolicyNo
,
Function
.
identity
()));
List
<
ApiExpectedFortunePageResponse
>
expectedFortuneVOList
=
expectedFortuneList
.
stream
().
map
(
expectedFortune
->
{
ApiExpectedFortunePageResponse
expectedFortuneVO
=
new
ApiExpectedFortunePageResponse
();
BeanUtils
.
copyProperties
(
expectedFortune
,
expectedFortuneVO
);
// 组装 VO
Map
<
String
,
String
>
finalBrokerRatioMap
=
brokerRatioMap
;
List
<
ApiExpectedFortunePageResponse
>
voList
=
expectedFortuneList
.
stream
().
map
(
ef
->
{
ApiExpectedFortunePageResponse
vo
=
new
ApiExpectedFortunePageResponse
();
BeanUtils
.
copyProperties
(
ef
,
vo
);
Policy
policy
=
policyMap
.
get
(
expectedFortune
.
getPolicyNo
());
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
expectedFortune
.
getPolicyNo
());
String
ratio
=
finalBrokerRatioMap
.
get
(
ef
.
getBrokerBizId
());
vo
.
setCommissionRatio
(
ratio
);
Policy
policy
=
policyMap
.
get
(
ef
.
getPolicyNo
());
PolicyFollow
follow
=
policyFollowMap
.
get
(
ef
.
getPolicyNo
());
if
(
policy
!=
null
)
{
expectedFortuneVO
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
expectedFortuneVO
.
setPremium
(
policy
.
getPaymentPremium
());
vo
.
setInsuranceCompany
(
policy
.
getInsuranceCompany
());
vo
.
setPremium
(
policy
.
getPaymentPremium
());
}
if
(
policyF
ollow
!=
null
)
{
expectedFortuneVO
.
setProductName
(
policyF
ollow
.
getProductName
());
expectedFortuneVO
.
setProductLaunchBizId
(
policyF
ollow
.
getProductLaunchBizId
());
if
(
f
ollow
!=
null
)
{
vo
.
setProductName
(
f
ollow
.
getProductName
());
vo
.
setProductLaunchBizId
(
f
ollow
.
getProductLaunchBizId
());
}
return
expectedFortuneVO
;
return
vo
;
}).
collect
(
Collectors
.
toList
());
return
expectedFortuneVOList
;
return
voList
;
}
@Override
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaCustomerServiceImpl.java
0 → 100644
View file @
60a764a9
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.gson.reflect.TypeToken
;
import
com.yd.base.feign.client.relobjectcertificate.ApiRelObjectCertificateFeignClient
;
import
com.yd.base.feign.dto.ApiCertificateDto
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.dto.DependantData
;
import
com.yd.csf.service.dto.TaxCountry
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.model.FnaCustomer
;
import
com.yd.csf.service.model.FnaForm
;
import
com.yd.csf.service.service.CustomerService
;
import
com.yd.csf.service.service.FnaCustomerService
;
import
com.yd.csf.service.dao.FnaCustomerMapper
;
import
com.yd.csf.service.service.FnaFormService
;
import
com.yd.csf.service.service.FnaService
;
import
com.yd.csf.service.utils.GSONUtil
;
import
com.yd.csf.service.vo.AddressVO
;
import
com.yd.csf.service.vo.CustomerVO
;
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.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author Zhang Jianan
* @description 针对表【fna_customer(客户信息表)】的数据库操作Service实现
* @createDate 2026-03-09 10:45:37
*/
@Service
public
class
FnaCustomerServiceImpl
extends
ServiceImpl
<
FnaCustomerMapper
,
FnaCustomer
>
implements
FnaCustomerService
{
@Resource
private
FnaCustomerService
fnaCustomerService
;
@Resource
private
CustomerService
customerService
;
@Resource
private
FnaService
fnaService
;
@Resource
private
FnaFormService
fnaFormService
;
@Resource
private
ApiRelObjectCertificateFeignClient
apiRelObjectCertificateFeignClient
;
@Override
public
void
validCustomer
(
FnaCustomer
fnaCustomer
)
{
if
(
StringUtils
.
isBlank
(
fnaCustomer
.
getNamePyEn
()))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"名字-英文不能为空"
);
}
if
(
StringUtils
.
isBlank
(
fnaCustomer
.
getMobile
()))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"客户手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
fnaCustomer
.
getAge
()))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"年龄不能为空"
);
}
if
(
StringUtils
.
isBlank
(
fnaCustomer
.
getNationality
()))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"国籍不能为空"
);
}
}
@Override
public
int
queryDependentsNum
(
String
fnaBizId
)
{
Fna
fna
=
fnaService
.
getByBizId
(
fnaBizId
);
if
(
fna
==
null
)
{
return
0
;
}
FnaForm
fnaForm
=
fnaFormService
.
getByFnaFormBizId
(
fna
.
getFnaFormBizId
());
if
(
fnaForm
!=
null
)
{
if
(
StringUtils
.
isNotBlank
((
CharSequence
)
fnaForm
.
getDependantList
())
&&
!
"null"
.
equals
(
fnaForm
.
getDependantList
()))
{
List
<
DependantData
>
dependantList
=
GSONUtil
.
fromJson
((
String
)
fnaForm
.
getDependantList
(),
new
TypeToken
<
List
<
DependantData
>>()
{
}.
getType
());
return
dependantList
.
size
();
}
}
return
0
;
}
@Override
public
CustomerVO
getCustomerVO
(
FnaCustomer
fnaCustomer
)
{
if
(
fnaCustomer
==
null
)
{
return
null
;
}
// 查询受供养人数量
int
dependentsNum
=
fnaCustomerService
.
queryDependentsNum
(
fnaCustomer
.
getFnaBizId
());
// 获取封装类
CustomerVO
customerVO
=
new
CustomerVO
();
BeanUtils
.
copyProperties
(
fnaCustomer
,
customerVO
);
customerVO
.
setDependentsNum
(
dependentsNum
);
if
(
ObjectUtils
.
isNotEmpty
(
fnaCustomer
.
getAddressList
()))
{
List
<
AddressVO
>
addressList
=
GSONUtil
.
fromJson
(
fnaCustomer
.
getAddressList
(),
new
TypeToken
<
List
<
AddressVO
>>()
{
}.
getType
());
customerVO
.
setAddressList
(
addressList
);
}
if
(
ObjectUtils
.
isNotEmpty
(
fnaCustomer
.
getTaxList
()))
{
List
<
TaxCountry
>
taxList
=
GSONUtil
.
fromJson
((
String
)
fnaCustomer
.
getTaxList
(),
new
TypeToken
<
List
<
TaxCountry
>>()
{
}.
getType
());
customerVO
.
setApiTaxationDtoList
(
taxList
);
}
if
(
ObjectUtils
.
isNotEmpty
(
fnaCustomer
.
getCertificateList
()))
{
List
<
ApiCertificateDto
>
certificateList
=
GSONUtil
.
fromJson
((
String
)
fnaCustomer
.
getCertificateList
(),
new
TypeToken
<
List
<
ApiCertificateDto
>>()
{
}.
getType
());
customerVO
.
setApiCertificateDtoList
(
certificateList
);
}
return
customerVO
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
View file @
60a764a9
...
...
@@ -124,7 +124,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
fortuneAccount
.
setBroker
(
accountExportDTO
.
getBroker
());
fortuneAccount
.
setTeam
(
accountExportDTO
.
getTeam
());
fortuneAccount
.
setCurrency
(
accountExportDTO
.
getCurrency
());
fortuneAccount
.
setAmount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
set
Hkd
Amount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
setFortuneAccountDate
(
currentDate
);
// 出账状态默认待出账
fortuneAccount
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
...
...
@@ -361,7 +361,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
List
<
FortuneAccount
>
fortuneAccountList
=
this
.
baseMapper
.
selectBatchIds
(
fortuneAccountIdList
);
BigDecimal
totalAmount
=
fortuneAccountList
.
stream
()
.
map
(
FortuneAccount:
:
getAmount
)
.
map
(
FortuneAccount:
:
get
Hkd
Amount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
int
brokerCount
=
fortuneAccountList
.
stream
()
.
map
(
FortuneAccount:
:
getBroker
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
60a764a9
...
...
@@ -138,10 +138,6 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
List
<
Policy
>
policyList
=
policyService
.
list
(
queryWrapper
);
Map
<
String
,
Policy
>
policyMap
=
policyList
.
stream
().
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
// 3.关联查询预计出账信息
List
<
ExpectedFortune
>
expectedFortuneList
=
expectedFortuneService
.
list
(
new
QueryWrapper
<
ExpectedFortune
>().
in
(
"expected_fortune_biz_id"
,
expectedFortuneBizIdSet
));
Map
<
String
,
ExpectedFortune
>
expectedFortuneMap
=
expectedFortuneList
.
stream
().
collect
(
Collectors
.
toMap
(
ExpectedFortune:
:
getExpectedFortuneBizId
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
fortuneVOList
.
forEach
(
fortuneVO
->
{
String
commissionBizId
=
fortuneVO
.
getCommissionExpectedBizId
();
// 设置来佣金额和比例
...
...
@@ -185,13 +181,13 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if
(
expectedFortune
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"预计出账数据不存在"
);
}
BigDecimal
currentPayment
Amount
=
fortuneUpdateRequest
.
getCurrentPayment
Amount
();
if
(
currentPaymentAmount
!=
null
)
{
if
(
currentPaymentAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账金额不能小于0"
);
BigDecimal
currentPayment
HkdAmount
=
fortuneUpdateRequest
.
getCurrentPaymentHkd
Amount
();
if
(
currentPayment
Hkd
Amount
!=
null
)
{
if
(
currentPayment
Hkd
Amount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账
港币
金额不能小于0"
);
}
if
(
currentPayment
Amount
.
compareTo
(
expectedFortune
.
get
Amount
())
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账
金额不能大于应付款
金额"
);
if
(
currentPayment
HkdAmount
.
compareTo
(
expectedFortune
.
getHkd
Amount
())
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账
港币金额不能大于应付款港币
金额"
);
}
if
(
StringUtils
.
isBlank
(
fortuneUpdateRequest
.
getCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账币种不能为空"
);
...
...
@@ -215,8 +211,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
fortune
.
setReconciliationOperator
(
currentLoginUser
.
getUsername
());
// 如果传入了金额
if
(
currentPayment
Amount
!=
null
)
{
splitFortune
(
fortune
,
currentPaymentAmount
,
expectedFortune
,
loginUserId
,
fortuneUpdateRequest
);
if
(
currentPayment
HkdAmount
!=
null
&&
currentPaymentHkdAmount
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
splitFortune
(
fortune
,
currentPayment
Hkd
Amount
,
expectedFortune
,
loginUserId
,
fortuneUpdateRequest
);
}
else
{
// 如果未传入金额,仅更新预计出账状态为已出帐
expectedFortuneService
.
lambdaUpdate
()
...
...
@@ -364,9 +360,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 校验发佣记录状态
StringBuilder
validateMsg
=
new
StringBuilder
();
for
(
Fortune
fortune
:
fortuneList
)
{
if
(
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
()))
{
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"当前未检核,请检核后再生成出账记录; "
);
}
//
if (StringUtils.equals(fortune.getStatus(), FortuneStatusEnum.CAN_SEND.getItemValue())) {
//
validateMsg.append(fortune.getPolicyNo()).append("-").append(fortune.getBroker()).append("当前未检核,请检核后再生成出账记录; ");
//
}
if
(
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
SENT
.
getItemValue
()))
{
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"已完成出账,不能生成出账记录; "
);
}
...
...
@@ -406,7 +402,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 计算出账总额
BigDecimal
totalAmount
=
brokerFortunes
.
stream
()
.
map
(
Fortune:
:
getCurrentPaymentAmount
)
.
map
(
Fortune:
:
getCurrentPayment
Hkd
Amount
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
accountDTO
.
setAmount
(
totalAmount
);
...
...
@@ -414,7 +410,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
Map
<
String
,
BigDecimal
>
fortuneAmountMap
=
brokerFortunes
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
Fortune:
:
getFortuneName
,
Collectors
.
reducing
(
BigDecimal
.
ZERO
,
Fortune:
:
getCurrentPaymentAmount
,
BigDecimal:
:
add
)
Collectors
.
reducing
(
BigDecimal
.
ZERO
,
Fortune:
:
getCurrentPayment
Hkd
Amount
,
BigDecimal:
:
add
)
));
// 设置各个fortune项目的金额
...
...
@@ -645,6 +641,40 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if
(
fortuneStatistics
.
getAvailableOutAmount
()
==
null
)
{
fortuneStatistics
.
setAvailableOutAmount
(
BigDecimal
.
ZERO
);
}
// 计算总保费、入账金额
if
(
CollectionUtils
.
isNotEmpty
(
fortuneIdList
))
{
List
<
Fortune
>
fortuneList
=
this
.
listByIds
(
fortuneIdList
);
Map
<
String
,
BigDecimal
>
exchangeRateMap
=
new
HashMap
<>();
for
(
Fortune
fortune
:
fortuneList
)
{
exchangeRateMap
.
put
(
fortune
.
getPolicyNo
(),
fortune
.
getExchangeRate
());
}
Set
<
String
>
policyNoSet
=
fortuneList
.
stream
().
map
(
Fortune:
:
getPolicyNo
).
collect
(
Collectors
.
toSet
());
// 查询总保费
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
().
in
(
Policy:
:
getPolicyNo
,
policyNoSet
).
list
();
BigDecimal
totalPremium
=
BigDecimal
.
ZERO
;
if
(
CollectionUtils
.
isNotEmpty
(
policyList
))
{
for
(
Policy
policy
:
policyList
)
{
BigDecimal
exchangeRate
=
exchangeRateMap
.
getOrDefault
(
policy
.
getPolicyNo
(),
BigDecimal
.
ONE
);
totalPremium
=
totalPremium
.
add
(
policy
.
getTotalPaymentPremium
().
multiply
(
exchangeRate
));
}
fortuneStatistics
.
setTotalPremium
(
totalPremium
);
}
// 查询总入账金额
List
<
Commission
>
commissions
=
commissionService
.
lambdaQuery
()
.
in
(
Commission:
:
getPolicyNo
,
policyNoSet
)
.
select
(
Commission:
:
getHkdAmount
)
.
list
();
BigDecimal
totalInAmount
=
BigDecimal
.
ZERO
;
if
(
CollectionUtils
.
isNotEmpty
(
commissions
))
{
for
(
Commission
commission
:
commissions
)
{
totalInAmount
=
totalInAmount
.
add
(
commission
.
getHkdAmount
());
}
fortuneStatistics
.
setTotalInAmount
(
totalInAmount
);
}
}
return
fortuneStatistics
;
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
View file @
60a764a9
...
...
@@ -490,6 +490,10 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
.
set
(
PolicyFollow:
:
getStatus
,
changePolicyFollowStatusRequest
.
getStatus
())
.
set
(
PolicyFollow:
:
getNextStatusList
,
getNextStatus
(
policyFollowStatusEnum
))
.
set
(
PolicyFollow:
:
getUpdaterId
,
loginUserId
)
//冷静期结束日期
.
set
(
PolicyFollow:
:
getCoolingOffEndDate
,
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
!=
null
?
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
:
policyFollow
.
getCoolingOffEndDate
())
//保单截止日期
.
set
(
PolicyFollow:
:
getPolicyExpirationDate
,
changePolicyFollowStatusRequest
.
getPolicyExpirationDate
()
!=
null
?
changePolicyFollowStatusRequest
.
getPolicyExpirationDate
()
:
policyFollow
.
getPolicyExpirationDate
())
.
eq
(
PolicyFollow:
:
getId
,
policyFollow
.
getId
())
.
update
();
...
...
@@ -512,6 +516,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
policy
.
setCoolingOffEndDate
(
policyFollow
.
getCoolingOffEndDate
());
policy
.
setReconciliationCompanyBizId
(
policyFollow
.
getReconciliationCompanyBizId
());
policy
.
setReconciliationCompanyCode
(
policyFollow
.
getReconciliationCompanyCode
());
policy
.
setReconciliationCompany
(
policyFollow
.
getReconciliationCompany
());
// 更新保单状态为生效
policy
.
setStatus
(
PolicyStatusEnum
.
INFORCE
.
getItemValue
());
// 手动映射不同名的字段
...
...
@@ -521,6 +526,8 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
policy
.
setTotalPaymentPremium
(
calculateTotalPaymentPremium
(
policy
));
policy
.
setUnderwritingDate
(
changePolicyFollowStatusRequest
.
getUnderwritingDate
());
policy
.
setEffectiveDate
(
changePolicyFollowStatusRequest
.
getEffectiveDate
());
//冷静期结束日期
policy
.
setCoolingOffEndDate
(
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
!=
null
?
changePolicyFollowStatusRequest
.
getCoolingOffEndDate
()
:
policy
.
getCoolingOffEndDate
());
if
(
ObjectUtils
.
isEmpty
(
policy
.
getInsuranceCompany
())
||
ObjectUtils
.
isEmpty
(
policy
.
getInsuranceCompany
()))
{
// 获取保单产品信息,填充对账公司相关字段
...
...
@@ -723,6 +730,14 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
}
@Override
public
PolicyFollow
queryOneByPolicyBizId
(
String
policyBizId
)
{
return
this
.
getOne
(
new
LambdaQueryWrapper
<
PolicyFollow
>()
.
eq
(
PolicyFollow:
:
getPolicyBizId
,
policyBizId
)
.
last
(
" limit 1 "
)
);
}
@Override
public
Boolean
uploadAttachment
(
AttachmentUploadRequest
attachmentUploadRequest
)
{
String
policyBizId
=
attachmentUploadRequest
.
getPolicyBizId
();
if
(
policyBizId
==
null
)
{
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
View file @
60a764a9
...
...
@@ -16,7 +16,9 @@ import com.yd.csf.feign.dto.appointment.ApiProductPlanMainInfoDto;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.model.PolicyAdditional
;
import
com.yd.csf.service.model.PolicyFollow
;
import
com.yd.csf.service.service.PolicyAdditionalService
;
import
com.yd.csf.service.service.PolicyFollowService
;
import
com.yd.csf.service.service.PolicyService
;
import
com.yd.csf.service.dao.PolicyMapper
;
import
com.yd.csf.service.vo.PolicyVO
;
...
...
@@ -33,6 +35,7 @@ import org.springframework.util.CollectionUtils;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.ZoneId
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -50,6 +53,8 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
@Resource
private
PolicyAdditionalService
policyAdditionalService
;
@Resource
private
PolicyFollowService
policyFollowService
;
@Resource
private
ApiRelProjectProductLaunchFeignClient
apiRelProjectProductLaunchFeignClient
;
@Override
...
...
@@ -102,64 +107,187 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updatePolicy
(
PolicyUpdateRequest
policyUpdateRequest
)
{
ApiProductPlanMainInfoDto
dto
=
policyUpdateRequest
.
getApiProductPlanMainInfoDto
();
if
(
dto
==
null
)
{
throw
new
BusinessException
(
"产品计划对象不能为空"
);
}
String
policyBizId
=
policyUpdateRequest
.
getPolicyBizId
();
if
(
StringUtils
.
isBlank
(
policyBizId
))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"policyBizId不能为空"
);
}
Policy
policy
=
this
.
getOne
(
new
QueryWrapper
<
Policy
>().
eq
(
"policy_biz_id"
,
policyBizId
));
if
(
policy
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"保单不存在"
);
}
BigDecimal
paymentPremium
=
policy
.
getPaymentPremium
();
if
(
paymentPremium
==
null
)
{
throw
new
BusinessException
(
"期交保费不能为空"
);
}
Object
paymentTerm
=
policy
.
getPaymentTerm
();
if
(
paymentTerm
==
null
)
{
throw
new
BusinessException
(
"供款期数不能为空"
);
}
// 手动映射字段,处理类型转换
Date
now
=
new
Date
();
// 保单信息
ApiProductPlanMainInfoDto
apiProductPlanMainInfoDto
=
policyUpdateRequest
.
getApiProductPlanMainInfoDto
();
if
(
apiProductPlanMainInfoDto
!=
null
)
{
BeanUtils
.
copyProperties
(
apiProductPlanMainInfoDto
,
policy
,
"policyBizId"
,
"id"
);
policy
.
setPaymentPremium
(
apiProductPlanMainInfoDto
.
getEachIssuePremium
());
policy
.
setTotalPaymentPremium
(
calculateTotalPaymentPremium
(
apiProductPlanMainInfoDto
));
policy
.
setIsPrepaid
(
apiProductPlanMainInfoDto
.
getIsPrepay
());
policy
.
setUpdateTime
(
now
);
// 更新保单
this
.
updateById
(
policy
);
// 保单基本信息
policy
.
setPolicyBizId
(
policyBizId
);
policy
.
setProductLaunchBizId
(
dto
.
getProductLaunchBizId
());
policy
.
setProductName
(
dto
.
getProductLaunchMainName
());
policy
.
setInsuranceCompany
(
dto
.
getCompanyName
());
policy
.
setInsuranceCompanyBizId
(
dto
.
getCompanyId
());
policy
.
setReconciliationCompany
(
dto
.
getReconciliationCompanyName
());
policy
.
setReconciliationCompanyBizId
(
dto
.
getReconciliationCompanyId
());
policy
.
setCurrency
(
dto
.
getPolicyCurrency
());
policy
.
setProductCate
(
dto
.
getInsuranceTypeId
());
policy
.
setPaymentTerm
(
dto
.
getIssueNumber
());
// 保障年期
policy
.
setGuaranteePeriod
(
dto
.
getGuaranteePeriod
());
// 保额
policy
.
setSumInsured
(
parseBigDecimal
(
dto
.
getSumInsured
()));
// 期交保费
BigDecimal
eachIssuePremium
=
parseBigDecimal
(
dto
.
getEachIssuePremium
());
if
(
eachIssuePremium
==
null
)
{
throw
new
BusinessException
(
"每期保费不能为空"
);
}
String
policyNo
=
policy
.
getPolicyNo
();
// 先删除旧的附加险
policyAdditionalService
.
remove
(
new
QueryWrapper
<
PolicyAdditional
>().
eq
(
"policy_biz_id"
,
policyBizId
));
// 保单附加险列表
List
<
ApiProductPlanAdditionalInfoDto
>
apiProductPlanAdditionalInfoDtoList
=
policyUpdateRequest
.
getApiProductPlanAdditionalInfoDtoList
();
if
(
CollUtil
.
isNotEmpty
(
apiProductPlanAdditionalInfoDtoList
))
{
// 转换为实体类
List
<
PolicyAdditional
>
policyAdditionalList
=
apiProductPlanAdditionalInfoDtoList
.
stream
().
map
(
additionalDto
->
{
PolicyAdditional
policyAdditional
=
new
PolicyAdditional
();
BeanUtils
.
copyProperties
(
additionalDto
,
policyAdditional
);
policyAdditional
.
setPolicyBizId
(
policyBizId
);
policyAdditional
.
setPolicyNo
(
policyNo
);
policyAdditional
.
setUpdateTime
(
now
);
policyAdditional
.
setCreateTime
(
now
);
return
policyAdditional
;
}).
collect
(
Collectors
.
toList
());
// 批量插入
policyAdditionalService
.
saveBatch
(
policyAdditionalList
);
policy
.
setPaymentPremium
(
eachIssuePremium
);
// 总保费计算
policy
.
setTotalPaymentPremium
(
calculateTotalPaymentPremium
(
dto
));
// 保单征费
policy
.
setPolicyLevy
(
parseString
(
dto
.
getPolicyLevy
()));
// 是否预缴
policy
.
setIsPrepaid
(
parseInteger
(
dto
.
getIsPrepay
()));
// 预缴年期
policy
.
setPrepaidTerm
(
parseInteger
(
dto
.
getPrepaymentPeriod
()));
// 是否回溯
policy
.
setIsBacktrack
(
parseInteger
(
dto
.
getIsTraceable
()));
// 首期付款方式
policy
.
setInitialPaymentMethod
(
dto
.
getInitialPaymentMethod
());
// 续期付款方式
policy
.
setRenewalPaymentMethod
(
dto
.
getRenewalPaymentMethod
());
// 红利分配方式
policy
.
setDividendDistributionMethod
(
dto
.
getDividendDistributionMethod
());
policy
.
setUpdateTime
(
now
);
this
.
updateById
(
policy
);
// 更新 PolicyFollow
PolicyFollow
policyFollow
=
policyFollowService
.
queryOneByPolicyBizId
(
policyBizId
);
if
(
policyFollow
==
null
)
{
throw
new
BusinessException
(
"新单跟进信息不存在"
);
}
//PolicyFollow 字段
policyFollow
.
setProductLaunchBizId
(
dto
.
getProductLaunchBizId
());
policyFollow
.
setProductName
(
dto
.
getProductLaunchMainName
());
policyFollow
.
setInsuranceCompany
(
dto
.
getCompanyName
());
policyFollow
.
setInsuranceCompanyBizId
(
dto
.
getCompanyId
());
policyFollow
.
setReconciliationCompany
(
dto
.
getReconciliationCompanyName
());
policyFollow
.
setReconciliationCompanyBizId
(
dto
.
getReconciliationCompanyId
());
policyFollow
.
setReconciliationCompanyCode
(
null
);
policyFollow
.
setProductCate
(
dto
.
getInsuranceTypeName
());
policyFollow
.
setCategoryCode
(
dto
.
getInsuranceTypeCode
());
policyFollow
.
setInsuranceCategoryBizId
(
dto
.
getInsuranceTypeId
());
policyFollow
.
setIssueNumber
(
dto
.
getIssueNumber
());
policyFollow
.
setGuaranteePeriod
(
dto
.
getGuaranteePeriod
());
policyFollow
.
setSumInsured
(
parseBigDecimal
(
dto
.
getSumInsured
()));
policyFollow
.
setPaymentFrequency
(
dto
.
getPaymentFrequency
());
policyFollow
.
setEachIssuePremium
(
eachIssuePremium
);
policyFollow
.
setIsPrepay
(
parseInteger
(
dto
.
getIsPrepay
()));
policyFollow
.
setIsTraceable
(
parseInteger
(
dto
.
getIsTraceable
()));
policyFollow
.
setPrepaidTerm
(
parseInteger
(
dto
.
getPrepaymentPeriod
()));
policyFollow
.
setPolicyCurrency
(
dto
.
getPolicyCurrency
());
policyFollow
.
setInitialPaymentMethod
(
dto
.
getInitialPaymentMethod
());
policyFollow
.
setRenewalPaymentMethod
(
dto
.
getRenewalPaymentMethod
());
policyFollow
.
setDividendDistributionMethod
(
dto
.
getDividendDistributionMethod
());
policyFollow
.
setPolicyLevy
(
parseString
(
dto
.
getPolicyLevy
()));
// 回溯日期处理
if
(
dto
.
getBacktrackDate
()
!=
null
)
{
policyFollow
.
setRetroactiveDate
(
Date
.
from
(
dto
.
getBacktrackDate
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()));
}
else
{
policyFollow
.
setRetroactiveDate
(
null
);
}
policyFollow
.
setUpdateTime
(
now
);
policyFollowService
.
updateById
(
policyFollow
);
return
true
;
}
private
BigDecimal
calculateTotalPaymentPremium
(
ApiProductPlanMainInfoDto
apiProductPlanMainInfoDto
)
{
// 计算总保费
return
apiProductPlanMainInfoDto
.
getEachIssuePremium
()
.
multiply
(
new
BigDecimal
(
apiProductPlanMainInfoDto
.
getPaymentFrequency
()))
// 类型转换辅助方法
private
BigDecimal
parseBigDecimal
(
Object
obj
)
{
if
(
obj
==
null
)
return
null
;
if
(
obj
instanceof
BigDecimal
)
return
(
BigDecimal
)
obj
;
if
(
obj
instanceof
String
)
{
String
str
=
((
String
)
obj
).
trim
();
if
(
str
.
isEmpty
())
return
null
;
try
{
return
new
BigDecimal
(
str
);
}
catch
(
NumberFormatException
e
)
{
log
.
warn
(
"解析 BigDecimal 失败: {}"
,
str
);
return
null
;
}
}
if
(
obj
instanceof
Number
)
{
return
BigDecimal
.
valueOf
(((
Number
)
obj
).
doubleValue
());
}
return
null
;
}
private
Integer
parseInteger
(
Object
obj
)
{
if
(
obj
==
null
)
return
null
;
if
(
obj
instanceof
Integer
)
return
(
Integer
)
obj
;
if
(
obj
instanceof
String
)
{
String
str
=
((
String
)
obj
).
trim
();
if
(
str
.
isEmpty
())
return
null
;
try
{
return
Integer
.
valueOf
(
str
);
}
catch
(
NumberFormatException
e
)
{
log
.
warn
(
"解析 Integer 失败: {}"
,
str
);
return
null
;
}
}
if
(
obj
instanceof
Number
)
{
return
((
Number
)
obj
).
intValue
();
}
return
null
;
}
private
String
parseString
(
Object
obj
)
{
if
(
obj
==
null
)
return
null
;
if
(
obj
instanceof
String
)
{
String
str
=
((
String
)
obj
).
trim
();
return
str
.
isEmpty
()
?
null
:
str
;
}
return
obj
.
toString
();
}
private
BigDecimal
calculateTotalPaymentPremium
(
ApiProductPlanMainInfoDto
dto
)
{
// 校验每期保费(必填)
BigDecimal
eachIssuePremium
=
dto
.
getEachIssuePremium
();
if
(
eachIssuePremium
==
null
)
{
throw
new
BusinessException
(
"每期保费不能为空"
);
}
String
issueNumberStr
=
dto
.
getIssueNumber
();
BigDecimal
issueNumber
;
// 供款期数为空时,默认按 1 期处理
if
(
StringUtils
.
isBlank
(
issueNumberStr
))
{
issueNumber
=
new
BigDecimal
(
"1"
);
}
else
{
// 安全转换为 BigDecimal
try
{
issueNumber
=
new
BigDecimal
(
issueNumberStr
.
trim
());
}
catch
(
NumberFormatException
e
)
{
throw
new
BusinessException
(
"供款期数格式不正确,请填写数字"
);
}
// 业务逻辑校验:期数必须为正整数
if
(
issueNumber
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
throw
new
BusinessException
(
"供款期数必须大于0"
);
}
// 检查是否为整数(去除小数部分后与原值比较)
if
(
issueNumber
.
stripTrailingZeros
().
scale
()
>
0
)
{
throw
new
BusinessException
(
"供款期数必须为整数"
);
}
}
// 计算总保费并保留4位小数
return
eachIssuePremium
.
multiply
(
issueNumber
)
.
setScale
(
4
,
RoundingMode
.
HALF_UP
);
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/CustomerVO.java
View file @
60a764a9
...
...
@@ -28,6 +28,12 @@ public class CustomerVO implements Serializable {
private
Long
id
;
/**
* fna业务id
*/
@Schema
(
description
=
"fna业务id"
)
private
String
fnaBizId
;
/**
* 客户唯一业务ID
*/
@Schema
(
description
=
"客户业务ID"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneAccountVO.java
View file @
60a764a9
...
...
@@ -44,10 +44,10 @@ public class FortuneAccountVO {
private
String
currency
;
/**
*
出账总
额
*
港币出账金
额
*/
@Schema
(
description
=
"
出账总
额"
)
private
BigDecimal
a
mount
;
@Schema
(
description
=
"
港币出账金
额"
)
private
BigDecimal
hkdA
mount
;
/**
* 出账状态
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
View file @
60a764a9
...
...
@@ -53,6 +53,12 @@ public class FortuneVO implements Serializable {
private
String
policyNo
;
/**
* 保单币种
*/
@Schema
(
description
=
"保单币种"
)
private
String
policyCurrency
;
/**
* 期交保费
*/
@Schema
(
description
=
"期交保费"
)
...
...
@@ -161,6 +167,18 @@ public class FortuneVO implements Serializable {
private
String
currency
;
/**
* 结算汇率
*/
@Schema
(
description
=
"结算汇率"
)
private
BigDecimal
exchangeRate
;
/**
* 港币出账金额
*/
@Schema
(
description
=
"港币出账金额"
)
private
BigDecimal
hkdAmount
;
/**
* 已出账金额
*/
@Schema
(
description
=
"已出账金额"
)
...
...
@@ -179,6 +197,12 @@ public class FortuneVO implements Serializable {
private
BigDecimal
currentPaymentAmount
;
/**
* 本次出账港币金额
*/
@Schema
(
description
=
"本次出账港币金额"
)
private
BigDecimal
currentPaymentHkdAmount
;
/**
* 本期出账比例
*/
@Schema
(
description
=
"本期出账比例"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowDetailVO.java
View file @
60a764a9
...
...
@@ -7,6 +7,7 @@ import com.yd.csf.service.model.PolicyBroker;
import
com.yd.csf.service.model.PolicyFollow
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
java.io.Serializable
;
...
...
@@ -530,6 +531,25 @@ public class PolicyFollowDetailVO implements Serializable {
detailVO
.
setPolicyBizId
(
policyFollow
.
getPolicyBizId
());
// 转换PolicyFollow
BeanUtils
.
copyProperties
(
policyFollow
,
detailVO
);
Object
issueNumberObj
=
policyFollow
.
getIssueNumber
();
if
(
issueNumberObj
instanceof
Integer
)
{
detailVO
.
setIssueNumber
((
Integer
)
issueNumberObj
);
}
else
if
(
issueNumberObj
instanceof
String
)
{
String
str
=
(
String
)
issueNumberObj
;
if
(
StringUtils
.
isNotBlank
(
str
))
{
try
{
detailVO
.
setIssueNumber
(
Integer
.
parseInt
(
str
.
trim
()));
}
catch
(
NumberFormatException
e
)
{
// 可记录日志,然后置为 null
detailVO
.
setIssueNumber
(
null
);
}
}
else
{
detailVO
.
setIssueNumber
(
null
);
}
}
else
{
// 其他类型(如 null 或意外类型)统一置 null
detailVO
.
setIssueNumber
(
null
);
}
// 处理 nextStatusList 字段
Object
nextStatusList
=
policyFollow
.
getNextStatusList
();
if
(
nextStatusList
!=
null
&&
!
nextStatusList
.
toString
().
isEmpty
())
{
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyFollowVO.java
View file @
60a764a9
...
...
@@ -120,7 +120,7 @@ public class PolicyFollowVO implements Serializable {
* 缴费年期
*/
@Schema
(
description
=
"缴费年期"
)
private
Integer
issueNumber
;
private
Object
issueNumber
;
/**
* 保险公司
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/PolicyVO.java
View file @
60a764a9
...
...
@@ -81,7 +81,7 @@ public class PolicyVO {
* 供款年期
*/
@Schema
(
description
=
"供款年期"
)
private
Integer
paymentTerm
;
private
Object
paymentTerm
;
/**
* 期交保费
...
...
yd-csf-service/src/main/resources/mappers/CommissionMapper.xml
View file @
60a764a9
...
...
@@ -106,7 +106,7 @@
), 0
) as expectePaidAmount,
COUNT(DISTINCT c.policy_no) as totalPolicyCount,
COALESCE(
SUM(CAST(c.premium AS DECIMAL(15,2)) * p.payment_term)
, 0) AS totalPremium,
COALESCE(
p.total_payment_premium * e.default_exchange_rate
, 0) AS totalPremium,
COUNT(DISTINCT c.reconciliation_company) as reconciliationCompanyCount,
COUNT(DISTINCT c.id) as totalCompareCommissionCount,
SUM(CASE WHEN c.status = '1' THEN 1 ELSE 0 END) as successCompareCommissionCount,
...
...
yd-csf-service/src/main/resources/mappers/ConditionConfigMapper.xml
View file @
60a764a9
...
...
@@ -12,4 +12,20 @@
and cc.is_deleted = 0
</where>
</select>
<select
id=
"selectBrokerRatioByBizIds"
resultType=
"java.util.Map"
>
SELECT
aaf.agent_id AS brokerBizId,
cc.conditional_value
FROM agent_accumulated_fyc aaf
LEFT JOIN condition_config cc
ON aaf.total_fyc >= cc.min_value
AND (cc.max_value IS NULL OR aaf.total_fyc
<
cc.max_value)
AND cc.condition_type_biz_id = 'condition_type_sk33eRvu75eF8IRL'
WHERE aaf.agent_id IN
<foreach
collection=
"list"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</select>
</mapper>
yd-csf-service/src/main/resources/mappers/FnaCustomerMapper.xml
0 → 100644
View file @
60a764a9
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yd.csf.service.dao.FnaCustomerMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yd.csf.service.model.FnaCustomer"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"fnaCustomerBizId"
column=
"fna_customer_biz_id"
/>
<result
property=
"customerBizId"
column=
"customer_biz_id"
/>
<result
property=
"fnaBizId"
column=
"fna_biz_id"
/>
<result
property=
"nameCn"
column=
"name_cn"
/>
<result
property=
"namePyEn"
column=
"name_py_en"
/>
<result
property=
"documentType"
column=
"document_type"
/>
<result
property=
"idNumber"
column=
"id_number"
/>
<result
property=
"gender"
column=
"gender"
/>
<result
property=
"birthday"
column=
"birthday"
/>
<result
property=
"age"
column=
"age"
/>
<result
property=
"nationality"
column=
"nationality"
/>
<result
property=
"birthplace"
column=
"birthplace"
/>
<result
property=
"isOtherCountry"
column=
"is_other_country"
/>
<result
property=
"taxList"
column=
"tax_list"
/>
<result
property=
"smokingStatus"
column=
"smoking_status"
/>
<result
property=
"maritalStatus"
column=
"marital_status"
/>
<result
property=
"educationLevel"
column=
"education_level"
/>
<result
property=
"isRetirement"
column=
"is_retirement"
/>
<result
property=
"retirementAge"
column=
"retirement_age"
/>
<result
property=
"height"
column=
"height"
/>
<result
property=
"weight"
column=
"weight"
/>
<result
property=
"bmi"
column=
"bmi"
/>
<result
property=
"riskAppetite"
column=
"risk_appetite"
/>
<result
property=
"dependentsNum"
column=
"dependents_num"
/>
<result
property=
"mobileCode"
column=
"mobile_code"
/>
<result
property=
"mobile"
column=
"mobile"
/>
<result
property=
"residenceMobileCode"
column=
"residence_mobile_code"
/>
<result
property=
"residenceMobile"
column=
"residence_mobile"
/>
<result
property=
"landlineCode"
column=
"landline_code"
/>
<result
property=
"landline"
column=
"landline"
/>
<result
property=
"email"
column=
"email"
/>
<result
property=
"certificateAddress"
column=
"certificate_address"
/>
<result
property=
"mailingAddress"
column=
"mailing_address"
/>
<result
property=
"residentialAddress"
column=
"residential_address"
/>
<result
property=
"mailingAddressCode"
column=
"mailing_address_code"
/>
<result
property=
"employmentStatus"
column=
"employment_status"
/>
<result
property=
"csName"
column=
"cs_name"
/>
<result
property=
"industry"
column=
"industry"
/>
<result
property=
"currentMonthlyIncome"
column=
"current_monthly_income"
/>
<result
property=
"totalWorkingYears"
column=
"total_working_years"
/>
<result
property=
"currentTenure"
column=
"current_tenure"
/>
<result
property=
"position"
column=
"position"
/>
<result
property=
"companyAddress"
column=
"company_address"
/>
<result
property=
"companyMobileCode"
column=
"company_mobile_code"
/>
<result
property=
"companyMobile"
column=
"company_mobile"
/>
<result
property=
"companyAddressCode"
column=
"company_address_code"
/>
<result
property=
"monthIncome"
column=
"month_income"
/>
<result
property=
"monthExpenditure"
column=
"month_expenditure"
/>
<result
property=
"totalCurrentAssets"
column=
"total_current_assets"
/>
<result
property=
"totalDebt"
column=
"total_debt"
/>
<result
property=
"travel"
column=
"travel"
/>
<result
property=
"exercise"
column=
"exercise"
/>
<result
property=
"game"
column=
"game"
/>
<result
property=
"movieDrama"
column=
"movie_drama"
/>
<result
property=
"delicacy"
column=
"delicacy"
/>
<result
property=
"addressList"
column=
"address_list"
/>
<result
property=
"certificateList"
column=
"certificate_list"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"isDeleted"
column=
"is_deleted"
/>
<result
property=
"creatorId"
column=
"creator_id"
/>
<result
property=
"updaterId"
column=
"updater_id"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,fna_customer_biz_id,customer_biz_id,fna_biz_id,name_cn,name_py_en,document_type,
id_number,gender,birthday,age,nationality,
birthplace,is_other_country,tax_list,smoking_status,marital_status,
education_level,is_retirement,retirement_age,height,weight,
bmi,risk_appetite,dependents_num,mobile_code,mobile,
residence_mobile_code,residence_mobile,landline_code,landline,email,
certificate_address,mailing_address,residential_address,mailing_address_code,employment_status,
cs_name,industry,current_monthly_income,total_working_years,current_tenure,
position,company_address,company_mobile_code,company_mobile,company_address_code,
month_income,month_expenditure,total_current_assets,total_debt,travel,
exercise,game,movie_drama,delicacy,address_list,
certificate_list,remark,is_deleted,creator_id,updater_id,
create_time,update_time
</sql>
</mapper>
yd-csf-service/src/main/resources/mappers/FortuneAccountMapper.xml
View file @
60a764a9
...
...
@@ -8,6 +8,10 @@
<id
property=
"id"
column=
"id"
/>
<result
property=
"fortuneAccountBizId"
column=
"fortune_account_biz_id"
/>
<result
property=
"broker"
column=
"broker"
/>
<result
property=
"currency"
column=
"currency"
/>
<result
property=
"amount"
column=
"amount"
/>
<result
property=
"hkdAmount"
column=
"hkd_amount"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"fortuneAccountDate"
column=
"fortune_account_date"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"remark"
column=
"remark"
/>
...
...
@@ -19,7 +23,7 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
id,fortune_account_biz_id,broker,fortune_account_date,content,remark,
id,fortune_account_biz_id,broker,
currency,amount,hkd_amount,status,
fortune_account_date,content,remark,
is_deleted,creator_id,updater_id,create_time,update_time
</sql>
</mapper>
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
View file @
60a764a9
...
...
@@ -66,15 +66,12 @@
SUM(CASE WHEN f.is_part = '0' THEN f.hkd_amount ELSE 0 END) AS amount,
SUM(CASE WHEN f.status = '2' THEN f.current_payment_hkd_amount ELSE 0 END) AS sentAmount,
IFNULL(
(select sum(
hk
d_amount)
(select sum(
unpai
d_amount)
from expected_fortune where status = '0' and policy_no = f.policy_no
),0) AS pendingOutAmount,
SUM(CASE WHEN f.status in ('6','1') THEN f.current_payment_hkd_amount ELSE 0 END) AS availableOutAmount,
COUNT(DISTINCT f.policy_no) AS totalPolicyCount,
MAX(ce.expected_amount) AS totalInAmount,
MAX(ce.premium) AS totalPremium
COUNT(DISTINCT f.policy_no) AS totalPolicyCount
FROM fortune f
LEFT JOIN commission_expected ce ON f.commission_expected_biz_id = ce.commission_expected_biz_id
WHERE 1 = 1
<if
test=
"fortuneIdList != null and fortuneIdList.size() > 0"
>
AND f.id IN
...
...
yd-csf-service/src/main/resources/mappers/PremiumReconciliationMapper.xml
View file @
60a764a9
...
...
@@ -8,7 +8,7 @@
pr.premium_reconciliation_biz_id,
pr.current_issue_number,
pr.reconciliation_type,
p.insurance_company AS insuranceCompany,
p
f
.insurance_company AS insuranceCompany,
pr.policy_no,
pf.status AS policyFollowStatus,
pr.reconciliation_status,
...
...
@@ -27,7 +27,7 @@
pb.broker_name AS brokerName,
pr.create_time,
pr.update_time,
p
.reconciliation_company
p
f.reconciliation_company_biz_id
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
...
...
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