|
|
|
@@ -205,19 +205,28 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
Date date = new Date(); |
|
|
|
record.setCreatetime(date); |
|
|
|
record.setUpdatetime(date); |
|
|
|
try { |
|
|
|
|
|
|
|
String rentInfo = record.getRentInfo(); |
|
|
|
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); |
|
|
|
int size = rentInfoArray.size(); |
|
|
|
if (size == 0) { |
|
|
|
return new ResultData(ErrorCode.SHOP_NOT_SELECTED); |
|
|
|
} |
|
|
|
|
|
|
|
//查询rent_info 包括 shopId |
|
|
|
for (int i = 0; i < size; i++) { |
|
|
|
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); |
|
|
|
WxRentContract wxRentContract = new WxRentContract(); |
|
|
|
wxRentContract.setTenantId(record.getTenantId()); |
|
|
|
wxRentContract.setShopId(record.getShopId()); |
|
|
|
long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). |
|
|
|
filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) |
|
|
|
&& !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) |
|
|
|
&& !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) |
|
|
|
&& !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) |
|
|
|
&& !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).count(); |
|
|
|
wxRentContract.setShopId(rentInfoObject.getLong("shopId")); |
|
|
|
int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract); |
|
|
|
if (count > 0) { |
|
|
|
return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); |
|
|
|
String shopNumber = rentInfoObject.getString("shopNumber"); |
|
|
|
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); |
|
|
|
wxRentContractMapper.insertSelective(record); |
|
|
|
} catch (Exception e) { |
|
|
|
|