add:统计证书

This commit is contained in:
zhangqinlin
2021-12-15 20:33:45 +08:00
parent b11abd83fa
commit 95ec40663a
4 changed files with 319 additions and 3 deletions
@@ -56,6 +56,17 @@
AND tmsub.id = #{projectId}
</if>
</where>
<!-- 标协会员证书项目-->
UNION ALL
select tmps.id,tmember.project_name,tmps.charge_use,tmember.director_id,su.realname,tmps.liaison_man_id,tmps.liaison_man,tmps.company_name,tmps.amount_receivable,tmps.paid_amount,tmps.invoice_requirements,tmps.pack,tmps.in_account,tmps.make_invoice,tmps.mail,tmps.create_time,5,'','','','',tmps.company_id,tmps.payment_method,'','','',tmember.year,''
from tb_member_project tmember
left join sys_user su on tmember.director_id = su.id
inner join tb_certificate_payment tmps on tmember.id=tmps.project_id
<where>
<if test="projectId != null and projectId != ''">
AND tmps.id = #{projectId}
</if>
</where>
</select>
<select id="queryProjectList" resultType="com.jero.project.entity.PayCommonProject">
<!-- 普通项目-->
@@ -205,4 +216,4 @@
select count(*) as num from pay_member_project_subitem msub where DATE_FORMAT(create_time,'%Y-%m') = #{time}
) a
</select>
</mapper>
</mapper>
@@ -552,6 +552,66 @@
</if>
</otherwise>
</choose>
</where>
union all
SELECT
tcp.id,
tmp.project_name AS projectName,
su.realname as principalName,
tcp.company_name AS chargeCompanyTemporaryName,
tcp.amount_receivable as allMoney,
tcp.paid_amount as comeAllMoney,
tcp.charge_use as chargeUse,
sd.depart_name as depart,
tcp.pack as pack,
tcp.create_time as createTime
FROM tb_member_project tmp left join tb_certificate_payment tcp on(tmp.id=tcp.project_id)
left JOIN sys_user su on(tmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND tcp.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND tmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND tcp.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND tcp.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND tcp.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and tcp.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>) pp inner join
(
select pwgs.id as id,max(ppr.payment_date) as payment_date
@@ -596,8 +656,15 @@
concat('%',#{allProjectStatisticsSearch.year},'%')
</if>
group by tmps.id
union all
SELECT
tcp.id,max(ppr.payment_date) as payment_date from tb_certificate_payment tcp inner join pay_payment_record ppr on(tcp.id=ppr.project_id)
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
WHERE ppr.payment_date like
concat('%',#{allProjectStatisticsSearch.year},'%')
</if>
group by tcp.id
) pprr on(pp.id=pprr.id) group by pp.id order by pprr.payment_date desc
</select>
<select id="queryPageListExcel" resultType="com.jero.statistics.entity.AllProjectStatistics">
@@ -905,6 +972,67 @@
</if>
</otherwise>
</choose>
</where>
union all
SELECT
tcp.id,
tmp.project_name AS projectName,
su.realname as principalName,
tcp.company_name AS chargeCompanyTemporaryName,
tcp.amount_receivable as allMoney,
tcp.paid_amount as comeAllMoney,
tcp.charge_use as chargeUse,
sd.depart_name as depart,
tcp.pack as pack,
tcp.create_time as createTime
FROM tb_member_project tmp left join tb_certificate_payment tcp on(tmp.id=tcp.project_id)
left JOIN sys_user su on(tmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="ids!= null and ids != ''"> tcp.id in <foreach collection="ids" item="item" close=")" open="(" separator=",">#{item}</foreach> </if>
<if test="idList != null and idList != ''">
tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="allProjectStatisticsSearch.projectName != null and allProjectStatisticsSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.projectName},'%'))
</if>
<if test="allProjectStatisticsSearch.payStatue != null and allProjectStatisticsSearch.payStatue != ''">
AND tcp.in_account LIKE
concat('%',concat(#{allProjectStatisticsSearch.payStatue},'%'))
</if>
<if test="allProjectStatisticsSearch.principalNameId != null and allProjectStatisticsSearch.principalNameId != ''">
AND tmp.director_id=#{allProjectStatisticsSearch.principalNameId}
</if>
<if test="allProjectStatisticsSearch.departCode != null and allProjectStatisticsSearch.departCode != ''">
AND su.org_code =#{allProjectStatisticsSearch.departCode}
</if>
<if test="allProjectStatisticsSearch.chargeUse != null and allProjectStatisticsSearch.chargeUse != ''">
AND tcp.charge_use=#{allProjectStatisticsSearch.chargeUse}
</if>
<if test="allProjectStatisticsSearch.chargeCompanyTemporaryName != null and allProjectStatisticsSearch.chargeCompanyTemporaryName != ''">
AND tcp.company_name LIKE
concat('%',concat(#{allProjectStatisticsSearch.chargeCompanyTemporaryName},'%'))
</if>
<if test="allProjectStatisticsSearch.pack != null and allProjectStatisticsSearch.pack != ''">
AND tcp.pack=#{allProjectStatisticsSearch.pack}
</if>
<choose>
<when test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != '' and allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney} and tcp.amount_receivable <![CDATA[<]]>=
#{allProjectStatisticsSearch.allMoneyTwo}
</when>
<otherwise>
<if test="allProjectStatisticsSearch.allMoney != null and allProjectStatisticsSearch.allMoney != ''">
AND tcp.amount_receivable >= #{allProjectStatisticsSearch.allMoney}
</if>
<if test="allProjectStatisticsSearch.allMoneyTwo != null and allProjectStatisticsSearch.allMoneyTwo != ''">
AND tcp.amount_receivable <![CDATA[<]]>= #{allProjectStatisticsSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>) pp
inner join
(
@@ -950,6 +1078,14 @@
concat('%',#{allProjectStatisticsSearch.year},'%')
</if>
group by tmps.id
union all
SELECT
tcp.id,max(ppr.payment_date) as payment_date from tb_certificate_payment tcp inner join pay_payment_record ppr on(tcp.id=ppr.project_id)
<if test="allProjectStatisticsSearch.year != null and allProjectStatisticsSearch.year != ''">
WHERE ppr.payment_date like
concat('%',#{allProjectStatisticsSearch.year},'%')
</if>
group by tcp.id
) pprr on(pp.id=pprr.id) group by pp.id order by pp.createTime
</select>
@@ -1243,8 +1379,42 @@
AND tmp.director_id=#{principalPeopleSearch.principalId}
</if>
</where> group by tmp.director_id
) pp
union all
SELECT
tmp.director_id as principalId,
su.realname as principalName,
sum(tmps.allMoney) as allMoney,
sum(tmps.comeAllMoney) as comeAllMoney,
tmp.create_time as createTime,
max(tmps.payment_date) as payment_date
FROM tb_member_project tmp right join (
select id,project_id,SUM(amount_receivable) AS
allMoney,SUM(paid_amount) AS comeAllMoney,max(tmps2.payment_date) as payment_date
from
(select tmps1.id,tmps1.project_id,amount_receivable,paid_amount,max(ppr.payment_date) as payment_date from tb_certificate_payment tmps1
inner join pay_payment_record ppr on(tmps1.id=ppr.project_id)
<if test="principalPeopleSearch.year !='' and principalPeopleSearch.year != null">
WHERE ppr.payment_date like concat('%',#{principalPeopleSearch.year},'%')
</if>
GROUP BY tmps1.id) tmps2 group by tmps2.project_id) tmps on(tmp.id=tmps.project_id)
left JOIN sys_user su on(tmp.director_id=su.id) left join sys_depart sd on(su.org_code=sd.org_code)
<where>
<if test="idList != null and idList != ''">
tmp.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 tmp.director_id=#{principalPeopleSearch.principalId}
</if>
</where> group by tmp.director_id
) pp
group by pp.principalId order by pp.createTime) ppp
<where>
<choose>
@@ -1561,6 +1731,45 @@
</otherwise>
</choose>
</where>
union ALL
SELECT
tmps.create_time as createTime,
tmps.id,
tmps.company_name as chargeCompanyTemporaryName,
tmp.project_name as projectName,
tmp.director_id as principalId,
tmps.amount_receivable AS allMoney,
tmps.paid_amount AS comeAllMoney,
tmps.pack as pack,
tmps.charge_use as chargeUse
FROM tb_member_project tmp inner join tb_certificate_payment tmps on(tmp.id=tmps.project_id)
<where>
tmp.director_id = #{principalPeopleDetailSearch.principalNameId}
<if test="principalPeopleDetailSearch.projectName != null and principalPeopleDetailSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{principalPeopleDetailSearch.projectName},'%'))
</if>
<if test="principalPeopleDetailSearch.chargeUse != null and principalPeopleDetailSearch.chargeUse != ''">
AND tmps.charge_use=#{principalPeopleDetailSearch.chargeUse}
</if>
<if test="principalPeopleDetailSearch.inAccountStatue != null and principalPeopleDetailSearch.inAccountStatue != ''">
AND tmps.in_account=#{principalPeopleDetailSearch.inAccountStatue}
</if>
<choose>
<when test="principalPeopleDetailSearch.allMoney != null and principalPeopleDetailSearch.allMoney != '' and principalPeopleDetailSearch.allMoneyTwo != null and principalPeopleDetailSearch.allMoneyTwo != ''">
AND tmps.amount_receivable >= #{principalPeopleDetailSearch.allMoney} and tmps.amount_receivable <![CDATA[<]]>=
#{principalPeopleDetailSearch.allMoneyTwo}
</when>
<otherwise>
<if test="principalPeopleDetailSearch.allMoney != null and principalPeopleDetailSearch.allMoney != ''">
AND tmps.amount_receivable >= #{principalPeopleDetailSearch.allMoney}
</if>
<if test="principalPeopleDetailSearch.allMoneyTwo != null and principalPeopleDetailSearch.allMoneyTwo != ''">
AND tmps.amount_receivable <![CDATA[<]]>= #{principalPeopleDetailSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
) pp
inner join
<!-- 判断来款项目的来款年份-->
@@ -1605,6 +1814,14 @@
WHERE ppr.payment_date like
concat('%',#{principalPeopleDetailSearch.year},'%')
</if>
group by tmps.id
union all
SELECT
tmps.id as id ,max(ppr.payment_date) as payment_date from tb_certificate_payment tmps inner join pay_payment_record ppr on (tmps.id=ppr.project_id)
<if test="principalPeopleDetailSearch.year !='' and principalPeopleDetailSearch.year !=null">
WHERE ppr.payment_date like
concat('%',#{principalPeopleDetailSearch.year},'%')
</if>
group by tmps.id
) pprr on(pp.id=pprr.id)
order by pprr.payment_date desc
@@ -1958,6 +2175,39 @@
AND ppp.company_id=#{companyComeMoneySearch.chargeCompanyId}
</if>
</where>
union all
SELECT
company_id as chargeCompanyTemporaryId,
company_name as chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
createTime,
payment_date
FROM (select SUM(amount_receivable) AS
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_certificate_payment tmp1s
inner join pay_payment_record ppr on(tmp1s.id=ppr.project_id)
<if test="companyComeMoneySearch.year !='' and companyComeMoneySearch.year !=null">
WHERE ppr.payment_date like concat('%',#{companyComeMoneySearch.year},'%')
</if>
group by tmp1s.id) tpms
left join tb_member_project tmp on(tmp.id=tpms.project_id)
<where>
<if test="idList != null and idList != ''">
tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
</where>
group by tpms.company_id) ppp
<where>
<if test="companyComeMoneySearch.chargeCompanyId != null and companyComeMoneySearch.chargeCompanyId != ''">
AND ppp.company_id=#{companyComeMoneySearch.chargeCompanyId}
</if>
</where>
) pp
group by pp.chargeCompanyTemporaryId order by pp.payment_date desc) ppp
<where>
@@ -2294,6 +2544,52 @@
</otherwise>
</choose>
</where>
union all
SELECT
tmps.create_time as createTime,
tmps.id AS projectId,
tmp.project_name AS projectName,
tmps.amount_receivable as allMoney,
tmps.paid_amount as comeAllMoney,
tmps.charge_use as chargeUse,
tmps.pack
FROM tb_member_project tmp left join tb_certificate_payment tmps on(tmp.id=tmps.project_id)
<where>
tmps.company_id = #{CompanyComeMoneyDetailSearch.chargeCompanyId}
<if test="idList != null and idList != ''">
and tmp.director_id in
<foreach item="item" open="(" separator="," close=")" collection="idList">
#{item}
</foreach>
</if>
<if test="CompanyComeMoneyDetailSearch.projectName != null and CompanyComeMoneyDetailSearch.projectName != ''">
AND tmp.project_name LIKE
concat('%',concat(#{CompanyComeMoneyDetailSearch.projectName},'%'))
</if>
<if test="CompanyComeMoneyDetailSearch.inAccountStatue != null and CompanyComeMoneyDetailSearch.inAccountStatue != ''">
AND tmps.in_account =#{CompanyComeMoneyDetailSearch.inAccountStatue}
</if>
<if test="CompanyComeMoneyDetailSearch.chargeUse != null and CompanyComeMoneyDetailSearch.chargeUse != ''">
AND tmps.charge_use=#{CompanyComeMoneyDetailSearch.chargeUse}
</if>
<choose>
<when test="CompanyComeMoneyDetailSearch.allMoney != null and CompanyComeMoneyDetailSearch.allMoney != '' and CompanyComeMoneyDetailSearch.allMoneyTwo != null and CompanyComeMoneyDetailSearch.allMoneyTwo != ''">
AND tmps.amount_receivable >= #{CompanyComeMoneyDetailSearch.allMoney} and tmps.amount_receivable <![CDATA[<]]>=
#{CompanyComeMoneyDetailSearch.allMoneyTwo}
</when>
<otherwise>
<if test="CompanyComeMoneyDetailSearch.allMoney != null and CompanyComeMoneyDetailSearch.allMoney != ''">
AND tmps.amount_receivable >= #{CompanyComeMoneyDetailSearch.allMoney}
</if>
<if test="CompanyComeMoneyDetailSearch.allMoneyTwo != null and CompanyComeMoneyDetailSearch.allMoneyTwo != ''">
AND tmps.amount_receivable <![CDATA[<]]>= #{CompanyComeMoneyDetailSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
) pp
inner join
(select pwgs.id as id,max(ppr.payment_date) as payment_date
@@ -2333,6 +2629,13 @@
WHERE ppr.payment_date like concat('%',#{CompanyComeMoneyDetailSearch.year},'%')
</if>
group by tmps.id
union all
SELECT
tmps.id,max(ppr.payment_date) as payment_date from tb_certificate_payment tmps inner join pay_payment_record ppr on(tmps.id=ppr.project_id)
<if test="CompanyComeMoneyDetailSearch.year !='' and CompanyComeMoneyDetailSearch.year !=null">
WHERE ppr.payment_date like concat('%',#{CompanyComeMoneyDetailSearch.year},'%')
</if>
group by tmps.id
) pprr on(pp.projectId=pprr.id)
order by pprr.payment_date desc
</select>
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.aspect.annotation.DictPoint;
import com.jero.common.exception.JeroBootException;
import com.jero.common.service.ProjectDetailService;
import com.jero.common.system.api.ISysBaseAPI;
@@ -1,5 +1,6 @@
package com.jero.statistics.entity;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;