refactor(property): 将 RemoteUnitService 调整为 RemoteBuildingService
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
parent
0cb299d383
commit
0db07e6d53
@ -0,0 +1,13 @@
|
|||||||
|
package org.dromara.property.api;
|
||||||
|
|
||||||
|
import org.dromara.property.api.domain.vo.RemoteBuildingVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物业楼层远程服务
|
||||||
|
* @author lxj
|
||||||
|
*/
|
||||||
|
public interface RemoteBuildingService {
|
||||||
|
|
||||||
|
RemoteBuildingVo queryBuildingById(Long id);
|
||||||
|
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
package org.dromara.property.api;
|
|
||||||
|
|
||||||
import org.dromara.property.api.domain.vo.RemoteUnitVo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物业楼层远程服务
|
|
||||||
* @author lxj
|
|
||||||
*/
|
|
||||||
public interface RemoteUnitService {
|
|
||||||
|
|
||||||
RemoteUnitVo queryUnitById(Long id);
|
|
||||||
|
|
||||||
}
|
|
@ -11,7 +11,7 @@ import java.io.Serializable;
|
|||||||
* @author lxj
|
* @author lxj
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class RemoteUnitVo implements Serializable {
|
public class RemoteBuildingVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = -11L;
|
private static final long serialVersionUID = -11L;
|
||||||
@ -21,31 +21,19 @@ public class RemoteUnitVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 园区id
|
||||||
|
*/
|
||||||
private Long communityId;
|
private Long communityId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 建筑名称
|
* 建筑名称
|
||||||
*/
|
*/
|
||||||
private Long buildingId;
|
private String buildingName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单元名称
|
* 总层数
|
||||||
*/
|
*/
|
||||||
private String unitName;
|
private Long floorCount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 单元层数
|
|
||||||
*/
|
|
||||||
private Integer floorCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单元户数
|
|
||||||
*/
|
|
||||||
private Integer householdCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 楼梯数量
|
|
||||||
*/
|
|
||||||
private Integer stairCount;
|
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package org.dromara.property.dubbo;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.dromara.property.api.RemoteBuildingService;
|
||||||
|
import org.dromara.property.api.domain.vo.RemoteBuildingVo;
|
||||||
|
import org.dromara.property.domain.vo.TbBuildingVo;
|
||||||
|
import org.dromara.property.domain.vo.TbUnitVo;
|
||||||
|
import org.dromara.property.service.ITbBuildingService;
|
||||||
|
import org.dromara.property.service.ITbUnitService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对外提供的远程服务调用
|
||||||
|
*
|
||||||
|
* @author lxj
|
||||||
|
*/
|
||||||
|
@DubboService
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RemoteBuildingServiceImpl implements RemoteBuildingService {
|
||||||
|
|
||||||
|
private final ITbBuildingService iTbBuildingService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteBuildingVo queryBuildingById(Long id) {
|
||||||
|
TbBuildingVo tbBuildingVo = iTbBuildingService.queryById(id);
|
||||||
|
if(tbBuildingVo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
RemoteBuildingVo remoteBuildingVo = new RemoteBuildingVo();
|
||||||
|
remoteBuildingVo.setId(tbBuildingVo.getId());
|
||||||
|
remoteBuildingVo.setCommunityId(tbBuildingVo.getCommunityId());
|
||||||
|
remoteBuildingVo.setBuildingName(tbBuildingVo.getBuildingName());
|
||||||
|
remoteBuildingVo.setFloorCount(tbBuildingVo.getFloorCount());
|
||||||
|
return remoteBuildingVo;
|
||||||
|
}
|
||||||
|
}
|
@ -1,39 +0,0 @@
|
|||||||
package org.dromara.property.dubbo;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
|
||||||
import org.dromara.property.api.RemoteUnitService;
|
|
||||||
import org.dromara.property.api.domain.vo.RemoteUnitVo;
|
|
||||||
import org.dromara.property.domain.vo.TbUnitVo;
|
|
||||||
import org.dromara.property.service.ITbUnitService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对外提供的远程服务调用
|
|
||||||
*
|
|
||||||
* @author lxj
|
|
||||||
*/
|
|
||||||
@DubboService
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class RemoteUnitServiceImpl implements RemoteUnitService {
|
|
||||||
|
|
||||||
private final ITbUnitService tbUnitService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RemoteUnitVo queryUnitById(Long id) {
|
|
||||||
TbUnitVo tbUnitVo = tbUnitService.queryById(id);
|
|
||||||
if(tbUnitVo == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
RemoteUnitVo remoteUnitVo = new RemoteUnitVo();
|
|
||||||
remoteUnitVo.setId(tbUnitVo.getId());
|
|
||||||
remoteUnitVo.setCommunityId(tbUnitVo.getCommunityId());
|
|
||||||
remoteUnitVo.setBuildingId(tbUnitVo.getBuildingId());
|
|
||||||
remoteUnitVo.setUnitName(tbUnitVo.getUnitName());
|
|
||||||
remoteUnitVo.setFloorCount(tbUnitVo.getFloorCount());
|
|
||||||
remoteUnitVo.setHouseholdCount(tbUnitVo.getHouseholdCount());
|
|
||||||
remoteUnitVo.setStairCount(tbUnitVo.getStairCount());
|
|
||||||
return remoteUnitVo;
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,8 +13,8 @@ import org.dromara.common.core.utils.MapstructUtils;
|
|||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.property.api.RemoteUnitService;
|
import org.dromara.property.api.RemoteBuildingService;
|
||||||
import org.dromara.property.api.domain.vo.RemoteUnitVo;
|
import org.dromara.property.api.domain.vo.RemoteBuildingVo;
|
||||||
import org.dromara.sis.domain.SisDeviceBindRef;
|
import org.dromara.sis.domain.SisDeviceBindRef;
|
||||||
import org.dromara.sis.domain.SisElevatorInfo;
|
import org.dromara.sis.domain.SisElevatorInfo;
|
||||||
import org.dromara.sis.domain.bo.SisElevatorInfoBo;
|
import org.dromara.sis.domain.bo.SisElevatorInfoBo;
|
||||||
@ -45,7 +45,7 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
|||||||
private final ISisDeviceBindRefService deviceBindRefService;
|
private final ISisDeviceBindRefService deviceBindRefService;
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private RemoteUnitService remoteUnitService;
|
private RemoteBuildingService remoteBuildingService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询电梯基本信息
|
* 查询电梯基本信息
|
||||||
@ -137,17 +137,23 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insertByBo(SisElevatorInfoBo bo) {
|
public Boolean insertByBo(SisElevatorInfoBo bo) {
|
||||||
// 验证单元是否存在
|
// 验证建筑是否存在
|
||||||
RemoteUnitVo remoteUnitVo = remoteUnitService.queryUnitById(bo.getUnitId());
|
RemoteBuildingVo remoteBuildingVo = remoteBuildingService.queryBuildingById(bo.getBuildingId());
|
||||||
Assert.notNull(remoteUnitVo, "社区单元信息不存在。");
|
Assert.notNull(remoteBuildingVo, "建筑信息不存在。");
|
||||||
|
|
||||||
|
// 数据转换
|
||||||
SisElevatorInfo add = MapstructUtils.convert(bo, SisElevatorInfo.class);
|
SisElevatorInfo add = MapstructUtils.convert(bo, SisElevatorInfo.class);
|
||||||
Assert.notNull(add, "电梯信息处理失败。");
|
Assert.notNull(add, "电梯信息处理失败。");
|
||||||
add.setCommunityId(remoteUnitVo.getCommunityId());
|
|
||||||
add.setBuildingId(remoteUnitVo.getBuildingId());
|
assert add != null;
|
||||||
|
add.setCommunityId(remoteBuildingVo.getCommunityId());
|
||||||
|
add.setBuildingId(remoteBuildingVo.getId());
|
||||||
// 生成电梯编码
|
// 生成电梯编码
|
||||||
String code = ELEVATOR_CONTROL_CODE_PREFIX + IdUtil.getSnowflakeNextIdStr();
|
String code = ELEVATOR_CONTROL_CODE_PREFIX + IdUtil.getSnowflakeNextIdStr();
|
||||||
add.setElevatorCode(code);
|
add.setElevatorCode(code);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
Assert.isTrue(flag, "新增电梯信息失败。");
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setElevatorId(add.getElevatorId());
|
bo.setElevatorId(add.getElevatorId());
|
||||||
List<SisDeviceBindRef> ls = new ArrayList<>();
|
List<SisDeviceBindRef> ls = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user