From e56cf1e5fec07bd44508b7f01141b7b88de2bad9 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Wed, 3 Jul 2019 16:51:39 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B4=A6=E5=8D=95][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=95=B0=E6=8D=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxBillAllServiceImpl.java | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 60c3c0907..589dab892 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -1023,15 +1023,17 @@ public class WxBillAllServiceImpl implements WxBillAllService { dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); WxBillDaily daily = wxBillDailyMapper.selectOne(dailyQuery); long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); - if (daily != null && !daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { - if (daily.getOwe() <= pay) { - daily.setStatus(EnumBillRentStatus.PAID.getCode()); + if (daily != null) { + if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { + if (daily.getOwe() <= pay) { + daily.setStatus(EnumBillRentStatus.PAID.getCode()); + } + daily.setPay(daily.getPay() + pay); + daily.setOwe(daily.getOwe() - pay); + daily.setPayDate(bill.getPayDate()); + daily.setReceiveDate(bill.getReceiveDate()); + wxBillDailyMapper.updateByPrimaryKey(daily); } - daily.setPay(daily.getPay() + pay); - daily.setOwe(daily.getOwe() - pay); - daily.setPayDate(bill.getPayDate()); - daily.setReceiveDate(bill.getReceiveDate()); - wxBillDailyMapper.updateByPrimaryKey(daily); } else { WxMerchantShop wxMerchantShop = new WxMerchantShop(); wxMerchantShop.setTenantId(tenantId); @@ -1070,17 +1072,19 @@ public class WxBillAllServiceImpl implements WxBillAllService { otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); WxBillOther other = wxBillOtherMapper.selectOne(otherQuery); long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); - if (other != null && !other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { - if (other.getOwe() <= pay) { - other.setStatus(EnumBillRentStatus.PAID.getCode()); + if (other != null) { + if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { + if (other.getOwe() <= pay) { + other.setStatus(EnumBillRentStatus.PAID.getCode()); + } + other.setName(bill.getBillAttr()); + other.setComments(bill.getBillAttr()); + other.setPay(other.getPay() + pay); + other.setOwe(other.getOwe() - pay); + other.setPayDate(bill.getPayDate()); + other.setReceiveDate(bill.getReceiveDate()); + wxBillOtherMapper.updateByPrimaryKey(other); } - other.setName(bill.getBillAttr()); - other.setComments(bill.getBillAttr()); - other.setPay(other.getPay() + pay); - other.setOwe(other.getOwe() - pay); - other.setPayDate(bill.getPayDate()); - other.setReceiveDate(bill.getReceiveDate()); - wxBillOtherMapper.updateByPrimaryKey(other); } else { WxMerchantShop wxMerchantShop = new WxMerchantShop(); wxMerchantShop.setTenantId(tenantId); @@ -1120,15 +1124,17 @@ public class WxBillAllServiceImpl implements WxBillAllService { otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); WxBillOtherDeposit otherDeposit = wxBillOtherDepositMapper.selectOne(otherDepositQuery); long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); - if (otherDeposit != null && !otherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { - if (otherDeposit.getOwe() <= pay) { - otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); + if (otherDeposit != null) { + if (!otherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { + if (otherDeposit.getOwe() <= pay) { + otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); + } + otherDeposit.setPay(otherDeposit.getPay() + pay); + otherDeposit.setOwe(otherDeposit.getOwe() - pay); + otherDeposit.setPayDate(bill.getPayDate()); + otherDeposit.setReceiveDate(bill.getReceiveDate()); + wxBillOtherDepositMapper.updateByPrimaryKey(otherDeposit); } - otherDeposit.setPay(otherDeposit.getPay() + pay); - otherDeposit.setOwe(otherDeposit.getOwe() - pay); - otherDeposit.setPayDate(bill.getPayDate()); - otherDeposit.setReceiveDate(bill.getReceiveDate()); - wxBillOtherDepositMapper.updateByPrimaryKey(otherDeposit); } else { WxMerchantShop wxMerchantShop = new WxMerchantShop(); wxMerchantShop.setTenantId(tenantId);