Browse Source

房屋码改为楼栋码+单元+房号

master
zhangyuan 3 years ago
parent
commit
cb5f7fa30f
  1. 28
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/personroom/service/impl/EpidemicBuildingUnitServiceImpl.java
  2. 1
      epdc-cloud-vim-yushan/src/main/resources/mapper/personroom/EpidemicBuildingUnitDao.xml
  3. 1
      epdc-cloud-vim-yushan/src/main/resources/mapper/personroom/EpidemicPlotBuildingDao.xml

28
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/personroom/service/impl/EpidemicBuildingUnitServiceImpl.java

@ -37,6 +37,7 @@ import com.elink.esua.epdc.dto.UploadToOssDTO;
import com.elink.esua.epdc.dto.epidemic.DictOptionDTO;
import com.elink.esua.epdc.dto.house.result.EpdcPopulationErrorResultDTO;
import com.elink.esua.epdc.dto.personroom.EpidemicBuildingUnitDTO;
import com.elink.esua.epdc.dto.personroom.EpidemicPlotBuildingDTO;
import com.elink.esua.epdc.dto.personroom.EpidemicUnitOwnerDTO;
import com.elink.esua.epdc.dto.personroom.form.GetHouseInfoFormDTO;
import com.elink.esua.epdc.dto.personroom.form.HouseInfoFormDTO;
@ -55,6 +56,7 @@ import com.elink.esua.epdc.vaccine.house.excel.BaseResidentInformationUpdateExce
import com.elink.esua.epdc.vaccine.personroom.dao.EpidemicBuildingUnitDao;
import com.elink.esua.epdc.vaccine.personroom.dao.EpidemicUnitOwnerDao;
import com.elink.esua.epdc.vaccine.personroom.entity.EpidemicBuildingUnitEntity;
import com.elink.esua.epdc.vaccine.personroom.entity.EpidemicPlotBuildingEntity;
import com.elink.esua.epdc.vaccine.personroom.entity.EpidemicUnitOwnerEntity;
import com.elink.esua.epdc.vaccine.personroom.redis.EpidemicBuildingUnitRedis;
import com.elink.esua.epdc.vaccine.personroom.service.EpidemicBuildingUnitService;
@ -192,8 +194,11 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui
}
checkData(dto);
if (dto.getBuildingId() != null && dto.getUnit() != null && dto.getRoomNo() != null) {
String showCode = getRoomCodeShow(dto.getBuildingId(), dto.getUnit(), dto.getRoomNo());
dto.setRoomCodeShow(showCode);
EpidemicPlotBuildingDTO building = epidemicPlotBuildingService.get(dto.getBuildingId());
if (building != null) {
String showCode = getRoomCodeShow(building.getBuildingCode(), dto.getUnit(), dto.getRoomNo());
dto.setRoomCodeShow(showCode);
}
}
EpidemicBuildingUnitEntity entity = ConvertUtils.sourceToTarget(dto, EpidemicBuildingUnitEntity.class);
insert(entity);
@ -378,7 +383,7 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui
if (dto.getBuildingId() != null && StringUtils.isNotBlank(dto.getUnit()) && StringUtils.isNotBlank(dto.getRoomNo())) {
EpidemicBuildingUnitEntity entity = new EpidemicBuildingUnitEntity();
entity.setRoomCode(dto.getId().toString());
entity.setRoomCodeShow(getRoomCodeShow(dto.getBuildingId(), dto.getUnit(), dto.getRoomNo()));
entity.setRoomCodeShow(getRoomCodeShow(dto.getBuildingCode(), dto.getUnit(), dto.getRoomNo()));
entity.setId(dto.getId());
updateList.add(entity);
}
@ -695,7 +700,7 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui
insert(unitEntity);
unitEntity.setRoomCode(unitEntity.getId().toString());
if (item.getUnit() != null && item.getRoomNo() != null) {
String showCode = getRoomCodeShow(buildingOptional.get().getId(), item.getUnit(), item.getRoomNo());
String showCode = getRoomCodeShow(buildingOptional.get().getBuildingCode(), item.getUnit(), item.getRoomNo());
unitEntity.setRoomCodeShow(showCode);
}
updateUnitList.add(unitEntity);
@ -760,7 +765,7 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui
insert(unitEntity);
unitEntity.setRoomCode(unitEntity.getId().toString());
if (item.getUnit() != null && item.getRoomNo() != null) {
String showCode = getRoomCodeShow(buildingOptional.get().getId(), item.getUnit(), item.getRoomNo());
String showCode = getRoomCodeShow(buildingOptional.get().getBuildingCode(), item.getUnit(), item.getRoomNo());
unitEntity.setRoomCodeShow(showCode);
}
@ -801,10 +806,11 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui
}
private String getRoomCodeShow(Long buildingId, String unit, String roomNo) {
String orgId = "370211010042";
String showBuildingCode = buildingId.toString().substring(buildingId.toString().length() - 6);
return orgId.concat(showBuildingCode).concat(getRoomMaCode(unit, roomNo));
private String getRoomCodeShow(String buildingCode, String unit, String roomNo) {
if (StringUtils.isBlank(buildingCode)) {
return "";
}
return buildingCode.concat(getRoomMaCode(unit, roomNo));
}
private String getRoomMaCode(String unit, String roomNo) {
@ -819,12 +825,12 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui
roomNum = "0";
}
if (unitNum.length() < 3) {
if (unitNum.length() < NumConstant.THREE) {
unitCode = String.format("%03d", Integer.parseInt(unitNum));
} else {
unitCode = unitNum.substring(unitNum.length() - 3);
}
if (roomNum.length() < 4) {
if (roomNum.length() < NumConstant.FOUR) {
roomCode = String.format("%04d", Integer.parseInt(roomNum));
} else {
roomCode = roomNum.substring(roomNum.length() - 4);

1
epdc-cloud-vim-yushan/src/main/resources/mapper/personroom/EpidemicBuildingUnitDao.xml

@ -247,6 +247,7 @@
u.ROOM_CODE,
u.ROOM_MA_CODE,
u.UNIT_MA_CODE,
b.BUILDING_CODE,
b.BUILDING_MA_CODE,
p.PLOT_MA_CODE,
u.MA_URL,

1
epdc-cloud-vim-yushan/src/main/resources/mapper/personroom/EpidemicPlotBuildingDao.xml

@ -178,6 +178,7 @@
b.BUILDING_NAME,
p.id AS plotId,
b.GRID_ID,
b.BUILDING_CODE,
b.BUILDING_MA_CODE,
p.PLOT_MA_CODE,
p.PLOT_NAME

Loading…
Cancel
Save