From a8dff572a1b21d65ff759d7a01e57de0db45c268 Mon Sep 17 00:00:00 2001 From: lijiarao Date: Mon, 26 Sep 2022 16:22:20 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=B0=83=E6=95=B4=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E4=BD=BF=E6=95=B0=E6=8D=AE=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/统计视图.sql | 20 +- .../jero/index/contoller/IndexController.java | 2 +- .../PayConfirmPaymentRecordController.java | 28 +- .../project/mapper/PayWorkingGroupMapper.java | 17 +- .../mapper/xml/PayWorkingGroupMapper.xml | 405 +++++++++++------- .../impl/PayWorkingGroupServiceImpl.java | 33 +- .../AllProjectMoneyStatisticsController.java | 27 +- 7 files changed, 343 insertions(+), 189 deletions(-) diff --git a/db/统计视图.sql b/db/统计视图.sql index 717d8ef9..89834e97 100644 --- a/db/统计视图.sql +++ b/db/统计视图.sql @@ -24,6 +24,7 @@ select pp.id as projectId, paidNoTaxAmount, confirmNoTaxAmount, contactsName, + confirmDate, pp.pack from (SELECT pwgs.id, pwg.id as superId, @@ -48,13 +49,15 @@ from (SELECT pwgs.id, invoice_no_tax_amount as invoiceNoTaxAmount, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, - GROUP_CONCAT(pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName, + GROUP_CONCAT(DISTINCT pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName, + GROUP_CONCAT(DISTINCT DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pwgs.create_time as createTime FROM pay_working_group pwg right join pay_working_group_subitem 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.depart_ids = sd.id) left JOIN pay_working_group_subitem_contacts pwgsc on pwgsc.working_group_sub_id = pwgs.id + left join pay_confirm_payment_record pcpr on pwgs.id = pcpr.project_id group by pwgs.id union all SELECT pcp.id, @@ -81,10 +84,13 @@ from (SELECT pwgs.id, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, contacts_temporary_name as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pcp.create_time as createTime FROM pay_common_project pcp left JOIN sys_user su on (pcp.principal_id = su.id) left join sys_depart sd on (su.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on pcp.id = pcpr.project_id + group by pcp.id union all SELECT pmps.id, pmp.id as superId, @@ -110,11 +116,14 @@ from (SELECT pwgs.id, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, company_contact_name as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pmps.create_time as createTime FROM pay_member_project pmp right join pay_member_project_subitem pmps on (pmp.id = pmps.project_id) left JOIN sys_user su on (pmp.director_id = su.id) left join sys_depart sd on (su.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on pmps.id = pcpr.project_id + group by pmps.id union all SELECT pms.id, pm.id as superId, @@ -140,11 +149,14 @@ from (SELECT pwgs.id, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, company_contact_name as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pms.create_time as createTime FROM pay_meeting pm right join pay_meeting_situation 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.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on pms.id = pcpr.project_id + group by pms.id union all SELECT tmps.id, tmp.id as superId, @@ -170,11 +182,14 @@ from (SELECT pwgs.id, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, liaison_man as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, tmps.create_time as createTime FROM tb_member_project tmp left join tb_member_project_subitem 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.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on tmps.id = pcpr.project_id + group by tmps.id union all SELECT tcp.id, tmp.id as superId, @@ -200,11 +215,14 @@ from (SELECT pwgs.id, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, liaison_man as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, 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.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on tcp.id = pcpr.project_id + group by tcp.id ) pp where pp.allMoney is not null and pp.allMoney != 0 diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java b/jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java index a49bc4c9..f72676a5 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java @@ -74,7 +74,7 @@ public class IndexController { List pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type); return Result.OK(pieChartVOS); }else if (Objects.equals(type,2)){ - List pieChartVOS = indexService.totalAmountClassificationStatistics("confirmAmount", type); + List pieChartVOS = indexService.totalAmountClassificationStatistics("confirmNoTaxAmount", type); return Result.OK(pieChartVOS); }else if (Objects.equals(type,3)){ List pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type); diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/controller/PayConfirmPaymentRecordController.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/controller/PayConfirmPaymentRecordController.java index 9ff76b41..f74d7de2 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/controller/PayConfirmPaymentRecordController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/controller/PayConfirmPaymentRecordController.java @@ -44,7 +44,7 @@ public class PayConfirmPaymentRecordController extends JeroController queryPageList(PayConfirmPaymentRecord payConfirmPaymentRecord, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @@ -59,7 +59,7 @@ public class PayConfirmPaymentRecordController extends JeroController> queryList(PayConfirmPaymentRecord payConfirmPaymentRecord, HttpServletRequest req) { @@ -72,8 +72,8 @@ public class PayConfirmPaymentRecordController extends JeroController add(@Validated @RequestBody PayConfirmPaymentRecord payConfirmPaymentRecord) { payConfirmPaymentRecordService.add(payConfirmPaymentRecord); @@ -84,8 +84,8 @@ public class PayConfirmPaymentRecordController extends JeroController edit(@Validated @RequestBody PayConfirmPaymentRecord payConfirmPaymentRecord) { payConfirmPaymentRecordService.editById(payConfirmPaymentRecord); @@ -95,8 +95,8 @@ public class PayConfirmPaymentRecordController extends JeroController delete(@RequestParam(name="id") String id) { payConfirmPaymentRecordService.deleteById(id); @@ -106,8 +106,8 @@ public class PayConfirmPaymentRecordController extends JeroController deleteBatch(@RequestParam(name="ids") String ids) { this.payConfirmPaymentRecordService.deleteByIds(Arrays.asList(ids.split(","))); @@ -117,7 +117,7 @@ public class PayConfirmPaymentRecordController extends JeroController editAll() { payConfirmPaymentRecordService.editAll(); @@ -127,7 +127,7 @@ public class PayConfirmPaymentRecordController extends JeroController updateAffirmIncome() { payConfirmPaymentRecordService.updateAffirmIncome(); @@ -137,7 +137,7 @@ public class PayConfirmPaymentRecordController extends JeroController importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, PayConfirmPaymentRecord.class); diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java index 13fd42e4..14feefb3 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java @@ -220,19 +220,28 @@ public interface PayWorkingGroupMapper extends BaseMapper { AllMoney queryPageListDepartment33(@Param("departStatisticsSearch") DepartStatisticsSearch departStatisticsSearch, @Param("idList") List idList); - List queryListAllProjectMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List idList); - List queryListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); AllMoney queryAllMoney33(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); - List cumulativeListAllProjectMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); - List cumulativeListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); + List cumulativeListAllMoney(); List amountClass(@Param("year") String year, @Param("column") String column); List amountClass1(@Param("year") String year, @Param("column") String column); List getYearMoneyDTO(); + + List queryListConfirmAmount(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); + + List queryListBillMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); + + List queryListComeAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); + + List cumulativeListConfirmAmount(); + + List cumulativeListBillMoney(); + + List cumulativeListComeAllMoney(); } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml index 8784cbbf..a3a0b550 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml @@ -145,7 +145,7 @@ sum(confirmAmount) as confirmAmount1 from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + type = 2 @@ -161,12 +161,14 @@ AND year LIKE concat(#{payWorkingGroupSearch.year},'%') - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{payWorkingGroupSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{payWorkingGroupSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{payWorkingGroupSearch.paymentYear},'-',#{payWorkingGroupSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{payWorkingGroupSearch.paymentYear},'%') + + AND if(allMoney IS NULL OR allMoney = '', 0, allMoney ) >= #{payWorkingGroupSearch.allMoney} and @@ -230,7 +232,7 @@ sum(invoiceNoTaxAmount) as billMoney, sum(confirmNoTaxAmount) as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + type = 2 @@ -246,12 +248,14 @@ AND year LIKE concat(#{payWorkingGroupSearch.year}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{payWorkingGroupSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{payWorkingGroupSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{payWorkingGroupSearch.paymentYear},'-',#{payWorkingGroupSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{payWorkingGroupSearch.paymentYear},'%') + + AND if(allMoney IS NULL OR allMoney = '', 0, allMoney) >= #{payWorkingGroupSearch.allMoney} @@ -381,7 +385,7 @@ invoiceNoTaxAmount as billMoney, confirmNoTaxAmount as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId in @@ -432,12 +436,14 @@ - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{allProjectStatisticsSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{allProjectStatisticsSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{allProjectStatisticsSearch.paymentYear},'-',#{allProjectStatisticsSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{allProjectStatisticsSearch.paymentYear},'%') + + and contactsName like concat('%', #{allProjectStatisticsSearch.companyContactName}, '%') @@ -478,7 +484,7 @@ sum(invoiceNoTaxAmount) as billMoney, sum(confirmNoTaxAmount) as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId in @@ -530,12 +536,14 @@ - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{allProjectStatisticsSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{allProjectStatisticsSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{allProjectStatisticsSearch.paymentYear},'-',#{allProjectStatisticsSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{allProjectStatisticsSearch.paymentYear},'%') + + and contactsName like concat('%', #{allProjectStatisticsSearch.companyContactName}, '%') @@ -1103,7 +1111,7 @@ sum(confirmNoTaxAmount) as confirmAmount, sum(confirmAmount) as confirmAmount1 from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId in @@ -1122,12 +1130,14 @@ AND departCode = #{principalPeopleSearch.departCode} - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{principalPeopleSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{principalPeopleSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{principalPeopleSearch.paymentYear},'-',#{principalPeopleSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{principalPeopleSearch.paymentYear},'%') + + group by principalId ) ppp @@ -1187,7 +1197,7 @@ sum(invoiceNoTaxAmount) as billMoney, sum(confirmNoTaxAmount) as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId in @@ -1206,12 +1216,14 @@ AND departCode = #{principalPeopleSearch.departCode} - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{principalPeopleSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{principalPeopleSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{principalPeopleSearch.paymentYear},'-',#{principalPeopleSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{principalPeopleSearch.paymentYear},'%') + + group by principalId ) ppp @@ -1362,7 +1374,7 @@ invoiceNoTaxAmount as billMoney, confirmNoTaxAmount as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId = #{principalPeopleDetailSearch.principalNameId} @@ -1394,12 +1406,14 @@ - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{principalPeopleDetailSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{principalPeopleDetailSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{principalPeopleDetailSearch.paymentYear},'-',#{principalPeopleDetailSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{principalPeopleDetailSearch.paymentYear},'%') + + @@ -1420,7 +1434,7 @@ invoiceNoTaxAmount as billMoney, confirmNoTaxAmount as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId = #{principalPeopleDetailSearch.principalNameId} @@ -1452,12 +1466,14 @@ - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{principalPeopleDetailSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{principalPeopleDetailSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{principalPeopleDetailSearch.paymentYear},'-',#{principalPeopleDetailSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{principalPeopleDetailSearch.paymentYear},'%') + + ) pp @@ -1748,7 +1764,7 @@ sum(confirmNoTaxAmount) as confirmAmount, sum(confirmAmount) as confirmAmount1 from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId in @@ -1763,12 +1779,14 @@ AND chargeCompanyId = #{companyComeMoneySearch.chargeCompanyId} - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{companyComeMoneySearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{companyComeMoneySearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{companyComeMoneySearch.paymentYear},'-',#{companyComeMoneySearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{companyComeMoneySearch.paymentYear},'%') + + group by chargeCompanyId ) ppp @@ -1831,7 +1849,7 @@ sum(invoiceNoTaxAmount) as billMoney, sum(confirmNoTaxAmount) as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + principalNameId in @@ -1846,12 +1864,14 @@ AND chargeCompanyId = #{companyComeMoneySearch.chargeCompanyId} - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{companyComeMoneySearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{companyComeMoneySearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{companyComeMoneySearch.paymentYear},'-',#{companyComeMoneySearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{companyComeMoneySearch.paymentYear},'%') + + group by chargeCompanyId ) ppp @@ -1993,7 +2013,7 @@ invoiceNoTaxAmount as billMoney, confirmNoTaxAmount as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + chargeCompanyId = #{CompanyComeMoneyDetailSearch.chargeCompanyId} @@ -2033,12 +2053,14 @@ - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{CompanyComeMoneyDetailSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{CompanyComeMoneyDetailSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{CompanyComeMoneyDetailSearch.paymentYear},'-',#{CompanyComeMoneyDetailSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{CompanyComeMoneyDetailSearch.paymentYear},'%') + + ) p @@ -2084,7 +2106,7 @@ invoiceNoTaxAmount as billMoney, confirmNoTaxAmount as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + chargeCompanyId = #{CompanyComeMoneyDetailSearch.chargeCompanyId} @@ -2125,12 +2147,14 @@ - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{CompanyComeMoneyDetailSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{CompanyComeMoneyDetailSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{CompanyComeMoneyDetailSearch.paymentYear},'-',#{CompanyComeMoneyDetailSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{CompanyComeMoneyDetailSearch.paymentYear},'%') + + ) pp @@ -2153,7 +2177,7 @@ sum(confirmNoTaxAmount) as confirmAmount, sum(confirmAmount) as confirmAmount1 from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + #{item} @@ -2162,12 +2186,14 @@ AND year LIKE concat(#{departStatisticsSearch.year}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{departStatisticsSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{departStatisticsSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{departStatisticsSearch.paymentYear},'-',#{departStatisticsSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{departStatisticsSearch.paymentYear},'%') + + group by v.departId) p @@ -2204,7 +2230,7 @@ sum(invoiceNoTaxAmount) as billMoney, sum(confirmNoTaxAmount) as confirmAmount from v_statistical v - left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) + #{item} @@ -2213,33 +2239,17 @@ AND year LIKE concat(#{departStatisticsSearch.year}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{departStatisticsSearch.paymentYear}, '%') - - and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{departStatisticsSearch.paymentMonth}, '%') - - + + + and confirmDate like concat('%',#{departStatisticsSearch.paymentYear},'-',#{departStatisticsSearch.paymentMonth},'%') + + + and confirmDate like concat('%',#{departStatisticsSearch.paymentYear},'%') + + - - - - + + + + + + + + + + + - - + + + + + + + + + @@ -2349,6 +2433,7 @@ paidNoTaxAmount, confirmNoTaxAmount, contactsName, + confirmDate, pp.pack from ( SELECT pwgs.id, @@ -2374,13 +2459,15 @@ invoice_no_tax_amount as invoiceNoTaxAmount, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, - GROUP_CONCAT(pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName, + GROUP_CONCAT(DISTINCT pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName, + GROUP_CONCAT(DISTINCT DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pwgs.create_time as createTime FROM pay_working_group pwg right join pay_working_group_subitem 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.depart_ids = sd.id) left JOIN pay_working_group_subitem_contacts pwgsc on pwgsc.working_group_sub_id = pwgs.id + left join pay_confirm_payment_record pcpr on pwgs.id = pcpr.project_id where pwgs.charge_way = 2 group by pwgs.id union all @@ -2407,13 +2494,15 @@ invoice_no_tax_amount as invoiceNoTaxAmount, paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, - GROUP_CONCAT(pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName, + GROUP_CONCAT(DISTINCT pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName, + GROUP_CONCAT(DISTINCT DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pwgs.create_time as createTime FROM pay_working_group pwg right join pay_working_group_subitem 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.depart_ids = sd.id) left JOIN pay_working_group_subitem_contacts pwgsc on pwgsc.working_group_sub_id = pwgs.id + left join pay_confirm_payment_record pcpr on pwgs.id = pcpr.project_id where pwgs.charge_way != 2 group by pwgs.id union all @@ -2441,10 +2530,13 @@ paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, contacts_temporary_name as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pcp.create_time as createTime FROM pay_common_project pcp left JOIN sys_user su on (pcp.principal_id = su.id) left join sys_depart sd on (su.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on pcp.id = pcpr.project_id + group by pcp.id union all SELECT pmps.id, pmp.id as superId, @@ -2470,11 +2562,14 @@ paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, company_contact_name as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pmps.create_time as createTime FROM pay_member_project pmp right join pay_member_project_subitem pmps on (pmp.id = pmps.project_id) left JOIN sys_user su on (pmp.director_id = su.id) left join sys_depart sd on (su.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on pmps.id = pcpr.project_id + group by pmps.id union all SELECT pms.id, pm.id as superId, @@ -2500,11 +2595,14 @@ paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, company_contact_name as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, pms.create_time as createTime FROM pay_meeting pm right join pay_meeting_situation 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.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on pms.id = pcpr.project_id + group by pms.id union all SELECT tmps.id, tmp.id as superId, @@ -2530,11 +2628,14 @@ paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, liaison_man as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, tmps.create_time as createTime FROM tb_member_project tmp left join tb_member_project_subitem 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.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on tmps.id = pcpr.project_id + group by tmps.id union all SELECT tcp.id, tmp.id as superId, @@ -2560,18 +2661,20 @@ paid_no_tax_amount as paidNoTaxAmount, confirm_no_tax_amount as confirmNoTaxAmount, liaison_man as contactsName, + GROUP_CONCAT(DATE_FORMAT(pcpr.payment_date,'%Y-%m')) as confirmDate, 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.depart_ids = sd.id) + left join pay_confirm_payment_record pcpr on tcp.id = pcpr.project_id + group by tcp.id ) pp where pp.allMoney is not null and pp.allMoney != 0 order by pp.createTime) v - LEFT JOIN pay_confirm_payment_record pcpr ON (v.projectId = pcpr.project_id) - DATE_FORMAT(pcpr.payment_date, '%Y') like concat(#{year}, '%') + confirmDate like concat('%',#{year},'%') GROUP BY chargeUse diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java index a840a3ec..0834a021 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java @@ -588,23 +588,30 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList) { - List list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList); List allMoneyList = payWorkingGroupMapper.queryListAllMoney(allProjectStatisticsSearch); - return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list,allMoneyList); + List listConfirmAmount = payWorkingGroupMapper.queryListConfirmAmount(allProjectStatisticsSearch); + List listBillMoney = payWorkingGroupMapper.queryListBillMoney(allProjectStatisticsSearch); + List listComeAllMoney = payWorkingGroupMapper.queryListComeAllMoney(allProjectStatisticsSearch); + return getAllProjectMoneyStatistics(allProjectStatisticsSearch,allMoneyList,listConfirmAmount, listBillMoney,listComeAllMoney); } @Override public List cumulativeListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch) { - List list = payWorkingGroupMapper.cumulativeListAllProjectMoney(allProjectStatisticsSearch); - List allMoneyList = payWorkingGroupMapper.cumulativeListAllMoney(allProjectStatisticsSearch); - return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list,allMoneyList); + List allMoneyList = payWorkingGroupMapper.cumulativeListAllMoney(); + List listConfirmAmount = payWorkingGroupMapper.cumulativeListConfirmAmount(); + List listBillMoney = payWorkingGroupMapper.cumulativeListBillMoney(); + List listComeAllMoney = payWorkingGroupMapper.cumulativeListComeAllMoney(); + return getAllProjectMoneyStatistics(allProjectStatisticsSearch,allMoneyList,listConfirmAmount, listBillMoney,listComeAllMoney); } @Override public List queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList) { - List list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList); List allMoneyList = payWorkingGroupMapper.queryListAllMoney(allProjectStatisticsSearch); - List list2=getAllProjectMoneyStatistics(allProjectStatisticsSearch, list, allMoneyList); + List listConfirmAmount = payWorkingGroupMapper.queryListConfirmAmount(allProjectStatisticsSearch); + List listBillMoney = payWorkingGroupMapper.queryListBillMoney(allProjectStatisticsSearch); + List listComeAllMoney = payWorkingGroupMapper.queryListComeAllMoney(allProjectStatisticsSearch); + + List list2=getAllProjectMoneyStatistics(allProjectStatisticsSearch,allMoneyList,listConfirmAmount, listBillMoney,listComeAllMoney); AllMoney allMoney=payWorkingGroupMapper.queryPageList33(allProjectStatisticsSearch, idList); List comeAllMoneyList=list2.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList()); @@ -652,11 +659,15 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl getAllProjectMoneyStatistics(AllProjectStatisticsSearch allProjectStatisticsSearch, List list, List allMoneyList) { - Map comeAllMoneyMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getComeAllMoney)); - Map billMoneyMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getBillMoney)); - Map confirmAmountMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getConfirmAmount)); + private List getAllProjectMoneyStatistics(AllProjectStatisticsSearch allProjectStatisticsSearch, + List allMoneyList, + List listConfirmAmount, + List listBillMoney, + List listComeAllMoney) { Map allMoneyMap = allMoneyList.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getAllMoney)); + Map confirmAmountMap = listConfirmAmount.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getConfirmAmount)); + Map billMoneyMap = listBillMoney.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getBillMoney)); + Map comeAllMoneyMap = listComeAllMoney.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getComeAllMoney)); String paymentYear=allProjectStatisticsSearch.getPaymentYear(); List yearMonth = getYearMonth(paymentYear); diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java index 23d2ce41..bbdbe6b2 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java @@ -17,6 +17,7 @@ import com.jero.statistics.entity.AllProjectStatisticsSearch; import com.jero.util.AmountUtil; import com.mchange.lang.IntegerUtils; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; @@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; +import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.*; import java.util.function.Function; @@ -67,14 +69,25 @@ public class AllProjectMoneyStatisticsController { public Result list(AllProjectStatisticsSearch allProjectStatisticsSearch) { List list = payWorkingGroupService.queryListAllProjectMoney(allProjectStatisticsSearch, null); - + BigDecimal allMoney = BigDecimal.ZERO; + BigDecimal comeAllMoney = BigDecimal.ZERO; + BigDecimal billMoney = BigDecimal.ZERO; + BigDecimal confirmAmount = BigDecimal.ZERO; + for (AllProjectStatistics item : list) { + BigDecimal allMoney1 = new BigDecimal(item.getAllMoney()); + allMoney = allMoney.add(allMoney1); + BigDecimal comeAllMoney1 = new BigDecimal(item.getComeAllMoney()); + comeAllMoney = comeAllMoney.add(comeAllMoney1); + BigDecimal billMoney1 = new BigDecimal(item.getBillMoney()); + billMoney = billMoney.add(billMoney1); + BigDecimal confirmAmount1 = new BigDecimal(item.getConfirmAmount()); + confirmAmount = confirmAmount.add(confirmAmount1); + }; HashMap hashMap = new HashMap<>(); - AllMoney allMoney = payWorkingGroupService.queryPageList33(allProjectStatisticsSearch, null); - AllMoney allMoney1 = payWorkingGroupService.queryAllMoney33(allProjectStatisticsSearch); - hashMap.put("sumOfMoney", ObjectUtils.isEmpty(allMoney1) ? 0 : allMoney1.getAllMoney()); - hashMap.put("sumOfReallyMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getComeAllMoney()); - hashMap.put("sumOfBillMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getBillMoney()); - hashMap.put("sumOfConfirmAmount", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getConfirmAmount()); + hashMap.put("sumOfMoney", allMoney.toString()); + hashMap.put("sumOfReallyMoney", comeAllMoney.toString()); + hashMap.put("sumOfBillMoney", billMoney.toString()); + hashMap.put("sumOfConfirmAmount", confirmAmount.toString()); hashMap.put("list", list); return Result.OK(hashMap);