feat(elevator): 1
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
0db07e6d53
commit
7c52b9b851
@ -135,12 +135,12 @@ public class SisElevatorInfoBo extends BaseEntity {
|
||||
/**
|
||||
* 建筑id
|
||||
*/
|
||||
@NotNull(message = "建筑不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
@ -153,6 +153,19 @@ public class SisElevatorInfoBo extends BaseEntity {
|
||||
*/
|
||||
private DeviceInfo elevatorControlDeviceId;
|
||||
|
||||
/**
|
||||
* 通道信息
|
||||
*/
|
||||
private List<ChannelInfo> channels;
|
||||
|
||||
|
||||
@Data
|
||||
public static class ChannelInfo {
|
||||
private Long floorId;
|
||||
private Long inChannel;
|
||||
private Long outChannel;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class DeviceInfo {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.domain.vo.SisElevatorFloorChannelRefVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
@ -8,8 +9,9 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
* 电梯⇄楼层⇄通道关联Mapper接口
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
* @since 2025-08-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface SisElevatorFloorChannelRefMapper extends BaseMapperPlus<SisElevatorFloorChannelRef, SisElevatorFloorChannelRefVo> {
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||
* 电梯⇄楼层⇄通道关联Service接口
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
* @since 2025-08-04
|
||||
*/
|
||||
public interface ISisElevatorFloorChannelRefService {
|
||||
|
||||
@ -66,4 +66,13 @@ public interface ISisElevatorFloorChannelRefService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量增加电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param elevatorId 电梯id
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
Boolean batchInsert(Long elevatorId, Collection<SisElevatorFloorChannelRef> bo);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.sis.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -15,6 +16,7 @@ import org.dromara.sis.domain.vo.SisElevatorFloorChannelRefVo;
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.mapper.SisElevatorFloorChannelRefMapper;
|
||||
import org.dromara.sis.service.ISisElevatorFloorChannelRefService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -40,7 +42,7 @@ public class SisElevatorFloorChannelRefServiceImpl implements ISisElevatorFloorC
|
||||
* @return 电梯⇄楼层⇄通道关联
|
||||
*/
|
||||
@Override
|
||||
public SisElevatorFloorChannelRefVo queryById(Long id){
|
||||
public SisElevatorFloorChannelRefVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@ -114,7 +116,7 @@ public class SisElevatorFloorChannelRefServiceImpl implements ISisElevatorFloorC
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisElevatorFloorChannelRef entity){
|
||||
private void validEntityBeforeSave(SisElevatorFloorChannelRef entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@ -127,9 +129,29 @@ public class SisElevatorFloorChannelRefServiceImpl implements ISisElevatorFloorC
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量增加电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param elevatorId 电梯id
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsert(Long elevatorId, Collection<SisElevatorFloorChannelRef> bo) {
|
||||
// 先删除通道关系
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisElevatorFloorChannelRef::getElevatorId, elevatorId);
|
||||
baseMapper.delete(lqw);
|
||||
|
||||
boolean flag = baseMapper.insertBatch(bo);
|
||||
Assert.isTrue(flag, "批量增加电梯⇄楼层⇄通道关联信息失败");
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,14 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.api.RemoteBuildingService;
|
||||
import org.dromara.property.api.domain.vo.RemoteBuildingVo;
|
||||
import org.dromara.sis.domain.SisDeviceBindRef;
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.domain.SisElevatorInfo;
|
||||
import org.dromara.sis.domain.bo.SisElevatorInfoBo;
|
||||
import org.dromara.sis.domain.enums.ControlTypeEnum;
|
||||
import org.dromara.sis.domain.vo.SisElevatorInfoVo;
|
||||
import org.dromara.sis.mapper.SisElevatorInfoMapper;
|
||||
import org.dromara.sis.service.ISisDeviceBindRefService;
|
||||
import org.dromara.sis.service.ISisElevatorFloorChannelRefService;
|
||||
import org.dromara.sis.service.ISisElevatorInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -43,6 +45,7 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
|
||||
private final SisElevatorInfoMapper baseMapper;
|
||||
private final ISisDeviceBindRefService deviceBindRefService;
|
||||
private final ISisElevatorFloorChannelRefService elevatorFloorChannelRefService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteBuildingService remoteBuildingService;
|
||||
@ -182,6 +185,22 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
Boolean b = deviceBindRefService.batchInsert(ls);
|
||||
Assert.isTrue(b, "设备绑定关联关系写入失败!");
|
||||
}
|
||||
|
||||
// 写入电梯⇄楼层⇄通道关联表
|
||||
if(!bo.getChannels().isEmpty()){
|
||||
Collection<SisElevatorFloorChannelRef> channelRefs = new ArrayList<>();
|
||||
for (SisElevatorInfoBo.ChannelInfo channelInfo : bo.getChannels()) {
|
||||
SisElevatorFloorChannelRef ref = new SisElevatorFloorChannelRef();
|
||||
ref.setElevatorId(add.getElevatorId());
|
||||
ref.setFloorId(channelInfo.getFloorId());
|
||||
ref.setInChannel(channelInfo.getInChannel());
|
||||
ref.setOutChannel(channelInfo.getOutChannel());
|
||||
channelRefs.add(ref);
|
||||
}
|
||||
Boolean b = elevatorFloorChannelRefService.batchInsert(add.getElevatorId(), channelRefs);
|
||||
Assert.isTrue(b, "电梯楼层通道关联关系写入失败!");
|
||||
}
|
||||
|
||||
// hik sdk 登录
|
||||
// short port = bo.getControlPort().shortValue();
|
||||
// Boolean isLogin = HikApiService.getInstance().login(bo.getControlIp(), port, bo.getControlAccount(), bo.getControlPwd());
|
||||
@ -230,6 +249,21 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
Boolean b = deviceBindRefService.batchInsert(ls);
|
||||
Assert.isTrue(b, "设备绑定关联关系写入失败!");
|
||||
}
|
||||
|
||||
// 写入电梯⇄楼层⇄通道关联表
|
||||
if(!bo.getChannels().isEmpty()){
|
||||
Collection<SisElevatorFloorChannelRef> channelRefs = new ArrayList<>();
|
||||
for (SisElevatorInfoBo.ChannelInfo channelInfo : bo.getChannels()) {
|
||||
SisElevatorFloorChannelRef ref = new SisElevatorFloorChannelRef();
|
||||
ref.setElevatorId(update.getElevatorId());
|
||||
ref.setFloorId(channelInfo.getFloorId());
|
||||
ref.setInChannel(channelInfo.getInChannel());
|
||||
ref.setOutChannel(channelInfo.getOutChannel());
|
||||
channelRefs.add(ref);
|
||||
}
|
||||
Boolean b = elevatorFloorChannelRefService.batchInsert(update.getElevatorId(), channelRefs);
|
||||
Assert.isTrue(b, "电梯楼层通道关联关系写入失败!");
|
||||
}
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user