|
|
|
@ -1,15 +1,27 @@
|
|
|
|
|
package com.air.origin.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.air.housing.entity.AnnoBlocksRel; |
|
|
|
|
import com.air.housing.entity.Blocks; |
|
|
|
|
import com.air.housing.entity.Houses; |
|
|
|
|
import com.air.housing.entity.HousingEstates; |
|
|
|
|
import com.air.housing.mapper.*; |
|
|
|
|
import com.air.origin.dto.BlocksOriginQuery; |
|
|
|
|
import com.air.origin.entity.HousesOrigin; |
|
|
|
|
import com.air.origin.mapper.HousesOriginMapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import com.air.origin.entity.BlocksOrigin; |
|
|
|
|
import com.air.origin.mapper.BlocksOriginMapper; |
|
|
|
|
import com.air.origin.service.BlocksOriginService; |
|
|
|
|
import com.cinderella.framework.common.core.exception.BusinessException; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -19,11 +31,27 @@ import java.util.List;
|
|
|
|
|
* @date 2021-06-08 11:35:48 |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@Slf4j |
|
|
|
|
public class BlocksOriginServiceImpl extends ServiceImpl<BlocksOriginMapper, BlocksOrigin> implements BlocksOriginService { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private BlocksOriginMapper blocksOriginMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private HousesMapper housesMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private BlocksMapper blocksMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private HousingEstatesMapper housingEstatesMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private FormatMapper formatMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private AnnoBlocksRelMapper annoBlocksRelMapper; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<BlocksOrigin> pageSer(Page page, BlocksOriginQuery query) { |
|
|
|
|
// return super.page(page, Wrappers.query(query.blocksOrigin()));
|
|
|
|
@ -34,4 +62,75 @@ public class BlocksOriginServiceImpl extends ServiceImpl<BlocksOriginMapper, Blo
|
|
|
|
|
|
|
|
|
|
return blocksOriginMapper.selectPager(page,query); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过信息撤销楼栋信息 |
|
|
|
|
* @param blocksOrigin |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public int removeByIdAnnul(BlocksOrigin blocksOrigin) { |
|
|
|
|
log.info("blocksOrigin={}",blocksOrigin); |
|
|
|
|
//删除楼栋 和房间数据
|
|
|
|
|
// housesMapper.delete(Wrappers.<Houses>query().lambda()
|
|
|
|
|
// .eq(Houses::getBlockId,blocksOrigin.getBlockId())
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
Blocks blocks = blocksMapper.selectOne(Wrappers.<Blocks>query().lambda() |
|
|
|
|
.eq(Blocks::getPreSalePermitNo, blocksOrigin.getPreSaleLicenseNo()) |
|
|
|
|
.eq(Blocks::getBlockName, blocksOrigin.getBuildingNo()) |
|
|
|
|
); |
|
|
|
|
List<Blocks> blocks1 = blocksMapper.selectList(Wrappers.<Blocks>query().lambda() |
|
|
|
|
.eq(Blocks::getHousingEstateId, blocks.getHousingEstateId()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
List<Blocks> blocks2 = blocksMapper.selectList(Wrappers.<Blocks>query().lambda() |
|
|
|
|
.eq(Blocks::getFormatId, blocks.getFormatId()) |
|
|
|
|
); |
|
|
|
|
if(blocks1.size() < 2){ |
|
|
|
|
//删除楼盘信息
|
|
|
|
|
int i = housingEstatesMapper.deleteById(blocks.getHousingEstateId()); |
|
|
|
|
//地块公告关联表
|
|
|
|
|
int i2 = annoBlocksRelMapper.delete(Wrappers.<AnnoBlocksRel>query().lambda() |
|
|
|
|
.eq(AnnoBlocksRel::getHousingEstatesId,blocks.getHousingEstateId()) |
|
|
|
|
); |
|
|
|
|
if(i < 0 && i2 < 0){ |
|
|
|
|
throw new BusinessException("操作失败!请联系管理员!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(blocks2.size() < 2){ |
|
|
|
|
//删除业态数据
|
|
|
|
|
int i1 = formatMapper.deleteById(blocks.getFormatId()); |
|
|
|
|
if(i1 < 0 ){ |
|
|
|
|
throw new BusinessException("操作失败!请联系管理员!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//删除房间数据
|
|
|
|
|
int delete = housesMapper.delete(Wrappers.<Houses>query().lambda() |
|
|
|
|
.eq(Houses::getBlockId, blocks.getBlockId()) |
|
|
|
|
); |
|
|
|
|
//删除楼栋数据
|
|
|
|
|
int i3 = blocksMapper.deleteById(blocks.getBlockId()); |
|
|
|
|
|
|
|
|
|
if(delete > 0 && i3 > 0){ |
|
|
|
|
//修改楼栋状态
|
|
|
|
|
BlocksOrigin blocksOrigin1 = new BlocksOrigin(); |
|
|
|
|
blocksOrigin1.setStatusCd("0"); |
|
|
|
|
int update = blocksOriginMapper.update(blocksOrigin1, Wrappers.<BlocksOrigin>query().lambda() |
|
|
|
|
.eq(BlocksOrigin::getBlockId, blocksOrigin.getBlockId()) |
|
|
|
|
); |
|
|
|
|
if (update > 0) { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
throw new BusinessException("操作失败!请联系管理员!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|