From fadbed30be320a9b15cc6d7caf8b6a599fd9d3a1 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 11 Apr 2019 16:27:09 +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][=E5=88=A4=E6=96=AD=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=B7=B2=E5=87=BA=E7=A7=9F=E9=97=AE=E9=A2=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxRentContractServiceImpl.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 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 fe09dc689..5730bd667 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -229,12 +229,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); WxRentContract wxRentContract = new WxRentContract(); wxRentContract.setTenantId(record.getTenantId()); - wxRentContract.setShopId(rentInfoObject.getLong("shopId")); + Long shopId = rentInfoObject.getLong("shopId"); + wxRentContract.setShopId(shopId); int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract); 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() + " 已出租"); + } } } else { WxRentContract wxRentContract = new WxRentContract(); @@ -298,7 +303,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { // 更新 ResultData resultData = getResultDataForUpdate(record, userId); - + if (resultData.code != Result.SUCCESS) { + return resultData; + } if (dbRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) { @@ -442,11 +449,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); if (count > 0) { String shopNumber = rentInfoObject.getString("shopNumber"); - return new ResultData(ErrorCode.SHOP_IS_RENT, "店铺 " + 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, "店铺 " + wxShop.getShopNumber() + " 已出租"); + return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + wxShop.getShopNumber() + " 已出租"); } } @@ -1175,6 +1182,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { } } ResultData resultData = getResultDataForUpdate(record, userId); + if (resultData.code != Result.SUCCESS) { + return resultData; + } // 启动审批流 if(record.getFlowParams() != null){ record.getFlowParams().put("businessId",record.getId().toString());