| @@ -636,22 +636,22 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Override | @Override | ||||
| public ResultData hasRentStatus(WxRentContract record) { | public ResultData hasRentStatus(WxRentContract record) { | ||||
| String rentInfo = record.getRentInfo(); | String rentInfo = record.getRentInfo(); | ||||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||||
| int size = rentInfoArray.size(); | |||||
| if (size == 0) { | |||||
| if (StringUtils.isEmpty(rentInfo)) { | |||||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | ||||
| } | } | ||||
| String[] split = rentInfo.split(","); | |||||
| int size = split.length; | |||||
| //查询rent_info 包括 shopId | //查询rent_info 包括 shopId | ||||
| for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||||
| String shopId = split[i]; | |||||
| WxShop wxShop = wxShopMapper.selectByPrimaryKey(shopId); | |||||
| WxRentContract wxRentContractQuery = new WxRentContract(); | WxRentContract wxRentContractQuery = new WxRentContract(); | ||||
| wxRentContractQuery.setTenantId(record.getTenantId()); | wxRentContractQuery.setTenantId(record.getTenantId()); | ||||
| Long shopId = rentInfoObject.getLong("shopId"); | |||||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||||
| String shopNumber = wxShop.getShopNumber(); | |||||
| if (shopId == null) { | if (shopId == null) { | ||||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); | return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); | ||||
| } | } | ||||
| wxRentContractQuery.setShopId(shopId); | |||||
| wxRentContractQuery.setShopId(Long.valueOf(shopId)); | |||||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); | int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); | ||||
| if (count > 0) { | if (count > 0) { | ||||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | ||||