Browse Source

楼盘修改2

feature/v.2.0.0
caoyizhong 3 years ago
parent
commit
bd02f11953
  1. 25
      air/src/main/java/com/air/housing/controller/BlocksController.java
  2. 15
      air/src/main/java/com/air/housing/mapper/AnnoBlocksRelMapper.java
  3. 2
      air/src/main/java/com/air/housing/service/AnnoBlocksRelService.java
  4. 14
      air/src/main/java/com/air/housing/service/BlocksService.java
  5. 55
      air/src/main/java/com/air/housing/service/impl/BlocksServiceImpl.java
  6. 61
      air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java
  7. 35
      air/src/main/java/com/air/housing/vo/BlocksVO.java
  8. 30
      air/src/main/java/com/air/origin/service/impl/BlocksOriginServiceImpl.java
  9. 19
      air/src/main/resources/mapper/AnnoBlocksRelMapper.xml
  10. 2
      air/src/main/resources/mapper/BlocksMapper.xml
  11. 7
      air/src/main/resources/mapper/HousingEstatesMapper.xml

25
air/src/main/java/com/air/housing/controller/BlocksController.java

@ -44,6 +44,19 @@ public class BlocksController {
return R.ok(blocksService.getById(blockId));
}
/**
* 通过id查询楼栋业态信息
*
* @param blockId id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/commercial_activities/{blockId}")
public R getByIds(@PathVariable("blockId") Long blockId) {
return R.ok(blocksService.selectCommercialActivities(blockId));
}
/**
* 新增楼栋信息
@ -71,6 +84,18 @@ public class BlocksController {
return R.ok(blocksService.updateById(blocks));
}
/**
* 修改楼栋信息
*
* @param blocks 楼栋信息
* @return R
*/
@ApiOperation(value = "修改楼栋信息", notes = "修改楼栋信息")
@PutMapping("/modify")
public R updateByIdBlocks(@RequestBody Blocks blocks) {
return R.ok(blocksService.updateByIdBlocks(blocks));
}
/**
* 通过id删除楼栋信息
*

15
air/src/main/java/com/air/housing/mapper/AnnoBlocksRelMapper.java

@ -3,6 +3,8 @@ package com.air.housing.mapper;
import com.air.housing.entity.AnnoBlocksRel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* 地块楼盘关联表
*
@ -10,4 +12,17 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2021-05-18 09:39:45
*/
public interface AnnoBlocksRelMapper extends BaseMapper<AnnoBlocksRel> {
/**
* 添加集合
* @param list
* @return
*/
int insertAllList(List<AnnoBlocksRel> list);
/**
* 查询楼盘名称
* @return
*/
List<AnnoBlocksRel> selectName();
}

2
air/src/main/java/com/air/housing/service/AnnoBlocksRelService.java

@ -11,4 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface AnnoBlocksRelService extends IService<AnnoBlocksRel> {
}

14
air/src/main/java/com/air/housing/service/BlocksService.java

@ -3,6 +3,7 @@ package com.air.housing.service;
import com.air.applets.dto.BlocksPreSaleTotalDto;
import com.air.housing.dto.BlockListDto;
import com.air.housing.entity.Blocks;
import com.air.housing.vo.BlocksVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -28,4 +29,17 @@ public interface BlocksService extends IService<Blocks> {
List<BlocksPreSaleTotalDto> getPreSaleDetailList(String landListedId);
/**
* 根据id查询业态信息
* @param id
* @return
*/
BlocksVO selectCommercialActivities(Long id);
/**
* 修改信息
* @param blocks
* @return
*/
int updateByIdBlocks(Blocks blocks);
}

55
air/src/main/java/com/air/housing/service/impl/BlocksServiceImpl.java

@ -5,13 +5,20 @@ import com.air.applets.dto.BlocksPreSaleTotalDto;
import com.air.housing.dto.BlockListDto;
import com.air.housing.entity.AnnoBlocksRel;
import com.air.housing.entity.Blocks;
import com.air.housing.entity.Format;
import com.air.housing.entity.HousingEstates;
import com.air.housing.mapper.AnnoBlocksRelMapper;
import com.air.housing.mapper.BlocksMapper;
import com.air.housing.mapper.FormatMapper;
import com.air.housing.mapper.HousingEstatesMapper;
import com.air.housing.service.BlocksService;
import com.air.housing.vo.BlocksVO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -25,12 +32,19 @@ import java.util.List;
*/
@Service
@AllArgsConstructor
@Slf4j
public class BlocksServiceImpl extends ServiceImpl<BlocksMapper, Blocks> implements BlocksService {
private BlocksMapper blocksMapper;
private AnnoBlocksRelMapper annoBlocksRelMapper;
@Autowired
private HousingEstatesMapper housingEstatesMapper;
@Autowired
private FormatMapper formatMapper;
@Override
public Page<Blocks> getBlocksPageByhousingEstateId(Page page, BlockListDto blockListDto) {
return blocksMapper.getBlocksPageByhousingEstateId(page, blockListDto);
@ -77,4 +91,45 @@ public class BlocksServiceImpl extends ServiceImpl<BlocksMapper, Blocks> impleme
}
return saleTotalDtoList;
}
/**
* 根据id查询业态信息
* @param id
* @return
*/
@Override
public BlocksVO selectCommercialActivities(Long id) {
BlocksVO blocksVO = new BlocksVO();
Blocks blocks = blocksMapper.selectById(id);
HousingEstates housingEstates = housingEstatesMapper.selectById(blocks.getHousingEstateId());
Format format = formatMapper.selectById(blocks.getFormatId());
blocksVO.setBlockId(blocks.getBlockId());
blocksVO.setBlockName(housingEstates.getName());
blocksVO.setHousingEstateId(housingEstates.getHousingEstateId());
blocksVO.setFormat(format.getFormat());
blocksVO.setPropertyType(format.getPropertyType());
blocksVO.setLargeFormat(format.getLargeFormat());
blocksVO.setFormatId(format.getFormatId());
return blocksVO;
}
/**
* 修改信息
* @param blocks
* @return
*/
@Override
public int updateByIdBlocks(Blocks blocks) {
log.info("+++++++++++++++++++{}",blocks);
Format format = new Format();
format.setHousingEstateId(blocks.getHousingEstateId());
format.setFormat(blocks.getFormat());
format.setPropertyType(blocks.getPropertyType());
format.setLargeFormat(blocks.getLargeFormat());
formatMapper.update(format,Wrappers.<Format>query().lambda()
.eq(Format::getFormatId,blocks.getFormatId())
);
return blocksMapper.updateById(blocks);
}
}

61
air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java

@ -1,6 +1,7 @@
package com.air.housing.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.air.common.Constant;
import com.air.enums.BlocksOriginStatusEnum;
@ -8,6 +9,7 @@ import com.air.housing.dto.HousingDefine;
import com.air.housing.dto.HousingEstatesListDto;
import com.air.housing.dto.HousingEstatesQuery;
import com.air.housing.entity.*;
import com.air.housing.mapper.AnnoBlocksRelMapper;
import com.air.housing.mapper.HousingEstatesMapper;
import com.air.housing.service.*;
import com.air.housing.vo.HousingEstatesDetail;
@ -59,11 +61,15 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
private HousingEstatesMapper housingEstatesMapper;
@Autowired
private AnnoBlocksRelService annoBlocksRelService;
@Autowired
private AnnoBlocksRelMapper annoBlocksRelMapper;
@Autowired
private LandListedMapper landListedMapper;
@Autowired
private FormatService formatService;
@Autowired
private RedisUtil redisUtil;
@Autowired
@ -83,11 +89,13 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
List<HousingEstatesName> housingEstatesNames = housingEstatesMapper.selectIName(name);
List<HousingEstates> list = new ArrayList<>();
//添加未添加的楼盘
for (int i = 0; i < landListeds.size(); i++) {
for (HousingEstatesName housingEstatesName : housingEstatesNames) {
if(landListeds.get(i).getBuildingName().equals(housingEstatesName.getName())){
log.info("========================{}",landListeds.get(i));
landListeds.remove(i);
for ( HousingEstatesName housingEstatesName : housingEstatesNames) {
for (LandListed landListed : landListeds) {
if(landListed.getBuildingName().equals(housingEstatesName.getName())){
// log.info("========================{}",landListed);
// log.info("==============数量=========={}",landListeds.size());
landListeds.remove(landListed);
break;
}
}
}
@ -108,7 +116,8 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
});
log.info("添加的数量{}",list.size());
this.saveBatch(list);
}else{
}
else{
return housingEstatesNames;
}
@ -124,10 +133,11 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
AnnoBlocksRel annoBlocksRel = new AnnoBlocksRel();
annoBlocksRel.setHousingEstatesId(housingEstatesName1.getHousingEstateId());
annoBlocksRel.setLandListedId(landListed1.getLandListedId());
if(redisUtil.getCacheObject(landListed1.getLandListedId() + housingEstatesName1.getHousingEstateId() ) != null){
Object object = redisUtil.getCacheObject("AA" + landListed1.getLandListedId());
if(ObjectUtil.isNotNull(object)){
annoBlocksRel.setMainLand(0);
}else{
redisUtil.setCacheObject(landListed1.getLandListedId() + housingEstatesName1.getHousingEstateId(),1,5, TimeUnit.MINUTES);
redisUtil.setCacheObject("AA"+landListed1.getLandListedId() ,1,2, TimeUnit.MINUTES);
annoBlocksRel.setMainLand(1);
}
annoBlocksRel.setStatusCd(Constant.COMMON_STATUS_1000);
@ -135,12 +145,27 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
}
});
});
if(annoBlocksRelList.size() > 0){
log.info("添加的数量{}",annoBlocksRelList.size());
boolean b = annoBlocksRelService.saveBatch(annoBlocksRelList);
if(!b){
throw new BusinessException("添加失败!!");
if(annoBlocksRelList.size() > 0){
List<AnnoBlocksRel> annoBlocksRelList1 = annoBlocksRelMapper.selectName();
for ( AnnoBlocksRel annoBlocksRel : annoBlocksRelList1) {
for ( AnnoBlocksRel annoBlocksRel1 : annoBlocksRelList ) {
if( annoBlocksRel1.getHousingEstatesId().equals(annoBlocksRel.getHousingEstatesId()) && annoBlocksRel1.getLandListedId().equals(annoBlocksRel.getLandListedId()) ){
log.info("==============添加地块关联表的数量=========={}",annoBlocksRelList.size());
annoBlocksRelList.remove(annoBlocksRel1);
break;
}
}
}
if(annoBlocksRelList.size() > 0){
log.info("添加地块关联表的数量{}",annoBlocksRelList.size());
int i = annoBlocksRelMapper.insertAllList(annoBlocksRelList);
if(i < 1){
throw new BusinessException("添加失败!!");
}
}
}
return housingEstatesName;
}
@ -176,20 +201,14 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
housingDefine.setHousingEstateId(housingEstates.getHousingEstateId());//楼盘ID
}
//查询楼盘业态是否存在,不存在时新建
Format format = formatService.getOne(Wrappers.<Format>query().lambda()
.eq(Format::getHousingEstateId, housingDefine.getHousingEstateId())
.eq(Format::getPropertyType,housingDefine.getPropertyType())
.eq(Format::getLargeFormat, housingDefine.getLargeFormat())
.eq(Format::getFormat, housingDefine.getFormat()));
if (format == null) {
format = new Format();
Format format = new Format();
format.setHousingEstateId(housingDefine.getHousingEstateId());
format.setPropertyType(housingDefine.getPropertyType());
format.setLargeFormat(housingDefine.getLargeFormat());
format.setFormat(housingDefine.getFormat());
format.setStatusCd(Constant.COMMON_STATUS_1000);
formatService.save(format);
}
//保存楼栋和房屋数据
copyBlocksOriginToBlocks(blocksOrigin, housingDefine,format.getFormatId());
//保存楼盘和地块之间的关系

35
air/src/main/java/com/air/housing/vo/BlocksVO.java

@ -0,0 +1,35 @@
package com.air.housing.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @program: back-end
* @description:
* @author: cyz
* @create: 2022-07-22 15:41
**/
@Data
public class BlocksVO {
private Long blockId;
@ApiModelProperty(value = "楼盘名称")
private String blockName;
@ApiModelProperty(value = "小业态")
private String format;
@ApiModelProperty(value = "楼盘ID")
private Long housingEstateId;
@ApiModelProperty(value = "大业态")
private String largeFormat;
@ApiModelProperty(value = "物业")
private String propertyType;
@ApiModelProperty(value = "业态id(关联当前楼栋对应的业态信息)")
private Long formatId;
}

30
air/src/main/java/com/air/origin/service/impl/BlocksOriginServiceImpl.java

@ -81,25 +81,25 @@ public class BlocksOriginServiceImpl extends ServiceImpl<BlocksOriginMapper, Blo
.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> 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(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());

19
air/src/main/resources/mapper/AnnoBlocksRelMapper.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.air.housing.mapper.AnnoBlocksRelMapper">
<insert id="insertAllList">
insert into anno_blocks_rel
(housing_estates_id,land_listed_id,main_land,status_cd )
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.housingEstatesId},#{item.landListedId},#{item.mainLand},#{item.statusCd})
</foreach>
</insert>
<select id="selectName" resultType="com.air.housing.entity.AnnoBlocksRel">
select housing_estates_id,land_listed_id
from anno_blocks_rel
</select>
</mapper>

2
air/src/main/resources/mapper/BlocksMapper.xml

@ -13,7 +13,7 @@
f.large_format,
f.`format`,
b.status_cd,
b.remark,
b.remark
from blocks b join `format` f ON b.format_id = f.format_id
where b.housing_estate_id = #{Blocks.housingEstateId}

7
air/src/main/resources/mapper/HousingEstatesMapper.xml

@ -24,7 +24,7 @@
</select>
<select id="selectIPage" resultType="com.air.housing.dto.HousingEstatesListDto">
select h.housing_estate_id,
select DISTINCT h.housing_estate_id,
l.land_code,
h.`name`,
l.canton,
@ -37,6 +37,7 @@
housing_estates h
JOIN anno_blocks_rel an ON h.housing_estate_id = an.housing_estates_id and an.main_land = 1
JOIN land_listed l on l.land_listed_id = an.land_listed_id
JOIN blocks b on b.housing_estate_id = h.housing_estate_id
<where>
<if test="query.name != null and query.name != ''">
and h.name like concat('%', #{query.name}, '%')
@ -51,10 +52,10 @@
and l.conductEnterprise like concat('%', #{query.conductEnterprise}, '%')
</if>
<if test="query.bigGroup != null and query.bigGroup != ''">
and l.big_group = #{query.bigGroup}
and l.big_group like concat('%', #{query.bigGroup},'%')
</if>
<if test="query.smallGroup != null and query.smallGroup != ''">
and l.small_group = #{query.smallGroup}
and l.small_group like concat('%',#{query.smallGroup},'%')
</if>
</where>

Loading…
Cancel
Save