fix bug:统计模块按照来款时间排序

This commit is contained in:
zhangqinlin
2021-10-20 14:14:30 +08:00
parent cb38fb1ec5
commit 2d683de5e8
7 changed files with 102 additions and 269 deletions
@@ -189,8 +189,4 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
List<PrincipalPeopleDetail> queryPageListForPrincipalDetailTwo(@Param("principalPeopleDetailSearch") PrincipalPeopleDetailSearch principalPeopleDetailSearch,@Param("ids") ArrayList<String> ids);
List<PrincipalPeopleList> queryPageListForPrincipalIds(@Param("principalPeopleSearch") PrincipalPeopleSearch principalPeopleSearch,@Param("idList") List<String> idList,@Param("ids") List<String> ids);
List<CompanyComeMoneyList> queryPageListForCompanyIds(@Param("companyComeMoneySearch") CompanyComeMoneySearch companyComeMoneySearch,@Param("idList") List<String> idList,@Param("ids") List<String> ids);
}
@@ -122,12 +122,18 @@
pwgs.allMoney,
pwgs.comeAllMoney,
pwgs.createTime,
CONCAT(CAST(ROUND((pwgs.comeAllMoney/pwgs.allMoney)*100,2) AS CHAR),'%') AS moneyRate
FROM pay_working_group pwg left join (select pwg1s.id,pwg1s.create_time AS createTime,working_group_id,SUM(receivable_amount) AS
allMoney,SUM(paid_amount) AS comeAllMoney
CONCAT(CAST(ROUND((pwgs.comeAllMoney/pwgs.allMoney)*100,2) AS CHAR),'%') AS moneyRate,pwgs.payment_date
FROM pay_working_group pwg left join
(
SELECT id, createTime,working_group_id,
sum(allMoney) as allMoney,sum(comeAllMoney) as comeAllMoney,max(pwg2s.payment_date) as payment_date from
(select pwg1s.id,pwg1s.create_time AS createTime,working_group_id,receivable_amount AS
allMoney,paid_amount AS comeAllMoney,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwg1s
inner join pay_payment_record ppr on(pwg1s.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{payWorkingGroupSearch.year},'%') group by pwg1s.working_group_id)
WHERE ppr.payment_date like concat('%',#{payWorkingGroupSearch.year},'%') group by pwg1s.id
) pwg2s group by pwg2s.working_group_id
)
pwgs on(pwg.id=pwgs.working_group_id)
<where>
<if test="ids != null and ids != ''">
@@ -154,7 +160,7 @@
</otherwise>
</choose>
</where>) ppp order by createTime desc
</where>) ppp order by ppp.payment_date desc
</select>
<!-- 工作组统计ids-->
@@ -166,9 +172,9 @@
pwgs.allMoney,
pwgs.comeAllMoney,
pwgs.createTime,
CONCAT(CAST(ROUND((pwgs.comeAllMoney/pwgs.allMoney)*100,2) AS CHAR),'%') AS moneyRate
CONCAT(CAST(ROUND((pwgs.comeAllMoney/pwgs.allMoney)*100,2) AS CHAR),'%') AS moneyRate,max(pwgs.payment_date) as payment_date
FROM pay_working_group pwg left join (select pwg1s.id,pwg1s.create_time AS createTime,working_group_id,SUM(receivable_amount) AS
allMoney,SUM(paid_amount) AS comeAllMoney
allMoney,SUM(paid_amount) AS comeAllMoney,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwg1s
inner join pay_payment_record ppr on(pwg1s.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{payWorkingGroupSearch.year},'%') group by pwg1s.working_group_id)
@@ -204,7 +210,7 @@
</otherwise>
</choose>
</where>) ppp order by createTime desc
</where>) ppp order by ppp.payment_date desc
</select>
<select id="queryPageListForStatisticsFirstPage" resultType="com.jero.project.entity.PayWorkingGroupStatistics">
@@ -533,7 +539,7 @@
</choose>
</where>) pp inner join
(
select pwgs.id as id
select pwgs.id as id,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwgs
inner join pay_payment_record ppr on(pwgs.id=ppr.project_id)
WHERE ppr.payment_date like
@@ -541,27 +547,27 @@
GROUP BY pwgs.id
union ALL
SELECT
pcp.id as id
pcp.id as id,max(ppr.payment_date) as payment_date
FROM pay_common_project pcp inner JOIN pay_payment_record ppr on(pcp.id=ppr.project_id) WHERE ppr.payment_date like concat('%',#{allProjectStatisticsSearch.year},'%')
group by pcp.id
union all
SELECT
pmps.id as id from
pmps.id as id,max(ppr.payment_date) as payment_date from
pay_member_project_subitem pmps inner join pay_payment_record ppr on(pmps.id=ppr.project_id)
WHERE ppr.payment_date like
concat('%',#{allProjectStatisticsSearch.year},'%')
group by pmps.id
union all
SELECT
pms.id from pay_meeting_situation pms inner join pay_payment_record ppr on(pms.id=ppr.project_id)
pms.id,max(ppr.payment_date) as payment_date from pay_meeting_situation pms inner join pay_payment_record ppr on(pms.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{allProjectStatisticsSearch.year},'%')
group by pms.id
union all
SELECT
tmps.id from tb_member_project_subitem tmps inner join pay_payment_record ppr on(tmps.id=ppr.project_id)
tmps.id,max(ppr.payment_date) as payment_date from tb_member_project_subitem tmps inner join pay_payment_record ppr on(tmps.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{allProjectStatisticsSearch.year},'%')
group by tmps.id
) pprr on(pp.id=pprr.id) group by pp.id order by pp.createTime
) pprr on(pp.id=pprr.id) group by pp.id order by pprr.payment_date desc
</select>
@@ -993,187 +999,27 @@
<!--个人来款统计导出ids-->
<select id="queryPageListForPrincipalIds" resultType="com.jero.statistics.entity.PrincipalPeopleList">
select principalId, principalName,allMoney,comeAllMoney,createTime,
CONCAT(CAST(ROUND((comeAllMoney/allMoney)*100,2) AS CHAR),'%') AS finishRate from
(select
principalId,principalName,SUM(allMoney) as allMoney,sum(comeAllMoney) as comeAllMoney,
createTime
from
(SELECT
pwg.principal_id_a as principalId,
pwg.principal_name_a as principalName,
sum(pwgs.allMoney) as allMoney,
sum(pwgs.comeAllMoney) as comeAllMoney,
pwg.create_time as createTime
FROM pay_working_group pwg
right JOIN (
select id,working_group_id,SUM(receivable_amount) AS allMoney,SUM(paid_amount) AS comeAllMoney
from (select
pwg1s.id,working_group_id,receivable_amount,paid_amount
from pay_working_group_subitem pwg1s inner join pay_payment_record ppr on(pwg1s.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{principalPeopleSearch.year},'%') group by pwg1s.id) pwgs2
GROUP BY pwgs2.working_group_id
) pwgs
ON (pwg.id=pwgs.working_group_id)
left JOIN sys_user su on(pwg.principal_id_a=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pwg.principal_id_a in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="principalPeopleSearch.principalId != null and principalPeopleSearch.principalId != ''">
AND pwg.principal_id_a=#{principalPeopleSearch.principalId}
</if>
<if test="principalPeopleSearch.departCode != null and principalPeopleSearch.departCode != ''">
AND su.org_code =#{principalPeopleSearch.departCode}
</if>
</where> GROUP BY pwg.principal_id_a
union all
SELECT
pcp1.principal_id as principalId,
pcp1.principal_name as principalName,
sum(pcp1.receivable_amount) as allMoney,
sum(pcp1.paid_amount) as comeAllMoney,
pcp1.create_time as createTime
FROM
(select pcp.principal_id,pcp.principal_name,pcp.receivable_amount,pcp.paid_amount,pcp.create_time from
pay_common_project pcp inner join pay_payment_record ppr on(pcp.id=ppr.project_id)
where
ppr.payment_date like
concat('%',#{principalPeopleSearch.year},'%')
group by pcp.id
) pcp1
left JOIN sys_user su on(pcp1.principal_id=su.id) left join sys_depart sd
on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pcp1.principal_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="principalPeopleSearch.departCode != null and principalPeopleSearch.departCode != ''">
AND su.org_code =#{principalPeopleSearch.departCode}
</if>
<if test="principalPeopleSearch.principalId != null and principalPeopleSearch.principalId != ''">
AND pcp1.principal_id=#{principalPeopleSearch.principalId}
</if>
</where> group by pcp1.principal_id
union all
select
pmp.director_id as principalId,
pmp.director_name as principalName,
SUM(pmps.allMoney) AS allMoney,
SUM(pmps.comeAllMoney) AS comeAllMoney,
pmp.create_time as createTime
FROM pay_member_project pmp
right join (
select id,projectId,sum(amount_receivable) AS allMoney,sum(paid_amount) AS comeAllMoney from(
select pmp1s.id,pmp1s.project_id as projectId,amount_receivable,paid_amount from
pay_member_project_subitem pmp1s
inner join pay_payment_record ppr on(pmp1s.id=ppr.project_id)
WHERE ppr.payment_date like
concat('%',#{principalPeopleSearch.year},'%')
GROUP BY pmp1s.id
) pmp1s group by pmp1s.projectId ) pmps on(pmp.id=pmps.projectId)
left JOIN sys_user su on(pmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="principalPeopleSearch.departCode != null and principalPeopleSearch.departCode != ''">
AND su.org_code =#{principalPeopleSearch.departCode}
</if>
<if test="principalPeopleSearch.principalId != null and principalPeopleSearch.principalId != ''">
AND pmp.director_id=#{principalPeopleSearch.principalId}
</if>
</where> group by pmp.director_id
union all
SELECT
pm.director_id as principalId,
pm.director_name as principalName,
sum(pms.allMoney) as allMoney,
sum(pms.comeAllMoney) as comeAllMoney,
pm.create_time as createTime
FROM pay_meeting pm right join (
select id,meeting_id,SUM(amount_receivable) AS
allMoney,SUM(paid_amount) AS comeAllMoney
from
(select pm1s.id,meeting_id,amount_receivable,paid_amount from pay_meeting_situation pm1s
inner join pay_payment_record ppr on(pm1s.id=ppr.project_id)
WHERE ppr.payment_date like
concat('%',#{principalPeopleSearch.year},'%')
GROUP BY pm1s.id) pms1 group by pms1.meeting_id) pms on(pm.id=pms.meeting_id)
left JOIN sys_user su on(pm.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
pm.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="principalPeopleSearch.departCode != null and principalPeopleSearch.departCode != ''">
AND su.org_code =#{principalPeopleSearch.departCode}
</if>
<if test="principalPeopleSearch.principalId != null and principalPeopleSearch.principalId != ''">
AND pm.director_id=#{principalPeopleSearch.principalId}
</if>
</where> group by pm.director_id) pp
group by pp.principalId order by pp.createTime) ppp
<where>
<if test="ids!= null and ids != ''"> where ppp.principalId in <foreach collection="ids" item="item" close=")" open="(" separator=",">#{item}</foreach> </if>
<choose>
<when test="principalPeopleSearch.allMoney != null and principalPeopleSearch.allMoney != '' and principalPeopleSearch.allMoneyTwo != null and principalPeopleSearch.allMoneyTwo != ''">
ppp.allMoney >= #{principalPeopleSearch.allMoney} and ppp.allMoney <![CDATA[<]]>=
#{principalPeopleSearch.allMoneyTwo}
</when>
<otherwise>
<if test="principalPeopleSearch.allMoney != null and principalPeopleSearch.allMoney != ''">
AND ppp.allMoney >= #{principalPeopleSearch.allMoney}
</if>
<if test="principalPeopleSearch.allMoneyTwo != null and principalPeopleSearch.allMoneyTwo != ''">
AND ppp.allMoney <![CDATA[<]]>= #{principalPeopleSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
</select>
<!--个人来款统计-->
<select id="queryPageListForPrincipal" resultType="com.jero.statistics.entity.PrincipalPeopleList">
select principalId, principalName,allMoney,comeAllMoney,createTime,
CONCAT(CAST(ROUND((comeAllMoney/allMoney)*100,2) AS CHAR),'%') AS finishRate from
(select
principalId,principalName,SUM(allMoney) as allMoney,sum(comeAllMoney) as comeAllMoney,
createTime
createTime,max(payment_date) as payment_date
from
(SELECT
pwg.principal_id_a as principalId,
pwg.principal_name_a as principalName,
sum(pwgs.allMoney) as allMoney,
sum(pwgs.comeAllMoney) as comeAllMoney,
pwg.create_time as createTime
pwg.create_time as createTime,
max(pwgs.payment_date) as payment_date
FROM pay_working_group pwg
right JOIN (
select id,working_group_id,SUM(receivable_amount) AS allMoney,SUM(paid_amount) AS comeAllMoney
select id,working_group_id,SUM(receivable_amount) AS allMoney,SUM(paid_amount) AS comeAllMoney,max(pwgs2.payment_date) as payment_date
from (select
pwg1s.id,working_group_id,receivable_amount,paid_amount
pwg1s.id,working_group_id,receivable_amount,paid_amount,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwg1s inner join pay_payment_record ppr on(pwg1s.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{principalPeopleSearch.year},'%') group by pwg1s.id) pwgs2
GROUP BY pwgs2.working_group_id
@@ -1202,9 +1048,10 @@
pcp1.principal_name as principalName,
sum(pcp1.receivable_amount) as allMoney,
sum(pcp1.paid_amount) as comeAllMoney,
pcp1.create_time as createTime
pcp1.create_time as createTime,
max(pcp1.payment_date) as payment_date
FROM
(select pcp.principal_id,pcp.principal_name,pcp.receivable_amount,pcp.paid_amount,pcp.create_time from
(select pcp.principal_id,pcp.principal_name,pcp.receivable_amount,pcp.paid_amount,pcp.create_time,max(ppr.payment_date) as payment_date from
pay_common_project pcp inner join pay_payment_record ppr on(pcp.id=ppr.project_id)
where
ppr.payment_date like
@@ -1234,11 +1081,12 @@
pmp.director_name as principalName,
SUM(pmps.allMoney) AS allMoney,
SUM(pmps.comeAllMoney) AS comeAllMoney,
pmp.create_time as createTime
pmp.create_time as createTime,
max(pmps.payment_date) as payment_date
FROM pay_member_project pmp
right join (
select id,projectId,sum(amount_receivable) AS allMoney,sum(paid_amount) AS comeAllMoney from(
select pmp1s.id,pmp1s.project_id as projectId,amount_receivable,paid_amount from
select id,projectId,sum(amount_receivable) AS allMoney,sum(paid_amount) AS comeAllMoney,max(pmp1s.payment_date) as payment_date from(
select pmp1s.id,pmp1s.project_id as projectId,amount_receivable,paid_amount,max(ppr.payment_date) as payment_date from
pay_member_project_subitem pmp1s
inner join pay_payment_record ppr on(pmp1s.id=ppr.project_id)
WHERE ppr.payment_date like
@@ -1267,12 +1115,13 @@
pm.director_name as principalName,
sum(pms.allMoney) as allMoney,
sum(pms.comeAllMoney) as comeAllMoney,
pm.create_time as createTime
pm.create_time as createTime,
max(pms.payment_date) as payment_date
FROM pay_meeting pm right join (
select id,meeting_id,SUM(amount_receivable) AS
allMoney,SUM(paid_amount) AS comeAllMoney
allMoney,SUM(paid_amount) AS comeAllMoney,max(pms1.payment_date) as payment_date
from
(select pm1s.id,meeting_id,amount_receivable,paid_amount from pay_meeting_situation pm1s
(select pm1s.id,meeting_id,amount_receivable,paid_amount,max(ppr.payment_date) as payment_date from pay_meeting_situation pm1s
inner join pay_payment_record ppr on(pm1s.id=ppr.project_id)
WHERE ppr.payment_date like
concat('%',#{principalPeopleSearch.year},'%')
@@ -1312,7 +1161,7 @@
</otherwise>
</choose>
</where>
order by ppp.payment_date desc
</select>
@@ -1548,7 +1397,7 @@
</where>) pp
inner join
<!-- 判断来款项目的来款年份-->
(select pwgs.id as id
(select pwgs.id as id,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwgs
inner join pay_payment_record ppr on(pwgs.id=ppr.project_id)
WHERE ppr.payment_date like
@@ -1556,22 +1405,22 @@
GROUP BY pwgs.id
union ALL
SELECT
pcp.id as id
pcp.id as id,max(ppr.payment_date) as payment_date
FROM pay_common_project pcp inner JOIN pay_payment_record ppr on(pcp.id=ppr.project_id) WHERE ppr.payment_date like concat('%',#{principalPeopleDetailSearch.year},'%')
group by pcp.id
union all
SELECT
pmps.id as id from
pmps.id as id,max(ppr.payment_date) as payment_date from
pay_member_project_subitem pmps inner join pay_payment_record ppr on(pmps.id=ppr.project_id)
WHERE ppr.payment_date like
concat('%',#{principalPeopleDetailSearch.year},'%')
group by pmps.id
union all
SELECT
pms.id as id from pay_meeting_situation pms inner join pay_payment_record ppr on (pms.id=ppr.project_id)
pms.id as id ,max(ppr.payment_date) as payment_date from pay_meeting_situation pms inner join pay_payment_record ppr on (pms.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{principalPeopleDetailSearch.year},'%')
group by pms.id) pprr on(pp.id=pprr.id)
order by pp.createTime
order by pprr.payment_date desc
</select>
<!-- 个人来款详情导出ids-->
<select id="queryPageListForPrincipalDetailTwo" resultType="com.jero.statistics.entity.PrincipalPeopleDetail">
@@ -1761,18 +1610,19 @@
CONCAT(CAST(ROUND((comeAllMoney/allMoney)*100,2) AS CHAR),'%') AS finishRate from
(select
chargeCompanyTemporaryId,chargeCompanyTemporaryName,SUM(allMoney) as allMoney,sum(comeAllMoney) as comeAllMoney,
createTime
createTime,payment_date
from
(SELECT
pwgs.charge_company_id as chargeCompanyTemporaryId,
pcm.company_name as chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
pwgs.create_time as createTime
pwgs.create_time as createTime,
pwgs.payment_date
FROM (
select pwgs2.id,working_group_id,SUM(receivable_amount) AS allMoney,SUM(paid_amount) AS comeAllMoney,charge_company_id,pwgs2.create_time
select pwgs2.id,working_group_id,SUM(receivable_amount) AS allMoney,SUM(paid_amount) AS comeAllMoney,charge_company_id,pwgs2.create_time,max(pwgs2.payment_date) as payment_date
from (select
pwg1s.id,working_group_id,receivable_amount,paid_amount,charge_company_id,pwg1s.create_time
pwg1s.id,working_group_id,receivable_amount,paid_amount,charge_company_id,pwg1s.create_time,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwg1s inner join pay_payment_record ppr on(pwg1s.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{companyComeMoneySearch.year},'%') group by pwg1s.id) pwgs2 left join pay_working_group pwg
ON (pwg.id=pwgs2.working_group_id)
@@ -1799,9 +1649,10 @@
pcm.company_name as chargeCompanyTemporaryName,
sum(pcp1.receivable_amount) as allMoney,
sum(pcp1.paid_amount) as comeAllMoney,
pcp1.create_time as createTime
pcp1.create_time as createTime,
max(pcp1.payment_date) as payment_date
FROM
(select pcp.principal_id,pcp.principal_name,pcp.receivable_amount,pcp.paid_amount,pcp.create_time,pcp.charge_company_id from
(select pcp.principal_id,pcp.principal_name,pcp.receivable_amount,pcp.paid_amount,pcp.create_time,pcp.charge_company_id,max(ppr.payment_date) as payment_date from
pay_common_project pcp inner join pay_payment_record ppr on(pcp.id=ppr.project_id)
where
ppr.payment_date like
@@ -1826,10 +1677,11 @@
company_name as chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
create_time as createTime
create_time as createTime,
pmps.payment_date
FROM (
select projectId,sum(amount_receivable) AS allMoney,sum(paid_amount) AS comeAllMoney ,pmp1s.create_time,company_id,company_name from(
select pmp2s.id,pmp2s.project_id as projectId,amount_receivable,paid_amount,pmp2s.create_time,company_id,company_name from
select projectId,sum(amount_receivable) AS allMoney,sum(paid_amount) AS comeAllMoney ,pmp1s.create_time,company_id,company_name,max(pmp1s.payment_date) as payment_date from(
select pmp2s.id,pmp2s.project_id as projectId,amount_receivable,paid_amount,pmp2s.create_time,company_id,company_name,max(ppr.payment_date) as payment_date from
pay_member_project_subitem pmp2s
inner join pay_payment_record ppr on(pmp2s.id=ppr.project_id)
WHERE ppr.payment_date like
@@ -1856,10 +1708,11 @@
company_name as chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
createTime
createTime,
pmss.payment_date
FROM (select SUM(allMoney) AS
allMoney,SUM(comeAllMoney) AS comeAllMoney,pms.create_time as createTime ,company_id,company_name
from (select pm1s.meeting_id,amount_receivable as allMoney ,paid_amount as comeAllMoney,pm1s.create_time,company_id,company_name
allMoney,SUM(comeAllMoney) AS comeAllMoney,pms.create_time as createTime ,company_id,company_name,max(pms.payment_date) as payment_date
from (select pm1s.meeting_id,amount_receivable as allMoney ,paid_amount as comeAllMoney,pm1s.create_time,company_id,company_name,max(ppr.payment_date) as payment_date
from pay_meeting_situation pm1s
inner join pay_payment_record ppr on(pm1s.id=ppr.project_id)
WHERE ppr.payment_date like
@@ -1885,10 +1738,11 @@
company_name as chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
createTime
createTime,
payment_date
FROM (select SUM(amount_receivable) AS
allMoney,SUM(paid_amount) AS comeAllMoney,tpms.create_time as createTime ,company_id,company_name
from(select amount_receivable,paid_amount,tmp1s.create_time,company_id,company_name,tmp1s.project_id
allMoney,SUM(paid_amount) AS comeAllMoney,tpms.create_time as createTime ,company_id,company_name,max(tpms.payment_date) as payment_date
from(select amount_receivable,paid_amount,tmp1s.create_time,company_id,company_name,tmp1s.project_id,max(ppr.payment_date) as payment_date
from tb_member_project_subitem tmp1s
inner join pay_payment_record ppr on(tmp1s.id=ppr.project_id)
WHERE ppr.payment_date like
@@ -1908,7 +1762,7 @@
</if>
</where>
) pp
group by pp.chargeCompanyTemporaryId order by pp.createTime) ppp
group by pp.chargeCompanyTemporaryId order by pp.payment_date desc) ppp
<where>
<choose>
<when test="companyComeMoneySearch.allMoney != null and companyComeMoneySearch.allMoney != '' and companyComeMoneySearch.allMoneyTwo != null and companyComeMoneySearch.allMoneyTwo != ''">
@@ -1925,6 +1779,7 @@
</otherwise>
</choose>
</where>
order by ppp.payment_date desc
</select>
<!--首页前十公司统计-->
<select id="queryPageListForCompanyFirstPage" resultType="com.jero.statistics.entity.CompanyComeMoneyList">
@@ -2230,7 +2085,7 @@
</where>
) pp
inner join
(select pwgs.id as id
(select pwgs.id as id,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwgs
inner join pay_payment_record ppr on(pwgs.id=ppr.project_id)
WHERE ppr.payment_date like
@@ -2238,28 +2093,28 @@
GROUP BY pwgs.id
union ALL
SELECT
pcp.id as id
pcp.id as id,max(ppr.payment_date) as payment_date
FROM pay_common_project pcp inner JOIN pay_payment_record ppr on(pcp.id=ppr.project_id) WHERE ppr.payment_date like concat('%',#{CompanyComeMoneyDetailSearch.year},'%')
group by pcp.id
union all
SELECT
pmps.id as id from
pmps.id as id,max(ppr.payment_date) as payment_date from
pay_member_project_subitem pmps inner join pay_payment_record ppr on(pmps.id=ppr.project_id)
WHERE ppr.payment_date like
concat('%',#{CompanyComeMoneyDetailSearch.year},'%')
group by pmps.id
union all
SELECT
pms.id as id from pay_meeting_situation pms inner join pay_payment_record ppr on (pms.id=ppr.project_id)
pms.id as id,max(ppr.payment_date) as payment_date from pay_meeting_situation pms inner join pay_payment_record ppr on (pms.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{CompanyComeMoneyDetailSearch.year},'%')
group by pms.id
union all
SELECT
tmps.id from tb_member_project_subitem tmps inner join pay_payment_record ppr on(tmps.id=ppr.project_id)
tmps.id,max(ppr.payment_date) as payment_date from tb_member_project_subitem tmps inner join pay_payment_record ppr on(tmps.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{CompanyComeMoneyDetailSearch.year},'%')
group by tmps.id
) pprr on(pp.projectId=pprr.id)
order by pp.createTime
order by pprr.payment_date desc
</select>
</mapper>
@@ -107,15 +107,12 @@
</where>
group by pwgs.id) pwg1
inner join
(SELECT
pwg.principal_id_a as principalId
FROM pay_working_group pwg
inner JOIN (select pwgs.id as id,working_group_id
(select pwgs.id as id,working_group_id,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwgs
left join pay_payment_record ppr on(pwgs.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{payWorkingGroupSubletSearch.year},'%') GROUP BY working_group_id) pwgss ON (pwg.id=pwgss.working_group_id)
GROUP BY pwg.principal_id_a) pwg2 on (pwg2.principalId=pwg1.principalId)
order by pwg1.create_time
WHERE ppr.payment_date like concat('%',#{payWorkingGroupSubletSearch.year},'%') GROUP BY pwgs.id
) pwg2 on (pwg2.id=pwg1.id)
order by pwg2.payment_date
</select>
<!-- 工作组详情导出 -->
@@ -169,15 +166,12 @@
</where>
group by pwgs.id) pwg1
inner join
(SELECT
pwg.principal_id_a as principalId
FROM pay_working_group pwg
inner JOIN (select pwgs.id as id,working_group_id
(select pwgs.id as id,working_group_id,max(ppr.payment_date) as payment_date
from pay_working_group_subitem pwgs
left join pay_payment_record ppr on(pwgs.id=ppr.project_id)
WHERE ppr.payment_date like concat('%',#{payWorkingGroupSubletSearch.year},'%') GROUP BY working_group_id) pwgss ON (pwg.id=pwgss.working_group_id)
GROUP BY pwg.principal_id_a) pwg2 on (pwg2.principalId=pwg1.principalId)
order by pwg1.create_time
WHERE ppr.payment_date like concat('%',#{payWorkingGroupSubletSearch.year},'%') GROUP BY pwgs.id
) pwg2 on (pwg2.id=pwg1.id)
order by pwg2.payment_date
</select>
<select id="queryCompanyPageList" resultType="com.jero.project.entity.PayWorkingGroupSubItem">
select pwgs.*,pwg.working_group_project as chargeProject from pay_working_group_subitem pwgs
@@ -124,12 +124,7 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
* @return
*/
List<PrincipalPeopleList> queryPageListForPrincipalExcel(PrincipalPeopleSearch principalPeopleSearch,List<String> idList);
/**
* 个人来款导出excel
* @param idList
* @return
*/
List<PrincipalPeopleList> queryPageListForPrincipalExcel(PrincipalPeopleSearch principalPeopleSearch,List<String> idList,List<String> ids);
/**
* 个人来款详情
* @param
@@ -267,19 +267,10 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
@Override
public List<PrincipalPeopleList> queryPageListForPrincipalExcel(PrincipalPeopleSearch principalPeopleSearch, List<String> idList) {
return null;
return payWorkingGroupMapper.queryPageListForPrincipal(principalPeopleSearch,idList);
}
/**
* 个人来款统计导出
* @param idList
* @param idList
* @return
*/
@Override
public List<PrincipalPeopleList> queryPageListForPrincipalExcel(PrincipalPeopleSearch principalPeopleSearch,List<String> idList,List<String> ids) {
return payWorkingGroupMapper.queryPageListForPrincipalIds(principalPeopleSearch,idList,ids);
}
/**
* 个人来款统计详情
* @param page
@@ -270,26 +270,26 @@ public class PayWorkingGroupStatisticsController {
}
HashMap<String, Object> hashMap = new HashMap<>();
DecimalFormat df = new DecimalFormat("#,##0.00");
// 转义来款用途
for(PayWorkGroupSubletStatistics s: pageList.getRecords()){
String key = String.valueOf(s.getChargeUse());
String payment_charge_use = sysBaseAPI.translateDict("payment_charge_use", key);
s.setChargeUse_text(payment_charge_use);
}
for(PayWorkGroupSubletStatistics s: pageList.getRecords()){
if(s.getAllMoney()== null || s.getAllMoney().equals("") ){
s.setAllMoney("0.0");
}
if(s.getComeAllMoney()== null || s.getComeAllMoney().equals("") ) {
s.setComeAllMoney("0.0");
}
}
// 转义来款用途
for(PayWorkGroupSubletStatistics s: pageList.getRecords()){
String key = String.valueOf(s.getChargeUse());
String payment_charge_use = sysBaseAPI.translateDict("payment_charge_use", key);
s.setChargeUse_text(payment_charge_use);
}
for(PayWorkGroupSubletStatistics s: pageList.getRecords()){
if(s.getAllMoney()== null || s.getAllMoney().equals("") ){
s.setAllMoney("0.0");
}
if(s.getComeAllMoney()== null || s.getComeAllMoney().equals("") ) {
s.setComeAllMoney("0.0");
}
}
hashMap.put("pageList",pageList);
hashMap.put("sumOfMoney", sum==0.0?sum:df.format(sum));
hashMap.put("sumOfReallyMoney", sumTwo==0.0?sumTwo:df.format(sumTwo));
return Result.OK(hashMap);
}
hashMap.put("pageList",pageList);
hashMap.put("sumOfMoney", sum==0.0?sum:df.format(sum));
hashMap.put("sumOfReallyMoney", sumTwo==0.0?sumTwo:df.format(sumTwo));
return Result.OK(hashMap);
}
/**
*导出
@@ -2,6 +2,7 @@ package com.jero.util;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.servlet.ModelAndView;
@@ -55,6 +56,7 @@ public class AmountUtil {
mv.addObject(NormalExcelConstants.CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(title, title);
exportParams.setType(ExcelType.XSSF);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);