|
|
@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletRequest; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Collection; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
@@ -249,60 +250,65 @@ public class WxRentContractController extends WxContractBaseController { |
|
|
|
|
|
|
|
|
@GetMapping("/merchantShops") |
|
|
@GetMapping("/merchantShops") |
|
|
@ApiImplicitParams({ |
|
|
@ApiImplicitParams({ |
|
|
@ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true)}) |
|
|
|
|
|
|
|
|
@ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true), |
|
|
|
|
|
@ApiImplicitParam(name = "contractId", value = "contractId", dataType = "Long", paramType = "query", required = true)}) |
|
|
@SystemControllerLog(description = "租赁合同-终结合同") |
|
|
@SystemControllerLog(description = "租赁合同-终结合同") |
|
|
public ResultData merchantShops(Long merchantId) { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] WxRentContractController::endRentContract"); |
|
|
|
|
|
return new ResultData(wxMerchantService.getMerchantShopList(merchantId)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/merchantShopsRenewable") |
|
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
|
@ApiImplicitParam(name = "contractId", value = "contractId", dataType = "Long", paramType = "query", required = true), |
|
|
|
|
|
@ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true)}) |
|
|
|
|
|
@SystemControllerLog(description = "租赁合同-终结合同") |
|
|
|
|
|
public ResultData merchantShopsRenewable(Long merchantId,Long contractId) { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] WxRentContractController::endRentContract"); |
|
|
|
|
|
List<WxShop> allist = new ArrayList<WxShop>(); |
|
|
|
|
|
|
|
|
|
|
|
List<WxShop> shopList = wxMerchantService.getMerchantShopList(merchantId); |
|
|
|
|
|
|
|
|
public ResultData merchantShops(Long merchantId,Long contractId) { |
|
|
|
|
|
|
|
|
|
|
|
List<Long> shopList = wxMerchantService.getMerchantShopIds(merchantId); |
|
|
if (null == shopList) { |
|
|
if (null == shopList) { |
|
|
return new ResultData(Result.ERROR,"商户未绑定店铺!"); |
|
|
return new ResultData(Result.ERROR,"商户未绑定店铺!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
WxRentContract rentContract = wxRentContractService.getSimpleDeatil(contractId); |
|
|
|
|
|
if (null == rentContract) { |
|
|
|
|
|
return new ResultData(Result.ERROR,"租金合同不存在!"); |
|
|
|
|
|
|
|
|
WxRentContract rentq = new WxRentContract(); |
|
|
|
|
|
List<Integer> status = new ArrayList<Integer>(); |
|
|
|
|
|
status.add(EnumRentContractStatus.PAING.getCode()); |
|
|
|
|
|
status.add(EnumRentContractStatus.READY_FOR_PAING.getCode()); |
|
|
|
|
|
rentq.setStatuss(status); |
|
|
|
|
|
rentq.updateTenantInfo(getUser()); |
|
|
|
|
|
List<WxRentContract> rentContractList = wxRentContractService.findList(rentq); |
|
|
|
|
|
List<Long> rentShopList = new ArrayList<Long>(); |
|
|
|
|
|
if (null != rentContractList) { |
|
|
|
|
|
for (WxRentContract rent : rentContractList) { |
|
|
|
|
|
List<Long> shopidlist = rent.shopIdsByRentInfo(); |
|
|
|
|
|
if (null != shopidlist) { |
|
|
|
|
|
for (Long sid: shopidlist) { |
|
|
|
|
|
if (!rentShopList.contains(sid)) { |
|
|
|
|
|
rentShopList.add(sid); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//如果是新建,或者修改,此时能查询出来未在有效合同里面的店铺 |
|
|
|
|
|
|
|
|
if (rentContract.getStatus().intValue() != EnumRentContractStatus.PAING.getCode() |
|
|
|
|
|
&& rentContract.getStatus().intValue() != EnumRentContractStatus.OUT_DATE.getCode()) { |
|
|
|
|
|
return new ResultData(Result.ERROR,"租金合同状态为计租中或者正常到期才能续签。"); |
|
|
|
|
|
|
|
|
//如果是续签,则还能查询出来合同本身的店铺 |
|
|
|
|
|
List<Long> currentContractShopIds = null; |
|
|
|
|
|
if (null != contractId) { |
|
|
|
|
|
WxRentContract rentContract = wxRentContractService.getSimpleDeatil(contractId); |
|
|
|
|
|
if (null == rentContract) { |
|
|
|
|
|
return new ResultData(Result.ERROR,"租金合同不存在!"); |
|
|
|
|
|
} |
|
|
|
|
|
if (rentContract.getStatus().intValue() != EnumRentContractStatus.PAING.getCode() |
|
|
|
|
|
&& rentContract.getStatus().intValue() != EnumRentContractStatus.OUT_DATE.getCode()) { |
|
|
|
|
|
return new ResultData(Result.ERROR,"租金合同状态为计租中或者正常到期才能续签。"); |
|
|
|
|
|
} |
|
|
|
|
|
currentContractShopIds = rentContract.shopIdsByRentInfo(); |
|
|
|
|
|
if (null != currentContractShopIds) { |
|
|
|
|
|
currentContractShopIds.stream().filter(si -> shopList.contains(si)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<Long> shopIds = rentContract.shopIdsByRentInfo(); |
|
|
|
|
|
if (null != shopIds) { |
|
|
|
|
|
List<WxShop> contractShops = wxShopService.getByIds(shopIds); |
|
|
|
|
|
//如果合同状态是计租中,则商铺不显示 |
|
|
|
|
|
if (rentContract.getStatus().intValue() != EnumRentContractStatus.PAING.getCode()) { |
|
|
|
|
|
if (null != contractShops) { |
|
|
|
|
|
for (WxShop s:contractShops) { |
|
|
|
|
|
if (shopList.contains(s)) { |
|
|
|
|
|
shopList.remove(s); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return new ResultData(shopList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//去掉正常状态的合同里的店铺 |
|
|
|
|
|
shopList.stream().filter(s -> !rentShopList.contains(s)); |
|
|
|
|
|
List<WxShop> shops = wxShopService.getByIds(shopList); |
|
|
|
|
|
//再加上合同里面店铺 |
|
|
|
|
|
if(null != currentContractShopIds && currentContractShopIds.size() > 0 ) { |
|
|
|
|
|
List<WxShop> contractShops = wxShopService.getByIds(currentContractShopIds); |
|
|
|
|
|
contractShops.stream().filter( cs -> !shopList.contains(cs.getId())); |
|
|
|
|
|
shops.addAll(contractShops); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(shops); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("getMerchantList") |
|
|
@GetMapping("getMerchantList") |
|
|
@SystemControllerLog(description = "获取商户列表") |
|
|
@SystemControllerLog(description = "获取商户列表") |
|
|
|