add 新增判断确认收入状态接口,编辑sql 确认收入状态添加默认值

This commit is contained in:
lijiarao
2022-08-05 14:09:52 +08:00
parent 65744d0fa0
commit bd63856f3d
2 changed files with 59 additions and 18 deletions
+6 -6
View File
@@ -248,7 +248,7 @@ alter table pay_confirm_payment_record
add column no_tax_amount decimal(12, 2) default 0 comment '未税金额';
-- 项目增加确认收入状态,税额,未税金额
alter table pay_common_project
add column affirm_income tinyint(1) null comment '确认收入',
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 '到账金额未税',
@@ -256,7 +256,7 @@ alter table pay_common_project
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) null comment '确认收入',
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 '到账金额未税',
@@ -264,7 +264,7 @@ alter table pay_working_group_subitem
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) null comment '确认收入',
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 '到账金额未税',
@@ -272,7 +272,7 @@ alter table pay_member_project_subitem
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) null comment '确认收入',
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 '到账金额未税',
@@ -280,7 +280,7 @@ alter table pay_meeting_situation
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) null comment '确认收入',
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 '到账金额未税',
@@ -288,7 +288,7 @@ alter table tb_member_project_subitem
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) null comment '确认收入',
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 '到账金额未税',
@@ -87,7 +87,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
payCommonProject.setConfirmAmount(confirmAmount);
payCommonProject.setConfirmTax(tax);
payCommonProject.setConfirmNoTaxAmount(noTaxAmount);
affirmIncome = payPaymentRecordService.getInAccount(payCommonProject.getReceivableAmount(), confirmAmount);
affirmIncome = getAffirmIncome(payCommonProject.getReceivableAmount(), confirmAmount);
payCommonProject.setAffirmIncome(affirmIncome);
payCommonProjectMapper.updateById(payCommonProject);
@@ -102,7 +102,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
payWorking.setConfirmAmount(confirmAmount);
payWorking.setConfirmTax(tax);
payWorking.setConfirmNoTaxAmount(noTaxAmount);
affirmIncome = payPaymentRecordService.getInAccount(payWorking.getReceivableAmount(), confirmAmount);
affirmIncome = getAffirmIncome(payWorking.getReceivableAmount(), confirmAmount);
payWorking.setAffirmIncome(affirmIncome);
payWorkingGroupSubItemMapper.updateById(payWorking);
@@ -118,7 +118,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
meeting.setConfirmAmount(confirmAmount);
meeting.setConfirmTax(tax);
meeting.setConfirmNoTaxAmount(noTaxAmount);
affirmIncome = payPaymentRecordService.getInAccount(meeting.getAmountReceivable(), confirmAmount);
affirmIncome = getAffirmIncome(meeting.getAmountReceivable(), confirmAmount);
meeting.setAffirmIncome(affirmIncome);
payMeetingSituationMapper.updateById(meeting);
@@ -134,7 +134,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
member.setConfirmAmount(confirmAmount);
member.setConfirmTax(tax);
member.setConfirmNoTaxAmount(noTaxAmount);
affirmIncome = payPaymentRecordService.getInAccount(member.getAmountReceivable(), confirmAmount);
affirmIncome = getAffirmIncome(member.getAmountReceivable(), confirmAmount);
member.setAffirmIncome(affirmIncome);
payMemberProjectSubitemMapper.updateById(member);
@@ -150,7 +150,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
tbMember.setConfirmAmount(confirmAmount);
tbMember.setConfirmTax(tax);
tbMember.setConfirmNoTaxAmount(noTaxAmount);
affirmIncome = payPaymentRecordService.getInAccount(tbMember.getAmountReceivable(), confirmAmount);
affirmIncome = getAffirmIncome(tbMember.getAmountReceivable(), confirmAmount);
tbMember.setAffirmIncome(affirmIncome);
tbMemberProjectSubitemMapper.updateById(tbMember);
break;
@@ -165,7 +165,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
tbMemberCertificate.setConfirmAmount(confirmAmount);
tbMemberCertificate.setConfirmTax(tax);
tbMemberCertificate.setConfirmNoTaxAmount(noTaxAmount);
affirmIncome = payPaymentRecordService.getInAccount(tbMemberCertificate.getAmountReceivable(), confirmAmount);
affirmIncome = getAffirmIncome(tbMemberCertificate.getAmountReceivable(), confirmAmount);
tbMemberCertificate.setAffirmIncome(affirmIncome);
certificatePaymentMapper.updateById(tbMemberCertificate);
@@ -198,7 +198,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
public void updateAffirmIncome() {
payCommonProjectMapper.selectList(new QueryWrapper<>()).forEach(p -> {
BigDecimal confirmAmount = p.getConfirmAmount();
Integer affirmIncome = payPaymentRecordService.getInAccount(p.getReceivableAmount(), confirmAmount);
Integer affirmIncome = getAffirmIncome(p.getReceivableAmount(), confirmAmount);
PayCommonProject project = new PayCommonProject();
project.setId(p.getId());
project.setAffirmIncome(affirmIncome);
@@ -211,7 +211,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
payWorkingGroupSubItemMapper.selectList(new QueryWrapper<>()).forEach(p -> {
BigDecimal confirmAmount = p.getConfirmAmount();
Integer affirmIncome = payPaymentRecordService.getInAccount(p.getReceivableAmount(), confirmAmount);
Integer affirmIncome = getAffirmIncome(p.getReceivableAmount(), confirmAmount);
PayWorkingGroupSubItem project = new PayWorkingGroupSubItem();
project.setId(p.getId());
project.setAffirmIncome(affirmIncome);
@@ -224,7 +224,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
payMeetingSituationMapper.selectList(new QueryWrapper<>()).forEach(p -> {
BigDecimal confirmAmount = p.getConfirmAmount();
Integer affirmIncome = payPaymentRecordService.getInAccount(p.getAmountReceivable(), confirmAmount);
Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount);
PayMeetingSituation project = new PayMeetingSituation();
project.setId(p.getId());
project.setAffirmIncome(affirmIncome);
@@ -237,7 +237,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
payMemberProjectSubitemMapper.selectList(new QueryWrapper<>()).forEach(p -> {
BigDecimal confirmAmount = p.getConfirmAmount();
Integer affirmIncome = payPaymentRecordService.getInAccount(p.getAmountReceivable(), confirmAmount);
Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount);
PayMemberProjectSubitem project = new PayMemberProjectSubitem();
project.setId(p.getId());
project.setAffirmIncome(affirmIncome);
@@ -250,7 +250,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
tbMemberProjectSubitemMapper.selectList(new QueryWrapper<>()).forEach(p -> {
BigDecimal confirmAmount = p.getConfirmAmount();
Integer affirmIncome = payPaymentRecordService.getInAccount(p.getAmountReceivable(), confirmAmount);
Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount);
TbMemberProjectSubitem project = new TbMemberProjectSubitem();
project.setId(p.getId());
project.setAffirmIncome(affirmIncome);
@@ -263,7 +263,7 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
certificatePaymentMapper.selectList(new QueryWrapper<>()).forEach(p -> {
BigDecimal confirmAmount = p.getConfirmAmount();
Integer affirmIncome = payPaymentRecordService.getInAccount(p.getAmountReceivable(), confirmAmount);
Integer affirmIncome = getAffirmIncome(p.getAmountReceivable(), confirmAmount);
TbCertificatePayment project = new TbCertificatePayment();
project.setId(p.getId());
project.setAffirmIncome(affirmIncome);
@@ -274,6 +274,47 @@ public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymen
}
});
}
/**
* 得到确认收入状态
* @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;
}
}
}