1.户室同步优化,增加带楼层的房屋号
This commit is contained in:
gaoben 2021-08-13 16:08:09 +08:00
parent 122f8ac4d3
commit 1c6fb64a91
5 changed files with 26 additions and 12 deletions

View File

@ -203,8 +203,11 @@ public class TenCellController extends AbstractController {
@ApiOperation("删除小区") @ApiOperation("删除小区")
@RequiresPermissions("ten:cell") @RequiresPermissions("ten:cell")
//@RequiresPermissions("ten:cell:delete") //@RequiresPermissions("ten:cell:delete")
public R syncRoomAddress(@RequestParam("cellId") Long cellId){ public R syncRoomAddress(@RequestParam("cellId") Long cellId,@RequestParam("layerFlag") Integer layerFlag){
int count = tenRoomService.syncAddress(cellId); if(layerFlag ==null){
layerFlag = 0;
}
int count = tenRoomService.syncAddress(cellId,layerFlag);
return R.ok().put("count",count); return R.ok().put("count",count);
} }
} }

View File

@ -30,7 +30,7 @@ public interface TenCellService extends IService<TenCellEntity> {
void updateByIdResis(TenCellEntity cell); void updateByIdResis(TenCellEntity cell);
int syncRoomAddress(Long cellId); int syncRoomAddress(Long cellId,Integer layerFlag);
} }

View File

@ -49,6 +49,6 @@ public interface TenRoomService {
List<TenRoomEntity> getNotSync(Long paramLong); List<TenRoomEntity> getNotSync(Long paramLong);
int syncAddress(Long cellId); int syncAddress(Long cellId,Integer layerFlag);
} }

View File

@ -181,7 +181,7 @@ public class TenCellServiceImpl extends ServiceImpl<TenCellDao, TenCellEntity> i
} }
@Override @Override
public int syncRoomAddress(Long cellId) { public int syncRoomAddress(Long cellId,Integer layerFlag) {
return tenRoomService.syncAddress(cellId); return tenRoomService.syncAddress(cellId,layerFlag);
} }
} }

View File

@ -205,7 +205,7 @@ public class TenRoomServiceImpl implements TenRoomService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int syncAddress(Long cellId) { public int syncAddress(Long cellId,Integer layerFlag) {
List<TenRoomEntity> allRooms = tenRoomDao.getNotBindByCellId(cellId); List<TenRoomEntity> allRooms = tenRoomDao.getNotBindByCellId(cellId);
TenCellEntity cellEntity = tenCellService.getById(cellId); TenCellEntity cellEntity = tenCellService.getById(cellId);
int count = 0; int count = 0;
@ -217,12 +217,23 @@ public class TenRoomServiceImpl implements TenRoomService {
String unit = buildEntity.getUnit(); String unit = buildEntity.getUnit();
String layer = roomEntity.getLayer().toString(); String layer = roomEntity.getLayer().toString();
String roomNumber = roomEntity.getRoomNumber().toString(); String roomNumber = roomEntity.getRoomNumber().toString();
String address = ""+buildNumber+""+unit+"单元"+layer+""+roomNumber+"";
//查询可以关联的标准地址 //查询可以关联的标准地址
List<TenAddressEntity> searchAddressList = tenAddressService.list(new QueryWrapper<TenAddressEntity>() List<TenAddressEntity> searchAddressList = new ArrayList<>();
.eq("dzjb",14) if(layerFlag.intValue() == 0){
.eq("xqid",xqid) String address = ""+buildNumber+""+unit+"单元"+layer+""+roomNumber+"";
.like("dzqc",address)); searchAddressList = tenAddressService.list(new QueryWrapper<TenAddressEntity>()
.eq("dzjb",14)
.eq("xqid",xqid)
.like("dzqc",address));
}
if(layerFlag.intValue() == 1){
String address = ""+buildNumber+""+unit+"单元"+layer+""+layer+"0?"+roomNumber+"";
searchAddressList = tenAddressService.list(new QueryWrapper<TenAddressEntity>()
.eq("dzjb",14)
.eq("xqid",xqid)
.last("and dzqc REGEXP '"+address+"'"));
}
//查询关联的是否已经绑定 //查询关联的是否已经绑定
if(searchAddressList.size() == 1){ if(searchAddressList.size() == 1){
TenAddressEntity addressEntity = searchAddressList.get(0); TenAddressEntity addressEntity = searchAddressList.get(0);