diff --git a/db/统计视图.sql b/db/统计视图.sql index 3f567a51..02d26bae 100644 --- a/db/统计视图.sql +++ b/db/统计视图.sql @@ -318,7 +318,7 @@ set confirm_no_tax_amount = confirm_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 1 = 1; +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, @@ -326,7 +326,7 @@ set confirm_no_tax_amount = confirm_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 1 = 1; +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, @@ -334,7 +334,7 @@ set confirm_no_tax_amount = confirm_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 1 = 1; +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, @@ -342,7 +342,7 @@ set confirm_no_tax_amount = confirm_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 1 = 1; +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, @@ -350,7 +350,7 @@ set confirm_no_tax_amount = confirm_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 1 = 1; +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, @@ -358,7 +358,37 @@ set confirm_no_tax_amount = confirm_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 1 = 1; +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/payment/mapper/PayConfirmPaymentRecordMapper.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/PayConfirmPaymentRecordMapper.java index 69ac80b1..84484481 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/PayConfirmPaymentRecordMapper.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/PayConfirmPaymentRecordMapper.java @@ -1,4 +1,5 @@ package com.jero.payment.mapper; +import java.math.BigDecimal; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.jero.member.entity.TbCertificatePayment; @@ -15,6 +16,6 @@ public interface PayConfirmPaymentRecordMapper extends BaseMapper selectByProjectId(@Param("projectId")String projectId); PayConfirmPaymentRecord selectOneByProjectIdAndProjectType(@Param("projectId")String projectId,@Param("projectType")String projectType); - + int updateZeroTaxByProjectId(@Param("projectId")String projectId); } \ No newline at end of file diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/PayPaymentRecordMapper.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/PayPaymentRecordMapper.java index 5cac4227..27263d87 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/PayPaymentRecordMapper.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/PayPaymentRecordMapper.java @@ -1,11 +1,11 @@ package com.jero.payment.mapper; +import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.payment.entity.PayPaymentRecord; import com.jero.project.entity.PayCommonProject; import com.jero.project.vo.PayCommonProjectOutput; -import io.lettuce.core.dynamic.annotation.Param; import java.math.BigDecimal; import java.util.List; @@ -61,4 +61,8 @@ public interface PayPaymentRecordMapper extends BaseMapper { * @Exception */ Integer getMonthProjectCount(String time); + + int updateZeroTaxByProjectId(@Param("projectId")String projectId); + + } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayConfirmPaymentRecordMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayConfirmPaymentRecordMapper.xml index 196f1bba..6e262c4f 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayConfirmPaymentRecordMapper.xml +++ b/jero-boot-incoming-payment/src/main/java/com/jero/payment/mapper/xml/PayConfirmPaymentRecordMapper.xml @@ -40,4 +40,12 @@ and project_type = #{projectType} 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 402c094b..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,6 +3,48 @@ + + 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 count(*) from (select * from pay_payment_record WHERE DATE_FORMAT(payment_date,'%Y-%m') = #{time} group by project_id) aa + + + + 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/impl/PayConfirmPaymentRecordService.java b/jero-boot-incoming-payment/src/main/java/com/jero/payment/service/impl/PayConfirmPaymentRecordService.java index 4436c4f2..0ae7e4a5 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,43 +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.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.jero.common.enums.PaymentStatusEnum; -import com.jero.company.entity.PayContactsManagement; 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.mapper.PayPaymentRecordMapper; import com.jero.payment.service.IPayPaymentRecordService; -import com.jero.payment.vo.TbCheckVo; -import com.jero.project.common.PayProjectCommon; 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 @@ -59,6 +45,8 @@ public class PayConfirmPaymentRecordService extends ServiceImpl()).forEach(p->{ + payCommonProjectMapper.selectList(new QueryWrapper<>()).forEach(p -> { BigDecimal confirmAmount = p.getConfirmAmount(); Integer affirmIncome = payPaymentRecordService.getInAccount(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 ->{ + payWorkingGroupSubItemMapper.selectList(new QueryWrapper<>()).forEach(p -> { BigDecimal confirmAmount = p.getConfirmAmount(); Integer affirmIncome = payPaymentRecordService.getInAccount(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 ->{ + payMeetingSituationMapper.selectList(new QueryWrapper<>()).forEach(p -> { BigDecimal confirmAmount = p.getConfirmAmount(); Integer affirmIncome = payPaymentRecordService.getInAccount(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 ->{ + payMemberProjectSubitemMapper.selectList(new QueryWrapper<>()).forEach(p -> { BigDecimal confirmAmount = p.getConfirmAmount(); Integer affirmIncome = payPaymentRecordService.getInAccount(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 ->{ + tbMemberProjectSubitemMapper.selectList(new QueryWrapper<>()).forEach(p -> { BigDecimal confirmAmount = p.getConfirmAmount(); Integer affirmIncome = payPaymentRecordService.getInAccount(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 ->{ + certificatePaymentMapper.selectList(new QueryWrapper<>()).forEach(p -> { BigDecimal confirmAmount = p.getConfirmAmount(); Integer affirmIncome = payPaymentRecordService.getInAccount(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()); + } }); } }