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());