Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
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
AutogeneralShanghai
yd-backend
Commits
d201f492
Commit
d201f492
authored
May 22, 2020
by
yao.xiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加-团队长查询分数/预测销售额及保存目标区分团队,个人
parent
3e16d24c
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
397 additions
and
118 deletions
+397
-118
yd-api/src/main/java/com/yd/api/practitioner/PractitionerController.java
+20
-20
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
+95
-31
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/SalesTargetMonthSaveRequestVO.java
+4
-0
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/SalesTargetQueryRequestVO.java
+1
-0
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/SalesTargetSaveRequestVO.java
+4
-0
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/TeamActionsAverageQueryResponseVO.java
+49
-0
yd-api/src/main/java/com/yd/dal/entity/marketing/MktLeadsGoals.java
+17
-2
yd-api/src/main/java/com/yd/dal/entity/marketing/MktLeadsGoalsActions.java
+7
-2
yd-api/src/main/java/com/yd/dal/mapper/customer/AclPractitionerSubordinateSystemMapper.java
+3
-0
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsAssignedTrackMapper.java
+4
-1
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsAssignedsMapper.java
+11
-1
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsGoalsActionsMapper.java
+3
-5
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsGoalsMapper.java
+3
-4
yd-api/src/main/java/com/yd/dal/service/customer/AclPractitionerSubordinateSystemDALService.java
+3
-0
yd-api/src/main/java/com/yd/dal/service/customer/impl/AclPractitionerSubordinateSystemDALServiceImpl.java
+6
-0
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsAssignedTrackDALServiceImpl.java
+3
-1
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsAssignedsDALServiceImpl.java
+12
-0
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsGoalsActionsDALServiceImpl.java
+2
-2
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsGoalsDALServiceImpl.java
+5
-2
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsAssignedTrackDALService.java
+8
-1
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsAssignedsDALService.java
+13
-0
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsGoalsActionsDALService.java
+1
-1
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsGoalsDALService.java
+4
-1
yd-api/src/main/resources/mapper/customer/AclPractitionerSubordinateSystemMapper.xml
+7
-0
yd-api/src/main/resources/mapper/marketing/MktLeadsAssignedTrackMapper.xml
+7
-24
yd-api/src/main/resources/mapper/marketing/MktLeadsAssignedsMapper.xml
+37
-0
yd-api/src/main/resources/mapper/marketing/MktLeadsGoalsActionsMapper.xml
+26
-14
yd-api/src/main/resources/mapper/marketing/MktLeadsGoalsMapper.xml
+42
-6
No files found.
yd-api/src/main/java/com/yd/api/practitioner/PractitionerController.java
View file @
d201f492
...
...
@@ -96,8 +96,8 @@ public class PractitionerController {
/**
* 微信-上传多媒体文件
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/mediaGet"
)
public
Object
mediaGet
(
@RequestBody
MediaGetReqVO
requestVO
){
...
...
@@ -110,8 +110,8 @@ public class PractitionerController {
/***
* 经纪人-经纪人查询自己的商机
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/ownOpportunityQuery"
)
public
Object
ownOpportunityQuery
(
@RequestBody
OwnOpportunityQueryRequestVO
requestVO
){
...
...
@@ -137,8 +137,8 @@ public class PractitionerController {
/***
* 经纪人-经纪人查询自己的商机详情查询
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/ownOpportunityDetailQuery"
)
public
Object
ownOpportunityDetailQuery
(
@RequestBody
OwnOpportunityDetailQueryRequestVO
requestVO
){
...
...
@@ -192,8 +192,8 @@ public class PractitionerController {
/**
* 经纪人-修改商机基本信息
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/ownOpportunityBasicInformationSave"
)
public
Object
ownOpportunityBasicInformationSave
(
@RequestBody
OwnOpportunityBasicInformationSaveRequestVO
requestVO
){
...
...
@@ -206,8 +206,8 @@ public class PractitionerController {
/**
* 经纪人-保存商机跟进,修改商机基本信息
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/ownOpportunityRecordSave"
)
public
Object
ownOpportunityRecordSave
(
@RequestBody
OwnOpportunityRecordSaveRequestVO
requestVO
){
...
...
@@ -220,8 +220,8 @@ public class PractitionerController {
/**
* 经纪人-ydLife查询此经纪人总分数 按年月周日 分别统计 新增商机个数 达成率
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/opportunityStatistics"
)
public
Object
OpportunityStatistics
(
@RequestBody
OpportunityStatisticsRequestVO
requestVO
){
...
...
@@ -234,8 +234,8 @@ public class PractitionerController {
/**
* 经纪人-保存销售目标
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/salesTargetSave"
)
public
Object
salesTargetSave
(
@RequestBody
SalesTargetSaveRequestVO
requestVO
){
...
...
@@ -248,8 +248,8 @@ public class PractitionerController {
/**
* 经纪人-查询销售目标
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/salesTargetQuery"
)
public
Object
salesTargetQuery
(
@RequestBody
SalesTargetQueryRequestVO
requestVO
){
...
...
@@ -262,8 +262,8 @@ public class PractitionerController {
/**
* 经纪人-保存月均目标
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/salesTargetMonthSave"
)
public
Object
salesTargetMonthSave
(
@RequestBody
SalesTargetMonthSaveRequestVO
requestVO
){
...
...
@@ -276,8 +276,8 @@ public class PractitionerController {
/**
* 团队长-查看组员得分均值
* @param requestVO
* @return
* @param requestVO
请求数据
* @return
响应数据
*/
@RequestMapping
(
"/teamActionsAverageQuery"
)
public
Object
teamActionsAverageQuery
(
@RequestBody
TeamActionsAverageQueryRequestVO
requestVO
){
...
...
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
View file @
d201f492
...
...
@@ -19,6 +19,7 @@ import com.yd.api.practitioner.vo.salestarget.*;
import
com.yd.api.practitioner.vo.setting.*
;
import
com.yd.api.result.CommonResult
;
import
com.yd.dal.entity.customer.*
;
import
com.yd.dal.entity.insurer.AclInsurerBranchDept
;
import
com.yd.dal.entity.marketing.*
;
import
com.yd.dal.entity.meta.*
;
import
com.yd.dal.entity.practitioner.opportunity.OwnOpportunityInfo
;
...
...
@@ -575,8 +576,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
/**
* 商机客户基本信息
* @param requestVO
* @return
*/
private
OpportunityBasicInformationInfo
getOpportunityBasicInformation
(
OwnOpportunityDetailQueryRequestVO
requestVO
)
{
OpportunityBasicInformationInfo
info
=
new
OpportunityBasicInformationInfo
();
...
...
@@ -647,8 +646,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
/**
* 客户标签查询
* @param customerId
* @return
*/
private
List
<
OpportunityCustomerTag
>
OpportunityCustomerTags
(
Long
customerId
)
{
List
<
OpportunityCustomerTag
>
tags
=
new
ArrayList
<>();
...
...
@@ -675,8 +672,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
/**
* 调查问卷答案,咨询服务
* @param requestVO
* @return
*/
private
OpportunityConsultationInfo
getOpportunityConsultation
(
OwnOpportunityDetailQueryRequestVO
requestVO
)
{
OpportunityConsultationInfo
info
=
new
OpportunityConsultationInfo
();
...
...
@@ -699,8 +694,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
/**
* 问卷答案
* @param requestVO
* @return
*/
@SuppressWarnings
(
"unchecked"
)
private
List
<
OpportunitySurveyAnswers
>
findSurveyAnswers
(
OwnOpportunityDetailQueryRequestVO
requestVO
)
{
...
...
@@ -1378,16 +1371,19 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//当前年份
Calendar
cal
=
Calendar
.
getInstance
();
int
year
=
cal
.
get
(
Calendar
.
YEAR
);
Integer
goalsType
=
requestVO
.
getGoalsType
();
//初始化之前数据 全部修改为不启用
initializationAction
(
practitionerId
,
year
);
initializationAction
(
practitionerId
,
year
,
goalsType
);
//查询经纪人所在团队
AclPractitionerSubordinateSystem
subordinate
=
aclPractitionerSubordinateSystemDALService
.
findByPractitionerId
(
practitionerId
);
//保存年目标
Date
date
=
new
Date
();
saveYearGoal
(
requestVO
,
practitionerId
,
date
,
year
);
saveYearGoal
(
requestVO
,
practitionerId
,
date
,
year
,
goalsType
,
subordinate
);
//保存月目标
List
<
SalesTargetMonth
>
salesTargetMonths
=
requestVO
.
getSalesTargetMonths
();
for
(
SalesTargetMonth
info:
salesTargetMonths
){
saveMonthGoal
(
info
,
practitionerId
,
date
,
year
);
saveMonthGoal
(
info
,
practitionerId
,
date
,
year
,
goalsType
,
subordinate
);
}
//保存经纪人商机活动量均分
...
...
@@ -1421,11 +1417,13 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//当前年份
Calendar
cal
=
Calendar
.
getInstance
();
int
year
=
cal
.
get
(
Calendar
.
YEAR
);
Integer
goalsType
=
requestVO
.
getGoalsType
();
//通过is_active = 1 经纪人id 和 目标所属年度 去查询ag_mkt_leads_goals/ag_mkt_leads_goals_actions
MktLeadsGoals
mktLeadsGoals
=
new
MktLeadsGoals
();
mktLeadsGoals
.
setIsActive
(
1
);
mktLeadsGoals
.
setPractitionerId
(
practitionerId
);
mktLeadsGoals
.
setCurrentYear
(
year
);
mktLeadsGoals
.
setGoalsType
(
goalsType
);
List
<
MktLeadsGoals
>
mktLeadsGoalsList
=
mktLeadsGoalsDALService
.
findByMktLeadsGoals
(
mktLeadsGoals
);
List
<
SalesTargetMonth
>
salesTargetMonthList
=
new
ArrayList
<>();
for
(
MktLeadsGoals
info
:
mktLeadsGoalsList
){
...
...
@@ -1476,13 +1474,15 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//当前年份
Calendar
cal
=
Calendar
.
getInstance
();
int
year
=
cal
.
get
(
Calendar
.
YEAR
);
mktLeadsGoalsActionsDALService
.
updateIsActiveIsNull
(
practitionerId
,
year
);
Integer
goalsType
=
requestVO
.
getGoalsType
();
mktLeadsGoalsActionsDALService
.
updateIsActiveIsNull
(
practitionerId
,
year
,
goalsType
);
List
<
SalesTargetActions
>
salesTargetActionsList
=
requestVO
.
getSalesTargetActionsList
();
Date
date
=
new
Date
();
MktLeadsGoalsActions
mktLeadsGoalsActions
;
for
(
SalesTargetActions
info
:
salesTargetActionsList
){
mktLeadsGoalsActions
=
new
MktLeadsGoalsActions
();
mktLeadsGoalsActions
.
setPractitionerId
(
practitionerId
);
mktLeadsGoalsActions
.
setGoalsType
(
goalsType
);
mktLeadsGoalsActions
.
setCurrentYear
(
year
);
mktLeadsGoalsActions
.
setStatisticTimeUnit
(
3
);
mktLeadsGoalsActions
.
setLeadsActionId
(
info
.
getLeadsActionId
());
...
...
@@ -1504,32 +1504,90 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
public
TeamActionsAverageQueryResponseVO
teamScoreAverageQuery
(
TeamActionsAverageQueryRequestVO
requestVO
)
{
TeamActionsAverageQueryResponseVO
responseVO
=
new
TeamActionsAverageQueryResponseVO
();
Long
practitionerId
=
requestVO
.
getPractitionerId
();
List
<
MdDropOptions
>
mdDropOptionsList
=
mdDropOptionsDALService
.
findByDropMasterCode
(
"bizchance_promotion_action"
);
ConcurrentMap
<
Long
,
Integer
>
optionScoreMap
=
new
ConcurrentHashMap
<>();
for
(
MdDropOptions
info
:
mdDropOptionsList
){
optionScoreMap
.
put
(
info
.
getId
(),
info
.
getDropOptionScore
());
}
//该团队长下团队所有经纪人信息
List
<
AclPractitioner
>
aclPractitioners
=
aclPractitionerDALService
.
findForSubordinateIdByPractitionerId
(
practitionerId
);
//经纪人个数
int
practitionerNum
=
aclPractitioners
.
size
(
);
//
团队
经纪人个数
BigDecimal
practitionerNum
=
BigDecimal
.
valueOf
(
aclPractitioners
.
size
()
);
List
<
Long
>
practitionerIds
=
new
ArrayList
<>();
for
(
AclPractitioner
info
:
aclPractitioners
){
practitionerIds
.
add
(
info
.
getId
());
}
System
.
out
.
println
(
practitionerIds
.
toString
());
//查询此团队经纪人所有得跟进状态
List
<
Integer
>
totalStatistics
=
mktLeadsAssignedTrackDALService
.
totalStatisticsForTeam
(
practitionerIds
);
Integer
totalDay
=
totalStatistics
.
get
(
0
);
Integer
totalWeek
=
totalStatistics
.
get
(
1
);
Integer
totalMonth
=
totalStatistics
.
get
(
2
);
List
<
MdDropOptions
>
mdDropOptions
=
mdDropOptionsDALService
.
findByDropMasterCode
(
"bizchance_promotion_action"
);
ConcurrentMap
<
String
,
Long
>
optionCodeToId
=
new
ConcurrentHashMap
<>();
for
(
MdDropOptions
info
:
mdDropOptions
){
optionCodeToId
.
put
(
info
.
getDropOptionCode
(),
info
.
getId
());
}
//查询其团队天,周,月总分
HashMap
<
String
,
BigDecimal
>
totalStatistics
=
mktLeadsAssignedTrackDALService
.
totalStatisticsForTeam
(
practitionerIds
);
//总分除以人数得到均分
Double
scoreDayAverage
=
getScoreAverage
(
totalStatistics
.
get
(
"scoreToday"
),
practitionerNum
);
Double
scoreWeekAverage
=
getScoreAverage
(
totalStatistics
.
get
(
"scoreWeek"
),
practitionerNum
);
Double
scoreMonthAverage
=
getScoreAverage
(
totalStatistics
.
get
(
"scoreMonth"
),
practitionerNum
);
//计算此团队一周增加的商机数 ag_mkt_leads_assigneds
Integer
opportunitiesNum
=
mktLeadsAssignedsDALService
.
countPractitionerIdsAndThisWeek
(
practitionerIds
);
//计算年/季/月 首年保费(premium)/佣金(commission)/件数(pieces) 均取至指派表ag_mkt_leads_assigneds
//拿到商机跟踪,失败id
Long
refusedId
=
optionCodeToId
.
get
(
"refused"
);
HashMap
<
String
,
BigDecimal
>
performanceForecast
=
mktLeadsAssignedsDALService
.
performanceForecastForTeam
(
practitionerIds
,
refusedId
);
//月平均保费
Double
premiumMonthAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalFYCMonth"
),
practitionerNum
);
//月平均佣金
Double
commissionMonthAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalFYPMonth"
),
practitionerNum
);
//月平均件数
Double
piecesMonthAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalPiecesMonth"
),
practitionerNum
);
// 季度平均保费
Double
premiumQuarterAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalFYCQuarter"
),
practitionerNum
);
// 季度平均佣金
Double
commissionQuarterAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalFYPQuarter"
),
practitionerNum
);
//季度平均件数
Double
piecesQuarterAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalPiecesQuarter"
),
practitionerNum
);
//年平均保费
Double
premiumYearAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalFYCYear"
),
practitionerNum
);
//年平均佣金
Double
commissionYearAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalFYPYear"
),
practitionerNum
);
//年平均件数
Double
piecesYearAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalPiecesYear"
),
practitionerNum
);
responseVO
.
setScoreDayAverage
(
scoreDayAverage
);
responseVO
.
setScoreWeekAverage
(
scoreWeekAverage
);
responseVO
.
setScoreMonthAverage
(
scoreMonthAverage
);
responseVO
.
setOpportunitiesNum
(
opportunitiesNum
);
responseVO
.
setPremiumMonthAverage
(
premiumMonthAverage
);
responseVO
.
setCommissionMonthAverage
(
commissionMonthAverage
);
responseVO
.
setPiecesMonthAverage
(
piecesMonthAverage
);
responseVO
.
setPremiumQuarterAverage
(
premiumQuarterAverage
);
responseVO
.
setCommissionQuarterAverage
(
commissionQuarterAverage
);
responseVO
.
setPiecesQuarterAverage
(
piecesQuarterAverage
);
responseVO
.
setPremiumYearAverage
(
premiumYearAverage
);
responseVO
.
setCommissionYearAverage
(
commissionYearAverage
);
responseVO
.
setPiecesYearAverage
(
piecesYearAverage
);
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
return
responseVO
;
}
private
void
initializationAction
(
Long
practitionerId
,
int
year
)
{
/**
* 通过总分计算平均分 保留两位小数
* @param total 总分
* @param practitionerNum 人数
* @return 均分
*/
private
Double
getScoreAverage
(
BigDecimal
total
,
BigDecimal
practitionerNum
)
{
Double
scoreAverage
=
0
D
;
if
(!
CommonUtil
.
isNullOrZero
(
total
)){
scoreAverage
=
total
.
divide
(
practitionerNum
,
2
,
BigDecimal
.
ROUND_HALF_UP
)
.
doubleValue
();
}
return
scoreAverage
;
}
private
void
initializationAction
(
Long
practitionerId
,
int
year
,
Integer
goalsType
)
{
//通过经纪人id 和 目标所属年度 去查询ag_mkt_leads_goals/ag_mkt_leads_goals_actions 并将is_active = 0
mktLeadsGoalsDALService
.
updateIsActiveIsNull
(
practitionerId
,
year
);
mktLeadsGoalsActionsDALService
.
updateIsActiveIsNull
(
practitionerId
,
year
);
mktLeadsGoalsDALService
.
updateIsActiveIsNull
(
practitionerId
,
year
,
goalsType
);
mktLeadsGoalsActionsDALService
.
updateIsActiveIsNull
(
practitionerId
,
year
,
goalsType
);
}
private
SalesTargetActions
saveLeadsGoalsActions
(
MdGoalsCalculateExpression
info
,
ScriptEngine
jScriptEngine
,
int
year
,
int
piecesMonth
,
Long
practitionerId
,
Date
date
)
{
...
...
@@ -1570,16 +1628,19 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
/**
* 保存月度商机目标
* @param info
* @param info
入参
* @param practitionerId 经纪人id
* @param date 版本号
* @param year 当前年份
*/
private
void
saveMonthGoal
(
SalesTargetMonth
info
,
Long
practitionerId
,
Date
date
,
int
year
)
{
private
void
saveMonthGoal
(
SalesTargetMonth
info
,
Long
practitionerId
,
Date
date
,
int
year
,
Integer
goalsType
,
AclPractitionerSubordinateSystem
subordinate
)
{
MktLeadsGoals
mktLeadsGoals
=
new
MktLeadsGoals
();
mktLeadsGoals
.
setPractitionerId
(
practitionerId
);
mktLeadsGoals
.
setPremium
(
info
.
getPremium
());
mktLeadsGoals
.
setCommission
(
info
.
getCommission
());
mktLeadsGoals
.
setGoalsType
(
goalsType
);
mktLeadsGoals
.
setSubordinateSystemId
(
subordinate
.
getId
());
mktLeadsGoals
.
setSubordinateSystemName
(
subordinate
.
getName
());
mktLeadsGoals
.
setPieces
(
info
.
getPieces
());
mktLeadsGoals
.
setPieceAveragePremium
(
info
.
getPieceAveragePremium
());
mktLeadsGoals
.
setCurrentYear
(
year
);
...
...
@@ -1596,18 +1657,21 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
/**
* 保存商机年目标
* @param requestVO
* @param requestVO
入参
* @param practitionerId 经纪人id
* @param date 版本号
* @param year 当前年份
*/
private
void
saveYearGoal
(
SalesTargetSaveRequestVO
requestVO
,
Long
practitionerId
,
Date
date
,
int
year
)
{
private
void
saveYearGoal
(
SalesTargetSaveRequestVO
requestVO
,
Long
practitionerId
,
Date
date
,
int
year
,
Integer
goalsType
,
AclPractitionerSubordinateSystem
subordinate
)
{
Integer
premium
=
requestVO
.
getPremium
();
Integer
commission
=
requestVO
.
getCommission
();
Integer
pieces
=
requestVO
.
getPieces
();
Integer
pieceAveragePremium
=
requestVO
.
getPieceAveragePremium
();
MktLeadsGoals
mktLeadsGoals
=
new
MktLeadsGoals
();
mktLeadsGoals
.
setPractitionerId
(
practitionerId
);
mktLeadsGoals
.
setGoalsType
(
goalsType
);
mktLeadsGoals
.
setSubordinateSystemId
(
subordinate
.
getId
());
mktLeadsGoals
.
setSubordinateSystemName
(
subordinate
.
getName
());
mktLeadsGoals
.
setPremium
(
premium
);
mktLeadsGoals
.
setCommission
(
commission
);
mktLeadsGoals
.
setPieces
(
pieces
);
...
...
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/SalesTargetMonthSaveRequestVO.java
View file @
d201f492
...
...
@@ -7,5 +7,9 @@ import java.util.List;
@Data
public
class
SalesTargetMonthSaveRequestVO
{
private
Long
practitionerId
;
/**
* 目标类型:1:经纪人指标,2:团队指标
*/
private
Integer
goalsType
;
private
List
<
SalesTargetActions
>
salesTargetActionsList
;
}
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/SalesTargetQueryRequestVO.java
View file @
d201f492
...
...
@@ -5,4 +5,5 @@ import lombok.Data;
@Data
public
class
SalesTargetQueryRequestVO
{
private
Long
practitionerId
;
private
Integer
goalsType
;
}
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/SalesTargetSaveRequestVO.java
View file @
d201f492
...
...
@@ -22,5 +22,9 @@ public class SalesTargetSaveRequestVO {
* 均价
*/
private
Integer
pieceAveragePremium
;
/**
* 目标类型:1:经纪人指标,2:团队指标
*/
private
Integer
goalsType
;
private
List
<
SalesTargetMonth
>
salesTargetMonths
;
}
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/TeamActionsAverageQueryResponseVO.java
View file @
d201f492
...
...
@@ -6,8 +6,57 @@ import lombok.Data;
@Data
public
class
TeamActionsAverageQueryResponseVO
{
/**
* 天均分
*/
private
Double
scoreDayAverage
;
/**
* 天均分
*/
private
Double
scoreWeekAverage
;
/**
* 月均分
*/
private
Double
scoreMonthAverage
;
/**
* 本周新增商机
*/
private
Integer
opportunitiesNum
;
/**
* 月平均保费
*/
private
Double
premiumMonthAverage
;
/**
* 月平均佣金
*/
private
Double
commissionMonthAverage
;
/**
* 月平均件数
*/
private
Double
piecesMonthAverage
;
/**
* 季度平均保费
*/
private
Double
premiumQuarterAverage
;
/**
* 季度平均佣金
*/
private
Double
commissionQuarterAverage
;
/**
* 季度平均件数
*/
private
Double
piecesQuarterAverage
;
/**
* 年平均保费
*/
private
Double
premiumYearAverage
;
/**
* 年平均佣金
*/
private
Double
commissionYearAverage
;
/**
* 年平均件数
*/
private
Double
piecesYearAverage
;
private
CommonResult
commonResult
;
}
yd-api/src/main/java/com/yd/dal/entity/marketing/MktLeadsGoals.java
View file @
d201f492
...
...
@@ -4,7 +4,7 @@ import java.util.Date;
import
lombok.Data
;
/**
* 经纪人商机目标设定
* 经纪人
(或团队长)
商机目标设定
*/
@Data
public
class
MktLeadsGoals
{
...
...
@@ -14,11 +14,26 @@ public class MktLeadsGoals {
private
Long
id
;
/**
* FK ag_acl_practitioner.id 经纪人
* 目标类型:1:经纪人指标,2:团队指标
*/
private
Integer
goalsType
;
/**
* FK ag_acl_practitioner.id 经纪人(或团队长)
*/
private
Long
practitionerId
;
/**
* FK ag_acl_practitioner_subordinate_system.id 团队ID
*/
private
Long
subordinateSystemId
;
/**
* FK ag_acl_practitioner_subordinate_system.name 团队Name
*/
private
String
subordinateSystemName
;
/**
* 目标所属年度
*/
private
Integer
currentYear
;
...
...
yd-api/src/main/java/com/yd/dal/entity/marketing/MktLeadsGoalsActions.java
View file @
d201f492
...
...
@@ -4,7 +4,7 @@ import java.util.Date;
import
lombok.Data
;
/**
* 经纪人商机活动量分摊细化设置
* 经纪人
(或团队长)
商机活动量分摊细化设置
*/
@Data
public
class
MktLeadsGoalsActions
{
...
...
@@ -14,7 +14,12 @@ public class MktLeadsGoalsActions {
private
Long
id
;
/**
* FK ag_acl_practitioner.id 经纪人
* 目标类型:1:经纪人指标,2:团队指标
*/
private
Integer
goalsType
;
/**
* FK ag_acl_practitioner.id 经纪人(或团队长)
*/
private
Long
practitionerId
;
...
...
yd-api/src/main/java/com/yd/dal/mapper/customer/AclPractitionerSubordinateSystemMapper.java
View file @
d201f492
...
...
@@ -17,4 +17,6 @@ public interface AclPractitionerSubordinateSystemMapper {
int
updateByPrimaryKey
(
AclPractitionerSubordinateSystem
record
);
PractitionerSubordinateInfo
findSubordinateInfo
(
Long
subordinateId
);
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
);
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsAssignedTrackMapper.java
View file @
d201f492
...
...
@@ -3,6 +3,8 @@ package com.yd.dal.mapper.marketing;
import
com.github.pagehelper.Page
;
import
com.yd.dal.entity.marketing.MktLeadsAssignedTrack
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
public
interface
MktLeadsAssignedTrackMapper
{
...
...
@@ -22,5 +24,5 @@ public interface MktLeadsAssignedTrackMapper {
List
<
MktLeadsAssignedTrack
>
findByTrackTimeForNew
(
MktLeadsAssignedTrack
mktLeadsAssignedTrack
);
List
<
Integer
>
totalStatisticsForTeam
(
List
<
Long
>
practitionerIds
);
HashMap
<
String
,
BigDecimal
>
totalStatisticsForTeam
(
List
<
Long
>
practitionerIds
);
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsAssignedsMapper.java
View file @
d201f492
package
com
.
yd
.
dal
.
mapper
.
marketing
;
import
com.yd.dal.entity.marketing.MktLeadsAssigneds
;
import
java.util.List
;
import
com.yd.dal.entity.marketing.MktLeadsAssigneds
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
public
interface
MktLeadsAssignedsMapper
{
int
deleteByPrimaryKey
(
Long
id
);
...
...
@@ -18,4 +23,8 @@ public interface MktLeadsAssignedsMapper {
List
<
MktLeadsAssigneds
>
findByMktLeadsAssigneds
(
MktLeadsAssigneds
mktLeadsAssigneds
);
List
<
MktLeadsAssigneds
>
findByPractitionerIdAndThisWeek
(
Long
practitionerId
);
Integer
countPractitionerIdsAndThisWeek
(
List
<
Long
>
practitionerIds
);
HashMap
<
String
,
BigDecimal
>
performanceForecastForTeam
(
@Param
(
"practitionerIds"
)
List
<
Long
>
practitionerIds
,
@Param
(
"refusedId"
)
Long
refusedId
);
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsGoalsActionsMapper.java
View file @
d201f492
package
com
.
yd
.
dal
.
mapper
.
marketing
;
import
com.yd.dal.entity.marketing.MktLeadsGoalsActions
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
com.yd.dal.entity.marketing.MktLeadsGoalsActions
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
MktLeadsGoalsActionsMapper
{
int
deleteByPrimaryKey
(
Long
id
);
...
...
@@ -18,7 +15,7 @@ public interface MktLeadsGoalsActionsMapper {
int
updateByPrimaryKey
(
MktLeadsGoalsActions
record
);
void
updateIsActiveIsNull
(
@Param
(
"practitionerId"
)
Long
practitionerId
,
@Param
(
"year"
)
Integer
year
);
void
updateIsActiveIsNull
(
@Param
(
"practitionerId"
)
Long
practitionerId
,
@Param
(
"year"
)
Integer
year
,
@Param
(
"goalsType"
)
Integer
goalsType
);
List
<
MktLeadsGoalsActions
>
findByMktLeadsGoalsActions
(
MktLeadsGoalsActions
mktLeadsGoalsActions
);
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/mapper/marketing/MktLeadsGoalsMapper.java
View file @
d201f492
package
com
.
yd
.
dal
.
mapper
.
marketing
;
import
com.yd.dal.entity.marketing.MktLeadsGoals
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
com.yd.dal.entity.marketing.MktLeadsGoals
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
MktLeadsGoalsMapper
{
int
deleteByPrimaryKey
(
Long
id
);
...
...
@@ -17,7 +15,7 @@ public interface MktLeadsGoalsMapper {
int
updateByPrimaryKey
(
MktLeadsGoals
record
);
void
updateIsActiveIsNull
(
@Param
(
"practitionerId"
)
Long
practitionerId
,
@Param
(
"year"
)
Integer
year
);
void
updateIsActiveIsNull
(
@Param
(
"practitionerId"
)
Long
practitionerId
,
@Param
(
"year"
)
Integer
year
,
@Param
(
"goalsType"
)
Integer
goalsType
);
List
<
MktLeadsGoals
>
selectByMktLeadsGoals
(
MktLeadsGoals
mktLeadsGoals
);
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/service/customer/AclPractitionerSubordinateSystemDALService.java
View file @
d201f492
package
com
.
yd
.
dal
.
service
.
customer
;
import
com.yd.dal.entity.customer.AclPractitionerSubordinateSystem
;
import
com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo
;
import
org.springframework.stereotype.Service
;
@Service
(
"aclPractitionerSubordinateSystemDALService"
)
public
interface
AclPractitionerSubordinateSystemDALService
{
PractitionerSubordinateInfo
findSubordinateInfo
(
Long
subordinateId
);
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
);
}
yd-api/src/main/java/com/yd/dal/service/customer/impl/AclPractitionerSubordinateSystemDALServiceImpl.java
View file @
d201f492
package
com
.
yd
.
dal
.
service
.
customer
.
impl
;
import
com.yd.dal.entity.customer.AclPractitionerSubordinateSystem
;
import
com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo
;
import
com.yd.dal.mapper.customer.AclPractitionerSubordinateSystemMapper
;
import
com.yd.dal.service.customer.AclPractitionerSubordinateSystemDALService
;
...
...
@@ -24,4 +25,9 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti
}
return
subordinateInfo
;
}
@Override
public
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
)
{
return
aclPractitionerSubordinateSystemMapper
.
findByPractitionerId
(
practitionerId
);
}
}
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsAssignedTrackDALServiceImpl.java
View file @
d201f492
...
...
@@ -8,6 +8,8 @@ import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
@Service
(
"mktLeadsAssignedTrackDALService"
)
...
...
@@ -39,7 +41,7 @@ public class MktLeadsAssignedTrackDALServiceImpl implements MktLeadsAssignedTrac
}
@Override
public
List
<
Integer
>
totalStatisticsForTeam
(
List
<
Long
>
practitionerIds
)
{
public
HashMap
<
String
,
BigDecimal
>
totalStatisticsForTeam
(
List
<
Long
>
practitionerIds
)
{
return
mktLeadsAssignedTrackMapper
.
totalStatisticsForTeam
(
practitionerIds
);
}
}
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsAssignedsDALServiceImpl.java
View file @
d201f492
...
...
@@ -6,6 +6,8 @@ import com.yd.dal.service.marketing.MktLeadsAssignedsDALService;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
@Service
(
"mktLeadsAssignedsDALService"
)
...
...
@@ -37,4 +39,14 @@ public class MktLeadsAssignedsDALServiceImpl implements MktLeadsAssignedsDALServ
public
List
<
MktLeadsAssigneds
>
findByPractitionerIdAndThisWeek
(
Long
practitionerId
)
{
return
mktLeadsAssignedsMapper
.
findByPractitionerIdAndThisWeek
(
practitionerId
);
}
@Override
public
Integer
countPractitionerIdsAndThisWeek
(
List
<
Long
>
practitionerIds
)
{
return
mktLeadsAssignedsMapper
.
countPractitionerIdsAndThisWeek
(
practitionerIds
);
}
@Override
public
HashMap
<
String
,
BigDecimal
>
performanceForecastForTeam
(
List
<
Long
>
practitionerIds
,
Long
refusedId
)
{
return
mktLeadsAssignedsMapper
.
performanceForecastForTeam
(
practitionerIds
,
refusedId
);
}
}
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsGoalsActionsDALServiceImpl.java
View file @
d201f492
...
...
@@ -20,8 +20,8 @@ public class MktLeadsGoalsActionsDALServiceImpl implements MktLeadsGoalsActionsD
}
@Override
public
void
updateIsActiveIsNull
(
Long
practitionerId
,
int
year
)
{
mktLeadsGoalsActionsMapper
.
updateIsActiveIsNull
(
practitionerId
,
year
);
public
void
updateIsActiveIsNull
(
Long
practitionerId
,
int
year
,
Integer
goalsType
)
{
mktLeadsGoalsActionsMapper
.
updateIsActiveIsNull
(
practitionerId
,
year
,
goalsType
);
}
@Override
...
...
yd-api/src/main/java/com/yd/dal/service/marketing/Impl/MktLeadsGoalsDALServiceImpl.java
View file @
d201f492
...
...
@@ -6,6 +6,8 @@ import com.yd.dal.service.marketing.MktLeadsGoalsDALService;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
@Service
(
"mktLeadsGoalsDALService"
)
...
...
@@ -20,12 +22,13 @@ public class MktLeadsGoalsDALServiceImpl implements MktLeadsGoalsDALService {
}
@Override
public
void
updateIsActiveIsNull
(
Long
practitionerId
,
Integer
year
)
{
mktLeadsGoalsMapper
.
updateIsActiveIsNull
(
practitionerId
,
year
)
;
public
void
updateIsActiveIsNull
(
Long
practitionerId
,
Integer
year
,
Integer
goalsType
)
{
mktLeadsGoalsMapper
.
updateIsActiveIsNull
(
practitionerId
,
year
,
goalsType
)
;
}
@Override
public
List
<
MktLeadsGoals
>
findByMktLeadsGoals
(
MktLeadsGoals
mktLeadsGoals
)
{
return
mktLeadsGoalsMapper
.
selectByMktLeadsGoals
(
mktLeadsGoals
);
}
}
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsAssignedTrackDALService.java
View file @
d201f492
...
...
@@ -2,6 +2,8 @@ package com.yd.dal.service.marketing;
import
com.yd.dal.entity.marketing.MktLeadsAssignedTrack
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
public
interface
MktLeadsAssignedTrackDALService
{
...
...
@@ -13,5 +15,10 @@ public interface MktLeadsAssignedTrackDALService {
List
<
MktLeadsAssignedTrack
>
findByTrackTimeForNew
(
MktLeadsAssignedTrack
mktLeadsAssignedTrack
);
List
<
Integer
>
totalStatisticsForTeam
(
List
<
Long
>
practitionerIds
);
/**
* 计算经纪人得分统计
* @param practitionerIds 经纪人id的list
* @return 返回他们的分数统计 1.天得分 2.周得分 3.月得分
*/
HashMap
<
String
,
BigDecimal
>
totalStatisticsForTeam
(
List
<
Long
>
practitionerIds
);
}
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsAssignedsDALService.java
View file @
d201f492
...
...
@@ -2,6 +2,8 @@ package com.yd.dal.service.marketing;
import
com.yd.dal.entity.marketing.MktLeadsAssigneds
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
public
interface
MktLeadsAssignedsDALService
{
...
...
@@ -14,4 +16,15 @@ public interface MktLeadsAssignedsDALService {
void
save
(
MktLeadsAssigneds
assigneds
);
List
<
MktLeadsAssigneds
>
findByPractitionerIdAndThisWeek
(
Long
practitionerId
);
/**
* 统计这些经纪人id本周一共新增多少商机
*/
Integer
countPractitionerIdsAndThisWeek
(
List
<
Long
>
practitionerIds
);
/**
* 计算年/季/月 首年保费(premium)/佣金(commission)/件数(pieces) 均取至指派表ag_mkt_leads_assigneds
* ag_mkt_leads_assigned_track跟进记录不可有"拒绝" md_drop_option_id = 102 (传入)
*/
HashMap
<
String
,
BigDecimal
>
performanceForecastForTeam
(
List
<
Long
>
practitionerIds
,
Long
refusedId
);
}
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsGoalsActionsDALService.java
View file @
d201f492
...
...
@@ -7,7 +7,7 @@ import java.util.List;
public
interface
MktLeadsGoalsActionsDALService
{
void
save
(
MktLeadsGoalsActions
mktLeadsGoalsActions
);
void
updateIsActiveIsNull
(
Long
practitionerId
,
int
year
);
void
updateIsActiveIsNull
(
Long
practitionerId
,
int
year
,
Integer
goalsType
);
List
<
MktLeadsGoalsActions
>
findByMktLeadsGoalsActions
(
MktLeadsGoalsActions
mktLeadsGoalsActions
);
}
yd-api/src/main/java/com/yd/dal/service/marketing/MktLeadsGoalsDALService.java
View file @
d201f492
...
...
@@ -2,12 +2,15 @@ package com.yd.dal.service.marketing;
import
com.yd.dal.entity.marketing.MktLeadsGoals
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
public
interface
MktLeadsGoalsDALService
{
void
saveMktLeadsGoals
(
MktLeadsGoals
mktLeadsGoals
);
void
updateIsActiveIsNull
(
Long
practitionerId
,
Integer
year
);
void
updateIsActiveIsNull
(
Long
practitionerId
,
Integer
year
,
Integer
goalsType
);
List
<
MktLeadsGoals
>
findByMktLeadsGoals
(
MktLeadsGoals
mktLeadsGoals
);
}
yd-api/src/main/resources/mapper/customer/AclPractitionerSubordinateSystemMapper.xml
View file @
d201f492
...
...
@@ -242,4 +242,10 @@
and s.id = #{subordinateId}
</select>
<select
id=
"findByPractitionerId"
resultMap=
"BaseResultMap"
>
select s.*
from ag_acl_practitioner_subordinate_system s
left join ag_acl_practitioner p on p.subordinate_system_id = s.id
where p.id = #{practitionerId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
yd-api/src/main/resources/mapper/marketing/MktLeadsAssignedTrackMapper.xml
View file @
d201f492
...
...
@@ -323,30 +323,13 @@
</if>
</where>
</select>
<select
id=
"totalStatisticsForTeam"
resultType=
"integer"
>
SELECT sum(track_score) as scoreToday
FROM ag_mkt_leads_assigned_track
where is_active = 1
and to_days(track_time) = to_days(now())
and practitioner_id in
<foreach
collection=
"list"
item=
"practitionerId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{practitionerId,jdbcType=BIGINT}
</foreach>
UNION all
SELECT sum(track_score) as scoreWeek
FROM ag_mkt_leads_assigned_track
where is_active = 1
and YEARWEEK(date_format(track_time,'%Y-%m-%d')) = YEARWEEK(now())
and practitioner_id in
<foreach
collection=
"list"
item=
"practitionerId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{practitionerId,jdbcType=BIGINT}
</foreach>
UNION all
SELECT sum(track_score) as scoreMonth
FROM ag_mkt_leads_assigned_track
where is_active = 1
and date_format(track_time,'%Y-%m')=date_format(now(),'%Y-%m')
and practitioner_id in
<select
id=
"totalStatisticsForTeam"
resultType=
"hashmap"
>
select sum(case when to_days(track_time) = to_days(now()) then track_score end) scoreToday,
sum(case when YEARWEEK(date_format(track_time,'%Y-%m-%d')) = YEARWEEK(now()) then track_score end) scoreWeek,
sum(case when date_format(track_time,'%Y-%m')=date_format(now(),'%Y-%m') then track_score end) scoreMonth
from ag_mkt_leads_assigned_track
where is_active = 1
and practitioner_id in
<foreach
collection=
"list"
item=
"practitionerId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{practitionerId,jdbcType=BIGINT}
</foreach>
...
...
yd-api/src/main/resources/mapper/marketing/MktLeadsAssignedsMapper.xml
View file @
d201f492
...
...
@@ -243,4 +243,40 @@
assigned_practitioner_id = #{practitionerId,jdbcType=BIGINT}
and YEARWEEK(date_format(created_at,'%Y-%m-%d')) = YEARWEEK(now())
</select>
<select
id=
"countPractitionerIdsAndThisWeek"
resultType=
"integer"
>
select
count(*)
from ag_mkt_leads_assigneds
where
assigned_practitioner_id in
<foreach
collection=
"list"
item=
"practitionerId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{practitionerId,jdbcType=BIGINT}
</foreach>
and YEARWEEK(date_format(created_at,'%Y-%m-%d')) = YEARWEEK(now())
</select>
<select
id=
"performanceForecastForTeam"
resultType=
"hashmap"
>
select sum(case when date_format(time_to_close,'%Y-%m')=date_format(now(),'%Y-%m') then FYC end) totalFYCMonth,
sum(case when date_format(time_to_close,'%Y-%m')=date_format(now(),'%Y-%m') then FYP end) totalFYPMonth,
sum(case when date_format(time_to_close,'%Y-%m')=date_format(now(),'%Y-%m') then pieces end) totalPiecesMonth,
sum(case when QUARTER(time_to_close)=QUARTER(now()) then FYC end) totalFYCQuarter,
sum(case when QUARTER(time_to_close)=QUARTER(now()) then FYP end) totalFYPQuarter,
sum(case when QUARTER(time_to_close)=QUARTER(now()) then pieces end) totalPiecesQuarter,
sum(case when YEAR(time_to_close)=YEAR(NOW()) then FYC end) totalFYCYear,
sum(case when YEAR(time_to_close)=YEAR(NOW()) then FYP end) totalFYPYear,
sum(case when YEAR(time_to_close)=YEAR(NOW()) then pieces end) totalPiecesYear
from ag_mkt_leads_assigneds a
where a.is_active=1
and a.assigned_practitioner_id in
<foreach
collection=
"practitionerIds"
item=
"practitionerId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{practitionerId,jdbcType=BIGINT}
</foreach>
and not EXISTS (select t.leads_assigned_id
from ag_mkt_leads_assigned_track t
where t.md_drop_option_id = #{refusedId,jdbcType=BIGINT}
and t.practitioner_id in
<foreach
collection=
"practitionerIds"
item=
"practitionerId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{practitionerId,jdbcType=BIGINT}
</foreach>
and a.id = t.leads_assigned_id)
</select>
</mapper>
\ No newline at end of file
yd-api/src/main/resources/mapper/marketing/MktLeadsGoalsActionsMapper.xml
View file @
d201f492
...
...
@@ -5,6 +5,7 @@
<!--@mbg.generated-->
<!--@Table ag_mkt_leads_goals_actions-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"goals_type"
jdbcType=
"INTEGER"
property=
"goalsType"
/>
<result
column=
"practitioner_id"
jdbcType=
"BIGINT"
property=
"practitionerId"
/>
<result
column=
"current_year"
jdbcType=
"INTEGER"
property=
"currentYear"
/>
<result
column=
"statistic_time_unit"
jdbcType=
"INTEGER"
property=
"statisticTimeUnit"
/>
...
...
@@ -20,9 +21,9 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id,
practitioner_id, current_year, statistic_time_unit, leads_action_id, leads_action_name
,
action_standards, current_version, is_active, created_at, created_by, updated_at
,
updated_by
id,
goals_type, practitioner_id, current_year, statistic_time_unit, leads_action_id
,
leads_action_name, action_standards, current_version, is_active, created_at, created_by
,
updated_
at, updated_
by
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
...
...
@@ -38,21 +39,24 @@
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.yd.dal.entity.marketing.MktLeadsGoalsActions"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into ag_mkt_leads_goals_actions (
practitioner_id, current_year, statistic_time_unit
,
leads_action_id, leads_action_name, action_standards
,
current_version, is_active, created_at
,
created_
by, updated_at, updated_by
)
values (#{
practitionerId,jdbcType=BIGINT}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit
,jdbcType=INTEGER},
#{
leadsActionId,jdbcType=BIGINT}, #{leadsActionName,jdbcType=VARCHAR}, #{actionStandards,jdbcType=INTEGE
R},
#{
currentVersion,jdbcType=TIMESTAMP}, #{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP
},
#{created
By,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}
)
insert into ag_mkt_leads_goals_actions (
goals_type, practitioner_id, current_year
,
statistic_time_unit, leads_action_id, leads_action_name
,
action_standards, current_version, is_active
,
created_
at, created_by, updated_at,
updated_by
)
values (#{
goalsType,jdbcType=INTEGER}, #{practitionerId,jdbcType=BIGINT}, #{currentYear
,jdbcType=INTEGER},
#{
statisticTimeUnit,jdbcType=INTEGER}, #{leadsActionId,jdbcType=BIGINT}, #{leadsActionName,jdbcType=VARCHA
R},
#{
actionStandards,jdbcType=INTEGER}, #{currentVersion,jdbcType=TIMESTAMP}, #{isActive,jdbcType=INTEGER
},
#{created
At,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=BIGINT}
)
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.yd.dal.entity.marketing.MktLeadsGoalsActions"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into ag_mkt_leads_goals_actions
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"goalsType != null"
>
goals_type,
</if>
<if
test=
"practitionerId != null"
>
practitioner_id,
</if>
...
...
@@ -91,6 +95,9 @@
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"goalsType != null"
>
#{goalsType,jdbcType=INTEGER},
</if>
<if
test=
"practitionerId != null"
>
#{practitionerId,jdbcType=BIGINT},
</if>
...
...
@@ -133,6 +140,9 @@
<!--@mbg.generated-->
update ag_mkt_leads_goals_actions
<set>
<if
test=
"goalsType != null"
>
goals_type = #{goalsType,jdbcType=INTEGER},
</if>
<if
test=
"practitionerId != null"
>
practitioner_id = #{practitionerId,jdbcType=BIGINT},
</if>
...
...
@@ -175,7 +185,8 @@
<update
id=
"updateByPrimaryKey"
parameterType=
"com.yd.dal.entity.marketing.MktLeadsGoalsActions"
>
<!--@mbg.generated-->
update ag_mkt_leads_goals_actions
set practitioner_id = #{practitionerId,jdbcType=BIGINT},
set goals_type = #{goalsType,jdbcType=INTEGER},
practitioner_id = #{practitionerId,jdbcType=BIGINT},
current_year = #{currentYear,jdbcType=INTEGER},
statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER},
leads_action_id = #{leadsActionId,jdbcType=BIGINT},
...
...
@@ -196,6 +207,7 @@
where
practitioner_id = #{practitionerId,jdbcType=BIGINT}
and current_year = #{year,jdbcType=INTEGER}
and goals_type = #{goalsType,jdbcType=INTEGER}
and is_active =1;
</update>
<select
id=
"findByMktLeadsGoalsActions"
resultMap=
"BaseResultMap"
>
...
...
yd-api/src/main/resources/mapper/marketing/MktLeadsGoalsMapper.xml
View file @
d201f492
...
...
@@ -5,7 +5,10 @@
<!--@mbg.generated-->
<!--@Table ag_mkt_leads_goals-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"goals_type"
jdbcType=
"INTEGER"
property=
"goalsType"
/>
<result
column=
"practitioner_id"
jdbcType=
"BIGINT"
property=
"practitionerId"
/>
<result
column=
"subordinate_system_id"
jdbcType=
"BIGINT"
property=
"subordinateSystemId"
/>
<result
column=
"subordinate_system_name"
jdbcType=
"VARCHAR"
property=
"subordinateSystemName"
/>
<result
column=
"current_year"
jdbcType=
"INTEGER"
property=
"currentYear"
/>
<result
column=
"statistic_time_unit"
jdbcType=
"INTEGER"
property=
"statisticTimeUnit"
/>
<result
column=
"seq_time"
jdbcType=
"INTEGER"
property=
"seqTime"
/>
...
...
@@ -22,9 +25,9 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id,
practitioner_id, current_year, statistic_time_unit, seq_time, premium, commission
,
pieces, piece_average_premium, current_version, is_active, created_at, created_by
,
updated_at, updated_by
id,
goals_type, practitioner_id, subordinate_system_id, subordinate_system_name
,
current_year, statistic_time_unit, seq_time, premium, commission, pieces, piece_average_premium
,
current_version, is_active, created_at, created_by,
updated_at, updated_by
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
...
...
@@ -40,12 +43,14 @@
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.yd.dal.entity.marketing.MktLeadsGoals"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into ag_mkt_leads_goals (practitioner_id, current_year, statistic_time_unit,
insert into ag_mkt_leads_goals (goals_type, practitioner_id, subordinate_system_id,
subordinate_system_name, current_year, statistic_time_unit,
seq_time, premium, commission,
pieces, piece_average_premium, current_version,
is_active, created_at, created_by,
updated_at, updated_by)
values (#{practitionerId,jdbcType=BIGINT}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
values (#{goalsType,jdbcType=INTEGER}, #{practitionerId,jdbcType=BIGINT}, #{subordinateSystemId,jdbcType=BIGINT},
#{subordinateSystemName,jdbcType=VARCHAR}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
#{seqTime,jdbcType=INTEGER}, #{premium,jdbcType=INTEGER}, #{commission,jdbcType=INTEGER},
#{pieces,jdbcType=INTEGER}, #{pieceAveragePremium,jdbcType=INTEGER}, #{currentVersion,jdbcType=TIMESTAMP},
#{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
...
...
@@ -55,9 +60,18 @@
<!--@mbg.generated-->
insert into ag_mkt_leads_goals
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"goalsType != null"
>
goals_type,
</if>
<if
test=
"practitionerId != null"
>
practitioner_id,
</if>
<if
test=
"subordinateSystemId != null"
>
subordinate_system_id,
</if>
<if
test=
"subordinateSystemName != null"
>
subordinate_system_name,
</if>
<if
test=
"currentYear != null"
>
current_year,
</if>
...
...
@@ -99,9 +113,18 @@
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"goalsType != null"
>
#{goalsType,jdbcType=INTEGER},
</if>
<if
test=
"practitionerId != null"
>
#{practitionerId,jdbcType=BIGINT},
</if>
<if
test=
"subordinateSystemId != null"
>
#{subordinateSystemId,jdbcType=BIGINT},
</if>
<if
test=
"subordinateSystemName != null"
>
#{subordinateSystemName,jdbcType=VARCHAR},
</if>
<if
test=
"currentYear != null"
>
#{currentYear,jdbcType=INTEGER},
</if>
...
...
@@ -147,9 +170,18 @@
<!--@mbg.generated-->
update ag_mkt_leads_goals
<set>
<if
test=
"goalsType != null"
>
goals_type = #{goalsType,jdbcType=INTEGER},
</if>
<if
test=
"practitionerId != null"
>
practitioner_id = #{practitionerId,jdbcType=BIGINT},
</if>
<if
test=
"subordinateSystemId != null"
>
subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT},
</if>
<if
test=
"subordinateSystemName != null"
>
subordinate_system_name = #{subordinateSystemName,jdbcType=VARCHAR},
</if>
<if
test=
"currentYear != null"
>
current_year = #{currentYear,jdbcType=INTEGER},
</if>
...
...
@@ -195,7 +227,10 @@
<update
id=
"updateByPrimaryKey"
parameterType=
"com.yd.dal.entity.marketing.MktLeadsGoals"
>
<!--@mbg.generated-->
update ag_mkt_leads_goals
set practitioner_id = #{practitionerId,jdbcType=BIGINT},
set goals_type = #{goalsType,jdbcType=INTEGER},
practitioner_id = #{practitionerId,jdbcType=BIGINT},
subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT},
subordinate_system_name = #{subordinateSystemName,jdbcType=VARCHAR},
current_year = #{currentYear,jdbcType=INTEGER},
statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER},
seq_time = #{seqTime,jdbcType=INTEGER},
...
...
@@ -216,6 +251,7 @@
SET is_active = 0
WHERE practitioner_id = #{practitionerId,jdbcType=BIGINT}
AND current_year = #{year,jdbcType=INTEGER}
and goals_type = #{goalsType,jdbcType=INTEGER}
AND is_active = 1;
</update>
<select
id=
"selectByMktLeadsGoals"
resultMap=
"BaseResultMap"
>
...
...
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