zxc 3 years ago
parent
commit
085ba12372
  1. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java
  2. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java
  3. 26
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java

@ -9,6 +9,7 @@ public interface ImportErrorMsgConstants {
String EXIST_ERROR = "数据已存在";
String UNIT_ERROR = "暂不支持单元数减小";
String UNIT_EXIST_HOUSES_ERROR = "单元下存在房屋,不可修改单元数";
String DOCUMENT_EXIST_ERROR = "文件中存在重复数据";

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java

@ -188,7 +188,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
if (!e.getAddStatus()){
nums.add(e.getNum());
BuildingInfoModel buildingInfoModel = ConvertUtils.sourceToTarget(e, BuildingInfoModel.class);
disposeErrorMsg(buildingInfoModel,ImportErrorMsgConstants.UNIT_ERROR);
disposeErrorMsg(buildingInfoModel,ImportErrorMsgConstants.UNIT_EXIST_HOUSES_ERROR);
e.setAddStatus(true);
}
});

26
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -44,10 +44,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerGridConstant;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dao.IcNeighborHoodDao;
import com.epmet.dao.IcPropertyManagementDao;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
@ -121,6 +118,10 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
private OssFeignClient ossFeignClient;
@Autowired
private ExecutorService executorService;
@Autowired
private IcBuildingUnitDao icBuildingUnitDao;
@Autowired
private IcHouseDao icHouseDao;
@Override
public PageData<IcNeighborHoodDTO> page(Map<String, Object> params) {
@ -598,7 +599,22 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
info.setBuildingExistStatus(true);
if (info.getBuildingUpdateStatus()){
if (info.getTotalUnitNum() < building.getTotalUnitNum()){
info.setBuildingUnitNumStatus(true);
/**
* 需求变动
* 单元数可以修改变小先去校验,单元下存在房屋就报错不存在删除对应单元更新楼栋单元数
* 校验规则单元号倒序校验原来的单元数 - 现在单元数个单元下是不是存在房屋存在房屋不能更新
*/
Integer size = building.getTotalUnitNum() - info.getTotalUnitNum();
List<String> ids = icBuildingUnitDao.getUnitIdByBuildingId(building.getId(), size);
if (!org.springframework.util.CollectionUtils.isEmpty(ids)){
Integer houseCount = icHouseDao.getHouseCountByUnitIds(ids);
if (houseCount.compareTo(NumConstant.ZERO) != NumConstant.ZERO){
info.setBuildingUnitNumStatus(true);
}else {
icBuildingUnitDao.delUnit(ids);
icBuildingService.updateBuilding(info);
}
}
}else {
info.setBuildingId(building.getId());
icBuildingService.updateBuilding(info);

Loading…
Cancel
Save