diff --git a/db/2022-1-4变更.sql b/db/2022-1-4变更.sql index 98025ed6..7d7c556b 100644 --- a/db/2022-1-4变更.sql +++ b/db/2022-1-4变更.sql @@ -257,4 +257,9 @@ INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `com INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1535559127371321346', '1535558715796852737', '查询', '', NULL, NULL, NULL, 2, 'departmentAllStatistics:search', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'LKGLZ', '2022-06-11 17:46:40', NULL, NULL, 0, 0, '1', 0); INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1535559323643777026', '1535558715796852737', '导出', '', NULL, NULL, NULL, 2, 'departmentAllStatistics:export', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'LKGLZ', '2022-06-11 17:47:27', NULL, NULL, 0, 0, '1', 0); +-- 2022年8月1日 增加全所收入统计模块的sql;增加打包管理模块确认收入按钮的sql +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1553998336251633666', '1553997970898395138', '导出', NULL, NULL, NULL, NULL, 2, 'wholePaymentsStatistics:export', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'LKGLZ', '2022-08-01 14:57:30', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1553998246489333762', '1553997970898395138', '查询', NULL, NULL, NULL, NULL, 2, 'wholePaymentsStatistics:search', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'LKGLZ', '2022-08-01 14:57:09', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1553997970898395138', '1437320526513905666', '全所收入统计', '/statisticalReport/WholePaymentsStatistics', 'statisticalReport/WholePaymentsStatistics', NULL, NULL, 1, NULL, '1', 10.00, 0, NULL, 1, 0, 0, 0, NULL, 'LKGLZ', '2022-08-01 14:56:03', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1553987184549404674', '1435493270476906497', '确认收入', NULL, NULL, NULL, NULL, 2, 'packProject:confirmPayment', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'LKGLZ', '2022-08-01 14:13:11', NULL, NULL, 0, 0, '1', 0); diff --git a/db/统计视图.sql b/db/统计视图.sql index 6ad3349c..ed78ab82 100644 --- a/db/统计视图.sql +++ b/db/统计视图.sql @@ -20,30 +20,36 @@ select pp.id as projectId, type, if(billMoney is null, 0, billMoney) as billMoney, confirmAmount, + invoiceNoTaxAmount, + paidNoTaxAmount, + confirmNoTaxAmount, contactsName, pp.pack from (SELECT pwgs.id, - pwg.id as superId, - pwg.working_group_project AS projectName, - pwg.principal_name_a as principalName, - pwgs.charge_company_id AS chargeCompanyId, - pwgs.charge_company_temporary_id as chargeCompanyTemporaryId, - pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName, - pwgs.receivable_amount as allMoney, - pwgs.paid_amount as comeAllMoney, - pwgs.charge_use as chargeUse, - sd.depart_name as depart, - pwgs.pack as pack, - pwg.year as year, - pwgs.in_account as payStatue, - su.org_code as departCode, - sd.id as departId, - pwg.principal_id_a as principalNameId, - 2 as type, - pwgs.invoice_amount AS billMoney, - confirm_amount as confirmAmount, - GROUP_CONCAT(pwgsc.contacts_temporary_name) as contactsName, - pwgs.create_time as createTime + pwg.id as superId, + pwg.working_group_project AS projectName, + pwg.principal_name_a as principalName, + pwgs.charge_company_id AS chargeCompanyId, + pwgs.charge_company_temporary_id as chargeCompanyTemporaryId, + pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName, + pwgs.receivable_amount as allMoney, + pwgs.paid_amount as comeAllMoney, + pwgs.charge_use as chargeUse, + sd.depart_name as depart, + pwgs.pack as pack, + pwg.year as year, + pwgs.in_account as payStatue, + su.org_code as departCode, + sd.id as departId, + pwg.principal_id_a as principalNameId, + 2 as type, + pwgs.invoice_amount AS billMoney, + confirm_amount as confirmAmount, + 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, + 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) @@ -71,6 +77,9 @@ from (SELECT pwgs.id, 1 as type, pcp.invoice_amount AS billMoney, confirm_amount as confirmAmount, + invoice_no_tax_amount as invoiceNoTaxAmount, + paid_no_tax_amount as paidNoTaxAmount, + confirm_no_tax_amount as confirmNoTaxAmount, contacts_temporary_name as contactsName, pcp.create_time as createTime FROM pay_common_project pcp @@ -97,6 +106,9 @@ from (SELECT pwgs.id, 4 as type, pmps.invoice_amount AS billMoney, confirm_amount as confirmAmount, + invoice_no_tax_amount as invoiceNoTaxAmount, + paid_no_tax_amount as paidNoTaxAmount, + confirm_no_tax_amount as confirmNoTaxAmount, company_contact_name as contactsName, pmps.create_time as createTime FROM pay_member_project pmp @@ -124,6 +136,9 @@ from (SELECT pwgs.id, 3 as type, pms.invoice_amount AS billMoney, confirm_amount as confirmAmount, + invoice_no_tax_amount as invoiceNoTaxAmount, + paid_no_tax_amount as paidNoTaxAmount, + confirm_no_tax_amount as confirmNoTaxAmount, company_contact_name as contactsName, pms.create_time as createTime FROM pay_meeting pm @@ -151,6 +166,9 @@ from (SELECT pwgs.id, 5 as type, tmps.invoice_amount AS billMoney, confirm_amount as confirmAmount, + invoice_no_tax_amount as invoiceNoTaxAmount, + paid_no_tax_amount as paidNoTaxAmount, + confirm_no_tax_amount as confirmNoTaxAmount, liaison_man as contactsName, tmps.create_time as createTime FROM tb_member_project tmp @@ -178,6 +196,9 @@ from (SELECT pwgs.id, 6 as type, tcp.invoice_amount AS billMoney, confirm_amount as confirmAmount, + invoice_no_tax_amount as invoiceNoTaxAmount, + paid_no_tax_amount as paidNoTaxAmount, + confirm_no_tax_amount as confirmNoTaxAmount, liaison_man as contactsName, tcp.create_time as createTime FROM tb_member_project tmp @@ -214,4 +235,160 @@ alter table pay_meeting_situation alter table tb_member_project_subitem add column confirm_amount decimal(12, 2) default 0 null comment '确认金额'; alter table tb_certificate_payment - add column confirm_amount decimal(12, 2) default 0 null comment '确认金额'; \ No newline at end of file + add column confirm_amount decimal(12, 2) default 0 null comment '确认金额'; +-- 新增税额和未税金额 +alter table pay_payment_record + add column tax decimal(12, 2) default 0 comment '税额', + add column no_tax_amount decimal(12, 2) default 0 comment '未税金额'; +alter table pay_mail_bill_project + add column tax decimal(12, 2) default 0 comment '税额', + add column no_tax_amount decimal(12, 2) default 0 comment '未税金额'; +alter table pay_confirm_payment_record + add column tax decimal(12, 2) default 0 comment '税额', + add column no_tax_amount decimal(12, 2) default 0 comment '未税金额'; +-- 项目增加确认收入状态,税额,未税金额 +alter table pay_common_project + add column affirm_income tinyint(1) default 0 comment '确认收入', + add column confirm_no_tax_amount decimal(12, 2) default 0 comment '确认金额未税', + add column confirm_tax decimal(12, 2) default 0 comment '确认金额税额', + add column paid_no_tax_amount decimal(12, 2) default 0 comment '到账金额未税', + add column paid_tax decimal(12, 2) default 0 comment '到账金额税额', + add column invoice_no_tax_amount decimal(12, 2) default 0 comment '开票金额未税', + add column invoice_tax decimal(12, 2) default 0 comment '开票金额税额'; +alter table pay_working_group_subitem + add column affirm_income tinyint(1) default 0 comment '确认收入', + add column confirm_no_tax_amount decimal(12, 2) default 0 comment '确认金额未税', + add column confirm_tax decimal(12, 2) default 0 comment '确认金额税额', + add column paid_no_tax_amount decimal(12, 2) default 0 comment '到账金额未税', + add column paid_tax decimal(12, 2) default 0 comment '到账金额税额', + add column invoice_no_tax_amount decimal(12, 2) default 0 comment '开票金额未税', + add column invoice_tax decimal(12, 2) default 0 comment '开票金额税额'; +alter table pay_member_project_subitem + add column affirm_income tinyint(1) default 0 comment '确认收入', + add column confirm_no_tax_amount decimal(12, 2) default 0 comment '确认金额未税', + add column confirm_tax decimal(12, 2) default 0 comment '确认金额税额', + add column paid_no_tax_amount decimal(12, 2) default 0 comment '到账金额未税', + add column paid_tax decimal(12, 2) default 0 comment '到账金额税额', + add column invoice_no_tax_amount decimal(12, 2) default 0 comment '开票金额未税', + add column invoice_tax decimal(12, 2) default 0 comment '开票金额税额'; +alter table pay_meeting_situation + add column affirm_income tinyint(1) default 0 comment '确认收入', + add column confirm_no_tax_amount decimal(12, 2) default 0 comment '确认金额未税', + add column confirm_tax decimal(12, 2) default 0 comment '确认金额税额', + add column paid_no_tax_amount decimal(12, 2) default 0 comment '到账金额未税', + add column paid_tax decimal(12, 2) default 0 comment '到账金额税额', + add column invoice_no_tax_amount decimal(12, 2) default 0 comment '开票金额未税', + add column invoice_tax decimal(12, 2) default 0 comment '开票金额税额'; +alter table tb_member_project_subitem + add column affirm_income tinyint(1) default 0 comment '确认收入', + add column confirm_no_tax_amount decimal(12, 2) default 0 comment '确认金额未税', + add column confirm_tax decimal(12, 2) default 0 comment '确认金额税额', + add column paid_no_tax_amount decimal(12, 2) default 0 comment '到账金额未税', + add column paid_tax decimal(12, 2) default 0 comment '到账金额税额', + add column invoice_no_tax_amount decimal(12, 2) default 0 comment '开票金额未税', + add column invoice_tax decimal(12, 2) default 0 comment '开票金额税额'; +alter table tb_certificate_payment + add column affirm_income tinyint(1) default 0 comment '确认收入', + add column confirm_no_tax_amount decimal(12, 2) default 0 comment '确认金额未税', + add column confirm_tax decimal(12, 2) default 0 comment '确认金额税额', + add column paid_no_tax_amount decimal(12, 2) default 0 comment '到账金额未税', + add column paid_tax decimal(12, 2) default 0 comment '到账金额税额', + add column invoice_no_tax_amount decimal(12, 2) default 0 comment '开票金额未税', + add column invoice_tax decimal(12, 2) default 0 comment '开票金额税额'; +-- 处理历史数据 +update pay_payment_record +set no_tax_amount = amount_received / 1.06, + tax = amount_received - no_tax_amount +where amount_received is not null; + +update pay_mail_bill_project +set no_tax_amount = invoice_amount / 1.06, + tax = invoice_amount - no_tax_amount +where invoice_amount is not null; + +update pay_confirm_payment_record +set no_tax_amount = amount_received / 1.06, + tax = amount_received - no_tax_amount +where amount_received is not null; +-- 六个项目处理历史数据 +update pay_common_project +set confirm_no_tax_amount = confirm_amount / 1.06, + paid_no_tax_amount = paid_amount / 1.06, + invoice_no_tax_amount = invoice_amount / 1.06, + confirm_tax = confirm_amount - confirm_no_tax_amount, + paid_tax = paid_amount - paid_no_tax_amount, + invoice_tax = invoice_amount - invoice_no_tax_amount +where need_invoice != 0; +update pay_working_group_subitem +set confirm_no_tax_amount = confirm_amount / 1.06, + paid_no_tax_amount = paid_amount / 1.06, + invoice_no_tax_amount = invoice_amount / 1.06, + confirm_tax = confirm_amount - confirm_no_tax_amount, + paid_tax = paid_amount - paid_no_tax_amount, + invoice_tax = invoice_amount - invoice_no_tax_amount +where need_invoice != 0; +update pay_member_project_subitem +set confirm_no_tax_amount = confirm_amount / 1.06, + paid_no_tax_amount = paid_amount / 1.06, + invoice_no_tax_amount = invoice_amount / 1.06, + confirm_tax = confirm_amount - confirm_no_tax_amount, + paid_tax = paid_amount - paid_no_tax_amount, + invoice_tax = invoice_amount - invoice_no_tax_amount +where need_invoice != 0; +update pay_meeting_situation +set confirm_no_tax_amount = confirm_amount / 1.06, + paid_no_tax_amount = paid_amount / 1.06, + invoice_no_tax_amount = invoice_amount / 1.06, + confirm_tax = confirm_amount - confirm_no_tax_amount, + paid_tax = paid_amount - paid_no_tax_amount, + invoice_tax = invoice_amount - invoice_no_tax_amount +where need_invoice != 0; +update tb_member_project_subitem +set confirm_no_tax_amount = confirm_amount / 1.06, + paid_no_tax_amount = paid_amount / 1.06, + invoice_no_tax_amount = invoice_amount / 1.06, + confirm_tax = confirm_amount - confirm_no_tax_amount, + paid_tax = paid_amount - paid_no_tax_amount, + invoice_tax = invoice_amount - invoice_no_tax_amount +where invoice_requirements != 0; +update tb_certificate_payment +set confirm_no_tax_amount = confirm_amount / 1.06, + paid_no_tax_amount = paid_amount / 1.06, + invoice_no_tax_amount = invoice_amount / 1.06, + confirm_tax = confirm_amount - confirm_no_tax_amount, + paid_tax = paid_amount - paid_no_tax_amount, + invoice_tax = invoice_amount - invoice_no_tax_amount +where invoice_requirements != 0; +update pay_common_project +set confirm_no_tax_amount = confirm_amount , + paid_no_tax_amount = paid_amount , + invoice_no_tax_amount = invoice_amount +where need_invoice = 0; +update pay_working_group_subitem +set confirm_no_tax_amount = confirm_amount, + paid_no_tax_amount = paid_amount, + invoice_no_tax_amount = invoice_amount +where need_invoice = 0; +update pay_member_project_subitem +set confirm_no_tax_amount = confirm_amount , + paid_no_tax_amount = paid_amount , + invoice_no_tax_amount = invoice_amount +where need_invoice = 0; +update pay_meeting_situation +set confirm_no_tax_amount = confirm_amount , + paid_no_tax_amount = paid_amount , + invoice_no_tax_amount = invoice_amount +where need_invoice = 0; +update tb_member_project_subitem +set confirm_no_tax_amount = confirm_amount , + paid_no_tax_amount = paid_amount , + invoice_no_tax_amount = invoice_amount +where invoice_requirements = 0; +update tb_certificate_payment +set confirm_no_tax_amount = confirm_amount , + paid_no_tax_amount = paid_amount , + invoice_no_tax_amount = invoice_amount +where invoice_requirements = 0; + +select * +from v_statistical; \ No newline at end of file diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/mail/PayMailBillVO.java b/jero-boot-incoming-payment/src/main/java/com/jero/mail/PayMailBillVO.java index 0360bb3e..1483f61b 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/mail/PayMailBillVO.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/mail/PayMailBillVO.java @@ -3,10 +3,12 @@ package com.jero.mail; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; import com.jero.mail.entity.PayMailBill; import com.jero.mail.entity.PayMailBillProject; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; import javax.validation.constraints.DecimalMax; import javax.validation.constraints.NotBlank; @@ -28,4 +30,18 @@ public class PayMailBillVO extends PayMailBill { @TableField(exist = false) @ApiModelProperty(value = "bmpId") private java.lang.String bmpId; + + /**税额*/ + @Excel(name = "税额", width = 15) + @ApiModelProperty(value = "税额") + @DecimalMax(value = "9999999999.99",message = "税额") + @JsonFormat(shape = JsonFormat.Shape.STRING) + private BigDecimal tax; + + /**未税金额*/ + @Excel(name = "未税金额", width = 15) + @ApiModelProperty(value = "未税金额") + @DecimalMax(value = "9999999999.99",message = "未税金额") + @JsonFormat(shape = JsonFormat.Shape.STRING) + private BigDecimal noTaxAmount; } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/mail/entity/PayMailBillProject.java b/jero-boot-incoming-payment/src/main/java/com/jero/mail/entity/PayMailBillProject.java index 4bdfe35e..d42a8461 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/mail/entity/PayMailBillProject.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/mail/entity/PayMailBillProject.java @@ -52,6 +52,20 @@ public class PayMailBillProject implements Serializable { @DecimalMax(value = "9999999999.99",message = "开票金额格式错误") @JsonFormat(shape = JsonFormat.Shape.STRING) private BigDecimal invoiceAmount; + /**税额*/ + @Excel(name = "税额", width = 15) + @ApiModelProperty(value = "税额") + @DecimalMax(value = "9999999999.99",message = "税额") + @JsonFormat(shape = JsonFormat.Shape.STRING) + private BigDecimal tax; + + /**未税金额*/ + @Excel(name = "未税金额", width = 15) + @ApiModelProperty(value = "未税金额") + @DecimalMax(value = "9999999999.99",message = "未税金额") + @JsonFormat(shape = JsonFormat.Shape.STRING) + private BigDecimal noTaxAmount; + /**备注*/ @Excel(name = "备注", width = 15) @ApiModelProperty(value = "备注") diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/mail/mapper/xml/PayMailBillMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/mail/mapper/xml/PayMailBillMapper.xml index e4d817e3..d8ca5ae0 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/mail/mapper/xml/PayMailBillMapper.xml +++ b/jero-boot-incoming-payment/src/main/java/com/jero/mail/mapper/xml/PayMailBillMapper.xml @@ -45,7 +45,7 @@ + select sum(amount_received) as amount_received, + sum(tax) as tax, + sum(no_tax_amount) as no_tax_amount + from pay_confirm_payment_record + where project_id = #{projectId,jdbcType=VARCHAR} + group by project_id + + + + + + + + update pay_confirm_payment_record + set no_tax_amount = amount_received, + tax = 0 + where project_id = #{projectId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayPaymentRecordMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayPaymentRecordMapper.xml index 17c71381..d73a9d1c 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayPaymentRecordMapper.xml +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayPaymentRecordMapper.xml @@ -3,13 +3,55 @@ + + id, + project_id, + project_type, + amount_received, + payment_date, + proof, + remark, + create_by, + create_time, + update_by, + update_time, + applicant_name, + payment_status, + reviewer_id, + reviewer_name, + review_time, + review_instructions, + tax, + no_tax_amount + + + + + + + + + + + + + + + + + + + + + + - select p.id,p.charge_project, p.charge_use, p.principal_id,p.principal_name,p.charge_company_temporary_name,p.receivable_amount,p.paid_amount,p.need_invoice,p.pack,p.in_account,p.make_invoice,p.mail,p.create_time,p.projectType,p.charge_company_temporary_id + select p.id,p.charge_project, p.charge_use, p.principal_id,p.principal_name,p.charge_company_temporary_name,p.receivable_amount,p.paid_amount,p.need_invoice,p.pack,p.in_account,p.make_invoice,p.mail,p.create_time,p.projectType,p.charge_company_temporary_id, + p.confirm_amount from ( select c.id,c.charge_project, c.charge_use, c.principal_id,su.realname as principal_name,c.charge_company_temporary_name,c.receivable_amount,c.paid_amount,c.need_invoice,c.pack,c.in_account,c.make_invoice,c.mail,c.create_time,1 as projectType,c.charge_company_temporary_id + ,c.confirm_amount from pay_common_project c left join sys_user su on c.principal_id = su.id where @@ -255,7 +299,8 @@ UNION ALL - select gsub.id,g.working_group_project, gsub.charge_use, g.principal_id_a,su.realname,gsub.charge_company_temporary_name,gsub.receivable_amount,gsub.paid_amount,gsub.need_invoice,gsub.pack,gsub.in_account,gsub.make_invoice,gsub.mail,gsub.create_time,2,gsub.charge_company_temporary_id + select gsub.id,g.working_group_project, gsub.charge_use, g.principal_id_a,su.realname,gsub.charge_company_temporary_name,gsub.receivable_amount,gsub.paid_amount,gsub.need_invoice,gsub.pack,gsub.in_account,gsub.make_invoice,gsub.mail,gsub.create_time,2,gsub.charge_company_temporary_id, + gsub.confirm_amount from pay_working_group g left join sys_user su on g.principal_id_a = su.id inner join pay_working_group_subitem gsub on g.id = gsub.working_group_id @@ -286,7 +331,8 @@ UNION ALL - select sit.id,meeting.meeting_name,sit.charge_use, meeting.director_id, su.realname,sit.company_name,sit.amount_receivable,sit.paid_amount,sit.need_invoice,sit.pack,sit.in_account,sit.make_invoice,sit.mail,sit.create_time,3,sit.company_id + select sit.id,meeting.meeting_name,sit.charge_use, meeting.director_id, su.realname,sit.company_name,sit.amount_receivable,sit.paid_amount,sit.need_invoice,sit.pack,sit.in_account,sit.make_invoice,sit.mail,sit.create_time,3,sit.company_id, + sit.confirm_amount from pay_meeting meeting left join sys_user su on meeting.director_id = su.id inner join pay_meeting_situation sit on meeting.id = sit.meeting_id @@ -317,7 +363,8 @@ UNION ALL - select msub.id,member.project_name,msub.charge_use,member.director_id,su.realname,msub.company_name,msub.amount_receivable,msub.paid_amount,msub.need_invoice,msub.pack,msub.in_account,msub.make_invoice,msub.mail,msub.create_time,4,msub.company_temporary_id + select msub.id,member.project_name,msub.charge_use,member.director_id,su.realname,msub.company_name,msub.amount_receivable,msub.paid_amount,msub.need_invoice,msub.pack,msub.in_account,msub.make_invoice,msub.mail,msub.create_time,4,msub.company_temporary_id, + msub.confirm_amount from pay_member_project member left join sys_user su on member.director_id = su.id inner join pay_member_project_subitem msub on member.id=msub.project_id @@ -348,7 +395,8 @@ UNION ALL - select tmsub.id,tmember.project_name,tmsub.charge_use,tmember.director_id,su.realname,tmsub.company_name,tmsub.amount_receivable,tmsub.paid_amount,tmsub.invoice_requirements,tmsub.pack,tmsub.in_account,tmsub.make_invoice,tmsub.mail,tmsub.create_time,5,tmsub.company_id + select tmsub.id,tmember.project_name,tmsub.charge_use,tmember.director_id,su.realname,tmsub.company_name,tmsub.amount_receivable,tmsub.paid_amount,tmsub.invoice_requirements,tmsub.pack,tmsub.in_account,tmsub.make_invoice,tmsub.mail,tmsub.create_time,5,tmsub.company_id, + tmsub.confirm_amount from tb_member_project tmember left join sys_user su on tmember.director_id = su.id inner join tb_member_project_subitem tmsub on tmember.id=tmsub.project_id @@ -379,7 +427,8 @@ UNION ALL - select tcp.id,tmember.project_name,tcp.charge_use,tmember.director_id,su.realname,tcp.company_name,tcp.amount_receivable,tcp.paid_amount,tcp.invoice_requirements,tcp.pack,tcp.in_account,tcp.make_invoice,tcp.mail,tcp.create_time,6,tcp.company_id + select tcp.id,tmember.project_name,tcp.charge_use,tmember.director_id,su.realname,tcp.company_name,tcp.amount_receivable,tcp.paid_amount,tcp.invoice_requirements,tcp.pack,tcp.in_account,tcp.make_invoice,tcp.mail,tcp.create_time,6,tcp.company_id, + tcp.confirm_amount from tb_member_project tmember inner join tb_certificate_payment tcp on tmember.id=tcp.project_id left join sys_user su on su.id = tmember.director_id @@ -426,4 +475,12 @@ + + + + update pay_payment_record + set no_tax_amount=amount_received, + tax = 0 + where project_id = #{projectId} + diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/IPayPaymentRecordService.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/IPayPaymentRecordService.java index 67c99e96..d99a3a08 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/IPayPaymentRecordService.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/IPayPaymentRecordService.java @@ -68,6 +68,11 @@ public interface IPayPaymentRecordService extends IService { void updateStandards(String tbPaymentId, MemberInfo memberInfo); + /** + * 税额是否正确 + */ + void isTax(BigDecimal tax, BigDecimal noTaxAmount, BigDecimal amountReceived); + /** * 累加实收并四舍五入 * @param paidAmount 实收 diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayConfirmPaymentRecordService.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayConfirmPaymentRecordService.java index 4dd54d21..c8385c45 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayConfirmPaymentRecordService.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayConfirmPaymentRecordService.java @@ -1,38 +1,29 @@ package com.jero.payment.service.impl; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.jero.common.enums.PaymentStatusEnum; -import com.jero.company.entity.PayContactsManagement; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.jero.contract.common.PayIncomeContractCommon; -import com.jero.meeting.entity.PayMeeting; import com.jero.meeting.entity.PayMeetingSituation; import com.jero.meeting.mapper.PayMeetingSituationMapper; import com.jero.member.entity.*; import com.jero.member.mapper.PayMemberProjectSubitemMapper; import com.jero.member.mapper.TbCertificatePaymentMapper; import com.jero.member.mapper.TbMemberProjectSubitemMapper; -import com.jero.payment.vo.TbCheckVo; -import com.jero.project.common.PayProjectCommon; +import com.jero.payment.mapper.PayPaymentRecordMapper; +import com.jero.payment.service.IPayPaymentRecordService; import com.jero.project.entity.PayCommonProject; -import com.jero.project.entity.PayWorkingGroup; import com.jero.project.entity.PayWorkingGroupSubItem; -import com.jero.project.entity.PayWorkingGroupSubItemContacts; import com.jero.project.mapper.PayCommonProjectMapper; import com.jero.project.mapper.PayWorkingGroupSubItemMapper; -import com.jero.temporary.entity.PayContactsManagementTemporary; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.payment.entity.PayConfirmPaymentRecord; import com.jero.payment.mapper.PayConfirmPaymentRecordMapper; -import org.springframework.util.CollectionUtils; /** * @author liJiaRao @@ -52,17 +43,37 @@ public class PayConfirmPaymentRecordService extends ServiceImpl ids) { removeByIds(ids); } + + public void updateAffirmIncome() { + payCommonProjectMapper.selectList(new QueryWrapper<>()).forEach(p -> { + BigDecimal confirmAmount = p.getConfirmAmount(); + Integer affirmIncome = getAffirmIncome(p.getReceivableAmount(), confirmAmount); + PayCommonProject project = new PayCommonProject(); + project.setId(p.getId()); + project.setAffirmIncome(affirmIncome); + payCommonProjectMapper.updateById(project); + if (p.getNeedInvoice() == 0) { + baseMapper.updateZeroTaxByProjectId(p.getId()); + payPaymentRecordMapper.updateZeroTaxByProjectId(p.getId()); + } + }); + + payWorkingGroupSubItemMapper.selectList(new QueryWrapper<>()).forEach(p -> { + BigDecimal confirmAmount = p.getConfirmAmount(); + Integer affirmIncome = getAffirmIncome(p.getReceivableAmount(), confirmAmount); + PayWorkingGroupSubItem project = new PayWorkingGroupSubItem(); + project.setId(p.getId()); + project.setAffirmIncome(affirmIncome); + payWorkingGroupSubItemMapper.updateById(project); + if (p.getNeedInvoice() == 0) { + baseMapper.updateZeroTaxByProjectId(p.getId()); + payPaymentRecordMapper.updateZeroTaxByProjectId(p.getId()); + } + }); + + payMeetingSituationMapper.selectList(new QueryWrapper<>()).forEach(p -> { + BigDecimal confirmAmount = p.getConfirmAmount(); + Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount); + PayMeetingSituation project = new PayMeetingSituation(); + project.setId(p.getId()); + project.setAffirmIncome(affirmIncome); + payMeetingSituationMapper.updateById(project); + if (p.getNeedInvoice() == 0) { + baseMapper.updateZeroTaxByProjectId(p.getId()); + payPaymentRecordMapper.updateZeroTaxByProjectId(p.getId()); + } + }); + + payMemberProjectSubitemMapper.selectList(new QueryWrapper<>()).forEach(p -> { + BigDecimal confirmAmount = p.getConfirmAmount(); + Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount); + PayMemberProjectSubitem project = new PayMemberProjectSubitem(); + project.setId(p.getId()); + project.setAffirmIncome(affirmIncome); + payMemberProjectSubitemMapper.updateById(project); + if (p.getNeedInvoice() == 0) { + baseMapper.updateZeroTaxByProjectId(p.getId()); + payPaymentRecordMapper.updateZeroTaxByProjectId(p.getId()); + } + }); + + tbMemberProjectSubitemMapper.selectList(new QueryWrapper<>()).forEach(p -> { + BigDecimal confirmAmount = p.getConfirmAmount(); + Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount); + TbMemberProjectSubitem project = new TbMemberProjectSubitem(); + project.setId(p.getId()); + project.setAffirmIncome(affirmIncome); + tbMemberProjectSubitemMapper.updateById(project); + if (p.getInvoiceRequirements() == 0) { + baseMapper.updateZeroTaxByProjectId(p.getId()); + payPaymentRecordMapper.updateZeroTaxByProjectId(p.getId()); + } + }); + + certificatePaymentMapper.selectList(new QueryWrapper<>()).forEach(p -> { + BigDecimal confirmAmount = p.getConfirmAmount(); + Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount); + TbCertificatePayment project = new TbCertificatePayment(); + project.setId(p.getId()); + project.setAffirmIncome(affirmIncome); + certificatePaymentMapper.updateById(project); + if (p.getInvoiceRequirements() == 0) { + baseMapper.updateZeroTaxByProjectId(p.getId()); + payPaymentRecordMapper.updateZeroTaxByProjectId(p.getId()); + } + }); + } + /** + * 得到确认收入状态 + * @param receivableAmount 应收 + * @param paidAmount 实收 + * @return + */ + public Integer getAffirmIncome (BigDecimal receivableAmount, BigDecimal paidAmount){ + BigDecimal zero = BigDecimal.ZERO; + if(receivableAmount == null){ + receivableAmount = BigDecimal.ZERO; + } + if(paidAmount == null){ + paidAmount = BigDecimal.ZERO; + } + + //应收=0 + if(receivableAmount.compareTo(zero)==0){ + return 3; + } + //应收>实收>0 + if(receivableAmount.compareTo(paidAmount) > 0 && paidAmount.compareTo(zero) > 0){ + return 2; + } + //应收=实收 + if(receivableAmount.compareTo(paidAmount) == 0){ + return 1; + } + //实收 > 应收 + if(paidAmount.compareTo(receivableAmount) > 0){ + return 1; + } + //实收=0 + if(paidAmount.compareTo(zero)==0){ + return 0; + }else{ + //无意义 + return 2; + } + + } + } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentCheckServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentCheckServiceImpl.java index 8adc73ee..7cf927b4 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentCheckServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayPaymentCheckServiceImpl.java @@ -55,6 +55,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; /** @@ -553,6 +554,19 @@ public class PayPaymentCheckServiceImpl extends ServiceImpl list,Integer flag,String checkOrRecord){ List typr5List = new ArrayList<>(); List typr6List = new ArrayList<>(); + //如果没有填写税额就存入默认税额 + list.forEach(payPaymentRecord ->{ + BigDecimal noTaxAmount1 = payPaymentRecord.getNoTaxAmount(); + BigDecimal tax1 = payPaymentRecord.getTax(); + if (noTaxAmount1 == null || tax1 == null){ + BigDecimal amountReceived = payPaymentRecord.getAmountReceived(); + BigDecimal noTaxAmount = amountReceived.divide(new BigDecimal("1.06"), 2, RoundingMode.HALF_UP); + BigDecimal tax = amountReceived.subtract(noTaxAmount); + payPaymentRecord.setNoTaxAmount(noTaxAmount); + payPaymentRecord.setTax(tax); + } + }); for(PayPaymentRecord payPaymentRecord : list){ addOneAmountReceived(payPaymentRecord,typr5List,typr6List,flag,checkOrRecord); @@ -329,6 +344,8 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl listId = new ArrayList<>(); + BigDecimal divide = payPaymentRecord.getAmountReceived().divide(new BigDecimal("1.06"), 2, RoundingMode.HALF_UP); //累加主列表实收金额 //来款条件校验 amountReceivedVerification( payPaymentRecord, flag); @@ -367,7 +387,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl实收>0 - if(receivableAmount.compareTo(paidAmount) == 1 && paidAmount.compareTo(zero)==1){ + if(receivableAmount.compareTo(paidAmount) > 0 && paidAmount.compareTo(zero) > 0){ return 2; } //应收=实收 @@ -884,7 +975,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl { List queryPageListDepartment(@Param("departStatisticsSearch") DepartStatisticsSearch departStatisticsSearch, @Param("idList") List idList); AllMoney queryPageListDepartment33(@Param("departStatisticsSearch") DepartStatisticsSearch departStatisticsSearch, @Param("idList") List idList); + + List queryListAllProjectMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List idList); } 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 022cc002..e2c6eb10 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 @@ -133,20 +133,19 @@ + @@ -1395,17 +1406,15 @@ projectName, principalNameId as principalId, allMoney, - comeAllMoney, + paidNoTaxAmount as comeAllMoney, packText, pack, chargeUse, chargeCompanyTemporaryName, - if(pmb.invoice_amount is null, 0.00, pmb.invoice_amount) as billMoney, - confirmAmount + invoiceNoTaxAmount as billMoney, + confirmNoTaxAmount as confirmAmount from v_statistical v - left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id - left join pay_mail_bill pmb on pmbp.bill_id = pmb.id - left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id) + left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) principalNameId = #{principalPeopleDetailSearch.principalNameId} @@ -1439,6 +1448,9 @@ and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{principalPeopleDetailSearch.paymentYear}, '%') + + and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{principalPeopleDetailSearch.paymentMonth}, '%') + ) pp @@ -1717,20 +1729,20 @@ allMoney, comeAllMoney, createTime, - CONCAT(CAST(ROUND((confirmAmount / allMoney) * 100, 2) AS CHAR), '%') AS finishRate, + CONCAT(CAST(ROUND((confirmAmount1 / allMoney) * 100, 2) AS CHAR), '%') AS finishRate, billMoney, - confirmAmount from + confirmAmount, + confirmAmount1 from (select chargeCompanyId as chargeCompanyTemporaryId, chargeCompanyTemporaryName, SUM(allMoney) as allMoney, - sum(comeAllMoney) as comeAllMoney, + sum(paidNoTaxAmount) as comeAllMoney, createTime, - if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, - sum(confirmAmount) as confirmAmount + sum(invoiceNoTaxAmount) as billMoney, + sum(confirmNoTaxAmount) as confirmAmount, + sum(confirmAmount) as confirmAmount1 from v_statistical v - left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id - left join pay_mail_bill pmb on pmbp.bill_id = pmb.id - left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id) + left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) principalNameId in @@ -1747,6 +1759,9 @@ and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{companyComeMoneySearch.paymentYear}, '%') + + and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{companyComeMoneySearch.paymentMonth}, '%') + group by chargeCompanyId @@ -1805,14 +1820,12 @@ (select chargeCompanyTemporaryId, chargeCompanyTemporaryName, SUM(allMoney) as allMoney, - sum(comeAllMoney) as comeAllMoney, + sum(paidNoTaxAmount) as comeAllMoney, createTime, - if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, - sum(confirmAmount) as confirmAmount + sum(invoiceNoTaxAmount) as billMoney, + sum(confirmNoTaxAmount) as confirmAmount from v_statistical v - left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id - left join pay_mail_bill pmb on pmbp.bill_id = pmb.id - left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id) + left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) principalNameId in @@ -1829,6 +1842,9 @@ and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{companyComeMoneySearch.paymentYear}, '%') + + and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{companyComeMoneySearch.paymentMonth}, '%') + group by chargeCompanyId @@ -1966,13 +1982,12 @@ select sum(allMoney) as allMoney, - sum(comeAllMoney) as comeAllMoney, - if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney, - sum(confirmAmount) as confirmAmount + sum(paidNoTaxAmount) as comeAllMoney, + sum(invoiceNoTaxAmount) as billMoney, + sum(confirmNoTaxAmount) as confirmAmount from v_statistical v - left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id - left join pay_mail_bill pmb on pmbp.bill_id = pmb.id - left join pay_confirm_payment_record pcpr on(pmbp.project_id=pcpr.project_id) + left join pay_confirm_payment_record pcpr on(v.projectId=pcpr.project_id) #{item} @@ -2189,7 +2209,28 @@ and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{departStatisticsSearch.paymentYear}, '%') + + and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{departStatisticsSearch.paymentMonth}, '%') + + + + diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupSubItemMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupSubItemMapper.xml index 17d4a569..b5c822f2 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupSubItemMapper.xml +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupSubItemMapper.xml @@ -121,6 +121,9 @@ and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{payWorkingGroupSubletSearch.paymentYear}, '%') + + and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{payWorkingGroupSubletSearch.paymentMonth}, '%') + group by id @@ -184,6 +187,9 @@ and DATE_FORMAT (pcpr.payment_date,'%Y') like concat(#{payWorkingGroupSubletSearch.paymentYear}, '%') + + and DATE_FORMAT (pcpr.payment_date,'%m') like concat(#{payWorkingGroupSubletSearch.paymentMonth}, '%') + group by id) p diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java index 6c735273..e2c446c4 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java @@ -238,4 +238,8 @@ public interface IPayWorkingGroupService extends IService { List queryPageListDepartmentExcel(DepartStatisticsSearch departStatisticsSearch, List idList); AllMoney queryPageListDepartment33(DepartStatisticsSearch departStatisticsSearch, List idList); + + List queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList); + + List queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList); } 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 c2efb540..e581f2a9 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 @@ -35,6 +35,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; +import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -630,4 +631,69 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList) { + List list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList); + return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list); + } + + @Override + public List queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList) { + List list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList); + List list2=getAllProjectMoneyStatistics(allProjectStatisticsSearch, list); + AllMoney allMoney=payWorkingGroupMapper.queryPageList33(allProjectStatisticsSearch, idList); + + List comeAllMoneyList=list2.stream().map(allProjectStatistics -> allProjectStatistics.getComeAllMoney()).collect(Collectors.toList()); + List billMoneyList=list2.stream().map(allProjectStatistics -> allProjectStatistics.getBillMoney()).collect(Collectors.toList()); + List confirmMoneyList=list2.stream().map(allProjectStatistics -> allProjectStatistics.getConfirmAmount()).collect(Collectors.toList()); + List> list3 = new ArrayList<>(); + list3.add(0,confirmMoneyList); + list3.add(1,billMoneyList); + list3.add(2,comeAllMoneyList); + + AllProjectMoneyExcel comeAllProjectMoney=new AllProjectMoneyExcel("到账金额",allMoney.getComeAllMoney()); + AllProjectMoneyExcel billAllProjectMoney=new AllProjectMoneyExcel("开票金额",allMoney.getBillMoney()); + AllProjectMoneyExcel confirmAllProjectMoney=new AllProjectMoneyExcel("确认收入金额",allMoney.getConfirmAmount()); + List excelList = new ArrayList<>(); + excelList.add(0,confirmAllProjectMoney); + excelList.add(1,billAllProjectMoney); + excelList.add(2,comeAllProjectMoney); + + for (int i=0; i < excelList.size(); i++) { + excelList.get(i).setJanuary(list3.get(i).get(0)); + excelList.get(i).setFebruary(list3.get(i).get(1)); + excelList.get(i).setMarch(list3.get(i).get(2)); + excelList.get(i).setApril(list3.get(i).get(3)); + excelList.get(i).setMay(list3.get(i).get(4)); + excelList.get(i).setJune(list3.get(i).get(5)); + excelList.get(i).setJuly(list3.get(i).get(6)); + excelList.get(i).setAugust(list3.get(i).get(7)); + excelList.get(i).setSeptember(list3.get(i).get(8)); + excelList.get(i).setOctober(list3.get(i).get(9)); + excelList.get(i).setNovember(list3.get(i).get(10)); + excelList.get(i).setDecember(list3.get(i).get(11)); + } + return excelList; + } + + @NotNull + private List getAllProjectMoneyStatistics(AllProjectStatisticsSearch allProjectStatisticsSearch, List list) { + List collect=list.stream() + .map(allProjectStatistics -> Integer.valueOf(allProjectStatistics.getPaymentDate().split("-")[1])) + .collect(Collectors.toList()); + + String paymentYear=allProjectStatisticsSearch.getPaymentYear(); + for (int i=1; i <= 12; i++) { + if (!collect.contains(i)) { + StringBuilder stringBuilder=new StringBuilder().append(paymentYear); + AllProjectStatistics allProjectStatistics=new AllProjectStatistics("0.00", "0.00", "0.00", stringBuilder.append("-" + i).toString()); + list.add(allProjectStatistics); + } + } + list.sort(Comparator.comparing(allProjectStatistics -> Integer.valueOf(allProjectStatistics.getPaymentDate().split("-")[1]))); + return list; + } + + } 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 new file mode 100644 index 00000000..db5ba355 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java @@ -0,0 +1,96 @@ +package com.jero.statistics.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +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.system.api.ISysBaseAPI; +import com.jero.common.util.oConvertUtils; +import com.jero.modules.system.mapper.SysUserMapper; +import com.jero.modules.system.service.ISysDepartService; +import com.jero.modules.system.service.ISysUserService; +import com.jero.project.service.IPayWorkingGroupService; +import com.jero.statistics.entity.AllMoney; +import com.jero.statistics.entity.AllProjectMoneyExcel; +import com.jero.statistics.entity.AllProjectStatistics; +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.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import java.text.DecimalFormat; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +/** + * @Description: TODO + * @author: Kuang Kaixing + * @date: 2022/07/28 16:13 + */ +@Api(tags = "全所收入统计") +@RestController +@RequestMapping("/statistics/allProjectMoneyStatistics") +@Slf4j +public class AllProjectMoneyStatisticsController { + @Resource + private SysUserMapper userMapper; + @Autowired + private ISysDepartService sysDepartService; + @Autowired + private ISysBaseAPI sysBaseAPI; + @Autowired + private ISysUserService sysUserService; + @Autowired + private IPayWorkingGroupService payWorkingGroupService; + + /** + * 分页列表查询 + * + * @param allProjectStatisticsSearch 全所收入统计搜索 + */ + @RequiresPermissions("wholeInstituteStatistics:search") + @ApiOperation(value = "全所收入统计搜索-列表查询", notes = "全所收入统计搜索-详情列表查询") + @GetMapping(value = "/list") + public Result list(AllProjectStatisticsSearch allProjectStatisticsSearch) { + + List list = payWorkingGroupService.queryListAllProjectMoney(allProjectStatisticsSearch, null); + + HashMap hashMap = new HashMap<>(); + AllMoney allMoney = payWorkingGroupService.queryPageList33(allProjectStatisticsSearch, null); + hashMap.put("sumOfMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.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("list", list); + + return Result.OK(hashMap); + + } + + + /** + * 所领导统计导出 + */ + @RequiresPermissions("wholeInstituteStatistics:export") + @AutoLog(value = "全所收入统计导出-导出统计") + @GetMapping(value = "/excel") + @ApiOperation(value = "全所收入统计导出-导出统计", notes = "全所收入统计导出-导出统计") + public ModelAndView excel(AllProjectStatisticsSearch allProjectStatisticsSearch, + @RequestParam(name = "selections", required = false) String selections) { + List list = payWorkingGroupService.queryListAllProjectMoneyExcel(allProjectStatisticsSearch, null); + return AmountUtil.exportListXls(list, AllProjectMoneyExcel.class, "收入统计"); + } +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllMoney.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllMoney.java index 778283ec..695fb73a 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllMoney.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllMoney.java @@ -7,11 +7,15 @@ import org.jeecgframework.poi.excel.annotation.Excel; @Data public class AllMoney { + private String allMoney; + @ApiModelProperty("到账金额未税") private String comeAllMoney; + @ApiModelProperty("开票金额未税") private String billMoney; + @ApiModelProperty("确认金额未税") private String confirmAmount; } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectMoneyExcel.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectMoneyExcel.java new file mode 100644 index 00000000..0b4e9500 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectMoneyExcel.java @@ -0,0 +1,65 @@ +package com.jero.statistics.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jeecgframework.poi.excel.annotation.Excel; + +/** + * @Description: 全所收入Excel + * @author: Kuang Kaixing + * @date: 2022/07/29 14:21 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class AllProjectMoneyExcel { + + @Excel(name = "合同",width=15,height=15) + private String category; + + @Excel(name="1月",width=15,height=15) + private String january; + + @Excel(name="2月",width=15,height=15) + private String february; + + @Excel(name="3月",width=15,height=15) + private String march; + + @Excel(name="4月",width=15,height=15) + private String april; + + @Excel(name="5月",width=15,height=15) + private String may; + + @Excel(name="6月",width=15,height=15) + private String june; + + @Excel(name="7月",width=15,height=15) + private String july; + + @Excel(name="8月",width=15,height=15) + private String august; + + @Excel(name="9月",width=15,height=15) + private String september; + + @Excel(name="10月",width=15,height=15) + private String october; + + @Excel(name="11月",width=15,height=15) + private String november; + + @Excel(name="12月",width=15,height=15) + private String december ; + + @Excel(name="总计",width=15,height=15) + private String total; + + public AllProjectMoneyExcel(String category, String total) { + this.category=category; + this.total=total; + } + +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatistics.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatistics.java index 03149b6f..703e3bf8 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatistics.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatistics.java @@ -2,14 +2,20 @@ package com.jero.statistics.entity; import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import org.jeecgframework.poi.excel.annotation.Excel; +import java.util.Date; + /** * @author zql * @date 2021/9/17 18:04 */ @Data +@AllArgsConstructor +@NoArgsConstructor public class AllProjectStatistics { @ApiModelProperty(value = "项目id") private String projectId; @@ -61,4 +67,15 @@ public class AllProjectStatistics { @Excel(name = "项目负责人", width = 15) @ApiModelProperty(value = "项目负责人") private String principalName; + + @Excel(name = "到账时间", width = 15) + @ApiModelProperty(value = "到账时间") + private String paymentDate; + + public AllProjectStatistics(String confirmAmount, String billMoney, String comeAllMoney, String paymentDate) { + this.confirmAmount=confirmAmount; + this.billMoney=billMoney; + this.comeAllMoney=comeAllMoney; + this.paymentDate=paymentDate; + } } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatisticsSearch.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatisticsSearch.java index 1bb0852c..1d1cb9db 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatisticsSearch.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/AllProjectStatisticsSearch.java @@ -50,6 +50,9 @@ public class AllProjectStatisticsSearch { @ApiModelProperty(value = "确认年份") private String paymentYear; + @ApiModelProperty(value = "确认月份") + private String paymentMonth; + @ApiModelProperty(value = "字段") private String column; diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyDetailSearch.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyDetailSearch.java index 436561aa..6d6e83be 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyDetailSearch.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyDetailSearch.java @@ -44,6 +44,9 @@ public class CompanyComeMoneyDetailSearch { @ApiModelProperty(value = "确认年份") private String paymentYear; + @ApiModelProperty(value = "确认月份") + private String paymentMonth; + @ApiModelProperty(value = "字段") private String column; diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyList.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyList.java index 0595d3ed..2598e8b0 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyList.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneyList.java @@ -26,6 +26,10 @@ public class CompanyComeMoneyList { @ApiModelProperty(value = "确认收入金额") private String confirmAmount; + @Excel(name = "确收率", width = 15) + @ApiModelProperty(value = "确收率") + private String finishRate; + @Excel(name = "开票金额", width = 15) @ApiModelProperty(value = "开票金额") private String billMoney; @@ -34,7 +38,5 @@ public class CompanyComeMoneyList { @ApiModelProperty(value = "到账总金额") private String comeAllMoney; - @Excel(name = "确收率", width = 15) - @ApiModelProperty(value = "确收率") - private String finishRate; + } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneySearch.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneySearch.java index 6e9c5797..1341be74 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneySearch.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/CompanyComeMoneySearch.java @@ -35,6 +35,9 @@ public class CompanyComeMoneySearch { @ApiModelProperty(value = "确认年份") private String paymentYear; + @ApiModelProperty(value = "确认月份") + private String paymentMonth; + @ApiModelProperty(value = "字段") private String column; diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatistics.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatistics.java index d543bff1..fbdcee57 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatistics.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatistics.java @@ -22,6 +22,10 @@ public class DepartStatistics { @ApiModelProperty(value = "确认收入金额") private String confirmAmount; + @Excel(name = "确收率", width = 15) + @ApiModelProperty(value = "确收率") + private String finishRate; + @Excel(name = "开票金额", width = 15) @ApiModelProperty(value = "开票金额") private String billMoney; @@ -30,9 +34,7 @@ public class DepartStatistics { @ApiModelProperty(value = "到账总金额") private String comeAllMoney; - @Excel(name = "确收率", width = 15) - @ApiModelProperty(value = "确收率") - private String finishRate; + } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatisticsSearch.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatisticsSearch.java index 30197c09..9d2f71ff 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatisticsSearch.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/DepartStatisticsSearch.java @@ -16,6 +16,9 @@ public class DepartStatisticsSearch { @ApiModelProperty(value = "确认年份") private String paymentYear; + @ApiModelProperty(value = "确认月份") + private String paymentMonth; + @ApiModelProperty(value = "字段") private String column; diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleDetailSearch.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleDetailSearch.java index 13c67a6d..9b310b31 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleDetailSearch.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleDetailSearch.java @@ -44,6 +44,9 @@ public class PrincipalPeopleDetailSearch { @ApiModelProperty(value = "确认年份") private String paymentYear; + @ApiModelProperty(value = "确认月份") + private String paymentMonth; + @ApiModelProperty(value = "字段") private String column; diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleSearch.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleSearch.java index 4a5dd9ef..83b6ef61 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleSearch.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/entity/PrincipalPeopleSearch.java @@ -32,6 +32,9 @@ public class PrincipalPeopleSearch { @ApiModelProperty(value = "确认年份") private String paymentYear; + @ApiModelProperty(value = "确认月份") + private String paymentMonth; + @ApiModelProperty(value = "字段") private String column;