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
2cb6bb80
Commit
2cb6bb80
authored
May 25, 2020
by
yao.xiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加-查看团队完成率
parent
c1ed8f4a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
125 additions
and
1 deletions
+125
-1
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
+89
-1
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/TeamActionsAverageQueryResponseVO.java
+12
-0
yd-api/src/main/java/com/yd/dal/mapper/customer/AclPractitionerSubordinateSystemMapper.java
+5
-0
yd-api/src/main/java/com/yd/dal/service/customer/AclPractitionerSubordinateSystemDALService.java
+4
-0
yd-api/src/main/java/com/yd/dal/service/customer/impl/AclPractitionerSubordinateSystemDALServiceImpl.java
+6
-0
yd-api/src/main/resources/i18n/messages_zh_CN.properties
+2
-0
yd-api/src/main/resources/mapper/customer/AclPractitionerSubordinateSystemMapper.xml
+7
-0
No files found.
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
View file @
2cb6bb80
...
@@ -1374,7 +1374,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
...
@@ -1374,7 +1374,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//初始化之前数据 全部修改为不启用
//初始化之前数据 全部修改为不启用
initializationAction
(
practitionerId
,
year
,
goalsType
);
initializationAction
(
practitionerId
,
year
,
goalsType
);
//查询经纪人所在团队
//查询经纪人所在团队
AclPractitionerSubordinateSystem
subordinate
=
aclPractitionerSubordinateSystemDALService
.
findByPractitionerId
(
practitionerId
);
List
<
AclPractitionerSubordinateSystem
>
subordinates
=
aclPractitionerSubordinateSystemDALService
.
findByOwnerPractitionerId
(
practitionerId
);
if
(
subordinates
.
isEmpty
()){
responseVO
.
setCommonResult
(
new
CommonResult
(
false
,
ZHBErrorConfig
.
getErrorInfo
(
"830016"
)));
return
responseVO
;
}
AclPractitionerSubordinateSystem
subordinate
=
subordinates
.
get
(
0
);
//保存年目标
//保存年目标
Date
date
=
new
Date
();
Date
date
=
new
Date
();
saveYearGoal
(
requestVO
,
practitionerId
,
date
,
year
,
goalsType
,
subordinate
);
saveYearGoal
(
requestVO
,
practitionerId
,
date
,
year
,
goalsType
,
subordinate
);
...
@@ -1551,6 +1556,13 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
...
@@ -1551,6 +1556,13 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//年平均件数
//年平均件数
Double
piecesYearAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalPiecesYear"
),
practitionerNum
);
Double
piecesYearAverage
=
getScoreAverage
(
performanceForecast
.
get
(
"totalPiecesYear"
),
practitionerNum
);
List
<
MktLeadsGoals
>
leadsGoals
=
getYearTeamGoals
(
practitionerId
);
ConcurrentHashMap
<
String
,
Double
>
achievementRateMap
=
new
ConcurrentHashMap
<>();
if
(!
leadsGoals
.
isEmpty
()){
//计算完成率
achievementRateMap
=
getAchievementRate
(
leadsGoals
,
performanceForecast
);
}
responseVO
.
setScoreDayAverage
(
scoreDayAverage
);
responseVO
.
setScoreDayAverage
(
scoreDayAverage
);
responseVO
.
setScoreWeekAverage
(
scoreWeekAverage
);
responseVO
.
setScoreWeekAverage
(
scoreWeekAverage
);
responseVO
.
setScoreMonthAverage
(
scoreMonthAverage
);
responseVO
.
setScoreMonthAverage
(
scoreMonthAverage
);
...
@@ -1564,10 +1576,86 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
...
@@ -1564,10 +1576,86 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
responseVO
.
setPremiumYearAverage
(
premiumYearAverage
);
responseVO
.
setPremiumYearAverage
(
premiumYearAverage
);
responseVO
.
setCommissionYearAverage
(
commissionYearAverage
);
responseVO
.
setCommissionYearAverage
(
commissionYearAverage
);
responseVO
.
setPiecesYearAverage
(
piecesYearAverage
);
responseVO
.
setPiecesYearAverage
(
piecesYearAverage
);
responseVO
.
setAchievementRateYear
(
achievementRateMap
.
get
(
"achievementRateYear"
));
responseVO
.
setAchievementRateQuarter
(
achievementRateMap
.
get
(
"achievementRateQuarter"
));
responseVO
.
setAchievementRateMonth
(
achievementRateMap
.
get
(
"achievementRateMonth"
));
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
return
responseVO
;
return
responseVO
;
}
}
private
ConcurrentHashMap
<
String
,
Double
>
getAchievementRate
(
List
<
MktLeadsGoals
>
leadsGoals
,
HashMap
<
String
,
BigDecimal
>
performanceForecast
)
{
ConcurrentHashMap
<
String
,
Double
>
achievementRateMap
=
new
ConcurrentHashMap
<>();
//获取当前月份
Calendar
cal
=
Calendar
.
getInstance
();
int
month
=
cal
.
get
(
Calendar
.
MONTH
)+
1
;
//查询这个月所在季度是那几个月
Integer
[]
quarter
=
null
;
if
(
month
==
1
||
month
==
2
||
month
==
3
){
quarter
=
new
Integer
[]{
1
,
2
,
3
};
}
else
if
(
month
==
4
||
month
==
5
||
month
==
6
){
quarter
=
new
Integer
[]{
4
,
5
,
6
};
}
else
if
(
month
==
7
||
month
==
8
||
month
==
9
){
quarter
=
new
Integer
[]{
7
,
8
,
9
};
}
else
if
(
month
==
10
||
month
==
11
||
month
==
12
){
quarter
=
new
Integer
[]{
10
,
11
,
12
};
}
Integer
yearGoal
=
0
;
Integer
quarterGoal
=
0
;
Integer
monthGoal
=
0
;
for
(
MktLeadsGoals
info
:
leadsGoals
){
if
(
info
.
getStatisticTimeUnit
()==
1
){
//年目标
yearGoal
=
info
.
getCommission
();
}
else
if
(
info
.
getStatisticTimeUnit
()
==
3
){
//月目标
//判断是否为本季度
Integer
monthNum
=
info
.
getSeqTime
();
if
(
Arrays
.
asList
(
quarter
).
contains
(
monthNum
)){
quarterGoal
+=
info
.
getCommission
();
if
(
month
==
info
.
getSeqTime
()){
monthGoal
=
info
.
getCommission
();
}
}
}
}
//年完成率
Double
achievementRateYear
=
performanceForecast
.
get
(
"totalFYCYear"
)
.
divide
(
BigDecimal
.
valueOf
(
yearGoal
),
4
,
BigDecimal
.
ROUND_HALF_UP
)
.
doubleValue
();
achievementRateMap
.
put
(
"achievementRateYear"
,
achievementRateYear
);
//季完成率
Double
achievementRateQuarter
=
performanceForecast
.
get
(
"totalFYCQuarter"
)
.
divide
(
BigDecimal
.
valueOf
(
quarterGoal
),
4
,
BigDecimal
.
ROUND_HALF_UP
)
.
doubleValue
();
achievementRateMap
.
put
(
"achievementRateQuarter"
,
achievementRateQuarter
);
//月完成率
Double
achievementRateMonth
=
performanceForecast
.
get
(
"totalFYCMonth"
)
.
divide
(
BigDecimal
.
valueOf
(
monthGoal
),
4
,
BigDecimal
.
ROUND_HALF_UP
)
.
doubleValue
();
achievementRateMap
.
put
(
"achievementRateMonth"
,
achievementRateMonth
);
return
achievementRateMap
;
}
private
List
<
MktLeadsGoals
>
getYearTeamGoals
(
Long
practitionerId
)
{
//查询团队长设置的月/季/年 FYC目标 ag_mkt_leads_goals
MktLeadsGoals
mktLeadsGoals
=
new
MktLeadsGoals
();
mktLeadsGoals
.
setIsActive
(
1
);
//是否启用
mktLeadsGoals
.
setPractitionerId
(
practitionerId
);
//团队长经纪人id
mktLeadsGoals
.
setGoalsType
(
2
);
//目标类型:1:经纪人指标,2:团队指标
//当前年份
Calendar
cal
=
Calendar
.
getInstance
();
int
year
=
cal
.
get
(
Calendar
.
YEAR
);
mktLeadsGoals
.
setCurrentYear
(
year
);
List
<
AclPractitionerSubordinateSystem
>
subordinateSystems
=
aclPractitionerSubordinateSystemDALService
.
findByOwnerPractitionerId
(
practitionerId
);
if
(!
subordinateSystems
.
isEmpty
()){
AclPractitionerSubordinateSystem
subordinateSystem
=
subordinateSystems
.
get
(
0
);
mktLeadsGoals
.
setSubordinateSystemId
(
subordinateSystem
.
getId
());
}
return
mktLeadsGoalsDALService
.
findByMktLeadsGoals
(
mktLeadsGoals
);
}
/**
/**
* 通过总分计算平均分 保留两位小数
* 通过总分计算平均分 保留两位小数
* @param total 总分
* @param total 总分
...
...
yd-api/src/main/java/com/yd/api/practitioner/vo/salestarget/TeamActionsAverageQueryResponseVO.java
View file @
2cb6bb80
...
@@ -58,5 +58,17 @@ public class TeamActionsAverageQueryResponseVO {
...
@@ -58,5 +58,17 @@ public class TeamActionsAverageQueryResponseVO {
* 年平均件数
* 年平均件数
*/
*/
private
Double
piecesYearAverage
;
private
Double
piecesYearAverage
;
/**
* 年完成率
*/
private
Double
achievementRateYear
;
/**
* 季完成率
*/
private
Double
achievementRateQuarter
;
/**
* 月完成率
*/
private
Double
achievementRateMonth
;
private
CommonResult
commonResult
;
private
CommonResult
commonResult
;
}
}
yd-api/src/main/java/com/yd/dal/mapper/customer/AclPractitionerSubordinateSystemMapper.java
View file @
2cb6bb80
...
@@ -3,6 +3,8 @@ package com.yd.dal.mapper.customer;
...
@@ -3,6 +3,8 @@ package com.yd.dal.mapper.customer;
import
com.yd.dal.entity.customer.AclPractitionerSubordinateSystem
;
import
com.yd.dal.entity.customer.AclPractitionerSubordinateSystem
;
import
com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo
;
import
com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo
;
import
java.util.List
;
public
interface
AclPractitionerSubordinateSystemMapper
{
public
interface
AclPractitionerSubordinateSystemMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
deleteByPrimaryKey
(
Long
id
);
...
@@ -19,4 +21,6 @@ public interface AclPractitionerSubordinateSystemMapper {
...
@@ -19,4 +21,6 @@ public interface AclPractitionerSubordinateSystemMapper {
PractitionerSubordinateInfo
findSubordinateInfo
(
Long
subordinateId
);
PractitionerSubordinateInfo
findSubordinateInfo
(
Long
subordinateId
);
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
);
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
);
List
<
AclPractitionerSubordinateSystem
>
findByOwnerPractitionerId
(
Long
practitionerId
);
}
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/service/customer/AclPractitionerSubordinateSystemDALService.java
View file @
2cb6bb80
...
@@ -4,9 +4,13 @@ import com.yd.dal.entity.customer.AclPractitionerSubordinateSystem;
...
@@ -4,9 +4,13 @@ import com.yd.dal.entity.customer.AclPractitionerSubordinateSystem;
import
com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo
;
import
com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
(
"aclPractitionerSubordinateSystemDALService"
)
@Service
(
"aclPractitionerSubordinateSystemDALService"
)
public
interface
AclPractitionerSubordinateSystemDALService
{
public
interface
AclPractitionerSubordinateSystemDALService
{
PractitionerSubordinateInfo
findSubordinateInfo
(
Long
subordinateId
);
PractitionerSubordinateInfo
findSubordinateInfo
(
Long
subordinateId
);
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
);
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
);
List
<
AclPractitionerSubordinateSystem
>
findByOwnerPractitionerId
(
Long
practitionerId
);
}
}
yd-api/src/main/java/com/yd/dal/service/customer/impl/AclPractitionerSubordinateSystemDALServiceImpl.java
View file @
2cb6bb80
...
@@ -7,6 +7,7 @@ import com.yd.dal.service.customer.AclPractitionerSubordinateSystemDALService;
...
@@ -7,6 +7,7 @@ import com.yd.dal.service.customer.AclPractitionerSubordinateSystemDALService;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Service
(
"aclPractitionerSubordinateSystemDALService"
)
@Service
(
"aclPractitionerSubordinateSystemDALService"
)
public
class
AclPractitionerSubordinateSystemDALServiceImpl
implements
AclPractitionerSubordinateSystemDALService
{
public
class
AclPractitionerSubordinateSystemDALServiceImpl
implements
AclPractitionerSubordinateSystemDALService
{
...
@@ -30,4 +31,9 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti
...
@@ -30,4 +31,9 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti
public
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
)
{
public
AclPractitionerSubordinateSystem
findByPractitionerId
(
Long
practitionerId
)
{
return
aclPractitionerSubordinateSystemMapper
.
findByPractitionerId
(
practitionerId
);
return
aclPractitionerSubordinateSystemMapper
.
findByPractitionerId
(
practitionerId
);
}
}
@Override
public
List
<
AclPractitionerSubordinateSystem
>
findByOwnerPractitionerId
(
Long
practitionerId
)
{
return
aclPractitionerSubordinateSystemMapper
.
findByOwnerPractitionerId
(
practitionerId
);
}
}
}
yd-api/src/main/resources/i18n/messages_zh_CN.properties
View file @
2cb6bb80
...
@@ -28,4 +28,5 @@
...
@@ -28,4 +28,5 @@
830013
=
请填写备注!
830013
=
请填写备注!
830014
=
此客户已是其他经纪人商机
830014
=
此客户已是其他经纪人商机
830015
=
每天同一个跟进状态只能对一个商机经行一次增加!
830015
=
每天同一个跟进状态只能对一个商机经行一次增加!
830016
=
您不是团队长,无法进行编辑保存
900003
=
保险公司响应报文为空!
900003
=
保险公司响应报文为空!
\ No newline at end of file
yd-api/src/main/resources/mapper/customer/AclPractitionerSubordinateSystemMapper.xml
View file @
2cb6bb80
...
@@ -248,4 +248,10 @@
...
@@ -248,4 +248,10 @@
left join ag_acl_practitioner p on p.subordinate_system_id = s.id
left join ag_acl_practitioner p on p.subordinate_system_id = s.id
where p.id = #{practitionerId,jdbcType=BIGINT}
where p.id = #{practitionerId,jdbcType=BIGINT}
</select>
</select>
<select
id=
"findByOwnerPractitionerId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from ag_acl_practitioner_subordinate_system
where owner_practitioner_id = #{practitionerId,jdbcType=BIGINT}
</select>
</mapper>
</mapper>
\ No newline at end of file
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