首页数据

This commit is contained in:
2025-09-01 16:03:46 +08:00
parent 896c501cd6
commit 127e26e0d4
16 changed files with 307 additions and 40 deletions

View File

@ -11,6 +11,7 @@ import com.fuyuanshen.equipment.domain.form.DeviceForm;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
import com.fuyuanshen.equipment.domain.vo.DataOverviewVo;
import java.io.IOException;
import java.util.List;
@ -115,4 +116,10 @@ public interface DeviceService extends IService<Device> {
*/
int webUnBindDevice(Long id);
/**
* 获取数据总览
*
* @return
*/
DataOverviewVo getDataOverview();
}

View File

@ -66,5 +66,13 @@ public interface IDeviceGroupService {
* @param deviceId 设备id
* @return 是否绑定成功
*/
Boolean bindingDevice(@NotEmpty(message = "分组id 不能为空") Long groupId, @NotEmpty(message = "设备id 不能为空") Long[] deviceId);
Boolean bindingDevice(Long groupId, Long[] deviceId);
/**
* 解绑设备分组
*
* @param deviceId 设备id
* @return 是否解绑成功
*/
Boolean groupUnbind( Long[] deviceId);
}

View File

@ -92,6 +92,7 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
vo.setId(group.getId());
vo.setGroupName(group.getGroupName());
vo.setStatus(group.getStatus() == 1 ? "正常" : "禁用");
vo.setParentId(group.getParentId());
vo.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(group.getCreateTime()));
return vo;
}
@ -124,10 +125,12 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
throw new RuntimeException("分组名称已存在,请勿重复添加!!!");
}
// 验证父分组是否存在如果提供了parentId
DeviceGroup pDeviceGroup = baseMapper.selectById(bo.getParentId());
if (bo.getParentId() != null && pDeviceGroup == null) {
throw new RuntimeException("父分组不存在!!!");
if (bo.getParentId() != null) {
// 验证父分组是否存在如果提供了parentId
DeviceGroup pDeviceGroup = baseMapper.selectById(bo.getParentId());
if (bo.getParentId() != null && pDeviceGroup == null) {
throw new RuntimeException("父分组不存在!!!");
}
}
DeviceGroup add = MapstructUtils.convert(bo, DeviceGroup.class);
@ -199,4 +202,27 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
return true;
}
/**
* 解绑设备分组
*
* @param deviceId 设备id
* @return 是否解绑成功
*/
@Override
public Boolean groupUnbind( Long[] deviceId) {
if (deviceId != null && deviceId.length > 0) {
// 创建更新条件
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", Arrays.asList(deviceId));
updateWrapper.set("group_id", null);
// 执行批量更新
deviceMapper.update(updateWrapper);
}
return true;
}
}

View File

@ -30,6 +30,7 @@ import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
import com.fuyuanshen.equipment.domain.vo.DataOverviewVo;
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
import com.fuyuanshen.equipment.enums.DeviceActiveStatusEnum;
@ -595,6 +596,8 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
}
/**
* 查询设备MAC号
*
@ -613,4 +616,14 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
}
/**
* 获取数据总览
*
* @return
*/
@Override
public DataOverviewVo getDataOverview() {
return null;
}
}

View File

@ -157,11 +157,11 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
throw new RuntimeException("设备类型不存在");
}
List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>()
.eq("device_type", deviceTypeGrants.getDeviceTypeId()));
if (CollectionUtil.isNotEmpty(devices)) {
throw new RuntimeException("该设备类型已绑定设备,无法修改!!!");
}
// List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>()
// .eq("device_type", deviceTypeGrants.getDeviceTypeId()));
// if (CollectionUtil.isNotEmpty(devices)) {
// throw new RuntimeException("该设备类型已绑定设备,无法修改!!!");
// }
// 校验设备类型名称
DeviceType dt = deviceTypeMapper.selectOne(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));