Browse Source

修改楼盘信息

feature/v.2.0.0
caoyizhong 3 years ago
parent
commit
b0e71ad1e9
  1. 2
      air/src/main/java/com/air/housing/controller/FormatController.java
  2. 6
      air/src/main/java/com/air/housing/service/FormatService.java
  3. 17
      air/src/main/java/com/air/housing/service/impl/FormatServiceImpl.java
  4. 17
      air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java
  5. 7
      air/src/main/java/com/air/land/controller/LandListedController.java
  6. 11
      air/src/main/java/com/air/origin/controller/BlocksOriginController.java
  7. 7
      air/src/main/java/com/air/origin/service/BlocksOriginService.java
  8. 99
      air/src/main/java/com/air/origin/service/impl/BlocksOriginServiceImpl.java

2
air/src/main/java/com/air/housing/controller/FormatController.java

@ -69,7 +69,7 @@ public class FormatController {
@ApiOperation(value = "修改业态信息", notes = "修改业态信息")
@PutMapping
public R updateById(@RequestBody Format format) {
return R.ok(formatService.updateById(format));
return R.ok(formatService.updateBy(format));
}
/**

6
air/src/main/java/com/air/housing/service/FormatService.java

@ -10,5 +10,11 @@ import com.air.housing.entity.Format;
* @date 2021-06-09 09:13:16
*/
public interface FormatService extends IService<Format> {
/**
* 修改业态信息
* @param format
* @return
*/
int updateBy(Format format);
}

17
air/src/main/java/com/air/housing/service/impl/FormatServiceImpl.java

@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.air.housing.entity.Format;
import com.air.housing.mapper.FormatMapper;
import com.air.housing.service.FormatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* 业态信息
*
@ -15,4 +18,18 @@ import org.springframework.stereotype.Service;
@Service
public class FormatServiceImpl extends ServiceImpl<FormatMapper, Format> implements FormatService {
@Autowired
private FormatMapper formatMapper;
@Override
public int updateBy(Format format) {
BigDecimal bigDecimal = new BigDecimal(0);
if(format.getFormatSize().compareTo(bigDecimal) > 0){
//有业态体量
format.setUnpushedStock( format.getFormatSize().subtract(format.getSupplyArea()));//未推
format.setBroadSenseStock(format.getNarrowSenseStock().add(format.getUnpushedStock()));//广义库存
}
return formatMapper.updateById(format);
}
}

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

@ -93,7 +93,7 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
housingEstates.setName(housingDefine.getHousingEstateName());
housingEstates.setStatusCd(Constant.COMMON_STATUS_1000);
this.save(housingEstates);
housingDefine.setHousingEstateId(housingEstates.getHousingEstateId());
housingDefine.setHousingEstateId(housingEstates.getHousingEstateId());//楼盘ID
}
//查询楼盘业态是否存在,不存在时新建
Format format = formatService.getOne(Wrappers.<Format>query().lambda()
@ -190,7 +190,6 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
}
List<Houses> housesList = new ArrayList<>(origins.size());
List<HousesOrigin> housesOriginList = new ArrayList<>(); //
BigDecimal totalQuantity= new BigDecimal(0);//供给面积
origins.forEach(housesOrigin -> {
BigDecimal bigDecimal = new BigDecimal(0);
//去除不是房间的数据
@ -218,7 +217,7 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
if(StrUtil.isNotBlank(housesOrigin.getSubscribeStatus()) || StrUtil.isNotBlank(housesOrigin.getNetSignStatus()) ) {
housesOriginList.add(housesOrigin);
}
totalQuantity.add(housesOrigin.getCoveredArea());
}
});
@ -232,11 +231,15 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
format.setDealtCount(housesOriginList.size()); //成交套数
//已售面积
BigDecimal bigDecimal = new BigDecimal(0);
housesOriginList.forEach( housesOrigin -> {
bigDecimal.add(housesOrigin.getCoveredArea());
} );
format.setSupplyArea(totalQuantity);//供给总面积
for (HousesOrigin housesOrigin : housesOriginList) { //成交的数量,面积
bigDecimal = bigDecimal.add(housesOrigin.getCoveredArea());
}
BigDecimal totalQuantity= new BigDecimal(0);//供给面积
for (Houses houses : housesList) {
totalQuantity = totalQuantity.add(houses.getCoveredArea());
}
format.setDealtArea(bigDecimal);//成交面积
format.setSupplyArea(totalQuantity);//供给总面积
format.setNarrowSenseStock(totalQuantity.subtract(bigDecimal));//狭义库存
formatService.updateById(format);
}

7
air/src/main/java/com/air/land/controller/LandListedController.java

@ -318,6 +318,13 @@ public class LandListedController {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx");
// OutputStream stream = null;
// try {
// stream = response.getOutputStream();
// stream.write(city.getBytes("UTF-8"));
// } catch (IOException e) {
// e.printStackTrace();
// }
// 获取数据
List<List<String>> date = landListedService.getLandListCity(city);
// List<List<String>> date = landListedService.getLandList(null);

11
air/src/main/java/com/air/origin/controller/BlocksOriginController.java

@ -91,4 +91,15 @@ public class BlocksOriginController {
public R removeById(@PathVariable Long blockId) {
return R.ok(blocksOriginService.removeById(blockId));
}
/**
* 通过信息撤销楼栋信息
* @param blocksOrigin id
* @return R
*/
@ApiOperation(value = "通过信息撤销楼栋信息", notes = "通过信息撤销楼栋信息")
@PostMapping("/annul")
public R removeById(@RequestBody BlocksOrigin blocksOrigin) {
return R.ok(blocksOriginService.removeByIdAnnul(blocksOrigin));
}
}

7
air/src/main/java/com/air/origin/service/BlocksOriginService.java

@ -23,4 +23,11 @@ public interface BlocksOriginService extends IService<BlocksOrigin> {
* @return
*/
List<BlocksOrigin> pageSer(Page page, BlocksOriginQuery query);
/**
* 通过信息撤销楼栋信息
* @param blocksOrigin
* @return
*/
int removeByIdAnnul(BlocksOrigin blocksOrigin);
}

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

@ -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;
}
}

Loading…
Cancel
Save