From a2277c0d8f0cc051c4b62285c88ee04c7f39fdc1 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 11 Apr 2019 17:56:25 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=A7=9F=E8=B5=81=E5=90=88=E5=90=8C][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E8=A1=A5=E5=BD=95=E6=97=B6=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=BA=97=E9=93=BA=E5=B7=B2=E5=87=BA=E7=A7=9F=E9=97=AE?= =?UTF-8?q?=E9=A2=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxRentContractServiceImpl.java | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 5730bd667..aeb9b1777 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -91,6 +91,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired private WxFlowService wxFlowService; + @Autowired + WxMerchantShopMapper wxMerchantShopMapper; + @Override public Map listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { Object rentContractStatusInfo = getRentContractStatusInfo(record); @@ -232,13 +235,25 @@ public class WxRentContractServiceImpl implements WxRentContractService { Long shopId = rentInfoObject.getLong("shopId"); wxRentContract.setShopId(shopId); int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract); + String shopNumber = rentInfoObject.getString("shopNumber"); if (count > 0) { - String shopNumber = rentInfoObject.getString("shopNumber"); return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); } - WxShop wxShop = wxShopMapper.selectByPrimaryKey(shopId); - if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { - return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + wxShop.getShopNumber() + " 已出租"); + if (record.getMerchantId() != null) { + WxMerchantShop wxMerchantShop = new WxMerchantShop(); + wxMerchantShop.setShopId(shopId); + wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); + List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); + long total = wxMerchantShopList.parallelStream(). + filter(ms -> !ms.getMerchantId().equals(record.getMerchantId())).count(); + if (total > 0) { + return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); + } + } else { + WxShop wxShop = wxShopMapper.selectByPrimaryKey(shopId); + if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { + return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + wxShop.getShopNumber() + " 已出租"); + } } } } else { @@ -279,7 +294,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { } //生成预览账单(补录第二步,第三步走编辑) - if(record.getReceivePeriod() != null && record.getLease()!=null && record.getPrice()!= null){ + if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null + && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) { wxBillRentMapper.deletePreviewBill(record); //重新生成 List resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); @@ -447,15 +463,26 @@ public class WxRentContractServiceImpl implements WxRentContractService { Long shopId = rentInfoObject.getLong("shopId"); wxRentContractQuery.setShopId(shopId); int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); + String shopNumber = rentInfoObject.getString("shopNumber"); if (count > 0) { - String shopNumber = rentInfoObject.getString("shopNumber"); return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); } - WxShop wxShop = wxShopMapper.selectByPrimaryKey(shopId); - if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { - return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + wxShop.getShopNumber() + " 已出租"); + if (record.getMerchantId() != null) { + WxMerchantShop wxMerchantShop = new WxMerchantShop(); + wxMerchantShop.setShopId(shopId); + wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); + List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); + long total = wxMerchantShopList.parallelStream(). + filter(ms -> !ms.getMerchantId().equals(record.getMerchantId())).count(); + if (total > 0) { + return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); + } + } else { + WxShop wxShop = wxShopMapper.selectByPrimaryKey(shopId); + if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { + return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + wxShop.getShopNumber() + " 已出租"); + } } - } } else { WxRentContract wxRentContractQuery = new WxRentContract();