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
aefab85d
Commit
aefab85d
authored
Apr 14, 2022
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard分公司统计2
parent
08c1938a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
97 deletions
+19
-97
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsDashboardDALServiceImpl.java
+1
-2
yd-api/src/main/resources/mapper/agms/AgmsDashboardMapper.xml
+18
-95
No files found.
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsDashboardDALServiceImpl.java
View file @
aefab85d
...
...
@@ -228,8 +228,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
if
(
amount
>
0
){
item
.
setRealRate
(
BigDecimal
.
valueOf
((
realAmount
.
doubleValue
()
/
amount
.
doubleValue
())
*
100
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
}
// 前端取amount作为报聘人数
item
.
setAmount
(
item
.
getHiringAmount
());
}
}
return
statisticsPractitionerInfos
;
...
...
yd-api/src/main/resources/mapper/agms/AgmsDashboardMapper.xml
View file @
aefab85d
...
...
@@ -234,7 +234,7 @@
) as level,
</otherwise>
</choose>
concat(ifnull(sum(o.order_price),0),'') as fyp,
concat(ifnull(sum(o.order_price
*lip.achievements_rate/100
),0),'') as fyp,
concat(ifnull(sum(o.fyc_amount),0),'') as fyc,
ifnull(count(o.id),0) as pieces
from ag_acl_practitioner p
...
...
@@ -298,22 +298,27 @@
where s.id=#{item.id}
) as level,
ifnull(sum(o.order_price),0) as fyp,
ifnull(sum(o.order_price
*lip.achievements_rate/100
),0) as fyp,
ifnull(sum(o.fyc_amount),0) as fyc,
ifnull(count(o.id),0) as pieces
from ag_acl_practitioner p
INNER JOIN ag_acl_life_insurance_practitioner lip ON lip.practitioner_id= p.id
INNER JOIN ag_po_order o ON o.policy_no = lip.policy_no
left join ag_product prd on prd.id = o.product_id
left join ag_product_category c1 on c1.id = prd.product_category_id
left join ag_product_plan a on o.plan_id = a.id
left join ag_product aa on aa.id = a.product_id
left join ag_product_category c2 on c2.id = aa.product_category_id
left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
where o.status = 3 and o.payment_status=3
and p.id in
<foreach
collection=
"item.teamMember"
item=
"p_id"
open=
"("
separator=
","
close=
")"
>
#{p_id,jdbcType=BIGINT}
</foreach>
<choose>
<when
test=
"category.equalsIgnoreCase('life')"
>
and
o.product_category_id in (2,5,8
)
and
(c1.id in (2,5,8) or c2.id in (2,5,8)
)
</when>
<when
test=
"category.equalsIgnoreCase('pc')"
>
and
o.product_category_id not in (2,5,8
)
and
(c1.id not in (2,5,8) or c2.id not in (2,5,8)
)
</when>
</choose>
<choose>
...
...
@@ -340,8 +345,6 @@
<select
id=
"statisticsPractitioner"
resultType=
"com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo"
>
<choose>
<when
test=
"type.equalsIgnoreCase('B')"
>
SELECT
ib.branch_name AS typeName,
ib.id AS typeId,
...
...
@@ -355,9 +358,11 @@
and hr.approve_step_id=5 and hr.approving_status=1
LEFT JOIN (
SELECT p.insurer_branch_id insurer_branch_id,
count( DISTINCT o.broker_customer_id ) AS real_count
FROM ag_po_order o
INNER JOIN ag_acl_practitioner p ON o.broker_customer_id = p.customer_id
count( DISTINCT f.sale_practitioner_id ) AS real_count
FROM
ag_acl_customer_fortune f
left JOIN ag_po_order o ON f.order_id = o.id and o.STATUS = 3 AND o.payment_status = 3
INNER JOIN ag_acl_practitioner p ON p.id = f.sale_practitioner_id
WHERE o.STATUS = 3 AND o.payment_status = 3
GROUP BY
p.insurer_branch_id
...
...
@@ -367,36 +372,6 @@
p.is_active = 1 AND p.insurer_branch_id IS NOT NULL
GROUP BY p.insurer_branch_id
ORDER BY amount DESC
</when>
<otherwise>
SELECT
s.id as typeId,
s.name as typeName,
ifnull( count( p.id ), 0 ) AS amount,
ifnull( a.real_count, 0 ) AS realAmount,
<include
refid=
"statisticsPractitionerHiring"
/>
AS hiringAmount,
sum(case when p.cert_list LIKE "%1%" then 1 else 0 end) AS mdrt
FROM
ag_acl_practitioner p
left join ag_acl_practitioner_hiring_approve_records hr on hr.hiring_basic_info_id=p.hiring_basic_info_id
and hr.approve_step_id=5 and hr.approving_status=1
LEFT JOIN (
SELECT p.subordinate_system_id subordinate_system_id,
count( DISTINCT o.broker_customer_id ) AS real_count
FROM
ag_po_order o
INNER JOIN ag_acl_practitioner p ON o.broker_customer_id = p.customer_id
WHERE o.STATUS = 3 AND o.payment_status = 3
GROUP BY p.subordinate_system_id
) a ON a.subordinate_system_id = p.subordinate_system_id
inner join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id and s.is_active=1
WHERE p.is_active = 1
AND p.subordinate_system_id IS NOT NULL
GROUP BY p.subordinate_system_id
ORDER BY amount DESC
</otherwise>
</choose>
</select>
<select
id=
"statisticsPractitionerTeam"
resultType=
"com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo"
>
...
...
@@ -424,12 +399,14 @@
<sql
id=
"realAmount"
>
(SELECT
count( DISTINCT
o.broker_custom
er_id )
count( DISTINCT
f.sale_practition
er_id )
FROM
ag_acl_customer_fortune f
left JOIN ag_po_order o ON f.order_id = o.id and o.STATUS = 3 AND o.payment_status = 3
left JOIN ag_acl_practitioner p ON
o.broker_customer_id = p.custom
er_id
left JOIN ag_acl_practitioner p ON
p.id = f.sale_practition
er_id
WHERE 1=1
and p.id in
<foreach
collection=
"item.teamMember"
item=
"p_id"
open=
"("
separator=
","
close=
")"
>
#{p_id,jdbcType=BIGINT}
</foreach>
and p.is_active = 1
<choose>
<when
test=
"time.equalsIgnoreCase('D')"
>
and TO_DAYS(o.underwriting_date) = TO_DAYS(now())
...
...
@@ -450,60 +427,6 @@
)
</sql>
<sql
id=
"statisticsPractitionerS2"
>
SELECT
s.id as typeId,
s.name as typeName,
ifnull( count( p.id ), 0 ) AS amount,
ifnull( a.real_count, 0 ) AS realAmount,
<include
refid=
"statisticsPractitionerHiring"
/>
AS hiringAmount,
sum(case when p.cert_list LIKE "%1%" then 1 else 0 end) AS mdrt
FROM
ag_acl_practitioner p
left join ag_acl_practitioner_hiring_approve_records hr on hr.hiring_basic_info_id=p.hiring_basic_info_id
and hr.approve_step_id=5 and hr.approving_status=1
LEFT JOIN (
SELECT p.s2_id s2_id,
count( DISTINCT o.broker_customer_id ) AS real_count
FROM
ag_po_order o
INNER JOIN ag_acl_practitioner p ON o.broker_customer_id = p.customer_id
WHERE o.STATUS = 3 AND o.payment_status = 3
GROUP BY p.subordinate_system_id
) a ON a.s2_id = p.s2_id
inner join ag_acl_practitioner_subordinate_system s on s.id = p.s2_id and s.is_active=1
WHERE p.is_active = 1
AND p.s2_id IS NOT NULL
GROUP BY p.s2_id
</sql>
<sql
id=
"statisticsPractitionerS3"
>
SELECT
s.id as typeId,
s.name as typeName,
ifnull( count( p.id ), 0 ) AS amount,
ifnull( a.real_count, 0 ) AS realAmount,
<include
refid=
"statisticsPractitionerHiring"
/>
AS hiringAmount,
sum(case when p.cert_list LIKE "%1%" then 1 else 0 end) AS mdrt
FROM
ag_acl_practitioner p
left join ag_acl_practitioner_hiring_approve_records hr on hr.hiring_basic_info_id=p.hiring_basic_info_id
and hr.approve_step_id=5 and hr.approving_status=1
LEFT JOIN (
SELECT p.s3_id s3_id,
count( DISTINCT o.broker_customer_id ) AS real_count
FROM
ag_po_order o
INNER JOIN ag_acl_practitioner p ON o.broker_customer_id = p.customer_id
WHERE o.STATUS = 3 AND o.payment_status = 3
GROUP BY p.subordinate_system_id
) a ON a.s3_id = p.s3_id
inner join ag_acl_practitioner_subordinate_system s on s.id = p.s3_id and s.is_active=1
WHERE p.is_active = 1
AND p.s3_id IS NOT NULL
GROUP BY p.s3_id
</sql>
<sql
id=
"statisticsPractitionerHiring"
>
sum(case
when
...
...
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