|
|
|
@@ -417,10 +417,64 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
wxMerchantMapper.insert(merchant); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
@Override |
|
|
|
public ResultData setSelled(WxShop record) { |
|
|
|
WxShop wxShop = wxShopMapper.selectById(record.getId()); |
|
|
|
if (wxShop == null) { |
|
|
|
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND); |
|
|
|
} |
|
|
|
|
|
|
|
//如果是写字楼住宅,直接更改状态即可 |
|
|
|
if(wxShop.getType() == EnumRentShopType.XIZILOU.getCode()) { |
|
|
|
wxShop.setSellStatus(EnumShopSellStatus.SELLED.getCode()); |
|
|
|
wxShop.setUpdateDate(new Date()); |
|
|
|
wxShopMapper.updateById(wxShop); |
|
|
|
return new ResultData(Result.SUCCESS, "更新成功"); |
|
|
|
}else { |
|
|
|
//2、如果该店铺还存在品牌商户,则不允许 |
|
|
|
WxMerchantShop wxMerchantShop = new WxMerchantShop(); |
|
|
|
wxMerchantShop.setShopId(wxShop.getId()); |
|
|
|
wxMerchantShop.updateTenantInfo(wxShop); |
|
|
|
wxMerchantShop.setIsDel(EnumYesOrNo.NO.getCode()); |
|
|
|
List<WxMerchantShop> wxMerchantShops = wxMerchantShopMapper.findList(wxMerchantShop); |
|
|
|
if (null != wxMerchantShops && wxMerchantShops.size() > 0 ) { |
|
|
|
return new ResultData(Result.ERROR,"店铺还存在关联的品牌商户,请先删除店铺关联"); |
|
|
|
} |
|
|
|
//如果存在有效的合同,则不允许删除 |
|
|
|
WxRentContract rcq = new WxRentContract(); |
|
|
|
rcq.updateTenantInfo(wxShop); |
|
|
|
rcq.setQueryShopNumber(wxShop.getShopNumber()); |
|
|
|
List<Integer> status = EnumRentContractStatus.getValidStatus(); |
|
|
|
status.add(EnumRentContractStatus.PERFORMANCE.getCode()); |
|
|
|
rcq.setStatuss(status); |
|
|
|
List<WxRentContract> list = wxRentContractMapper.findList(rcq); |
|
|
|
if (null != list && list.size() > 0 ) { |
|
|
|
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的租金合同,请先终止该合同或者审批退回作废合同"); |
|
|
|
} |
|
|
|
|
|
|
|
WxPropertyContract pcq = new WxPropertyContract(); |
|
|
|
pcq.updateTenantInfo(wxShop); |
|
|
|
pcq.setQueryShopNumber(wxShop.getShopNumber()); |
|
|
|
pcq.setStatuss(status); |
|
|
|
List<WxPropertyContract> plist = wxPropertyContractMapper.findList(pcq); |
|
|
|
if (null != plist && plist.size() > 0 ) { |
|
|
|
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同,请先终止该合同或者审批退回作废合同"); |
|
|
|
} |
|
|
|
|
|
|
|
wxShop.setSellStatus(EnumShopSellStatus.SELLED.getCode()); |
|
|
|
wxShop.setUpdateDate(new Date()); |
|
|
|
wxShopMapper.updateById(wxShop); |
|
|
|
|
|
|
|
//创建虚拟商户 |
|
|
|
createPrivateMerchant(wxShop); |
|
|
|
return new ResultData(Result.SUCCESS, "更新成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData deleteById(Long id, Integer isAdmin) { |
|
|
|
//1、已出租不让删除 |
|
|
|
WxShop wxShop = wxShopMapper.selectById(id); |
|
|
|
if (wxShop == null) { |
|
|
|
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND); |
|
|
|
@@ -434,7 +488,7 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
rcq.setStatuss(status); |
|
|
|
List<WxRentContract> list = wxRentContractMapper.findList(rcq); |
|
|
|
if (null != list && list.size() > 0 ) { |
|
|
|
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的租金合同,不能删除"); |
|
|
|
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的租金合同,请先终止该合同或者审批退回作废合同"); |
|
|
|
} |
|
|
|
|
|
|
|
WxPropertyContract pcq = new WxPropertyContract(); |
|
|
|
@@ -443,7 +497,7 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
pcq.setStatuss(status); |
|
|
|
List<WxPropertyContract> plist = wxPropertyContractMapper.findList(pcq); |
|
|
|
if (null != plist && plist.size() > 0 ) { |
|
|
|
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同,不能删除"); |
|
|
|
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同,请先终止该合同或者审批退回作废合同"); |
|
|
|
} |
|
|
|
// WxAllBill abq = new WxAllBill(); |
|
|
|
// abq.updateTenantInfo(wxShop); |
|
|
|
@@ -463,6 +517,7 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
if (count > 0) { |
|
|
|
//更新标记 |
|
|
|
wxShop.setIsDel(EnumDelStatus.DEL.getCode()); |
|
|
|
wxShop.setUpdateDate(new Date()); |
|
|
|
wxShopMapper.updateById(wxShop); |
|
|
|
//关联表 |
|
|
|
for (int i = 0; i < count; i++) { |
|
|
|
@@ -473,6 +528,7 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
} else { |
|
|
|
//虚拟商户是没有中间表的 |
|
|
|
wxShop.setIsDel(EnumDelStatus.DEL.getCode()); |
|
|
|
wxShop.setUpdateDate(new Date()); |
|
|
|
wxShopMapper.updateById(wxShop); |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS, "删除成功"); |
|
|
|
|