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
0156300f
Commit
0156300f
authored
Apr 14, 2022
by
akexiu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
57a664c0
197320cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
129 deletions
+98
-129
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsDashboardDALServiceImpl.java
+1
-2
yd-api/src/main/resources/mapper/agms/AgmsDashboardMapper.xml
+55
-123
yd-api/src/main/resources/mapper/lifecommission/LifeCommissionMapper.xml
+42
-4
No files found.
yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsDashboardDALServiceImpl.java
View file @
0156300f
...
@@ -228,8 +228,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
...
@@ -228,8 +228,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
if
(
amount
>
0
){
if
(
amount
>
0
){
item
.
setRealRate
(
BigDecimal
.
valueOf
((
realAmount
.
doubleValue
()
/
amount
.
doubleValue
())
*
100
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
item
.
setRealRate
(
BigDecimal
.
valueOf
((
realAmount
.
doubleValue
()
/
amount
.
doubleValue
())
*
100
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
}
}
// 前端取amount作为报聘人数
item
.
setAmount
(
item
.
getHiringAmount
());
}
}
}
}
return
statisticsPractitionerInfos
;
return
statisticsPractitionerInfos
;
...
...
yd-api/src/main/resources/mapper/agms/AgmsDashboardMapper.xml
View file @
0156300f
...
@@ -234,21 +234,28 @@
...
@@ -234,21 +234,28 @@
) as level,
) as level,
</otherwise>
</otherwise>
</choose>
</choose>
concat(ifnull(sum(o.order_price),0),'') as fyp,
if(GROUP_CONCAT(DISTINCT o.id) is null, 0,
concat(ifnull(sum(o.fyc_amount),0),'') as fyc,
(select sum(t.order_price) from ag_po_order t where FIND_IN_SET(t.id, GROUP_CONCAT(DISTINCT o.id SEPARATOR ',')))
ifnull(count(o.id),0) as pieces
) as fyp,
concat(ifnull(sum(o.fyc_amount*lip.achievements_rate/100),0),'') as fyc,
ifnull(count(DISTINCT o.id),0) as pieces
from ag_acl_practitioner p
from ag_acl_practitioner p
INNER JOIN ag_acl_life_insurance_practitioner lip ON lip.practitioner_id= p.id
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
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_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
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
where o.status = 3 and o.payment_status=3
where o.status = 3 and o.payment_status=3
<choose>
<choose>
<when
test=
"category.equalsIgnoreCase('life')"
>
<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>
<when
test=
"category.equalsIgnoreCase('pc')"
>
<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>
</when>
</choose>
</choose>
<choose>
<choose>
...
@@ -293,22 +300,29 @@
...
@@ -293,22 +300,29 @@
where s.id=#{item.id}
where s.id=#{item.id}
) as level,
) as level,
ifnull(sum(o.order_price),0) as fyp,
if(GROUP_CONCAT(DISTINCT o.id) is null, 0,
ifnull(sum(o.fyc_amount),0) as fyc,
(select sum(t.order_price) from ag_po_order t where FIND_IN_SET(t.id, GROUP_CONCAT(DISTINCT o.id SEPARATOR ',')))
ifnull(count(o.id),0) as pieces
) as fyp,
ifnull(sum(o.fyc_amount*lip.achievements_rate/100),0) as fyc,
ifnull(count(DISTINCT o.id),0) as pieces
from ag_acl_practitioner p
from ag_acl_practitioner p
INNER JOIN ag_acl_life_insurance_practitioner lip ON lip.practitioner_id= p.id
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
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_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
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
where o.status = 3 and o.payment_status=3
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>
and p.id in
<foreach
collection=
"item.teamMember"
item=
"p_id"
open=
"("
separator=
","
close=
")"
>
#{p_id,jdbcType=BIGINT}
</foreach>
<choose>
<choose>
<when
test=
"category.equalsIgnoreCase('life')"
>
<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>
<when
test=
"category.equalsIgnoreCase('pc')"
>
<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>
</when>
</choose>
</choose>
<choose>
<choose>
...
@@ -335,63 +349,33 @@
...
@@ -335,63 +349,33 @@
<select
id=
"statisticsPractitioner"
resultType=
"com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo"
>
<select
id=
"statisticsPractitioner"
resultType=
"com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo"
>
<choose>
SELECT
<when
test=
"type.equalsIgnoreCase('B')"
>
ib.branch_name AS typeName,
SELECT
ib.id AS typeId,
ib.branch_name AS typeName,
ifnull( count( p.id ), 0 ) AS amount,
ib.id AS typeId,
ifnull( a.real_count, 0 ) AS realAmount,
ifnull( count( p.id ), 0 ) AS amount,
<include
refid=
"statisticsPractitionerHiring"
/>
AS hiringAmount,
ifnull( a.real_count, 0 ) AS realAmount,
sum(case when p.cert_list LIKE "%1%" then 1 else 0 end) AS mdrt
<include
refid=
"statisticsPractitionerHiring"
/>
AS hiringAmount,
FROM
sum(case when p.cert_list LIKE "%1%" then 1 else 0 end) AS mdrt
ag_acl_practitioner p
FROM
left join ag_acl_practitioner_hiring_approve_records hr on hr.hiring_basic_info_id=p.hiring_basic_info_id
ag_acl_practitioner p
and hr.approve_step_id=5 and hr.approving_status=1
left join ag_acl_practitioner_hiring_approve_records hr on hr.hiring_basic_info_id=p.hiring_basic_info_id
LEFT JOIN (
and hr.approve_step_id=5 and hr.approving_status=1
SELECT p.insurer_branch_id insurer_branch_id,
LEFT JOIN (
count( DISTINCT f.sale_practitioner_id ) AS real_count
SELECT p.insurer_branch_id insurer_branch_id,
FROM
count( DISTINCT o.broker_customer_id ) AS real_count
ag_acl_customer_fortune f
FROM ag_po_order o
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 o.broker_customer_id = p.customer_id
INNER JOIN ag_acl_practitioner p ON p.id = f.sale_practitioner_id
WHERE o.STATUS = 3 AND o.payment_status = 3
WHERE o.STATUS = 3 AND o.payment_status = 3
GROUP BY
GROUP BY
p.insurer_branch_id
p.insurer_branch_id
) a ON a.insurer_branch_id = p.insurer_branch_id
) a ON a.insurer_branch_id = p.insurer_branch_id
inner JOIN ag_acl_insurer_branch ib ON ib.id = p.insurer_branch_id and ib.is_active=1
inner JOIN ag_acl_insurer_branch ib ON ib.id = p.insurer_branch_id and ib.is_active=1
WHERE
WHERE
p.is_active = 1 AND p.insurer_branch_id IS NOT NULL
p.is_active = 1 AND p.insurer_branch_id IS NOT NULL
GROUP BY p.insurer_branch_id
GROUP BY p.insurer_branch_id
ORDER BY amount DESC
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>
<select
id=
"statisticsPractitionerTeam"
resultType=
"com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo"
>
<select
id=
"statisticsPractitionerTeam"
resultType=
"com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo"
>
...
@@ -419,12 +403,14 @@
...
@@ -419,12 +403,14 @@
<sql
id=
"realAmount"
>
<sql
id=
"realAmount"
>
(SELECT
(SELECT
count( DISTINCT
o.broker_custom
er_id )
count( DISTINCT
f.sale_practition
er_id )
FROM
FROM
ag_acl_customer_fortune f
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_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
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>
<choose>
<when
test=
"time.equalsIgnoreCase('D')"
>
<when
test=
"time.equalsIgnoreCase('D')"
>
and TO_DAYS(o.underwriting_date) = TO_DAYS(now())
and TO_DAYS(o.underwriting_date) = TO_DAYS(now())
...
@@ -445,60 +431,6 @@
...
@@ -445,60 +431,6 @@
)
)
</sql>
</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"
>
<sql
id=
"statisticsPractitionerHiring"
>
sum(case
sum(case
when
when
...
...
yd-api/src/main/resources/mapper/lifecommission/LifeCommissionMapper.xml
View file @
0156300f
...
@@ -48,18 +48,20 @@
...
@@ -48,18 +48,20 @@
o.broker_customer_id,
o.broker_customer_id,
o.cover_term_type coverageTerm,
o.cover_term_type coverageTerm,
CONCAT(o.payment_term, (case o.payment_term_unit when 'Y' then '年' when 'M' then '月' else '
日
' END)) payTerm
CONCAT(o.payment_term, (case o.payment_term_unit when 'Y' then '年' when 'M' then '月' else '
年
' END)) payTerm
from ag_po_order_commission oc
from ag_po_order_commission oc
left
join
inner
join
(SELECT id, order_price, product_id,
(SELECT id, order_price, product_id,
plan_id, insurer_id, order_date, config_level, cover_term, insurer_branch_id ydBranchId,
plan_id, insurer_id, order_date, config_level, cover_term, insurer_branch_id ydBranchId,
payment_term, payment_term_unit,broker_customer_id,
payment_term, payment_term_unit,broker_customer_id,
cover_term_type
cover_term_type
from ag_po_order t
from ag_po_order t
where t.status
in (3,4)
and t.policy_no is not null
where t.status
=3 and t.payment_status=3
and t.policy_no is not null
and (t.plan_id not in (424,453,464) or t.plan_id is null)
and (t.plan_id not in (424,453,464) or t.plan_id is null)
) o ON o.id = oc.order_id
) o ON o.id = oc.order_id
left join ag_product_life_commission_base b on oc.commission_base_id = b.id
left join ag_product_life_commission_base b on oc.commission_base_id = b.id
union all
<include
refid=
"manualCommission"
/>
) t
) t
left join ag_acl_insurer_branch ib on t.insurer_branch_id = ib.id
left join ag_acl_insurer_branch ib on t.insurer_branch_id = ib.id
left join ag_acl_insurer i ON t.insurer_id = i.id
left join ag_acl_insurer i ON t.insurer_id = i.id
...
@@ -120,6 +122,40 @@
...
@@ -120,6 +122,40 @@
order by t.orderDate desc
order by t.orderDate desc
</select>
</select>
<sql
id=
"manualCommission"
>
SELECT '' as orderId,
b.plan_id plan_id,
b.product_id product_id,
b.config_level config_level,
oc.insurer_id insurer_id,
oc.insurer_branch_id,
oc.commission_check_id,
oc.policy_no policyNo,
'' as orderPrice,
oc.rate commissionRate,
oc.amount commissionAmount,
oc.commission_status commissionCheckStatus,
'' as orderDate,
oc.commission_no commissionNo,
oc.id commissionId,
date_format(oc.commission_year, '%Y-%m-%d') commissionYear,
oc.commission_status commissionStatus,
oc.commission_time commissionTime,
oc.commission_period commissionPeriod,
oc.commission_type commissionType,
oc.commission_item commissionItem,
oc.practitioner_id practitionerId,
'' as ydBranchId,
'' as broker_customer_id,
'' as coverageTerm,
'' as payTerm
from ag_po_order_commission oc
left join ag_product_life_commission_base b on oc.commission_base_id = b.id
where oc.order_id is null
</sql>
<insert
id=
"insertOrderCommissionCheck"
parameterType=
"com.yd.dal.entity.commission.OrderCommissonCheck"
<insert
id=
"insertOrderCommissionCheck"
parameterType=
"com.yd.dal.entity.commission.OrderCommissonCheck"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
...
@@ -200,7 +236,7 @@
...
@@ -200,7 +236,7 @@
o.cover_term_type coverageTerm,
o.cover_term_type coverageTerm,
CONCAT(o.payment_term, (case o.payment_term_unit when 'Y' then '年' when 'M' then '月' else '年' END)) payTerm
CONCAT(o.payment_term, (case o.payment_term_unit when 'Y' then '年' when 'M' then '月' else '年' END)) payTerm
from ag_po_order_commission oc
from ag_po_order_commission oc
left
join
inner
join
(SELECT id, order_price, product_id,
(SELECT id, order_price, product_id,
plan_id, insurer_id, order_date, config_level, cover_term, insurer_branch_id ydBranchId,
plan_id, insurer_id, order_date, config_level, cover_term, insurer_branch_id ydBranchId,
payment_term, payment_term_unit,broker_customer_id,
payment_term, payment_term_unit,broker_customer_id,
...
@@ -210,6 +246,8 @@
...
@@ -210,6 +246,8 @@
and (t.plan_id not in (424,453,464) or t.plan_id is null)
and (t.plan_id not in (424,453,464) or t.plan_id is null)
) o ON o.id = oc.order_id
) o ON o.id = oc.order_id
left join ag_product_life_commission_base b on oc.commission_base_id = b.id
left join ag_product_life_commission_base b on oc.commission_base_id = b.id
union all
<include
refid=
"manualCommission"
/>
) t
) t
left join ag_acl_insurer_branch ib on t.insurer_branch_id = ib.id
left join ag_acl_insurer_branch ib on t.insurer_branch_id = ib.id
left join ag_acl_insurer i ON t.insurer_id = i.id
left join ag_acl_insurer i ON t.insurer_id = i.id
...
...
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