| @@ -91,6 +91,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Autowired | |||
| private WxFlowService wxFlowService; | |||
| @Autowired | |||
| WxMerchantShopMapper wxMerchantShopMapper; | |||
| @Override | |||
| public Map<String, Object> 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<WxMerchantShop> 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<WxBillRent> 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<WxMerchantShop> 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(); | |||