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
74f7a213
Commit
74f7a213
authored
May 12, 2021
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AGMS的N22寿险数据统计
parent
02cac741
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
153 additions
and
11 deletions
+153
-11
yd-api/src/main/java/com/yd/api/agms/service/impl/AgmsDashboardServiceImpl.java
+123
-10
yd-api/src/main/java/com/yd/dal/service/agms/AgmsDashboardDALService.java
+2
-0
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsDashboardDALServiceImpl.java
+2
-1
yd-api/src/main/java/com/yd/rmi/n22/salary/pojo/Achieve.java
+2
-0
yd-api/src/main/java/com/yd/util/CommonUtil.java
+24
-0
No files found.
yd-api/src/main/java/com/yd/api/agms/service/impl/AgmsDashboardServiceImpl.java
View file @
74f7a213
...
...
@@ -6,9 +6,15 @@ import com.yd.api.agms.vo.dashboard.*;
import
com.yd.api.result.CommonResult
;
import
com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo
;
import
com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo
;
import
com.yd.dal.entity.customer.practitioner.PractitionerRankInfo
;
import
com.yd.dal.entity.meta.MdDropOptions
;
import
com.yd.dal.service.agms.AgmsDashboardDALService
;
import
com.yd.dal.service.meta.MdDropOptionsDALService
;
import
com.yd.rmi.n22.salary.pojo.Achieve
;
import
com.yd.rmi.n22.salary.pojo.SearchStaffAchievementRequestBody
;
import
com.yd.rmi.n22.salary.pojo.SearchStaffAchievementResponseVO
;
import
com.yd.rmi.n22.salary.service.N22SalaryService
;
import
com.yd.util.CommonUtil
;
import
com.yd.util.config.ZHBErrorConfig
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -16,7 +22,9 @@ import org.springframework.stereotype.Service;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
(
"agmsDashboardService"
)
public
class
AgmsDashboardServiceImpl
implements
AgmsDashboardService
{
...
...
@@ -25,6 +33,8 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
private
AgmsDashboardDALService
agmsDashboardDALService
;
@Autowired
private
MdDropOptionsDALService
mdDropOptionsDALService
;
@Autowired
private
N22SalaryService
n22SalaryService
;
@Override
public
StatisticsPEPResponseVO
statisticsPEP
(
StatisticsPEPRequestVO
requestVO
)
{
...
...
@@ -92,39 +102,142 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
@Override
public
StatisticsSalesResponseVO
statisticsSales
(
StatisticsSalesRequestVO
requestVO
)
{
StatisticsSalesResponseVO
responseVO
=
new
StatisticsSalesResponseVO
();
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
String
category
=
requestVO
.
getCategory
();
String
time
=
requestVO
.
getTime
();
String
type
=
requestVO
.
getType
();
category
=
Strings
.
isNullOrEmpty
(
category
)
?
"all"
:
category
;
time
=
Strings
.
isNullOrEmpty
(
time
)
?
"m"
:
time
;
type
=
Strings
.
isNullOrEmpty
(
type
)
?
"b"
:
type
;
List
<
StatisticsSalesInfo
>
statisticsSalesInfos
;
if
(
"life"
.
equals
(
category
)){
//寿险
statisticsSalesInfos
=
agmsDashboardDALService
.
statisticsSalesEG
(
type
,
time
);
}
else
if
(
"pc"
.
equals
(
category
)){
//产险
statisticsSalesInfos
=
agmsDashboardDALService
.
statisticsSalesYD
(
type
,
time
);
}
else
{
statisticsSalesInfos
=
getAll
(
type
,
time
);
List
<
StatisticsSalesInfo
>
statisticsSalesInfos
=
null
;
try
{
if
(
"life"
.
equals
(
category
))
{
//寿险
// statisticsSalesInfos = agmsDashboardDALService.statisticsSalesEG(type, time);
// 查询N22接口获取寿险数据
statisticsSalesInfos
=
this
.
statisticsSalesN22
(
category
,
type
,
time
);
}
else
if
(
"pc"
.
equals
(
category
))
{
//产险
statisticsSalesInfos
=
agmsDashboardDALService
.
statisticsSalesYD
(
type
,
time
);
}
else
{
statisticsSalesInfos
=
getAll
(
category
,
type
,
time
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
responseVO
.
setCommonResult
(
new
CommonResult
(
false
,
e
.
getMessage
()));
}
responseVO
.
setStatisticsSalesInfos
(
statisticsSalesInfos
);
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
return
responseVO
;
}
private
List
<
StatisticsSalesInfo
>
statisticsSalesN22
(
String
category
,
String
type
,
String
time
)
throws
Exception
{
// 1.根据Agent_id当前经纪人的佣金明细
SearchStaffAchievementResponseVO
searchStaffAchievementResponseVO
=
this
.
queryN22
(
category
,
type
,
time
);
if
(!
"查询成功"
.
equals
(
searchStaffAchievementResponseVO
.
getResponseHead
().
getMessage
())){
throw
new
Exception
(
"N22寿险业绩统计查询错误"
);
}
List
<
Achieve
>
achieveList
=
searchStaffAchievementResponseVO
.
getResponseBody
().
getAchieveList
();
// 2.筛选结果集
if
(
"life"
.
equals
(
category
))
{
if
(
"t"
.
equals
(
type
))
{
achieveList
=
achieveList
.
stream
()
.
filter
((
Achieve
i
)
->
"寿险团队"
.
equals
(
i
.
getRolegrouptype
()))
.
collect
(
Collectors
.
toList
());
}
else
if
(
"b"
.
equals
(
type
))
{
achieveList
=
achieveList
.
stream
()
.
filter
((
Achieve
i
)
->
"二级机构"
.
equals
(
i
.
getRolegrouptype
()))
.
collect
(
Collectors
.
toList
());
}
}
System
.
out
.
println
(
"筛选后的数据"
);
System
.
out
.
println
(
achieveList
);
// 3.组装返回报文
List
<
StatisticsSalesInfo
>
infoList
=
new
ArrayList
<>();
StatisticsSalesInfo
info
=
null
;
for
(
Achieve
achieve
:
achieveList
)
{
info
=
new
StatisticsSalesInfo
();
info
.
setPieces
(
achieve
.
getSucNumber
());
info
.
setFyp
(
Double
.
toString
(
achieve
.
getFYP
()));
info
.
setFyc
(
Double
.
toString
(
achieve
.
getFYC
()));
info
.
setTypeName
(
achieve
.
getDescription
());
infoList
.
add
(
info
);
}
// 3.计算件均保费
agmsDashboardDALService
.
getUnitPremium
(
infoList
);
return
infoList
;
}
private
SearchStaffAchievementResponseVO
queryN22
(
String
category
,
String
type
,
String
time
)
{
// 1.根据查询时间范围获取查询开始时间和结束时间
String
startTime
;
String
endTime
;
if
(
"d"
.
equals
(
time
))
{
endTime
=
startTime
=
CommonUtil
.
dateParseString
(
new
Date
(),
"yyyy-MM-dd"
);
}
else
if
(
"w"
.
equals
(
time
))
{
startTime
=
CommonUtil
.
getWeekStart
();
endTime
=
CommonUtil
.
getWeekEnd
();
}
else
if
(
"m"
.
equals
(
time
))
{
startTime
=
CommonUtil
.
getBeginDayOfMonth
();
endTime
=
CommonUtil
.
getEndDayOfMonth
();
}
else
if
(
"q"
.
equals
(
time
))
{
startTime
=
CommonUtil
.
getStartOrEndDayOfQuarter
(
true
);
endTime
=
CommonUtil
.
getStartOrEndDayOfQuarter
(
false
);
}
else
{
startTime
=
CommonUtil
.
getBeginDayOfYear
();
endTime
=
CommonUtil
.
getEndDayOfYear
();
}
SearchStaffAchievementRequestBody
searchStaffAchievementRequestBody
=
new
SearchStaffAchievementRequestBody
();
searchStaffAchievementRequestBody
.
setIssuedatestart
(
startTime
);
searchStaffAchievementRequestBody
.
setIssuedateend
(
endTime
);
searchStaffAchievementRequestBody
.
setPolicystatus
(
"201"
);
if
(
"life"
.
equals
(
category
))
{
if
(
"b"
.
equals
(
type
))
{
searchStaffAchievementRequestBody
.
setSearchtype
(
"3"
);
searchStaffAchievementRequestBody
.
setIsdown
(
"0"
);
}
else
{
searchStaffAchievementRequestBody
.
setSearchtype
(
"2"
);
searchStaffAchievementRequestBody
.
setIsdown
(
"0"
);
}
}
else
if
(
"all"
.
equals
(
category
))
{
searchStaffAchievementRequestBody
.
setOrganization_id
(
"HX6ZCQ"
);
searchStaffAchievementRequestBody
.
setSearchtype
(
"3"
);
searchStaffAchievementRequestBody
.
setIsdown
(
"1"
);
}
return
n22SalaryService
.
searchStaffAchievement
(
searchStaffAchievementRequestBody
);
}
/**
* dashBoard -- 寿险+产险销售统计
* @param type 类型
* @param time 时间
* @return 数据
*/
private
List
<
StatisticsSalesInfo
>
getAll
(
String
type
,
String
time
)
{
private
List
<
StatisticsSalesInfo
>
getAll
(
String
category
,
String
type
,
String
time
)
throws
Exception
{
StatisticsSalesInfo
statisticsSalesInfo
=
new
StatisticsSalesInfo
();
List
<
StatisticsSalesInfo
>
statisticsSalesInfos
=
new
ArrayList
<>();
String
unitPremium
=
"0"
;
double
fyp
=
0
D
,
fyc
=
0
D
;
Integer
pieces
=
0
;
List
<
StatisticsSalesInfo
>
statisticsSalesInfosLife
=
agmsDashboardDALService
.
statisticsSalesEG
(
type
,
time
);
// List<StatisticsSalesInfo> statisticsSalesInfosLife = agmsDashboardDALService.statisticsSalesEG(type,time);
// 查询N22接口获取寿险数据
List
<
StatisticsSalesInfo
>
statisticsSalesInfosLife
=
this
.
statisticsSalesN22
(
category
,
type
,
time
);
List
<
StatisticsSalesInfo
>
statisticsSalesInfosPC
=
agmsDashboardDALService
.
statisticsSalesYD
(
type
,
time
);
statisticsSalesInfosLife
.
addAll
(
statisticsSalesInfosPC
);
if
(
statisticsSalesInfosLife
.
size
()
>
0
){
for
(
StatisticsSalesInfo
item
:
statisticsSalesInfosLife
){
...
...
yd-api/src/main/java/com/yd/dal/service/agms/AgmsDashboardDALService.java
View file @
74f7a213
...
...
@@ -20,4 +20,6 @@ public interface AgmsDashboardDALService {
List
<
StatisticsSalesInfo
>
statisticsSalesEG
(
String
type
,
String
time
);
List
<
PersonalOffLineFYC
>
offLineFYC
(
List
<
String
>
mobileNoList
);
void
getUnitPremium
(
List
<
StatisticsSalesInfo
>
statisticsSalesInfos
);
}
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsDashboardDALServiceImpl.java
View file @
74f7a213
...
...
@@ -101,7 +101,8 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
* 获取均件保费
* @param statisticsSalesInfos
*/
private
void
getUnitPremium
(
List
<
StatisticsSalesInfo
>
statisticsSalesInfos
)
{
@Override
public
void
getUnitPremium
(
List
<
StatisticsSalesInfo
>
statisticsSalesInfos
)
{
if
(
statisticsSalesInfos
!=
null
&&
statisticsSalesInfos
.
size
()
>
0
){
String
fyp
;
Integer
pieces
;
...
...
yd-api/src/main/java/com/yd/rmi/n22/salary/pojo/Achieve.java
View file @
74f7a213
...
...
@@ -8,6 +8,8 @@ public class Achieve {
private
String
Description
;
private
String
Rolegrouptype
;
private
String
SearchType
;
private
Double
FYC
;
...
...
yd-api/src/main/java/com/yd/util/CommonUtil.java
View file @
74f7a213
...
...
@@ -1629,4 +1629,28 @@ public class CommonUtil {
return
dayBefore
;
}
/**
* 获取本周的第一天
* @return String
* **/
public
static
String
getWeekStart
()
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
WEEK_OF_MONTH
,
0
);
cal
.
set
(
Calendar
.
DAY_OF_WEEK
,
2
);
Date
time
=
cal
.
getTime
();
return
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
time
);
}
/**
* 获取本周的最后一天
* @return String
* **/
public
static
String
getWeekEnd
()
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
Calendar
.
DAY_OF_WEEK
,
cal
.
getActualMaximum
(
Calendar
.
DAY_OF_WEEK
));
cal
.
add
(
Calendar
.
DAY_OF_WEEK
,
1
);
Date
time
=
cal
.
getTime
();
return
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
time
);
}
}
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