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
bdfc676e
Commit
bdfc676e
authored
May 18, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/test' into test_zxm_salary
parents
4779ebb8
d0523a47
Show whitespace changes
Inline
Side-by-side
Showing
65 changed files
with
1553 additions
and
596 deletions
+1553
-596
.idea/encodings.xml
+0
-1
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
+25
-1
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFortuneController.java
+19
-3
yd-csf-api/src/main/java/com/yd/csf/api/handler/EvaluateRankJobHandler.java
+4
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/ApiCommissionExpectedService.java
+4
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentServiceImpl.java
+2
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiCommissionExpectedServiceImpl.java
+19
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+168
-94
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPolicyReceiptServiceImpl.java
+38
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
+2
-2
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
+44
-6
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/excel/ApiSalarySplitSummaryExcelDto.java
+3
-3
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ApiExpectedFortunePageRequest.java
+1
-3
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneAddRequest.java
+52
-85
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneUpdateRequest.java
+58
-63
yd-csf-feign/src/main/java/com/yd/csf/feign/request/salarysplit/ApiSalarySplitSummaryPageRequest.java
+5
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
+58
-29
yd-csf-service/src/main/java/com/yd/csf/service/component/PolicyReportPdfService.java
+2
-1
yd-csf-service/src/main/java/com/yd/csf/service/config/XxlJobConfig.java
+44
-44
yd-csf-service/src/main/java/com/yd/csf/service/dao/PolicyFollowMapper.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/dto/BatchEditActualPayoutDateRequest.java
+16
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionAddRequest.java
+8
-4
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedAddDto.java
+11
-11
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedQueryRequest.java
+2
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedUpdateRequest.java
+5
-3
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionUpdateRequest.java
+8
-4
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAddRequest.java
+10
-3
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneDownloadRequest.java
+0
-2
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneQueryRequest.java
+6
-8
yd-csf-service/src/main/java/com/yd/csf/service/enums/FortuneTypeEnum.java
+62
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/Commission.java
+13
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/CommissionExpected.java
+20
-4
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyFollow.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionService.java
+2
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneAccountService.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneService.java
+1
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
+10
-3
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyBrokerService.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyFollowService.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyPolicyholderService.java
+5
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyService.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
+75
-12
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
+149
-25
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CustomerServiceImpl.java
+3
-3
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
+105
-20
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
+59
-13
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+144
-35
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyBrokerServiceImpl.java
+11
-3
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
+75
-22
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyInsurantServiceImpl.java
+1
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyPolicyholderServiceImpl.java
+16
-6
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
+11
-0
yd-csf-service/src/main/java/com/yd/csf/service/utils/BusinessNoUtils.java
+15
-13
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedExportNewDTO.java
+14
-2
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedNewVO.java
+46
-9
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionVO.java
+8
-3
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
+5
-5
yd-csf-service/src/main/java/com/yd/csf/service/vo/PayableReportVO.java
+22
-9
yd-csf-service/src/main/java/com/yd/csf/service/vo/ReceivableReportVO.java
+3
-3
yd-csf-service/src/main/resources/mappers/CommissionExpectedMapper.xml
+2
-2
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
+14
-24
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
+14
-4
yd-csf-service/src/main/resources/mappers/PolicyFollowMapper.xml
+4
-3
yd-csf-service/src/main/resources/mappers/SalarySplitMapper.xml
+6
-0
No files found.
.idea/encodings.xml
View file @
bdfc676e
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"Encoding"
>
<component
name=
"Encoding"
>
<file
url=
"file://$PROJECT_DIR$/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/src/main/resources"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/yd-csf-api/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/yd-csf-api/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/yd-csf-api/src/main/resources"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/yd-csf-api/src/main/resources"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/yd-csf-feign/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/yd-csf-feign/src/main/java"
charset=
"UTF-8"
/>
...
...
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiCommissionExpectedController.java
View file @
bdfc676e
...
@@ -14,6 +14,7 @@ import com.yd.csf.api.dto.QueryCommissionExpectedByPageNewResponse;
...
@@ -14,6 +14,7 @@ import com.yd.csf.api.dto.QueryCommissionExpectedByPageNewResponse;
import
com.yd.csf.api.dto.QueryCommissionExpectedByPageResponse
;
import
com.yd.csf.api.dto.QueryCommissionExpectedByPageResponse
;
import
com.yd.csf.api.dto.ReceivableReportResponse
;
import
com.yd.csf.api.dto.ReceivableReportResponse
;
import
com.yd.csf.api.service.ApiCommissionExpectedService
;
import
com.yd.csf.api.service.ApiCommissionExpectedService
;
import
com.yd.csf.feign.request.commission.CommissionExpectedEditStatusRequest
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.model.CommissionExpected
;
import
com.yd.csf.service.model.CommissionExpected
;
...
@@ -34,6 +35,7 @@ import org.apache.commons.lang3.ObjectUtils;
...
@@ -34,6 +35,7 @@ import org.apache.commons.lang3.ObjectUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -253,6 +255,16 @@ public class ApiCommissionExpectedController {
...
@@ -253,6 +255,16 @@ public class ApiCommissionExpectedController {
}
}
/**
/**
* 修改入账状态
* @param request
* @return
*/
@PutMapping
(
"/edit/status"
)
public
Result
editStatus
(
@Validated
@RequestBody
CommissionExpectedEditStatusRequest
request
)
{
return
apiCommissionExpectedService
.
editStatus
(
request
);
}
/**
* 应收款导出(旧)
* 应收款导出(旧)
*
*
* @param commissionExpectedQueryRequest
* @param commissionExpectedQueryRequest
...
@@ -343,12 +355,24 @@ public class ApiCommissionExpectedController {
...
@@ -343,12 +355,24 @@ public class ApiCommissionExpectedController {
@Operation
(
summary
=
"应收款报表"
)
@Operation
(
summary
=
"应收款报表"
)
public
Result
<
ReceivableReportResponse
>
receivableReport
(
@RequestBody
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
)
{
public
Result
<
ReceivableReportResponse
>
receivableReport
(
@RequestBody
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
)
{
//保單持有人(中/英、繁简/大小写)、签单人、转介人名称(主)、受保人(中/英、繁简/大小写)、查询保单号列表
//保單持有人(中/英、繁简/大小写)、签单人、转介人名称(主)、受保人(中/英、繁简/大小写)、查询保单号列表
List
<
String
>
queryPolicyNoList
=
policyFollowService
.
queryPolicyNoList
(
commissionExpectedQueryRequest
.
getPolicyHolder
(),
List
<
String
>
queryPolicyNoList
=
new
ArrayList
<>();
Boolean
queryFlag
=
false
;
if
(
StringUtils
.
isNotBlank
(
commissionExpectedQueryRequest
.
getPolicyHolder
())
||
StringUtils
.
isNotBlank
(
commissionExpectedQueryRequest
.
getSigner
())
||
StringUtils
.
isNotBlank
(
commissionExpectedQueryRequest
.
getBrokerName
())
||
StringUtils
.
isNotBlank
(
commissionExpectedQueryRequest
.
getInsured
())
){
queryPolicyNoList
=
policyFollowService
.
queryPolicyNoList
(
commissionExpectedQueryRequest
.
getPolicyHolder
(),
commissionExpectedQueryRequest
.
getSigner
(),
commissionExpectedQueryRequest
.
getSigner
(),
commissionExpectedQueryRequest
.
getBrokerName
(),
commissionExpectedQueryRequest
.
getBrokerName
(),
commissionExpectedQueryRequest
.
getInsured
());
commissionExpectedQueryRequest
.
getInsured
());
queryFlag
=
true
;
}
log
.
info
(
"应收款报表=>receivableReport=>queryPolicyNoList:{}"
,
JSON
.
toJSONString
(
queryPolicyNoList
));
// 构建查询条件
// 构建查询条件
commissionExpectedQueryRequest
.
setPolicyNoList
(
queryPolicyNoList
);
commissionExpectedQueryRequest
.
setPolicyNoList
(
queryPolicyNoList
);
commissionExpectedQueryRequest
.
setQueryFlag
(
queryFlag
);
QueryWrapper
<
CommissionExpected
>
queryWrapper
=
commissionExpectedService
.
getQueryWrapper
(
commissionExpectedQueryRequest
);
QueryWrapper
<
CommissionExpected
>
queryWrapper
=
commissionExpectedService
.
getQueryWrapper
(
commissionExpectedQueryRequest
);
// 先查询所有符合条件的记录ID(用于统计)
// 先查询所有符合条件的记录ID(用于统计)
...
...
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFortuneController.java
View file @
bdfc676e
...
@@ -197,9 +197,6 @@ public class ApiFortuneController {
...
@@ -197,9 +197,6 @@ public class ApiFortuneController {
if
(
CollectionUtils
.
isEmpty
(
fortuneDownloadRequest
.
getFortuneBizIdList
()))
{
if
(
CollectionUtils
.
isEmpty
(
fortuneDownloadRequest
.
getFortuneBizIdList
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"请选择要出账的发佣数据"
);
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"请选择要出账的发佣数据"
);
}
}
if
(
StringUtils
.
isBlank
(
fortuneDownloadRequest
.
getActualPayoutDate
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"请输入出账年月(实)"
);
}
fortuneService
.
downloadAccount
(
fortuneDownloadRequest
,
response
);
fortuneService
.
downloadAccount
(
fortuneDownloadRequest
,
response
);
...
@@ -449,6 +446,25 @@ public class ApiFortuneController {
...
@@ -449,6 +446,25 @@ public class ApiFortuneController {
return
Result
.
success
(
fortuneService
.
editActualPayoutDate
(
editActualPayoutDateRequest
));
return
Result
.
success
(
fortuneService
.
editActualPayoutDate
(
editActualPayoutDateRequest
));
}
}
/**
* 批量设置出账年月(实)),已设置的跳过
*
* @param editBatchActualPayoutDateRequest
* @return
*/
@PostMapping
(
"/edit/actual_payout_date/batch"
)
@Operation
(
summary
=
"批量设置出账年月(实),已设置的跳过"
)
public
Result
<
String
>
batchEditActualPayoutDate
(
@RequestBody
BatchEditActualPayoutDateRequest
editBatchActualPayoutDateRequest
)
{
if
(
editBatchActualPayoutDateRequest
==
null
||
CollectionUtils
.
isEmpty
(
editBatchActualPayoutDateRequest
.
getFortuneBizIdList
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"fortuneBizIdList 不能为空"
);
}
if
(
StringUtils
.
isBlank
(
editBatchActualPayoutDateRequest
.
getActualPayoutDate
()))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
"actualPayoutDate 不能为空"
);
}
return
Result
.
success
(
fortuneService
.
batchEditActualPayoutDate
(
editBatchActualPayoutDateRequest
));
}
/**
/**
* 修改结算汇率,设置完成后,更新到应付款管理明细中
* 修改结算汇率,设置完成后,更新到应付款管理明细中
*
*
...
...
yd-csf-api/src/main/java/com/yd/csf/api/handler/EvaluateRankJobHandler.java
View file @
bdfc676e
...
@@ -18,7 +18,9 @@ import org.apache.commons.collections4.CollectionUtils;
...
@@ -18,7 +18,9 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -128,6 +130,8 @@ public class EvaluateRankJobHandler {
...
@@ -128,6 +130,8 @@ public class EvaluateRankJobHandler {
log
.
setFycLogBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_AGENT_ACCUMULATED_FYC_LOG
.
getCode
()));
log
.
setFycLogBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_AGENT_ACCUMULATED_FYC_LOG
.
getCode
()));
//操作来源
//操作来源
log
.
setSourceType
(
OprSourceEnum
.
CALM_TASK_EVALUATE_RANK
.
getItemValue
());
log
.
setSourceType
(
OprSourceEnum
.
CALM_TASK_EVALUATE_RANK
.
getItemValue
());
log
.
setCreateTime
(
LocalDateTime
.
now
());
log
.
setUpdateTime
(
LocalDateTime
.
now
());
return
log
;
return
log
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
iAgentAccumulatedFycLogService
.
saveOrUpdateBatch
(
addLogList
);
iAgentAccumulatedFycLogService
.
saveOrUpdateBatch
(
addLogList
);
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/ApiCommissionExpectedService.java
View file @
bdfc676e
package
com
.
yd
.
csf
.
api
.
service
;
package
com
.
yd
.
csf
.
api
.
service
;
import
com.yd.common.result.Result
;
import
com.yd.csf.feign.request.commission.CommissionExpectedEditStatusRequest
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -7,4 +9,6 @@ import java.io.UnsupportedEncodingException;
...
@@ -7,4 +9,6 @@ import java.io.UnsupportedEncodingException;
public
interface
ApiCommissionExpectedService
{
public
interface
ApiCommissionExpectedService
{
void
exportCommissionExpectedNew
(
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
;
void
exportCommissionExpectedNew
(
CommissionExpectedQueryRequest
commissionExpectedQueryRequest
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
;
Result
editStatus
(
CommissionExpectedEditStatusRequest
request
);
}
}
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiAppointmentServiceImpl.java
View file @
bdfc676e
...
@@ -685,6 +685,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
...
@@ -685,6 +685,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
// 保單持有人
// 保單持有人
if
(
apiPolicyholderInfoDto
!=
null
)
{
if
(
apiPolicyholderInfoDto
!=
null
)
{
follow
.
setPolicyHolder
(
StringUtils
.
isNotBlank
(
apiPolicyholderInfoDto
.
getNameCn
())
?
apiPolicyholderInfoDto
.
getNameCn
()
:
apiPolicyholderInfoDto
.
getNamePyEn
());
follow
.
setPolicyHolder
(
StringUtils
.
isNotBlank
(
apiPolicyholderInfoDto
.
getNameCn
())
?
apiPolicyholderInfoDto
.
getNameCn
()
:
apiPolicyholderInfoDto
.
getNamePyEn
());
follow
.
setPolicyHolderEn
(
apiPolicyholderInfoDto
.
getNamePyEn
());
}
}
// 受保人信息
// 受保人信息
...
@@ -709,6 +710,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
...
@@ -709,6 +710,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
&&
!
response
.
getApiAppointmentInfoDto
().
getUserSignDtoList
().
isEmpty
())
{
&&
!
response
.
getApiAppointmentInfoDto
().
getUserSignDtoList
().
isEmpty
())
{
ApiAppointmentUserSignDto
firstSigner
=
response
.
getApiAppointmentInfoDto
().
getUserSignDtoList
().
get
(
0
);
ApiAppointmentUserSignDto
firstSigner
=
response
.
getApiAppointmentInfoDto
().
getUserSignDtoList
().
get
(
0
);
follow
.
setSigner
(
firstSigner
.
getName
());
follow
.
setSigner
(
firstSigner
.
getName
());
follow
.
setSignerSc
(
ChineseTextConverter
.
traditionalToSimplified
(
firstSigner
.
getName
()));
follow
.
setSignerBizId
(
firstSigner
.
getAppointmentUserSignBizId
());
follow
.
setSignerBizId
(
firstSigner
.
getAppointmentUserSignBizId
());
follow
.
setPracticeCode
(
firstSigner
.
getPracticeCode
());
follow
.
setPracticeCode
(
firstSigner
.
getPracticeCode
());
}
}
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiCommissionExpectedServiceImpl.java
View file @
bdfc676e
...
@@ -7,7 +7,9 @@ import com.alibaba.fastjson.JSON;
...
@@ -7,7 +7,9 @@ import com.alibaba.fastjson.JSON;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.result.Result
;
import
com.yd.csf.api.service.ApiCommissionExpectedService
;
import
com.yd.csf.api.service.ApiCommissionExpectedService
;
import
com.yd.csf.feign.request.commission.CommissionExpectedEditStatusRequest
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
com.yd.csf.service.model.CommissionExpected
;
import
com.yd.csf.service.model.CommissionExpected
;
import
com.yd.csf.service.service.CommissionExpectedService
;
import
com.yd.csf.service.service.CommissionExpectedService
;
...
@@ -84,4 +86,21 @@ public class ApiCommissionExpectedServiceImpl implements ApiCommissionExpectedSe
...
@@ -84,4 +86,21 @@ public class ApiCommissionExpectedServiceImpl implements ApiCommissionExpectedSe
}
}
}
}
/**
* 修改入账状态
* @param request
* @return
*/
@Override
public
Result
editStatus
(
CommissionExpectedEditStatusRequest
request
)
{
CommissionExpected
commissionExpected
=
commissionExpectedService
.
queryOne
(
request
.
getCommissionExpectedBizId
());
if
(
commissionExpected
==
null
)
{
throw
new
BusinessException
(
"预计来佣数据不存在"
);
}
commissionExpected
.
setStatus
(
request
.
getStatus
());
commissionExpected
.
setStatusDesc
(
request
.
getStatusDesc
());
commissionExpectedService
.
saveOrUpdate
(
commissionExpected
);
return
Result
.
success
();
}
}
}
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
bdfc676e
package
com
.
yd
.
csf
.
api
.
service
.
impl
;
package
com
.
yd
.
csf
.
api
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
@@ -71,8 +70,8 @@ import java.time.LocalDate;
...
@@ -71,8 +70,8 @@ import java.time.LocalDate;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
ibm
.
icu
.
impl
.
ValidIdentifiers
.
Datatype
.
currency
;
import
static
com
.
ibm
.
icu
.
impl
.
ValidIdentifiers
.
Datatype
.
currency
;
@Slf4j
@Slf4j
...
@@ -634,8 +633,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -634,8 +633,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.
build
());
.
build
());
//异步处理-构建冷静期定时任务
//异步处理-构建冷静期定时任务
log
.
info
(
"异步处理-构建冷静期定时任务=>请求前入参:{}"
,
JSON
.
toJSONString
(
collectResDtos
));
//
log.info("异步处理-构建冷静期定时任务=>请求前入参:{}",JSON.toJSONString(collectResDtos));
apiExpectedFortuneAsyncService
.
buildCalmDateTask
(
collectResDtos
,
policyNo
,
exchangeRate
);
//
apiExpectedFortuneAsyncService.buildCalmDateTask(collectResDtos,policyNo,exchangeRate);
return
Result
.
success
();
return
Result
.
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -672,28 +671,12 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -672,28 +671,12 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
private
List
<
ExpectedFortune
>
updatePayableNoBatch
(
String
policyNo
)
{
private
List
<
ExpectedFortune
>
updatePayableNoBatch
(
String
policyNo
)
{
// 查询最新一条有 payableNo 记录
ExpectedFortune
latest
=
iExpectedFortuneService
.
getOne
(
new
QueryWrapper
<
ExpectedFortune
>()
.
isNotNull
(
"payable_no"
)
.
eq
(
"is_part"
,
0
)
.
orderByDesc
(
"id"
)
.
last
(
"LIMIT 1"
),
true
);
//查询当前保单号的所有预计发佣记录
//查询当前保单号的所有预计发佣记录
List
<
ExpectedFortune
>
expectedFortuneList
=
iExpectedFortuneService
.
queryList
(
policyNo
);
List
<
ExpectedFortune
>
expectedFortuneList
=
iExpectedFortuneService
.
queryList
(
policyNo
);
//查询redis缓存的字典列表信息
//查询redis缓存的字典列表信息
List
<
GetDictItemListByDictTypeResponse
>
dictTypeResponses
=
redisUtil
.
getCacheObject
(
RedisConstants
.
DICT_LIST
);
List
<
GetDictItemListByDictTypeResponse
>
dictTypeResponses
=
redisUtil
.
getCacheObject
(
RedisConstants
.
DICT_LIST
);
//获取当前序号作为起点
int
currentSeq
=
0
;
if
(!
Objects
.
isNull
(
latest
))
{
String
payableNo
=
latest
.
getPayableNo
();
currentSeq
=
Integer
.
parseInt
(
payableNo
.
substring
(
payableNo
.
length
()
-
6
));
}
//批量更新应付款编号,每个item递增
//批量更新应付款编号,每个item递增
ExpectedFortune
expectedFortune
;
ExpectedFortune
expectedFortune
;
List
<
ExpectedFortune
>
updateList
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
updateList
=
new
ArrayList
<>();
...
@@ -702,9 +685,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -702,9 +685,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
ExpectedFortune
updateObj
=
new
ExpectedFortune
();
ExpectedFortune
updateObj
=
new
ExpectedFortune
();
updateObj
.
setId
(
expectedFortune
.
getId
());
updateObj
.
setId
(
expectedFortune
.
getId
());
updateObj
.
setPayableNo
(
this
.
createPayableNo
(
"R"
,
currentSeq
+
i
+
1
));
updateObj
.
setFortuneType
(
GetDictItemListByDictTypeResponse
.
getItemValue
(
dictTypeResponses
,
updateObj
.
setFortuneType
(
GetDictItemListByDictTypeResponse
.
getItemValue
(
dictTypeResponses
,
"csf_fortune_type"
,
expectedFortune
.
getFortuneName
()));
"csf_fortune_type"
,
expectedFortune
.
getFortuneName
()));
updateObj
.
setPayableNo
(
iExpectedFortuneService
.
getPayableNo
(
updateObj
.
getFortuneType
(),
policyNo
,
expectedFortune
.
getId
()));
updateList
.
add
(
updateObj
);
updateList
.
add
(
updateObj
);
}
}
...
@@ -1012,7 +995,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1012,7 +995,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
// 5. 组装返回结果
// 5. 组装返回结果
ApiExpectedFortunePageResponseVO
response
=
new
ApiExpectedFortunePageResponseVO
();
ApiExpectedFortunePageResponseVO
response
=
new
ApiExpectedFortunePageResponseVO
();
response
.
setStatisticsVO
(
statisticsVO
);
response
.
setStatisticsVO
(
statisticsVO
);
response
.
setPage
(
iExpectedFortuneService
.
getVOPage
(
iPage
));
//
恢复分页数据
response
.
setPage
(
iExpectedFortuneService
.
getVOPage
(
iPage
));
//
字段填充、调整数据顺序
log
.
info
(
"查询应付款管理列表完成, 耗时: {}ms, 页码: {}, 页大小: {}, 总记录数: {}"
,
log
.
info
(
"查询应付款管理列表完成, 耗时: {}ms, 页码: {}, 页大小: {}, 总记录数: {}"
,
System
.
currentTimeMillis
()
-
startTime
,
System
.
currentTimeMillis
()
-
startTime
,
...
@@ -1033,27 +1016,41 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1033,27 +1016,41 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if
(
CollectionUtils
.
isEmpty
(
fortuneAddRequestList
))
{
if
(
CollectionUtils
.
isEmpty
(
fortuneAddRequestList
))
{
return
true
;
return
true
;
}
}
// 校验参数
validateAdd
(
fortuneAddRequestList
);
validateAdd
(
fortuneAddRequestList
);
// 根据保单号、期数、项目类型查询已存在的记录
validIsExist
(
fortuneAddRequestList
);
// 查询保单信息
// 查询保单信息
Set
<
String
>
policyNoSet
=
fortuneAddRequestList
.
stream
()
Set
<
String
>
policyNoSet
=
fortuneAddRequestList
.
stream
()
.
map
(
ExpectedFortuneAddRequest:
:
getPolicyNo
)
.
map
(
ExpectedFortuneAddRequest:
:
getPolicyNo
)
.
filter
(
StringUtils:
:
isNotBlank
).
collect
(
Collectors
.
toSet
());
.
filter
(
StringUtils:
:
isNotBlank
)
.
collect
(
Collectors
.
toSet
());
Map
<
String
,
Policy
>
policyMap
=
new
HashMap
<>(
);
Map
<
String
,
Policy
>
policyMap
=
policyService
.
queryPolicyMap
(
policyNoSet
);
if
(
CollUtil
.
isNotEmpty
(
policyNoSet
))
{
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
().
in
(
Policy:
:
getPolicyNo
,
policyNoSet
).
list
();
// 当前登录用户
// 保单映射
AuthUserDto
authUserDto
=
SecurityUtil
.
getCurrentLoginUser
();
policyMap
=
policyList
.
stream
().
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
()));
// 当前时间
}
LocalDateTime
now
=
LocalDateTime
.
now
();
// 查询最新一条有 payableNo 记录
// 查询最新一条有 payableNo 记录
int
currentSeq
=
iExpectedFortuneService
.
getPayableNoCurrentSeq
();
//
int currentSeq = iExpectedFortuneService.getPayableNoCurrentSeq();
List
<
ExpectedFortune
>
fortuneList
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
fortuneList
=
new
ArrayList
<>();
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
BeanUtil
.
copyProperties
(
expectedFortuneDto
,
expectedFortune
);
BeanUtil
.
copyProperties
(
expectedFortuneDto
,
expectedFortune
,
"payoutDate"
,
"actualPayoutDate"
);
// 设置创建人、更新人
expectedFortune
.
setCreatorId
(
authUserDto
.
getUserBizId
());
expectedFortune
.
setCreatorName
(
authUserDto
.
getRealName
());
expectedFortune
.
setUpdaterId
(
authUserDto
.
getUserBizId
());
expectedFortune
.
setCreateTime
(
now
);
expectedFortune
.
setUpdateTime
(
now
);
// 是否拆分
expectedFortune
.
setIsPart
(
0
);
if
(
"R"
.
equals
(
expectedFortuneDto
.
getFortuneBizType
()))
{
if
(
"R"
.
equals
(
expectedFortuneDto
.
getFortuneBizType
()))
{
Policy
policy
=
policyMap
.
get
(
expectedFortuneDto
.
getPolicyNo
());
Policy
policy
=
policyMap
.
get
(
expectedFortuneDto
.
getPolicyNo
());
...
@@ -1072,31 +1069,76 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1072,31 +1069,76 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
expectedFortune
.
setExpectedFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
()));
expectedFortune
.
setExpectedFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
()));
// 预计发佣类型名称
// 预计发佣类型名称
expectedFortune
.
setFortuneName
(
queryByDict
(
expectedFortuneDto
.
getFortuneType
()));
expectedFortune
.
setFortuneName
(
queryByDict
(
expectedFortuneDto
.
getFortuneType
()));
// 应付款编号(序号递增)
// 预计出账年月
expectedFortune
.
setPayableNo
(
this
.
createPayableNo
(
expectedFortune
.
getFortuneBizType
(),
++
currentSeq
));
if
(
StringUtils
.
isNotBlank
(
expectedFortuneDto
.
getPayoutDate
()))
{
expectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
expectedFortuneDto
.
getPayoutDate
()
+
"-01"
));
}
// 实际出账年月
if
(
StringUtils
.
isNotBlank
(
expectedFortuneDto
.
getActualPayoutDate
()))
{
expectedFortune
.
setActualPayoutDate
(
LocalDate
.
parse
(
expectedFortuneDto
.
getActualPayoutDate
()
+
"-01"
));
}
// 转介人比例默认100%
expectedFortune
.
setBrokerRatio
(
"100"
);
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
// 转介人比例默认100%
expectedFortune
.
setBrokerRatio
(
"100"
);
expectedFortune
.
setUnpaidAmount
(
expectedFortune
.
getHkdAmount
());
expectedFortune
.
setUnpaidAmount
(
expectedFortune
.
getHkdAmount
());
expectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
expectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
expectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
expectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
fortuneList
.
add
(
expectedFortune
);
fortuneList
.
add
(
expectedFortune
);
}
}
iExpectedFortuneService
.
saveOrUpdateBatch
(
fortuneList
);
iExpectedFortuneService
.
saveOrUpdateBatch
(
fortuneList
);
// 更新应付款编号
List
<
ExpectedFortune
>
updateList
=
new
ArrayList
<>();
for
(
ExpectedFortune
expected
:
fortuneList
)
{
// 生成应付款编号
String
payableNo
=
iExpectedFortuneService
.
getPayableNo
(
expected
.
getFortuneType
(),
expected
.
getPolicyNo
(),
expected
.
getId
());
ExpectedFortune
updateExpected
=
new
ExpectedFortune
();
updateExpected
.
setId
(
expected
.
getId
());
updateExpected
.
setPayableNo
(
payableNo
);
updateList
.
add
(
updateExpected
);
}
iExpectedFortuneService
.
updateBatchById
(
updateList
);
return
true
;
return
true
;
}
}
private
String
queryByDict
(
String
fortuneType
)
{
private
void
validIsExist
(
List
<
ExpectedFortuneAddRequest
>
fortuneAddRequestList
)
{
//查询redis缓存的字典列表信息
List
<
GetDictItemListByDictTypeResponse
>
dictTypeResponses
=
redisUtil
.
getCacheObject
(
RedisConstants
.
DICT_LIST
);
Set
<
String
>
policyNoSet
=
new
HashSet
<>();
String
fortuneName
=
GetDictItemListByDictTypeResponse
.
getItemLabel
(
dictTypeResponses
,
Set
<
Integer
>
fortunePeriodSet
=
new
HashSet
<>();
"csf_fortune_type"
,
fortuneType
);
Set
<
String
>
fortuneBizTypeSet
=
new
HashSet
<>();
if
(
ObjectUtils
.
isNotEmpty
(
fortuneName
))
{
for
(
ExpectedFortuneAddRequest
request
:
fortuneAddRequestList
)
{
return
fortuneName
;
policyNoSet
.
add
(
request
.
getPolicyNo
());
fortunePeriodSet
.
add
(
request
.
getFortunePeriod
());
fortuneBizTypeSet
.
add
(
request
.
getFortuneBizType
());
}
List
<
ExpectedFortune
>
existingRecords
=
iExpectedFortuneService
.
lambdaQuery
()
.
in
(
ExpectedFortune:
:
getPolicyNo
,
policyNoSet
)
.
in
(
ExpectedFortune:
:
getFortunePeriod
,
fortunePeriodSet
)
.
in
(
ExpectedFortune:
:
getFortuneBizType
,
fortuneBizTypeSet
)
.
list
();
// 转换为 Map
Map
<
String
,
ExpectedFortune
>
existingRecordsMap
=
new
HashMap
<>();
for
(
ExpectedFortune
item
:
existingRecords
)
{
String
key
=
String
.
format
(
"%s_%s_%s"
,
item
.
getPolicyNo
(),
item
.
getFortunePeriod
(),
item
.
getFortuneBizType
());
existingRecordsMap
.
put
(
key
,
item
);
}
}
// 校验是否存在
for
(
ExpectedFortuneAddRequest
request
:
fortuneAddRequestList
)
{
String
key
=
String
.
format
(
"%s_%s_%s"
,
request
.
getPolicyNo
(),
request
.
getFortunePeriod
(),
request
.
getFortuneBizType
());
if
(
existingRecordsMap
.
containsKey
(
key
))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"当前期数已存在: "
+
request
.
getFortuneName
());
}
}
}
private
String
queryByDict
(
String
fortuneType
)
{
Result
<
List
<
GetDictItemListByDictTypeResponse
>>
result
=
apiSysDictFeignClient
.
getDictItemListByDictType
(
"csf_fortune_type"
);
Result
<
List
<
GetDictItemListByDictTypeResponse
>>
result
=
apiSysDictFeignClient
.
getDictItemListByDictType
(
"csf_fortune_type"
);
if
(
ObjectUtils
.
isNotEmpty
(
result
.
getData
()))
{
if
(
ObjectUtils
.
isNotEmpty
(
result
.
getData
()))
{
for
(
GetDictItemListByDictTypeResponse
dictItem
:
result
.
getData
())
{
for
(
GetDictItemListByDictTypeResponse
dictItem
:
result
.
getData
())
{
...
@@ -1132,15 +1174,29 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1132,15 +1174,29 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
private
void
validateAdd
(
List
<
ExpectedFortuneAddRequest
>
fortuneAddRequestList
)
{
private
void
validateAdd
(
List
<
ExpectedFortuneAddRequest
>
fortuneAddRequestList
)
{
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
for
(
ExpectedFortuneAddRequest
expectedFortuneDto
:
fortuneAddRequestList
)
{
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getHkdAmount
()))
{
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getOriginalAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账金额不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"原币种金额不能为空"
);
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getOriginalCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"原币种不能为空"
);
}
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
get
Currency
()))
{
if
(
Objects
.
isNull
(
expectedFortuneDto
.
get
OriginalToHkdRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"
预计出账币种
不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"
原币种→港币汇率
不能为空"
);
}
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getExchangeRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"结算汇率不能为空"
);
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getRuleAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"保单币种金额不能为空"
);
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getRuleCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"保单币种不能为空"
);
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getDefaultExchangeRate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账汇率不能为空"
);
}
if
(
Objects
.
isNull
(
expectedFortuneDto
.
getHkdAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"预计出账金额不能为空"
);
}
}
}
}
}
}
...
@@ -1199,25 +1255,14 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1199,25 +1255,14 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
public
IPage
<
PayableReportVO
>
convertPayableReportVO
(
IPage
<
PayableReportVO
>
payableReportPage
)
{
public
IPage
<
PayableReportVO
>
convertPayableReportVO
(
IPage
<
PayableReportVO
>
payableReportPage
)
{
if
(!
CollectionUtils
.
isEmpty
(
payableReportPage
.
getRecords
()))
{
if
(!
CollectionUtils
.
isEmpty
(
payableReportPage
.
getRecords
()))
{
// 查询转介人等级
List
<
String
>
brokerBizIdList
=
payableReportPage
.
getRecords
().
stream
().
map
(
PayableReportVO:
:
getBrokerBizId
).
collect
(
Collectors
.
toList
());
List
<
String
>
brokerBizIdList
=
payableReportPage
.
getRecords
().
stream
().
map
(
PayableReportVO:
:
getBrokerBizId
).
collect
(
Collectors
.
toList
());
List
<
UserGradeDto
>
userGradeDtoList
=
new
ArrayList
<>();
Map
<
String
,
UserGradeDto
>
userGradeMap
=
iAgentAccumulatedFycService
.
queryUserGradeMap
(
brokerBizIdList
);
if
(!
CollectionUtils
.
isEmpty
(
brokerBizIdList
))
{
userGradeDtoList
=
iAgentAccumulatedFycService
.
queryUserGradeList
(
brokerBizIdList
);
}
Map
<
String
,
UserGradeDto
>
userGradeMap
=
userGradeDtoList
.
stream
()
.
collect
(
Collectors
.
toMap
(
UserGradeDto:
:
getClientUserBizId
,
Function
.
identity
()));
// 查询新单跟进
List
<
String
>
policyNoList
=
payableReportPage
.
getRecords
().
stream
().
map
(
PayableReportVO:
:
getPolicyNo
).
collect
(
Collectors
.
toList
());
List
<
String
>
policyNoList
=
payableReportPage
.
getRecords
().
stream
().
map
(
PayableReportVO:
:
getPolicyNo
).
collect
(
Collectors
.
toList
());
Map
<
String
,
PolicyFollow
>
policyFollowMap
=
policyFollowService
.
queryPolicyFollowMap
(
policyNoList
);
List
<
PolicyFollow
>
policyFollowList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
policyNoList
))
{
policyFollowList
=
policyFollowService
.
lambdaQuery
()
.
in
(
PolicyFollow:
:
getPolicyNo
,
policyNoList
)
.
list
();
}
Map
<
String
,
PolicyFollow
>
policyFollowMap
=
policyFollowList
.
stream
()
.
collect
(
Collectors
.
toMap
(
PolicyFollow:
:
getPolicyNo
,
Function
.
identity
()));
List
<
PayableReportVO
>
voList
=
payableReportPage
.
getRecords
().
stream
().
map
(
vo
->
{
List
<
PayableReportVO
>
voList
=
payableReportPage
.
getRecords
().
stream
().
map
(
vo
->
{
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
vo
.
getPolicyNo
());
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
vo
.
getPolicyNo
());
UserGradeDto
userGradeDto
=
userGradeMap
.
get
(
vo
.
getBrokerBizId
());
UserGradeDto
userGradeDto
=
userGradeMap
.
get
(
vo
.
getBrokerBizId
());
...
@@ -1229,6 +1274,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1229,6 +1274,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if
(
policyFollow
!=
null
)
{
if
(
policyFollow
!=
null
)
{
vo
.
setProductName
(
policyFollow
.
getProductName
());
vo
.
setProductName
(
policyFollow
.
getProductName
());
vo
.
setProductLaunchBizId
(
policyFollow
.
getProductLaunchBizId
());
vo
.
setProductLaunchBizId
(
policyFollow
.
getProductLaunchBizId
());
vo
.
setPolicyHolder
(
policyFollow
.
getPolicyHolder
());
vo
.
setPolicyHolderEn
(
policyFollow
.
getPolicyHolderEn
());
}
}
return
vo
;
return
vo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -1238,20 +1285,6 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1238,20 +1285,6 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
}
}
/**
/**
* 创建应付款编号 应付款类型-CSF-年份后两位-6位数字(不重复)
*
* @param fortuneBizType 预计发佣业务类型
* @param seq 序号
* @return
*/
private
String
createPayableNo
(
String
fortuneBizType
,
int
seq
)
{
return
String
.
format
(
"%s%s%s"
,
fortuneBizType
+
"-CSF"
,
LocalDate
.
now
().
getYear
()
%
100
,
String
.
format
(
"%06d"
,
seq
));
}
/**
* 分页查询 - 预计发佣
* 分页查询 - 预计发佣
*
*
* @param request
* @param request
...
@@ -1387,27 +1420,68 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
...
@@ -1387,27 +1420,68 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if
(
expectedFortune
.
getPaidAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
expectedFortune
.
getPaidAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"当前应付款已有出账金额,不能修改"
);
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"当前应付款已有出账金额,不能修改"
);
}
}
CurrencyEnum
currencyEnum
;
try
{
// 根据保单号、期数查询关联 fortune 数据,重新计算:已出帐金额、待出帐金额、已出帐比例、待出帐比例
currencyEnum
=
CurrencyEnum
.
valueOf
(
request
.
getCurrency
());
List
<
Fortune
>
fortuneList
=
fortuneService
.
lambdaQuery
()
}
catch
(
IllegalArgumentException
e
)
{
.
eq
(
Fortune:
:
getPolicyNo
,
request
.
getPolicyNo
())
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"币种错误:"
+
request
.
getCurrency
());
.
eq
(
Fortune:
:
getFortunePeriod
,
request
.
getFortunePeriod
())
.
list
();
BigDecimal
paidAmount
=
BigDecimal
.
ZERO
;
BigDecimal
unpaidAmount
=
request
.
getHkdAmount
();
BigDecimal
paidRatio
=
BigDecimal
.
ZERO
;
BigDecimal
unpaidRatio
=
BigDecimal
.
valueOf
(
100
);
if
(!
CollectionUtils
.
isEmpty
(
fortuneList
))
{
// 计算已出账金额
for
(
Fortune
fortune
:
fortuneList
)
{
if
(
FortuneStatusEnum
.
SENT
.
getItemValue
().
equals
(
fortune
.
getStatus
()))
{
paidAmount
=
paidAmount
.
add
(
fortune
.
getCurrentPaymentHkdAmount
());
}
}
// 计算待出账金额
unpaidAmount
=
request
.
getHkdAmount
().
subtract
(
paidAmount
);
// 计算已出账比例(已出账金额/预计发佣金额)
paidRatio
=
paidAmount
.
divide
(
request
.
getHkdAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
));
// 计算待出账比例(待出账金额/预计发佣金额)
unpaidRatio
=
unpaidAmount
.
divide
(
request
.
getHkdAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
));
}
}
// 获取当前登录用户
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
ExpectedFortune
updateExpectedFortune
=
new
ExpectedFortune
();
ExpectedFortune
updateExpectedFortune
=
new
ExpectedFortune
();
BeanUtils
.
copyProperties
(
request
,
updateExpectedFortune
);
BeanUtils
.
copyProperties
(
request
,
updateExpectedFortune
,
"payoutDate"
,
"actualPayoutDate"
);
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
//
如果金额变更,则需要重新计算港币金额和待出账金额
//
设置 policy 关联字段
if
(
ObjectUtils
.
notEqual
(
expectedFortune
.
getHkdAmount
(),
request
.
getHkdAmount
()))
{
if
(
!
expectedFortune
.
getPolicyNo
().
equals
(
updateExpectedFortune
.
getPolicyNo
()))
{
//
计算港币金额
//
查询保单数据
updateExpectedFortune
.
setHkdAmount
(
request
.
getHkdAmount
())
;
Policy
policy
=
null
;
// 更新待出账金额
if
(
StringUtils
.
isNotBlank
(
request
.
getPolicyNo
()))
{
updateExpectedFortune
.
setUnpaidAmount
(
request
.
getHkdAmount
(
));
policy
=
policyService
.
getOne
(
new
QueryWrapper
<
Policy
>().
eq
(
"policy_no"
,
request
.
getPolicyNo
()
));
}
}
// 获取当前登录用户
if
(
policy
!=
null
)
{
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
updateExpectedFortune
.
setInsuranceCompanyBizId
(
policy
.
getInsuranceCompanyBizId
());
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
updateExpectedFortune
.
setProductLaunchBizId
(
policy
.
getProductLaunchBizId
());
updateExpectedFortune
.
setPremium
(
policy
.
getPaymentPremium
());
updateExpectedFortune
.
setPolicyCurrency
(
policy
.
getCurrency
());
}
}
// 处理出账年月字段
if
(
StringUtils
.
isNotBlank
(
request
.
getPayoutDate
()))
{
updateExpectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
request
.
getPayoutDate
()
+
"-01"
));
}
// 处理实际出账年月字段
if
(
StringUtils
.
isNotBlank
(
request
.
getActualPayoutDate
()))
{
updateExpectedFortune
.
setActualPayoutDate
(
LocalDate
.
parse
(
request
.
getActualPayoutDate
()
+
"-01"
));
}
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
updateExpectedFortune
.
setPaidAmount
(
paidAmount
);
updateExpectedFortune
.
setUnpaidAmount
(
unpaidAmount
);
updateExpectedFortune
.
setPaidRatio
(
paidRatio
);
updateExpectedFortune
.
setUnpaidRatio
(
unpaidRatio
);
updateExpectedFortune
.
setUpdaterId
(
loginUserId
);
updateExpectedFortune
.
setUpdaterId
(
loginUserId
);
updateExpectedFortune
.
setUpdateTime
(
LocalDateTime
.
now
());
updateExpectedFortune
.
setUpdateTime
(
LocalDateTime
.
now
());
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPolicyReceiptServiceImpl.java
View file @
bdfc676e
...
@@ -13,8 +13,10 @@ import com.yd.csf.feign.request.policyreceipt.ApiPolicyReceiptPageRequest;
...
@@ -13,8 +13,10 @@ import com.yd.csf.feign.request.policyreceipt.ApiPolicyReceiptPageRequest;
import
com.yd.csf.feign.response.policyreceipt.ApiPolicyReceiptDetailResponse
;
import
com.yd.csf.feign.response.policyreceipt.ApiPolicyReceiptDetailResponse
;
import
com.yd.csf.feign.response.policyreceipt.ApiPolicyReceiptPageResponse
;
import
com.yd.csf.feign.response.policyreceipt.ApiPolicyReceiptPageResponse
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.model.PolicyFollow
;
import
com.yd.csf.service.model.PolicyReceipt
;
import
com.yd.csf.service.model.PolicyReceipt
;
import
com.yd.csf.service.service.IPolicyReceiptService
;
import
com.yd.csf.service.service.IPolicyReceiptService
;
import
com.yd.csf.service.service.PolicyFollowService
;
import
com.yd.csf.service.service.PolicyService
;
import
com.yd.csf.service.service.PolicyService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -24,8 +26,10 @@ import org.springframework.stereotype.Service;
...
@@ -24,8 +26,10 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.Objects
;
@Slf4j
@Slf4j
...
@@ -38,6 +42,9 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
...
@@ -38,6 +42,9 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
@Autowired
@Autowired
private
PolicyService
policyService
;
private
PolicyService
policyService
;
@Autowired
private
PolicyFollowService
policyFollowService
;
/**
/**
* 分页列表查询-保单回执信息
* 分页列表查询-保单回执信息
* @param request
* @param request
...
@@ -94,6 +101,10 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
...
@@ -94,6 +101,10 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
policyReceipt
.
setReceiptStatus
(
request
.
getReceiptStatus
());
policyReceipt
.
setReceiptStatus
(
request
.
getReceiptStatus
());
policyReceipt
.
setPolicyHolderSignature
(!
CollectionUtils
.
isEmpty
(
request
.
getPolicyHolderSignatureList
())
?
String
.
join
(
";"
,
request
.
getPolicyHolderSignatureList
())
:
""
);
policyReceipt
.
setPolicyHolderSignature
(!
CollectionUtils
.
isEmpty
(
request
.
getPolicyHolderSignatureList
())
?
String
.
join
(
";"
,
request
.
getPolicyHolderSignatureList
())
:
""
);
iPolicyReceiptService
.
saveOrUpdate
(
policyReceipt
);
iPolicyReceiptService
.
saveOrUpdate
(
policyReceipt
);
//更新新单跟进回执信息
updateReceiptToPolicyFollow
(
policyReceipt
);
return
Result
.
success
();
return
Result
.
success
();
}
}
...
@@ -120,6 +131,10 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
...
@@ -120,6 +131,10 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
policyReceipt
.
setReceiptStatus
(
request
.
getReceiptStatus
());
policyReceipt
.
setReceiptStatus
(
request
.
getReceiptStatus
());
policyReceipt
.
setPolicyHolderSignature
(!
CollectionUtils
.
isEmpty
(
request
.
getPolicyHolderSignatureList
())
?
String
.
join
(
";"
,
request
.
getPolicyHolderSignatureList
())
:
""
);
policyReceipt
.
setPolicyHolderSignature
(!
CollectionUtils
.
isEmpty
(
request
.
getPolicyHolderSignatureList
())
?
String
.
join
(
";"
,
request
.
getPolicyHolderSignatureList
())
:
""
);
iPolicyReceiptService
.
saveOrUpdate
(
policyReceipt
);
iPolicyReceiptService
.
saveOrUpdate
(
policyReceipt
);
//更新新单跟进回执信息
updateReceiptToPolicyFollow
(
policyReceipt
);
return
Result
.
success
();
return
Result
.
success
();
}
}
...
@@ -141,4 +156,27 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
...
@@ -141,4 +156,27 @@ public class ApiPolicyReceiptServiceImpl implements ApiPolicyReceiptService {
return
Result
.
success
();
return
Result
.
success
();
}
}
/**
* 更新新单跟进信息的回执信息
* @param policyReceipt
* @return
*/
public
Result
updateReceiptToPolicyFollow
(
PolicyReceipt
policyReceipt
)
{
PolicyFollow
policyFollow
=
policyFollowService
.
queryOneByPolicyNo
(
policyReceipt
.
getPolicyNo
());
if
(
policyFollow
==
null
)
{
throw
new
BusinessException
(
"新单跟进信息不存在"
);
}
if
(
"CONFIRMED"
.
equals
(
policyReceipt
.
getReceiptStatus
()))
{
//回执状态为已确认时,更新新单跟进信息的回执状态和回执日期
policyFollow
.
setReceiptStatus
(
policyReceipt
.
getReceiptStatus
());
policyFollow
.
setReceiptDate
(
policyReceipt
.
getReceiptDate
()
!=
null
?
Date
.
from
(
policyReceipt
.
getReceiptDate
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
())
:
null
);
}
else
if
(
"UNCONFIRMED"
.
equals
(
policyReceipt
.
getReceiptStatus
()))
{
//回执状态为未确认时,更新新单跟进信息的回执状态
policyFollow
.
setReceiptStatus
(
policyReceipt
.
getReceiptStatus
());
policyFollow
.
setReceiptDate
(
null
);
}
policyFollowService
.
saveOrUpdate
(
policyFollow
);
return
Result
.
success
();
}
}
}
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiPremiumReconciliationServiceImpl.java
View file @
bdfc676e
...
@@ -134,11 +134,11 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
...
@@ -134,11 +134,11 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
// 投保人-中文转简体
// 投保人-中文转简体
String
policyHolderNameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
request
.
getPolicyHolder
());
String
policyHolderNameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
request
.
getPolicyHolder
());
// 投保人-英文转小写
// 投保人-英文转小写
String
policyHolderNameEnLc
=
EnglishTextUtil
.
toLowerCase
(
request
.
getPolicyHolder
());
String
policyHolderNameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
request
.
getPolicyHolder
());
// 受保人-中文转简体
// 受保人-中文转简体
String
insuredNameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
request
.
getPolicyHolder
());
String
insuredNameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
request
.
getPolicyHolder
());
// 受保人-英文转小写
// 受保人-英文转小写
String
insuredNameEnLc
=
EnglishTextUtil
.
toLowerCase
(
request
.
getPolicyHolder
());
String
insuredNameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
request
.
getPolicyHolder
());
request
.
setPolicyHolderNameSc
(
policyHolderNameSc
);
request
.
setPolicyHolderNameSc
(
policyHolderNameSc
);
request
.
setPolicyHolderNameEnLc
(
policyHolderNameEnLc
);
request
.
setPolicyHolderNameEnLc
(
policyHolderNameEnLc
);
request
.
setInsuredNameSc
(
insuredNameSc
);
request
.
setInsuredNameSc
(
insuredNameSc
);
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiSalarySplitServiceImpl.java
View file @
bdfc676e
...
@@ -33,16 +33,17 @@ import com.yd.oss.feign.client.ApiExcelFeignClient;
...
@@ -33,16 +33,17 @@ import com.yd.oss.feign.client.ApiExcelFeignClient;
import
com.yd.oss.feign.dto.ExportParam
;
import
com.yd.oss.feign.dto.ExportParam
;
import
com.yd.oss.feign.dto.ExportResult
;
import
com.yd.oss.feign.dto.ExportResult
;
import
com.yd.oss.feign.request.ApiExportRequest
;
import
com.yd.oss.feign.request.ApiExportRequest
;
import
com.yd.user.feign.client.sysdict.ApiSysDictFeignClient
;
import
com.yd.user.feign.request.sysdict.GetDictTypeListRequest
;
import
com.yd.user.feign.response.sysdict.GetDictItemListByDictTypeResponse
;
import
com.yd.user.feign.response.sysdict.GetDictTypeListResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Slf4j
@Slf4j
...
@@ -61,6 +62,9 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
...
@@ -61,6 +62,9 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
@Autowired
@Autowired
private
ApiExcelFeignClient
apiExcelFeignClient
;
private
ApiExcelFeignClient
apiExcelFeignClient
;
@Autowired
private
ApiSysDictFeignClient
apiSysDictFeignClient
;
/**
/**
* 分页查询-薪资拆分应发信息汇总列表
* 分页查询-薪资拆分应发信息汇总列表
* @param request
* @param request
...
@@ -72,6 +76,13 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
...
@@ -72,6 +76,13 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
// 查询分页信息
// 查询分页信息
Page
<
ApiSalarySplitSummaryPageDto
>
page
=
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
());
Page
<
ApiSalarySplitSummaryPageDto
>
page
=
new
Page
<>(
request
.
getPageNo
(),
request
.
getPageSize
());
IPage
<
ApiSalarySplitSummaryPageDto
>
iPage
=
iSalarySplitService
.
summaryPage
(
page
,
request
);
IPage
<
ApiSalarySplitSummaryPageDto
>
iPage
=
iSalarySplitService
.
summaryPage
(
page
,
request
);
if
(
CollectionUtils
.
isNotEmpty
(
iPage
.
getRecords
()))
{
Map
<
String
,
String
>
map
=
getBillOrgDict
();
iPage
.
getRecords
().
stream
().
map
(
dto
->
{
dto
.
setBillOrg
(
map
!=
null
?
map
.
get
(
dto
.
getBillOrg
())
:
""
);
return
dto
;
}).
collect
(
Collectors
.
toList
());
}
response
.
setPage
(
iPage
);
response
.
setPage
(
iPage
);
//查询薪资拆分业务ID列表
//查询薪资拆分业务ID列表
List
<
String
>
salarySplitBizIdList
=
iSalarySplitService
.
queryList
(
request
);
List
<
String
>
salarySplitBizIdList
=
iSalarySplitService
.
queryList
(
request
);
...
@@ -80,6 +91,33 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
...
@@ -80,6 +91,33 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
}
}
/**
/**
* 获取出账机构字典数据
*/
private
Map
<
String
,
String
>
getBillOrgDict
()
{
Map
<
String
,
String
>
dictMap
=
new
HashMap
<>();
try
{
GetDictTypeListRequest
dictRequest
=
new
GetDictTypeListRequest
();
dictRequest
.
setTypeList
(
Collections
.
singletonList
(
"csf_bill_org"
));
List
<
GetDictTypeListResponse
>
dictTypeResponses
=
apiSysDictFeignClient
.
getByDictTypeList
(
dictRequest
).
getData
();
if
(
dictTypeResponses
!=
null
&&
!
dictTypeResponses
.
isEmpty
())
{
for
(
GetDictTypeListResponse
dictTypeResponse
:
dictTypeResponses
)
{
if
(
"csf_bill_org"
.
equals
(
dictTypeResponse
.
getDictType
())
&&
dictTypeResponse
.
getDictItemList
()
!=
null
)
{
for
(
GetDictItemListByDictTypeResponse
dictItem
:
dictTypeResponse
.
getDictItemList
())
{
dictMap
.
put
(
dictItem
.
getItemValue
(),
dictItem
.
getItemLabel
());
}
break
;
}
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"获取出账机构字典数据失败"
,
e
);
}
return
dictMap
;
}
/**
* 分页查询-薪资拆分应发信息列表
* 分页查询-薪资拆分应发信息列表
* @param request
* @param request
* @return
* @return
...
@@ -271,9 +309,9 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
...
@@ -271,9 +309,9 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
ExportParam
exportParam
=
new
ExportParam
();
ExportParam
exportParam
=
new
ExportParam
();
// 指定需要导出的字段(字段名必须与 DTO 中的属性名一致)
// 指定需要导出的字段(字段名必须与 DTO 中的属性名一致)
exportParam
.
setFieldNames
(
Arrays
.
asList
(
exportParam
.
setFieldNames
(
Arrays
.
asList
(
"salarySplitNo"
,
"brokerName"
,
"team"
,
"fromAmount"
,
"salarySplitNo"
,
"b
usinessNo"
,
"b
rokerName"
,
"team"
,
"fromAmount"
,
"currency"
,
"exchangeRate"
,
"toAmount"
,
"toCurrency"
,
"currency"
,
"exchangeRate"
,
"toAmount"
,
"toCurrency"
,
"fortuneAccountMonth"
,
"billOrg"
,
"hkdAmount"
,
"fortuneAccountBizId"
"fortuneAccountMonth"
,
"billOrg"
,
"hkdAmount"
));
));
exportParam
.
setFileName
(
"薪资拆分应发信息汇总"
);
exportParam
.
setFileName
(
"薪资拆分应发信息汇总"
);
exportParam
.
setUploadToOss
(
true
);
exportParam
.
setUploadToOss
(
true
);
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/dto/excel/ApiSalarySplitSummaryExcelDto.java
View file @
bdfc676e
...
@@ -10,6 +10,9 @@ public class ApiSalarySplitSummaryExcelDto {
...
@@ -10,6 +10,9 @@ public class ApiSalarySplitSummaryExcelDto {
@Excel
(
name
=
"发放编号"
,
orderNum
=
"1"
)
@Excel
(
name
=
"发放编号"
,
orderNum
=
"1"
)
private
String
salarySplitNo
;
private
String
salarySplitNo
;
@Excel
(
name
=
"业务编号"
,
orderNum
=
"1"
)
private
String
businessNo
;
@Excel
(
name
=
"转介人"
,
orderNum
=
"2"
)
@Excel
(
name
=
"转介人"
,
orderNum
=
"2"
)
private
String
brokerName
;
private
String
brokerName
;
...
@@ -43,7 +46,4 @@ public class ApiSalarySplitSummaryExcelDto {
...
@@ -43,7 +46,4 @@ public class ApiSalarySplitSummaryExcelDto {
@Excel
(
name
=
"本期总出账金额(原币种)"
,
orderNum
=
"12"
)
@Excel
(
name
=
"本期总出账金额(原币种)"
,
orderNum
=
"12"
)
private
BigDecimal
hkdAmount
;
private
BigDecimal
hkdAmount
;
@Excel
(
name
=
"出账业务编号"
,
orderNum
=
"13"
)
private
String
businessNo
;
}
}
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ApiExpectedFortunePageRequest.java
View file @
bdfc676e
...
@@ -60,9 +60,7 @@ public class ApiExpectedFortunePageRequest extends PageDto {
...
@@ -60,9 +60,7 @@ public class ApiExpectedFortunePageRequest extends PageDto {
@Schema
(
description
=
"应付款类型 R-关联保单应付款 U-非关联保单应付款"
)
@Schema
(
description
=
"应付款类型 R-关联保单应付款 U-非关联保单应付款"
)
private
String
fortuneBizType
;
private
String
fortuneBizType
;
/**
@Schema
(
description
=
"保單持有人(中/英)"
)
* 保單持有人(中/英)
*/
private
String
policyHolder
;
private
String
policyHolder
;
private
List
<
String
>
PolicyNoList
;
private
List
<
String
>
PolicyNoList
;
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneAddRequest.java
View file @
bdfc676e
...
@@ -5,117 +5,84 @@ import io.swagger.v3.oas.annotations.media.Schema;
...
@@ -5,117 +5,84 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
@Data
public
class
ExpectedFortuneAddRequest
{
public
class
ExpectedFortuneAddRequest
{
/**
* 应付款类型 R-关联保单应付款 U-非关联保单应付款
@Schema
(
description
=
"应付款类型 R-关联保单应付款 U-非关联保单应付款"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
*/
@Schema
(
description
=
"应付款类型 R-关联保单应付款 U-非关联保单应付款"
)
private
String
fortuneBizType
;
private
String
fortuneBizType
;
/**
@Schema
(
description
=
"出账年月 (估)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 关联保单号
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
*/
private
String
payoutDate
;
@Schema
(
description
=
"出账年月 (实)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
String
actualPayoutDate
;
@Schema
(
description
=
"关联保单号"
)
@Schema
(
description
=
"关联保单号"
)
private
String
policyNo
;
private
String
policyNo
;
/**
@Schema
(
description
=
"出账状态 0=待出账 1=可出帐,待检核 2=完成出账 3=部分出账 4=保留 5=已失效 6=可出帐,检核完成 7=未找到当前预计发佣对应的来佣, 字典值: csf_expected_fortune_status"
)
* 产品计划 ID
private
String
status
;
*/
@Schema
(
description
=
"
产品计划 ID
"
)
@Schema
(
description
=
"
出账状态-修改理由
"
)
private
String
productLaunchBizId
;
private
String
statusDesc
;
/**
@Schema
(
description
=
"出账项目"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 佣金期数
private
String
fortuneName
;
*/
@Schema
(
description
=
"佣金期数"
)
@Schema
(
description
=
"出账项目类型 字典值:csf_fortune_type"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
fortuneType
;
@Schema
(
description
=
"出账期数"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
Integer
fortunePeriod
;
private
Integer
fortunePeriod
;
/**
@Schema
(
description
=
"出账总期数"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 总期数
*/
@Schema
(
description
=
"总期数"
)
private
Integer
fortuneTotalPeriod
;
private
Integer
fortuneTotalPeriod
;
/**
@Schema
(
description
=
"转介人名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 转介人名称
*/
@Schema
(
description
=
"转介人名称"
)
private
String
broker
;
private
String
broker
;
/**
@Schema
(
description
=
"broker biz id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 转介人业务ID
*/
@Schema
(
description
=
"broker biz id"
)
private
String
brokerBizId
;
private
String
brokerBizId
;
/**
@Schema
(
description
=
"所属团队"
)
* 团队名称
*/
@Schema
(
description
=
"团队名称"
)
private
String
team
;
private
String
team
;
/**
@Schema
(
description
=
"所属团队业务ID"
)
* 所属团队业务ID
*/
@Schema
(
description
=
"所属团队 biz id"
)
private
String
teamBizId
;
private
String
teamBizId
;
/**
@Schema
(
description
=
"保单币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账项目
private
BigDecimal
ruleAmount
;
*/
@Schema
(
description
=
"出账项目"
)
private
String
fortuneName
;
/**
@Schema
(
description
=
"保单币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账项目类型
private
String
ruleCurrency
;
*/
@Schema
(
description
=
"出账项目类型 字典值:csf_fortune_type"
)
private
String
fortuneType
;
/**
@Schema
(
description
=
"保单币种→港币汇率(默认保单币种汇率)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 结算汇率
private
BigDecimal
defaultExchangeRate
;
*/
@Schema
(
description
=
"结算汇率"
)
private
BigDecimal
exchangeRate
;
/**
@Schema
(
description
=
"原币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账金额 单位:港币
private
String
originalCurrency
;
*/
@Schema
(
description
=
"出账金额 单位:港币"
)
private
BigDecimal
hkdAmount
;
/**
@Schema
(
description
=
"原币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账币种
private
BigDecimal
originalAmount
;
*/
@Schema
(
description
=
"出账币种"
)
@Schema
(
description
=
"原币种→港币汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
currency
;
private
BigDecimal
originalToHkdRate
;
/**
@Schema
(
description
=
"发放币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账日 (估)
private
String
payoutCurrency
;
*/
@Schema
(
description
=
"出账日 (估)"
)
@Schema
(
description
=
"发放币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
BigDecimal
payoutAmount
;
private
Date
payoutDate
;
@Schema
(
description
=
"港币→发放币种汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
/**
private
BigDecimal
hkdToPayoutRate
;
* 出账日 (实)
*/
@Schema
(
description
=
"港币金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@Schema
(
description
=
"出账日 (实)"
)
private
BigDecimal
hkdAmount
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
actualPayoutDate
;
/**
* 出账状态
*/
@Schema
(
description
=
"出账状态 0=待出账 1=可出帐,待检核 2=完成出账 3=部分出账 4=保留 5=已失效 6=可出帐,检核完成 7=未找到当前预计发佣对应的来佣, 字典值: csf_expected_fortune_status"
)
private
String
status
;
/**
* 备注
*/
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
private
String
remark
;
}
}
yd-csf-feign/src/main/java/com/yd/csf/feign/request/expectedfortune/ExpectedFortuneUpdateRequest.java
View file @
bdfc676e
...
@@ -5,99 +5,94 @@ import io.swagger.v3.oas.annotations.media.Schema;
...
@@ -5,99 +5,94 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
@Data
@Data
public
class
ExpectedFortuneUpdateRequest
{
public
class
ExpectedFortuneUpdateRequest
{
/**
* 预计发佣业务id
@Schema
(
description
=
"预计发佣业务id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
*/
@Schema
(
description
=
"预计发佣业务id"
)
private
String
expectedFortuneBizId
;
private
String
expectedFortuneBizId
;
/**
@Schema
(
description
=
"应付款类型 R-关联保单应付款 U-非关联保单应付款"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 应付款类型 R-关联保单应付款 U-非关联保单应付款
*/
@Schema
(
description
=
"应付款类型 R-关联保单应付款 U-非关联保单应付款"
)
private
String
fortuneBizType
;
private
String
fortuneBizType
;
/**
@Schema
(
description
=
"出账年月 (估)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账日 (估)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
*/
private
String
payoutDate
;
@Schema
(
description
=
"出账日 (估)"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
LocalDate
payoutDate
;
/**
@Schema
(
description
=
"出账年月 (实)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账日 (实)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
*/
private
String
actualPayoutDate
;
@Schema
(
description
=
"出账日 (实)"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
LocalDate
actualPayoutDate
;
/**
@Schema
(
description
=
"关联保单号"
)
* 港币出账金额
private
String
policyNo
;
*/
@Schema
(
description
=
"港币出账金额"
)
private
BigDecimal
hkdAmount
;
/**
/**
* 出账状态
* 出账状态
*/
*/
@Schema
(
description
=
"出账状态 0=待出账 1=可出帐,待检核 2=完成出账 3=部分出账 4=保留 5=已失效 6=可出帐,检核完成 7=未找到当前预计发佣对应的来佣, 字典值: csf_expected_fortune_status"
)
//
@Schema(description = "出账状态 0=待出账 1=可出帐,待检核 2=完成出账 3=部分出账 4=保留 5=已失效 6=可出帐,检核完成 7=未找到当前预计发佣对应的来佣, 字典值: csf_expected_fortune_status")
private
String
status
;
//
private String status;
/**
/**
* 出账状态-修改理由
* 出账状态-修改理由
*/
*/
@Schema
(
description
=
"出账状态-修改理由"
)
//
@Schema(description = "出账状态-修改理由")
private
String
statusDesc
;
//
private String statusDesc;
/**
* 出账项目
@Schema
(
description
=
"出账项目"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
*/
@Schema
(
description
=
"出账项目"
)
private
String
fortuneName
;
private
String
fortuneName
;
/**
@Schema
(
description
=
"出账项目类型 字典值:csf_fortune_type"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账项目类型
*/
@Schema
(
description
=
"出账项目类型 字典值:csf_fortune_type"
)
private
String
fortuneType
;
private
String
fortuneType
;
/**
@Schema
(
description
=
"出账期数"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账期数
*/
@Schema
(
description
=
"出账期数"
)
private
Integer
fortunePeriod
;
private
Integer
fortunePeriod
;
/**
@Schema
(
description
=
"出账总期数"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 出账总期数
*/
@Schema
(
description
=
"出账总期数"
)
private
Integer
fortuneTotalPeriod
;
private
Integer
fortuneTotalPeriod
;
/**
@Schema
(
description
=
"转介人名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 币种
*/
@Schema
(
description
=
"币种"
)
private
String
currency
;
/**
* 转介人名称
*/
@Schema
(
description
=
"转介人名称"
)
private
String
broker
;
private
String
broker
;
/**
@Schema
(
description
=
"broker biz id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
* 转介人业务ID
*/
@Schema
(
description
=
"broker biz id"
)
private
String
brokerBizId
;
private
String
brokerBizId
;
/**
@Schema
(
description
=
"所属团队"
)
* 备注
private
String
team
;
*/
@Schema
(
description
=
"所属团队业务ID"
)
private
String
teamBizId
;
@Schema
(
description
=
"保单币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
ruleAmount
;
@Schema
(
description
=
"保单币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
ruleCurrency
;
@Schema
(
description
=
"保单币种→港币汇率(默认保单币种汇率)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
defaultExchangeRate
;
@Schema
(
description
=
"原币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
originalCurrency
;
@Schema
(
description
=
"原币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalAmount
;
@Schema
(
description
=
"原币种→港币汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalToHkdRate
;
@Schema
(
description
=
"发放币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
payoutCurrency
;
@Schema
(
description
=
"发放币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
payoutAmount
;
@Schema
(
description
=
"港币→发放币种汇率"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdToPayoutRate
;
@Schema
(
description
=
"港币金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdAmount
;
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
private
String
remark
;
}
}
yd-csf-feign/src/main/java/com/yd/csf/feign/request/salarysplit/ApiSalarySplitSummaryPageRequest.java
View file @
bdfc676e
...
@@ -42,4 +42,9 @@ public class ApiSalarySplitSummaryPageRequest extends PageDto {
...
@@ -42,4 +42,9 @@ public class ApiSalarySplitSummaryPageRequest extends PageDto {
* 出账机构
* 出账机构
*/
*/
private
String
billOrg
;
private
String
billOrg
;
/**
* 出账业务编号
*/
private
String
businessNo
;
}
}
yd-csf-feign/src/main/java/com/yd/csf/feign/response/expectedfortune/ApiExpectedFortunePageResponse.java
View file @
bdfc676e
...
@@ -132,9 +132,9 @@ public class ApiExpectedFortunePageResponse {
...
@@ -132,9 +132,9 @@ public class ApiExpectedFortunePageResponse {
private
String
fortuneType
;
private
String
fortuneType
;
/**
/**
*
转介人介绍费占比
*
持有比例
*/
*/
@Schema
(
description
=
"
转介人介绍费占比
"
)
@Schema
(
description
=
"
持有比例
"
)
private
String
brokerRatio
;
private
String
brokerRatio
;
...
@@ -152,22 +152,55 @@ public class ApiExpectedFortunePageResponse {
...
@@ -152,22 +152,55 @@ public class ApiExpectedFortunePageResponse {
private
String
ruleCurrency
;
private
String
ruleCurrency
;
/**
/**
*
出账币种名称
*
预计出账-默认保单币种汇率(保单币种 -> 港币汇率)
*/
*/
@Schema
(
description
=
"出账币种名称"
)
@Schema
(
description
=
"预计出账-默认保单币种汇率(保单币种 -> 港币汇率)"
)
private
String
currencyName
;
private
BigDecimal
defaultExchangeRate
;
/**
* 预计出账-HKD应出账金额
*/
@Schema
(
description
=
"预计出账-HKD应出账金额"
)
private
BigDecimal
hkdAmount
;
// ========== 原币种及金额 ==========
@Schema
(
description
=
"原币种"
)
private
String
originalCurrency
;
@Schema
(
description
=
"原币种金额"
)
private
BigDecimal
originalAmount
;
@Schema
(
description
=
"原币→港币汇率"
)
private
BigDecimal
originalToHkdRate
;
// ========== 发放币种及金额 ==========
@Schema
(
description
=
"发放币种"
)
private
String
payoutCurrency
;
@Schema
(
description
=
"发放币种金额"
)
private
BigDecimal
payoutAmount
;
@Schema
(
description
=
"港币→发放币汇率"
)
private
BigDecimal
hkdToPayoutRate
;
/**
* 实际出账-本次出账金额(HKD)
*/
@Schema
(
description
=
"实际出账-本次出账金额(HKD)"
)
private
BigDecimal
currentPaymentHkdAmount
;
/**
/**
*
保单币种 -> 港币
汇率
*
实际出账-本期结算
汇率
*/
*/
@Schema
(
description
=
"
保单币种 -> 港币
汇率"
)
@Schema
(
description
=
"
实际出账-本期结算
汇率"
)
private
BigDecimal
exchangeRate
;
private
BigDecimal
exchangeRate
;
/**
/**
*
HKD应出账金额
*
出账币种名称
*/
*/
@Schema
(
description
=
"
HKD应出账金额
"
)
@Schema
(
description
=
"
出账币种名称
"
)
private
BigDecimal
hkdAmount
;
private
String
currencyName
;
/**
/**
* 出账状态
* 出账状态
...
@@ -196,51 +229,47 @@ public class ApiExpectedFortunePageResponse {
...
@@ -196,51 +229,47 @@ public class ApiExpectedFortunePageResponse {
private
LocalDate
actualPayoutDate
;
private
LocalDate
actualPayoutDate
;
/**
/**
* 已出账金额(HKD)
*
预计出账-
已出账金额(HKD)
*/
*/
@Schema
(
description
=
"已出账金额(HKD)"
)
@Schema
(
description
=
"
预计出账-
已出账金额(HKD)"
)
private
BigDecimal
paidAmount
;
private
BigDecimal
paidAmount
;
/**
/**
* 待出账金额
*
预计出账-
待出账金额
*/
*/
@Schema
(
description
=
"待出账金额"
)
@Schema
(
description
=
"
预计出账-
待出账金额"
)
private
BigDecimal
unpaidAmount
;
private
BigDecimal
unpaidAmount
;
/**
/**
*
已出账
比例 已出账金额/应出账金额
*
预计出账-已出账金额
比例 已出账金额/应出账金额
*/
*/
@Schema
(
description
=
"
已出账
比例 已出账金额/应出账金额"
)
@Schema
(
description
=
"
预计出账-已出账金额
比例 已出账金额/应出账金额"
)
private
BigDecimal
paidRatio
;
private
BigDecimal
paidRatio
;
/**
/**
* 待出账比例 待出账金额/应出账金额
*
预计出账-
待出账比例 待出账金额/应出账金额
*/
*/
@Schema
(
description
=
"待出账比例 待出账金额/应出账金额"
)
@Schema
(
description
=
"
预计出账-
待出账比例 待出账金额/应出账金额"
)
private
BigDecimal
unpaidRatio
;
private
BigDecimal
unpaidRatio
;
/**
/**
* 基本法项目配置表唯一业务ID
*/
@Schema
(
description
=
"rule item biz id"
)
private
String
ruleItemBizId
;
/**
* 备注
* 备注
*/
*/
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
private
String
remark
;
/**
/**
* 创建
时间
* 创建
人
*/
*/
@Schema
(
description
=
"创建
时间
"
)
@Schema
(
description
=
"创建
人
"
)
private
LocalDateTime
createTi
me
;
private
String
creatorNa
me
;
/**
/**
* 创建
人名称
* 创建
时间
*/
*/
private
String
creatorName
;
@Schema
(
description
=
"创建时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
createTime
;
/**
/**
* 更新时间(操作时间)
* 更新时间(操作时间)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/component/PolicyReportPdfService.java
View file @
bdfc676e
...
@@ -247,8 +247,9 @@ public class PolicyReportPdfService {
...
@@ -247,8 +247,9 @@ public class PolicyReportPdfService {
// 第五行:年繳金額 | 金額值 | 保費徵費 | 費用值
// 第五行:年繳金額 | 金額值 | 保費徵費 | 費用值
addTableHeaderCellNoBorder
(
table
,
"年繳金額"
);
addTableHeaderCellNoBorder
(
table
,
"年繳金額"
);
addTableCellNoBorder
(
table
,
formatAmount
(
data
.
getAnnualAmount
()));
addTableCellNoBorder
(
table
,
formatAmount
(
data
.
getAnnualAmount
()));
//保单征费
addTableHeaderCellNoBorder
(
table
,
"保費徵費"
);
addTableHeaderCellNoBorder
(
table
,
"保費徵費"
);
addTableCellNoBorder
(
table
,
formatAmount
(
data
.
getP
remiumFee
()));
addTableCellNoBorder
(
table
,
formatAmount
(
data
.
getP
olicyLevy
()));
// 第六行:首期合計金額 | 金額值 | (空) | (空)
// 第六行:首期合計金額 | 金額值 | (空) | (空)
addTableHeaderCellNoBorder
(
table
,
"首期合計金額"
);
addTableHeaderCellNoBorder
(
table
,
"首期合計金額"
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/config/XxlJobConfig.java
View file @
bdfc676e
package
com
.
yd
.
csf
.
service
.
config
;
//package com.yd.csf.service.config;
//
import
com.xxl.job.core.executor.impl.XxlJobSpringExecutor
;
//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import
lombok.extern.slf4j.Slf4j
;
//import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang3.StringUtils
;
//import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Value
;
//import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import
org.springframework.context.annotation.Bean
;
//import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
//import org.springframework.context.annotation.Configuration;
//
@Slf4j
//@Slf4j
@Configuration
//@Configuration
@ConditionalOnClass
(
XxlJobSpringExecutor
.
class
)
//@ConditionalOnClass(XxlJobSpringExecutor.class)
public
class
XxlJobConfig
{
//public class XxlJobConfig {
//
@Value
(
"${xxl.job.admin.addresses:http://139.224.145.34:8686/xxl-job-admin}"
)
// @Value("${xxl.job.admin.addresses:http://139.224.145.34:8686/xxl-job-admin}")
private
String
adminAddresses
;
// private String adminAddresses;
//
@Value
(
"${xxl.job.executor.appname:csf-executor}"
)
// @Value("${xxl.job.executor.appname:csf-executor}")
private
String
appname
;
// private String appname;
//
@Value
(
"${xxl.job.executor.port:9999}"
)
// @Value("${xxl.job.executor.port:9999}")
private
int
port
;
// private int port;
//
@Value
(
"${xxl.job.accessToken:default_token}"
)
// @Value("${xxl.job.accessToken:default_token}")
private
String
accessToken
;
// private String accessToken;
//
@Bean
// @Bean
public
XxlJobSpringExecutor
xxlJobExecutor
()
{
// public XxlJobSpringExecutor xxlJobExecutor() {
log
.
info
(
">>>>>>>>>>> xxl-job config init. appname: {}, port: {}, accessToken: {}"
,
// log.info(">>>>>>>>>>> xxl-job config init. appname: {}, port: {}, accessToken: {}",
appname
,
port
,
StringUtils
.
isNotBlank
(
accessToken
)
?
"已配置"
:
"未配置"
);
// appname, port, StringUtils.isNotBlank(accessToken) ? "已配置" : "未配置");
//
XxlJobSpringExecutor
xxlJobSpringExecutor
=
new
XxlJobSpringExecutor
();
// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor
.
setAdminAddresses
(
adminAddresses
);
// xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor
.
setAppname
(
appname
);
// xxlJobSpringExecutor.setAppname(appname);
xxlJobSpringExecutor
.
setPort
(
port
);
// xxlJobSpringExecutor.setPort(port);
// 设置accessToken
// // 设置accessToken
xxlJobSpringExecutor
.
setAccessToken
(
accessToken
);
// xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor
.
setLogRetentionDays
(
30
);
// xxlJobSpringExecutor.setLogRetentionDays(30);
//
return
xxlJobSpringExecutor
;
// return xxlJobSpringExecutor;
}
// }
}
//}
\ No newline at end of file
\ No newline at end of file
yd-csf-service/src/main/java/com/yd/csf/service/dao/PolicyFollowMapper.java
View file @
bdfc676e
...
@@ -20,7 +20,7 @@ public interface PolicyFollowMapper extends BaseMapper<PolicyFollow> {
...
@@ -20,7 +20,7 @@ public interface PolicyFollowMapper extends BaseMapper<PolicyFollow> {
List
<
String
>
queryPolicyNoList
(
List
<
String
>
queryPolicyNoList
(
@Param
(
"policyHolderSc"
)
String
policyHolderSc
,
@Param
(
"policyHolderSc"
)
String
policyHolderSc
,
@Param
(
"policyHolderEnLc"
)
String
policyHolderEnLc
,
@Param
(
"policyHolderEnLc"
)
String
policyHolderEnLc
,
@Param
(
"signer
"
)
String
signer
,
@Param
(
"signer
Sc"
)
String
signerSc
,
@Param
(
"brokerName"
)
String
brokerName
,
@Param
(
"brokerName"
)
String
brokerName
,
@Param
(
"insuredSc"
)
String
insuredSc
,
@Param
(
"insuredSc"
)
String
insuredSc
,
@Param
(
"insuredEnLc"
)
String
insuredEnLc
@Param
(
"insuredEnLc"
)
String
insuredEnLc
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/BatchEditActualPayoutDateRequest.java
0 → 100644
View file @
bdfc676e
package
com
.
yd
.
csf
.
service
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BatchEditActualPayoutDateRequest
{
@Schema
(
description
=
"出账业务ID列表"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
List
<
String
>
fortuneBizIdList
;
@Schema
(
description
=
"实际出账年月(实)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
actualPayoutDate
;
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionAddRequest.java
View file @
bdfc676e
...
@@ -81,11 +81,10 @@ public class CommissionAddRequest implements Serializable {
...
@@ -81,11 +81,10 @@ public class CommissionAddRequest implements Serializable {
private
BigDecimal
exchangeRate
;
private
BigDecimal
exchangeRate
;
/**
/**
* 入账
日
(实)
* 入账
年月
(实)
*/
*/
@Schema
(
description
=
"入账日(实)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
format
=
"yyyy-MM-dd"
)
@Schema
(
description
=
"入账年月(实)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
format
=
"yyyy-MM"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
String
commissionDate
;
private
Date
commissionDate
;
/**
/**
* 备注
* 备注
...
@@ -93,5 +92,10 @@ public class CommissionAddRequest implements Serializable {
...
@@ -93,5 +92,10 @@ public class CommissionAddRequest implements Serializable {
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
private
String
remark
;
/**
* 人工备注
*/
private
String
manualRemark
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedAddDto.java
View file @
bdfc676e
...
@@ -102,16 +102,16 @@ public class CommissionExpectedAddDto {
...
@@ -102,16 +102,16 @@ public class CommissionExpectedAddDto {
/**
/**
* 入账日 (估)
* 入账日 (估)
*/
*/
@Schema
(
description
=
"入账日 (估) format:yyyy-MM
-dd
"
)
@Schema
(
description
=
"入账日 (估) format:yyyy-MM"
)
@JsonFormat
(
pattern
=
"yyyy-MM
-dd
"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
Date
commissionDate
;
private
Date
commissionDate
;
/**
//
/**
* 入账日 (实)
//
* 入账日 (实)
*/
//
*/
@Schema
(
description
=
"入账日 (实) format:yyyy-MM-dd"
)
//
@Schema(description = "入账日 (实) format:yyyy-MM-dd")
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
//
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private
Date
actualCommissionDate
;
//
private Date actualCommissionDate;
/**
/**
* 入账状态 0=待入账 1=完成入账 2=部分入账 3=已失效
* 入账状态 0=待入账 1=完成入账 2=部分入账 3=已失效
...
@@ -120,8 +120,8 @@ public class CommissionExpectedAddDto {
...
@@ -120,8 +120,8 @@ public class CommissionExpectedAddDto {
private
String
status
;
private
String
status
;
/**
/**
* 备注
*
人工
备注
*/
*/
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"
人工
备注"
)
private
String
r
emark
;
private
String
manualR
emark
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedQueryRequest.java
View file @
bdfc676e
...
@@ -105,4 +105,6 @@ public class CommissionExpectedQueryRequest extends PageDto {
...
@@ -105,4 +105,6 @@ public class CommissionExpectedQueryRequest extends PageDto {
private
List
<
String
>
policyNoList
;
private
List
<
String
>
policyNoList
;
private
Boolean
queryFlag
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionExpectedUpdateRequest.java
View file @
bdfc676e
package
com
.
yd
.
csf
.
service
.
dto
;
package
com
.
yd
.
csf
.
service
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -112,13 +113,13 @@ public class CommissionExpectedUpdateRequest implements Serializable {
...
@@ -112,13 +113,13 @@ public class CommissionExpectedUpdateRequest implements Serializable {
* 入账日期
* 入账日期
*/
*/
@Schema
(
description
=
"入账日期 format:yyyy-MM-dd"
)
@Schema
(
description
=
"入账日期 format:yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
Date
commissionDate
;
private
Date
commissionDate
;
/**
/**
* 备注
*
人工
备注
*/
*/
@Schema
(
description
=
"备注"
)
private
String
manualRemark
;
private
String
remark
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
\ No newline at end of file
yd-csf-service/src/main/java/com/yd/csf/service/dto/CommissionUpdateRequest.java
View file @
bdfc676e
...
@@ -92,11 +92,10 @@ public class CommissionUpdateRequest implements Serializable {
...
@@ -92,11 +92,10 @@ public class CommissionUpdateRequest implements Serializable {
private
BigDecimal
exchangeRate
;
private
BigDecimal
exchangeRate
;
/**
/**
* 入账
日期
* 入账
年月 yyyy-MM
*/
*/
@Schema
(
description
=
"入账日期"
)
@Schema
(
description
=
"入账年月 yyyy-MM"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
String
commissionDate
;
private
Date
commissionDate
;
/**
/**
* 备注
* 备注
...
@@ -104,5 +103,10 @@ public class CommissionUpdateRequest implements Serializable {
...
@@ -104,5 +103,10 @@ public class CommissionUpdateRequest implements Serializable {
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
private
String
remark
;
/**
* 人工备注
*/
private
String
manualRemark
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneAddRequest.java
View file @
bdfc676e
package
com
.
yd
.
csf
.
service
.
dto
;
package
com
.
yd
.
csf
.
service
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -143,10 +144,16 @@ public class FortuneAddRequest implements Serializable {
...
@@ -143,10 +144,16 @@ public class FortuneAddRequest implements Serializable {
private
BigDecimal
hkdAmount
;
private
BigDecimal
hkdAmount
;
/**
/**
* 出账
日期
* 出账
年月(估)
*/
*/
@Schema
(
description
=
"出账日期"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@Schema
(
description
=
"出账年月(估)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
LocalDate
payoutDate
;
private
String
payoutDate
;
/**
* 出账年月(实)
*/
@Schema
(
description
=
"出账年月(实)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
actualPayoutDate
;
/**
/**
* 出账备注
* 出账备注
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneDownloadRequest.java
View file @
bdfc676e
...
@@ -11,6 +11,4 @@ public class FortuneDownloadRequest {
...
@@ -11,6 +11,4 @@ public class FortuneDownloadRequest {
@Schema
(
description
=
"发佣数据业务Id列表"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@Schema
(
description
=
"发佣数据业务Id列表"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
List
<
String
>
fortuneBizIdList
;
private
List
<
String
>
fortuneBizIdList
;
@Schema
(
description
=
"出账年月(实),格式:yyyy-MM,例如:2026-04"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
actualPayoutDate
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneQueryRequest.java
View file @
bdfc676e
...
@@ -60,18 +60,16 @@ public class FortuneQueryRequest extends PageDto implements Serializable {
...
@@ -60,18 +60,16 @@ public class FortuneQueryRequest extends PageDto implements Serializable {
private
List
<
String
>
productLaunchBizIdList
;
private
List
<
String
>
productLaunchBizIdList
;
/**
/**
* 出账
日
(估)开始
* 出账
年月
(估)开始
*/
*/
@Schema
(
description
=
"出账日(估)开始 格式:yyyy-MM-dd"
)
@Schema
(
description
=
"出账年月(估)开始 格式:yyyy-MM"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
String
payoutDateStart
;
private
LocalDate
payoutDateStart
;
/**
/**
* 出账
日
(估)结束
* 出账
年月
(估)结束
*/
*/
@Schema
(
description
=
"出账日(估)结束 格式:yyyy-MM-dd"
)
@Schema
(
description
=
"出账年月(估)结束 格式:yyyy-MM"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
String
payoutDateEnd
;
private
LocalDate
payoutDateEnd
;
/**
/**
* 检核年月
* 检核年月
...
...
yd-csf-service/src/main/java/com/yd/csf/service/enums/FortuneTypeEnum.java
0 → 100644
View file @
bdfc676e
package
com
.
yd
.
csf
.
service
.
enums
;
import
org.apache.commons.lang3.StringUtils
;
/**
* 项目类型码枚举
* XS("销售佣金", "1")
* M1("一级管理奖", "2")
* M2("二级管理奖", "3")
* TJ("终身推荐奖", "4")
* FD("辅导奖", "5")
* OT("其他加扣款", "6")
* PA("协议约定金额", "7")
*/
public
enum
FortuneTypeEnum
{
//项目类型枚举
XS
(
"XS"
,
"1"
),
M1
(
"M1"
,
"2"
),
M2
(
"M2"
,
"3"
),
TJ
(
"TJ"
,
"4"
),
FD
(
"FD"
,
"5"
),
OT
(
"OT"
,
"6"
),
PA
(
"PA"
,
"7"
),
;
//字典项标签(名称)
private
String
itemLabel
;
//字典项值
private
String
itemValue
;
//构造函数
FortuneTypeEnum
(
String
itemLabel
,
String
itemValue
)
{
this
.
itemLabel
=
itemLabel
;
this
.
itemValue
=
itemValue
;
}
public
String
getItemLabel
()
{
return
itemLabel
;
}
public
String
getItemValue
()
{
return
itemValue
;
}
/**
* 根据业务值(itemValue)获取枚举实例
*
* @param itemValue 业务值,如 "2"
* @return 对应的枚举实例
*/
public
static
FortuneTypeEnum
getByItemValue
(
String
itemValue
)
{
if
(
StringUtils
.
isBlank
(
itemValue
))
{
throw
new
IllegalArgumentException
(
"itemValue is blank"
);
}
for
(
FortuneTypeEnum
type
:
FortuneTypeEnum
.
values
())
{
if
(
type
.
itemValue
.
equals
(
itemValue
))
{
return
type
;
}
}
throw
new
IllegalArgumentException
(
"No enum constant for itemValue: "
+
itemValue
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/model/Commission.java
View file @
bdfc676e
...
@@ -147,6 +147,11 @@ public class Commission implements Serializable {
...
@@ -147,6 +147,11 @@ public class Commission implements Serializable {
private
String
commissionExpectedBizId
;
private
String
commissionExpectedBizId
;
/**
/**
* 人工备注
*/
private
String
manualRemark
;
/**
* 通用备注
* 通用备注
*/
*/
private
String
remark
;
private
String
remark
;
...
@@ -160,11 +165,19 @@ public class Commission implements Serializable {
...
@@ -160,11 +165,19 @@ public class Commission implements Serializable {
/**
/**
* 创建人ID
* 创建人ID
*/
*/
@TableField
(
value
=
"creator_id"
,
fill
=
FieldFill
.
INSERT
)
private
String
creatorId
;
private
String
creatorId
;
/**
/**
* 创建人名称
*/
@TableField
(
value
=
"creator_name"
,
fill
=
FieldFill
.
INSERT
)
private
String
creatorName
;
/**
* 更新人ID
* 更新人ID
*/
*/
@TableField
(
value
=
"updater_id"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
String
updaterId
;
private
String
updaterId
;
/**
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/CommissionExpected.java
View file @
bdfc676e
package
com
.
yd
.
csf
.
service
.
model
;
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -161,6 +158,11 @@ public class CommissionExpected implements Serializable {
...
@@ -161,6 +158,11 @@ public class CommissionExpected implements Serializable {
private
BigDecimal
pendingRatio
;
private
BigDecimal
pendingRatio
;
/**
/**
* 人工备注
*/
private
String
manualRemark
;
/**
* 通用备注
* 通用备注
*/
*/
private
String
remark
;
private
String
remark
;
...
@@ -173,14 +175,28 @@ public class CommissionExpected implements Serializable {
...
@@ -173,14 +175,28 @@ public class CommissionExpected implements Serializable {
/**
/**
* 创建人ID
* 创建人ID
*/
*/
@TableField
(
value
=
"creator_id"
,
fill
=
FieldFill
.
INSERT
)
private
String
creatorId
;
private
String
creatorId
;
/**
/**
* 创建人名称
*/
@TableField
(
value
=
"creator_name"
,
fill
=
FieldFill
.
INSERT
)
private
String
creatorName
;
/**
* 更新人ID
* 更新人ID
*/
*/
@TableField
(
value
=
"updater_id"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
String
updaterId
;
private
String
updaterId
;
/**
/**
* 更新人名称
*/
@TableField
(
value
=
"updater_name"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
String
updaterName
;
/**
* 创建时间
* 创建时间
*/
*/
private
Date
createTime
;
private
Date
createTime
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/PolicyFollow.java
View file @
bdfc676e
...
@@ -75,6 +75,11 @@ public class PolicyFollow implements Serializable {
...
@@ -75,6 +75,11 @@ public class PolicyFollow implements Serializable {
private
String
signer
;
private
String
signer
;
/**
/**
* 签单人(简体)
*/
private
String
signerSc
;
/**
* 签单人业务id
* 签单人业务id
*/
*/
private
String
signerBizId
;
private
String
signerBizId
;
...
@@ -265,6 +270,11 @@ public class PolicyFollow implements Serializable {
...
@@ -265,6 +270,11 @@ public class PolicyFollow implements Serializable {
private
String
policyHolder
;
private
String
policyHolder
;
/**
/**
* 保單持有人(英文)
*/
private
String
policyHolderEn
;
/**
* 受保人
* 受保人
*/
*/
private
String
insured
;
private
String
insured
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionExpectedService.java
View file @
bdfc676e
...
@@ -7,6 +7,7 @@ import com.yd.csf.service.dto.CommissionExpectedAddRequest;
...
@@ -7,6 +7,7 @@ import com.yd.csf.service.dto.CommissionExpectedAddRequest;
import
com.yd.csf.service.dto.CommissionExpectedChangeStatusRequest
;
import
com.yd.csf.service.dto.CommissionExpectedChangeStatusRequest
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
com.yd.csf.service.dto.CommissionExpectedQueryRequest
;
import
com.yd.csf.service.dto.CommissionExpectedUpdateRequest
;
import
com.yd.csf.service.dto.CommissionExpectedUpdateRequest
;
import
com.yd.csf.service.model.Commission
;
import
com.yd.csf.service.model.CommissionExpected
;
import
com.yd.csf.service.model.CommissionExpected
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.model.Policy
;
...
@@ -88,4 +89,6 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
...
@@ -88,4 +89,6 @@ public interface CommissionExpectedService extends IService<CommissionExpected>
Boolean
changeStatus
(
CommissionExpectedChangeStatusRequest
commissionExpectedChangeStatusRequest
);
Boolean
changeStatus
(
CommissionExpectedChangeStatusRequest
commissionExpectedChangeStatusRequest
);
CommissionExpected
queryOne
(
String
commissionExpectedBizId
);
CommissionExpected
queryOne
(
String
commissionExpectedBizId
);
CommissionExpected
queryOne
(
String
policyNo
,
Integer
commissionPeriod
,
String
commissionType
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/CommissionService.java
View file @
bdfc676e
...
@@ -69,4 +69,6 @@ public interface CommissionService extends IService<Commission> {
...
@@ -69,4 +69,6 @@ public interface CommissionService extends IService<Commission> {
* @return 结算汇率
* @return 结算汇率
*/
*/
BigDecimal
queryCommissionExchangeRate
(
String
policyNo
,
Integer
commissionPeriod
);
BigDecimal
queryCommissionExchangeRate
(
String
policyNo
,
Integer
commissionPeriod
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneAccountService.java
View file @
bdfc676e
...
@@ -22,7 +22,7 @@ public interface FortuneAccountService extends IService<FortuneAccount> {
...
@@ -22,7 +22,7 @@ public interface FortuneAccountService extends IService<FortuneAccount> {
Page
<
FortuneAccountVO
>
getFortuneAccountVOPage
(
Page
<
FortuneAccount
>
fortunePage
);
Page
<
FortuneAccountVO
>
getFortuneAccountVOPage
(
Page
<
FortuneAccount
>
fortunePage
);
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
,
LocalDate
actualPayoutDate
);
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
);
FortuneAccount
getByFortuneAccountBizId
(
String
fortuneAccountBizId
);
FortuneAccount
getByFortuneAccountBizId
(
String
fortuneAccountBizId
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/FortuneService.java
View file @
bdfc676e
...
@@ -47,4 +47,5 @@ public interface FortuneService extends IService<Fortune> {
...
@@ -47,4 +47,5 @@ public interface FortuneService extends IService<Fortune> {
Boolean
editExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
);
Boolean
editExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
);
String
batchEditActualPayoutDate
(
BatchEditActualPayoutDateRequest
editBatchActualPayoutDateRequest
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
View file @
bdfc676e
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.yd.csf.service.vo.ExpectedFortuneStatisticsVO
;
import
com.yd.csf.service.vo.ExpectedFortuneStatisticsVO
;
import
com.yd.csf.service.vo.PayableReportVO
;
import
com.yd.csf.service.vo.PayableReportVO
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -39,6 +40,7 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
...
@@ -39,6 +40,7 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
/**
/**
* 应付款报表 - 按保单号和期数维度统计(分页)
* 应付款报表 - 按保单号和期数维度统计(分页)
*
* @param page 分页参数
* @param page 分页参数
* @param expectedFortuneIds 预计发佣ID列表
* @param expectedFortuneIds 预计发佣ID列表
* @return 应付款报表VO分页列表
* @return 应付款报表VO分页列表
...
@@ -52,14 +54,18 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
...
@@ -52,14 +54,18 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
Integer
getPayableNoCurrentSeq
();
Integer
getPayableNoCurrentSeq
();
/**
/**
* 生成应付款编号(序号递增) 格式:发佣类型-CSF+年份+序号
* 生成应付款编号 格式:发佣类型-保单号后6位-流水号
* @param fortuneType 发佣类型
*
* @param fortuneType 应付款类型
* @param policyNo 保单号
* @param expectedFortuneId 预计发佣ID
* @return 应付款编号
* @return 应付款编号
*/
*/
String
getPayableNo
(
String
fortuneType
);
String
getPayableNo
(
String
fortuneType
,
String
policyNo
,
long
expectedFortuneId
);
/**
/**
* 查询预计发佣和实际发佣的分页列表(手动分页)
* 查询预计发佣和实际发佣的分页列表(手动分页)
*
* @param pageNo 页码(从 1 开始)
* @param pageNo 页码(从 1 开始)
* @param pageSize 每页大小
* @param pageSize 每页大小
* @param queryWrapper 查询条件
* @param queryWrapper 查询条件
...
@@ -69,6 +75,7 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
...
@@ -69,6 +75,7 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
/**
/**
* 查询预计发佣和实际发佣的统计数据(使用 SQL 聚合)
* 查询预计发佣和实际发佣的统计数据(使用 SQL 聚合)
*
* @param queryWrapper 查询条件
* @param queryWrapper 查询条件
* @return 统计信息
* @return 统计信息
*/
*/
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyBrokerService.java
View file @
bdfc676e
...
@@ -4,8 +4,10 @@ import com.yd.csf.service.dto.QueryPolicyBrokerDto;
...
@@ -4,8 +4,10 @@ import com.yd.csf.service.dto.QueryPolicyBrokerDto;
import
com.yd.csf.service.model.PolicyBroker
;
import
com.yd.csf.service.model.PolicyBroker
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* @author Zhang Jianan
* @author Zhang Jianan
...
@@ -22,6 +24,7 @@ public interface PolicyBrokerService extends IService<PolicyBroker> {
...
@@ -22,6 +24,7 @@ public interface PolicyBrokerService extends IService<PolicyBroker> {
List
<
String
>
selectRelatedBrokerBizIds
(
String
clientUserId
);
List
<
String
>
selectRelatedBrokerBizIds
(
String
clientUserId
);
Map
<
String
,
PolicyBroker
>
queryPolicyBrokerMap
(
Collection
<
String
>
policyNoSet
);
Map
<
String
,
String
>
queryInternalCodeMap
(
List
<
String
>
brokerBizIdList
);
Map
<
String
,
String
>
queryInternalCodeMap
(
List
<
String
>
brokerBizIdList
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyFollowService.java
View file @
bdfc676e
...
@@ -12,6 +12,7 @@ import com.yd.csf.service.vo.PolicyFollowDetailVO;
...
@@ -12,6 +12,7 @@ import com.yd.csf.service.vo.PolicyFollowDetailVO;
import
com.yd.csf.service.vo.PolicyFollowVO
;
import
com.yd.csf.service.vo.PolicyFollowVO
;
import
com.yd.csf.service.vo.PolicyNumberResponseVO
;
import
com.yd.csf.service.vo.PolicyNumberResponseVO
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -182,6 +183,8 @@ public interface PolicyFollowService extends IService<PolicyFollow> {
...
@@ -182,6 +183,8 @@ public interface PolicyFollowService extends IService<PolicyFollow> {
*/
*/
Boolean
updatePolicySecondHolder
(
PolicySecondHolderUpdateRequest
policySecondHolderUpdateRequest
);
Boolean
updatePolicySecondHolder
(
PolicySecondHolderUpdateRequest
policySecondHolderUpdateRequest
);
Map
<
String
,
PolicyFollow
>
queryPolicyFollowMap
(
Collection
<?>
policyNoSet
);
Result
<
ApiPolicyFollowDetailResponse
>
detail
(
String
policyNo
);
Result
<
ApiPolicyFollowDetailResponse
>
detail
(
String
policyNo
);
List
<
String
>
queryPolicyNoList
(
String
policyHolder
,
String
signer
,
String
brokerName
,
String
insured
);
List
<
String
>
queryPolicyNoList
(
String
policyHolder
,
String
signer
,
String
brokerName
,
String
insured
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyPolicyholderService.java
View file @
bdfc676e
...
@@ -4,6 +4,9 @@ import com.yd.csf.service.dto.PolicyPolicyholderUpdateRequest;
...
@@ -4,6 +4,9 @@ import com.yd.csf.service.dto.PolicyPolicyholderUpdateRequest;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -22,6 +25,8 @@ public interface PolicyPolicyholderService extends IService<PolicyPolicyholder>
...
@@ -22,6 +25,8 @@ public interface PolicyPolicyholderService extends IService<PolicyPolicyholder>
PolicyPolicyholder
queryOne
(
String
policyBizId
);
PolicyPolicyholder
queryOne
(
String
policyBizId
);
Map
<
String
,
PolicyPolicyholder
>
queryPolicyholderMap
(
Collection
<?>
policyNoList
);
List
<
PolicyPolicyholder
>
queryList
(
String
policyHolder
);
List
<
PolicyPolicyholder
>
queryList
(
String
policyHolder
);
boolean
updateName
(
String
policyBizId
,
String
name
);
boolean
updateName
(
String
policyBizId
,
String
name
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/PolicyService.java
View file @
bdfc676e
...
@@ -10,6 +10,7 @@ import com.yd.csf.service.vo.PolicyVO;
...
@@ -10,6 +10,7 @@ import com.yd.csf.service.vo.PolicyVO;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* @author Zhang Jianan
* @author Zhang Jianan
...
@@ -33,4 +34,6 @@ public interface PolicyService extends IService<Policy> {
...
@@ -33,4 +34,6 @@ public interface PolicyService extends IService<Policy> {
List
<
PolicyProductInfo
>
getPolicyProductInfo
(
List
<
String
>
productLaunchBizIdList
);
List
<
PolicyProductInfo
>
getPolicyProductInfo
(
List
<
String
>
productLaunchBizIdList
);
Map
<
String
,
PolicyProductInfo
>
getPolicyProductInfoMap
(
Collection
<
String
>
productLaunchBizIdList
);
Map
<
String
,
PolicyProductInfo
>
getPolicyProductInfoMap
(
Collection
<
String
>
productLaunchBizIdList
);
Map
<
String
,
Policy
>
queryPolicyMap
(
Collection
<
String
>
policyNoList
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionExpectedServiceImpl.java
View file @
bdfc676e
...
@@ -92,6 +92,8 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -92,6 +92,8 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
private
ApiInsuranceReconciliationCompanyFeignClient
companyFeignClient
;
private
ApiInsuranceReconciliationCompanyFeignClient
companyFeignClient
;
@Resource
@Resource
private
CustomerService
customerService
;
private
CustomerService
customerService
;
@Resource
private
CommissionExpectedService
commissionExpectedService
;
// 用于对象转换的ObjectMapper
// 用于对象转换的ObjectMapper
private
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
private
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
...
@@ -255,6 +257,16 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -255,6 +257,16 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
vo
.
setCommissionDate
(
null
);
vo
.
setCommissionDate
(
null
);
//本次入账比例
//本次入账比例
vo
.
setRevenueRatio
(
null
);
vo
.
setRevenueRatio
(
null
);
vo
.
setRemark
(
expected
.
getRemark
());
vo
.
setManualRemark
(
expected
.
getManualRemark
());
vo
.
setStatusDesc
(
expected
.
getStatusDesc
());
vo
.
setCommissionExpectedBizId
(
expected
.
getCommissionExpectedBizId
());
vo
.
setCommissionExpectedDate
(
expected
.
getCommissionDate
());
vo
.
setCurrency
(
expected
.
getCurrency
());
vo
.
setCommissionType
(
expected
.
getCommissionType
());
vo
.
setAmount
(
expected
.
getAmount
());
vo
.
setRealUpdaterName
(
expected
.
getUpdaterName
());
vo
.
setRealUpdateTime
(
expected
.
getUpdateTime
());
// 填充保单信息
// 填充保单信息
Policy
policy
=
policyMap
.
get
(
expected
.
getPolicyNo
());
Policy
policy
=
policyMap
.
get
(
expected
.
getPolicyNo
());
...
@@ -268,6 +280,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -268,6 +280,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
if
(
policyFollow
!=
null
)
{
if
(
policyFollow
!=
null
)
{
vo
.
setProductName
(
policyFollow
.
getProductName
());
vo
.
setProductName
(
policyFollow
.
getProductName
());
// vo.setProductLaunchBizId(policyFollow.getProductLaunchBizId());
// vo.setProductLaunchBizId(policyFollow.getProductLaunchBizId());
vo
.
setIssueNumber
(
policyFollow
.
getIssueNumber
()
!=
null
?
Integer
.
parseInt
(
policyFollow
.
getIssueNumber
().
toString
())
:
null
);
}
}
// 累积数据
// 累积数据
...
@@ -277,7 +290,6 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -277,7 +290,6 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
// vo.setPaidAmount(paidAmount);
// vo.setPaidAmount(paidAmount);
vo
.
setRealAmount
(
paidAmount
);
// 实收金额(累积)
vo
.
setRealAmount
(
paidAmount
);
// 实收金额(累积)
vo
.
setExpectedAmount
(
expected
.
getExpectedAmount
());
vo
.
setExpectedAmount
(
expected
.
getExpectedAmount
());
vo
.
setIssueNumber
(
policyFollow
.
getIssueNumber
()
!=
null
?
Integer
.
parseInt
(
policyFollow
.
getIssueNumber
().
toString
())
:
null
);
// 产品来佣率
// 产品来佣率
BigDecimal
commissionRatio
=
expected
.
getCommissionRatio
();
BigDecimal
commissionRatio
=
expected
.
getCommissionRatio
();
...
@@ -304,17 +316,19 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -304,17 +316,19 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
}
else
{
}
else
{
vo
.
setRealRate
(
BigDecimal
.
ZERO
);
vo
.
setRealRate
(
BigDecimal
.
ZERO
);
vo
.
setGapRate
(
BigDecimal
.
ZERO
);
vo
.
setGapRate
(
BigDecimal
.
ZERO
);
// 当产品来佣率为零或 null 时,总入账比例无意义,设置为 0
if
(
"U"
.
equals
(
expected
.
getCommissionBizType
()))
{
//应收款类型 R=关联保单应收单 totalRevenueRatio取值paidRatio
vo
.
setTotalRevenueRatio
(
new
BigDecimal
(
"100.00"
));
}
else
{
vo
.
setTotalRevenueRatio
(
BigDecimal
.
ZERO
);
vo
.
setTotalRevenueRatio
(
BigDecimal
.
ZERO
);
}
}
}
// 待入账金额
// 待入账金额
// 待入账金额归零 = 已入账来佣比例(实佣率)>= 产品来佣率
// 待入账金额归零 = 已入账来佣比例(实佣率)>= 产品来佣率
if
(
commissionRatio
!=
null
&&
paidRatio
.
compareTo
(
commissionRatio
)
>=
0
)
{
if
(
commissionRatio
!=
null
&&
paidRatio
.
compareTo
(
commissionRatio
)
>=
0
)
{
vo
.
setPendingAmount
(
BigDecimal
.
ZERO
);
vo
.
setPendingAmount
(
BigDecimal
.
ZERO
);
// vo.setPendingRatio(BigDecimal.ZERO);
}
else
if
(
commissionRatio
!=
null
)
{
}
else
if
(
commissionRatio
!=
null
)
{
// vo.setPendingRatio(commissionRatio.subtract(paidRatio));
if
(
expected
.
getExpectedAmount
()
!=
null
)
{
if
(
expected
.
getExpectedAmount
()
!=
null
)
{
//待入账金额 = 预计来佣金额 - 已入账来佣金额
//待入账金额 = 预计来佣金额 - 已入账来佣金额
vo
.
setPendingAmount
(
expected
.
getExpectedAmount
().
subtract
(
paidAmount
));
vo
.
setPendingAmount
(
expected
.
getExpectedAmount
().
subtract
(
paidAmount
));
...
@@ -350,12 +364,17 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -350,12 +364,17 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
commission
.
getReconciliationYearMonth
().
replace
(
"-"
,
""
)
:
""
);
commission
.
getReconciliationYearMonth
().
replace
(
"-"
,
""
)
:
""
);
// vo.setRealCommissionDate(commission.getCommissionDate());
// vo.setRealCommissionDate(commission.getCommissionDate());
vo
.
setRealExchangeRate
(
commission
.
getExchangeRate
());
vo
.
setRealExchangeRate
(
commission
.
getExchangeRate
());
vo
.
setRealAmount
(
commission
.
getAmount
());
vo
.
setRealAmount
(
commission
.
get
Hkd
Amount
());
vo
.
setRealCurrentCommissionRatio
(
commission
.
getCurrentCommissionRatio
());
vo
.
setRealCurrentCommissionRatio
(
commission
.
getCurrentCommissionRatio
());
vo
.
setRealUpdateTime
(
commission
.
getUpdateTime
());
vo
.
setRealUpdateTime
(
commission
.
getUpdateTime
());
vo
.
setRealUpdaterName
(
commission
.
getUpdaterName
());
vo
.
setRealUpdaterName
(
commission
.
getUpdaterName
());
vo
.
setRealRemark
(
commission
.
getRemark
());
vo
.
setCommissionDate
(
commission
.
getCommissionDate
());
vo
.
setCommissionDate
(
commission
.
getCommissionDate
());
vo
.
setCommissionBizId
(
commission
.
getCommissionBizId
());
vo
.
setRemark
(
commission
.
getRemark
());
vo
.
setManualRemark
(
commission
.
getManualRemark
());
vo
.
setStatusDesc
(
commission
.
getStatusDesc
());
vo
.
setRealUpdateTime
(
commission
.
getUpdateTime
());
vo
.
setRealUpdaterName
(
commission
.
getUpdaterName
());
// 覆盖公共业务字段
// 覆盖公共业务字段
// vo.setAmount(commission.getAmount());
// vo.setAmount(commission.getAmount());
...
@@ -402,7 +421,11 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -402,7 +421,11 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
:
gap
.
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
:
gap
.
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
vo
.
setGapRate
(
gapRate
);
vo
.
setGapRate
(
gapRate
);
}
else
{
}
else
{
if
(
"U"
.
equals
(
commission
.
getCommissionBizType
()))
{
vo
.
setRevenueRatio
(
new
BigDecimal
(
"100.00"
));
}
else
{
vo
.
setRevenueRatio
(
BigDecimal
.
ZERO
);
vo
.
setRevenueRatio
(
BigDecimal
.
ZERO
);
}
vo
.
setGapRate
(
BigDecimal
.
ZERO
);
vo
.
setGapRate
(
BigDecimal
.
ZERO
);
}
}
...
@@ -629,7 +652,15 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -629,7 +652,15 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
queryWrapper
.
eq
(
ObjectUtils
.
isNotEmpty
(
productLaunchBizId
),
"product_launch_biz_id"
,
productLaunchBizId
);
queryWrapper
.
eq
(
ObjectUtils
.
isNotEmpty
(
productLaunchBizId
),
"product_launch_biz_id"
,
productLaunchBizId
);
queryWrapper
.
eq
(
ObjectUtils
.
isNotEmpty
(
commissionBizType
),
"commission_biz_type"
,
commissionBizType
);
queryWrapper
.
eq
(
ObjectUtils
.
isNotEmpty
(
commissionBizType
),
"commission_biz_type"
,
commissionBizType
);
queryWrapper
.
in
(
ObjectUtils
.
isNotEmpty
(
statusList
),
"status"
,
statusList
);
queryWrapper
.
in
(
ObjectUtils
.
isNotEmpty
(
statusList
),
"status"
,
statusList
);
if
(
CollectionUtils
.
isNotEmpty
(
commissionExpectedQueryRequest
.
getPolicyNoList
()))
{
queryWrapper
.
in
(
CollectionUtils
.
isNotEmpty
(
commissionExpectedQueryRequest
.
getPolicyNoList
()),
"policy_no"
,
commissionExpectedQueryRequest
.
getPolicyNoList
());
queryWrapper
.
in
(
CollectionUtils
.
isNotEmpty
(
commissionExpectedQueryRequest
.
getPolicyNoList
()),
"policy_no"
,
commissionExpectedQueryRequest
.
getPolicyNoList
());
}
else
{
if
(
commissionExpectedQueryRequest
.
getQueryFlag
()
!=
null
&&
commissionExpectedQueryRequest
.
getQueryFlag
())
{
//查询不到数据
queryWrapper
.
apply
(
"1=0"
);
}
}
// 范围查询
// 范围查询
queryWrapper
.
ge
(
ObjectUtils
.
isNotEmpty
(
commissionDateStart
),
"commission_date"
,
commissionDateStart
);
queryWrapper
.
ge
(
ObjectUtils
.
isNotEmpty
(
commissionDateStart
),
"commission_date"
,
commissionDateStart
);
queryWrapper
.
le
(
ObjectUtils
.
isNotEmpty
(
commissionDateEnd
),
"commission_date"
,
commissionDateEnd
);
queryWrapper
.
le
(
ObjectUtils
.
isNotEmpty
(
commissionDateEnd
),
"commission_date"
,
commissionDateEnd
);
...
@@ -638,6 +669,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -638,6 +669,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
queryWrapper
.
apply
(
"EXISTS (SELECT 1 FROM policy_broker pb WHERE pb.policy_no = commission_expected.policy_no AND pb.team_biz_id = {0})"
,
queryWrapper
.
apply
(
"EXISTS (SELECT 1 FROM policy_broker pb WHERE pb.policy_no = commission_expected.policy_no AND pb.team_biz_id = {0})"
,
teamBizId
);
teamBizId
);
}
}
// 默认排序规则
// 默认排序规则
queryWrapper
.
orderByDesc
(
"commission_date"
);
queryWrapper
.
orderByDesc
(
"commission_date"
);
// 排序字段
// 排序字段
...
@@ -707,6 +739,12 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -707,6 +739,12 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
// 预计总金额
// 预计总金额
if
(
"R"
.
equals
(
addDto
.
getCommissionBizType
()))
{
if
(
"R"
.
equals
(
addDto
.
getCommissionBizType
()))
{
//校验同一个保单且同一个期数且同一个项目的数据是否存在,如果存在不允许添加
CommissionExpected
expected
=
commissionExpectedService
.
queryOne
(
addDto
.
getPolicyNo
(),
addDto
.
getCommissionPeriod
(),
addDto
.
getCommissionType
());
if
(
expected
!=
null
)
{
throw
new
BusinessException
(
"同一个保单且同一个期数且同一个项目的预计来佣数据已存在,不能重复新增"
);
}
Policy
policy
=
policyMap
.
get
(
addDto
.
getPolicyNo
());
Policy
policy
=
policyMap
.
get
(
addDto
.
getPolicyNo
());
if
(
ObjectUtils
.
isEmpty
(
policy
))
{
if
(
ObjectUtils
.
isEmpty
(
policy
))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"保单号为"
+
addDto
.
getPolicyNo
()
+
"的保单不存在"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"保单号为"
+
addDto
.
getPolicyNo
()
+
"的保单不存在"
);
...
@@ -730,9 +768,9 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -730,9 +768,9 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
commissionExpected
.
setProductLaunchBizId
(
policy
.
getProductLaunchBizId
());
commissionExpected
.
setProductLaunchBizId
(
policy
.
getProductLaunchBizId
());
commissionExpected
.
setPremium
(
policy
.
getPaymentPremium
());
commissionExpected
.
setPremium
(
policy
.
getPaymentPremium
());
}
else
{
}
else
{
BigDecimal
expectedAmount
=
addDto
.
getAmount
()
//
BigDecimal expectedAmount = addDto.getAmount()
.
multiply
(
addDto
.
getExchangeRate
());
//
.multiply(addDto.getExchangeRate());
commissionExpected
.
setExpectedAmount
(
expectedAmount
);
commissionExpected
.
setExpectedAmount
(
addDto
.
getAmount
()
);
}
}
if
(
StringUtils
.
isBlank
(
addDto
.
getCommissionExpectedBizId
()))
{
if
(
StringUtils
.
isBlank
(
addDto
.
getCommissionExpectedBizId
()))
{
...
@@ -782,9 +820,9 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -782,9 +820,9 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
if
(
StringUtils
.
isBlank
(
request
.
getCurrency
()))
{
if
(
StringUtils
.
isBlank
(
request
.
getCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账币种不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账币种不能为空"
);
}
}
if
(
request
.
getExchangeRate
()
==
null
)
{
//
if (request.getExchangeRate() == null) {
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"结算汇率不能为空"
);
//
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "结算汇率不能为空");
}
//
}
if
(
"R"
.
equals
(
request
.
getCommissionBizType
()))
{
if
(
"R"
.
equals
(
request
.
getCommissionBizType
()))
{
if
(
request
.
getCommissionRatio
()
==
null
)
{
if
(
request
.
getCommissionRatio
()
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"关联保单应收单,佣金比例不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"关联保单应收单,佣金比例不能为空"
);
...
@@ -839,6 +877,18 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -839,6 +877,18 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
.
divide
(
BigDecimal
.
valueOf
(
100
),
4
,
RoundingMode
.
HALF_UP
)
.
divide
(
BigDecimal
.
valueOf
(
100
),
4
,
RoundingMode
.
HALF_UP
)
);
);
commissionExpected
.
setPremium
(
policy
.
getPaymentPremium
());
commissionExpected
.
setPremium
(
policy
.
getPaymentPremium
());
//已入账比例
BigDecimal
paidRatio
=
ObjectUtils
.
defaultIfNull
(
commissionExpected
.
getPaidRatio
(),
BigDecimal
.
ZERO
);
//预计入账比例(保单产品来佣金率)
BigDecimal
commissionRatio
=
ObjectUtils
.
defaultIfNull
(
commissionExpected
.
getCommissionRatio
(),
BigDecimal
.
ZERO
);
//已入账比例 >= 预计入账比例 -> 入账状态置为完成入账。否则部分入账
if
(
paidRatio
.
compareTo
(
commissionRatio
)
>=
0
)
{
//完成入账
commissionExpected
.
setStatus
(
"1"
);
}
else
{
//部分入账
commissionExpected
.
setStatus
(
"2"
);
}
}
else
{
}
else
{
commissionExpected
.
setExpectedAmount
(
commissionExpected
.
setExpectedAmount
(
commissionExpectedUpdateRequest
.
getAmount
()
commissionExpectedUpdateRequest
.
getAmount
()
...
@@ -1495,6 +1545,19 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
...
@@ -1495,6 +1545,19 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
);
);
}
}
@Override
public
CommissionExpected
queryOne
(
String
policyNo
,
Integer
commissionPeriod
,
String
commissionType
)
{
return
this
.
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CommissionExpected
>()
.
eq
(
CommissionExpected:
:
getPolicyNo
,
policyNo
)
.
eq
(
CommissionExpected:
:
getCommissionPeriod
,
commissionPeriod
)
.
eq
(
CommissionExpected:
:
getCommissionType
,
commissionType
)
.
last
(
" limit 1 "
)
);
}
private
Policy
convertPolicy
(
PolicyFollow
policyFollow
,
String
effectiveDate
,
String
coolingOffEndDate
)
{
private
Policy
convertPolicy
(
PolicyFollow
policyFollow
,
String
effectiveDate
,
String
coolingOffEndDate
)
{
Policy
policy
=
new
Policy
();
Policy
policy
=
new
Policy
();
BeanUtil
.
copyProperties
(
policyFollow
,
policy
);
BeanUtil
.
copyProperties
(
policyFollow
,
policy
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CommissionServiceImpl.java
View file @
bdfc676e
...
@@ -31,7 +31,6 @@ import com.yd.insurance.base.feign.client.insurancereconciliationcompany.ApiInsu
...
@@ -31,7 +31,6 @@ import com.yd.insurance.base.feign.client.insurancereconciliationcompany.ApiInsu
import
com.yd.insurance.base.feign.request.insurancereconciliationcompany.ApiInsuranceReconciliationCompanyPageRequest
;
import
com.yd.insurance.base.feign.request.insurancereconciliationcompany.ApiInsuranceReconciliationCompanyPageRequest
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -84,6 +83,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -84,6 +83,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
private
ApiExchangeRateFeignClient
apiExchangeRateFeignClient
;
private
ApiExchangeRateFeignClient
apiExchangeRateFeignClient
;
@Resource
@Resource
private
ApiInsuranceReconciliationCompanyFeignClient
apiInsuranceReconciliationCompanyFeignClient
;
private
ApiInsuranceReconciliationCompanyFeignClient
apiInsuranceReconciliationCompanyFeignClient
;
@Resource
private
PolicyPolicyholderService
policyPolicyholderService
;
@Override
@Override
...
@@ -155,6 +156,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -155,6 +156,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
.
list
();
.
list
();
Map
<
String
,
CommissionExpected
>
commissionExpectedMap
=
commissionExpectedList
.
stream
().
collect
(
Collectors
.
toMap
(
CommissionExpected:
:
getCommissionExpectedBizId
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
Map
<
String
,
CommissionExpected
>
commissionExpectedMap
=
commissionExpectedList
.
stream
().
collect
(
Collectors
.
toMap
(
CommissionExpected:
:
getCommissionExpectedBizId
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
// 3.关联查询投保人名称
Map
<
String
,
PolicyFollow
>
policyFollowMap
=
policyFollowService
.
queryPolicyFollowMap
(
policyNoSet
);
// 4.关联查询转介人
Map
<
String
,
PolicyBroker
>
policyBrokerMap
=
policyBrokerService
.
queryPolicyBrokerMap
(
policyNoSet
);
// 填充信息
// 填充信息
List
<
CommissionVO
>
commissionVOList
=
commissionList
.
stream
().
map
(
commission
->
{
List
<
CommissionVO
>
commissionVOList
=
commissionList
.
stream
().
map
(
commission
->
{
CommissionVO
commissionVO
=
CommissionVO
.
objToVo
(
commission
);
CommissionVO
commissionVO
=
CommissionVO
.
objToVo
(
commission
);
...
@@ -168,12 +175,24 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -168,12 +175,24 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
}
}
CommissionExpected
commissionExpected
=
commissionExpectedMap
.
get
(
commission
.
getCommissionExpectedBizId
());
CommissionExpected
commissionExpected
=
commissionExpectedMap
.
get
(
commission
.
getCommissionExpectedBizId
());
if
(
commissionExpected
!=
null
)
{
if
(
commissionExpected
!=
null
)
{
// 填充应收账款编号、预计入账状态
// 填充应收账款编号、预计入账状态
、保单本期来佣率
commissionVO
.
setReceivableNo
(
commissionExpected
.
getReceivableNo
());
commissionVO
.
setReceivableNo
(
commissionExpected
.
getReceivableNo
());
commissionVO
.
setPaidRatio
(
commissionExpected
.
getPaidRatio
());
commissionVO
.
setPaidRatio
(
commissionExpected
.
getPaidRatio
());
commissionVO
.
setPendingRatio
(
commissionExpected
.
getPendingRatio
());
commissionVO
.
setPendingRatio
(
commissionExpected
.
getPendingRatio
());
commissionVO
.
setStatusDesc
(
commissionExpected
.
getStatusDesc
());
commissionVO
.
setStatusDesc
(
commissionExpected
.
getStatusDesc
());
commissionVO
.
setCommissionExpectedStatus
(
commissionExpected
.
getStatus
());
commissionVO
.
setCommissionExpectedStatus
(
commissionExpected
.
getStatus
());
commissionVO
.
setCommissionRatio
(
commissionExpected
.
getCommissionRatio
());
}
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
commission
.
getPolicyNo
());
if
(
policyFollow
!=
null
)
{
// 填充投保人名称
commissionVO
.
setPolicyHolder
(
policyFollow
.
getPolicyHolder
());
commissionVO
.
setPolicyHolderEn
(
policyFollow
.
getPolicyHolderEn
());
}
PolicyBroker
policyBroker
=
policyBrokerMap
.
get
(
commission
.
getPolicyNo
());
if
(
policyBroker
!=
null
)
{
// 填充转介人名称
commissionVO
.
setBroker
(
policyBroker
.
getBrokerName
());
}
}
return
commissionVO
;
return
commissionVO
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -386,6 +405,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -386,6 +405,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
if
(!
Objects
.
equals
(
commission
.
getPolicyNo
(),
commissionUpdateRequest
.
getPolicyNo
()))
{
if
(!
Objects
.
equals
(
commission
.
getPolicyNo
(),
commissionUpdateRequest
.
getPolicyNo
()))
{
throw
new
BusinessException
(
"当前保单号不匹配"
);
throw
new
BusinessException
(
"当前保单号不匹配"
);
}
}
String
remark
=
commission
.
getRemark
();
Policy
policy
=
null
;
Policy
policy
=
null
;
if
(
StringUtils
.
isNotBlank
(
commissionUpdateRequest
.
getPolicyNo
()))
{
if
(
StringUtils
.
isNotBlank
(
commissionUpdateRequest
.
getPolicyNo
()))
{
policy
=
policyService
.
lambdaQuery
().
eq
(
Policy:
:
getPolicyNo
,
commission
.
getPolicyNo
()).
one
();
policy
=
policyService
.
lambdaQuery
().
eq
(
Policy:
:
getPolicyNo
,
commission
.
getPolicyNo
()).
one
();
...
@@ -413,6 +433,9 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -413,6 +433,9 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
// 计算来佣金额(港币)
// 计算来佣金额(港币)
commission
.
setHkdAmount
(
calculateHKDAmount
(
requestAmount
,
commissionUpdateRequest
.
getCurrency
()));
commission
.
setHkdAmount
(
calculateHKDAmount
(
requestAmount
,
commissionUpdateRequest
.
getCurrency
()));
commission
.
setManualRemark
(
commissionUpdateRequest
.
getManualRemark
());
commission
.
setRemark
(
remark
);
// 获取当前登录用户
// 获取当前登录用户
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
...
@@ -422,6 +445,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -422,6 +445,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
// 更新属性
// 更新属性
BeanUtils
.
copyProperties
(
commissionUpdateRequest
,
commission
,
"commissionBizId"
);
BeanUtils
.
copyProperties
(
commissionUpdateRequest
,
commission
,
"commissionBizId"
);
// 入账年月
commission
.
setCommissionDate
(
DateUtil
.
parse
(
commissionUpdateRequest
.
getCommissionDate
()
+
"-01"
));
if
(
"U"
.
equals
(
commissionUpdateRequest
.
getCommissionBizType
()))
{
if
(
"U"
.
equals
(
commissionUpdateRequest
.
getCommissionBizType
()))
{
commission
.
setPolicyNo
(
null
);
commission
.
setPolicyNo
(
null
);
}
}
...
@@ -505,9 +530,9 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -505,9 +530,9 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
if
(
ObjectUtils
.
isEmpty
(
commissionUpdateRequest
.
getCurrency
()))
{
if
(
ObjectUtils
.
isEmpty
(
commissionUpdateRequest
.
getCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"入账币种不能为空"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"入账币种不能为空"
);
}
}
if
(
ObjectUtils
.
isEmpty
(
commissionUpdateRequest
.
getExchangeRate
()))
{
//
if (ObjectUtils.isEmpty(commissionUpdateRequest.getExchangeRate())) {
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"结算汇率不能为空"
);
//
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "结算汇率不能为空");
}
//
}
}
}
...
@@ -548,10 +573,10 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -548,10 +573,10 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
CommissionEditRecord
commissionRecord
=
getCommissionEditRecord
(
"结算汇率"
,
commission
.
getExchangeRate
(),
commissionUpdateRequest
.
getExchangeRate
(),
commission
.
getCommissionBizId
(),
currentLoginUser
);
CommissionEditRecord
commissionRecord
=
getCommissionEditRecord
(
"结算汇率"
,
commission
.
getExchangeRate
(),
commissionUpdateRequest
.
getExchangeRate
(),
commission
.
getCommissionBizId
(),
currentLoginUser
);
commissionEditRecords
.
add
(
commissionRecord
);
commissionEditRecords
.
add
(
commissionRecord
);
}
}
String
commissionDate
=
DateUtil
.
format
Date
(
commission
.
getCommissionDate
()
);
String
commissionDate
=
DateUtil
.
format
(
commission
.
getCommissionDate
(),
"yyyy-MM"
);
String
requestCommissionDate
=
DateUtil
.
formatDate
(
commissionUpdateRequest
.
getCommissionDate
()
);
String
requestCommissionDate
=
commissionUpdateRequest
.
getCommissionDate
(
);
if
(!
Objects
.
equals
(
commissionDate
,
requestCommissionDate
))
{
if
(!
Objects
.
equals
(
commissionDate
,
requestCommissionDate
))
{
CommissionEditRecord
commissionRecord
=
getCommissionEditRecord
(
"来佣
日期
"
,
commissionDate
,
requestCommissionDate
,
commission
.
getCommissionBizId
(),
currentLoginUser
);
CommissionEditRecord
commissionRecord
=
getCommissionEditRecord
(
"来佣
年月
"
,
commissionDate
,
requestCommissionDate
,
commission
.
getCommissionBizId
(),
currentLoginUser
);
commissionEditRecords
.
add
(
commissionRecord
);
commissionEditRecords
.
add
(
commissionRecord
);
}
}
if
(!
Objects
.
equals
(
commission
.
getRemark
(),
commissionUpdateRequest
.
getRemark
()))
{
if
(!
Objects
.
equals
(
commission
.
getRemark
(),
commissionUpdateRequest
.
getRemark
()))
{
...
@@ -647,8 +672,11 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -647,8 +672,11 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
}
}
}
}
// 3. 构建实际的初始发佣记录
// 2.4 根据保单号、期数查询入账检核汇率
List
<
Fortune
>
newFortuneList
=
buildNewFortunes
(
filteredExpectedFortuneList2
,
commissions
);
Map
<
String
,
BigDecimal
>
exchangeRateMap
=
this
.
queryCommissionExchangeRateMap
(
policyNoSet
,
commissionPeriodSet
);
// 3. 构建实际的初始发佣记录(使用入账检核汇率)
List
<
Fortune
>
newFortuneList
=
buildNewFortunes
(
filteredExpectedFortuneList2
,
commissions
,
exchangeRateMap
);
// 4. 保存发佣记录
// 4. 保存发佣记录
saveNewFortunes
(
newFortuneList
);
saveNewFortunes
(
newFortuneList
);
...
@@ -656,6 +684,42 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -656,6 +684,42 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
return
true
;
return
true
;
}
}
private
Map
<
String
,
BigDecimal
>
queryCommissionExchangeRateMap
(
Set
<
String
>
policyNoSet
,
Set
<
Integer
>
commissionPeriodSet
)
{
if
(
CollectionUtils
.
isEmpty
(
policyNoSet
)
||
CollectionUtils
.
isEmpty
(
commissionPeriodSet
))
{
return
new
HashMap
<>();
}
// 1. 查询所有符合条件的记录,按入账日期降序排序
List
<
Commission
>
commissionExchangeRateList
=
this
.
lambdaQuery
()
.
in
(
Commission:
:
getPolicyNo
,
policyNoSet
)
.
in
(
Commission:
:
getCommissionPeriod
,
commissionPeriodSet
)
.
select
(
Commission:
:
getPolicyNo
,
Commission:
:
getCommissionPeriod
,
Commission:
:
getExchangeRate
,
Commission:
:
getCommissionDate
)
.
orderByDesc
(
Commission:
:
getCommissionDate
)
.
list
();
// 2. 按 policyNo + commissionPeriod 分组,取每组的第一条(最新的)
Map
<
String
,
BigDecimal
>
exchangeRateMap
=
commissionExchangeRateList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
commission
->
buildPolicyPeriodKey
(
commission
.
getPolicyNo
(),
commission
.
getCommissionPeriod
())
))
.
entrySet
().
stream
()
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
entry
->
entry
.
getValue
().
get
(
0
).
getExchangeRate
()
));
// 3. 确保所有 policyNo + commissionPeriod 组合都在 Map 中,没有记录的设为 null
Map
<
String
,
BigDecimal
>
result
=
new
HashMap
<>();
for
(
String
policyNo
:
policyNoSet
)
{
for
(
Integer
commissionPeriod
:
commissionPeriodSet
)
{
String
key
=
buildPolicyPeriodKey
(
policyNo
,
commissionPeriod
);
result
.
put
(
key
,
exchangeRateMap
.
getOrDefault
(
key
,
null
));
}
}
return
result
;
}
/**
/**
* 保存新的发佣记录
* 保存新的发佣记录
*/
*/
...
@@ -674,7 +738,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -674,7 +738,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
* 构建新的发佣记录
* 构建新的发佣记录
*/
*/
private
List
<
Fortune
>
buildNewFortunes
(
List
<
ExpectedFortune
>
expectedFortuneList
,
private
List
<
Fortune
>
buildNewFortunes
(
List
<
ExpectedFortune
>
expectedFortuneList
,
List
<
Commission
>
commissionList
)
{
List
<
Commission
>
commissionList
,
Map
<
String
,
BigDecimal
>
exchangeRateMap
)
{
if
(
CollectionUtils
.
isEmpty
(
expectedFortuneList
))
{
if
(
CollectionUtils
.
isEmpty
(
expectedFortuneList
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
...
@@ -686,25 +751,63 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -686,25 +751,63 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
(
oldValue
,
newValue
)
->
newValue
// 遇到重复时使用新值
(
oldValue
,
newValue
)
->
newValue
// 遇到重复时使用新值
));
));
// 当前登录用户
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
Date
now
=
new
Date
();
Date
now
=
new
Date
();
return
expectedFortuneList
.
stream
()
.
map
(
expectedFortune
->
{
// 创建新的发佣记录
List
<
Fortune
>
newFortuneList
=
new
ArrayList
<>();
// 更新预计发佣记录的港币金额
List
<
ExpectedFortune
>
updatedExpectedFortuneList
=
new
ArrayList
<>();
for
(
ExpectedFortune
expectedFortune
:
expectedFortuneList
)
{
Fortune
fortune
=
new
Fortune
();
Fortune
fortune
=
new
Fortune
();
BeanUtils
.
copyProperties
(
expectedFortune
,
fortune
);
BeanUtils
.
copyProperties
(
expectedFortune
,
fortune
);
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setId
(
null
);
fortune
.
setId
(
null
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setFortuneBizType
(
"R"
);
fortune
.
setExchangeRate
(
expectedFortune
.
getDefaultExchangeRate
());
// 优先使用入账检核汇率,如果没有则使用默认汇率
String
key
=
buildPolicyPeriodKey
(
expectedFortune
.
getPolicyNo
(),
expectedFortune
.
getFortunePeriod
());
BigDecimal
exchangeRate
=
exchangeRateMap
.
get
(
key
);
if
(
exchangeRate
!=
null
)
{
fortune
.
setExchangeRate
(
exchangeRate
);
fortune
.
setOriginalToHkdRate
(
exchangeRate
);
// 重新计算港币金额
BigDecimal
hkdAmount
=
fortune
.
getRuleAmount
().
multiply
(
exchangeRate
);
fortune
.
setHkdAmount
(
hkdAmount
);
fortune
.
setCurrentPaymentAmount
(
hkdAmount
);
fortune
.
setCurrentPaymentHkdAmount
(
hkdAmount
);
// 默认发放币种、汇率、发放币种金额
fortune
.
setPayoutCurrency
(
"HKD"
);
fortune
.
setHkdToPayoutRate
(
BigDecimal
.
ONE
);
fortune
.
setPayoutAmount
(
hkdAmount
);
// 更新预计发佣记录的港币金额
ExpectedFortune
update
=
new
ExpectedFortune
();
update
.
setId
(
expectedFortune
.
getId
());
update
.
setDefaultExchangeRate
(
exchangeRate
);
update
.
setOriginalToHkdRate
(
exchangeRate
);
update
.
setHkdAmount
(
hkdAmount
);
update
.
setUnpaidAmount
(
hkdAmount
);
update
.
setPayoutCurrency
(
"HKD"
);
update
.
setHkdToPayoutRate
(
BigDecimal
.
ONE
);
update
.
setPayoutAmount
(
hkdAmount
);
updatedExpectedFortuneList
.
add
(
update
);
}
else
{
fortune
.
setExchangeRate
(
expectedFortune
.
getDefaultExchangeRate
());
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getOriginalAmount
());
fortune
.
setCurrentPaymentAmount
(
expectedFortune
.
getOriginalAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
expectedFortune
.
getHkdAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
expectedFortune
.
getHkdAmount
());
}
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
fortune
.
setIsPart
(
0
);
fortune
.
setIsPart
(
0
);
// 关联来佣业务ID
// 关联来佣业务ID
String
key
=
buildPolicyPeriodKey
(
expectedFortune
.
getPolicyNo
(),
expectedFortune
.
getFortunePeriod
());
Commission
matchedCommission
=
commissionByPolicyPeriod
.
get
(
key
);
Commission
matchedCommission
=
commissionByPolicyPeriod
.
get
(
key
);
if
(
matchedCommission
!=
null
)
{
if
(
matchedCommission
!=
null
)
{
fortune
.
setCommissionBizId
(
matchedCommission
.
getCommissionBizId
());
fortune
.
setCommissionBizId
(
matchedCommission
.
getCommissionBizId
());
...
@@ -716,10 +819,22 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -716,10 +819,22 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
fortune
.
setCreateTime
(
now
);
fortune
.
setCreateTime
(
now
);
fortune
.
setUpdateTime
(
now
);
fortune
.
setUpdateTime
(
now
);
fortune
.
setReconciliationOperator
(
"系统生成"
);
fortune
.
setCreatorId
(
loginUserId
);
fortune
.
setUpdaterId
(
loginUserId
);
newFortuneList
.
add
(
fortune
);
}
// 更新预计发佣记录
if
(
CollectionUtils
.
isNotEmpty
(
updatedExpectedFortuneList
))
{
boolean
updateSuccess
=
iExpectedFortuneService
.
updateBatchById
(
updatedExpectedFortuneList
);
if
(!
updateSuccess
)
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
"更新预计发佣记录港币金额失败"
);
}
}
return
fortune
;
return
newFortuneList
;
})
.
collect
(
Collectors
.
toList
());
}
}
/**
/**
...
@@ -742,7 +857,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -742,7 +857,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
}
}
/**
/**
* 构建保单号+期
次
的唯一键
* 构建保单号+期
数
的唯一键
*/
*/
@Override
@Override
public
String
buildPolicyPeriodKey
(
String
policyNo
,
Object
period
)
{
public
String
buildPolicyPeriodKey
(
String
policyNo
,
Object
period
)
{
...
@@ -839,7 +954,10 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -839,7 +954,10 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
for
(
CommissionAddRequest
request
:
customerAddRequestList
)
{
for
(
CommissionAddRequest
request
:
customerAddRequestList
)
{
Commission
commission
=
new
Commission
();
Commission
commission
=
new
Commission
();
BeanUtils
.
copyProperties
(
request
,
commission
);
BeanUtils
.
copyProperties
(
request
,
commission
);
commission
.
setManualRemark
(
request
.
getManualRemark
());
// 入账年月
commission
.
setCommissionDate
(
DateUtil
.
parse
(
request
.
getCommissionDate
()
+
"-01"
));
// 计算来佣金额(港币)
// 计算来佣金额(港币)
commission
.
setHkdAmount
(
calculateHKDAmount
(
request
.
getAmount
(),
request
.
getCurrency
()));
commission
.
setHkdAmount
(
calculateHKDAmount
(
request
.
getAmount
(),
request
.
getCurrency
()));
// 入账业务id
// 入账业务id
...
@@ -964,9 +1082,9 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -964,9 +1082,9 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
if
(
ObjectUtils
.
isEmpty
(
request
.
getAmount
()))
{
if
(
ObjectUtils
.
isEmpty
(
request
.
getAmount
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账金额不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"入账金额不能为空"
);
}
}
if
(
ObjectUtils
.
isEmpty
(
request
.
getExchangeRate
()))
{
//
if (ObjectUtils.isEmpty(request.getExchangeRate())) {
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
"结算汇率不能为空"
);
//
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "结算汇率不能为空");
}
//
}
if
(
"R"
.
equals
(
request
.
getCommissionBizType
()))
{
if
(
"R"
.
equals
(
request
.
getCommissionBizType
()))
{
// 校验保单号是否存在
// 校验保单号是否存在
if
(
ObjectUtils
.
isEmpty
(
request
.
getExchangeRate
()))
{
if
(
ObjectUtils
.
isEmpty
(
request
.
getExchangeRate
()))
{
...
@@ -986,7 +1104,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -986,7 +1104,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
if
(
commission
==
null
)
{
if
(
commission
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"来佣记录不存在"
);
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
"来佣记录不存在"
);
}
}
if
(
StringUtils
.
isNotBlank
(
commission
.
getCommissionExpectedBizId
()))
{
CommissionExpected
commissionExpected
=
commissionExpectedService
.
queryOne
(
commission
.
getCommissionExpectedBizId
());
if
(
commissionExpected
!=
null
)
{
throw
new
BusinessException
(
"已经同步过了,无需再次同步"
);
}
}
// 获取当前登录用户
// 获取当前登录用户
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
...
@@ -994,7 +1117,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -994,7 +1117,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
CommissionExpected
expected
=
new
CommissionExpected
();
CommissionExpected
expected
=
new
CommissionExpected
();
BeanUtils
.
copyProperties
(
commission
,
expected
,
"id"
,
"remark"
);
BeanUtils
.
copyProperties
(
commission
,
expected
,
"id"
,
"remark"
);
expected
.
setCommissionExpectedBizId
(
RandomStringGenerator
.
generateBizId16
(
"commission_expected"
));
expected
.
setCommissionExpectedBizId
(
RandomStringGenerator
.
generateBizId16
(
"commission_expected"
));
expected
.
setPremium
(
new
BigDecimal
(
commission
.
getPremium
())
);
expected
.
setPremium
(
commission
.
getPremium
()
!=
null
?
new
BigDecimal
(
commission
.
getPremium
())
:
BigDecimal
.
ZERO
);
// 生成应收单编号
// 生成应收单编号
expected
.
setReceivableNo
(
receivableService
.
generateReceivableNo
(
expected
.
setReceivableNo
(
receivableService
.
generateReceivableNo
(
...
@@ -1010,7 +1133,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -1010,7 +1133,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
expected
.
setCommissionDate
(
commission
.
getCommissionDate
());
expected
.
setCommissionDate
(
commission
.
getCommissionDate
());
expected
.
setStatus
(
CommissionExpectedStatusEnum
.
COMPARED
.
getItemValue
());
expected
.
setStatus
(
CommissionExpectedStatusEnum
.
COMPARED
.
getItemValue
());
expected
.
setStatusDesc
(
"比对成功,通过手动同步预计来佣"
);
// 设置状态描述为比对成功
expected
.
setStatusDesc
(
"比对成功,通过手动同步预计来佣"
);
// 设置状态描述为比对成功
expected
.
setRemark
(
null
);
expected
.
setRemark
(
expected
.
getStatusDesc
()
);
expected
.
setCreatorId
(
loginUserId
);
expected
.
setCreatorId
(
loginUserId
);
expected
.
setCreateTime
(
new
Date
());
expected
.
setCreateTime
(
new
Date
());
...
@@ -1124,6 +1247,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
...
@@ -1124,6 +1247,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
return
commissionRecord
.
getExchangeRate
();
return
commissionRecord
.
getExchangeRate
();
}
}
/**
/**
* 查询列表
* 查询列表
*
*
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CustomerServiceImpl.java
View file @
bdfc676e
...
@@ -74,7 +74,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
...
@@ -74,7 +74,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
// 中文转简体
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
name
);
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
name
);
// 英文转小写
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
name
);
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
name
);
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
nameSc
),
"name_sc"
,
nameSc
)
queryWrapper
.
like
(
StringUtils
.
isNotBlank
(
nameSc
),
"name_sc"
,
nameSc
)
.
or
().
like
(
StringUtils
.
isNotBlank
(
nameEnLc
),
"name_en_lc"
,
nameEnLc
);
.
or
().
like
(
StringUtils
.
isNotBlank
(
nameEnLc
),
"name_en_lc"
,
nameEnLc
);
...
@@ -150,7 +150,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
...
@@ -150,7 +150,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
// 中文转简体
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
customerAddRequest
.
getNameCn
());
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
customerAddRequest
.
getNameCn
());
// 英文转小写
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
customerAddRequest
.
getNamePyEn
());
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
customerAddRequest
.
getNamePyEn
());
customer
.
setNameSc
(
nameSc
);
customer
.
setNameSc
(
nameSc
);
customer
.
setNameEnLc
(
nameEnLc
);
customer
.
setNameEnLc
(
nameEnLc
);
...
@@ -263,7 +263,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
...
@@ -263,7 +263,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
// 中文转简体
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
customerUpdateRequest
.
getNameCn
());
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
customerUpdateRequest
.
getNameCn
());
// 英文转小写
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
customerUpdateRequest
.
getNamePyEn
());
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
customerUpdateRequest
.
getNamePyEn
());
oldCustomer
.
setNameSc
(
nameSc
);
oldCustomer
.
setNameSc
(
nameSc
);
oldCustomer
.
setNameEnLc
(
nameEnLc
);
oldCustomer
.
setNameEnLc
(
nameEnLc
);
boolean
result
=
customerService
.
updateById
(
oldCustomer
);
boolean
result
=
customerService
.
updateById
(
oldCustomer
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
View file @
bdfc676e
...
@@ -9,6 +9,7 @@ import com.yd.csf.feign.request.expectedfortune.ApiExpectedFortunePageRequest;
...
@@ -9,6 +9,7 @@ import com.yd.csf.feign.request.expectedfortune.ApiExpectedFortunePageRequest;
import
com.yd.csf.feign.response.expectedfortune.ApiExpectedFortunePageResponse
;
import
com.yd.csf.feign.response.expectedfortune.ApiExpectedFortunePageResponse
;
import
com.yd.csf.service.dto.UserGradeDto
;
import
com.yd.csf.service.dto.UserGradeDto
;
import
com.yd.csf.service.enums.CurrencyEnum
;
import
com.yd.csf.service.enums.CurrencyEnum
;
import
com.yd.csf.service.enums.FortuneTypeEnum
;
import
com.yd.csf.service.model.ExpectedFortune
;
import
com.yd.csf.service.model.ExpectedFortune
;
import
com.yd.csf.service.dao.ExpectedFortuneMapper
;
import
com.yd.csf.service.dao.ExpectedFortuneMapper
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.model.Policy
;
...
@@ -17,6 +18,7 @@ import com.yd.csf.service.service.*;
...
@@ -17,6 +18,7 @@ import com.yd.csf.service.service.*;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yd.csf.service.vo.ExpectedFortuneStatisticsVO
;
import
com.yd.csf.service.vo.ExpectedFortuneStatisticsVO
;
import
com.yd.csf.service.vo.PayableReportVO
;
import
com.yd.csf.service.vo.PayableReportVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -36,6 +38,7 @@ import java.util.stream.Collectors;
...
@@ -36,6 +38,7 @@ import java.util.stream.Collectors;
* @since 2025-11-17
* @since 2025-11-17
*/
*/
@Service
@Service
@Slf4j
public
class
ExpectedFortuneServiceImpl
extends
ServiceImpl
<
ExpectedFortuneMapper
,
ExpectedFortune
>
implements
IExpectedFortuneService
{
public
class
ExpectedFortuneServiceImpl
extends
ServiceImpl
<
ExpectedFortuneMapper
,
ExpectedFortune
>
implements
IExpectedFortuneService
{
@Resource
@Resource
...
@@ -90,38 +93,105 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
...
@@ -90,38 +93,105 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
return
expectedFortuneVOPage
;
return
expectedFortuneVOPage
;
}
}
// 调整数据顺序、格式
processData
(
expectedFortuneList
);
// 1. 转介人职级信息
// 1. 转介人职级信息
List
<
String
>
brokerBizIds
=
expectedFortuneList
.
stream
().
map
(
ApiExpectedFortunePageResponse:
:
getBrokerBizId
).
collect
(
Collectors
.
toList
());
List
<
String
>
brokerBizIds
=
expectedFortuneList
.
stream
().
map
(
ApiExpectedFortunePageResponse:
:
getBrokerBizId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
UserGradeDto
>
userGradeMap
=
iAgentAccumulatedFycService
.
queryUserGradeMap
(
brokerBizIds
);
Map
<
String
,
UserGradeDto
>
userGradeMap
=
iAgentAccumulatedFycService
.
queryUserGradeMap
(
brokerBizIds
);
// 2. 关联查询保单信息
// 2. 关联查询新单跟进信息
Set
<
String
>
policyNoList
=
expectedFortuneList
.
stream
().
map
(
ApiExpectedFortunePageResponse:
:
getPolicyNo
).
collect
(
Collectors
.
toSet
());
Map
<
String
,
PolicyFollow
>
policyFollowMap
=
policyFollowService
.
queryPolicyFollowMap
(
policyNoList
);
for
(
ApiExpectedFortunePageResponse
vo
:
expectedFortuneList
)
{
for
(
ApiExpectedFortunePageResponse
vo
:
expectedFortuneList
)
{
// 出账币种名称
vo
.
setCurrencyName
(
"港币"
);
vo
.
setCurrencyName
(
"港币"
);
// String ratio = finalBrokerRatioMap.get(ef.getBrokerBizId());
// vo.setCommissionRatio(ratio);
// Policy policy = policyMap.get(vo.getPolicyNo());
// PolicyFollow follow = policyFollowMap.get(vo.getPolicyNo());
UserGradeDto
userGradeDto
=
userGradeMap
.
get
(
vo
.
getBrokerBizId
());
UserGradeDto
userGradeDto
=
userGradeMap
.
get
(
vo
.
getBrokerBizId
());
if
(
userGradeDto
!=
null
)
{
if
(
userGradeDto
!=
null
)
{
vo
.
setBrokerGradeName
(
userGradeDto
.
getGradeName
());
vo
.
setBrokerGradeName
(
userGradeDto
.
getGradeName
());
}
}
// if (policy != null) {
// vo.setInsuranceCompany(policy.getInsuranceCompany());
PolicyFollow
policyFollow
=
policyFollowMap
.
get
(
vo
.
getPolicyNo
());
// }
if
(
policyFollow
!=
null
)
{
// if (follow != null) {
vo
.
setInsuranceCompany
(
policyFollow
.
getInsuranceCompany
());
// vo.setProductName(follow.getProductName());
vo
.
setProductName
(
policyFollow
.
getProductName
());
// vo.setProductLaunchBizId(follow.getProductLaunchBizId());
}
// }
}
}
// expectedFortuneVOPage.setRecords(vo
List);
expectedFortuneVOPage
.
setRecords
(
expectedFortune
List
);
return
expectedFortuneVOPage
;
return
expectedFortuneVOPage
;
}
}
/**
* 调整数据顺序 预计在前,实际在后,按预计发佣月排序
*
* @param expectedFortuneList 预计发佣列表
*/
private
void
processData
(
List
<
ApiExpectedFortunePageResponse
>
expectedFortuneList
)
{
if
(
CollUtil
.
isEmpty
(
expectedFortuneList
))
{
return
;
}
log
.
info
(
"顺序调整前: {}"
,
expectedFortuneList
.
size
());
// 1. 分组
Map
<
Integer
,
List
<
ApiExpectedFortunePageResponse
>>
groupMap
=
expectedFortuneList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ApiExpectedFortunePageResponse:
:
getType
));
// 2. 获取预计发佣(type=1)和实际发佣(type=2)列表
List
<
ApiExpectedFortunePageResponse
>
expectedList
=
groupMap
.
getOrDefault
(
1
,
new
ArrayList
<>());
List
<
ApiExpectedFortunePageResponse
>
actualList
=
groupMap
.
getOrDefault
(
2
,
new
ArrayList
<>());
// 3. 将 actualList 转换为 Map
Map
<
String
,
List
<
ApiExpectedFortunePageResponse
>>
actualMap
=
actualList
.
stream
()
.
filter
(
item
->
"R"
.
equals
(
item
.
getFortuneBizType
()))
.
collect
(
Collectors
.
groupingBy
(
ApiExpectedFortunePageResponse:
:
getExpectedFortuneBizId
));
// 4. 调整数据顺序
List
<
ApiExpectedFortunePageResponse
>
sortedList
=
new
ArrayList
<>();
Set
<
String
>
matchedActualPayableNos
=
new
HashSet
<>();
for
(
ApiExpectedFortunePageResponse
expected
:
expectedList
)
{
sortedList
.
add
(
expected
);
// 查找对应的实际发佣
List
<
ApiExpectedFortunePageResponse
>
matchedList
=
actualMap
.
get
(
expected
.
getExpectedFortuneBizId
());
if
(
CollUtil
.
isNotEmpty
(
matchedList
))
{
// 设置实际出账记录的字段:待出账金额(估)、已出账比例、未出账比例、已出账金额
matchedList
.
forEach
(
actual
->
{
actual
.
setUnpaidAmount
(
expected
.
getHkdAmount
());
actual
.
setPaidRatio
(
expected
.
getPaidRatio
());
actual
.
setUnpaidRatio
(
expected
.
getUnpaidRatio
());
actual
.
setPaidAmount
(
expected
.
getPaidAmount
());
});
sortedList
.
addAll
(
matchedList
);
matchedActualPayableNos
.
add
(
expected
.
getExpectedFortuneBizId
());
}
}
// 5. 添加未匹配的实际发佣记录
for
(
ApiExpectedFortunePageResponse
actual
:
actualList
)
{
if
(!
matchedActualPayableNos
.
contains
(
actual
.
getExpectedFortuneBizId
()))
{
sortedList
.
add
(
actual
);
}
}
// 6.设置实际出账记录的字段:待出账金额(估)
for
(
ApiExpectedFortunePageResponse
item
:
sortedList
)
{
if
(
item
.
getType
()
==
2
)
{
item
.
setCurrentPaymentHkdAmount
(
item
.
getHkdAmount
());
}
}
// 7. 将排序后的结果写回原列表
expectedFortuneList
.
clear
();
expectedFortuneList
.
addAll
(
sortedList
);
log
.
info
(
"顺序调整后: {}"
,
sortedList
.
size
());
}
@Override
@Override
public
List
<
ApiExpectedFortunePageResponse
>
toVOList
(
List
<
ExpectedFortune
>
expectedFortuneList
)
{
public
List
<
ApiExpectedFortunePageResponse
>
toVOList
(
List
<
ExpectedFortune
>
expectedFortuneList
)
{
if
(
CollUtil
.
isEmpty
(
expectedFortuneList
))
{
if
(
CollUtil
.
isEmpty
(
expectedFortuneList
))
{
...
@@ -232,12 +302,27 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
...
@@ -232,12 +302,27 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
}
}
@Override
@Override
public
String
getPayableNo
(
String
fortuneType
)
{
public
String
getPayableNo
(
String
fortuneType
,
String
policyNo
,
long
expectedFortuneId
)
{
Integer
currentSeq
=
getPayableNoCurrentSeq
();
// 1. 安全获取保单号后6位
return
String
.
format
(
"%s%s%s"
,
String
last6Chars
=
""
;
fortuneType
+
"-CSF"
,
if
(
policyNo
!=
null
&&
!
policyNo
.
isEmpty
())
{
LocalDate
.
now
().
getYear
()
%
100
,
int
startIdx
=
Math
.
max
(
0
,
policyNo
.
length
()
-
6
);
currentSeq
+
1
);
last6Chars
=
policyNo
.
substring
(
startIdx
);
}
// 2. 字符串左补0至6位
// %6s 表示最小宽度为6,不足部分默认用空格填充在左侧
// replace(' ', '0') 将填充的空格替换为0,实现左补0效果
String
formattedPolicySuffix
=
String
.
format
(
"%6s"
,
last6Chars
).
replace
(
' '
,
'0'
);
// 3. 项目类型枚举转换为字符串
String
fortuneTypeCode
=
FortuneTypeEnum
.
getByItemValue
(
fortuneType
).
getItemLabel
();
// 4. 组装最终字符串
return
String
.
format
(
"%s-%s-%d"
,
fortuneTypeCode
,
formattedPolicySuffix
,
expectedFortuneId
);
}
}
@Override
@Override
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneAccountServiceImpl.java
View file @
bdfc676e
...
@@ -109,7 +109,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -109,7 +109,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
@Override
@Override
@Transactional
(
rollbackFor
=
BusinessException
.
class
)
@Transactional
(
rollbackFor
=
BusinessException
.
class
)
public
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
,
LocalDate
actualPayoutDate
)
{
public
void
saveFortuneAccount
(
List
<
FortuneAccountExportDTO
>
accountExportDTOList
)
{
if
(
CollectionUtils
.
isEmpty
(
accountExportDTOList
))
{
if
(
CollectionUtils
.
isEmpty
(
accountExportDTOList
))
{
return
;
return
;
}
}
...
@@ -122,19 +122,22 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -122,19 +122,22 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
Map
<
String
,
String
>
map
=
policyBrokerService
.
queryInternalCodeMap
(
brokerBizIdList
);
Map
<
String
,
String
>
map
=
policyBrokerService
.
queryInternalCodeMap
(
brokerBizIdList
);
List
<
FortuneAccount
>
fortuneAccountList
=
new
ArrayList
<>();
List
<
FortuneAccount
>
fortuneAccountList
=
new
ArrayList
<>();
Date
currentDate
=
new
Date
();
Date
currentDate
=
new
Date
();
String
billingYearMonth
=
actualPayoutDate
!=
null
?
actualPayoutDate
.
format
(
java
.
time
.
format
.
DateTimeFormatter
.
ofPattern
(
"yyyyMM"
))
Map
<
String
,
Integer
>
prefixSerialCache
=
new
HashMap
<>();
:
""
;
for
(
FortuneAccountExportDTO
accountExportDTO
:
accountExportDTOList
)
{
for
(
FortuneAccountExportDTO
accountExportDTO
:
accountExportDTOList
)
{
FortuneAccount
fortuneAccount
=
new
FortuneAccount
();
FortuneAccount
fortuneAccount
=
new
FortuneAccount
();
fortuneAccount
.
setFortuneAccountBizId
(
RandomStringGenerator
.
generateBizId16
(
"fortune_account"
));
fortuneAccount
.
setFortuneAccountBizId
(
RandomStringGenerator
.
generateBizId16
(
"fortune_account"
));
String
internalCode
=
map
.
get
(
accountExportDTO
.
getBrokerBizId
());
String
internalCode
=
map
.
get
(
accountExportDTO
.
getBrokerBizId
());
// LocalDate payoutDate = accountExportDTO.getActualPayoutDate();
// String billingYearMonth = payoutDate != null
String
billingYearMonth
=
accountExportDTO
.
getActualPayoutDate
()
!=
null
// ? actualPayoutDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyyMM"))
?
accountExportDTO
.
getActualPayoutDate
().
format
(
java
.
time
.
format
.
DateTimeFormatter
.
ofPattern
(
"yyyyMM"
))
// : "";
:
""
;
String
businessNo
=
BusinessNoUtils
.
generate
(
billingYearMonth
,
internalCode
);
//出账业务编号(出账年月 + 转介人内部编号(后6位)(如无,用0补齐)+流水号(6位))
String
prefix
=
BusinessNoUtils
.
getPrefix
(
billingYearMonth
,
internalCode
);
// 业务编号生成
String
businessNo
=
generateBusinessNoWithCache
(
prefix
,
billingYearMonth
,
internalCode
,
prefixSerialCache
);
fortuneAccount
.
setBusinessNo
(
businessNo
);
fortuneAccount
.
setBusinessNo
(
businessNo
);
fortuneAccount
.
setBroker
(
accountExportDTO
.
getBroker
());
fortuneAccount
.
setBroker
(
accountExportDTO
.
getBroker
());
fortuneAccount
.
setBrokerBizId
(
accountExportDTO
.
getBrokerBizId
());
fortuneAccount
.
setBrokerBizId
(
accountExportDTO
.
getBrokerBizId
());
...
@@ -142,7 +145,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -142,7 +145,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
fortuneAccount
.
setTeamBizId
(
accountExportDTO
.
getTeamBizId
());
fortuneAccount
.
setTeamBizId
(
accountExportDTO
.
getTeamBizId
());
fortuneAccount
.
setCurrency
(
accountExportDTO
.
getCurrency
());
fortuneAccount
.
setCurrency
(
accountExportDTO
.
getCurrency
());
fortuneAccount
.
setHkdAmount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
setHkdAmount
(
accountExportDTO
.
getAmount
());
fortuneAccount
.
setFortuneAccountDate
(
this
.
getActualPayoutDate
(
ac
tualPayoutDate
));
fortuneAccount
.
setFortuneAccountDate
(
this
.
getActualPayoutDate
(
ac
countExportDTO
.
getActualPayoutDate
()
));
// 出账状态默认待出账
// 出账状态默认待出账
fortuneAccount
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
fortuneAccount
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
...
@@ -186,7 +189,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -186,7 +189,7 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
updateFortune
.
setCurrentPaymentRatio
(
item
.
getCurrentPaymentHkdAmount
()
updateFortune
.
setCurrentPaymentRatio
(
item
.
getCurrentPaymentHkdAmount
()
.
divide
(
item
.
getHkdAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)));
.
divide
(
item
.
getHkdAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)));
}
}
updateFortune
.
setReconciliationOperator
(
currentLoginUser
.
get
Usern
ame
());
updateFortune
.
setReconciliationOperator
(
currentLoginUser
.
get
RealN
ame
());
updateFortuneList
.
add
(
updateFortune
);
updateFortuneList
.
add
(
updateFortune
);
// 处理关联预计发佣记录
// 处理关联预计发佣记录
expectedFortuneBizIdList
.
add
(
item
.
getExpectedFortuneBizId
());
expectedFortuneBizIdList
.
add
(
item
.
getExpectedFortuneBizId
());
...
@@ -210,7 +213,6 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -210,7 +213,6 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
ExpectedFortune
updateExpectedFortune
=
new
ExpectedFortune
();
ExpectedFortune
updateExpectedFortune
=
new
ExpectedFortune
();
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
updateExpectedFortune
.
setId
(
expectedFortune
.
getId
());
updateExpectedFortune
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
updateExpectedFortune
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
updateExpectedFortune
.
setActualPayoutDate
(
actualPayoutDate
);
updateExpectedFortuneList
.
add
(
updateExpectedFortune
);
updateExpectedFortuneList
.
add
(
updateExpectedFortune
);
}
}
expectedFortuneService
.
updateBatchById
(
updateExpectedFortuneList
);
expectedFortuneService
.
updateBatchById
(
updateExpectedFortuneList
);
...
@@ -218,6 +220,50 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
...
@@ -218,6 +220,50 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
}
}
/**
* 带本地缓存的业务编号生成(解决同一批次内相同 prefix 的流水号重复问题)
* @param prefix 业务编号前缀(出账年月 + 转介人内部编号后6位)
* @param billingYearMonth 出账年月
* @param internalCode 转介人内部编号
* @param prefixSerialCache 本地缓存(Map<prefix, 当前已使用的最大流水号数值>)
* @return 完整的业务编号
*/
private
String
generateBusinessNoWithCache
(
String
prefix
,
String
billingYearMonth
,
String
internalCode
,
Map
<
String
,
Integer
>
prefixSerialCache
)
{
// 从缓存中获取当前 prefix 已分配的最大流水号,若不存在则查询数据库
Integer
currentMaxSerial
=
prefixSerialCache
.
get
(
prefix
);
if
(
currentMaxSerial
==
null
)
{
String
maxSerialFromDb
=
getMaxSerialNoByPrefix
(
prefix
);
// 返回如 "000000"
currentMaxSerial
=
Integer
.
parseInt
(
maxSerialFromDb
);
}
int
nextSerial
=
currentMaxSerial
+
1
;
String
serialPart
=
String
.
format
(
"%06d"
,
nextSerial
);
String
businessNo
=
BusinessNoUtils
.
generate
(
billingYearMonth
,
internalCode
,
serialPart
);
// 更新缓存
prefixSerialCache
.
put
(
prefix
,
nextSerial
);
return
businessNo
;
}
/**
* 根据前缀查询当前最大流水号(后6位)
* @param prefix 业务编号前缀(出账年月+转介人内部编号后6位,共12位)
* @return 最大流水号(6位字符串),如果没有记录则返回 "000000"
*/
private
String
getMaxSerialNoByPrefix
(
String
prefix
)
{
// 查询 business_no 以指定前缀开头的记录,按业务编号降序取第一条
LambdaQueryWrapper
<
FortuneAccount
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
likeRight
(
FortuneAccount:
:
getBusinessNo
,
prefix
)
.
orderByDesc
(
FortuneAccount:
:
getBusinessNo
)
.
last
(
"limit 1"
);
FortuneAccount
account
=
this
.
getOne
(
wrapper
,
false
);
if
(
account
==
null
)
{
return
"000000"
;
}
String
businessNo
=
account
.
getBusinessNo
();
// 取最后6位作为流水号
return
businessNo
.
substring
(
businessNo
.
length
()
-
6
);
}
private
Date
getActualPayoutDate
(
LocalDate
actualPayoutDate
)
{
private
Date
getActualPayoutDate
(
LocalDate
actualPayoutDate
)
{
if
(
actualPayoutDate
==
null
)
{
if
(
actualPayoutDate
==
null
)
{
return
null
;
return
null
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
bdfc676e
...
@@ -18,7 +18,6 @@ import com.yd.common.exception.BusinessException;
...
@@ -18,7 +18,6 @@ import com.yd.common.exception.BusinessException;
import
com.yd.common.result.Result
;
import
com.yd.common.result.Result
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.common.utils.RedisUtil
;
import
com.yd.common.utils.RedisUtil
;
import
com.yd.csf.feign.response.expectedfortune.ApiExpectedFortunePageResponse
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.enums.FortuneStatusEnum
;
import
com.yd.csf.service.enums.FortuneStatusEnum
;
import
com.yd.csf.service.model.*
;
import
com.yd.csf.service.model.*
;
...
@@ -43,6 +42,8 @@ import java.math.RoundingMode;
...
@@ -43,6 +42,8 @@ import java.math.RoundingMode;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.YearMonth
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -91,8 +92,19 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -91,8 +92,19 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
String
policyNo
=
fortuneQueryRequest
.
getPolicyNo
();
String
policyNo
=
fortuneQueryRequest
.
getPolicyNo
();
List
<
String
>
insuranceCompanyBizIdList
=
fortuneQueryRequest
.
getInsuranceCompanyBizIdList
();
List
<
String
>
insuranceCompanyBizIdList
=
fortuneQueryRequest
.
getInsuranceCompanyBizIdList
();
List
<
String
>
productLaunchBizIdList
=
fortuneQueryRequest
.
getProductLaunchBizIdList
();
List
<
String
>
productLaunchBizIdList
=
fortuneQueryRequest
.
getProductLaunchBizIdList
();
LocalDate
payoutDateStart
=
fortuneQueryRequest
.
getPayoutDateStart
();
// 出账年月(估)开始
LocalDate
payoutDateEnd
=
fortuneQueryRequest
.
getPayoutDateEnd
();
LocalDate
payoutDateStart
=
null
;
if
(
StringUtils
.
isNotBlank
(
fortuneQueryRequest
.
getPayoutDateStart
()))
{
payoutDateStart
=
LocalDate
.
parse
(
fortuneQueryRequest
.
getPayoutDateStart
()
+
"-01"
);
}
// 出账年月(估)结束 月最后一天
LocalDate
payoutDateEnd
=
null
;
if
(
StringUtils
.
isNotBlank
(
fortuneQueryRequest
.
getPayoutDateEnd
()))
{
// 1. 先解析为 YearMonth (专门处理年月)
YearMonth
yearMonth
=
YearMonth
.
parse
(
fortuneQueryRequest
.
getPayoutDateEnd
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM"
));
// 2. 获取该月的最后一天
payoutDateEnd
=
yearMonth
.
atEndOfMonth
();
}
String
brokerName
=
fortuneQueryRequest
.
getBrokerName
();
String
brokerName
=
fortuneQueryRequest
.
getBrokerName
();
// 入账状态
// 入账状态
...
@@ -221,7 +233,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -221,7 +233,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
// 检核人
// 检核人
fortune
.
setReconciliationOperator
(
currentLoginUser
.
get
Usern
ame
());
fortune
.
setReconciliationOperator
(
currentLoginUser
.
get
RealN
ame
());
// 如果传入了金额
// 如果传入了金额
if
(
currentPaymentHkdAmount
!=
null
&&
currentPaymentHkdAmount
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
if
(
currentPaymentHkdAmount
!=
null
&&
currentPaymentHkdAmount
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
...
@@ -248,7 +260,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -248,7 +260,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getHkdAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getHkdAmount
());
fortune
.
setCurrentPaymentRatio
(
BigDecimal
.
valueOf
(
100
));
fortune
.
setCurrentPaymentRatio
(
BigDecimal
.
valueOf
(
100
));
fortune
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
fortune
.
setReconciliationOperator
(
currentLoginUser
.
get
Usern
ame
());
fortune
.
setReconciliationOperator
(
currentLoginUser
.
get
RealN
ame
());
fortune
.
setUpdaterId
(
loginUserId
);
fortune
.
setUpdaterId
(
loginUserId
);
fortune
.
setUpdateTime
(
new
Date
());
fortune
.
setUpdateTime
(
new
Date
());
...
@@ -257,6 +269,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -257,6 +269,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
/**
/**
* 保单币种对预计来佣的结算币种的默认汇率
* 保单币种对预计来佣的结算币种的默认汇率
*
* @param policyCurrency 保单币种
* @param policyCurrency 保单币种
* @param currency 预计来佣的结算币种
* @param currency 预计来佣的结算币种
* @return 汇率
* @return 汇率
...
@@ -295,7 +308,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -295,7 +308,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
main
.
setCurrentPaymentRatio
(
currentPaymentHkdAmount
main
.
setCurrentPaymentRatio
(
currentPaymentHkdAmount
.
divide
(
expectedFortune
.
getHkdAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)));
.
divide
(
expectedFortune
.
getHkdAmount
(),
4
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)));
main
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
main
.
setStatus
(
FortuneStatusEnum
.
CHECKED
.
getItemValue
());
main
.
setReconciliationOperator
(
currentLoginUser
.
get
Usern
ame
());
main
.
setReconciliationOperator
(
currentLoginUser
.
get
RealN
ame
());
main
.
setUpdaterId
(
loginUserId
);
main
.
setUpdaterId
(
loginUserId
);
main
.
setUpdateTime
(
new
Date
());
main
.
setUpdateTime
(
new
Date
());
...
@@ -314,7 +327,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -314,7 +327,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
part
.
setStatus
(
FortuneStatusEnum
.
RESERVED
.
getItemValue
());
part
.
setStatus
(
FortuneStatusEnum
.
RESERVED
.
getItemValue
());
part
.
setIsPart
(
1
);
part
.
setIsPart
(
1
);
part
.
setPayoutDate
(
LocalDate
.
now
().
plusMonths
(
1
));
// 次月
part
.
setPayoutDate
(
LocalDate
.
now
().
plusMonths
(
1
));
// 次月
part
.
setReconciliationOperator
(
currentLoginUser
.
get
Usern
ame
());
part
.
setReconciliationOperator
(
currentLoginUser
.
get
RealN
ame
());
part
.
setCreatorId
(
loginUserId
);
part
.
setCreatorId
(
loginUserId
);
part
.
setCreateTime
(
new
Date
());
part
.
setCreateTime
(
new
Date
());
this
.
save
(
part
);
this
.
save
(
part
);
...
@@ -372,13 +385,34 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -372,13 +385,34 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
StringBuilder
validateMsg
=
new
StringBuilder
();
StringBuilder
validateMsg
=
new
StringBuilder
();
for
(
Fortune
fortune
:
fortuneList
)
{
for
(
Fortune
fortune
:
fortuneList
)
{
if
(
StringUtils
.
isNotBlank
(
fortune
.
getFortuneAccountBizId
()))
{
if
(
StringUtils
.
isNotBlank
(
fortune
.
getFortuneAccountBizId
()))
{
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"已发薪资,不能重复生成薪资记录; "
);
validateMsg
.
append
(
"保单"
).
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
())
.
append
(
":已发薪资,不能重复生成"
);
break
;
}
}
if
(
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
WAIT
.
getItemValue
()))
{
if
(
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
WAIT
.
getItemValue
()))
{
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"待出账状态不能直接改为'可出账, 检核完成',不能生成出账记录; "
);
validateMsg
.
append
(
"保单"
).
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
())
.
append
(
":待出账状态不能直接改为'可出账, 检核完成'"
);
break
;
}
}
if
(
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
SENT
.
getItemValue
()))
{
if
(
StringUtils
.
equals
(
fortune
.
getStatus
(),
FortuneStatusEnum
.
SENT
.
getItemValue
()))
{
validateMsg
.
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
()).
append
(
"已完成出账,不能生成出账记录; "
);
validateMsg
.
append
(
"保单"
).
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
())
.
append
(
":已完成出账"
);
break
;
}
if
(
fortune
.
getActualPayoutDate
()
==
null
)
{
validateMsg
.
append
(
"保单"
).
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
())
.
append
(
":未设置出账年月(实)"
);
break
;
}
if
(
ObjectUtils
.
isEmpty
(
fortune
.
getPayoutCurrency
()))
{
validateMsg
.
append
(
"保单"
).
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
())
.
append
(
":未设置发放币种"
);
break
;
}
if
(
ObjectUtils
.
isEmpty
(
fortune
.
getPayoutAmount
()))
{
validateMsg
.
append
(
"保单"
).
append
(
fortune
.
getPolicyNo
()).
append
(
"-"
).
append
(
fortune
.
getBroker
())
.
append
(
":未设置发放币种金额"
);
break
;
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
validateMsg
.
toString
()))
{
if
(
StringUtils
.
isNotBlank
(
validateMsg
.
toString
()))
{
...
@@ -386,20 +420,18 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -386,20 +420,18 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
}
if
(
CollUtil
.
isNotEmpty
(
fortuneList
))
{
if
(
CollUtil
.
isNotEmpty
(
fortuneList
))
{
// 按人和发放币种分组
// 按人和实际出账年月(实)和发放币种分组
Map
<
String
,
List
<
Fortune
>>
fortuneMap
=
fortuneList
.
stream
().
collect
(
Collectors
.
groupingBy
(
fortune
->
fortune
.
getBroker
()
+
"_"
+
fortune
.
getPayoutCurrency
()));
Map
<
String
,
List
<
Fortune
>>
fortuneMap
=
fortuneList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
fortune
->
fortune
.
getBroker
()
+
"_"
+
fortune
.
getActualPayoutDate
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
))
+
"_"
+
fortune
.
getPayoutCurrency
()));
// 创建按人分组的导出DTO列表
// 创建按人分组的导出DTO列表
List
<
FortuneAccountExportDTO
>
accountExportDTOList
=
new
ArrayList
<>();
List
<
FortuneAccountExportDTO
>
accountExportDTOList
=
new
ArrayList
<>();
// 设置出账年月(实)
LocalDate
actualPayoutDate
=
LocalDate
.
parse
(
fortuneDownloadRequest
.
getActualPayoutDate
()
+
"-01"
);
fortuneList
.
forEach
(
fortune
->
fortune
.
setActualPayoutDate
(
actualPayoutDate
));
// 处理每个分组的数据
// 处理每个分组的数据
for
(
Map
.
Entry
<
String
,
List
<
Fortune
>>
entry
:
fortuneMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
Fortune
>>
entry
:
fortuneMap
.
entrySet
())
{
String
broker
=
entry
.
getKey
().
split
(
"_"
)[
0
];
String
broker
=
entry
.
getKey
().
split
(
"_"
)[
0
];
String
currency
=
entry
.
getKey
().
split
(
"_"
)[
1
];
String
actualPayoutDate
=
entry
.
getKey
().
split
(
"_"
)[
1
];
String
currency
=
entry
.
getKey
().
split
(
"_"
)[
2
];
List
<
Fortune
>
brokerFortunes
=
entry
.
getValue
();
List
<
Fortune
>
brokerFortunes
=
entry
.
getValue
();
FortuneAccountExportDTO
accountDTO
=
new
FortuneAccountExportDTO
();
FortuneAccountExportDTO
accountDTO
=
new
FortuneAccountExportDTO
();
...
@@ -412,7 +444,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -412,7 +444,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
accountDTO
.
setTeam
(
brokerFortunes
.
get
(
0
).
getTeam
());
accountDTO
.
setTeam
(
brokerFortunes
.
get
(
0
).
getTeam
());
accountDTO
.
setTeamBizId
(
brokerFortunes
.
get
(
0
).
getTeamBizId
());
accountDTO
.
setTeamBizId
(
brokerFortunes
.
get
(
0
).
getTeamBizId
());
accountDTO
.
setCurrency
(
currency
);
accountDTO
.
setCurrency
(
currency
);
accountDTO
.
setActualPayoutDate
(
brokerFortunes
.
get
(
0
).
getActualPayoutDate
(
));
accountDTO
.
setActualPayoutDate
(
LocalDate
.
parse
(
actualPayoutDate
));
}
}
// 计算出账总额
// 计算出账总额
...
@@ -467,7 +499,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -467,7 +499,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// }
// }
// 写入数据库
// 写入数据库
fortuneAccountService
.
saveFortuneAccount
(
accountExportDTOList
,
actualPayoutDate
);
fortuneAccountService
.
saveFortuneAccount
(
accountExportDTOList
);
// // 使用try-with-resources确保流正确关闭
// // 使用try-with-resources确保流正确关闭
// try (ServletOutputStream outputStream = response.getOutputStream()) {
// try (ServletOutputStream outputStream = response.getOutputStream()) {
...
@@ -557,7 +589,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -557,7 +589,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
getPayoutAmount
());
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
getPayoutAmount
());
fortune
.
setFortuneName
(
queryByDict
(
fortuneAddRequest
.
getFortuneType
()));
fortune
.
setFortuneName
(
queryByDict
(
fortuneAddRequest
.
getFortuneType
()));
fortune
.
setActualPayoutDate
(
fortuneAddRequest
.
getPayoutDate
(
));
fortune
.
setActualPayoutDate
(
LocalDate
.
parse
(
fortuneAddRequest
.
getPayoutDate
()
+
"-01"
));
fortune
.
setIsPart
(
0
);
fortune
.
setIsPart
(
0
);
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
fortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
());
...
@@ -568,6 +600,12 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -568,6 +600,12 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getFortuneBizType
()))
{
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getFortuneBizType
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账类型不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账类型不能为空"
);
}
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getPayoutDate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账年月(估)不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getActualPayoutDate
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账年月(实)不能为空"
);
}
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getOriginalCurrency
()))
{
if
(
ObjectUtils
.
isEmpty
(
fortuneAddRequest
.
getOriginalCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种不能为空"
);
...
@@ -724,9 +762,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -724,9 +762,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 查询入账记录
// 查询入账记录
Map
<
String
,
Commission
>
commissionByPolicyPeriod
=
new
HashMap
<>();
Map
<
String
,
Commission
>
commissionByPolicyPeriod
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
policyNoSet
))
{
if
(
CollectionUtils
.
isNotEmpty
(
policyNoSet
))
{
// 查询保单号
// 查询保单信息
List
<
Policy
>
policyList
=
policyService
.
lambdaQuery
().
in
(
Policy:
:
getPolicyNo
,
policyNoSet
).
list
();
policyMap
=
policyService
.
queryPolicyMap
(
policyNoSet
);
policyMap
=
policyList
.
stream
().
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
));
// 查询预计出账
// 查询预计出账
expectedFortuneMap
=
expectedFortuneService
.
lambdaQuery
()
expectedFortuneMap
=
expectedFortuneService
.
lambdaQuery
()
...
@@ -751,6 +788,11 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -751,6 +788,11 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
}
}
}
// 当前登录用户
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
realName
=
currentLoginUser
.
getRealName
();
List
<
Fortune
>
fortuneList
=
new
ArrayList
<>();
List
<
Fortune
>
fortuneList
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
expectedFortuneUpdateList
=
new
ArrayList
<>();
List
<
ExpectedFortune
>
expectedFortuneUpdateList
=
new
ArrayList
<>();
for
(
FortuneAddRequest
fortuneAddRequest
:
fortuneAddRequestList
)
{
for
(
FortuneAddRequest
fortuneAddRequest
:
fortuneAddRequestList
)
{
...
@@ -758,7 +800,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -758,7 +800,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
valiAddFortune
(
fortuneAddRequest
);
valiAddFortune
(
fortuneAddRequest
);
Fortune
fortune
=
new
Fortune
();
Fortune
fortune
=
new
Fortune
();
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
fortune
);
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
fortune
,
"payoutDate"
,
"actualPayoutDate"
);
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getHkdAmount
());
fortune
.
setCurrentPaymentHkdAmount
(
fortune
.
getHkdAmount
());
// 查询发佣类型名称
// 查询发佣类型名称
...
@@ -777,7 +819,22 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -777,7 +819,22 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
expectedFortune
=
createExpectedFortune
(
fortuneAddRequest
,
policy
,
fortuneName
);
expectedFortune
=
createExpectedFortune
(
fortuneAddRequest
,
policy
,
fortuneName
);
// 保存
// 保存
expectedFortuneService
.
save
(
expectedFortune
);
expectedFortuneService
.
save
(
expectedFortune
);
// 更新应付款编号
String
payableNo
=
expectedFortuneService
.
getPayableNo
(
fortuneAddRequest
.
getFortuneType
(),
policy
.
getPolicyNo
(),
expectedFortune
.
getId
());
expectedFortuneService
.
lambdaUpdate
()
.
set
(
ExpectedFortune:
:
getPayableNo
,
payableNo
)
.
set
(
ExpectedFortune:
:
getCreatorId
,
loginUserId
)
.
set
(
ExpectedFortune:
:
getCreatorName
,
realName
)
.
set
(
ExpectedFortune:
:
getUpdaterId
,
loginUserId
)
.
eq
(
ExpectedFortune:
:
getId
,
expectedFortune
.
getId
())
.
update
();
// 关联应付款编号
fortune
.
setPayableNo
(
payableNo
);
}
else
{
// 如果有预计出账记录,提示去应付款管理页面修改金额,而不是在出账页面新增
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
fortuneAddRequest
.
getFortuneName
()
+
" 已存在应付记录,请在应付款管理页面修改金额"
);
}
}
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setExpectedFortuneBizId
(
expectedFortune
.
getExpectedFortuneBizId
());
fortune
.
setPolicyCurrency
(
expectedFortune
.
getPolicyCurrency
());
fortune
.
setPolicyCurrency
(
expectedFortune
.
getPolicyCurrency
());
fortune
.
setCurrentPaymentRatio
(
BigDecimal
.
valueOf
(
100
));
fortune
.
setCurrentPaymentRatio
(
BigDecimal
.
valueOf
(
100
));
...
@@ -799,8 +856,19 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -799,8 +856,19 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 生成发佣业务ID
// 生成发佣业务ID
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setFortuneBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FORTUNE
.
getCode
()));
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
getPayoutAmount
());
fortune
.
setCurrentPaymentAmount
(
fortuneAddRequest
.
getPayoutAmount
());
fortune
.
setActualPayoutDate
(
fortuneAddRequest
.
getPayoutDate
());
fortune
.
setPayoutDate
(
LocalDate
.
parse
(
fortuneAddRequest
.
getPayoutDate
()
+
"-01"
));
fortune
.
setActualPayoutDate
(
LocalDate
.
parse
(
fortuneAddRequest
.
getActualPayoutDate
()
+
"-01"
));
fortune
.
setIsPart
(
0
);
fortune
.
setIsPart
(
0
);
// 创建时间、更新时间
Date
now
=
new
Date
();
fortune
.
setCreateTime
(
now
);
fortune
.
setUpdateTime
(
now
);
// 创建人、更新人
fortune
.
setCreatorId
(
loginUserId
);
fortune
.
setReconciliationOperator
(
realName
);
fortune
.
setUpdaterId
(
loginUserId
);
fortuneList
.
add
(
fortune
);
fortuneList
.
add
(
fortune
);
}
}
this
.
saveBatch
(
fortuneList
);
this
.
saveBatch
(
fortuneList
);
...
@@ -813,13 +881,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -813,13 +881,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
}
private
ExpectedFortune
createExpectedFortune
(
FortuneAddRequest
fortuneAddRequest
,
Policy
policy
,
String
fortuneName
)
{
private
ExpectedFortune
createExpectedFortune
(
FortuneAddRequest
fortuneAddRequest
,
Policy
policy
,
String
fortuneName
)
{
// 应付款编号(序号递增)
String
payableNo
=
expectedFortuneService
.
getPayableNo
(
fortuneAddRequest
.
getFortuneType
());
// 创建 expectedFortune
// 创建 expectedFortune
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
expectedFortune
);
BeanUtil
.
copyProperties
(
fortuneAddRequest
,
expectedFortune
,
"payoutDate"
,
"actualPayoutDate"
);
// 设置 policy 关联字段
// 设置 policy 关联字段
expectedFortune
.
setInsuranceCompanyBizId
(
policy
.
getInsuranceCompanyBizId
());
expectedFortune
.
setInsuranceCompanyBizId
(
policy
.
getInsuranceCompanyBizId
());
...
@@ -832,7 +896,15 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -832,7 +896,15 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 预计发佣类型名称
// 预计发佣类型名称
expectedFortune
.
setFortuneName
(
fortuneName
);
expectedFortune
.
setFortuneName
(
fortuneName
);
// 应付款编号
// 应付款编号
expectedFortune
.
setPayableNo
(
payableNo
);
expectedFortune
.
setPayableNo
(
null
);
// 是否拆分
expectedFortune
.
setIsPart
(
0
);
// 默认保单币种汇率
expectedFortune
.
setDefaultExchangeRate
(
fortuneAddRequest
.
getExchangeRate
());
// 预计出账年月
expectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
fortuneAddRequest
.
getPayoutDate
()
+
"-01"
));
// 实际出账年月
expectedFortune
.
setActualPayoutDate
(
LocalDate
.
parse
(
fortuneAddRequest
.
getActualPayoutDate
()
+
"-01"
));
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
expectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
...
@@ -842,6 +914,11 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -842,6 +914,11 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
expectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
expectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
expectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
expectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
// 创建时间、更新时间
LocalDateTime
now
=
LocalDateTime
.
now
();
expectedFortune
.
setCreateTime
(
now
);
expectedFortune
.
setUpdateTime
(
now
);
return
expectedFortune
;
return
expectedFortune
;
}
}
...
@@ -909,7 +986,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -909,7 +986,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
AuthUserDto
currentLoginUser
=
SecurityUtil
.
getCurrentLoginUser
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
username
=
currentLoginUser
.
getUsern
ame
();
String
realName
=
currentLoginUser
.
getRealN
ame
();
for
(
int
i
=
0
;
i
<
splitList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
splitList
.
size
();
i
++)
{
FortuneSplitDto
splitDto
=
splitList
.
get
(
i
);
FortuneSplitDto
splitDto
=
splitList
.
get
(
i
);
...
@@ -940,7 +1017,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -940,7 +1017,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
newExpectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
newExpectedFortune
.
setPaidRatio
(
BigDecimal
.
ZERO
);
newExpectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
newExpectedFortune
.
setUnpaidRatio
(
BigDecimal
.
valueOf
(
100
));
newExpectedFortune
.
setStatus
(
"0"
);
newExpectedFortune
.
setStatus
(
FortuneStatusEnum
.
CAN_SEND
.
getItemValue
()
);
newExpectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
splitDto
.
getPayoutYearMonth
()
+
"-01"
));
newExpectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
splitDto
.
getPayoutYearMonth
()
+
"-01"
));
...
@@ -953,7 +1030,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -953,7 +1030,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
newExpectedFortune
.
setRemark
(
expectedRemark
);
newExpectedFortune
.
setRemark
(
expectedRemark
);
newExpectedFortune
.
setCreatorId
(
loginUserId
);
newExpectedFortune
.
setCreatorId
(
loginUserId
);
newExpectedFortune
.
setCreatorName
(
usern
ame
);
newExpectedFortune
.
setCreatorName
(
realN
ame
);
newExpectedFortune
.
setCreateTime
(
localDateTime
);
newExpectedFortune
.
setCreateTime
(
localDateTime
);
newExpectedFortune
.
setUpdaterId
(
loginUserId
);
newExpectedFortune
.
setUpdaterId
(
loginUserId
);
newExpectedFortune
.
setUpdateTime
(
localDateTime
);
newExpectedFortune
.
setUpdateTime
(
localDateTime
);
...
@@ -993,7 +1070,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -993,7 +1070,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
}
newFortune
.
setRemark
(
fortuneRemark
);
newFortune
.
setRemark
(
fortuneRemark
);
newFortune
.
setReconciliationOperator
(
usern
ame
);
newFortune
.
setReconciliationOperator
(
realN
ame
);
newFortune
.
setCreatorId
(
loginUserId
);
newFortune
.
setCreatorId
(
loginUserId
);
newFortune
.
setCreateTime
(
now
);
newFortune
.
setCreateTime
(
now
);
newFortune
.
setUpdaterId
(
loginUserId
);
newFortune
.
setUpdaterId
(
loginUserId
);
...
@@ -1127,6 +1204,38 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
...
@@ -1127,6 +1204,38 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
return
true
;
return
true
;
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
batchEditActualPayoutDate
(
BatchEditActualPayoutDateRequest
editBatchActualPayoutDateRequest
)
{
List
<
Fortune
>
fortuneList
=
this
.
lambdaQuery
()
.
in
(
Fortune:
:
getFortuneBizId
,
editBatchActualPayoutDateRequest
.
getFortuneBizIdList
())
.
list
();
if
(
CollectionUtils
.
isEmpty
(
fortuneList
))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"出账记录不存在"
);
}
// 处理实际出账年月(实)
LocalDate
actualPayoutDate
=
LocalDate
.
parse
(
editBatchActualPayoutDateRequest
.
getActualPayoutDate
()
+
"-01"
);
// 更新 fortune 的字段, 已设置的不更新,记录更新成功及跳过的条数
int
updateCount
=
0
;
int
skipCount
=
0
;
for
(
Fortune
fortune
:
fortuneList
)
{
if
(
ObjectUtils
.
isEmpty
(
fortune
.
getActualPayoutDate
()))
{
updateCount
++;
}
else
{
skipCount
++;
continue
;
}
this
.
lambdaUpdate
()
.
set
(
Fortune:
:
getActualPayoutDate
,
actualPayoutDate
)
.
eq
(
Fortune:
:
getId
,
fortune
.
getId
())
.
update
();
}
return
String
.
format
(
"设置成功。已更新 %d 条数据,跳过 %d 条(已有实际出账年月)"
,
updateCount
,
skipCount
);
}
private
void
validEditExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
)
{
private
void
validEditExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
)
{
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getOriginalCurrency
()))
{
if
(
ObjectUtils
.
isEmpty
(
editExchangeRateRequest
.
getOriginalCurrency
()))
{
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种不能为空"
);
throw
new
BusinessException
(
ResultCode
.
PARAM_CHECK_ERROR
.
getCode
(),
"原币种不能为空"
);
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyBrokerServiceImpl.java
View file @
bdfc676e
...
@@ -11,9 +11,8 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -11,9 +11,8 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Collections
;
import
java.util.*
;
import
java.util.List
;
import
java.util.function.Function
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -61,6 +60,15 @@ public class PolicyBrokerServiceImpl extends ServiceImpl<PolicyBrokerMapper, Pol
...
@@ -61,6 +60,15 @@ public class PolicyBrokerServiceImpl extends ServiceImpl<PolicyBrokerMapper, Pol
}
}
@Override
@Override
public
Map
<
String
,
PolicyBroker
>
queryPolicyBrokerMap
(
Collection
<
String
>
policyNoSet
)
{
if
(
CollectionUtils
.
isEmpty
(
policyNoSet
))
{
return
Collections
.
emptyMap
();
}
List
<
PolicyBroker
>
list
=
this
.
lambdaQuery
().
in
(
PolicyBroker:
:
getPolicyNo
,
policyNoSet
).
list
();
return
list
.
stream
().
collect
(
Collectors
.
toMap
(
PolicyBroker:
:
getPolicyNo
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
));
}
@Override
public
Map
<
String
,
String
>
queryInternalCodeMap
(
List
<
String
>
brokerBizIdList
)
{
public
Map
<
String
,
String
>
queryInternalCodeMap
(
List
<
String
>
brokerBizIdList
)
{
if
(
CollectionUtils
.
isEmpty
(
brokerBizIdList
))
{
if
(
CollectionUtils
.
isEmpty
(
brokerBizIdList
))
{
return
Collections
.
emptyMap
();
return
Collections
.
emptyMap
();
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyFollowServiceImpl.java
View file @
bdfc676e
...
@@ -52,6 +52,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -52,6 +52,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -168,7 +169,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -168,7 +169,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
}
}
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getInsured
()))
queryWrapper
.
like
(
"insured"
,
policyFollowQueryRequest
.
getInsured
());
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getInsured
()))
queryWrapper
.
like
(
"insured"
,
policyFollowQueryRequest
.
getInsured
());
//签单人
//签单人
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getSigner
()))
queryWrapper
.
like
(
"signer
"
,
policyFollowQueryRequest
.
getSigner
(
));
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getSigner
()))
queryWrapper
.
like
(
"signer
_sc"
,
ChineseTextConverter
.
traditionalToSimplified
(
policyFollowQueryRequest
.
getSigner
()
));
//转介人(保单转介人表)
//转介人(保单转介人表)
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getBrokerName
()))
{
if
(
StringUtils
.
isNotEmpty
(
policyFollowQueryRequest
.
getBrokerName
()))
{
List
<
PolicyBroker
>
policyBrokerList
=
policyBrokerService
.
queryList
(
QueryPolicyBrokerDto
.
builder
().
brokerName
(
policyFollowQueryRequest
.
getBrokerName
()).
build
());
List
<
PolicyBroker
>
policyBrokerList
=
policyBrokerService
.
queryList
(
QueryPolicyBrokerDto
.
builder
().
brokerName
(
policyFollowQueryRequest
.
getBrokerName
()).
build
());
...
@@ -378,6 +379,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -378,6 +379,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
policyFollow
.
setUpdaterId
(
loginUserId
);
policyFollow
.
setUpdaterId
(
loginUserId
);
policyFollow
.
setUpdateTime
(
new
Date
());
policyFollow
.
setUpdateTime
(
new
Date
());
policyFollow
.
setSignerSc
(
ChineseTextConverter
.
traditionalToSimplified
(
policyFollowDto
.
getSigner
()));
try
{
try
{
boolean
result
=
updateById
(
policyFollow
);
boolean
result
=
updateById
(
policyFollow
);
...
@@ -1298,6 +1300,15 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1298,6 +1300,15 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
return
policySecondHolderService
.
updatePolicySecondHolder
(
policySecondHolderUpdateRequest
);
return
policySecondHolderService
.
updatePolicySecondHolder
(
policySecondHolderUpdateRequest
);
}
}
@Override
public
Map
<
String
,
PolicyFollow
>
queryPolicyFollowMap
(
Collection
<?>
policyNoSet
)
{
if
(
CollectionUtils
.
isEmpty
(
policyNoSet
))
{
return
Collections
.
emptyMap
();
}
List
<
PolicyFollow
>
policyFollowList
=
this
.
list
(
new
QueryWrapper
<
PolicyFollow
>().
in
(
"policy_no"
,
policyNoSet
));
return
policyFollowList
.
stream
().
collect
(
Collectors
.
toMap
(
PolicyFollow:
:
getPolicyNo
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
));
}
/**
/**
* 根据保单号查询新单跟进详情
* 根据保单号查询新单跟进详情
* @param policyNo
* @param policyNo
...
@@ -1321,15 +1332,18 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1321,15 +1332,18 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
public
List
<
String
>
queryPolicyNoList
(
String
policyHolder
,
String
signer
,
String
brokerName
,
String
insured
)
{
public
List
<
String
>
queryPolicyNoList
(
String
policyHolder
,
String
signer
,
String
brokerName
,
String
insured
)
{
// 投保人转换:中文转简体、英文转小写
// 投保人转换:中文转简体、英文转小写
String
policyHolderSc
=
ChineseTextConverter
.
traditionalToSimplified
(
policyHolder
);
String
policyHolderSc
=
ChineseTextConverter
.
traditionalToSimplified
(
policyHolder
);
String
policyHolderEnLc
=
EnglishTextUtil
.
toLowerCase
(
policyHolder
);
String
policyHolderEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
policyHolder
);
// 受保人转换:中文转简体、英文转小写
// 受保人转换:中文转简体、英文转小写
String
insuredSc
=
ChineseTextConverter
.
traditionalToSimplified
(
insured
);
String
insuredSc
=
ChineseTextConverter
.
traditionalToSimplified
(
insured
);
String
insuredEnLc
=
EnglishTextUtil
.
toLowerCase
(
insured
);
String
insuredEnLc
=
EnglishTextUtil
.
toLowerCaseSafe
(
insured
);
//签单员繁转简体
String
signerSc
=
ChineseTextConverter
.
traditionalToSimplified
(
signer
);
return
this
.
baseMapper
.
queryPolicyNoList
(
return
this
.
baseMapper
.
queryPolicyNoList
(
policyHolderSc
,
policyHolderEnLc
,
policyHolderSc
,
policyHolderEnLc
,
signer
,
signer
Sc
,
brokerName
,
brokerName
,
insuredSc
,
insuredEnLc
insuredSc
,
insuredEnLc
);
);
...
@@ -1352,6 +1366,9 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1352,6 +1366,9 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
// 3. 更新客户表
// 3. 更新客户表
updateCustomerNameFields
(
pageSize
);
updateCustomerNameFields
(
pageSize
);
// 4. 更新新单跟进表
updateSignerScFields
(
pageSize
);
log
.
info
(
"投保人/受保人名字冗余字段更新完成"
);
log
.
info
(
"投保人/受保人名字冗余字段更新完成"
);
return
Result
.
success
(
"更新成功"
);
return
Result
.
success
(
"更新成功"
);
}
}
...
@@ -1376,23 +1393,23 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1376,23 +1393,23 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
// 繁体 → 简体
// 繁体 → 简体
if
(
StringUtils
.
isNotBlank
(
entity
.
getName
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getName
()))
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getName
());
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getName
());
if
(!
nameSc
.
equals
(
entity
.
getNameSc
()))
{
//
if (!nameSc.equals(entity.getNameSc())) {
entity
.
setNameSc
(
nameSc
);
entity
.
setNameSc
(
nameSc
);
changed
=
true
;
changed
=
true
;
}
//
}
}
}
// 英文 → 小写
// 英文 → 小写
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameEn
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameEn
()))
{
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
entity
.
getNameEn
());
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
entity
.
getNameEn
());
if
(!
nameEnLc
.
equals
(
entity
.
getNameEnLc
()))
{
//
if (!nameEnLc.equals(entity.getNameEnLc())) {
entity
.
setNameEnLc
(
nameEnLc
);
entity
.
setNameEnLc
(
nameEnLc
);
changed
=
true
;
changed
=
true
;
}
//
}
}
}
if
(
changed
)
{
if
(
changed
)
{
entity
.
setUpdateTime
(
new
Date
());
// 可选,记录更新时间
//
entity.setUpdateTime(new Date()); // 可选,记录更新时间
toUpdate
.
add
(
entity
);
toUpdate
.
add
(
entity
);
}
}
}
}
...
@@ -1423,22 +1440,22 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1423,22 +1440,22 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
if
(
StringUtils
.
isNotBlank
(
entity
.
getName
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getName
()))
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getName
());
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getName
());
if
(!
nameSc
.
equals
(
entity
.
getNameSc
()))
{
//
if (!nameSc.equals(entity.getNameSc())) {
entity
.
setNameSc
(
nameSc
);
entity
.
setNameSc
(
nameSc
);
changed
=
true
;
changed
=
true
;
}
//
}
}
}
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameEn
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameEn
()))
{
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
entity
.
getNameEn
());
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
entity
.
getNameEn
());
if
(!
nameEnLc
.
equals
(
entity
.
getNameEnLc
()))
{
//
if (!nameEnLc.equals(entity.getNameEnLc())) {
entity
.
setNameEnLc
(
nameEnLc
);
entity
.
setNameEnLc
(
nameEnLc
);
changed
=
true
;
changed
=
true
;
}
//
}
}
}
if
(
changed
)
{
if
(
changed
)
{
entity
.
setUpdateTime
(
new
Date
());
//
entity.setUpdateTime(new Date());
toUpdate
.
add
(
entity
);
toUpdate
.
add
(
entity
);
}
}
}
}
...
@@ -1469,22 +1486,22 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1469,22 +1486,22 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameCn
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getNameCn
()))
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getNameCn
());
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getNameCn
());
if
(!
nameSc
.
equals
(
entity
.
getNameSc
()))
{
//
if (!nameSc.equals(entity.getNameSc())) {
entity
.
setNameSc
(
nameSc
);
entity
.
setNameSc
(
nameSc
);
changed
=
true
;
changed
=
true
;
}
//
}
}
}
if
(
StringUtils
.
isNotBlank
(
entity
.
getNamePyEn
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getNamePyEn
()))
{
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
entity
.
getNamePyEn
());
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
entity
.
getNamePyEn
());
if
(!
nameEnLc
.
equals
(
entity
.
getNameEnLc
()))
{
//
if (!nameEnLc.equals(entity.getNameEnLc())) {
entity
.
setNameEnLc
(
nameEnLc
);
entity
.
setNameEnLc
(
nameEnLc
);
changed
=
true
;
changed
=
true
;
}
//
}
}
}
if
(
changed
)
{
if
(
changed
)
{
entity
.
setUpdateTime
(
new
Date
());
//
entity.setUpdateTime(new Date());
toUpdate
.
add
(
entity
);
toUpdate
.
add
(
entity
);
}
}
}
}
...
@@ -1495,5 +1512,41 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
...
@@ -1495,5 +1512,41 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
pageNo
++;
pageNo
++;
}
}
}
}
/**
* 批量处理 PolicyFollow 的 signerSc
*/
private
void
updateSignerScFields
(
int
pageSize
)
{
int
pageNo
=
1
;
while
(
true
)
{
Page
<
PolicyFollow
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
Page
<
PolicyFollow
>
resultPage
=
policyFollowService
.
page
(
page
);
List
<
PolicyFollow
>
records
=
resultPage
.
getRecords
();
if
(
CollUtil
.
isEmpty
(
records
))
{
break
;
}
List
<
PolicyFollow
>
toUpdate
=
new
ArrayList
<>();
for
(
PolicyFollow
entity
:
records
)
{
boolean
changed
=
false
;
if
(
StringUtils
.
isNotBlank
(
entity
.
getSigner
()))
{
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
entity
.
getSigner
());
entity
.
setSignerSc
(
nameSc
);
changed
=
true
;
}
if
(
changed
)
{
// entity.setUpdateTime(new Date());
toUpdate
.
add
(
entity
);
}
}
if
(!
toUpdate
.
isEmpty
())
{
policyFollowService
.
updateBatchById
(
toUpdate
);
}
pageNo
++;
}
}
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyInsurantServiceImpl.java
View file @
bdfc676e
...
@@ -60,7 +60,7 @@ public class PolicyInsurantServiceImpl extends ServiceImpl<PolicyInsurantMapper,
...
@@ -60,7 +60,7 @@ public class PolicyInsurantServiceImpl extends ServiceImpl<PolicyInsurantMapper,
// 中文转简体
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
insured
);
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
insured
);
// 英文转小写
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
insured
);
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
insured
);
return
this
.
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyInsurant
>()
return
this
.
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyInsurant
>()
.
and
(
wrapper
->
wrapper
.
and
(
wrapper
->
wrapper
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyPolicyholderServiceImpl.java
View file @
bdfc676e
...
@@ -9,8 +9,6 @@ import com.yd.common.exception.BusinessException;
...
@@ -9,8 +9,6 @@ import com.yd.common.exception.BusinessException;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.ChineseTextConverter
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.common.utils.EnglishTextUtil
;
import
com.yd.csf.service.dto.PolicyPolicyholderUpdateRequest
;
import
com.yd.csf.service.dto.PolicyPolicyholderUpdateRequest
;
import
com.yd.csf.service.enums.FnaStatusEnum
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
com.yd.csf.service.model.PolicyPolicyholder
;
import
com.yd.csf.service.service.PolicyPolicyholderService
;
import
com.yd.csf.service.service.PolicyPolicyholderService
;
import
com.yd.csf.service.dao.PolicyPolicyholderMapper
;
import
com.yd.csf.service.dao.PolicyPolicyholderMapper
;
...
@@ -20,9 +18,8 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -20,9 +18,8 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.stream.Collectors
;
import
java.util.List
;
/**
/**
* @author Zhang Jianan
* @author Zhang Jianan
...
@@ -58,6 +55,19 @@ public class PolicyPolicyholderServiceImpl extends ServiceImpl<PolicyPolicyholde
...
@@ -58,6 +55,19 @@ public class PolicyPolicyholderServiceImpl extends ServiceImpl<PolicyPolicyholde
}
}
@Override
@Override
public
Map
<
String
,
PolicyPolicyholder
>
queryPolicyholderMap
(
Collection
<?>
policyNoList
)
{
if
(
CollectionUtils
.
isEmpty
(
policyNoList
))
{
return
Collections
.
emptyMap
();
}
List
<
PolicyPolicyholder
>
policyholderList
=
this
.
lambdaQuery
()
.
in
(
PolicyPolicyholder:
:
getPolicyNo
,
policyNoList
)
.
list
();
return
policyholderList
.
stream
().
collect
(
Collectors
.
toMap
(
PolicyPolicyholder:
:
getPolicyNo
,
a
->
a
,
(
oldValue
,
newValue
)
->
newValue
));
}
@Override
public
List
<
PolicyPolicyholder
>
queryList
(
String
policyHolder
)
{
public
List
<
PolicyPolicyholder
>
queryList
(
String
policyHolder
)
{
// 输入为空时直接返回空列表,避免无意义的全表查询
// 输入为空时直接返回空列表,避免无意义的全表查询
if
(
StringUtils
.
isBlank
(
policyHolder
))
{
if
(
StringUtils
.
isBlank
(
policyHolder
))
{
...
@@ -67,7 +77,7 @@ public class PolicyPolicyholderServiceImpl extends ServiceImpl<PolicyPolicyholde
...
@@ -67,7 +77,7 @@ public class PolicyPolicyholderServiceImpl extends ServiceImpl<PolicyPolicyholde
// 中文转简体
// 中文转简体
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
policyHolder
);
String
nameSc
=
ChineseTextConverter
.
traditionalToSimplified
(
policyHolder
);
// 英文转小写
// 英文转小写
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
(
policyHolder
);
String
nameEnLc
=
EnglishTextUtil
.
toLowerCase
Safe
(
policyHolder
);
return
this
.
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyPolicyholder
>()
return
this
.
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
PolicyPolicyholder
>()
.
and
(
wrapper
->
wrapper
.
and
(
wrapper
->
wrapper
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
View file @
bdfc676e
...
@@ -388,6 +388,17 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
...
@@ -388,6 +388,17 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
.
collect
(
Collectors
.
toMap
(
PolicyProductInfo:
:
getProductLaunchBizId
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
));
.
collect
(
Collectors
.
toMap
(
PolicyProductInfo:
:
getProductLaunchBizId
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
));
}
}
@Override
public
Map
<
String
,
Policy
>
queryPolicyMap
(
Collection
<
String
>
policyNoList
)
{
// 校验参数
if
(
CollectionUtils
.
isEmpty
(
policyNoList
))
{
return
Collections
.
emptyMap
();
}
return
this
.
lambdaQuery
().
in
(
Policy:
:
getPolicyNo
,
policyNoList
).
list
()
.
stream
().
collect
(
Collectors
.
toMap
(
Policy:
:
getPolicyNo
,
Function
.
identity
()));
}
/**
/**
* 从JSON数组中解析自定义属性
* 从JSON数组中解析自定义属性
*/
*/
...
...
yd-csf-service/src/main/java/com/yd/csf/service/utils/BusinessNoUtils.java
View file @
bdfc676e
package
com
.
yd
.
csf
.
service
.
utils
;
package
com
.
yd
.
csf
.
service
.
utils
;
import
java.util.concurrent.ThreadLocalRandom
;
/**
/**
* 业务编号生成工具类
* 业务编号生成工具类
*
<p>格式:出账年月 + 转介人内部编号后6位(无则补0) + 6位随机数字</p>
*
格式:出账年月(6) + 转介人内部编号后6位 + 6位流水号(从000001开始递增)
*/
*/
public
class
BusinessNoUtils
{
public
class
BusinessNoUtils
{
/**
/**
* 生成业务编号
* 生成业务编号(流水号由调用方传入)
*
* @param billingYearMonth 出账年月,如 "202604"
* @param billingYearMonth 出账年月,如 "202604"
* @param referrerInnerNo 转介人内部编号,可为 null 或空字符串
* @param referrerInnerNo 转介人内部编号,可为null或空
* @return 完整的业务编号字符串
* @param serialPart 6位流水号(如 "000001")
* @return 完整业务编号
*/
*/
public
static
String
generate
(
String
billingYearMonth
,
String
referrerInnerNo
)
{
public
static
String
generate
(
String
billingYearMonth
,
String
referrerInnerNo
,
String
serialPart
)
{
String
referrerPart
=
formatReferrerInnerNo
(
referrerInnerNo
);
String
referrerPart
=
formatReferrerInnerNo
(
referrerInnerNo
);
String
serialPart
=
generateRandomSerial
();
return
billingYearMonth
+
referrerPart
+
serialPart
;
return
billingYearMonth
+
referrerPart
+
serialPart
;
}
}
...
@@ -33,9 +30,13 @@ public class BusinessNoUtils {
...
@@ -33,9 +30,13 @@ public class BusinessNoUtils {
return
String
.
format
(
"%6s"
,
no
).
replace
(
' '
,
'0'
);
return
String
.
format
(
"%6s"
,
no
).
replace
(
' '
,
'0'
);
}
}
// 生成6位随机数字(000000~999999)
/**
private
static
String
generateRandomSerial
()
{
* 获取业务编号中的前缀部分(用于数据库查询)
int
random
=
ThreadLocalRandom
.
current
().
nextInt
(
1000000
);
* @param billingYearMonth 出账年月
return
String
.
format
(
"%06d"
,
random
);
* @param referrerInnerNo 转介人内部编号
* @return 前缀字符串(12位)
*/
public
static
String
getPrefix
(
String
billingYearMonth
,
String
referrerInnerNo
)
{
return
billingYearMonth
+
formatReferrerInnerNo
(
referrerInnerNo
);
}
}
}
}
\ No newline at end of file
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedExportNewDTO.java
View file @
bdfc676e
...
@@ -186,11 +186,23 @@ public class CommissionExpectedExportNewDTO {
...
@@ -186,11 +186,23 @@ public class CommissionExpectedExportNewDTO {
@ExcelProperty
(
"期交保费"
)
@ExcelProperty
(
"期交保费"
)
private
String
premium
;
private
String
premium
;
// /**
// * 入账检核记录-通用备注
// */
// @ExcelProperty("备注")
// private String realRemark;
/**
* 人工备注
*/
@ExcelProperty
(
"人工备注"
)
private
String
manualRemark
;
/**
/**
*
入账检核记录-通用
备注
*
系统
备注
*/
*/
@ExcelProperty
(
"备注"
)
@ExcelProperty
(
"备注"
)
private
String
re
alRe
mark
;
private
String
remark
;
/**
/**
* 入账检核记录-更新人名称
* 入账检核记录-更新人名称
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionExpectedNewVO.java
View file @
bdfc676e
...
@@ -16,6 +16,18 @@ import java.util.List;
...
@@ -16,6 +16,18 @@ import java.util.List;
@Data
@Data
@Schema
(
description
=
"预计来佣响应"
)
@Schema
(
description
=
"预计来佣响应"
)
public
class
CommissionExpectedNewVO
implements
Serializable
{
public
class
CommissionExpectedNewVO
implements
Serializable
{
/**
* 预计来佣业务id
*/
private
String
commissionExpectedBizId
;
/**
* 保单来佣业务id
*/
private
String
commissionBizId
;
//===========公共字段=============
//===========公共字段=============
/**
/**
* 是否实收:1-预计(预计来佣记录) 2-实收(保单来佣表记录)*
* 是否实收:1-预计(预计来佣记录) 2-实收(保单来佣表记录)*
...
@@ -72,6 +84,11 @@ public class CommissionExpectedNewVO implements Serializable {
...
@@ -72,6 +84,11 @@ public class CommissionExpectedNewVO implements Serializable {
private
Integer
totalPeriod
;
private
Integer
totalPeriod
;
/**
/**
* 预计来佣-入账项目类型(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)
*/
private
String
commissionType
;
/**
* 预计来佣-来佣名称(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)
* 预计来佣-来佣名称(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)
*/
*/
// @Schema(description = "来佣名称(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)")
// @Schema(description = "来佣名称(1:销售拥金;2:销售奖金;3:销售津贴;4:续期佣金;5:服务津贴;等等)")
...
@@ -81,13 +98,18 @@ public class CommissionExpectedNewVO implements Serializable {
...
@@ -81,13 +98,18 @@ public class CommissionExpectedNewVO implements Serializable {
* 预计来佣-入账年月(估) * (预计来佣日期)
* 预计来佣-入账年月(估) * (预计来佣日期)
*/
*/
// @Schema(description = "入账年月(估)")
// @Schema(description = "入账年月(估)")
@JsonFormat
(
pattern
=
"yyyyMM"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy
-
MM"
,
timezone
=
"GMT+8"
)
private
Date
commissionDateMonth
;
private
Date
commissionDateMonth
;
/**
/**
* 预计来佣-入账日(同预计来佣表commissionDate)
*/
private
Date
commissionExpectedDate
;
/**
* 入账检核记录-入账年月实(来佣日期 yyyyMM)
* 入账检核记录-入账年月实(来佣日期 yyyyMM)
*/
*/
@JsonFormat
(
pattern
=
"yyyyMM"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy
-
MM"
,
timezone
=
"GMT+8"
)
private
Date
commissionDate
;
private
Date
commissionDate
;
/**
/**
...
@@ -151,6 +173,11 @@ public class CommissionExpectedNewVO implements Serializable {
...
@@ -151,6 +173,11 @@ public class CommissionExpectedNewVO implements Serializable {
private
BigDecimal
expectedAmount
;
private
BigDecimal
expectedAmount
;
/**
/**
* 预计来佣-入账金额
*/
private
BigDecimal
amount
;
/**
* 预计来佣-结算汇率(估)
* 预计来佣-结算汇率(估)
*/
*/
// @Schema(description = "结算汇率(估)")
// @Schema(description = "结算汇率(估)")
...
@@ -180,16 +207,15 @@ public class CommissionExpectedNewVO implements Serializable {
...
@@ -180,16 +207,15 @@ public class CommissionExpectedNewVO implements Serializable {
private
String
policyCurrency
;
private
String
policyCurrency
;
/**
/**
* 预计来佣-
期交保费
* 预计来佣-
入账币种
*/
*/
// @Schema(description = "期交保费")
private
String
currency
;
private
Object
premium
;
/**
/**
*
入账检核记录-通用备注
*
预计来佣-期交保费
*/
*/
// @Schema(description = "
备注
")
// @Schema(description = "
期交保费
")
private
String
realRemark
;
private
Object
premium
;
/**
/**
* 入账检核记录-更新人名称
* 入账检核记录-更新人名称
...
@@ -203,9 +229,20 @@ public class CommissionExpectedNewVO implements Serializable {
...
@@ -203,9 +229,20 @@ public class CommissionExpectedNewVO implements Serializable {
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
realUpdateTime
;
private
Date
realUpdateTime
;
/**
* 修改理由
*/
private
String
statusDesc
;
/**
* 人工备注
*/
private
String
manualRemark
;
/**
* 通用备注
*/
private
String
remark
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/CommissionVO.java
View file @
bdfc676e
...
@@ -171,10 +171,10 @@ public class CommissionVO implements Serializable {
...
@@ -171,10 +171,10 @@ public class CommissionVO implements Serializable {
private
String
currency
;
private
String
currency
;
/**
/**
* 来佣
日期
* 来佣
年月 yyyy-MM
*/
*/
@Schema
(
description
=
"来佣
日期
"
)
@Schema
(
description
=
"来佣
年月 yyyy-MM
"
)
@JsonFormat
(
pattern
=
"yyyy-MM
-dd
"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
Date
commissionDate
;
private
Date
commissionDate
;
/**
/**
...
@@ -268,6 +268,11 @@ public class CommissionVO implements Serializable {
...
@@ -268,6 +268,11 @@ public class CommissionVO implements Serializable {
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
private
Date
updateTime
;
/**
* 人工备注
*/
private
String
manualRemark
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/FortuneVO.java
View file @
bdfc676e
...
@@ -282,17 +282,17 @@ public class FortuneVO implements Serializable {
...
@@ -282,17 +282,17 @@ public class FortuneVO implements Serializable {
private
String
status
;
private
String
status
;
/**
/**
* 出账
日
(估) / 预计发佣月
* 出账
年月
(估) / 预计发佣月
*/
*/
@Schema
(
description
=
"出账
日
(估) / 预计发佣月"
)
@Schema
(
description
=
"出账
年月
(估) / 预计发佣月"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
LocalDate
payoutDate
;
private
LocalDate
payoutDate
;
/**
/**
* 出账
日
(实)
* 出账
年月
(实)
*/
*/
@Schema
(
description
=
"出账
日
(实)"
)
@Schema
(
description
=
"出账
年月
(实)"
)
@JsonFormat
(
pattern
=
"yyyy-MM
-dd
"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM"
,
timezone
=
"GMT+8"
)
private
LocalDate
actualPayoutDate
;
private
LocalDate
actualPayoutDate
;
/**
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/vo/PayableReportVO.java
View file @
bdfc676e
...
@@ -3,6 +3,7 @@ package com.yd.csf.service.vo;
...
@@ -3,6 +3,7 @@ package com.yd.csf.service.vo;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
...
@@ -21,6 +22,18 @@ public class PayableReportVO {
...
@@ -21,6 +22,18 @@ public class PayableReportVO {
private
String
policyNo
;
private
String
policyNo
;
/**
/**
* 投保人
*/
@Schema
(
description
=
"投保人"
)
private
String
policyHolder
;
/**
* 投保人英文
*/
@Schema
(
description
=
"投保人英文"
)
private
String
policyHolderEn
;
/**
* 转介人
* 转介人
*/
*/
@Schema
(
description
=
"转介人(保单的第一位转介人)"
)
@Schema
(
description
=
"转介人(保单的第一位转介人)"
)
...
@@ -135,13 +148,13 @@ public class PayableReportVO {
...
@@ -135,13 +148,13 @@ public class PayableReportVO {
@Schema
(
description
=
"产品计划"
)
@Schema
(
description
=
"产品计划"
)
private
String
productName
;
private
String
productName
;
/**
//
/**
* 保單持有人(投保人,保单表)(中文名)
//
* 保單持有人(投保人,保单表)(中文名)
*/
//
*/
private
String
policyHolder
;
//
private String policyHolder;
//
/**
//
/**
* 保單持有人(投保人,保单表)(英文名)
//
* 保單持有人(投保人,保单表)(英文名)
*/
//
*/
private
String
policyHolderEn
;
//
private String policyHolderEn;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/vo/ReceivableReportVO.java
View file @
bdfc676e
...
@@ -141,10 +141,10 @@ public class ReceivableReportVO {
...
@@ -141,10 +141,10 @@ public class ReceivableReportVO {
private
String
policyCurrency
;
private
String
policyCurrency
;
/**
/**
* 备注
*
人工
备注
*/
*/
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"
人工
备注"
)
private
String
r
emark
;
private
String
manualR
emark
;
/**
/**
* 保單持有人(投保人,保单表)(中文名)
* 保單持有人(投保人,保单表)(中文名)
...
...
yd-csf-service/src/main/resources/mappers/CommissionExpectedMapper.xml
View file @
bdfc676e
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
(select pi.name from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insured,
(select pi.name from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insured,
(select pi.name_en from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insuredEn,
(select pi.name_en from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insuredEn,
ce.
r
emark,
ce.
manual_remark as manualR
emark,
MAX(ce.reconciliation_company) as reconciliationCompany,
MAX(ce.reconciliation_company) as reconciliationCompany,
MAX(ce.reconciliation_company_biz_id) as reconciliationCompanyBizId,
MAX(ce.reconciliation_company_biz_id) as reconciliationCompanyBizId,
ce.commission_period as commissionPeriod,
ce.commission_period as commissionPeriod,
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
(select pp.name_en from policy_policyholder pp where pp.policy_biz_id = p.policy_biz_id limit 1) as policyHolderEn,
(select pi.name from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insured,
(select pi.name from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insured,
(select pi.name_en from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insuredEn,
(select pi.name_en from policy_insurant pi where pi.policy_biz_id = p.policy_biz_id limit 1) as insuredEn,
ce.
r
emark,
ce.
manual_remark as manualR
emark,
ce.reconciliation_company as reconciliationCompany,
ce.reconciliation_company as reconciliationCompany,
ce.reconciliation_company_biz_id as reconciliationCompanyBizId,
ce.reconciliation_company_biz_id as reconciliationCompanyBizId,
ce.commission_period as commissionPeriod,
ce.commission_period as commissionPeriod,
...
...
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
View file @
bdfc676e
...
@@ -79,24 +79,11 @@
...
@@ -79,24 +79,11 @@
then round(100 - (ifnull(sum(ef.paid_amount), 0) / ifnull(sum(ef.hkd_amount), 0) * 100), 2)
then round(100 - (ifnull(sum(ef.paid_amount), 0) / ifnull(sum(ef.hkd_amount), 0) * 100), 2)
else 100
else 100
end as unpaidRatio,
end as unpaidRatio,
MAX(
first_broker.broker_name
) as broker,
MAX(
ef.broker
) as broker,
MAX(
first_broker
.broker_biz_id) as brokerBizId,
MAX(
ef
.broker_biz_id) as brokerBizId,
DATE_ADD(DATE_ADD(MAX(p.effective_date), INTERVAL 2 MONTH), INTERVAL (ef.fortune_period - 1) YEAR) as payoutDate
DATE_ADD(DATE_ADD(MAX(p.effective_date), INTERVAL 2 MONTH), INTERVAL (ef.fortune_period - 1) YEAR) as payoutDate
from expected_fortune ef
from expected_fortune ef
left join policy p on ef.policy_no = p.policy_no
left join policy p on ef.policy_no = p.policy_no
left join (
SELECT pb1.policy_no, pb1.broker_name,pb1.broker_biz_id
FROM policy_broker pb1
WHERE pb1.id = (
SELECT pb2.id
FROM policy_broker pb2
WHERE pb2.policy_no = pb1.policy_no
AND pb2.is_deleted = 0
ORDER BY pb2.id ASC
LIMIT 1
)
AND pb1.is_deleted = 0
) first_broker on ef.policy_no = first_broker.policy_no
<where>
<where>
ef.fortune_biz_type = 'R'
ef.fortune_biz_type = 'R'
<if
test=
"expectedFortuneIds != null and expectedFortuneIds.size > 0"
>
<if
test=
"expectedFortuneIds != null and expectedFortuneIds.size > 0"
>
...
@@ -182,7 +169,7 @@
...
@@ -182,7 +169,7 @@
ef.status_desc,
ef.status_desc,
ef.payout_date,
ef.payout_date,
ef.actual_payout_date,
ef.actual_payout_date,
ef.default_exchange_rate,
ef.default_exchange_rate
as exchangeRate
,
ef.original_currency,
ef.original_currency,
ef.original_amount,
ef.original_amount,
ef.original_to_hkd_rate,
ef.original_to_hkd_rate,
...
@@ -190,6 +177,8 @@
...
@@ -190,6 +177,8 @@
ef.payout_amount,
ef.payout_amount,
ef.hkd_to_payout_rate,
ef.hkd_to_payout_rate,
ef.hkd_amount,
ef.hkd_amount,
ef.hkd_amount as current_payment_hkd_amount,
ef.default_exchange_rate as exchange_rate,
ef.paid_amount,
ef.paid_amount,
ef.unpaid_amount,
ef.unpaid_amount,
ef.paid_ratio,
ef.paid_ratio,
...
@@ -242,7 +231,7 @@
...
@@ -242,7 +231,7 @@
NULL as status_desc,
NULL as status_desc,
f.payout_date,
f.payout_date,
f.actual_payout_date,
f.actual_payout_date,
f.exchange_rate
as default_exchange_rate,
NUll
as default_exchange_rate,
f.original_currency,
f.original_currency,
f.original_amount,
f.original_amount,
f.original_to_hkd_rate,
f.original_to_hkd_rate,
...
@@ -250,17 +239,19 @@
...
@@ -250,17 +239,19 @@
f.payout_amount,
f.payout_amount,
f.hkd_to_payout_rate,
f.hkd_to_payout_rate,
f.hkd_amount,
f.hkd_amount,
f.current_payment_amount as paid_amount,
NULL as current_payment_hkd_amount,
0 as unpaid_amount,
f.exchange_rate,
f.current_payment_ratio as paid_ratio,
NULL as paid_amount,
0 as unpaid_ratio,
NULL as unpaid_amount,
NULL as paid_ratio,
NULL as unpaid_ratio,
f.is_tax,
f.is_tax,
f.tax_amount,
f.tax_amount,
f.net_amount,
f.net_amount,
NULL as rule_item_biz_id,
NULL as rule_item_biz_id,
f.remark,
f.remark,
f.create_time,
f.create_time,
NULL
as creator_name,
f.reconciliation_operator
as creator_name,
f.update_time,
f.update_time,
2 as type
2 as type
FROM fortune f
FROM fortune f
...
@@ -291,10 +282,9 @@
...
@@ -291,10 +282,9 @@
ef.paid_amount,
ef.paid_amount,
ef.unpaid_amount,
ef.unpaid_amount,
ef.policy_no,
ef.policy_no,
(SELECT
SUM(p.total_payment_premium) * MAX(ef.default_exchange_rate)
(SELECT
p.total_payment_premium * ef.default_exchange_rate
FROM policy p
FROM policy p
WHERE p.policy_no = ef.policy_no
WHERE p.policy_no = ef.policy_no
LIMIT 1
) AS totalPremiumAmount
) AS totalPremiumAmount
FROM expected_fortune ef
FROM expected_fortune ef
WHERE ef.is_deleted = 0
WHERE ef.is_deleted = 0
...
...
yd-csf-service/src/main/resources/mappers/FortuneMapper.xml
View file @
bdfc676e
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
<result
property=
"shareRate"
column=
"share_rate"
/>
<result
property=
"shareRate"
column=
"share_rate"
/>
<result
property=
"fortuneName"
column=
"fortune_name"
/>
<result
property=
"fortuneName"
column=
"fortune_name"
/>
<result
property=
"fortuneType"
column=
"fortune_type"
/>
<result
property=
"fortuneType"
column=
"fortune_type"
/>
<result
property=
"
amount"
column=
"
amount"
/>
<result
property=
"
ruleAmount"
column=
"rule_
amount"
/>
<result
property=
"
currency"
column=
"
currency"
/>
<result
property=
"
ruleCurrency"
column=
"rule_
currency"
/>
<result
property=
"exchangeRate"
column=
"exchange_rate"
/>
<result
property=
"exchangeRate"
column=
"exchange_rate"
/>
<result
property=
"hkdAmount"
column=
"hkd_amount"
/>
<result
property=
"hkdAmount"
column=
"hkd_amount"
/>
<result
property=
"currentPaymentAmount"
column=
"current_payment_amount"
/>
<result
property=
"currentPaymentAmount"
column=
"current_payment_amount"
/>
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
id,fortune_biz_id,expected_fortune_biz_id,payable_no,reconciliation_year_month,fortune_biz_type,batch_biz_id,
id,fortune_biz_id,expected_fortune_biz_id,payable_no,reconciliation_year_month,fortune_biz_type,batch_biz_id,
commission_biz_id,commission_expected_biz_id,policy_no,policy_currency,fortune_period,fortune_total_period,broker_biz_id,
commission_biz_id,commission_expected_biz_id,policy_no,policy_currency,fortune_period,fortune_total_period,broker_biz_id,
team_biz_id,grade_commission_rate,share_rate,fortune_name,fortune_type,is_part,
team_biz_id,grade_commission_rate,share_rate,fortune_name,fortune_type,is_part,
amount,
currency,exchange_rate,hkd_amount,current_payment_amount,current_payment_hkd_amount,current_payment_ratio,status,payout_date,actual_payout_date,is_tax,
rule_amount,rule_
currency,exchange_rate,hkd_amount,current_payment_amount,current_payment_hkd_amount,current_payment_ratio,status,payout_date,actual_payout_date,is_tax,
tax_amount,net_amount,salary_biz_id,base_rule_biz_id,settlement_biz_id,reconciliation_operator,
tax_amount,net_amount,salary_biz_id,base_rule_biz_id,settlement_biz_id,reconciliation_operator,
calculation_formula,remark,is_deleted,creator_id,updater_id,
calculation_formula,remark,is_deleted,creator_id,updater_id,
create_time,update_time
create_time,update_time
...
@@ -71,7 +71,17 @@
...
@@ -71,7 +71,17 @@
from expected_fortune where status = '0' and policy_no = f.policy_no
from expected_fortune where status = '0' and policy_no = f.policy_no
),0) AS pendingOutAmount,
),0) AS pendingOutAmount,
IFNULL(SUM(CASE WHEN f.status in ('6','1') THEN f.current_payment_hkd_amount ELSE 0 END),0) AS availableOutAmount,
IFNULL(SUM(CASE WHEN f.status in ('6','1') THEN f.current_payment_hkd_amount ELSE 0 END),0) AS availableOutAmount,
COUNT(DISTINCT f.policy_no) AS totalPolicyCount
(SELECT COUNT(DISTINCT f2.policy_no)
FROM fortune f2
WHERE 1 = 1
<if
test=
"fortuneIdList != null and fortuneIdList.size() > 0"
>
AND f2.id IN
<foreach
collection=
"fortuneIdList"
item=
"fortuneId"
open=
"("
close=
")"
separator=
","
>
#{fortuneId}
</foreach>
</if>
AND f2.is_part in (0,1)
) AS totalPolicyCount
FROM fortune f
FROM fortune f
WHERE 1 = 1
WHERE 1 = 1
<if
test=
"fortuneIdList != null and fortuneIdList.size() > 0"
>
<if
test=
"fortuneIdList != null and fortuneIdList.size() > 0"
>
...
...
yd-csf-service/src/main/resources/mappers/PolicyFollowMapper.xml
View file @
bdfc676e
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
<result
property=
"status"
column=
"status"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"nextStatusList"
column=
"next_status_list"
/>
<result
property=
"nextStatusList"
column=
"next_status_list"
/>
<result
property=
"policyHolder"
column=
"policy_holder"
/>
<result
property=
"policyHolder"
column=
"policy_holder"
/>
<result
property=
"policyHolderEn"
column=
"policy_holder_en"
/>
<result
property=
"insured"
column=
"insured"
/>
<result
property=
"insured"
column=
"insured"
/>
<result
property=
"insuredBizId"
column=
"insured_biz_id"
/>
<result
property=
"insuredBizId"
column=
"insured_biz_id"
/>
<result
property=
"insuredAge"
column=
"insured_age"
/>
<result
property=
"insuredAge"
column=
"insured_age"
/>
...
@@ -95,7 +96,7 @@
...
@@ -95,7 +96,7 @@
each_issue_premium,is_prepay,is_traceable,retroactive_date,prepaid_term,
each_issue_premium,is_prepay,is_traceable,retroactive_date,prepaid_term,
prepaid_amount,prepaid_amount_after_discount,policy_expiration_date,payment_number,product_launch_biz_id,
prepaid_amount,prepaid_amount_after_discount,policy_expiration_date,payment_number,product_launch_biz_id,
product_name,product_cate,category_code,insurance_company,insurance_company_biz_id,reconciliation_company,insurance_category_biz_id,
product_name,product_cate,category_code,insurance_company,insurance_company_biz_id,reconciliation_company,insurance_category_biz_id,
reconciliation_company_biz_id,status,next_status_list,policy_holder,insured,insured_biz_id,
reconciliation_company_biz_id,status,next_status_list,policy_holder,
policy_holder_en,
insured,insured_biz_id,
insured_age,grace_period,is_join,policy_currency,initial_payment_method,
insured_age,grace_period,is_join,policy_currency,initial_payment_method,
initial_premium,initial_premium_total,initial_payment_status,initial_premium_discount,
initial_premium,initial_premium_total,initial_payment_status,initial_premium_discount,
mailing_method,renewal_payment_method,dividend_distribution_method,delivery_no,
mailing_method,renewal_payment_method,dividend_distribution_method,delivery_no,
...
@@ -181,8 +182,8 @@
...
@@ -181,8 +182,8 @@
</if>
</if>
)
)
</if>
</if>
<if
test=
"signer
!= null and signer
!= ''"
>
<if
test=
"signer
Sc != null and signerSc
!= ''"
>
and pf.signer
like concat('%', #{signer
}, '%')
and pf.signer
_sc like concat('%', #{signerSc
}, '%')
</if>
</if>
<if
test=
"brokerName != null and brokerName != ''"
>
<if
test=
"brokerName != null and brokerName != ''"
>
and first_broker.broker_name like concat('%', #{brokerName}, '%')
and first_broker.broker_name like concat('%', #{brokerName}, '%')
...
...
yd-csf-service/src/main/resources/mappers/SalarySplitMapper.xml
View file @
bdfc676e
...
@@ -54,6 +54,9 @@
...
@@ -54,6 +54,9 @@
<if
test=
"request.billOrg != null and request.billOrg != ''"
>
<if
test=
"request.billOrg != null and request.billOrg != ''"
>
and ss.bill_org like concat('%', #{request.billOrg}, '%')
and ss.bill_org like concat('%', #{request.billOrg}, '%')
</if>
</if>
<if
test=
"request.businessNo != null and request.businessNo != ''"
>
and fa.business_no like concat('%', #{request.businessNo}, '%')
</if>
and ss.is_deleted = 0
and ss.is_deleted = 0
</where>
</where>
</select>
</select>
...
@@ -83,6 +86,9 @@
...
@@ -83,6 +86,9 @@
<if
test=
"request.billOrg != null and request.billOrg != ''"
>
<if
test=
"request.billOrg != null and request.billOrg != ''"
>
and ss.bill_org like concat('%', #{request.billOrg}, '%')
and ss.bill_org like concat('%', #{request.billOrg}, '%')
</if>
</if>
<if
test=
"request.businessNo != null and request.businessNo != ''"
>
and fa.business_no like concat('%', #{request.businessNo}, '%')
</if>
and ss.is_deleted = 0
and ss.is_deleted = 0
</where>
</where>
</select>
</select>
...
...
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