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
3848bb2f
Commit
3848bb2f
authored
Apr 20, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
93ff6104
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1038 additions
and
152 deletions
+1038
-152
src/main/java/com/yd/csf/service/com/yd/csf/service/controller/AgentAccumulatedFycController.java
+18
-0
src/main/java/com/yd/csf/service/com/yd/csf/service/dao/AgentAccumulatedFycMapper.java
+16
-0
src/main/java/com/yd/csf/service/com/yd/csf/service/mappers/AgentAccumulatedFycMapper.xml
+5
-0
src/main/java/com/yd/csf/service/com/yd/csf/service/model/AgentAccumulatedFyc.java
+153
-0
src/main/java/com/yd/csf/service/com/yd/csf/service/service/IAgentAccumulatedFycService.java
+16
-0
src/main/java/com/yd/csf/service/com/yd/csf/service/service/impl/AgentAccumulatedFycServiceImpl.java
+20
-0
yd-csf-api/src/main/java/com/yd/csf/api/async/ApiExpectedFortuneAsyncService.java
+217
-104
yd-csf-api/src/main/java/com/yd/csf/api/controller/AgentAccumulatedFycLogController.java
+18
-0
yd-csf-api/src/main/java/com/yd/csf/api/dto/AlgorithmCollectResDto.java
+15
-5
yd-csf-api/src/main/java/com/yd/csf/api/handler/CalmSendJobHandler.java
+102
-22
yd-csf-api/src/main/java/com/yd/csf/api/service/ApiAgentDetailFycService.java
+1
-0
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
+19
-3
yd-csf-feign/src/main/java/com/yd/csf/feign/enums/FycSourceTypeEnum.java
+29
-0
yd-csf-feign/src/main/java/com/yd/csf/feign/enums/OprSourceEnum.java
+30
-0
yd-csf-service/src/main/java/com/yd/csf/service/dao/AgentAccumulatedFycLogMapper.java
+16
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/QueryPolicyAndBrokerDto.java
+2
-2
yd-csf-service/src/main/java/com/yd/csf/service/model/AgentAccumulatedFyc.java
+57
-6
yd-csf-service/src/main/java/com/yd/csf/service/model/AgentAccumulatedFycLog.java
+171
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/AgentDetailFyc.java
+15
-3
yd-csf-service/src/main/java/com/yd/csf/service/model/CalmTask.java
+16
-4
yd-csf-service/src/main/java/com/yd/csf/service/model/MemberGradeConfig.java
+12
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/IAgentAccumulatedFycLogService.java
+16
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/IAgentAccumulatedFycService.java
+4
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/IAgentDetailFycService.java
+1
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/IMemberGradeConfigService.java
+3
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/AgentAccumulatedFycLogServiceImpl.java
+20
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/AgentAccumulatedFycServiceImpl.java
+11
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/AgentDetailFycServiceImpl.java
+6
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CalmTaskServiceImpl.java
+3
-1
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/MemberGradeConfigServiceImpl.java
+20
-0
yd-csf-service/src/main/java/com/yd/csf/service/utils/MyBatisPlusCodeGenerator.java
+1
-1
yd-csf-service/src/main/resources/mappers/AgentAccumulatedFycLogMapper.xml
+5
-0
No files found.
src/main/java/com/yd/csf/service/com/yd/csf/service/controller/AgentAccumulatedFycController.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息 前端控制器
* </p>
*
* @author zxm
* @since 2026-04-16
*/
@RestController
@RequestMapping
(
"/agentAccumulatedFyc"
)
public
class
AgentAccumulatedFycController
{
}
src/main/java/com/yd/csf/service/com/yd/csf/service/dao/AgentAccumulatedFycMapper.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
dao
;
import
com.yd.csf.service.model.AgentAccumulatedFyc
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* 业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息 Mapper 接口
* </p>
*
* @author zxm
* @since 2026-04-16
*/
public
interface
AgentAccumulatedFycMapper
extends
BaseMapper
<
AgentAccumulatedFyc
>
{
}
src/main/java/com/yd/csf/service/com/yd/csf/service/mappers/AgentAccumulatedFycMapper.xml
0 → 100644
View file @
3848bb2f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yd.csf.service.dao.AgentAccumulatedFycMapper"
>
</mapper>
src/main/java/com/yd/csf/service/com/yd/csf/service/model/AgentAccumulatedFyc.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* <p>
* 业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息
* </p>
*
* @author zxm
* @since 2026-04-16
*/
@Getter
@Setter
@TableName
(
"agent_accumulated_fyc"
)
public
class
AgentAccumulatedFyc
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键ID
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 业务员ID(会员唯一业务ID)
*/
@TableField
(
"agent_id"
)
private
String
agentId
;
/**
* 未生效累计积分(不限业务场景)
*/
@TableField
(
"no_effect"
)
private
BigDecimal
noEffect
;
/**
* 已生效累计积分(不限业务场景)
*/
@TableField
(
"effect"
)
private
BigDecimal
effect
;
/**
* 累计积分 = 未生效累计积分 + 已生效累计积分
*/
@TableField
(
"total_fyc"
)
private
BigDecimal
totalFyc
;
/**
* 已生效累计首期佣金积分值(佣金场景)
*/
@TableField
(
"first_commission"
)
private
BigDecimal
firstCommission
;
/**
* 未生效累计首期佣金积分值(佣金场景)
*/
@TableField
(
"no_first_commission"
)
private
BigDecimal
noFirstCommission
;
/**
* 已生效累计非首期佣金积分值(佣金场景)
*/
@TableField
(
"ryc"
)
private
BigDecimal
ryc
;
/**
* 未生效累计非首期佣金积分值(佣金场景)
*/
@TableField
(
"no_ryc"
)
private
BigDecimal
noRyc
;
/**
* 晋升职级累计积分 = 已生效累计积分 - 已生效累计非首期佣金积分值
*/
@TableField
(
"promotion"
)
private
BigDecimal
promotion
;
/**
* 当前等级,业务员当前的会员等级编码(会员等级配置表等级编码)
*/
@TableField
(
"current_grade_code"
)
private
String
currentGradeCode
;
/**
* 最后计算日期,记录最后一次计算累计FYC的日期
*/
@TableField
(
"last_calc_date"
)
private
LocalDateTime
lastCalcDate
;
/**
* 状态(0:停用 1:启用)
*/
@TableField
(
"status"
)
private
Byte
status
;
/**
* 所属租户唯一业务ID(冗余)
*/
@TableField
(
"tenant_biz_id"
)
private
String
tenantBizId
;
/**
* 所属项目唯一业务ID(冗余)
*/
@TableField
(
"project_biz_id"
)
private
String
projectBizId
;
/**
* 通用备注
*/
@TableField
(
"remark"
)
private
String
remark
;
/**
* 删除标识: 0-正常, 1-删除
*/
@TableField
(
"is_deleted"
)
private
Boolean
isDeleted
;
/**
* 创建人ID
*/
@TableField
(
"creator_id"
)
private
String
creatorId
;
/**
* 更新人ID
*/
@TableField
(
"updater_id"
)
private
String
updaterId
;
/**
* 创建时间
*/
@TableField
(
"create_time"
)
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
@TableField
(
"update_time"
)
private
LocalDateTime
updateTime
;
}
src/main/java/com/yd/csf/service/com/yd/csf/service/service/IAgentAccumulatedFycService.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
service
;
import
com.yd.csf.service.model.AgentAccumulatedFyc
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* <p>
* 业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息 服务类
* </p>
*
* @author zxm
* @since 2026-04-16
*/
public
interface
IAgentAccumulatedFycService
extends
IService
<
AgentAccumulatedFyc
>
{
}
src/main/java/com/yd/csf/service/com/yd/csf/service/service/impl/AgentAccumulatedFycServiceImpl.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
com.yd.csf.service.model.AgentAccumulatedFyc
;
import
com.yd.csf.service.dao.AgentAccumulatedFycMapper
;
import
com.yd.csf.service.service.IAgentAccumulatedFycService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* 业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息 服务实现类
* </p>
*
* @author zxm
* @since 2026-04-16
*/
@Service
public
class
AgentAccumulatedFycServiceImpl
extends
ServiceImpl
<
AgentAccumulatedFycMapper
,
AgentAccumulatedFyc
>
implements
IAgentAccumulatedFycService
{
}
yd-csf-api/src/main/java/com/yd/csf/api/async/ApiExpectedFortuneAsyncService.java
View file @
3848bb2f
...
...
@@ -7,23 +7,20 @@ import com.yd.csf.api.dto.AlgorithmCollectResDto;
import
com.yd.csf.api.dto.AlgorithmResDto
;
import
com.yd.csf.api.service.ApiExpectedFortuneService
;
import
com.yd.csf.api.service.XxlJobService
;
import
com.yd.csf.feign.enums.FycSourceTypeEnum
;
import
com.yd.csf.feign.enums.OprSourceEnum
;
import
com.yd.csf.feign.request.expectedfortune.ApiGenerateExpectedFortuneRequest
;
import
com.yd.csf.feign.response.expectedfortune.ApiGenerateExpectedFortuneResponse
;
import
com.yd.csf.service.model.CalmTask
;
import
com.yd.csf.service.model.Policy
;
import
com.yd.csf.service.model.PolicyFollow
;
import
com.yd.csf.service.service.ICalmTaskService
;
import
com.yd.csf.service.service.PolicyFollowService
;
import
com.yd.csf.service.service.PolicyService
;
import
com.yd.csf.service.model.*
;
import
com.yd.csf.service.service.*
;
import
com.yd.feign.config.FeignTokenInterceptor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.
apache.commons.lang3.String
Utils
;
import
org.
springframework.beans.Bean
Utils
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
...
...
@@ -44,11 +41,15 @@ public class ApiExpectedFortuneAsyncService {
@Resource
private
PolicyFollowService
policyFollowService
;
@Resource
private
PolicyService
policyService
;
@Resource
private
ICalmTaskService
iCalmTaskService
;
@Resource
private
XxlJobService
xxlJobService
;
@Resource
private
IAgentAccumulatedFycService
iAgentAccumulatedFycService
;
@Resource
private
IAgentDetailFycService
iAgentDetailFycService
;
@Resource
private
IAgentAccumulatedFycLogService
iAgentAccumulatedFycLogService
;
/**
* 异步处理-执行预计发拥数据
...
...
@@ -80,21 +81,6 @@ public class ApiExpectedFortuneAsyncService {
}
}
// /**
// * 异步处理-构建冷静期定时任务
// * @param collectResDtos
// */
// @Async("commonAsyncExecutor")
// public void buildCalmDateTask(List<AlgorithmCollectResDto> collectResDtos,String policyNo){
// //collectResDtos要分组,分组条件是clientUserBizId,sumCalculatedValue和commissionName需要分组统计计算,拿到分组后的创建新的List<AlgorithmCollectResDto>返回
//
// }
/**
* 异步处理-构建冷静期定时任务
* @param collectResDtos 原始计算结果收集列表
* @param policyNo 保单号
*/
@Async
(
"commonAsyncExecutor"
)
public
void
buildCalmDateTask
(
List
<
AlgorithmCollectResDto
>
collectResDtos
,
String
policyNo
)
{
if
(
CollectionUtils
.
isEmpty
(
collectResDtos
))
{
...
...
@@ -102,113 +88,239 @@ public class ApiExpectedFortuneAsyncService {
return
;
}
//新单跟进对象
//
新单跟进对象
PolicyFollow
policyFollow
=
policyFollowService
.
queryOneByPolicyNo
(
policyNo
);
//保单对象
// Policy policy = policyService.queryOne(policyNo);
if
(
policyFollow
==
null
)
{
log
.
warn
(
"未找到保单跟进记录,policyNo: {}"
,
policyNo
);
return
;
}
// 按 clientUserBizId 分组,计算每个用户的 sumCalculatedValue 和 commissionName
Map
<
String
,
AlgorithmCollectResDto
>
groupedMap
=
collectResDtos
.
stream
()
.
filter
(
dto
->
StringUtils
.
isNotBlank
(
dto
.
getClientUserBizId
()))
.
collect
(
Collectors
.
toMap
(
AlgorithmCollectResDto:
:
getClientUserBizId
,
Function
.
identity
(),
(
existing
,
replacement
)
->
{
// 合并:累加 sumCalculatedValue,合并 commissionName
BigDecimal
sum1
=
existing
.
getSumCalculatedValue
()
!=
null
?
existing
.
getSumCalculatedValue
()
:
BigDecimal
.
ZERO
;
BigDecimal
sum2
=
calculateSumFromResList
(
replacement
.
getAlgorithmResDtoList
());
existing
.
setSumCalculatedValue
(
sum1
.
add
(
sum2
));
// 过滤掉 calculatedValue 为 0 的项,并收集所有有效的 AlgorithmResDto,返回新的List<AlgorithmCollectResDto>
List
<
AlgorithmCollectResDto
>
filteredCollectResDtos
=
collectResDtos
.
stream
()
.
map
(
dto
->
{
List
<
AlgorithmResDto
>
originalList
=
dto
.
getAlgorithmResDtoList
();
if
(
CollectionUtils
.
isEmpty
(
originalList
))
{
return
null
;
}
List
<
AlgorithmResDto
>
validList
=
originalList
.
stream
()
.
filter
(
res
->
res
.
getCalculatedValue
()
!=
null
&&
res
.
getCalculatedValue
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
.
collect
(
Collectors
.
toList
());
if
(
validList
.
isEmpty
())
{
return
null
;
}
// 创建新对象
AlgorithmCollectResDto
newDto
=
new
AlgorithmCollectResDto
();
BeanUtils
.
copyProperties
(
dto
,
newDto
);
newDto
.
setAlgorithmResDtoList
(
validList
);
return
newDto
;
})
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toList
());
String
commission1
=
existing
.
getCommissionName
()
!=
null
?
existing
.
getCommissionName
()
:
""
;
String
commission2
=
buildCommissionName
(
replacement
.
getAlgorithmResDtoList
());
existing
.
setCommissionName
(
mergeCommissionNames
(
commission1
,
commission2
));
return
existing
;
if
(
CollectionUtils
.
isEmpty
(
filteredCollectResDtos
))
{
log
.
info
(
"过滤后无有效发佣数据,policyNo: {}"
,
policyNo
);
return
;
}
));
// 构造calmTask列表返回
List
<
CalmTask
>
resultList
=
groupedMap
.
values
().
stream
().
map
(
dto
->
{
//计算合计值
BigDecimal
totalSum
=
dto
.
getSumCalculatedValue
();
if
(
totalSum
==
null
||
(
totalSum
!=
null
&&
totalSum
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
//计算合计值为空或者0,直接返回null,不构造此CalmTask对象。
return
null
;
//去重获取转介人业务ID列表
List
<
String
>
clientUserBizIdList
=
filteredCollectResDtos
.
stream
()
.
map
(
AlgorithmCollectResDto:
:
getClientUserBizId
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
//查询转介人对应累计积分
List
<
AgentAccumulatedFyc
>
accumulatedFycList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
clientUserBizIdList
))
{
accumulatedFycList
=
iAgentAccumulatedFycService
.
queryList
(
clientUserBizIdList
);
}
//循环,构建同保单号多个转介人多个期数多个佣金项目的冷静期定时任务记录和积分明细记录
for
(
AlgorithmCollectResDto
resDto
:
filteredCollectResDtos
)
{
if
(
CollectionUtils
.
isEmpty
(
resDto
.
getAlgorithmResDtoList
()))
{
continue
;
}
List
<
AgentAccumulatedFyc
>
filterList
=
accumulatedFycList
.
stream
()
.
filter
(
dto
->
dto
.
getAgentId
().
equals
(
resDto
.
getClientUserBizId
()))
.
collect
(
Collectors
.
toList
());
AgentAccumulatedFyc
agentAccumulatedFyc
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
filterList
))
{
agentAccumulatedFyc
=
filterList
.
get
(
0
);
}
for
(
AlgorithmResDto
algorithmResDto
:
resDto
.
getAlgorithmResDtoList
())
{
CalmTask
calmTask
=
new
CalmTask
();
calmTask
.
setBrokerBizId
(
dto
.
getClientUserBizId
());
calmTask
.
setBrokerName
(
dto
.
getClientUserName
());
//当前保单转介人累计FYC(当前保单转介人基本法计算积分合值)
calmTask
.
setTotalFyc
(
totalSum
);
calmTask
.
setCommissionName
(
dto
.
getCommissionName
());
//执行状态->未执行
calmTask
.
setExecutionStatus
(
"0"
);
calmTask
.
setCalmTaskBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_CALM_TASK
.
getCode
()));
//保单号
calmTask
.
setPolicyNo
(
policyNo
);
//新单跟进唯一业务ID
calmTask
.
setPolicyBizId
(
policyFollow
.
getPolicyBizId
());
//执行时间(定时任务执行时间) = 积分解冻时间
calmTask
.
setExecutionTime
(
resDto
.
getThawingTime
());
//冷静期天数
calmTask
.
setCoolingOffDays
(
policyFollow
.
getCoolingOffDays
());
//保单冷静期定时任务表唯一业务ID
calmTask
.
setCalmTaskBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_CALM_TASK
.
getCode
()));
//执行状态(0-未执行,1-执行中,2-已执行,3-执行异常)
//0-未执行
calmTask
.
setExecutionStatus
(
"0"
);
//转介人名称
calmTask
.
setBrokerName
(
resDto
.
getClientUserName
());
//转介人业务id
calmTask
.
setBrokerBizId
(
resDto
.
getClientUserBizId
());
//佣金项目
calmTask
.
setCommissionName
(
algorithmResDto
.
getItemName
());
//发佣期数
calmTask
.
setFortunePeriod
(
resDto
.
getFortunePeriod
());
//佣金值(积分值)
calmTask
.
setFyc
(
algorithmResDto
.
getCalculatedValue
());
//冷静期结束日期
calmTask
.
setCoolingOffEndDate
(
policyFollow
.
getCoolingOffEndDate
());
//执行时间(定时任务执行时间)
calmTask
.
setExecutionTime
(
policyFollow
.
getCoolingOffEndDate
().
toInstant
()
.
atZone
(
ZoneId
.
of
(
"Asia/Shanghai"
))
.
toLocalDateTime
());
//新单跟进唯一业务ID
calmTask
.
setPolicyBizId
(
policyFollow
.
getPolicyBizId
());
//保单号
calmTask
.
setPolicyNo
(
policyNo
);
return
calmTask
;
}).
collect
(
Collectors
.
toList
());
iCalmTaskService
.
saveOrUpdateBatch
(
resultList
);
log
.
info
(
"完成基本法分组计算,policyNo: {}, 分组后用户数: {}"
,
policyNo
,
resultList
.
size
());
//业务员积分明细表唯一业务ID
String
detailFycBizId
=
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_AGENT_DETAIL_FYC
.
getCode
());
calmTask
.
setDetailFycBizId
(
detailFycBizId
);
iCalmTaskService
.
saveOrUpdate
(
calmTask
);
//新增积分明细
addAgentDetailFyc
(
resDto
,
policyNo
,
algorithmResDto
,
detailFycBizId
,
agentAccumulatedFyc
);
// 构建冷静期定时任务逻辑
//创建XXL-Job定时任务
if
(
CollectionUtils
.
isNotEmpty
(
resultList
))
{
//循环创建定时任务(多个冷静期的定时任务)
for
(
CalmTask
calmTask
:
resultList
)
{
xxlJobService
.
addScheduleJob
(
calmTask
.
getCalmTaskBizId
(),
"冷静期定时发送任务-"
,
"calmSendJobHandler"
,
calmTask
.
getCoolingOffEndDate
());
xxlJobService
.
addScheduleJob
(
calmTask
.
getCalmTaskBizId
(),
"冷静期定时发送任务-"
,
"calmSendJobHandler"
,
Date
.
from
(
resDto
.
getThawingTime
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()));
}
}
//更新积分总表的值
updateAgentAccumulatedFyc
(
accumulatedFycList
,
filteredCollectResDtos
);
}
/**
* 从 AlgorithmResDto 列表中计算所有 calculatedValue 的总和
* 新增积分明细
* @param resDto
* @param policyNo
* @param algorithmResDto
* @param detailFycBizId
* @param agentAccumulatedFyc
*/
private
BigDecimal
calculateSumFromResList
(
List
<
AlgorithmResDto
>
resDtoList
)
{
if
(
CollectionUtils
.
isEmpty
(
resDtoList
))
{
return
BigDecimal
.
ZERO
;
}
return
resDtoList
.
stream
()
.
map
(
AlgorithmResDto:
:
getCalculatedValue
)
.
filter
(
Objects:
:
nonNull
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
public
void
addAgentDetailFyc
(
AlgorithmCollectResDto
resDto
,
String
policyNo
,
AlgorithmResDto
algorithmResDto
,
String
detailFycBizId
,
AgentAccumulatedFyc
agentAccumulatedFyc
)
{
//新增积分明细
AgentDetailFyc
agentDetailFyc
=
new
AgentDetailFyc
();
//积分来源类型
agentDetailFyc
.
setSourceType
(
FycSourceTypeEnum
.
CALM_TASK
.
getItemValue
());
//业务员ID
agentDetailFyc
.
setAgentId
(
resDto
.
getClientUserBizId
());
//积分提供的保单号
agentDetailFyc
.
setPolicyNo
(
policyNo
);
//积分来源基本法项目配置表唯一业务ID
agentDetailFyc
.
setRuleItemBizId
(
algorithmResDto
.
getRuleItemBizId
());
//业务员积分明细表唯一业务ID
agentDetailFyc
.
setDetailFycBizId
(
detailFycBizId
);
//状态(0:停用(冻结) 1:启用(生效))
//冻结
agentDetailFyc
.
setStatus
(
0
);
//积分解冻时间
agentDetailFyc
.
setThawingTime
(
resDto
.
getThawingTime
());
//变化前的业务员总FYC积分(已生效+未生效)
agentDetailFyc
.
setBeforeFyc
(
agentAccumulatedFyc
!=
null
?
agentAccumulatedFyc
.
getTotalFyc
()
:
BigDecimal
.
ZERO
);
//变化值(-代表减少)
agentDetailFyc
.
setChangeFyc
(
algorithmResDto
.
getCalculatedValue
().
toString
());
//变化后的业务员总FYC积分
agentDetailFyc
.
setAfterFyc
(
agentDetailFyc
.
getBeforeFyc
().
add
(
algorithmResDto
.
getCalculatedValue
()));
iAgentDetailFycService
.
saveOrUpdate
(
agentDetailFyc
);
}
/**
* 从 AlgorithmResDto 列表中构建去重后的佣金项目名称(分号拼接)
* 更新积分总表的值
* @param accumulatedFycList
* @param filteredCollectResDtos
*/
private
String
buildCommissionName
(
List
<
AlgorithmResDto
>
resDtoList
)
{
if
(
CollectionUtils
.
isEmpty
(
resDtoList
))
{
return
""
;
public
void
updateAgentAccumulatedFyc
(
List
<
AgentAccumulatedFyc
>
accumulatedFycList
,
List
<
AlgorithmCollectResDto
>
filteredCollectResDtos
)
{
//更新积分总表的值,更新这个accumulatedFycList的每个对象里面的:未生效累计积分(不限业务场景)、累计积分 = 未生效累计积分 + 已生效累计积分、未生效累计首期佣金积分值(佣金场景)、未生效累计非首期佣金积分值(佣金场景)
// 将查询到的累计积分列表转为 Map(便于更新)
Map
<
String
,
AgentAccumulatedFyc
>
fycMap
=
accumulatedFycList
.
stream
()
.
collect
(
Collectors
.
toMap
(
AgentAccumulatedFyc:
:
getAgentId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
// 构建每个转介人本次的积分增量 Map
// 未生效累计积分增量
Map
<
String
,
BigDecimal
>
noEffectDeltaMap
=
new
HashMap
<>();
// 未生效首期佣金增量
Map
<
String
,
BigDecimal
>
noFirstCommissionDeltaMap
=
new
HashMap
<>();
// 未生效非首期佣金增量
Map
<
String
,
BigDecimal
>
noRycDeltaMap
=
new
HashMap
<>();
for
(
AlgorithmCollectResDto
resDto
:
filteredCollectResDtos
)
{
String
agentId
=
resDto
.
getClientUserBizId
();
Integer
fortunePeriod
=
resDto
.
getFortunePeriod
();
for
(
AlgorithmResDto
algorithmResDto
:
resDto
.
getAlgorithmResDtoList
())
{
BigDecimal
val
=
algorithmResDto
.
getCalculatedValue
();
if
(
val
==
null
)
continue
;
// 累加 noEffect 增量
noEffectDeltaMap
.
merge
(
agentId
,
val
,
BigDecimal:
:
add
);
// 根据期数判断佣金类型
if
(
fortunePeriod
!=
null
&&
fortunePeriod
==
1
)
{
noFirstCommissionDeltaMap
.
merge
(
agentId
,
val
,
BigDecimal:
:
add
);
}
else
{
noRycDeltaMap
.
merge
(
agentId
,
val
,
BigDecimal:
:
add
);
}
}
return
resDtoList
.
stream
()
.
map
(
AlgorithmResDto:
:
getItemName
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
joining
(
";"
));
}
/**
* 合并两个佣金名称字符串(去重后用分号拼接)
*/
private
String
mergeCommissionNames
(
String
name1
,
String
name2
)
{
Set
<
String
>
nameSet
=
new
LinkedHashSet
<>();
if
(
StringUtils
.
isNotBlank
(
name1
))
{
nameSet
.
addAll
(
Arrays
.
asList
(
name1
.
split
(
";"
)));
// 更新或新建累计积分记录
List
<
AgentAccumulatedFyc
>
toUpdateList
=
new
ArrayList
<>();
for
(
String
agentId
:
noEffectDeltaMap
.
keySet
())
{
BigDecimal
noEffectDelta
=
noEffectDeltaMap
.
get
(
agentId
);
BigDecimal
noFirstDelta
=
noFirstCommissionDeltaMap
.
getOrDefault
(
agentId
,
BigDecimal
.
ZERO
);
BigDecimal
noRycDelta
=
noRycDeltaMap
.
getOrDefault
(
agentId
,
BigDecimal
.
ZERO
);
AgentAccumulatedFyc
fyc
=
fycMap
.
get
(
agentId
);
if
(
fyc
==
null
)
{
continue
;
}
if
(
StringUtils
.
isNotBlank
(
name2
))
{
nameSet
.
addAll
(
Arrays
.
asList
(
name2
.
split
(
";"
)));
// 应用增量
//未生效累计积分(不限业务场景)
fyc
.
setNoEffect
(
fyc
.
getNoEffect
().
add
(
noEffectDelta
));
//未生效累计首期佣金积分值(佣金场景)
fyc
.
setNoFirstCommission
(
fyc
.
getNoFirstCommission
().
add
(
noFirstDelta
));
//未生效累计非首期佣金积分值(佣金场景)
fyc
.
setNoRyc
(
fyc
.
getNoRyc
().
add
(
noRycDelta
));
//累计积分 = 未生效累计积分 + 已生效累计积分
fyc
.
setTotalFyc
(
fyc
.
getNoEffect
().
add
(
fyc
.
getEffect
()));
toUpdateList
.
add
(
fyc
);
}
return
String
.
join
(
";"
,
nameSet
);
// 批量保存
if
(
CollectionUtils
.
isNotEmpty
(
toUpdateList
))
{
iAgentAccumulatedFycService
.
saveOrUpdateBatch
(
toUpdateList
);
log
.
info
(
"更新业务员累计积分完成,涉及人数: {}"
,
toUpdateList
.
size
());
//批量新增积分总表日志表
List
<
AgentAccumulatedFycLog
>
saveLogList
=
toUpdateList
.
stream
().
map
(
dto
->
{
AgentAccumulatedFycLog
log
=
new
AgentAccumulatedFycLog
();
BeanUtils
.
copyProperties
(
dto
,
log
);
log
.
setId
(
null
);
log
.
setFycBizId
(
dto
.
getFycBizId
());
log
.
setFycLogBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_AGENT_ACCUMULATED_FYC_LOG
.
getCode
()));
//操作来源枚举-冻结
log
.
setSourceType
(
OprSourceEnum
.
CALM_TASK_FREEZE
.
getItemValue
());
return
log
;
}).
collect
(
Collectors
.
toList
());
iAgentAccumulatedFycLogService
.
saveOrUpdateBatch
(
saveLogList
);
}
}
}
\ No newline at end of file
yd-csf-api/src/main/java/com/yd/csf/api/controller/AgentAccumulatedFycLogController.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
api
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 业务员累计积分表操作日志记录表(每次主表(累计积分表)的操作变化记录) 前端控制器
* </p>
*
* @author zxm
* @since 2026-04-17
*/
@RestController
@RequestMapping
(
"/agentAccumulatedFycLog"
)
public
class
AgentAccumulatedFycLogController
{
}
yd-csf-api/src/main/java/com/yd/csf/api/dto/AlgorithmCollectResDto.java
View file @
3848bb2f
package
com
.
yd
.
csf
.
api
.
dto
;
import
lombok.Data
;
import
java.
math.BigDecimal
;
import
java.
time.LocalDateTime
;
import
java.util.List
;
/**
...
...
@@ -21,14 +21,24 @@ public class AlgorithmCollectResDto {
private
String
clientUserName
;
/**
*
计算值-当前用户的基本法合计值(客户端用户业务ID分组后统计组内的algorithmResDtoList的里面的calculatedValue合计值)
*
发佣期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
*/
private
BigDecimal
sumCalculatedValue
;
private
Integer
fortunePeriod
;
/**
*
计算值-佣金项目(去重algorithmResDtoList的itemName通过分号拼接的
)
*
积分解冻时间(受发佣期数影响,第一年就是冷静期结束日期,第二年冷静期结束日期+1年,以此类推
)
*/
private
String
commissionName
;
private
LocalDateTime
thawingTime
;
// /**
// * 计算值-当前用户的基本法合计值(客户端用户业务ID分组后统计组内的algorithmResDtoList的里面的calculatedValue合计值)
// */
// private BigDecimal sumCalculatedValue;
//
// /**
// * 计算值-佣金项目(去重algorithmResDtoList的itemName通过分号拼接的)
// */
// private String commissionName;
/**
* 算法-基本法计算-返回的列表(当前客户端用户绑定的多个基本法类型的计算值列表)
...
...
yd-csf-api/src/main/java/com/yd/csf/api/handler/CalmSendJobHandler.java
View file @
3848bb2f
...
...
@@ -3,11 +3,20 @@ package com.yd.csf.api.handler;
import
com.alibaba.fastjson.JSON
;
import
com.xxl.job.core.context.XxlJobHelper
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
com.yd.csf.service.service.ICalmTaskService
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.csf.api.service.ApiAgentDetailFycService
;
import
com.yd.csf.feign.enums.FycSourceTypeEnum
;
import
com.yd.csf.feign.enums.OprSourceEnum
;
import
com.yd.csf.service.model.*
;
import
com.yd.csf.service.service.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.Objects
;
...
...
@@ -19,34 +28,104 @@ import java.util.Objects;
@Slf4j
public
class
CalmSendJobHandler
{
@
Autowired
@
Resource
private
ICalmTaskService
iCalmTaskService
;
@Resource
private
IAgentDetailFycService
iAgentDetailFycService
;
@Resource
private
IAgentAccumulatedFycService
iAgentAccumulatedFycService
;
@Resource
private
IAgentAccumulatedFycLogService
iAgentAccumulatedFycLogService
;
/**
* XXL-Job任务执行入口方法
*/
@XxlJob
(
"calmSendJobHandler"
)
public
void
execute
()
throws
Exception
{
// //主任务发送时间
// LocalDateTime taskSendTime = LocalDateTime.now();
// // 从XXL-Job参数中获取任务ID
// String param = XxlJobHelper.getJobParam();
// // 记录任务开始日志
// log.info("开始冷静期定时发送任务,参数: {}", param);
//
// // 解析任务参数(参数为冷静期定时任务业务ID)
// String taskBizId = param;
// // 根据冷静期定时任务业务ID查询冷静期定时任务信息
// EmailTask emailTask = iCalmTaskService.queryOne(taskBizId);
// log.info("根据邮件任务业务ID查询邮件任务信息: {}: " + JSON.toJSONString(emailTask));
//
// // 检查邮件任务是否存在
// if (Objects.isNull(emailTask)) {
// // 记录错误并返回
// XxlJobHelper.log("邮件任务不存在: " + taskBizId);
// XxlJobHelper.handleFail("邮件任务不存在");
// return;
// }
//主任务发送时间
LocalDateTime
taskSendTime
=
LocalDateTime
.
now
();
// 从XXL-Job参数中获取任务ID
String
param
=
XxlJobHelper
.
getJobParam
();
// 记录任务开始日志
log
.
info
(
"开始冷静期定时发送任务,参数: {}"
,
param
);
// 解析任务参数(参数为冷静期定时任务业务ID)
String
taskBizId
=
param
;
// 根据冷静期定时任务业务ID查询冷静期定时任务信息
CalmTask
calmTask
=
iCalmTaskService
.
queryOne
(
taskBizId
);
log
.
info
(
"根据冷静期定时发送任务业务ID查询冷静期定时任务信息: {}: "
+
JSON
.
toJSONString
(
calmTask
));
// 检查冷静期定时任务是否存在
if
(
Objects
.
isNull
(
calmTask
))
{
// 记录错误并返回
XxlJobHelper
.
log
(
"冷静期定时发送任务不存在: "
+
taskBizId
);
XxlJobHelper
.
handleFail
(
"冷静期定时发送任务不存在"
);
return
;
}
//更新保单冷静期定时任务对象字段
//执行状态: 2-已执行
calmTask
.
setExecutionStatus
(
"2"
);
iCalmTaskService
.
saveOrUpdate
(
calmTask
);
//更新保单冷静期定时任务对应的积分明细对象字段
//查询积分明细
AgentDetailFyc
agentDetailFyc
=
iAgentDetailFycService
.
queryOne
(
calmTask
.
getDetailFycBizId
());
if
(
agentDetailFyc
!=
null
)
{
//状态:生效
agentDetailFyc
.
setStatus
(
1
);
iAgentDetailFycService
.
saveOrUpdate
(
agentDetailFyc
);
}
//更新积分总表的字段(此时积分都已经生效)
//查询积分总表对象 弄好了,差一个每月1号晋升职级定时任务未开发,还有个基本法要根据保单生效日所在月对应的积分总表操作日志记录表来找出对应月的最大职级(晋升职级累计积分)(少个积分总表操作日志记录表)
AgentAccumulatedFyc
agentAccumulatedFyc
=
iAgentAccumulatedFycService
.
queryOne
(
calmTask
.
getBrokerBizId
());
if
(
agentAccumulatedFyc
!=
null
)
{
//未生效累计积分(不限业务场景)= 未生效累计积分(不限业务场景) - 增量积分
BigDecimal
noEffect
=
agentAccumulatedFyc
.
getNoEffect
().
subtract
(
calmTask
.
getFyc
());
agentAccumulatedFyc
.
setNoEffect
(
noEffect
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
?
BigDecimal
.
ZERO
:
noEffect
);
//已生效累计积分(不限业务场景) = 已生效累计积分(不限业务场景) + 增量积分
BigDecimal
effect
=
agentAccumulatedFyc
.
getEffect
().
add
(
calmTask
.
getFyc
());
agentAccumulatedFyc
.
setEffect
(
effect
);
//累计积分 = 未生效累计积分 + 已生效累计积分
agentAccumulatedFyc
.
setTotalFyc
(
agentAccumulatedFyc
.
getNoEffect
().
add
(
agentAccumulatedFyc
.
getEffect
()));
if
(
calmTask
.
getFortunePeriod
()
==
1
)
{
//首期
//已生效累计首期佣金积分值(佣金场景) = 已生效累计首期佣金积分值(佣金场景) + 增量积分
BigDecimal
firstCommission
=
agentAccumulatedFyc
.
getFirstCommission
().
add
(
calmTask
.
getFyc
());
agentAccumulatedFyc
.
setFirstCommission
(
firstCommission
);
//未生效累计首期佣金积分值(佣金场景)= 未生效累计首期佣金积分值(佣金场景)- 增量积分
BigDecimal
noFirstCommission
=
agentAccumulatedFyc
.
getNoFirstCommission
().
subtract
(
calmTask
.
getFyc
());
agentAccumulatedFyc
.
setNoFirstCommission
(
noFirstCommission
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
?
BigDecimal
.
ZERO
:
noFirstCommission
);
}
else
{
//非首期
//已生效累计非首期佣金积分值(佣金场景) = 已生效累计非首期佣金积分值(佣金场景) + 增量积分
BigDecimal
ryc
=
agentAccumulatedFyc
.
getRyc
().
add
(
calmTask
.
getFyc
());
agentAccumulatedFyc
.
setRyc
(
ryc
);
//未生效累计非首期佣金积分值(佣金场景)= 未生效累计非首期佣金积分值(佣金场景)- 增量积分
BigDecimal
noRyc
=
agentAccumulatedFyc
.
getNoRyc
().
subtract
(
calmTask
.
getFyc
());
agentAccumulatedFyc
.
setNoRyc
(
noRyc
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
?
BigDecimal
.
ZERO
:
noRyc
);
}
//晋升职级累计积分 = 已生效累计积分 - 已生效累计非首期佣金积分值
BigDecimal
promotion
=
agentAccumulatedFyc
.
getEffect
().
subtract
(
agentAccumulatedFyc
.
getRyc
());
agentAccumulatedFyc
.
setPromotion
(
promotion
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
?
BigDecimal
.
ZERO
:
promotion
);
//最后计算日期,记录最后一次计算累计FYC的日期
agentAccumulatedFyc
.
setLastCalcDate
(
LocalDateTime
.
now
());
iAgentAccumulatedFycService
.
saveOrUpdate
(
agentAccumulatedFyc
);
//新增积分总表日志表
AgentAccumulatedFycLog
log
=
new
AgentAccumulatedFycLog
();
BeanUtils
.
copyProperties
(
agentAccumulatedFyc
,
log
);
log
.
setId
(
null
);
log
.
setFycBizId
(
agentAccumulatedFyc
.
getFycBizId
());
log
.
setFycLogBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_AGENT_ACCUMULATED_FYC_LOG
.
getCode
()));
//操作来源枚举-解冻
log
.
setSourceType
(
OprSourceEnum
.
CALM_TASK_FREEZE
.
getItemValue
());
iAgentAccumulatedFycLogService
.
saveOrUpdate
(
log
);
}
}
}
\ No newline at end of file
yd-csf-api/src/main/java/com/yd/csf/api/service/ApiAgentDetailFycService.java
View file @
3848bb2f
...
...
@@ -2,6 +2,7 @@ package com.yd.csf.api.service;
import
com.yd.common.result.Result
;
import
com.yd.csf.api.dto.GenerateAgentDetailFycDto
;
import
com.yd.csf.service.model.AgentDetailFyc
;
public
interface
ApiAgentDetailFycService
{
...
...
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiExpectedFortuneServiceImpl.java
View file @
3848bb2f
...
...
@@ -532,6 +532,12 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
throw
new
BusinessException
(
"保单的供款年期不存在"
);
}
// 冷静期结束日期 Date 转换为 LocalDateTime
LocalDateTime
baseThawingTime
=
brokerDto
.
getCoolingOffEndDate
()
.
toInstant
()
.
atZone
(
ZoneId
.
systemDefault
())
.
toLocalDateTime
();
List
<
CommissionRuleBinding
>
commissionRuleBindingList
=
brokerRelUserIdList
(
brokerDto
);
log
.
info
(
"同步处理-> 遍历保单转介人列表信息 -> 调用基本法算出预计发佣列表->commissionRuleBindingList:{}"
,
JSON
.
toJSONString
(
commissionRuleBindingList
));
for
(
int
i
=
1
;
i
<=
paymentTerm
;
i
++)
{
...
...
@@ -544,6 +550,12 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
AlgorithmCollectResDto
resDto
=
new
AlgorithmCollectResDto
();
resDto
.
setClientUserBizId
(
brokerDto
.
getBrokerBizId
());
resDto
.
setClientUserName
(
brokerDto
.
getBrokerName
());
//发佣期数
resDto
.
setFortunePeriod
(
i
);
// 根据期数增加年份(第一年 +0,第二年 +1,以此类推)
LocalDateTime
actualThawingTime
=
baseThawingTime
.
plusYears
(
resDto
.
getFortunePeriod
()
-
1
);
//积分解冻时间(受发佣期数影响,第一年就是冷静期结束日期,第二年冷静期结束日期+1年,以此类推)
resDto
.
setThawingTime
(
actualThawingTime
);
resDto
.
setAlgorithmResDtoList
(
result
.
getData
());
collectResDtos
.
add
(
resDto
);
...
...
@@ -557,9 +569,13 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.
build
());
//收集计算非销售佣金的转介人
AlgorithmCollectResDto
resDto1
=
new
AlgorithmCollectResDto
();
resDto
.
setClientUserBizId
(
binding
.
getTargetId
());
resDto
.
setClientUserName
(
binding
.
getTargetName
());
resDto
.
setAlgorithmResDtoList
(
result1
.
getData
());
resDto1
.
setClientUserBizId
(
binding
.
getTargetId
());
resDto1
.
setClientUserName
(
binding
.
getTargetName
());
//发佣期数
resDto1
.
setFortunePeriod
(
i
);
//积分解冻时间(受发佣期数影响,第一年就是冷静期结束日期,第二年冷静期结束日期+1年,以此类推)
resDto1
.
setThawingTime
(
actualThawingTime
);
resDto1
.
setAlgorithmResDtoList
(
result1
.
getData
());
collectResDtos
.
add
(
resDto1
);
}
...
...
yd-csf-feign/src/main/java/com/yd/csf/feign/enums/FycSourceTypeEnum.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
feign
.
enums
;
/**
* 积分来源枚举
*/
public
enum
FycSourceTypeEnum
{
CALM_TASK
(
"冷静期定时计算"
,
"CALM_TASK"
),
;
//字典项标签(名称)
private
String
itemLabel
;
//字典项值
private
String
itemValue
;
//构造函数
FycSourceTypeEnum
(
String
itemLabel
,
String
itemValue
)
{
this
.
itemLabel
=
itemLabel
;
this
.
itemValue
=
itemValue
;
}
public
String
getItemLabel
()
{
return
itemLabel
;
}
public
String
getItemValue
()
{
return
itemValue
;
}
}
yd-csf-feign/src/main/java/com/yd/csf/feign/enums/OprSourceEnum.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
feign
.
enums
;
/**
* 操作来源枚举
*/
public
enum
OprSourceEnum
{
CALM_TASK_FREEZE
(
"冷静期定时计算-冻结"
,
"CALM_TASK_FREEZE"
),
CALM_TASK_DEFROST
(
"冷静期定时计算-解冻"
,
"CALM_TASK_DEFROST"
),
;
//字典项标签(名称)
private
String
itemLabel
;
//字典项值
private
String
itemValue
;
//构造函数
OprSourceEnum
(
String
itemLabel
,
String
itemValue
)
{
this
.
itemLabel
=
itemLabel
;
this
.
itemValue
=
itemValue
;
}
public
String
getItemLabel
()
{
return
itemLabel
;
}
public
String
getItemValue
()
{
return
itemValue
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/dao/AgentAccumulatedFycLogMapper.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
dao
;
import
com.yd.csf.service.model.AgentAccumulatedFycLog
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* 业务员累计积分表操作日志记录表(每次主表(累计积分表)的操作变化记录) Mapper 接口
* </p>
*
* @author zxm
* @since 2026-04-17
*/
public
interface
AgentAccumulatedFycLogMapper
extends
BaseMapper
<
AgentAccumulatedFycLog
>
{
}
yd-csf-service/src/main/java/com/yd/csf/service/dto/QueryPolicyAndBrokerDto.java
View file @
3848bb2f
...
...
@@ -55,9 +55,9 @@ public class QueryPolicyAndBrokerDto {
private
LocalDate
effectiveDate
;
/**
* 冷静期
到期日
* 冷静期
结束日期
*/
private
Local
Date
coolingOffEndDate
;
private
Date
coolingOffEndDate
;
/**
* 期交保费
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/AgentAccumulatedFyc.java
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
@@ -14,7 +17,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author zxm
* @since 202
5-10-15
* @since 202
6-04-16
*/
@Getter
@Setter
...
...
@@ -30,18 +33,66 @@ public class AgentAccumulatedFyc implements Serializable {
private
Long
id
;
/**
* 业务员ID(客户端用户表唯一业务ID)
* 业务员累计积分表唯一业务ID
*/
@TableField
(
"fyc_biz_id"
)
private
String
fycBizId
;
/**
* 业务员ID(会员唯一业务ID)
*/
@TableField
(
"agent_id"
)
private
String
agentId
;
/**
* 累计FYC,业务员历史累计的FYC总额
* 未生效累计积分(不限业务场景)
*/
@TableField
(
"no_effect"
)
private
BigDecimal
noEffect
;
/**
* 已生效累计积分(不限业务场景)
*/
@TableField
(
"effect"
)
private
BigDecimal
effect
;
/**
* 累计积分 = 未生效累计积分 + 已生效累计积分
*/
@TableField
(
"total_fyc"
)
private
BigDecimal
totalFyc
;
/**
* 已生效累计首期佣金积分值(佣金场景)
*/
@TableField
(
"first_commission"
)
private
BigDecimal
firstCommission
;
/**
* 未生效累计首期佣金积分值(佣金场景)
*/
@TableField
(
"no_first_commission"
)
private
BigDecimal
noFirstCommission
;
/**
* 已生效累计非首期佣金积分值(佣金场景)
*/
@TableField
(
"ryc"
)
private
BigDecimal
ryc
;
/**
* 未生效累计非首期佣金积分值(佣金场景)
*/
@TableField
(
"no_ryc"
)
private
BigDecimal
noRyc
;
/**
* 晋升职级累计积分 = 已生效累计积分 - 已生效累计非首期佣金积分值
*/
@TableField
(
"promotion"
)
private
BigDecimal
promotion
;
/**
* 当前等级,业务员当前的会员等级编码(会员等级配置表等级编码)
*/
@TableField
(
"current_grade_code"
)
...
...
@@ -86,13 +137,13 @@ public class AgentAccumulatedFyc implements Serializable {
/**
* 创建人ID
*/
@TableField
(
value
=
"creator_id"
,
fill
=
FieldFill
.
INSERT
)
@TableField
(
"creator_id"
)
private
String
creatorId
;
/**
* 更新人ID
*/
@TableField
(
value
=
"updater_id"
,
fill
=
FieldFill
.
UPDATE
)
@TableField
(
"updater_id"
)
private
String
updaterId
;
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/AgentAccumulatedFycLog.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* <p>
* 业务员累计积分表操作日志记录表(每次主表(累计积分表)的操作变化记录)
* </p>
*
* @author zxm
* @since 2026-04-17
*/
@Getter
@Setter
@TableName
(
"agent_accumulated_fyc_log"
)
public
class
AgentAccumulatedFycLog
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键ID
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 业务员累计积分表操作日志记录表唯一业务ID
*/
@TableField
(
"fyc_log_biz_id"
)
private
String
fycLogBizId
;
/**
* 业务员累计积分表唯一业务ID(关联业务员累计积分表)
*/
@TableField
(
"fyc_biz_id"
)
private
String
fycBizId
;
/**
* 操作来源
*/
@TableField
(
"source_type"
)
private
String
sourceType
;
/**
* 业务员ID(会员唯一业务ID)
*/
@TableField
(
"agent_id"
)
private
String
agentId
;
/**
* 未生效累计积分(不限业务场景)
*/
@TableField
(
"no_effect"
)
private
BigDecimal
noEffect
;
/**
* 已生效累计积分(不限业务场景)
*/
@TableField
(
"effect"
)
private
BigDecimal
effect
;
/**
* 累计积分 = 未生效累计积分 + 已生效累计积分
*/
@TableField
(
"total_fyc"
)
private
BigDecimal
totalFyc
;
/**
* 已生效累计首期佣金积分值(佣金场景)
*/
@TableField
(
"first_commission"
)
private
BigDecimal
firstCommission
;
/**
* 未生效累计首期佣金积分值(佣金场景)
*/
@TableField
(
"no_first_commission"
)
private
BigDecimal
noFirstCommission
;
/**
* 已生效累计非首期佣金积分值(佣金场景)
*/
@TableField
(
"ryc"
)
private
BigDecimal
ryc
;
/**
* 未生效累计非首期佣金积分值(佣金场景)
*/
@TableField
(
"no_ryc"
)
private
BigDecimal
noRyc
;
/**
* 晋升职级累计积分 = 已生效累计积分 - 已生效累计非首期佣金积分值
*/
@TableField
(
"promotion"
)
private
BigDecimal
promotion
;
/**
* 当前等级,业务员当前的会员等级编码(会员等级配置表等级编码)
*/
@TableField
(
"current_grade_code"
)
private
String
currentGradeCode
;
/**
* 最后计算日期,记录最后一次计算累计FYC的日期
*/
@TableField
(
"last_calc_date"
)
private
LocalDateTime
lastCalcDate
;
/**
* 状态(0:停用 1:启用)
*/
@TableField
(
"status"
)
private
Integer
status
;
/**
* 所属租户唯一业务ID(冗余)
*/
@TableField
(
"tenant_biz_id"
)
private
String
tenantBizId
;
/**
* 所属项目唯一业务ID(冗余)
*/
@TableField
(
"project_biz_id"
)
private
String
projectBizId
;
/**
* 通用备注
*/
@TableField
(
"remark"
)
private
String
remark
;
/**
* 删除标识: 0-正常, 1-删除
*/
@TableField
(
"is_deleted"
)
private
Integer
isDeleted
;
/**
* 创建人ID
*/
@TableField
(
"creator_id"
)
private
String
creatorId
;
/**
* 更新人ID
*/
@TableField
(
"updater_id"
)
private
String
updaterId
;
/**
* 创建时间
*/
@TableField
(
"create_time"
)
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
@TableField
(
"update_time"
)
private
LocalDateTime
updateTime
;
}
yd-csf-service/src/main/java/com/yd/csf/service/model/AgentDetailFyc.java
View file @
3848bb2f
...
...
@@ -30,13 +30,19 @@ public class AgentDetailFyc implements Serializable {
private
Long
id
;
/**
* 业务员ID(客户端用户表唯一业务ID)
* 业务员积分明细表唯一业务ID
*/
@TableField
(
"detail_fyc_biz_id"
)
private
String
detailFycBizId
;
/**
* 业务员ID(客户端用户表唯一业务ID,积分接收者)
*/
@TableField
(
"agent_id"
)
private
String
agentId
;
/**
* 积分来源类型:
保单转介费、一级管理奖、二级管理奖、辅导津贴奖、终身推荐奖
* 积分来源类型:
销售佣金、一级管理佣金、二级管理佣金、辅导津贴佣金、终身推荐佣金、冷静期定时计算
*/
@TableField
(
"source_type"
)
private
String
sourceType
;
...
...
@@ -84,7 +90,13 @@ public class AgentDetailFyc implements Serializable {
private
String
changeFyc
;
/**
* 状态(0:停用 1:启用)
* 积分解冻时间
*/
@TableField
(
"thawing_time"
)
private
LocalDateTime
thawingTime
;
/**
* 状态(0:停用(冻结) 1:启用(生效))
*/
@TableField
(
"status"
)
private
Integer
status
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/CalmTask.java
View file @
3848bb2f
...
...
@@ -40,6 +40,12 @@ public class CalmTask implements Serializable {
private
String
calmTaskBizId
;
/**
* 业务员积分明细表唯一业务ID
*/
@TableField
(
"detail_fyc_biz_id"
)
private
String
detailFycBizId
;
/**
* 新单跟进唯一业务ID
*/
@TableField
(
"policy_biz_id"
)
...
...
@@ -58,6 +64,12 @@ public class CalmTask implements Serializable {
private
String
commissionName
;
/**
* 发佣期数(1=第一年; 2=第二年; 3=第三年; 4=第四年; 5=第五年)
*/
@TableField
(
"fortune_period"
)
private
Integer
fortunePeriod
;
/**
* 转介人业务id
*/
@TableField
(
"broker_biz_id"
)
...
...
@@ -70,10 +82,10 @@ public class CalmTask implements Serializable {
private
String
brokerName
;
/**
*
当前保单转介人累计FYC(当前保单转介人基本法计算积分合
值)
*
佣金值(积分
值)
*/
@TableField
(
"
total_
fyc"
)
private
BigDecimal
totalF
yc
;
@TableField
(
"fyc"
)
private
BigDecimal
f
yc
;
/**
* 冷静期结束日期
...
...
@@ -88,7 +100,7 @@ public class CalmTask implements Serializable {
private
Integer
coolingOffDays
;
/**
* 执行时间(定时任务执行时间)
* 执行时间(定时任务执行时间)
= 积分解冻时间(冷静期结束日期 + 期数年份)
*/
@TableField
(
"execution_time"
)
private
LocalDateTime
executionTime
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/MemberGradeConfig.java
View file @
3848bb2f
...
...
@@ -60,6 +60,18 @@ public class MemberGradeConfig implements Serializable {
private
BigDecimal
integralRatio
;
/**
* 最小积分值(包含最小值)
*/
@TableField
(
"min_value"
)
private
BigDecimal
minValue
;
/**
* 最大积分值(不包含最大值)
*/
@TableField
(
"max_value"
)
private
BigDecimal
maxValue
;
/**
* 等级描述
*/
@TableField
(
"description"
)
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/IAgentAccumulatedFycLogService.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
service
;
import
com.yd.csf.service.model.AgentAccumulatedFycLog
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* <p>
* 业务员累计积分表操作日志记录表(每次主表(累计积分表)的操作变化记录) 服务类
* </p>
*
* @author zxm
* @since 2026-04-17
*/
public
interface
IAgentAccumulatedFycLogService
extends
IService
<
AgentAccumulatedFycLog
>
{
}
yd-csf-service/src/main/java/com/yd/csf/service/service/IAgentAccumulatedFycService.java
View file @
3848bb2f
...
...
@@ -3,6 +3,8 @@ package com.yd.csf.service.service;
import
com.yd.csf.service.model.AgentAccumulatedFyc
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
/**
* <p>
* 业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息 服务类
...
...
@@ -14,4 +16,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
public
interface
IAgentAccumulatedFycService
extends
IService
<
AgentAccumulatedFyc
>
{
AgentAccumulatedFyc
queryOne
(
String
agentId
);
List
<
AgentAccumulatedFyc
>
queryList
(
List
<
String
>
agentIdList
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/IAgentDetailFycService.java
View file @
3848bb2f
...
...
@@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public
interface
IAgentDetailFycService
extends
IService
<
AgentDetailFyc
>
{
AgentDetailFyc
queryOne
(
String
detailFycBizId
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/IMemberGradeConfigService.java
View file @
3848bb2f
...
...
@@ -3,6 +3,8 @@ package com.yd.csf.service.service;
import
com.yd.csf.service.model.MemberGradeConfig
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.math.BigDecimal
;
/**
* <p>
* 会员等级配置表 服务类
...
...
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public
interface
IMemberGradeConfigService
extends
IService
<
MemberGradeConfig
>
{
MemberGradeConfig
queryOne
(
BigDecimal
fycValue
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/AgentAccumulatedFycLogServiceImpl.java
0 → 100644
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
com.yd.csf.service.model.AgentAccumulatedFycLog
;
import
com.yd.csf.service.dao.AgentAccumulatedFycLogMapper
;
import
com.yd.csf.service.service.IAgentAccumulatedFycLogService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* 业务员累计积分表操作日志记录表(每次主表(累计积分表)的操作变化记录) 服务实现类
* </p>
*
* @author zxm
* @since 2026-04-17
*/
@Service
public
class
AgentAccumulatedFycLogServiceImpl
extends
ServiceImpl
<
AgentAccumulatedFycLogMapper
,
AgentAccumulatedFycLog
>
implements
IAgentAccumulatedFycLogService
{
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/AgentAccumulatedFycServiceImpl.java
View file @
3848bb2f
...
...
@@ -5,8 +5,11 @@ import com.yd.csf.service.model.AgentAccumulatedFyc;
import
com.yd.csf.service.dao.AgentAccumulatedFycMapper
;
import
com.yd.csf.service.service.IAgentAccumulatedFycService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* <p>
* 业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息 服务实现类
...
...
@@ -25,7 +28,14 @@ public class AgentAccumulatedFycServiceImpl extends ServiceImpl<AgentAccumulated
*/
@Override
public
AgentAccumulatedFyc
queryOne
(
String
agentId
)
{
return
this
.
getOne
(
new
LambdaQueryWrapper
<
AgentAccumulatedFyc
>().
eq
(
AgentAccumulatedFyc:
:
getAgentId
,
agentId
).
last
(
"limit 1"
));
return
this
.
getOne
(
new
LambdaQueryWrapper
<
AgentAccumulatedFyc
>()
.
eq
(
AgentAccumulatedFyc:
:
getAgentId
,
agentId
).
last
(
"limit 1"
));
}
@Override
public
List
<
AgentAccumulatedFyc
>
queryList
(
List
<
String
>
agentIdList
)
{
return
this
.
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
AgentAccumulatedFyc
>()
.
in
(
CollectionUtils
.
isNotEmpty
(
agentIdList
),
AgentAccumulatedFyc:
:
getAgentId
,
agentIdList
));
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/AgentDetailFycServiceImpl.java
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yd.csf.service.model.AgentDetailFyc
;
import
com.yd.csf.service.dao.AgentDetailFycMapper
;
import
com.yd.csf.service.service.IAgentDetailFycService
;
...
...
@@ -17,4 +18,9 @@ import org.springframework.stereotype.Service;
@Service
public
class
AgentDetailFycServiceImpl
extends
ServiceImpl
<
AgentDetailFycMapper
,
AgentDetailFyc
>
implements
IAgentDetailFycService
{
@Override
public
AgentDetailFyc
queryOne
(
String
detailFycBizId
)
{
return
this
.
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
AgentDetailFyc
>()
.
eq
(
AgentDetailFyc:
:
getDetailFycBizId
,
detailFycBizId
).
last
(
" limit 1 "
));
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/CalmTaskServiceImpl.java
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yd.csf.service.model.CalmTask
;
import
com.yd.csf.service.dao.CalmTaskMapper
;
import
com.yd.csf.service.service.ICalmTaskService
;
...
...
@@ -24,6 +25,7 @@ public class CalmTaskServiceImpl extends ServiceImpl<CalmTaskMapper, CalmTask> i
*/
@Override
public
CalmTask
queryOne
(
String
calmTaskBizId
)
{
return
null
;
return
this
.
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CalmTask
>()
.
eq
(
CalmTask:
:
getCalmTaskBizId
,
calmTaskBizId
).
last
(
" limit 1 "
));
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/MemberGradeConfigServiceImpl.java
View file @
3848bb2f
package
com
.
yd
.
csf
.
service
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yd.csf.service.model.MemberGradeConfig
;
import
com.yd.csf.service.dao.MemberGradeConfigMapper
;
import
com.yd.csf.service.service.IMemberGradeConfigService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
/**
* <p>
* 会员等级配置表 服务实现类
...
...
@@ -17,4 +20,21 @@ import org.springframework.stereotype.Service;
@Service
public
class
MemberGradeConfigServiceImpl
extends
ServiceImpl
<
MemberGradeConfigMapper
,
MemberGradeConfig
>
implements
IMemberGradeConfigService
{
/**
* 根据积分查询范围内的等级
* @param fycValue
* @return
*/
@Override
public
MemberGradeConfig
queryOne
(
BigDecimal
fycValue
)
{
LambdaQueryWrapper
<
MemberGradeConfig
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
le
(
MemberGradeConfig:
:
getMinValue
,
fycValue
)
// min_value <= fycValue
.
and
(
w
->
w
.
isNull
(
MemberGradeConfig:
:
getMaxValue
)
// max_value IS NULL
.
or
()
.
gt
(
MemberGradeConfig:
:
getMaxValue
,
fycValue
)
// 或 fycValue < max_value
)
.
eq
(
MemberGradeConfig:
:
getStatus
,
1
)
.
last
(
" limit 1"
);
return
getOne
(
wrapper
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/utils/MyBatisPlusCodeGenerator.java
View file @
3848bb2f
...
...
@@ -21,7 +21,7 @@ public class MyBatisPlusCodeGenerator {
})
.
strategyConfig
(
builder
->
{
builder
.
addInclude
(
"
calm_task
"
"
agent_accumulated_fyc_log
"
)
.
entityBuilder
()
...
...
yd-csf-service/src/main/resources/mappers/AgentAccumulatedFycLogMapper.xml
0 → 100644
View file @
3848bb2f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yd.csf.service.dao.AgentAccumulatedFycLogMapper"
>
</mapper>
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