自动生成房屋信息接口新增,批量创建房屋数据接口修改,bug修改 --renpc

This commit is contained in:
Renpc-kilig 2023-11-16 11:11:19 +08:00
parent cdb4b6cd25
commit fd950b875f
12 changed files with 234 additions and 192 deletions

View File

@ -9,7 +9,6 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.population.pojo.dtos.building.BuildingDTO;
import com.cm.population.pojo.vos.building.BuildingBatchVO;
import com.cm.population.pojo.vos.building.BuildingVO;
import com.cm.population.service.building.IBuildingService;
import io.swagger.annotations.*;
@ -109,13 +108,4 @@ public class BuildingController extends AbstractController {
return new SuccessResultData<>(buildingService.count(params));
}
@ApiOperation(value = "新增楼排管理", notes = "新增楼排管理接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveBatch")
@CheckRequestBodyAnnotation
public SuccessResult saveBatch(@RequestBody BuildingBatchVO buildingBatchVO) {
buildingService.saveBatch(buildingBatchVO);
return new SuccessResult();
}
}

View File

@ -8,8 +8,10 @@ import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.population.pojo.dtos.house.AutoHouseDTO;
import com.cm.population.pojo.dtos.house.BatchHouseDTO;
import com.cm.population.pojo.dtos.house.HouseDTO;
import com.cm.population.pojo.vos.building.BuildingBatchVO;
import com.cm.population.pojo.vos.house.HouseVO;
import com.cm.population.service.house.IHouseService;
import io.swagger.annotations.*;
@ -131,4 +133,22 @@ public class HouseController extends AbstractController {
return houseService.getAllHouse(params);
}
@ApiOperation(value = "批量生成房屋", notes = "批量生成房屋接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveBatch")
@CheckRequestBodyAnnotation
public SuccessResult saveBatch(@RequestBody BuildingBatchVO buildingBatchVO) {
houseService.saveBatch(buildingBatchVO);
return new SuccessResult();
}
@ApiOperation(value = "根据楼栋信息自动生成房屋", notes = "根据楼栋信息自动生成房屋接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveAuto")
@CheckRequestBodyAnnotation
public SuccessResult saveAuto(@RequestBody AutoHouseDTO autoHouseDTO) {
houseService.saveAuto(null, autoHouseDTO);
return new SuccessResult();
}
}

View File

@ -9,7 +9,6 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.population.pojo.dtos.building.BuildingDTO;
import com.cm.population.pojo.vos.building.BuildingBatchVO;
import com.cm.population.pojo.vos.building.BuildingVO;
import com.cm.population.service.building.IBuildingService;
import io.swagger.annotations.*;
@ -121,16 +120,4 @@ public class BuildingAppController extends AbstractController {
return new SuccessResultData<>(buildingService.count(params));
}
@ApiOperation(value = "新增楼排管理", notes = "新增楼排管理接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveBatch")
@CheckRequestBodyAnnotation
public SuccessResult saveBatch(@RequestHeader("token") String token, @RequestBody BuildingBatchVO buildingBatchVO) {
buildingService.saveBatch(token, buildingBatchVO);
return new SuccessResult();
}
}

View File

@ -8,7 +8,9 @@ import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.population.pojo.dtos.house.AutoHouseDTO;
import com.cm.population.pojo.dtos.house.HouseDTO;
import com.cm.population.pojo.vos.building.BuildingBatchVO;
import com.cm.population.pojo.vos.house.HouseVO;
import com.cm.population.service.house.IHouseService;
import io.swagger.annotations.*;
@ -120,4 +122,28 @@ public class HouseAppController extends AbstractController {
return new SuccessResultData<>(houseService.count(params));
}
@ApiOperation(value = "批量生成房屋", notes = "批量生成房屋接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveBatch")
@CheckRequestBodyAnnotation
public SuccessResult saveBatch(@RequestHeader("token") String token, @RequestBody BuildingBatchVO buildingBatchVO) {
houseService.saveBatch(token, buildingBatchVO);
return new SuccessResult();
}
@ApiOperation(value = "根据楼栋信息自动生成房屋", notes = "根据楼栋信息自动生成房屋接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveAuto")
@CheckRequestBodyAnnotation
public SuccessResult saveAuto(@RequestHeader("token") String token, @RequestBody AutoHouseDTO autoHouseDTO) {
houseService.saveAuto(token, autoHouseDTO);
return new SuccessResult();
}
}

View File

@ -0,0 +1,38 @@
package com.cm.population.pojo.dtos.house;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @ClassName: HouseDTO
* @Description: 房院管理
* @Author: CodeFactory
* @Date: 2023-10-25 14:47:44
* @Version: 3.0
**/
@ApiModel
public class AutoHouseDTO {
@ApiModelProperty(name = "buildingId", value = "楼/排ID")
private String buildingId;
@ApiModelProperty(name = "floorUnitHouseCount", value = "每单元每层户数")
private Integer floorUnitHouseCount;
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public Integer getFloorUnitHouseCount() {
return floorUnitHouseCount;
}
public void setFloorUnitHouseCount(Integer floorUnitHouseCount) {
this.floorUnitHouseCount = floorUnitHouseCount;
}
}

View File

@ -1,7 +1,5 @@
package com.cm.population.pojo.vos.building;
import com.cm.common.annotation.CheckNumberAnnotation;
import com.cm.population.pojo.vos.house.HouseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -32,25 +30,10 @@ public class BuildingBatchVO {
private String residentialId;
@ApiModelProperty(name = "residentialName", value = "所在小区名称")
private String residentialName;
@ApiModelProperty(name = "name", value = "楼排名称")
private String name;
@ApiModelProperty(name = "buildNum", value = "楼/排号")
@CheckNumberAnnotation(name = "楼/排号")
private Integer buildNum;
@ApiModelProperty(name = "floorsNum", value = "楼层数")
@CheckNumberAnnotation(name = "楼层数")
private Integer floorsNum;
@ApiModelProperty(name = "unitNum", value = "单元/排数")
@CheckNumberAnnotation(name = "单元/排数")
private Integer unitNum;
@ApiModelProperty(name = "address", value = "详细地址")
private String address;
@ApiModelProperty(name = "longitude", value = "经度")
private String longitude;
@ApiModelProperty(name = "latitude", value = "纬度")
private String latitude;
@ApiModelProperty(name = "image", value = "图片")
private String image;
@ApiModelProperty(name = "buildingId", value = "楼栋ID")
private String buildingId;
@ApiModelProperty(name = "buildingName", value = "楼栋名称")
private String buildingName;
@ApiModelProperty(name = "resultList", value = "批量录入房屋信息")
private List<BatchVO> resultList;
@ -86,68 +69,20 @@ public class BuildingBatchVO {
this.residentialName = residentialName;
}
public String getName() {
return name == null ? "" : name.trim();
public String getBuildingId() {
return buildingId;
}
public void setName(String name) {
this.name = name;
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public Integer getBuildNum() {
return buildNum == null ? 0 : buildNum;
public String getBuildingName() {
return buildingName;
}
public void setBuildNum(Integer buildNum) {
this.buildNum = buildNum;
}
public Integer getFloorsNum() {
return floorsNum == null ? 0 : floorsNum;
}
public void setFloorsNum(Integer floorsNum) {
this.floorsNum = floorsNum;
}
public Integer getUnitNum() {
return unitNum;
}
public void setUnitNum(Integer unitNum) {
this.unitNum = unitNum;
}
public String getAddress() {
return address == null ? "" : address.trim();
}
public void setAddress(String address) {
this.address = address;
}
public String getLongitude() {
return longitude == null ? "" : longitude.trim();
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude == null ? "" : latitude.trim();
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getImage() {
return image == null ? "" : image.trim();
}
public void setImage(String image) {
this.image = image;
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public String getStreet() {

View File

@ -186,38 +186,4 @@ public interface IBuildingService {
*/
Integer count(Map<String, Object> params);
/**
* 批量新增房屋信息
*
* @param buildingBatchVO
* @return
*/
void saveBatch(BuildingBatchVO buildingBatchVO);
/**
* 新增楼排管理
*
* @param token
* @param buildingBatchVO
* @return
*/
void saveBatch(String token, BuildingBatchVO buildingBatchVO);
/**
* 新增楼排管理
*
* @param buildingBatchVO
* @return buildingId
*/
String saveBatchReturnId(BuildingBatchVO buildingBatchVO);
/**
* 新增楼排管理
*
* @param token
* @param buildingBatchVO
* @return buildingId
*/
String saveBatchReturnId(String token, BuildingBatchVO buildingBatchVO);
}

View File

@ -200,62 +200,4 @@ public class BuildingServiceImpl extends AbstractService implements IBuildingSer
return count == null ? 0 : count;
}
@Override
public void saveBatch(BuildingBatchVO buildingBatchVO) {
saveBatchReturnId(buildingBatchVO);
}
@Override
public void saveBatch(String token, BuildingBatchVO buildingBatchVO) {
saveBatchReturnId(token, buildingBatchVO);
}
@Override
public String saveBatchReturnId(BuildingBatchVO buildingBatchVO) {
return saveBatchReturnId(null, buildingBatchVO);
}
@Override
public String saveBatchReturnId(String token, BuildingBatchVO buildingBatchVO) {
String buildingId = UUIDUtil.getUUID();
Map<String, Object> params = null;
try {
params = HashMapUtil.beanToMap(buildingBatchVO);
} catch (Exception e) {
e.printStackTrace();
}
params.put("buildingId", buildingId);
if (StringUtils.isBlank(token)) {
setSaveInfo(params);
} else {
setSaveInfo(token, params);
}
buildingDao.save(params);
List<BuildingBatchVO.BatchVO> resultList = buildingBatchVO.getResultList();
if (null != resultList && resultList.size() > 0) {
for (BuildingBatchVO.BatchVO batchVO : resultList) {
for (BuildingBatchVO.FloorVO floorVO : batchVO.getFloorList()) {
for (BuildingBatchVO.HouseVO houseVO : floorVO.getHouseList()) {
HouseVO insertHouseVO = new HouseVO();
// 基本信息
insertHouseVO.setResidentialId(buildingBatchVO.getResidentialId());
insertHouseVO.setResidentialName(buildingBatchVO.getResidentialName());
insertHouseVO.setStreet(buildingBatchVO.getStreet());
insertHouseVO.setStreetName(buildingBatchVO.getStreetName());
insertHouseVO.setCommunity(buildingBatchVO.getCommunity());
insertHouseVO.setCommunityName(buildingBatchVO.getCommunityName());
insertHouseVO.setBuildingId(buildingId);
insertHouseVO.setAffiliatedUnit(batchVO.getUnitValue());
insertHouseVO.setAffiliationFloors(floorVO.getFloorValue());
insertHouseVO.setHouseNum(houseVO.getHouseValue());
houseService.save(insertHouseVO);
}
}
}
}
return buildingId;
}
}

View File

@ -3,9 +3,11 @@ package com.cm.population.service.house;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResultList;
import com.cm.population.pojo.bos.house.HouseBO;
import com.cm.population.pojo.dtos.house.AutoHouseDTO;
import com.cm.population.pojo.dtos.house.BatchHouseDTO;
import com.cm.population.pojo.dtos.house.HouseDTO;
import com.cm.population.pojo.pos.house.HousePO;
import com.cm.population.pojo.vos.building.BuildingBatchVO;
import com.cm.population.pojo.vos.house.HouseVO;
import java.util.List;
@ -189,4 +191,45 @@ public interface IHouseService {
List<HouseDTO> listByPopulationInfoId(String populationInfoId);
BatchHouseDTO getAllHouse(Map<String, Object> params);
/**
* 批量新增房屋信息
*
* @param buildingBatchVO
* @return
*/
void saveBatch(BuildingBatchVO buildingBatchVO);
/**
* 新增楼排管理
*
* @param token
* @param buildingBatchVO
* @return
*/
void saveBatch(String token, BuildingBatchVO buildingBatchVO);
/**
* 新增楼排管理
*
* @param buildingBatchVO
* @return buildingId
*/
String saveBatchReturnId(BuildingBatchVO buildingBatchVO);
/**
* 新增楼排管理
*
* @param token
* @param buildingBatchVO
* @return buildingId
*/
String saveBatchReturnId(String token, BuildingBatchVO buildingBatchVO);
/**
* 自动生成房屋信息
* @param token
* @param autoHouseDTO
*/
void saveAuto(String token, AutoHouseDTO autoHouseDTO);
}

View File

@ -9,10 +9,12 @@ import com.cm.common.utils.UUIDUtil;
import com.cm.population.dao.house.IHouseDao;
import com.cm.population.pojo.bos.house.HouseBO;
import com.cm.population.pojo.dtos.building.BuildingDTO;
import com.cm.population.pojo.dtos.house.AutoHouseDTO;
import com.cm.population.pojo.dtos.house.BatchHouseDTO;
import com.cm.population.pojo.dtos.house.HouseDTO;
import com.cm.population.pojo.dtos.residential.ResidentialDTO;
import com.cm.population.pojo.pos.house.HousePO;
import com.cm.population.pojo.vos.building.BuildingBatchVO;
import com.cm.population.pojo.vos.house.HouseVO;
import com.cm.population.service.building.IBuildingService;
import com.cm.population.service.house.IHouseService;
@ -289,4 +291,93 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
return batchHouseDTO;
}
@Override
public void saveBatch(BuildingBatchVO buildingBatchVO) {
saveBatchReturnId(buildingBatchVO);
}
@Override
public void saveBatch(String token, BuildingBatchVO buildingBatchVO) {
saveBatchReturnId(token, buildingBatchVO);
}
@Override
public String saveBatchReturnId(BuildingBatchVO buildingBatchVO) {
return saveBatchReturnId(null, buildingBatchVO);
}
@Override
public String saveBatchReturnId(String token, BuildingBatchVO buildingBatchVO) {
String buildingId = buildingBatchVO.getBuildingId();
String buildingName = buildingBatchVO.getBuildingName();
BuildingDTO buildingDTO = buildingService.get(buildingId);
if (null != buildingDTO) {
List<BuildingBatchVO.BatchVO> resultList = buildingBatchVO.getResultList();
if (null != resultList && resultList.size() > 0) {
for (BuildingBatchVO.BatchVO batchVO : resultList) {
for (BuildingBatchVO.FloorVO floorVO : batchVO.getFloorList()) {
for (BuildingBatchVO.HouseVO houseVO : floorVO.getHouseList()) {
HouseVO insertHouseVO = new HouseVO();
// 基本信息
insertHouseVO.setResidentialId(buildingDTO.getResidentialId());
insertHouseVO.setResidentialName(buildingDTO.getResidentialName());
insertHouseVO.setStreet(buildingDTO.getStreet());
insertHouseVO.setStreetName(buildingDTO.getStreetName());
insertHouseVO.setCommunity(buildingDTO.getCommunity());
insertHouseVO.setCommunityName(buildingDTO.getCommunityName());
insertHouseVO.setBuildingId(buildingId);
insertHouseVO.setBuildingName(buildingDTO.getName());
insertHouseVO.setAffiliationUnit(Integer.valueOf(batchVO.getUnitValue()));
insertHouseVO.setAffiliationFloors(floorVO.getFloorValue());
insertHouseVO.setHouseNum(houseVO.getHouseValue());
saveReturnId(token, insertHouseVO);
}
}
}
}
}
return buildingId;
}
@Override
public void saveAuto(String token, AutoHouseDTO autoHouseDTO) {
String buildingId = autoHouseDTO.getBuildingId();
BuildingDTO buildingDTO = buildingService.get(buildingId);
if (null != buildingDTO) {
// 楼层数
int floorsNum = buildingDTO.getFloorsNum();
// 单元数
int unitNum = buildingDTO.getUnitNum();
int houseCount = autoHouseDTO.getFloorUnitHouseCount();
for (int unit = 1; unit <= unitNum; unit++) {
for (int floor = 1; floor <= floorsNum; floor++) {
HouseVO houseVO = new HouseVO();
// 基本信息街道社区小区楼栋
houseVO.setStreet(buildingDTO.getStreet());
houseVO.setStreetName(buildingDTO.getStreetName());
houseVO.setCommunity(buildingDTO.getCommunity());
houseVO.setCommunityName(buildingDTO.getCommunityName());
houseVO.setResidentialId(buildingDTO.getResidentialId());
houseVO.setResidentialName(buildingDTO.getResidentialName());
houseVO.setBuildingId(buildingDTO.getBuildingId());
houseVO.setBuildingName(buildingDTO.getName());
// 房屋信息单元楼层房号
houseVO.setAffiliationUnit(unit);
houseVO.setAffiliationFloors(String.valueOf(floor));
for (int house = 1; house <= houseCount; house++) {
houseVO.setHouseNum(floor + "0" + house);
save(token, houseVO);
}
}
}
}
}
}

View File

@ -372,8 +372,10 @@
// 设置所在街道和社区的选中值
var streetName = $('#street').find("option:selected").text();
var communityName = $('#community').find("option:selected").text();
var residentialName = $('#residentialId').find("option:selected").text();
formData.field.streetName = streetName;
formData.field.communityName = communityName;
formData.field.residentialName = residentialName;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);

View File

@ -403,8 +403,10 @@
// 设置所在街道和社区的选中值
var streetName = $('#street').find("option:selected").text();
var communityName = $('#community').find("option:selected").text();
var residentialName = $('#residentialId').find("option:selected").text();
formData.field.streetName = streetName;
formData.field.communityName = communityName;
formData.field.residentialName = residentialName;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);